<?php $__env->startSection('title','Purchase Invoices'); ?>
<?php $__env->startSection('content'); ?>
<div class="page-head"><div><h1>Purchase invoices</h1><p>Approved purchases update stock, weighted average cost, supplier payable, input VAT, and journals.</p></div><a href="<?php echo e(route('purchases.create')); ?>" class="btn btn-primary btn-dense"><i class="bi bi-plus-lg me-1"></i>New purchase</a></div>
<div class="card-erp"><div class="card-erp-body"><form class="row g-2 align-items-end"><div class="col-md-6"><label class="form-label">Search purchase, supplier invoice, or supplier</label><input class="form-control" name="q" value="<?php echo e(request('q')); ?>"></div><div class="col-md-3"><label class="form-label">Status</label><select class="form-select" name="status"><option value="">All</option><?php $__currentLoopData = ['draft','finalized','cancelled']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $s): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option <?php if(request('status')===$s): echo 'selected'; endif; ?>><?php echo e($s); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select></div><div class="col-md-3"><button class="btn btn-dark w-100">Apply</button></div></form></div><div class="table-responsive"><table class="table table-dense"><thead><tr><th>Purchase</th><th>Date</th><th>Supplier</th><th>Supplier invoice</th><th>Warehouse</th><th class="text-end">VAT</th><th class="text-end">Total</th><th class="text-end">Balance</th><th>Status</th><th></th></tr></thead><tbody><?php $__empty_1 = true; $__currentLoopData = $purchases; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $purchase): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><tr><td><a class="fw-bold text-accent text-decoration-none" href="<?php echo e(route('purchases.show',$purchase)); ?>"><?php echo e($purchase->purchase_no); ?></a></td><td><?php echo e($purchase->purchase_date->format('d M Y')); ?></td><td><?php echo e($purchase->supplier?->name_en); ?></td><td><?php echo e($purchase->supplier_invoice_no?:'—'); ?></td><td><?php echo e($purchase->warehouse?->code); ?></td><td class="text-end"><?php echo e(number_format((float)$purchase->vat_total,2)); ?></td><td class="text-end fw-bold"><?php echo e(number_format((float)$purchase->grand_total,2)); ?></td><td class="text-end"><?php echo e(number_format((float)$purchase->balance_total,2)); ?></td><td><span class="badge status-<?php echo e($purchase->status); ?>"><?php echo e(strtoupper($purchase->status)); ?></span></td><td><a class="btn btn-light border btn-dense" href="<?php echo e(route('purchases.show',$purchase)); ?>">Open</a></td></tr><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><tr><td colspan="10" class="text-center text-muted py-5">No purchase invoices found.</td></tr><?php endif; ?></tbody></table></div><?php if($purchases->hasPages()): ?><div class="card-erp-body border-top"><?php echo e($purchases->links()); ?></div><?php endif; ?></div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\saudi\resources\views\purchases\index.blade.php ENDPATH**/ ?>