<?php $__env->startSection('content'); ?>
<div class="col-md-12 content-header" >
    <h1><i class="fa fa-quote-left"></i> Invoices</h1>
</div>
<section class="content">

    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-default">
                <div class="row">
                <div class="col-md-6" style="width:880px;margin-left:20px"><br/>
                    <a href="<?php echo e(route('invoices.index')); ?>" class="btn btn-info btn-sm"> <i class="fa fa-chevron-left"></i> Back</a>
                    <a href="<?php echo e(url('invoices/send', $invoice->id)); ?>" class="btn btn-success btn-sm pull-right" style="margin-left: 5px"> <i class="fa fa-share"></i> Send</a>
                    <a href="<?php echo e(url('invoices/pdf', $invoice->id)); ?>" target="_blank" class="btn btn-primary btn-sm pull-right" style="margin-left: 5px"> <i class="fa fa-download"></i> Download</a>
                    <a href="<?php echo e(route('invoices.edit', $invoice->id)); ?>" class="btn btn-warning btn-sm pull-right" > <i class="fa fa-pencil"></i> Edit</a>
                </div>
                </div>
                <div class="panel-body">
                    <div class="row">
                        <div class="invoice">
                            <div class="row">
                                <div class="col-md-3">
                                    <div class="panel-body">
                                        <?php if($invoiceSettings->logo): ?>
                                        <img src="<?php echo e(asset('assets/img/'.$invoiceSettings->logo)); ?>" alt="logo" width="100%"/>
                                        <?php endif; ?>
                                     </div>
                                </div>
                                <div class="col-md-9 text-right">
                                    <div class="panel-body">
                                        <div class="col-xs-12 text-right"> <h1>INVOICE</h1></div>
                                        <div class="col-xs-9 text-right invoice_title">REFERENCE</div>
                                        <div class="col-xs-3 text-right"><?php echo e($invoice->number); ?></div>
                                        <div class="col-xs-9 text-right invoice_title">DATE</div>
                                        <div class="col-xs-3 text-right"><?php echo e($settings ? date($settings->date_format, strtotime($invoice->invoice_date)) : $settings->invoice_date); ?></div>
                                        <div class="col-xs-9 text-right invoice_title">DUE DATE</div>
                                        <div class="col-xs-3 text-right"><?php echo e($settings ? date($settings->date_format, strtotime($invoice->due_date)) : $settings->due_date); ?></div>
                                    </div>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-md-6">
                                        <div class="panel-body">
                                            <h4 class="invoice_title">OUR INFORMATION</h4><hr class="separator"/>
                                            <h4><?php echo e($settings->name); ?></h4>
                                            <?php echo e($settings->address1 ? $settings->address1.',' : ''); ?> <?php echo e($settings->state ? $settings->state : ''); ?><br/>
                                            <?php echo e($settings->city ? $settings->city.',' : ''); ?> <?php echo e($settings->postal_code ? $settings->postal_code.','  : ''); ?><br/>
                                            <?php echo e($settings->country); ?><br/>
                                            Phone: <?php echo e($settings->phone); ?><br/>
                                            Email: <?php echo e($settings->email); ?>.
                                        </div>
                                </div>
                                <div class="col-xs-6">
                                        <div class="panel-body">
                                            <h4 class="invoice_title">BILLING TO </h4><hr class="separator"/>
                                            <h4><?php echo e($invoice->client->name); ?></h4>
                                            <?php echo e($invoice->client->address1 ? $invoice->client->address1.',' : ''); ?> <?php echo e($invoice->client->state ? $invoice->client->state : ''); ?><br/>
                                            <?php echo e($invoice->client->city ? $invoice->client->city.',' : ''); ?> <?php echo e($invoice->client->postal_code ? $invoice->client->postal_code.','  : ''); ?><br/>
                                            <?php echo e($invoice->client->country); ?><br/>
                                            Phone: <?php echo e($invoice->client->phone); ?><br/>
                                            Email: <?php echo e($invoice->client->email); ?>.
                                        </div>
                                </div>
                            </div>
                            <div class="col-md-12">
                            <table class="table">
                                <thead style="margin-bottom:30px;background: #2e3e4e;color: #fff;">
                                <tr>
                                    <th style="width:50%">PRODUCT</th>
                                    <th style="width:10%" class="text-center">QTY</th>
                                    <th style="width:15%" class="text-right">PRICE</th>
                                    <th style="width:10%" class="text-center">TAX</th>
                                    <th style="width:15%" class="text-right">TOTAL</th>
                                </tr>
                                </thead>
                                <tbody id="items">
                                <?php foreach($invoice->items as $item): ?>
                                <tr>
                                    <td><?php echo $item->product->category != '' ? $item->product->category.' - '.$item->product->name : $item->product->name; ?></td>
                                    <td class="text-center"><?php echo e($item->quantity); ?></td>
                                    <td class="text-right"><?php echo e($item->price); ?></td>
                                    <td class="text-center"><?php echo e($item->tax ? $item->tax->value.'%' : ''); ?></td>
                                    <td class="text-right"><?php echo e($invoice->totals[$item->id]['itemTotal']); ?></td>
                                </tr>
                                <?php endforeach; ?>
                                </tbody>
                            </table>
                            </div><!-- /.col -->

                            <div class="col-md-6" style="padding: 7% 12% 0 15%; text-transform: uppercase">
                              <div class="<?php echo e(getStatus('label', 'paid') == $invoice->status ? 'invoice_status_paid' : 'invoice_status_cancelled'); ?>">
                                    <?php echo e(statuses()[$invoice->status]['label']); ?>

                            </div>

                            </div><!-- /.col -->
                            <div class="col-md-6">
                                <div class="table-responsive">
                                    <table class="table">
                                        <tbody>
                                        <tr>
                                            <th style="width:50%">Subtotal</th>
                                            <td class="text-right">
                                                <span id="subTotal"><?php echo e($invoice->currency.' '.$invoice->totals['subTotal']); ?></span>
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>Tax</th>
                                            <td class="text-right">
                                                <span id="taxTotal"><?php echo e($invoice->currency.' '.$invoice->totals['taxTotal']); ?></span>
                                            </td>
                                        </tr>
                                        <?php if($invoice->totals['discount'] > 0): ?>
                                        <tr>
                                            <th>Discount</th>
                                            <td class="text-right">
                                                <span id="taxTotal"><?php echo e($invoice->currency.' '.$invoice->totals['discount']); ?></span>
                                            </td>
                                        </tr>
                                        <?php endif; ?>
                                        <tr>
                                            <th>Total</th>
                                            <td class="text-right">
                                                <span id="grandTotal"><?php echo e($invoice->currency.' '.$invoice->totals['grandTotal']); ?></span>
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>Paid</th>
                                            <td class="text-right">
                                                <span id="grandTotal"><?php echo e($invoice->currency.' '.$invoice->totals['paidFormatted']); ?></span>
                                            </td>
                                        </tr>
                                        <tr class="amount_due">
                                            <th>Amount Due:</th>
                                            <td class="text-right">
                                                <span id="grandTotal"><?php echo e($invoice->currency.' '.$invoice->totals['amountDue']); ?></span>
                                            </td>
                                        </tr>
                                        </tbody></table>
                                </div>
                            </div><!-- /.col -->

                            <div class="col-md-12">
                                <?php if($invoice->notes): ?>
                                <h4 class="invoice_title">NOTES</h4><hr class="separator"/>
                                <?php echo $invoice->notes; ?> <br/><br/>
                                <?php endif; ?>
                                <?php if($invoice->terms): ?>
                                <h4 class="invoice_title">TERMS</h4><hr class="separator"/>
                                <?php echo $invoice->terms; ?>

                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
        <div class="cleafix"></div>
    </div>
</section>

<?php $__env->stopSection(); ?>



<?php echo $__env->make('app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>