@php $duplicateDetails = $details ->where('is_duplicate', true) ->where('status', 'pending'); @endphp
Mã đặt chỗ: {{ $booking->booking_code ?? 'N/A' }} | Ngày đặt: {{ isset($booking->created_at) ? \Carbon\Carbon::parse($booking->created_at)->format('d/m/Y') : 'N/A' }}
Yêu cầu này có {{ $details->count() }} ngày, trong đó có {{ $duplicateDetails->count() }} ngày bị trùng lịch.
@if($duplicateDetails->count() > 0)Các ngày bị trùng: {{ $duplicateDetails->pluck('booking_date')->map(fn($date) => \Carbon\Carbon::parse($date)->format('d/m/Y'))->implode(', ') }}
@endif| Ngày đặt | Giờ bắt đầu - Giờ kết thúc | Trạng thái | Thao tác |
|---|---|---|---|
|
{{ \Carbon\Carbon::parse($detail->booking_date)->format('d/m/Y') }}
{{-- Hiển thị ngày trong tuần, in hoa chữ cái đầu tiên của mỗi từ --}} {{ ucwords(\Carbon\Carbon::parse($detail->booking_date)->translatedFormat('l')) }} |
{{ \Carbon\Carbon::parse($detail->start_time)->format('H:i') }} - {{ \Carbon\Carbon::parse($detail->end_time)->format('H:i') }}
@if($detail->is_duplicate)
|
{{-- Trạng thái, nếu bị trùng thì hiện text bị trùng --}}
@php
if ($detail->is_duplicate) {
$statusConfig = [
'label' => 'Trùng lịch',
'style' => 'background-color: #fee2e2; color: #991b1b; padding: 4px 10px; border-radius: 9999px; font-size: 12px; font-weight: 500;'
];
if ($detail->status == 'rejected') {
$statusConfig['label'] .= ' (đã từ chối)';
}
} else {
$statusConfig = match($detail->status) {
'pending' => ['label' => 'Chờ duyệt', 'style' => 'background-color: #fef3c7; color: #92400e; padding: 4px 10px; border-radius: 9999px; font-size: 12px; font-weight: 500;'],
'approved' => ['label' => 'Đã duyệt', 'style' => 'background-color: #dcfce7; color: #166534; padding: 4px 10px; border-radius: 9999px; font-size: 12px; font-weight: 500;'],
'rejected' => ['label' => 'Đã từ chối', 'style' => 'background-color: #fee2e2; color: #991b1b; padding: 4px 10px; border-radius: 9999px; font-size: 12px; font-weight: 500;'],
'cancelled' => ['label' => $detail->cancelled_by_customer ? 'Đã hủy bởi khách hàng' : 'Đã hủy', 'style' => 'background-color: #f3f4f6; color: #374151; padding: 4px 10px; border-radius: 9999px; font-size: 12px; font-weight: 500;'],
default => ['text' => 'Không xác định', 'color' => 'text-gray-500'],
};
}
@endphp
{{ $statusConfig['label'] }}
|
{{-- Nút từ chối cho ngày có status pending hoặc bị trùng lịch --}}
@if(($detail->status === 'pending' || $detail->is_duplicate) && $detail->status != 'rejected')
@endif
{{-- Nút hủy cho ngày có status approved --}}
@if($detail->status === 'approved')
@endif
|