added check if expense is closed, user cannot edit
This commit is contained in:
@@ -137,6 +137,11 @@ class FormEntertainmentPresentationController extends Controller
|
||||
$this->checkAuthorization(auth()->user(), ['forms.entertainment.edit']);
|
||||
|
||||
$form = FormEntertaimentPresentation::findOrfail($id);
|
||||
if($form->status == 'Closed') {
|
||||
session()->flash('error', 'Form has been closed, you cannot edit it.');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
return view('backend.pages.forms.entertainment.edit', [
|
||||
'form' => $form
|
||||
]);
|
||||
@@ -160,6 +165,11 @@ class FormEntertainmentPresentationController extends Controller
|
||||
]);
|
||||
|
||||
$form = FormEntertaimentPresentation::findOrfail($id);
|
||||
if($form->status == 'Closed') {
|
||||
session()->flash('error', 'Form has been closed, you cannot edit it.');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
$cabang = UserHasCabang::with('cabang')->where('user_id', $form->user_id)->first()->cabang;
|
||||
$region = Region::where('id', $cabang->region_id)->first();
|
||||
$kategori = Kategori::where('name', 'Entertainment & Presentation')->first();
|
||||
|
||||
@@ -130,6 +130,11 @@ class FormMeetingSeminarController extends Controller
|
||||
$this->checkAuthorization(auth()->user(), ['forms.meeting.edit']);
|
||||
|
||||
$form = FormMeetingSeminar::findOrfail($id);
|
||||
if($form->status == 'Closed') {
|
||||
session()->flash('error', 'Form has been closed, you cannot edit it.');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
return view('backend.pages.forms.meeting.edit', [
|
||||
'form' => $form
|
||||
]);
|
||||
@@ -149,6 +154,11 @@ class FormMeetingSeminarController extends Controller
|
||||
]);
|
||||
|
||||
$form = FormMeetingSeminar::findOrfail($id);
|
||||
if($form->status == 'Closed') {
|
||||
session()->flash('error', 'Form has been closed, you cannot edit it.');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
$cabang = UserHasCabang::with('cabang')->where('user_id', $form->user_id)->first()->cabang;
|
||||
$region = Region::where('id', $cabang->region_id)->first();
|
||||
$kategori = Kategori::where('name', 'Meeting & Seminar')->first();
|
||||
|
||||
@@ -133,6 +133,11 @@ class FormOtherController extends Controller
|
||||
$this->checkAuthorization(auth()->user(), ['forms.other.edit']);
|
||||
|
||||
$form = FormOthers::findOrfail($id);
|
||||
if($form->status == 'Closed') {
|
||||
session()->flash('error', 'Form has been closed, you cannot edit it.');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
return view('backend.pages.forms.other.edit', [
|
||||
'form' => $form,
|
||||
'kategori' => Kategori::whereNotIn('name', ['Up Country', 'Vehicle Running Cost', 'Entertainment & Presentation', 'Meeting & Seminar'])->get()
|
||||
@@ -154,6 +159,11 @@ class FormOtherController extends Controller
|
||||
]);
|
||||
|
||||
$form = FormOthers::findOrfail($id);
|
||||
if($form->status == 'Closed') {
|
||||
session()->flash('error', 'Form has been closed, you cannot edit it.');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
$cabang = UserHasCabang::with('cabang')->where('user_id', $form->user_id)->first()->cabang;
|
||||
$region = Region::where('id', $cabang->region_id)->first();
|
||||
$kategori = Kategori::where('id', $request->kategori_id)->first();
|
||||
|
||||
@@ -141,6 +141,11 @@ class FormUpCountryController extends Controller
|
||||
$this->checkAuthorization(auth()->user(), ['forms.country.edit']);
|
||||
|
||||
$form = FormUpCountry::with('rayon')->findOrfail($id);
|
||||
if($form->status == 'Closed') {
|
||||
session()->flash('error', 'Form has been closed, you cannot edit it.');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
return view('backend.pages.forms.upcountry.edit', [
|
||||
'rayons' => Rayon::all(),
|
||||
'form' => $form
|
||||
@@ -166,6 +171,11 @@ class FormUpCountryController extends Controller
|
||||
]);
|
||||
|
||||
$form = FormUpCountry::findOrfail($id);
|
||||
if($form->status == 'Closed') {
|
||||
session()->flash('error', 'Form has been closed, you cannot edit it.');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
$cabang = UserHasCabang::with('cabang')->where('user_id', $form->user_id)->first()->cabang;
|
||||
$region = Region::where('id', $cabang->region_id)->first();
|
||||
$kategori = Kategori::where('name', 'Up Country')->first();
|
||||
|
||||
@@ -136,6 +136,11 @@ class FormVehicleController extends Controller
|
||||
$this->checkAuthorization(auth()->user(), ['forms.vehicle.edit']);
|
||||
|
||||
$form = FormVehicleRunningCost::findOrfail($id);
|
||||
if($form->status == 'Closed') {
|
||||
session()->flash('error', 'Form has been closed, you cannot edit it.');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
return view('backend.pages.forms.vehicle.edit', [
|
||||
'form' => $form
|
||||
]);
|
||||
@@ -159,6 +164,11 @@ class FormVehicleController extends Controller
|
||||
]);
|
||||
|
||||
$form = FormVehicleRunningCost::findOrfail($id);
|
||||
if($form->status == 'Closed') {
|
||||
session()->flash('error', 'Form has been closed, you cannot edit it.');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
$cabang = UserHasCabang::with('cabang')->where('user_id', $form->user_id)->first()->cabang;
|
||||
$region = Region::where('id', $cabang->region_id)->first();
|
||||
$kategori = Kategori::where('name', 'Vehicle Running Cost')->first();
|
||||
|
||||
Reference in New Issue
Block a user