@extends('layouts.master')
@section('title', 'Hotel Booking Details')
@section('content')
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h5 class="mb-0">Hotel Booking Details</h5>
<a href="{{ route('hotel.list') }}" class="btn btn-secondary btn-sm">Back to List</a>
</div>
<div class="card-body">
<form action="{{ route('hotel.status.update', $hotel->id) }}" method="post" onsubmit="return confirmStatusUpdate()">
@csrf
<table class="table table-bordered">
<tbody>
<tr>
<th>Agency</th>
<td>{{ $hotel->agency->name ?? 'N/A' }}</td>
</tr>
<tr>
<th>User</th>
<td>{{ $hotel->user->name ?? 'N/A' }}</td>
</tr>
<tr>
<th>City</th>
<td>{{ $hotel->city ?? '-' }}</td>
</tr>
<tr>
<th>Hotel Name</th>
<td>{{ $hotel->hotel_name }}</td>
</tr>
<tr>
<th>Owner Name</th>
<td>{{ $hotel->owner_name }}</td>
</tr>
<tr>
<th>Representative Name</th>
<td>
{{ $hotel->representative_name ?? '-' }} <br>
{{ $hotel->phone_number ?? '-' }}
</td>
</tr>
<tr>
<th>Tasria</th>
<td>
{{ $hotel->tasria_owner ?? '-' }} <br>
{{ $hotel->tasria_number ?? '-' }}
</td>
</tr>
<tr>
<th>Total Seats</th>
<td>{{ $hotel->total_seat }}</td>
</tr>
<tr>
<th>Double Rooms (Bed 2)</th>
<td>{{ $hotel->double_bed }} Room</td>
</tr>
<tr>
<th>Triple Rooms (Bed 3)</th>
<td>{{ $hotel->triple_bed }} Room</td>
</tr>
<tr>
<th>Quad Rooms (Bed 4)</th>
<td>{{ $hotel->quad_bed }} Room</td>
</tr>
<tr>
<th>Quintuple Rooms (Bed 5)</th>
<td>{{ $hotel->quintuple_bed }} Room</td>
</tr>
<tr>
<th>Allocated Seats</th>
<td>{{ $hotel->allocated_seats }} Seats</td>
</tr>
<tr>
<th>Total Amount</th>
<td>{{ number_format($hotel->amount, 2, '.', ',') }} SAR</td>
</tr>
<tr>
<th>Status</th>
<td>
<div id="status-container">
@if ($hotel->status == 1)
<span class="badge bg-success">Approved</span>
@elseif($hotel->status == 2)
<span class="badge bg-danger">Rejected</span>
@else
<span class="badge bg-secondary">Pending</span>
@endif
</div>
@if (in_array(auth()->user()->role, [1, 2, 3]))
<select class="form-select mt-2" name="status">
<option value="0" {{ $hotel->status == 0 ? 'selected' : '' }}>Pending</option>
<option value="1" {{ $hotel->status == 1 ? 'selected' : '' }}>Approved</option>
<option value="2" {{ $hotel->status == 2 ? 'selected' : '' }}>Rejected</option>
</select>
@endif
</td>
</tr>
<tr>
<th>Approved By</th>
<td>{{ $hotel->approvedBy->name ?? '-' }}</td>
</tr>
<tr>
<th>Created At</th>
<td>{{ $hotel->created_at->format('Y-m-d H:i:s') }}</td>
</tr>
<tr>
<th>Updated At</th>
<td>{{ $hotel->updated_at->format('Y-m-d H:i:s') }}</td>
</tr>
@if (in_array(auth()->user()->role, [1, 2, 3]))
<tr>
<td colspan="2" class="text-end">
<button type="submit" class="btn btn-primary mt-3">Update Status</button>
</td>
</tr>
@endif
</tbody>
</table>
</form>
</div>
</div>
<script>
function confirmStatusUpdate() {
return confirm('Are you sure you want to update the status?');
}
</script>
@endsection