<?php $__env->startSection('content'); ?>
<div class="col-md-12 content-header" >
    <h1><i class="fa fa-file-pdf-o"></i> Invoices</h1>
</div>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <!--    Hover Rows  -->
            <a href="<?php echo e(route('invoices.create')); ?>" class="btn btn-primary btn-sm pull-right"> <i class="fa fa-plus"></i> New Invoice</a> <br/><br/>
            <?php if(Session::has('flash_notification.message')): ?>
                <?php echo message(); ?>

            <?php endif; ?>
            <div class="panel panel-default">
                <div class="panel-heading">
                    Invoices
                </div>
                <div class="panel-body">
                    <table class="table table-bordered table-striped table-hover datatable">
                        <thead>
                        <tr>
                            <th></th>
                            <th>No.</th>
                            <th>Status</th>
                            <th>Client</th>
                            <th>Due Date</th>
                            <th class="text-right">Amount</th>
                            <th class="text-right">Paid</th>
                            <th class="text-right">Due</th>
                            <th>Action </th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php foreach($invoices as $invoice): ?>
                        <tr>
                            <td></td>
                            <td><?php echo e($invoice->number); ?> </td>
                            <td ><span class="label <?php echo e(statuses()[$invoice->status]['class']); ?>"><?php echo e(ucwords(statuses()[$invoice->status]['label'])); ?> </span></td>
                            <td><a href="<?php echo e(route('clients.show', $invoice->client_id )); ?>"><?php echo e($invoice->client->name); ?></a> </td>
                            <td><?php echo e($invoice->due_date); ?> </td>
                            <td class="text-right"><?php echo e($invoice->currency.''.$invoice->totals['grandTotal']); ?> </td>
                            <td class="text-right"><?php echo e($invoice->currency.''.$invoice->totals['paid']); ?> </td>
                            <td class="text-right"><?php echo e($invoice->currency.''.$invoice->totals['amountDue']); ?> </td>
                            <td>
                                <a href="<?php echo route('invoices.show',$invoice->id); ?>" data-rel="tooltip" data-placement="top" title="View invoice" class="btn btn-sm btn-info"><i class="fa fa-eye"></i>  </a>
                                <a href="<?php echo url('invoices/pdf',$invoice->id); ?>" data-rel="tooltip" data-placement="top" title="Download invoice" class="btn btn-sm btn-primary"><i class="fa fa-download"></i> </a>
                                <a href="<?php echo route('payments.create','invoice_id='.$invoice->id); ?>" data-rel="tooltip" data-toggle="ajax-modal" data-placement="top" title="Add Payment" class="btn btn-sm btn-warning"><i class="fa fa-money"></i> </a>
                                <a href="<?php echo route('invoices.edit',$invoice->id); ?>" class="btn btn-sm btn-success"><i class="fa fa-pencil"></i> Edit </a>
                                <?php echo delete_btn('invoices.destroy', $invoice->id); ?>

                            </td>
                        </tr>
                        <?php endforeach; ?>
                        </tbody>
                    </table>
                </div>
            </div>
            <!-- End  Hover Rows  -->
        </div>
    </div>
</section>
<?php $__env->stopSection(); ?>

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