<!DOCTYPE html>
<html lang="en"><head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head><body>
<div class="container">
    <div style="width:300px;height:130px;float:left;overflow: hidden">
        <?php if($settings && $settings->logo != ''): ?>
            <img src="<?php echo e(asset('assets/img/'.$settings->logo)); ?>" alt="logo" width="50%"/>
        <?php endif; ?>
    </div>
    <div class="text-right" style="width:300px;height:130px;float:right;">
        <div class="text-right"> <h2><?php echo e(trans('application.invoice')); ?></h2></div>
        <table style="width: 100%">
            <tr>
                <td class="text-right" style="width: 40%"><?php echo e(trans('application.reference')); ?></td>
                <td class="text-right"><?php echo e($invoice->number); ?></td>
            </tr>
            <tr>
                <td class="text-right"><?php echo e(trans('application.date')); ?></td>
                <td class="text-right"><?php echo e($settings ? date($settings->date_format, strtotime($invoice->invoice_date)) : $invoice->date_format); ?></td>
            </tr>
            <tr>
                <td class="text-right"><?php echo e(trans('application.due_date')); ?></td>
                <td class="text-right"><?php echo e($settings ? date($settings->date_format, strtotime($invoice->due_date)) : $invoice->due_date); ?></td>
            </tr>
            <?php if($settings && $settings->vat != ''): ?>
                <tr>
                    <td class="text-right"><?php echo e(trans('application.vat_number')); ?></td>
                    <td class="text-right"><?php echo e($settings ? $settings->vat : ''); ?></td>
                </tr>
            <?php endif; ?>
        </table>
    </div>
    <div style="clear: both"></div>
    <div class="col-md-12">
        <div class="from_address">
            <h4 class="invoice_title"><?php echo e(trans('application.our_information')); ?></h4><hr class="separator"/>
            <?php if($settings): ?>
                <h4><?php echo e($settings->name); ?></h4>
                <?php if($settings->address1 != '' || $settings->state != ''): ?>
                    <?php echo e($settings->address1 ? $settings->address1.',' : ''); ?> <?php echo e($settings->state ? $settings->state : ''); ?><br/>
                <?php endif; ?>
                <?php if($settings->city != '' || $settings->postal_code != ''): ?>
                    <?php echo e($settings->city ? $settings->city.',' : ''); ?> <?php echo e($settings->postal_code ? $settings->postal_code.','  : ''); ?><br/>
                <?php endif; ?>
                <?php if($settings->country != ''): ?>
                    <?php echo e($settings->country); ?><br/>
                <?php endif; ?>
                <?php if($settings->phone != ''): ?>
                    <?php echo e(trans('application.phone')); ?>: <?php echo e($settings->phone); ?><br/>
                <?php endif; ?>
                <?php if($settings->email != ''): ?>
                    <?php echo e(trans('application.email')); ?>: <?php echo e($settings->email); ?>.
                <?php endif; ?>
            <?php endif; ?>
        </div>
        <div class="to_address">
            <h4 class="invoice_title"><?php echo e(trans('application.billing_to')); ?> </h4><hr class="separator"/>
            <h4><?php echo e($invoice->client->name); ?></h4>
            <?php if($invoice->client->address1 != '' || $invoice->client->state != ''): ?>
                <?php echo e($invoice->client->address1 ? $invoice->client->address1.',' : ''); ?> <?php echo e($invoice->client->state ? $invoice->client->state : ''); ?><br/>
            <?php endif; ?>
            <?php if($invoice->client->city != '' || $invoice->client->postal_code != ''): ?>
                <?php echo e($invoice->client->city ? $invoice->client->city.',' : ''); ?> <?php echo e($invoice->client->postal_code ? $invoice->client->postal_code.','  : ''); ?><br/>
            <?php endif; ?>
            <?php if($invoice->client->country != ''): ?>
                <?php echo e($invoice->client->country); ?><br/>
            <?php endif; ?>
            <?php if($invoice->client->phone != ''): ?>
                <?php echo e(trans('application.phone')); ?>: <?php echo e($invoice->client->phone); ?><br/>
            <?php endif; ?>
            <?php if($invoice->client->email != ''): ?>
                <?php echo e(trans('application.email')); ?>: <?php echo e($invoice->client->email); ?>.
            <?php endif; ?>
        </div>
    </div>
    <div style="clear: both"></div>
    <div class="col-md-12">
        <table class="table">
            <tr style="margin-bottom:30px;background: #2e3e4e;color: #fff;" class="item_table_header">
                <th style="width:50%"><?php echo e(trans('application.product')); ?></th>
                <th style="width:10%" class="text-center"><?php echo e(trans('application.quantity')); ?></th>
                <th style="width:15%" class="text-right"><?php echo e(trans('application.price')); ?></th>
                <th style="width:10%" class="text-center"><?php echo e(trans('application.tax')); ?></th>
                <th style="width:15%" class="text-right"><?php echo e(trans('application.total')); ?></th>
            </tr>
            <?php $__currentLoopData = $invoice->items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getFirstLoop(); ?>
                <tr class="items">
                    <td><b><?php echo $item->item_name; ?></b><br/><?php echo $item->item_description; ?></td>
                    <td class="text-center"><?php echo e($item->quantity); ?></td>
                    <td class="text-right"><?php echo e(format_amount($item->price)); ?></td>
                    <td class="text-center"><?php echo e($item->tax ? $item->tax->value.'%' : ''); ?></td>
                    <td class="text-right"><?php echo e(format_amount($invoice->totals[$item->uuid]['itemTotal'])); ?></td>
                </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getFirstLoop(); ?>
        </table>
    </div><!-- /.col -->
    <div class="col-md-12">
        <div class="col-md-6" style="padding: 7% 25% 0 10%;width: 30%; text-transform: uppercase">
            <?php if($invoiceSettings && $invoiceSettings->show_status): ?>
                <div class="<?php echo e($invoice->status == 2 ? 'invoice_status_paid' : 'invoice_status_cancelled'); ?>">
                    <?php echo e(statuses()[$invoice->status]['label']); ?>

                </div>
            <?php endif; ?>
        </div>
        <table class="table">
            <tr>
                <th style="width:75%" class="text-right"><?php echo e(trans('application.subtotal')); ?></th>
                <td class="text-right">
                    <span id="subTotal"><?php echo e($invoice->currency.' '.format_amount($invoice->totals['subTotal'])); ?></span>
                </td>
            </tr>
            <tr>
                <th class="text-right"><?php echo e(trans('application.tax')); ?></th>
                <td class="text-right">
                    <span id="taxTotal"><?php echo e($invoice->currency.' '.format_amount($invoice->totals['taxTotal'])); ?></span>
                </td>
            </tr>
            <?php if($invoice->totals['discount'] > 0): ?>
                <tr>
                    <th class="text-right"><?php echo e(trans('application.discount')); ?></th>
                    <td class="text-right">
                        <span id="taxTotal"><?php echo e($invoice->currency.' '.format_amount($invoice->totals['discount'])); ?></span>
                    </td>
                </tr>
            <?php endif; ?>
            <tr>
                <th class="text-right"><?php echo e(trans('application.total')); ?></th>
                <td class="text-right">
                    <span id="grandTotal"><?php echo e($invoice->currency.' '.format_amount($invoice->totals['grandTotal'])); ?></span>
                </td>
            </tr>
            <tr>
                <th class="text-right"><?php echo e(trans('application.paid')); ?></th>
                <td class="text-right">
                    <span id="grandTotal"><?php echo e($invoice->currency.' '.format_amount($invoice->totals['paidFormatted'])); ?></span>
                </td>
            </tr>
            <tr class="amount_due">
                <th class="text-right"><?php echo e(trans('application.amount_due')); ?>:</th>
                <td class="text-right">
                    <span id="grandTotal"><?php echo e($invoice->currency.' '.format_amount($invoice->totals['amountDue'])); ?></span>
                </td>
            </tr>
        </table>
    </div>
    <div class="col-md-12">
        <?php if($invoice->notes): ?>
            <h4 class="invoice_title"><?php echo e(trans('application.notes')); ?></h4><hr class="separator"/>
            <?php echo $invoice->notes; ?> <br/><br/>
        <?php endif; ?>
        <?php if($invoice->terms): ?>
            <h4 class="invoice_title"><?php echo e(trans('application.terms')); ?></h4><hr class="separator"/>
            <?php echo $invoice->terms; ?>

        <?php endif; ?>
    </div>
