{{-- File: resources/views/guests/show.blade.php --}} @extends('admin-layouts.master') @section('title', 'Detail Tamu - ' . $guest->name) @section('content')
{{ strtoupper(substr($guest->name, 0, 1)) }}

{{ $guest->name }}

@if($guest->phone)
{{ $guest->phone }}
@endif @if($guest->email)
{{ $guest->email }}
@endif
Terdaftar {{ $guest->created_at->diffForHumans() }} @if($guest->bookings->count() >= 5) VIP Guest @endif @php $hasActiveBooking = $guest->bookings->whereIn('status', ['booked', 'checked_in'])->count() > 0; @endphp @if($hasActiveBooking) Sedang Menginap @endif
Edit Data {{-- --}}
{{ $guest->bookings->count() }}
Total Booking
{{ $guest->bookings->where('status', 'checked_out')->count() }}
Selesai Menginap
@php $totalSpent = $guest->bookings->sum(function($booking) { return $booking->bookingDetails->sum('grand_total'); }); @endphp Rp {{ number_format($totalSpent, 0, ',', '.') }}
Total Pengeluaran
@php $lastBooking = $guest->bookings->sortByDesc('created_at')->first(); @endphp {{ $lastBooking ? $lastBooking->created_at->diffForHumans() : 'Belum ada' }}
Booking Terakhir
Informasi Personal
Nama Lengkap
{{ $guest->name }}
@if($guest->phone)
Nomor Telepon
{{ $guest->phone }}
@endif @if($guest->email)
Email
{{ $guest->email }}
@endif @if($guest->identity_type && $guest->identity_number)
{{ $guest->identity_type ?? 'Identitas' }}
{{ $guest->identity_number }}
@endif @if($guest->address)
Alamat
{{ $guest->address }}
@endif
Tanggal Registrasi
{{ $guest->created_at->format('d F Y, H:i') }} {{ $guest->created_at->diffForHumans() }}
Statistik Tamu
{{ $guest->bookings->count() }}
Total Booking
{{ $guest->bookings->where('status', 'checked_out')->count() }}
Selesai
{{ $guest->bookings->where('status', 'cancelled')->count() }}
Dibatalkan
@php $totalNights = $guest->bookings->sum(function($booking) { return $booking->check_in_date && $booking->check_out_date ? $booking->check_in_date->diffInDays($booking->check_out_date) : 0; }); @endphp {{ $totalNights }}
Total Malam
Riwayat Booking ({{ $guest->bookings->count() }})
@if($guest->bookings->count() > 0)
@foreach($guest->bookings->sortByDesc('created_at') as $booking)
Booking #{{ $booking->id }}
Dibuat {{ $booking->created_at->format('d F Y, H:i') }}
@switch($booking->status) @case('booked') Booked @break @case('checked_in') Check-in @break @case('checked_out') Check-out @break @case('cancelled') Cancelled @break @endswitch
Periode Menginap:
@if($booking->check_in_date && $booking->check_out_date) {{ $booking->check_in_date->format('d M Y') }} - {{ $booking->check_out_date->format('d M Y') }} ({{ $booking->check_in_date->diffInDays($booking->check_out_date) }} malam) @else Tanggal belum ditentukan @endif
Kamar:
@if($booking->bookingDetails && $booking->bookingDetails->count() > 0) @foreach($booking->bookingDetails as $detail)
{{ $detail->room->room_number ?? 'N/A' }} @if($detail->room && $detail->room->typeRoom) ({{ $detail->room->typeRoom->name }}) @endif
@endforeach @else Kamar belum ditentukan @endif
@if($booking->bookingDetails && $booking->bookingDetails->count() > 0)
Total Biaya:
Rp {{ number_format($booking->bookingDetails->sum('grand_total'), 0, ',', '.') }}
@endif @if($booking->cancel_description)
Alasan Pembatalan:
{{ $booking->cancel_description }}
@endif
Detail @if($booking->status === 'booked') @endif @if($booking->status === 'checked_in') @endif
@endforeach
@else
Belum Ada Booking

Tamu ini belum pernah melakukan booking. Mulai dengan membuat booking pertama.

@endif
@endsection @push('scripts') @endpush