<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>RNW Group - Certificate Reference <?php echo e($quotation->id); ?></title>

    <?php if(!empty($html)): ?>
        <style>
            /*Used separately form pdf*/
            body {
                background: #595959
            }
            .invoice-box {
                background: #fff;
                border: 1px solid #eee;
                box-shadow: 0 0 10px 6px rgba(0, 0, 0, .15);
            }
        </style>
    <?php endif; ?>

    <style>
        .together
        {
            page-break-inside: avoid !important;
            padding:15px 0
        }
        .invoice-box{
            max-width: 800px;
            margin: auto;
            padding: 5px 25px;
            font-size: 12px;
            line-height: 18px;
            font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;
            color: #666;
        }

        .invoice-box table{
            width:100%;
            line-height:inherit;
            border-collapse: collapse;
        }

        .invoice-box table td{
            padding: 3px 10px;
            vertical-align:middle;
        }

        .invoice-box table tr.top table td{
            padding-bottom:20px;
        }

        .invoice-box table tr.top table td.title{
            font-size:45px;
            line-height:45px;
        }

        .invoice-box table tr.information table td{
            padding-bottom:40px;
        }

        .invoice-box table tr.heading td{
            background:#00b050;
            border-bottom:1px solid #009145;
            color:#fff
        }

        .invoice-box table tr.primary td{
            background: #ffffff;
            border-bottom: 1px solid #ffffff;
            color: #fff;
        }

        .invoice-box table tr.primary td{
            background: #70a79a;
            border-bottom: 1px solid #629287;
            color: #fff;
        }

        .invoice-box table tr.details td{
            background: #f7f7f7;
            border-bottom: 1px solid #e6e6e6;
        }

        .invoice-box table tr.danger td{
            background: #c0392b;
            border-bottom: 1px solid #a53127;
            color:#fff
        }

        .invoice-box table tr.item td{
            border-bottom:1px solid #eee;
        }

        .invoice-box table tr.item.last td{
            border-bottom:none;
        }

        .invoice-box table tr.total td:nth-child(2){
            border-top:2px solid #eee;
            font-weight:bold;
        }

        /*@media  only screen and (max-width: 600px) {*/
        /*.invoice-box table tr.top table td{*/
        /*width:100%;*/
        /*display:block;*/
        /*text-align:center;*/
        /*}*/

        /*.invoice-box table tr.information table td{*/
        /*width:100%;*/
        /*display:block;*/
        /*text-align:center;*/
        /*}*/
        /*}*/
        .images {
            padding:10px 0;
            text-align: center;
        }
        .images .image {
            width:130px;
            height:130px;
            margin:20px;
            display:inline-block;
            text-align: center;
            vertical-align: middle;
        }
        .images img {
            max-height:130px;
            max-width:130px;
            display:block;
            margin:auto;
            vertical-align: middle;
        }
        label {
            margin: 3px 0;
            font-size: 12px;
            display: block;
            font-weight: bold;
            text-transform: uppercase;
        }
        .review-form {
            margin-top:20px
        }
        .review-form input,
        .review-form select {
            height: 48px;
        }
        .review-form input,
        .review-form textarea,
        .review-form select {
            width: 100%;
            padding: 15px;
            font-size: 14px;
            box-sizing: border-box;
            margin: 0;
            background: #f7f7f7;
            border: none;
            outline: none;
            display: block;
            -webkit-appearance: none;
        }
        .submit-form {
            background:#348eda;
            border:none;
            color:#fff;
            padding:10px 20px;
            font-size: 14px;
            outline:none;
            cursor: pointer;
        }
        .first-input-row label {
            margin-top: 12px;
        }
        td b {
            page-break-inside: avoid !important;
            margin: 4px 0 4px 0;
        }
        * {
            overflow: visible !important;
        }
        .quotation-items table {
            table-layout: fixed;
            width: 100%;
        }
        html, body {
            overflow-x: hidden;
        }
        table, img, blockquote {page-break-inside: avoid;}
    </style>
</head>

