<?php $__env->startSection('content'); ?>
<div class="col-md-12 content-header" >
    <h1><i class="fa fa-file-pdf-o"></i> <?php echo e(trans('application.invoices')); ?></h1>
</div>

<section class="content">
    <div class="row">
        <div class="col-lg-12">
            <div class="box  box-primary">
                <?php if(hasPermission('add_invoice')): ?>
                    <div class="box-header with-border">
                        <h3 class="box-title pull-right">
                        <div class="box-tools ">
                            <a href="<?php echo e(route('invoices.create')); ?>" class="btn btn-primary btn-xs"> <i class="fa fa-plus"></i> <?php echo e(trans('application.new_invoice')); ?></a>
                        </div>
                        </h3>
                    </div>
                <?php endif; ?>
                <div class="box-body">
                    <div class="table-responsive">
                        <table class="table table-bordered table-striped table-hover datatable">
                        <thead>
                        <tr>
                            <th width="5%"></th>
                            <th width="10%"><?php echo e(trans('application.invoice_number')); ?></th>
                            <th width="10%"><?php echo e(trans('application.status')); ?></th>
                            <th width="10%"><?php echo e(trans('application.client')); ?></th>
                            <th width="10%"><?php echo e(trans('application.phone')); ?></th>
                            <th width="10%"><?php echo e(trans('application.due_date')); ?></th>
                            <th width="10%" class="text-right"><?php echo e(trans('application.amount')); ?></th>
                            <th width="10%" class="text-right"><?php echo e(trans('application.paid')); ?></th>
                            <th width="10%" class="text-right"><?php echo e(trans('application.amount_due')); ?></th>
                            <th width="15%"><?php echo e(trans('application.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->client->phone); ?></td>
                            <td><?php echo e($invoice->due_date); ?> </td>
                            <td class="text-right"><?php echo e($invoice->currency.' '.format_amount($invoice->totals['grandTotal'])); ?> </td>
                            <td class="text-right"><?php echo e($invoice->currency.' '.format_amount($invoice->totals['paid'])); ?> </td>
                            <td class="text-right"><?php echo e($invoice->currency.' '.format_amount($invoice->totals['amountDue'])); ?> </td>
                            <td>
                                <?php if(hasPermission('view_invoice')): ?>
                                    <?php echo show_btn('invoices.show', $invoice->uuid); ?>
                                <?php endif; ?>
                                    <a href="<?php echo e(url('invoices/pdf',$invoice->uuid)); ?>" data-rel="tooltip" data-placement="top" title="<?php echo e(trans('application.download_invoice')); ?>" class="btn btn-xs btn-primary"><i class="fa fa-download"></i> </a>
                                <?php if(hasPermission('add_payment')): ?>
                                   <a href="<?php echo e(route('payments.create','invoice_id='.$invoice->uuid)); ?>" data-rel="tooltip" data-toggle="ajax-modal" data-placement="top" title="<?php echo e(trans('application.add_payment')); ?>" class="btn btn-xs btn-warning"><i class="fa fa-usd"></i> </a>
                                <?php endif; ?>
                                <?php if(hasPermission('edit_invoice')): ?>
                                   <a href="<?php echo e(route('invoices.edit',$invoice->uuid)); ?>" data-rel="tooltip" data-placement="top" title="<?php echo e(trans('application.edit_invoice')); ?>" class="btn btn-xs btn-success"><i class="fa fa-pencil"></i></a>
                                <?php endif; ?>
                                <?php if(hasPermission('delete_invoice')): ?>
                                    <?php echo delete_btn('invoices.destroy', $invoice->uuid); ?>
                                <?php endif; ?>
                            </td>
                        </tr>
                        <?php endforeach; ?>
                        </tbody>
                    </table>
                    </div>
                </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(); ?>