@extends('layouts.app') @section('title', __('appointments::messages.schedules.title')) @section('content') @php $weekdays = __('appointments::messages.schedules.weekdays'); @endphp

{{ __('appointments::messages.schedules.title') }}

{{ __('appointments::messages.schedules.subtitle') }}

{{-- No inline onchange: the CSP sets script-src 'self', which blocks it. The delegated change handler on a data-clinic-filter form does the same job and is subject to no such restriction. --}}
@if ($doctor === null) {{-- Not the same state as "this clinician has no rota": nobody has been chosen yet. Saying "no working hours set" here reads as a fault in the data when it is really just step one. --}}

{{ __('appointments::messages.schedules.choose_doctor') }}

{{ __('appointments::messages.schedules.choose_doctor_text') }}

@else
@can('create', \App\Modules\Appointments\Models\DoctorSchedule::class)
@csrf
@endcan @forelse ($schedules->where('is_active', true) as $schedule)
{{ $weekdays[$schedule->weekday] ?? $schedule->weekday }} {{ substr((string) $schedule->starts_at, 0, 5) }}–{{ substr((string) $schedule->ends_at, 0, 5) }} @if ($schedule->slot_minutes) {{ $schedule->slot_minutes }} min @endif @if ($schedule->capacity > 1) ×{{ $schedule->capacity }} @endif
@can('delete', $schedule) @endcan
@empty

{{ __('appointments::messages.schedules.empty') }}

{{ __('appointments::messages.schedules.empty_text') }}

@endforelse
@can('create', \App\Modules\Appointments\Models\DoctorSchedule::class)
@csrf
@endcan @forelse ($exceptions as $exception)
{{ $exception->date->format('Y-m-d') }} {{ __('appointments::messages.schedules.types.'.$exception->type) }} @if ($exception->doctor_id === null) {{ __('appointments::messages.schedules.whole_branch') }} @endif @if ($exception->reason)
{{ $exception->reason }}
@endif
@can('create', \App\Modules\Appointments\Models\DoctorSchedule::class) @endcan
@empty

{{ __('appointments::messages.schedules.no_exceptions') }}

{{ __('appointments::messages.schedules.no_exceptions_text') }}

@endforelse
@endif
@endsection