changed logic in production calendar
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Failing after 15s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Larastan / larastan (pull_request) Failing after 6m27s
Laravel Pint / pint (pull_request) Successful in 3m38s

This commit is contained in:
dhanabalan
2026-11-03 11:43:12 +05:30
parent ece5b846bb
commit 944e62ff9e

View File

@@ -4,6 +4,7 @@ namespace App\Filament\Pages;
use App\Models\CustomerPoMaster; use App\Models\CustomerPoMaster;
use App\Models\Plant; use App\Models\Plant;
use App\Models\ProductionCalendar;
use App\Models\ProductionPlan; use App\Models\ProductionPlan;
use App\Models\WireMasterPacking; use App\Models\WireMasterPacking;
use Filament\Facades\Filament; use Filament\Facades\Filament;
@@ -139,27 +140,36 @@ class ProductionCalender extends Page
return; return;
} }
$updated = ProductionPlan::where('plant_id', $plantId) $updated = ProductionCalendar::where('plant_id', $plantId)
->whereMonth('created_at', $month) ->whereMonth('created_at', $month)
->whereYear('created_at', $year) ->whereYear('created_at', $year)
->update([ ->first();
'working_days' => $workingDays,
'leave_dates' => $dates,
'updated_at' => now(),
]);
if ($updated) { if ($updated) {
$updated->update([
'working_days' => $workingDays,
'leave_dates' => $dates,
]);
Notification::make() Notification::make()
->title('Success') ->title('Success')
->body("Working days updated successfully!") ->body("Working days updated successfully!")
->success() ->success()
->send(); ->send();
return;
} else { } else {
ProductionCalendar::create([
'plant_id' => $plantId,
'working_days' => $workingDays,
'leave_dates' => $dates,
]);
Notification::make() Notification::make()
->title('No Records Updated') ->title('Record Created Successfully')
->body("No production plans found for this plant and month.") ->body("Production calendar plans created for this plant and month.")
->warning() ->success()
->send(); ->send();
return;
} }
} }