</div>
</body></html>
<style>
    body {
        font-family: DejaVu Sans, 'Source Sans Pro','Helvetica Neue',Helvetica,Arial,sans-serif;
        overflow-x: hidden;
        overflow-y: auto;
        font-size: 13px;
    }
    .amount_due {
        font-size: 20px;
        font-weight: 500;
    }
    .invoice_title{
        color: #2e3e4e;
        font-weight: bold;
    }
    .text-right{
        text-align: right;
    }
    .text-center{
        text-align: center;
    }
    .from_address{
        width: 300px;
        float: left;
        height: 220px;
    }
    .to_address{
        width: 300px;
        height: 220px;
        float: right;
    }
    .col-md-12{
        width: 100%;
    }
    .col-md-6{
        width: 50%;
        float: left;
    }
    table {
        border-spacing: 0;
        border-collapse: collapse;
    }
    .table {
        width: 100%;
        max-width: 100%;
        margin-bottom: 20px;
    }
    .item_table_header>th{
        padding: 8px;
        line-height: 1.42857143;
        vertical-align: top;
    }
    .table>tr>td, .table>tr>th{
        padding: 8px;
        line-height: 1.42857143;
        vertical-align: top;
    }
    hr.separator{
        border-color:  #2e3e4e;
        margin-top: 10px;
        margin-bottom: 10px;
    }
    .items>td{
        border: 3px solid #fff !important;
        vertical-align: middle;
    }
    .items{
        background-color: #f1f1f1;
    }
    .invoice_status_cancelled
    {
        font-size : 20px;
        text-align : center;
        color: #cc0000;
        border: 1px solid #cc0000;
    }
    .invoice_status_paid
    {
        font-size : 25px;
        text-align : center;
        color: #82b440;
        border: 1px solid #82b440;
    }
</style>
