<div class="text-center mb-4">
	<h2>Ваш участок обслуживания</h2>
	<h2 class="font-weight-bold">{{$zone_name}}</h2>
</div>

@php
	$today = date('N'); // 1..7
@endphp

@foreach($doctors as $doc)
	<div class="card mb-4 shadow-sm" style="border-radius:18px;">
		<div class="card-body">
			<div class="d-flex align-items-start mb-3">

				{{-- Левая колонка с аватаром-вставкой по дизайну --}}
				<div style="font-size:20px;">
					<strong>{{$doc['name']}}</strong><br>

					@if(!empty($doc['speciality_name']))
						<div class="mt-1">
							<i class="fas fa-stethoscope text-secondary mr-1"></i>
							{{$doc['post_name'] ?: 'Врач'}}
						</div>
					@endif

					@if(!empty($doc['office']))
						<div class="mt-1">
							<i class="fas fa-door-closed text-secondary mr-1"></i>
							Кабинет: <strong>{{$doc['office']}}</strong>
						</div>
					@endif
				</div>
			</div>

			@php
				$daysMap = [
                    'day1' => 'Понедельник',
                    'day2' => 'Вторник',
                    'day3' => 'Среда',
                    'day4' => 'Четверг',
                    'day5' => 'Пятница',
                    'day6' => 'Суббота',
                    'day7' => 'Воскресенье',
                ];

                $schedule = json_decode($doc['schedule'] ?? '', true);
			@endphp

			<hr class="mt-3 mb-3" style="border-color:#e5e5e5;">

			<h5 class="mb-3">Расписание приёма</h5>

			@if(empty($schedule))
				<div class="text-muted">Расписание не указано</div>
			@else
				<ul class="list-unstyled mb-0">

					@foreach($daysMap as $dayKey => $dayTitle)
						@php
							$slot = $schedule[$dayKey] ?? null;
						@endphp

						<li class="d-flex justify-content-between py-2 border-bottom"
							style="font-size:17px;">

							<span>{{ $dayTitle }}</span>

							@if($slot && !empty($slot['start']) && !empty($slot['end']))
								<span class="text-dark font-weight-bold">
                                    {{ substr($slot['start'], 0, 5) }} — {{ substr($slot['end'], 0, 5) }}
                                </span>
							@else
								<span class="text-muted font-italic">Нет приёма</span>
							@endif

						</li>
					@endforeach

				</ul>
			@endif

		</div>
	</div>
@endforeach

