Merge pull request 'changed logic in production calendar' (#1372) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled

Reviewed-on: #1372
This commit was merged in pull request #1372.
This commit is contained in:
2026-11-03 06:13:27 +00:00

View File

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