<body style='height:50px;overflow:hidden;margin:0;padding:0;'>
<div class="invoice-box">
    <table cellpadding="0" cellspacing="0">
        <tr class="top">
            <td colspan="4">
                <table>
                    <tr>
                        <td class="title">
                            <?php if($quotation->clientId == 84): ?>
                                <img src="<?php echo e(!empty($html) ? url('assets/images/rnw-logo.png') : public_path('assets/images/rnw-logo.png')); ?>" style="width:100%; max-width:200px;">
                            <?php else: ?>
                                <img src="<?php echo e(!empty($html) ? url('assets/images/logo.png') : public_path('/assets/images/logo.png')); ?>" style="width:100%; max-width:200px;">
                            <?php endif; ?>
                        </td>

                        <td align="right">
                            <h2>Certificate</h2>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>

        <tr class="pre-heading">
            <td colspan="4" align="center" style="padding: 20px 5px;border-top: 2px solid;border-bottom: 1px dashed">
                <h4 style="margin: 0 0 10px 0;font-size:22px">You have received your Certificate</h4>
                This identifies the status and value approved for each job from your Application.<br>
                You will be required to upload your single line consolidated invoice to the value of this Certificate
            </td>
        </tr>

        <tr class="information">
            <td colspan="2" style="padding-top:20px;padding-bottom:10px" align="left">
                <b><?php echo e($serviceProvider->name); ?></b><br>
                <?php echo e($serviceProvider->address1); ?><br>
                <?php echo e($serviceProvider->address2); ?><br>
                <?php echo e($serviceProvider->town); ?><br>
                <?php echo e($serviceProvider->city); ?><br>
                <?php echo e($serviceProvider->postcode); ?><br>
                <?php echo e($serviceProvider->telephone); ?>

            </td>
            <td colspan="2" style="padding-top:20px;padding-bottom:10px" align="right">
                <?php if($quotation->clientId == 84): ?>
                    <b>RNW Facilities Management</b><br>
                <?php else: ?>
                    <b>RNW Holdings Limited</b><br>
                <?php endif; ?>
                Willow Park<br>
                Wash Road<br>
                Basildon<br>
                Essex<br>
                SS15 4AZ<br>
                0844 357 2233
            </td>
        </tr>

        <tr class="primary" align="center">
            <td>Certificate Number</td>
            <td>Certificate Date</td>
            <td>Certified by</td>
            <td>Total Certificate Value</td>
        </tr>

        <tr class="details" align="center">
            <td><?php echo e($quotation->id); ?></td>
            <td><?php echo e(date('d/m/Y H:i', strtotime($quotation->created_at))); ?></td>
            <td>RNW FM</td>
            <td>£<?php echo e(number_format($quotation->totalAmount, 2)); ?></td>
        </tr>

    </table>
    <?php if(!empty($quotation->items) && count($quotation->items)): ?>
        <div class="quotation-items">
            <div class="together" style="margin:20px 0 0 0;padding:0">
                <table cellpadding="0" cellspacing="0" style="margin:0;padding:0">
                    <tr class="primary" align="center">
                        <td>Job Ref</td>
                        <td>Building</td>
                        <td>Job Type</td>
                        <td>Discipline</td>
                        <td>Date Logged</td>
                        <td>Date Completed</td>
                        <td>Certificate Status</td>
                        <td>Job Value</td>
                        <td>KPI Charges</td>
                        <td>Certificate Total</td>
                    </tr>
                </table>
            </div>
            <?php foreach($quotation->items as $item): ?>
                <div class="together" style="margin:0;padding:0">
                    <table cellpadding="0" cellspacing="0" style="margin:0;padding:0">
                        <tr class="details" align="left">
                            <td><?php echo e($item->itemTypeId); ?></td>
                            <td><?php echo e(!empty($item->building) ? $item->building->name : 'N/A'); ?></td>
                            <td><?php echo e(!empty($item->job) ? ucwords(strtolower($item->job->jobType)) : 'N/A'); ?></td>
                            <td><?php echo e(!empty($item->job) ? $item->job->discipline : 'N/A'); ?></td>
                            <td><?php echo e(!empty($item->serviceProviderJob) ? date('d/m/Y H:i', strtotime($item->serviceProviderJob->created_at)) : 'N/A'); ?></td>
                            <td><?php echo e(!empty($item->lastVisit) ? date('d/m/Y H:i', strtotime($item->lastVisit->checkoutTime)) : 'N/A'); ?></td>
                            <td><b><?php echo e(ucwords(strtolower($item->itemStatus == 'APPROVED' ? 'AGREED' : $item->itemStatus))); ?></b></td>
                            <td>&pound; <?php echo e(number_format($item->itemTotalPrice, 2)); ?></td>
                            <td>&pound; <?php echo e(number_format($item->kpiValue, 2)); ?></td>
                            <td>&pound; <?php echo e(number_format($item->jobValue, 2)); ?></td>
                        </tr>
                        <?php if(!empty($item->itemComments)): ?>
                            <tr class="plain" align="left">
                                <td colspan="10">Comments: <?php echo e($item->itemComments); ?></td>
                            </tr>
                        <?php endif; ?>
                        <?php if(!empty($item->job->kpiCharge)): ?>
                            <?php foreach($item->job->kpiCharge as $aKpiCharge): ?>
                                <tr class="plain" align="left">
                                    <td colspan="1">
                                        KPI:
                                    </td>
                                    <td colspan="7">
                                        <?php echo e($aKpiCharge->itemDescription); ?>

                                    </td>
                                    <td colspan="2">
                                        &pound; <?php echo e(number_format($aKpiCharge->itemTotalPrice, 2)); ?>

                                    </td>
                                </tr>
                            <?php endforeach; ?>
                        <?php endif; ?>
                    </table>
                </div>
            <?php endforeach; ?>
        </div>
    <?php endif; ?>
    <h4 align="right" style="margin:20px 0 0 0;padding:0">Total Certificate Value: £<?php echo e(number_format($quotation->totalAmount, 2)); ?></h4>
    <h4 align="right" style="margin:3px 0;padding:0">Please raise your invoice plus VAT</h4>
    <br>
    <div class="together">
        <div align="center">
            RNW Group | Willow Park | Wash road | Basildon | SS15 4AZ<br>
            <?php if(!empty($quotation->clientId) && $quotation->clientId == 84): ?>
                T: 0844 357 2233 E: mothercare@rnwgroup.com W: www.rnwgroup.com
            <?php else: ?>
                T: 0843 1234 567 E: help@rnwgroup.com
            <?php endif; ?>
        </div>
    </div>
</div>
</body>
</html>