@extends(BaseHelper::getAdminMasterLayoutTemplate()) @section('content') {{-- Statistics Overview --}}
{{ trans('plugins/hotel::ical.total_rooms') }}

{{ $rooms->count() }}

{{ trans('plugins/hotel::ical.synced_calendars') }}

{{ $rooms->sum(fn($r) => $r->calendars->count()) }}

{{ trans('plugins/hotel::ical.rooms_with_calendars') }}

{{ $rooms->filter(fn($r) => $r->calendars->isNotEmpty())->count() }}

{{ trans('plugins/hotel::ical.last_sync_time') }}
@php $lastSync = $rooms->flatMap(fn($r) => $r->calendars)->filter(fn($c) => $c->last_synced_at)->sortByDesc('last_synced_at')->first(); @endphp

{{ $lastSync ? $lastSync->last_synced_at->diffForHumans() : trans('plugins/hotel::ical.never') }}

{{-- Main Content --}}

{{ trans('plugins/hotel::ical.sync_calendars') }}

{{ trans('plugins/hotel::ical.documentation') }} {{ trans('plugins/hotel::ical.logs') }} @if($rooms->filter(fn($r) => $r->calendars->isNotEmpty())->count() > 0) @endif
@if($rooms->isEmpty())
{{ trans('plugins/hotel::ical.no_rooms_found') }}

{{ trans('plugins/hotel::ical.no_rooms_desc') }}

{{ trans('plugins/hotel::room.create') }}
@else
@foreach($rooms as $room) @endforeach
{{ trans('core/base::tables.name') }} {{ trans('plugins/hotel::ical.calendars') }} {{ trans('plugins/hotel::ical.status') }} {{ trans('plugins/hotel::ical.last_sync') }} {{ trans('core/base::tables.operations') }}
@if($room->image) {{ $room->name }} @else
@endif
{{ $room->name }} @if($room->room_category) {{ $room->room_category->name }} @endif
@if($room->calendars->count() > 0) @else @endif @if($room->calendars->isNotEmpty()) @php $lastSync = $room->calendars->max('last_synced_at'); $hasRecentSync = $lastSync && $lastSync->diffInHours(now()) < 24; @endphp @if($hasRecentSync) {{ trans('plugins/hotel::ical.synced') }} @elseif($lastSync) {{ trans('plugins/hotel::ical.needs_sync') }} @else {{ trans('plugins/hotel::ical.not_synced') }} @endif @else {{ trans('plugins/hotel::ical.no_calendars') }} @endif @if($room->calendars->isNotEmpty()) @php $lastSync = $room->calendars->max('last_synced_at'); @endphp @if($lastSync) {{ $lastSync->diffForHumans() }} @else {{ trans('plugins/hotel::ical.never') }} @endif @else {{ trans('plugins/hotel::ical.not_applicable') }} @endif
@if($room->calendars->isNotEmpty()) @endif
@endif
@endsection @push('footer') @endpush