@props(['menuGroups', 'ungroupedCategories' => null, 'currency' => 'TL', 'clickable' => true]) @php // Build tab list: enabled groups + "Diğer" for ungrouped categories $tabs = []; $dayOfWeek = now()->dayOfWeekIso; foreach ($menuGroups as $group) { $groupData = $group->data ?? []; $hasGroupHours = $groupData['service_hours_enabled'] ?? false; $groupSlots = $hasGroupHours ? $groupData['service_hours'][$dayOfWeek] ?? [] : []; // Eski format dönüşümü if (isset($groupSlots['start'])) { $groupSlots = [['name' => 'Servis', 'open' => $groupSlots['start'], 'close' => $groupSlots['end']]]; } $groupSlots = collect($groupSlots)->filter(fn($s) => !($s['is_closed'] ?? false)); $hoursText = ''; if ($hasGroupHours && $groupSlots->isNotEmpty()) { $hoursText = $groupSlots->map(fn($s) => ($s['open'] ?? '') . ' - ' . ($s['close'] ?? ''))->implode(', '); } // Grubun şu an açık/kapalı durumunu hesapla $groupServiceCheck = $group->checkGroupServiceHours(true); $groupIsOpen = $groupServiceCheck['is_open']; $tabs[] = [ 'id' => 'group-' . $group->id, 'name' => $group->name, 'hours' => $hoursText, 'isOpen' => $groupIsOpen, ]; } if ($ungroupedCategories && $ungroupedCategories->isNotEmpty()) { $tabs[] = ['id' => 'group-ungrouped', 'name' => __('menu.other'), 'hours' => '', 'isOpen' => true]; } @endphp @if (!empty($tabs))