Merge branch 'branch-jagad' into 'main'
fix bug cannot approve See merge request fiqhpratama1/xpendify!21
This commit is contained in:
@@ -273,10 +273,15 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'total' => 'required|numeric|min:1|max:' . BudgetHelper::getAvailableBudget(),
|
'total' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$form = FormEntertaimentPresentation::findOrfail($id);
|
$form = FormEntertaimentPresentation::findOrfail($id);
|
||||||
|
if($form->total > BudgetHelper::getAvailableBudget()) {
|
||||||
|
session()->flash('error', 'The total nominal exceeds the available budget.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
$form->update([
|
$form->update([
|
||||||
'approved_at' => now(),
|
'approved_at' => now(),
|
||||||
'approved_by' => auth()->user()->id,
|
'approved_by' => auth()->user()->id,
|
||||||
|
|||||||
@@ -266,10 +266,15 @@ class FormOtherController extends Controller
|
|||||||
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
||||||
|
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'total' => 'required|numeric|min:1|max:' . BudgetHelper::getAvailableBudget(),
|
'total' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$form = FormOthers::findOrfail($id);
|
$form = FormOthers::findOrfail($id);
|
||||||
|
if($form->total > BudgetHelper::getAvailableBudget()) {
|
||||||
|
session()->flash('error', 'The total nominal exceeds the available budget.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
$form->update([
|
$form->update([
|
||||||
'approved_at' => now(),
|
'approved_at' => now(),
|
||||||
'approved_by' => auth()->user()->id,
|
'approved_by' => auth()->user()->id,
|
||||||
|
|||||||
@@ -275,10 +275,15 @@ class FormVehicleController extends Controller
|
|||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'total' => 'required|numeric|min:1|max:' . BudgetHelper::getAvailableBudget(),
|
'total' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$form = FormVehicleRunningCost::findOrfail($id);
|
$form = FormVehicleRunningCost::findOrfail($id);
|
||||||
|
if($form->total > BudgetHelper::getAvailableBudget()) {
|
||||||
|
session()->flash('error', 'The total nominal exceeds the available budget.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
$form->update([
|
$form->update([
|
||||||
'approved_at' => now(),
|
'approved_at' => now(),
|
||||||
'approved_by' => auth()->user()->id,
|
'approved_by' => auth()->user()->id,
|
||||||
|
|||||||
Reference in New Issue
Block a user