<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800;900&display=swap" rel="stylesheet">
    <title><?php echo e(__('pdf.estimation.title', [], $estimation->lang)); ?> <?php echo e($estimation->name); ?></title>
    <style>
        @page :first {
            size: A4 portrait;
            margin: 20px 5px;
            padding: 0px;
        }

        @page {
            size: A4 portrait;
            margin: 500px 5px;
            padding: 0px;

            @top-center {
                content: " ";
                display: block;
                margin-top: 1cm;
            }
        }

        * {
            box-sizing: border-box;
        }

        body {
            margin: 0px;
            padding: 0px;
            font-family: 'Montserrat', sans-serif;
            font-weight: 500;
        }

        a {
            color: inherit;
            text-decoration: none;
        }

        hr {
            margin: 1cm 0;
            height: 0;
            border: 0;
            border-top: 1mm solid var(--highlight-color);
        }

        header h1,
        header h2,
        header h3,
        header p {
            margin: 0;
        }

        header hr {
            margin: 1cm 0 .5cm 0;
        }

        main table {
            width: 100%;
            border-collapse: collapse;
        }

        main table thead th {
            height: 1cm;
            color: var(--highlight-color);
        }

        main table thead th:nth-of-type(2),
        main table thead th:nth-of-type(3),
        main table thead th:last-of-type {
            width: 2.5cm;
        }

        main table tbody td {
            padding: 1mm 0;
            border-bottom: 0.5mm solid var(--table-row-separator-color);
        }

        main table thead th:last-of-type,
        main table tbody td:last-of-type {
            text-align: right;
        }

        main table th {
            text-align: left;
        }

        th:last-of-type {
            padding-right: 0 !important;
        }

        .main--container {
            padding: 40px 60px 0 40px;
        }

        /* HEADER */
        .header {
            margin: 20px 40px 40px 40px;
            padding: 40px;
            background-color: #313233;
            color: #fff;
        }

        .header .header-logo>* {
            display: inline-block;
            vertical-align: middle;
            margin-bottom: 15px;
        }

        .header .header-logo>img {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            object-fit: cover;
            margin-right: 10px;
        }

        .header .header-logo .workspace_name {
            font-size: 18px;
        }

        .header .header-info,
        .header-issued_by {
            display: inline-block;
        }

        .header .header-issued_by {
            float: right;
            text-align: end;
        }

        .header .header-info-text,
        .header-issued_by--text {
            font-size: 14px;
        }

        .header .header-issued_by--label,
        .header-info--label {
            font-size: 14px;
            font-weight: 600;
        }

        .estimation-title {
            margin: 0;
        }

        /* TASK TABLE */
        .entries-table {
            table-layout: fixed;
        }

        .entries-table th {
            font-size: 13px;
            padding-right: 10px;
        }

        .text-center-width-14 {
            width: 14%;
            text-align: center;
        }

        .entries-table .entry-name {
            text-transform: uppercase;
            font-weight: 600;
        }

        .entries-table .task-name {
            font-size: 11px;
            font-weight: 600;
            padding-right: 10px;
        }

        .entries-table .task-value {
            font-size: 11px;
            font-weight: 600;
        }

        .column-details--label {
            text-align: center;
        }

        /* SUMMARY */
        .summary {
            margin-top: 40px;
        }

        .summary-total {
            font-weight: 700 !important;
            font-size: 14px;
        }

        .summary-value {
            font-size: 14px;
            font-weight: 600;
        }

        /* FOOTER */
        #footer {
            position: fixed;
            left: 50%;
            transform: translateX(-50%);
            bottom: 0;
            color: #aaa;
            font-size: 0.9em;
        }

        footer .note--label {
            font-size: 13px;
            font-weight: 600;
            margin: 0;
        }

        footer .note--content {
            font-size: 12px;
            margin-top: 5px;
            font-weight: 500;
        }

        footer .note--divider {
            margin: 15px 0 5px;
            background-color: #485460;
        }

        .page-number:before {
            content: "<?php echo e(__('pdf.estimation.page', [], $estimation->lang)); ?> " counter(page);
            font-size: 12px;
            font-weight: lighter;
            color: #485460;
        }
    </style>
</head>

