@extends('layouts.dental') @section('title', 'Agenda') @section('content')
| @foreach($days as $day) @php $isToday=$day->isToday(); $isHoliday=isset($holidays[$day->format('Y-m-d')]); $holidayName=$isHoliday?$holidays[$day->format('Y-m-d')]->description:''; @endphp |
{{ $day->locale('pt_BR')->isoFormat('ddd')}}.
{{ $day->format('d') }} /{{ $day->format('m') }}
@if($isHoliday)@endif
|
@endforeach
|---|---|
| @if($min===0){{ str_pad($h,2,'0',STR_PAD_LEFT) }}h00@endif | @foreach($days as $day) @php $dayKey=$day->format('Y-m-d'); $isHoliday=isset($holidays[$dayKey]); $dayApps=$appointments->get($dayKey,collect())->filter(fn($a)=>$a->starts_at->hour==$h&&$a->starts_at->minute==$min); $colors=['agendado'=>'#4CAF50','confirmado'=>'#2196F3','em_atendimento'=>'#FF9800','realizado'=>'#9E9E9E','faltou'=>'#F44336','cancelado'=>'#EF4444']; $_dk=['seg','ter','qua','qui','sex','sab','dom'][$day->dayOfWeekIso-1]??null; $_cfg=$_dk&&isset($schedule[$_dk])?$schedule[$_dk]:['active'=>true,'open'=>'07:00','close'=>'20:00']; $_open=$_cfg['active']; $_slotTime=$h+$min/60; $_openH=isset($_cfg['open'])?(int)explode(':',$_cfg['open'])[0]+(int)explode(':',$_cfg['open'])[1]/60:7; $_closeH=isset($_cfg['close'])?(int)explode(':',$_cfg['close'])[0]+(int)explode(':',$_cfg['close'])[1]/60:20; $_inHours=$_slotTime>=$_openH&&$_slotTime<$_closeH; $_available=!$isHoliday&&$_open&&$_inHours; $_bg=$isHoliday?'#FFFDE7':(!$_open?'#ebebeb':(!$_inHours?'#f5f5f5':($day->isToday()?'#fafcff':'#fff'))); @endphp@foreach($dayApps as $apt) @php $heightPx=max((($apt->duration_minutes??30)/30)*32-2,28);$bg=$colors[$apt->status]??'#4CAF50'; @endphp @endforeach @php $dayEvts=isset($events)?$events->get($dayKey,collect())->filter(fn($e)=>$e->starts_at->hour==$h&&$e->starts_at->minute==$min):collect(); @endphp @foreach($dayEvts as $evt) @php $heightEvt=max((($evt->duration_minutes??30)/30)*32-2,28); @endphp @endforeach | @endforeach