fix some revisi

This commit is contained in:
Jagad R R
2025-01-19 14:57:01 +07:00
parent 430700bc59
commit 1610d83bc6
17 changed files with 562 additions and 477 deletions
@@ -133,9 +133,8 @@ class FormMeetingSeminarController extends Controller
$closingDateNextMonth = date('Y-m-', strtotime('+1 month')) . env('CLOSING_DATE');
if ($currentDate < $startDate || $currentDate > $closingDateNextMonth) {
return response()->json([
'error' => 'Current date is not within the valid range.'
], 400);
session()->flash('error', 'Gagal, Input expense sudah melewati periode input 12-10');
return redirect()->back();
}
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
@@ -195,9 +194,8 @@ class FormMeetingSeminarController extends Controller
];
// Check if the total nominal exceeds the available budget
$cabang_id = UserHasCabang::where('user_id', auth()->user()->id)->first()->cabang_id;
if(array_sum($data_nominal) > BudgetHelper::getAvailableBudget($cabang_id)) {
session()->flash('error', 'The total nominal exceeds the available budget.');
if(array_sum($data_nominal) > BudgetHelper::getAvailableBudget($cabang->id)) {
session()->flash('error', 'Alokasi budget bulanan cabang tidak mencukupi,silahkan ajukan pada periode expense berikutnya');
return redirect()->back();
}