<div class="text-center mb-4">
	<h2>Ваш участок обслуживания</h2>
	<h2 class="font-weight-bold"><?php echo \htmlentities($zone_name, ENT_QUOTES, 'UTF-8', false); ?></h2>
</div>

<?php 
	$today = date('N'); // 1..7
 ?>

<?php $__currentLoopData = $doctors; $this->addLoop($__currentLoopData);$this->getFirstLoop();
 foreach($__currentLoopData as $doc): $loop = $this->incrementLoopIndices();  ?>
	<div class="card mb-4 shadow-sm" style="border-radius:18px;">
 <div class="card-body">
 <div class="d-flex align-items-start mb-3">

 <?php /* Левая колонка с аватаром-вставкой по дизайну */ ?>
 <div style="font-size:20px;">
 <strong><?php echo \htmlentities($doc['name'], ENT_QUOTES, 'UTF-8', false); ?></strong><br>

 <?php if(!empty($doc['speciality_name'])): ?>
 <div class="mt-1">
 <i class="fas fa-stethoscope text-secondary mr-1"></i>
 <?php echo \htmlentities($doc['post_name'] ?: 'Врач', ENT_QUOTES, 'UTF-8', false); ?>

 </div>
 <?php endif; ?>

 <?php if(!empty($doc['office'])): ?>
 <div class="mt-1">
 <i class="fas fa-door-closed text-secondary mr-1"></i>
 Кабинет: <strong><?php echo \htmlentities($doc['office'], ENT_QUOTES, 'UTF-8', false); ?></strong>
 </div>
 <?php endif; ?>
 </div>
 </div>

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

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

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

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

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

 <?php $__currentLoopData = $daysMap; $this->addLoop($__currentLoopData);$this->getFirstLoop();
 foreach($__currentLoopData as $dayKey => $dayTitle): $loop = $this->incrementLoopIndices();  ?>
 <?php 
 $slot = $schedule[$dayKey] ?? null;
  ?>

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

 <span><?php echo \htmlentities($dayTitle, ENT_QUOTES, 'UTF-8', false); ?></span>

 <?php if($slot && !empty($slot['start']) && !empty($slot['end'])): ?>
 <span class="text-dark font-weight-bold">
 <?php echo \htmlentities(substr($slot['start'], 0, 5), ENT_QUOTES, 'UTF-8', false); ?> — <?php echo \htmlentities(substr($slot['end'], 0, 5), ENT_QUOTES, 'UTF-8', false); ?>

 </span>
 <?php else: ?>
 <span class="text-muted font-italic">Нет приёма</span>
 <?php endif; ?>

 </li>
 <?php endforeach; $this->popLoop(); $loop = $this->getFirstLoop(); ?>

 </ul>
 <?php endif; ?>

 </div>
	</div>
<?php endforeach; $this->popLoop(); $loop = $this->getFirstLoop(); ?>

