<?php $__env->startSection('title','Vendor Bills'); ?>
<?php $__env->startSection('page_title','Vendor Bills'); ?>
<?php $__env->startSection('content'); ?>
<div class="page-head"><div><h1>Vendor Bills</h1><p>Record subcontractor, fuel, maintenance and operating supplier invoices.</p></div><?php if(auth()->user()->hasPermission('vendor_bills.create')): ?><a class="btn btn-primary" href="<?php echo e(route('bills.create')); ?>">+ New Vendor Bill</a><?php endif; ?></div>
<div class="card"><div class="toolbar"><form class="search"><input class="control" name="search" value="<?php echo e(request('search')); ?>" placeholder="Bill, vendor invoice or vendor"><select class="control" name="status" style="max-width:180px"><option value="">All statuses</option><?php $__currentLoopData = \App\Enums\DocumentStatus::cases(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $status): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($status->value); ?>" <?php if(request('status')===$status->value): echo 'selected'; endif; ?>><?php echo e(ucwords(str_replace('_',' ',$status->value))); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select><button class="btn btn-secondary">Filter</button></form><span class="muted"><?php echo e($bills->total()); ?> bills</span></div><div class="table-wrap"><table class="table"><thead><tr><th>Internal Bill</th><th>Vendor Invoice</th><th>Date</th><th>Vendor</th><th>Total</th><th>Paid / Allocated</th><th>Balance</th><th>Status</th><th>Actions</th></tr></thead><tbody>
<?php $__empty_1 = true; $__currentLoopData = $bills; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $bill): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><?php ($status=$bill->status instanceof \App\Enums\DocumentStatus?$bill->status->value:$bill->status); ?><tr><td><strong><?php echo e($bill->bill_number); ?></strong></td><td><?php echo e($bill->vendor_invoice_number); ?></td><td><?php echo e($bill->invoice_date->format('d M Y')); ?></td><td><?php echo e($bill->party?->legal_name); ?></td><td><?php echo e($bill->currency_code); ?> <?php echo e(number_format((float)$bill->grand_total,2)); ?></td><td><?php echo e(number_format((float)$bill->allocated_total,2)); ?></td><td><?php echo e(number_format((float)$bill->grand_total-(float)$bill->allocated_total,2)); ?></td><td><span class="badge status-<?php echo e($status); ?>"><?php echo e(ucwords(str_replace('_',' ',$status))); ?></span></td><td><div class="actions"><a class="btn btn-secondary btn-sm" href="<?php echo e(route('bills.show',$bill)); ?>">Open</a><a class="btn btn-secondary btn-sm" target="_blank" href="<?php echo e(route('bills.print',$bill)); ?>">Print</a></div></td></tr><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><tr><td colspan="9" class="empty">No vendor bills found.</td></tr><?php endif; ?></tbody></table></div><?php echo e($bills->links()); ?></div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/cbo/public_html/resources/views/bills/index.blade.php ENDPATH**/ ?>