@include('viki-location.partials.top-header')
{{ __('viki.bookings_title') }}
{{ __('viki.bookings_sub') }}
@if (session('success'))
{{ session('success') }}
@endif
@if (session('error'))
{{ session('error') }}
@endif
@php
$badgeMap = [
'pending_owner' => ['bk-pending', __('viki.booking_status_pending')],
'owner_accepted' => ['bk-accepted', __('viki.booking_status_accepted')],
'paid' => ['bk-paid', __('viki.booking_status_paid')],
'owner_declined' => ['bk-declined', __('viki.booking_status_declined')],
'expired' => ['bk-expired', __('viki.booking_status_expired')],
'cancelled' => ['bk-expired', __('viki.booking_status_cancelled')],
];
@endphp
@forelse($requests as $booking)
@php
$badge = $badgeMap[$booking->status] ?? ['bk-expired', $booking->status];
$clientName = trim(($booking->client->first_name ?? '').' '.($booking->client->last_name ?? '')) ?: ($booking->client->name ?? 'โ');
@endphp
{{ $booking->maison->title }}
{{ __('viki.booking_from_client') }} {{ $clientName }} ยท {{ $booking->created_at->format('d.m.Y') }}
{{ $badge[1] }}
{{ __('viki.cal_from') }} {{ $booking->start_date->format('d.m.Y') }} {{ __('viki.cal_to_lc') }} {{ $booking->end_date->format('d.m.Y') }} ({{ $booking->nights }} {{ __('viki.detail_nights') }})
{{ __('viki.booking_total') }} {{ number_format($booking->total_amount, 2, ',', ' ') }} {{ $booking->currency }}
@if($booking->status === 'pending_owner')
@if($booking->owner_deadline)
{{ __('viki.booking_owner_deadline') }} {{ $booking->owner_deadline->format('d.m.Y') }}
@endif
@elseif($booking->status === 'owner_accepted')
{{ __('viki.booking_awaiting_payment') }} @if($booking->payment_deadline) ({{ __('viki.booking_before') }} {{ $booking->payment_deadline->format('d.m.Y') }})@endif
@elseif($booking->status === 'paid')
@endif
@php $claim = $booking->cancellationClaim; @endphp
@if($claim)
@php $refund = $booking->refundBreakdown(); @endphp
{{ __('viki.claim_title') }}
{{ __('viki.claim_intro', ['date' => $claim->created_at->format('d.m.Y H:i')]) }}
@if($claim->reason)
{{ __('viki.claim_reason') }} {{ $claim->reason }}
@endif
{{ $claim->filename }}
@if($claim->isPending())
{{ __('viki.claim_effect', [
'amount' => number_format($refund['refund'], 2, ',', ' ').' '.$booking->currency,
]) }}
@else
{{ $claim->isApproved() ? __('viki.claim_approved_state') : __('viki.claim_rejected_state') }}
@if($claim->reviewed_at)
โ {{ $claim->reviewed_at->format('d.m.Y H:i') }}
@endif
@endif
@endif
@empty
{{ __('viki.bookings_empty') }}
@endforelse