Code |
Region |
Store |
Pickup Location |
Amount |
Collect |
Driver |
Status |
|
@if($orders->isEmpty())
No orders! |
@else
@foreach($orders as $order)
@php
$statuses = getStatus();
$status = "Unknown";
if (array_key_exists($order->status, $statuses)) {
$statusClass = match ($order->status) {
-1 => 'bg-danger-subtle text-danger',
0 => 'bg-secondary-subtle text-secondary',
2 => 'bg-primary-subtle text-primary',
3 => 'bg-info-subtle text-info',
4 => 'bg-warning-subtle text-warning',
1 => 'bg-success-subtle text-success',
default => 'bg-secondary-subtle text-secondary',
};
$status = '' . $statuses[$order->status] . '';
}
$collect_method = 'Unknown';
if($order->collect_method == 'D'){
$collect_method = 'Delivery';
}
elseif($order->collect_method == 'P'){
$collect_method = 'Pickup';
} elseif($order->collect_method == 'PL'){
$collect_method = 'Pickup Location';
}
$driver = '-';
if($order->collect_method == 'D'){
if(!empty($order->order_pickup) && !empty($order->order_pickup->driver)){
$driver = $order->order_pickup->driver->first_name.' '.$order->order_pickup->driver->last_name.' ('.$order->order_pickup->driver->username.')';
}
} elseif($order->collect_method == 'PL'){
if(!empty($order->pickup_location) && !empty($order->pickup_location->driver)){
$driver = $order->pickup_location->driver->first_name.' '.$order->pickup_location->driver->last_name.' ('.$order->pickup_location->driver->username.')';
}
}
@endphp
{{ $order->code }} |
{{ $order->region->name }} |
{{ is_null($order->store_id) ? '-' : $order->store->name }} |
{{ is_null($order->pickup_location_id) ? '-' : $order->pickup_location->name }} |
{{ $order->total_amount }} |
{!! $collect_method !!} |
{{ $driver }} |
{!! $status !!} |
|
@endforeach
@endif
{{ $orders->appends(\Request::query())->links('vendor.pagination.custom-pagination') }}