ldc-cocotte/resources/views/bo/orders/index-list.blade.php

61 lines
2.6 KiB
PHP

<div class="table-responsive">
<table class="fix-action table">
<thead>
@php
$cols = [
'customer' => Str::ucfirst(trans_choice('models.classes.customers', 1)),
'reference' => Str::ucfirst(__('validation.custom.attributes.reference')),
'date' => Str::ucfirst(__('validation.custom.attributes.order_date')),
'total' => Str::ucfirst(__('validation.custom.attributes.total')),
'pickup_date' => Str::ucfirst(__('validation.custom.attributes.pickup_date')),
'shop' => Str::ucfirst(trans_choice('models.classes.shops', 1)),
'status' => Str::ucfirst(__('validation.custom.attributes.order_status')),
];
@endphp
@include('bo.modules.tableColSorter', [
'cols' => $cols,
'mobileHide' => [],
'ignore' => ['customer', 'pickup_date'],
'defaultSortCol' => 'date',
'defaultSortWay' => 'desc',
])
</thead>
<tbody>
@forelse ($orders as $order)
<tr>
<td>
<span class="d-block">{{ Str::title($order->employee->lastname) }} {{ Str::title($order->employee->firstname) }}</span>
</td>
<td>{{ $order->reference }}</td>
<td>{{ Date::forHumans($order->created_at) }}</td>
<td>@money($order->total)</td>
<td>{{ $order->pickup_day ? Date::forHumansDate($order->pickup_day) : __('No Content') }}</td>
<td>{{ $order->shop?->name ?? __('No Content') }}</td>
<td>{{ $order->status->label() }}</td>
<td>
<div class="btn-group">
@can('view', $order)
<a class="btn btn-sm btn-primary" data-bs-toggle="tooltip" href="{{ route('bo.orders.show', $order) }}"
title="{{ __('crud.helpers.view_model', ['model' => Str::ucfirst(trans_choice('models.classes.orders', 1))]) }}">
<i class="fas fa-info"></i>
</a>
@endcan
@can('cancel', $order)
<form class="d-inline confirmCancelJS" action="{{ route('bo.orders.cancel', $order) }}" method="POST">
@csrf
<button class="btn btn-sm btn-danger rounded-start-0" title="{{ __('Cancel the order') }}">
<i class="fa-solid fa-times"></i></button>
</form>
@endcan
</div>
</td>
@empty
<tr>
<td class="text-center" colspan="20">
<span class="h3">{{ __('crud.helpers.no_results') }}</span>
</td>
</tr>
@endforelse
</tbody>
</table>
</div>