<body>
    <div id="footer">
        <div class="page-number"></div>
    </div>
    <header class="header">
        <div>
            <div class="header-logo">
                <img src="<?php echo e($logo); ?>" alt="" />
                <h1 class="workspace_name"><?php echo e($workspace_name); ?></h1>
            </div>
            <div>

                <div>
                    <div class="header-info">
                        <p class="header-info-text">
                            <span class="header-info--label"><?php echo e(__('pdf.estimation.date', [], $estimation->lang)); ?></span>: <?php echo e($estimation->updated_at->format('d.m.Y')); ?>

                        </p>
                        <p class="header-info-text">
                            <span class="header-info--label"><?php echo e(__('pdf.estimation.client', [], $estimation->lang)); ?></span>: <?php echo e($estimation->client_name); ?>

                        </p>
                        <p class="header-info-text">
                            <span class="header-info--label"><?php echo e(__('pdf.estimation.project', [], $estimation->lang)); ?></span>: <?php echo e($estimation->project_name); ?>

                        </p>
                    </div>
                    <div class="header-issued_by">
                        <h3 class="header-issued_by--label"><?php echo e(__('pdf.estimation.issued_by', [], $estimation->lang)); ?>:</h3>
                        <p class="header-issued_by--text">
                            <?php echo e($user->name); ?> </br>
                            <?php echo e($user->email); ?> </br>
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </header>
    <h1 style="padding: 0px 40px" class="estimation-title"><?php echo e($estimation->name); ?></h1>

    <main class="main--container">

        <?php $__currentLoopData = $estimation->columns; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $column): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <table class="entries-table">
            <thead>
                <tr>
                    <th class=" entry-name"><?php echo e($column->name); ?></th>
                    <th class="column-details--label"><?php echo e(__('pdf.estimation.hours', [], $estimation->lang)); ?></th>
                    <th class="column-details--label"><?php echo e(__('pdf.estimation.price', [], $estimation->lang)); ?></th>
                    <th style="text-align: right;"> <?php echo e(__('pdf.estimation.sum', [], $estimation->lang)); ?></th>
                </tr>
            </thead>
            <tbody>
                <?php $__currentLoopData = $column->estimationTasks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $task): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php if($task->is_fixed && $task->pivot->value !== null): ?>
                <tr style="margin-top: 5px;">
                    <td class="task-name">
                        <?php echo e($task->name); ?>

                    </td>
                    <td class="task-value text-center-width-14 ">
                        -
                    </td>
                    <td class="task-value text-center-width-14 ">
                        -
                    </td>
                    <td class="task-value" style="text-align: right; width: 14%;">
                        <?php echo e($task->pivot->value); ?> <?php echo e($estimation->currency); ?>

                    </td>
                </tr>
                <?php elseif(!$task->is_fixed && $task->pivot->value !== null): ?>
                <tr style="margin-top: 5px;">
                    <td style="width: 55%;" class="task-name">
                        <?php echo e($task->name); ?>

                    </td>
                    <td class="task-value text-center-width-14">
                        <?php echo e($task->pivot->value); ?>

                    </td>
                    <td class="task-value text-center-width-14">
                        <?php echo e($column->rate); ?>

                    </td>
                    <td class="task-value" style="text-align: right; width: 14%;">
                        <?php echo e($task->pivot->value * $column->rate); ?> <?php echo e($estimation->currency); ?>

                    </td>
                </tr>
                <?php endif; ?>
                <?php if($loop->last): ?>
                <tr>
                    <td colspan="4" style="font-weight: 700; padding-top: 10px; white-space: nowrap ; padding-bottom: 15px; font-size: 14px; ">
                        <?php echo e(number_format($column->fixed_value + $column->hours_sum_value, 2)); ?> <?php echo e($estimation->currency); ?>

                    </td>
                </tr>
                <?php endif; ?>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
        </table>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        <table class="summary" style="page-break-inside: avoid;">
            <tr>
                <th class="summary-value">
                    <?php echo e(__('pdf.estimation.hours_sum', [], $estimation->lang)); ?>

                </th>
                <td class="summary-value">
                    <?php echo e($estimation->hours_sum); ?>

                </td>
            </tr>
            <tr>
                <th class="summary-value">
                    <?php echo e(__('pdf.estimation.hours_value_sum', [], $estimation->lang)); ?>

                </th>
                <td class="summary-value">
                    <?php echo e(number_format($estimation->hours_value_sum, 2)); ?> <?php echo e($estimation->currency); ?>

                </td>
            </tr>
            <tr>
                <th class="summary-value">
                    <?php echo e(__('pdf.estimation.fixed_value_sum', [], $estimation->lang)); ?>

                </th>
                <td class="summary-value">
                    <?php echo e(number_format($estimation->fixed_value_sum, 2)); ?> <?php echo e($estimation->currency); ?>

                </td>
            </tr>

            <?php if($estimation->discount_value): ?>
            <tr>
                <th class="summary-value">
                    <?php echo e(__('pdf.estimation.before_discount', [], $estimation->lang)); ?>

                </th>
                <td class="summary-value">
                    <?php echo e(number_format($estimation->hours_value_sum + $estimation->fixed_value_sum, 2)); ?> <?php echo e($estimation->currency); ?>

                </td>
            </tr>
            <tr>
                <th class="summary-value">
                    <?php echo e(__('pdf.estimation.discount', [], $estimation->lang)); ?>

                </th>
                <td class="summary-value">
                    <?php echo e(number_format($estimation->discount_value, 2)); ?> <?php echo e($estimation->discount_type === 'percentage' ? '%' : $estimation->currency); ?>

                </td>
            </tr>
            <tr>
                <th class="summary-total">
                    <?php echo e(__('pdf.estimation.total', [], $estimation->lang)); ?>

                </th>
                <td class="summary-total">
                    <?php echo e($estimation->discount_type === 'percentage' ? number_format(($estimation->hours_value_sum + $estimation->fixed_value_sum) * (1 - $estimation->discount_value / 100), 2) : number_format(($estimation->hours_value_sum + $estimation->fixed_value_sum) - $estimation->discount_value, 2)); ?> <?php echo e($estimation->currency); ?>

                </td>
            </tr>
            <?php else: ?>
            <tr>
                <th class="summary-total">
                    <?php echo e(__('pdf.estimation.total', [], $estimation->lang)); ?>

                </th>
                <td class="summary-total">
                    <?php echo e(number_format($estimation->hours_value_sum + $estimation->fixed_value_sum, 2)); ?> <?php echo e($estimation->currency); ?>

                </td>
            </tr>
            <?php endif; ?>
        </table>
        <?php if($estimation->pdf_note): ?>
        <footer>
            <div>
                <hr class="note--divider">
                <h3 class="note--label"><?php echo e(__('pdf.estimation.note', [], $estimation->lang)); ?></h3>
                <p class="note--content">
                    <?php echo e($estimation->pdf_note); ?>

                </p>
            </div>
        </footer>
        <?php endif; ?>
    </main>


</body>

</html>
<?php /**PATH /var/www/esteamate/esteamate-api/resources/views/pdf/estimation.blade.php ENDPATH**/ ?>