feat: add TurkeyHolidayHelper to exclude official holidays from intern day calculations and logs

This commit is contained in:
Ümit Tunç
2026-07-18 02:02:56 +03:00
parent e172afb3ac
commit 7d72ebc7ad
4 changed files with 127 additions and 8 deletions
+5 -5
View File
@@ -177,7 +177,7 @@ class CareerController extends Controller
$temp = $startDate->copy();
while ($count < $daysToAdd) {
if ($temp->isWeekend()) {
if ($temp->isWeekend() || \App\Helpers\TurkeyHolidayHelper::isHoliday($temp)) {
$temp->addDay();
continue;
}
@@ -464,7 +464,7 @@ class CareerController extends Controller
$count = 0;
while ($count < $daysToAdd) {
if ($temp->isWeekend()) {
if ($temp->isWeekend() || \App\Helpers\TurkeyHolidayHelper::isHoliday($temp)) {
$temp->addDay();
continue;
}
@@ -501,9 +501,9 @@ class CareerController extends Controller
return response()->json(['success' => false, 'message' => 'İleriye dönük staj günleri için defter doldurulamaz.'], 422);
}
// 2. Prevent weekend entries
if ($dateObj->isWeekend()) {
return response()->json(['success' => false, 'message' => 'Hafta sonu günlerine staj günlüğü girilemez.'], 422);
// 2. Prevent weekend and holiday entries
if ($dateObj->isWeekend() || \App\Helpers\TurkeyHolidayHelper::isHoliday($dateObj)) {
return response()->json(['success' => false, 'message' => 'Hafta sonu günlerine ve resmi tatillere staj günlüğü girilemez.'], 422);
}
// 3. Determine if retroactive