@extends('layouts.admin.app') @section('title', 'Chi tiết booking') @section('content') @php $backUrl = request()->filled('trip_id') ? route('admin.booking-management.trip-bookings', ['tripId' => (int) request('trip_id')]) : route('admin.booking-management.index'); $paymentMethod = $booking->payment?->payment_method; $paymentMethodLabel = match ($paymentMethod) { 'onboard' => 'Thanh toán khi lên xe', 'qr' => 'QR', default => $paymentMethod ? strtoupper($paymentMethod) : '-', }; $bookingStatusLabels = [ 'draft' => 'Nháp', 'reserved' => 'Đã giữ chỗ', 'awaiting_payment' => 'Chờ thanh toán', 'paid' => 'Đã thanh toán', 'cancelled' => 'Đã hủy', 'expired' => 'Hết hạn', ]; $paymentStatusLabels = [ 'pending' => 'Chờ xử lý', 'success' => 'Thành công', 'failed' => 'Thất bại', ]; $bookingStatusText = $bookingStatusLabels[$booking->booking_status] ?? $booking->booking_status; $paymentStatusText = $paymentStatusLabels[$booking->payment_status] ?? $booking->payment_status; $journeyTypeLabels = [ 'one_way' => 'Một chiều', 'round_trip' => 'Hai chiều', ]; $journeyDirectionLabels = [ 'outbound' => 'Chiều đi', 'return' => 'Chiều về', ]; $journeyTypeText = $journeyTypeLabels[$booking->journey_type] ?? 'Một chiều'; $journeyDirectionText = $booking->journey_direction ? $journeyDirectionLabels[$booking->journey_direction] ?? $booking->journey_direction : '-'; $bookingBadgeClass = match ($booking->booking_status) { 'paid' => 'bg-emerald-100 text-emerald-700', 'cancelled' => 'bg-rose-100 text-rose-700', 'expired' => 'bg-gray-200 text-gray-700', 'reserved', 'awaiting_payment' => 'bg-amber-100 text-amber-700', default => 'bg-blue-100 text-blue-700', }; $paymentBadgeClass = match ($booking->payment_status) { 'success' => 'bg-emerald-100 text-emerald-700', 'failed' => 'bg-rose-100 text-rose-700', default => 'bg-amber-100 text-amber-700', }; $canMarkNoShow = in_array($booking->booking_status, ['paid', 'reserved'], true) && !$booking->no_show; $isNoShow = (bool) $booking->no_show; $canDelete = !($booking->booking_status === 'paid' || $booking->payment_status === 'success'); @endphp

Chi tiết booking

{{ $booking->code }}

Theo dõi thông tin khách, trạng thái thanh toán và xử lý đơn tập trung.

@if ($isNoShow) Không lên xe @endif Đặt chỗ: {{ $bookingStatusText }} Thanh toán: {{ $paymentStatusText }}
@if (session('success'))
{{ session('success') }}
@endif @if ($errors->any())
@endif

Thông tin khách hàng

Khách hàng

{{ $booking->customer_name }}

Số điện thoại

{{ $booking->customer_phone }}

Email

{{ $booking->customer_email ?: '-' }}

Thông tin chuyến và ghế

Tuyến

{{ $booking->trip?->route?->fromStation?->name }} - {{ $booking->trip?->route?->toStation?->name }}

Giờ chạy

{{ $booking->trip?->depart_at?->format('d/m/Y H:i') }}

Ghế đã đặt

{{ $booking->items->pluck('seat_code_snapshot')->implode(', ') }}

Phương thức thanh toán

{{ $paymentMethodLabel }}

Loại hành trình

{{ $journeyTypeText }}

Chiều

{{ $journeyDirectionText }}

Mã nhóm khứ hồi

{{ $booking->booking_group_code ?: '-' }}

@if ($isNoShow)

Không lên xe

Lúc {{ $booking->no_show_at?->format('d/m/Y H:i') }}

@endif

Tóm tắt thanh toán

Mã booking {{ $booking->code }}
Booking {{ $bookingStatusText }}
Thanh toán {{ $paymentStatusText }}
{{-- [TEMPORARILY HIDDEN: Hiển thị tổng tiền]
Tổng tiền {{ number_format($booking->total_amount) }}đ
[END HIDDEN] --}}

Xử lý booking

@if ($isNoShow)
Đơn đã được đánh dấu không lên xe. Ghế đã được giải phóng.
@elseif (in_array($booking->booking_status, ['cancelled', 'expired'], true))

Đơn này đã ở trạng thái cuối, không thể xử lý tiếp.

@elseif ($booking->booking_status === 'paid') {{-- Đã thu tiền: chỉ no-show --}}
@csrf
@elseif ($booking->booking_status === 'reserved') {{-- Thanh toán khi lên xe: pending — admin cần nút xác nhận đã thu tiền; vẫn cho hủy / no-show --}}
@if ($booking->payment_status === 'pending')
@csrf
@endif
@csrf
@csrf
@else {{-- draft / awaiting_payment: xác nhận thanh toán (QR hoặc chuyển khoản) hoặc hủy --}}
@csrf
@csrf
@endif
← Quay lại danh sách @if ($canDelete)
@csrf @method('DELETE') @if (request()->filled('trip_id')) @endif
@endif
@endsection