{{ __('Dashboard') }}
@php $now = now(); $calendarMonth = $calendarMonth ?? \App\Support\CalendarMonth::fromRequest(request()); $calendarGrid = $calendarMonth->grid(); $calendarCells = $calendarGrid['cells']; $todayDay = $calendarMonth->todayDay(); $weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']; $appointmentsByDate = $appointmentsByDate ?? collect(); $upcomingAppointments = $upcomingAppointments ?? collect(); $calendarViewerId = (int) auth()->id(); $appointmentChipLabel = static fn (\App\Models\Appointment $appointment): string => $appointment->calendarChipLabel( false, false, $calendarViewerId, ); $calendarAppointmentsByDate = $appointmentsByDate ->map(function ($appointments) use ($appointmentChipLabel, $calendarViewerId) { return $appointments ->map(fn (\App\Models\Appointment $appointment) => array_merge( \App\Support\AppointmentCalendarEntry::fromAppointment( $appointment, $appointmentChipLabel, false, $calendarViewerId, ), [], )) ->values() ->all(); }) ->all(); $reopenDashboardAppointmentId = old('__appointment_id'); $reopenDashboardReschedule = filled($reopenDashboardAppointmentId) && old('__appointment_from') === 'dashboard' && ($errors->has('reschedule_reason') || filled(old('reschedule_reason'))); $personalAppointmentMode = (bool) ($personalAppointmentMode ?? false); $appointmentStoreUrl = $appointmentStoreUrl ?? null; $appointmentReschedulePathTemplate = preg_replace( '#/(\d+)/reschedule$#', '/__ID__/reschedule', route('appointments.reschedule', ['appointment' => 1]), ); $appointmentUpdatePathTemplate = preg_replace( '#/(\d+)$#', '/__ID__', route('appointments.update', ['appointment' => 1]), ); $dashboardCalendarConfig = [ 'leadUrlBase' => url('/leads'), 'appointmentStoreUrl' => $appointmentStoreUrl, 'personalAppointmentMode' => $personalAppointmentMode, 'appointmentsBase' => rtrim(route('appointments.index'), '/'), 'appointmentReschedulePathTemplate' => $appointmentReschedulePathTemplate, 'appointmentUpdatePathTemplate' => $appointmentUpdatePathTemplate, 'appointmentFrom' => 'dashboard', 'filterYear' => (string) $calendarMonth->year, 'filterMonth' => (string) $calendarMonth->month, 'todayDate' => $now->format('Y-m-d'), 'appointmentDateDefault' => old('appointment_date', $now->format('Y-m-d')), 'appointmentTimeDefault' => old('appointment_time', '09:00'), 'appointmentLocationDefault' => old('location', ''), 'appointmentNotesDefault' => old('notes', ''), 'appointmentLeadIdDefault' => old('lead_id', old('__appointment_lead_id', '')), 'appointmentWithUserIdDefault' => old('with_user_id', ''), 'editLeadIdDefault' => old('lead_id', ''), 'editDateDefault' => old('appointment_date', ''), 'editTimeDefault' => old('appointment_time', '09:00'), 'editLocationDefault' => old('location', ''), 'editNotesDefault' => old('notes', ''), 'rescheduleDateDefault' => old('appointment_date', ''), 'rescheduleTimeDefault' => old('appointment_time', '09:00'), 'rescheduleReasonDefault' => old('reschedule_reason', ''), 'reopenEdit' => filled($reopenDashboardAppointmentId) && old('__appointment_from') === 'dashboard' && ! $reopenDashboardReschedule ? ['appointmentId' => (int) $reopenDashboardAppointmentId] : null, 'reopenReschedule' => $reopenDashboardReschedule ? ['appointmentId' => (int) $reopenDashboardAppointmentId] : null, 'appointmentsByDate' => $calendarAppointmentsByDate, ]; if ( old('__appointment_from') === 'dashboard' && ! filled($reopenDashboardAppointmentId) ) { if ($personalAppointmentMode && filled(old('appointment_date'))) { $dashboardCalendarConfig['reopenAppointment'] = array_filter([ 'leadId' => filled(old('lead_id')) ? (int) old('lead_id') : null, 'withUserId' => filled(old('with_user_id')) ? (int) old('with_user_id') : null, ], fn ($value) => $value !== null); } elseif (filled(old('__appointment_lead_id'))) { $dashboardCalendarConfig['reopenAppointment'] = [ 'leadId' => (int) old('__appointment_lead_id'), ]; } } $calendarLeadOptions = $calendarLeadOptions ?? []; @endphp @if ($errors->any() && old('__appointment_from') === 'dashboard')

Please fix the following:

    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif
{{-- Calendar (left, ~70%) + Upcoming Appointments (right, ~30%) --}}
@foreach($weekdays as $dayLabel)
{{ $dayLabel }}
@endforeach
@foreach($calendarCells as $day) @if($day === null) @else @php $dateKey = $calendarMonth->date->copy()->day($day)->format('Y-m-d'); $dayAppointments = $appointmentsByDate->get($dateKey, collect()); $isToday = $todayDay !== null && $day === $todayDay; $visibleAppointments = $dayAppointments->take(5); $moreCount = max(0, $dayAppointments->count() - 5); $cellClasses = $isToday ? 'ring-2 ring-[var(--dealer-accent-color)] bg-red-50 border-[var(--dealer-accent-color)]' : 'border-gray-200 bg-gray-50'; $dayNumberClasses = $isToday ? 'text-[var(--dealer-accent-color)] font-bold' : 'text-gray-700 font-semibold'; $isPastDay = $calendarMonth->isPastDay($day); @endphp
@if (! $isPastDay) @endif {{ $day }} @if ($dayAppointments->isNotEmpty())
@foreach ($visibleAppointments as $appointment)
@if ($appointment->isCompleted()) @elseif ($appointment->isMissed()) @elseif ($appointment->isNoShow()) ? @endif {{ $appointmentChipLabel($appointment) }}
@endforeach
@endif
@endif @endforeach
@if ($upcomingAppointments->isEmpty())

No upcoming appointments yet.

@else
    @foreach ($upcomingAppointments as $appointment) @php $lead = $appointment->lead; $phone = $lead?->displayPhone(); $timeForInput = $appointment->appointment_time ? \Illuminate\Support\Str::substr((string) $appointment->appointment_time, 0, 5) : ($appointment->appointment_datetime?->format('H:i') ?? '09:00'); @endphp
  • {{ $appointment->counterpartyLabelForViewer($calendarViewerId) }}

    {{ $appointment->statusLabel() }}

    {{ $appointment->appointment_datetime->format('D, d M Y') }} · {{ $appointment->appointment_datetime->format('H:i') }}

    @if ($phone)

    {{ $phone }}

    @endif @if ($appointment->location)

    {{ $appointment->location }}

    @endif
    @if ($appointment->canBeMarkedMissed()) @endif @if ($appointment->canBeMarkedNoShow()) @endif
  • @endforeach
@endif @can('appointments.view') View all @endcan
@php $showPendingProofsPanel = auth()->user()?->canReviewProofSubmissions(); $showPendingProspectingPlansPanel = auth()->user()?->can('prospecting-plans.review'); @endphp @if ($showPendingProofsPanel || $showPendingProspectingPlansPanel)
@if ($showPendingProofsPanel) @endif @if ($showPendingProspectingPlansPanel) @endif
@endif