{{-- Livewire start div --}}
Legend
Weekend
Bank Holiday
Pending
Holiday
@php //Days & Date $currentDate = new DateTime($calendarData['year'] - $calendarData['month'] - 01); echo ''; echo "'; for ($i = 1; $i <= $calendarData['daysInMonth']; $i++) { $currentDate->setDate($calendarData['year'], $calendarData['month'], $i); $dayOfWeek = $currentDate->format('N'); $isWeekend = $dayOfWeek == 6 || $dayOfWeek == 7; if ($isWeekend) { echo "'; } else { echo "'; } } echo ''; for ($i = 1; $i <= $calendarData['daysInMonth']; $i++) { $currentDate->setDate($calendarData['year'], $calendarData['month'], $i); $dayOfWeek = $currentDate->format('N'); $isWeekend = $dayOfWeek == 6 || $dayOfWeek == 7; if ($isWeekend) { echo "'; } else { echo "'; } } echo ''; @endphp {{-- Emplpoyee data --}} @foreach ($holidaydata as $holiday) @php // dd($holidaydata); $matchedPublicHoliday = null; //set pub holiday as null to start the script $isEmployeeHoliday = null; $holColor = null; for ($i = 1; $i <= $calendarData['daysInMonth']; $i++) { $currentDate->setDate($calendarData['year'], $calendarData['month'], $i); $dayOfWeek = $currentDate->format('N'); $isWeekend = $dayOfWeek == 6 || $dayOfWeek == 7; foreach ($publicHoliday as $PubHol) { if ($currentDate->format('Y-m-d') == $PubHol->date) { $matchedPublicHoliday = true; break; } else { $matchedPublicHoliday = false; } } //find holiday data foreach ($holidaydata as $empHol) { $startDate = new DateTime($empHol->start_date); $endDate = new DateTime($empHol->end_date); if ( $currentDate->format('Y-m-d') >= $startDate->format('Y-m-d') && $currentDate->format('Y-m-d') <= $endDate->format('Y-m-d') ) { $isEmployeeHoliday = true; if ($empHol->status == 'Pending') { $HolColor = 'warning'; } elseif ($empHol->status == 'Approved') { $holColor = 'primary'; } break; } else { $isEmployeeHoliday = false; } } if ($isWeekend) { echo ""; } elseif ($matchedPublicHoliday) { echo ""; } elseif ($isEmployeeHoliday) { echo "'; } else { echo ""; } } @endphp @endforeach
"; echo '" . $currentDate->format('D') . '" . $currentDate->format('D') . '
" . $i . '" . $i . '
{{ $holiday->getUser->name }} "; echo "
"; echo '
{{-- Livewire end div --}}