{{-- Danh sách đơn từ (/approval/order) - nạp lại bằng AJAX khi tìm kiếm / lọc trạng thái. Style bảng dùng chung .crm-list-table (components.css) + phần riêng .order-* (cuối components.css). Giữ hook JS: #checkAll, input[getdataitem] (chọn đơn để duyệt hàng loạt). --}} @php // Loại đơn: [nhãn, icon, modifier màu] $orderTypes = [ 0 => ['Đơn nghỉ', 'fas fa-calendar-times', 'leave'], 1 => ['Check-in/Check-out', 'fas fa-user-clock', 'checkin'], 2 => ['Tăng ca', 'fas fa-business-time', 'overtime'], ]; // Trạng thái: [nhãn, icon, modifier màu] $orderStatuses = [ 0 => ['Chờ duyệt', 'fas fa-hourglass-half', 'pending'], 1 => ['Đã duyệt', 'fas fa-check-circle', 'approved'], 2 => ['Không duyệt', 'fas fa-ban', 'rejected'], ]; @endphp
@forelse($docs as $item) @php $type = $orderTypes[$item->type] ?? $orderTypes[2]; $status = $orderStatuses[$item->status] ?? $orderStatuses[2]; $fullName = (string) @$item->user->full_name; $words = preg_split('/\s+/u', trim($fullName)); $initial = mb_strtoupper(mb_substr(end($words) ?: '?', 0, 1)); $detailUrl = '/approval/order/show/' . $item->id . '/' . $item->type; @endphp @empty @endforelse
Nhân viên Loại đơn Trạng thái Phòng ban / Chức vụ Lý do Ngày tạo Chi tiết
{{ $initial }}
{{ $fullName }} @if(@$item->user->code) {{ $item->user->code }} @endif
{{ $type[0] }} {{ $status[0] }}
{{ @$item->user->department->name ?: '—' }} {{ @$item->user->roles->name }}
{{ @$item->reason->name ?: '—' }} @if($item->created_at) {{ \Carbon\Carbon::parse($item->created_at)->format('d/m/Y') }} {{ \Carbon\Carbon::parse($item->created_at)->format('H:i') }} @endif
Không có đơn từ nào