<?php $__env->startSection('title','Transport Jobs'); ?>
<?php $__env->startSection('page_title','Transport Jobs'); ?>
<?php $__env->startSection('content'); ?>
<div class="page-head"><div><h1>Transport Jobs</h1><p>Plan dispatch, track delivery, POD, revenue, cost and profit.</p></div><?php if(auth()->user()->hasPermission('transport_jobs.create')): ?><a class="btn btn-primary" href="<?php echo e(route('jobs.create')); ?>">+ New Job</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="Job, customer, PO, location"><select class="control" name="status"><option value="">All statuses</option><?php $__currentLoopData = ['enquiry','confirmed','scheduled','in_transit','delivered','pod_received','ready_to_invoice','invoiced','closed','cancelled']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $s): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($s); ?>" <?php if(request('status')===$s): echo 'selected'; endif; ?>><?php echo e(ucwords(str_replace('_',' ',$s))); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select><button class="btn btn-secondary">Filter</button></form><span class="muted"><?php echo e($jobs->total()); ?> jobs</span></div>
<div class="table-wrap"><table class="table"><thead><tr><th>Job</th><th>Date</th><th>Customer</th><th>Route / Service</th><th>Trips</th><th>Revenue</th><th>Cost</th><th>Profit</th><th>Status</th><th></th></tr></thead><tbody><?php $__empty_1 = true; $__currentLoopData = $jobs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $job): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><tr><td><strong><?php echo e($job->job_number); ?></strong><div class="muted"><?php echo e($job->customer_po); ?></div></td><td><?php echo e($job->job_date->format('d M Y')); ?></td><td><?php echo e($job->customer?->legal_name); ?></td><td><?php echo e($job->route?->name ?? ($job->pickup_location.' → '.$job->delivery_location)); ?><div class="muted"><?php echo e($job->serviceType?->name); ?></div></td><td><?php echo e($job->number_of_trips); ?></td><td>AED <?php echo e(number_format((float)$job->actual_revenue,2)); ?></td><td>AED <?php echo e(number_format((float)$job->actual_cost,2)); ?></td><td class="<?php echo e((float)$job->profit<0?'badge-red':''); ?>">AED <?php echo e(number_format((float)$job->profit,2)); ?></td><td><span class="badge status-<?php echo e($job->status); ?>"><?php echo e(ucwords(str_replace('_',' ',$job->status))); ?></span></td><td><a class="btn btn-secondary btn-sm" href="<?php echo e(route('jobs.show',$job)); ?>">Open</a></td></tr><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><tr><td colspan="10" class="empty">No jobs found.</td></tr><?php endif; ?></tbody></table></div><?php echo e($jobs->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/jobs/index.blade.php ENDPATH**/ ?>