24 lines
5.8 KiB
PHP
24 lines
5.8 KiB
PHP
@extends('lodge.admin-layout')
|
||
@section('title','Bookings & overview')
|
||
@section('section-label',request('section') === 'photos' ? 'Photographs' : (request('section') === 'bookings' ? 'Bookings' : 'Overview'))
|
||
@section('content')
|
||
@php
|
||
$section = request('section', 'overview');
|
||
$items = $bookings->getCollection();
|
||
$allCount = $bookings->total();
|
||
$pendingOnPage = $items->where('status','pending')->count();
|
||
$confirmedOnPage = $items->where('status','confirmed')->count();
|
||
$revenueOnPage = $items->where('status','confirmed')->sum('total_pence') / 100;
|
||
@endphp
|
||
@if($section === 'photos')
|
||
<div class="page-heading"><div><div class="eyebrow">PROPERTY MEDIA</div><h1>Photographs</h1><p>Manage the photographs displayed on your lodge website.</p></div><a class="btn secondary" href="{{ route('lodge.admin') }}">← Back to overview</a></div>
|
||
@if(Route::has('lodge.photos.store'))<section class="panel"><div class="panel-heading"><div><h2>Upload photographs</h2><p>Add new images to your lodge gallery.</p></div></div><form method="POST" action="{{ route('lodge.photos.store') }}" enctype="multipart/form-data" class="upload-form">@csrf<label for="photo-upload">Select image</label><input id="photo-upload" type="file" name="photo" accept="image/*" required><button class="btn primary" type="submit">Upload photograph</button></form></section>@endif
|
||
@if(isset($photos) && count($photos))<section class="panel"><div class="panel-heading"><h2>Gallery</h2><span class="count-chip">{{ count($photos) }} photos</span></div><div class="photo-grid">@foreach($photos as $photo)<div class="photo-card">@php $photoPath = $photo->url ?? $photo->path ?? $photo->filename ?? null; @endphp @if($photoPath)<img loading="lazy" src="{{ str_starts_with($photoPath,'http') || str_starts_with($photoPath,'/') ? $photoPath : asset('storage/'.$photoPath) }}" alt="Lodge photograph">@else<div class="photo-placeholder">Image</div>@endif<div class="photo-caption"><span>Photo #{{ $photo->id }}</span>@if(Route::has('lodge.photos.destroy'))<form method="POST" action="{{ route('lodge.photos.destroy',$photo) }}" onsubmit="return confirm('Delete this photograph?')">@csrf @method('DELETE')<button class="link-danger" type="submit">Delete</button></form>@endif</div></div>@endforeach</div></section>@elseif(!Route::has('lodge.photos.store'))<div class="empty-panel">Photo management is not installed in this version of Cresta 31.</div>@else<div class="empty-panel">No uploaded photographs yet.</div>@endif
|
||
@else
|
||
<div class="page-heading"><div><div class="eyebrow">PROPERTY MANAGEMENT</div><h1>{{ $section === 'bookings' ? 'Bookings' : 'Welcome back' }}</h1><p>{{ $section === 'bookings' ? 'Review reservations and update booking statuses.' : 'Here’s what’s happening with your lodge bookings.' }}</p></div><a class="btn secondary" href="{{ url('/') }}" target="_blank" rel="noopener">View website ↗</a></div>
|
||
<div class="stats-grid"><div class="stat-card"><div class="stat-label">Total bookings <span>▤</span></div><div class="stat-value">{{ number_format($allCount) }}</div><div class="stat-foot">All reservations</div></div><div class="stat-card"><div class="stat-label">Pending <span>◷</span></div><div class="stat-value">{{ $pendingOnPage }}</div><div class="stat-foot">On this page</div></div><div class="stat-card"><div class="stat-label">Confirmed <span>✓</span></div><div class="stat-value">{{ $confirmedOnPage }}</div><div class="stat-foot">On this page</div></div><div class="stat-card"><div class="stat-label">Confirmed value <span>£</span></div><div class="stat-value">£{{ number_format($revenueOnPage,2) }}</div><div class="stat-foot">On this page</div></div></div>
|
||
<section class="panel"><div class="panel-heading"><div><h2>{{ $section === 'bookings' ? 'All bookings' : 'Recent bookings' }}</h2><p>Manage guest reservations and their current status.</p></div><span class="count-chip">{{ number_format($allCount) }} total</span></div><div class="table-scroll"><table class="booking-table"><thead><tr><th>Reference</th><th>Guest</th><th>Stay dates</th><th>Guests</th><th>Amount</th><th>Status</th><th>Update</th></tr></thead><tbody>@forelse($bookings as $b)<tr><td><strong class="reference">{{ $b->reference }}</strong></td><td><strong>{{ $b->guest_name }}</strong><small>{{ $b->guest_email }}</small>@if($b->guest_phone)<small>{{ $b->guest_phone }}</small>@endif</td><td><span class="date-cell">{{ $b->check_in?->format('d M Y') }}<br><span class="date-to">to {{ $b->check_out?->format('d M Y') }}</span></span></td><td>{{ $b->guests }}</td><td><strong>£{{ number_format($b->total_pence/100,2) }}</strong></td><td><span class="badge {{ $b->status }}">{{ ucfirst($b->status) }}</span></td><td><form class="update-form" method="POST" action="{{ route('lodge.update',$b) }}">@csrf @method('PATCH')<select name="status" aria-label="Status for {{ $b->reference }}"><option value="pending" @selected($b->status === 'pending')>Pending</option><option value="confirmed" @selected($b->status === 'confirmed')>Confirmed</option><option value="cancelled" @selected($b->status === 'cancelled')>Cancelled</option></select><button type="submit">Save</button></form></td></tr>@empty<tr><td colspan="7" class="empty-table">No bookings yet. New reservations will appear here.</td></tr>@endforelse</tbody></table></div><div class="pagination-area">{{ $bookings->appends(request()->query())->links() }}</div></section>
|
||
@if($section !== 'bookings')<div class="quick-grid"><a class="quick-card" href="{{ route('lodge.admin',['section'=>'bookings']) }}"><span class="quick-icon">▤</span><div><strong>Manage bookings</strong><small>Review and update reservations</small></div><span class="quick-arrow">→</span></a><a class="quick-card" href="{{ route('lodge.admin',['section'=>'photos']) }}"><span class="quick-icon">▧</span><div><strong>Lodge gallery</strong><small>Upload and organise photos</small></div><span class="quick-arrow">→</span></a></div>@endif
|
||
@endif
|
||
@endsection
|