@foreach($weekArray as $weekKey => $weekDay)
@if($product->activeHours)
@if($product->activeHours->{ $weekDay.'_start' } == 'full')
@php
$current = \Carbon\Carbon::now();
$roundedMinutes = ceil($current->minute / 30) * 30;
if ($roundedMinutes == 60) {
$current->addHour();
$roundedMinutes = 0;
}
$startTimeToday = $current->setTime($current->hour, $roundedMinutes, 0)->copy()->addHours(3);
$endTimeToday = $startTimeToday->copy()->addHours(17)->addMinutes(30);
$startTime = \Carbon\Carbon::createFromTime(7, 0, 0);
$endTime = $startTime->copy()->addHours(17);
$rang = 1;
@endphp
@while ($startTime->lessThan($endTime) == 1)
{{ $startTime->format('H:i') }}
@php
$startTime->addMinutes(30);
$rang++;
@endphp
@endwhile
@while ($startTimeToday->lessThan($endTimeToday) == 1)
{{ $startTimeToday->format('H:i') }}
@if($startTimeToday->format('H:i') == '00:00' || $startTimeToday->format('H:i') == '23:30')
{{ $startTimeToday->format('d-m') }}
@endif
@php
$startTimeToday->addMinutes(30);
$rang++;
@endphp
@endwhile
{{--
--}}
@elseif($product->activeHours->{ $weekDay.'_start' } == null)
Not Available
@else
@php
$rang = 1;
$endTimeForActive = '';
@endphp
@foreach($product->activeHours->activeHoursBlocks as $hourBlock)
@if($weekDay == $hourBlock->day)
{{ substr($hourBlock->block, 0, 5) }}
@php
$rang++;
$endTimeForActive = \Carbon\Carbon::parse(substr($hourBlock->block, 0, 5))->format('H:i');
@endphp
@endif
@endforeach
@php
$current = \Carbon\Carbon::now();
$roundedMinutes = ceil($current->minute / 30) * 30;
if ($roundedMinutes == 60) {
$current->addHour();
$roundedMinutes = 0;
}
$startTimeToday = $current->setTime($current->hour, $roundedMinutes, 0)->copy()->addHours(3);
$endTimeToday = \Carbon\Carbon::parse($endTimeForActive)->addMinutes(30);
@endphp
@while ($startTimeToday->lessThan($endTimeToday) == 1)
{{ $startTimeToday }}
{{ $startTimeToday->format('H:i') }}
@php
$startTimeToday->addMinutes(30);
$rang++;
@endphp
@endwhile
@endif
@else
Not Available
@endif
@endforeach