@extends('dashboard.admin.layouts.master') @php $dayNames = [ 0 => trans('clinic.doctors.days.sunday'), 1 => trans('clinic.doctors.days.monday'), 2 => trans('clinic.doctors.days.tuesday'), 3 => trans('clinic.doctors.days.wednesday'), 4 => trans('clinic.doctors.days.thursday'), 5 => trans('clinic.doctors.days.friday'), 6 => trans('clinic.doctors.days.saturday'), ]; $oldDays = old('days'); @endphp @section('content')

{{ trans('clinic.doctors.schedule_title') }} — {{ $doctor->name }}

{{ trans('clinic.common.back') }}
@if(session('success'))
{{ session('success') }}
@endif @if($errors->any())
    @foreach($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif @if($clinics->count() > 1)
@endif
@csrf @method('PUT')
{{ trans('clinic.doctors.periods_hint') }}
@foreach($days as $dayOfWeek => $periods) @php $oldPeriods = $oldDays[$dayOfWeek]['periods'] ?? null; $dayActive = $oldDays !== null ? ! empty($oldDays[$dayOfWeek]['is_active']) : $periods->isNotEmpty(); $rows = $oldPeriods !== null ? collect($oldPeriods)->values() : $periods->map(fn ($period) => [ 'id' => $period->id, 'label' => $period->label, 'start_time' => substr($period->start_time, 0, 5), 'end_time' => substr($period->end_time, 0, 5), ])->values(); // Always render one blank row so the first period needs no extra click. $rows = $rows->isEmpty() ? collect([[]]) : $rows; @endphp
@foreach($rows as $index => $row)
@error("days.$dayOfWeek.periods.$index.start_time")
{{ $message }}
@enderror
@error("days.$dayOfWeek.periods.$index.end_time")
{{ $message }}
@enderror
@endforeach
@endforeach
@endsection @section('js') {!! JsValidator::formRequest('App\Http\Requests\Admin\Clinic\UpdateDoctorScheduleRequest', '#scheduleForm') !!} @endsection