add budgets
This commit is contained in:
@@ -220,10 +220,11 @@ class FormUpCountryController extends Controller
|
||||
public function edit($id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.country.edit']);
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
|
||||
$form = FormUpCountry::with('rayon')->findOrfail($id);
|
||||
if($form->status == 'Closed') {
|
||||
session()->flash('error', 'Form has been closed, you cannot edit it.');
|
||||
if($form->status != 'On Progress' && $role == 'Medical Representatif') {
|
||||
session()->flash('error', 'You cannot edit this form because it has been approved or rejected.');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
@@ -236,6 +237,7 @@ class FormUpCountryController extends Controller
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.country.edit']);
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
|
||||
$request->validate([
|
||||
'rayon_id' => 'required|exists:rayon,id',
|
||||
@@ -253,8 +255,8 @@ class FormUpCountryController extends Controller
|
||||
]);
|
||||
|
||||
$form = FormUpCountry::findOrfail($id);
|
||||
if($form->status == 'Closed') {
|
||||
session()->flash('error', 'Form has been closed, you cannot edit it.');
|
||||
if($form->status != 'On Progress' && $role == 'Medical Representatif') {
|
||||
session()->flash('error', 'You cannot edit this form because it has been approved or rejected.');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
@@ -537,6 +539,11 @@ class FormUpCountryController extends Controller
|
||||
$this->checkAuthorization(auth()->user(), ['forms.country.delete']);
|
||||
|
||||
$form = FormUpCountry::findOrfail($id);
|
||||
if($form->status != 'On Progress' && $role == 'Medical Representatif') {
|
||||
session()->flash('error', 'You cannot edit this form because it has been approved or rejected.');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
AuditTrailHelper::AddAuditTrail('Delete', 'Delete Record at Form Entertainment Presentation (' . $form->expense_number . ')');
|
||||
|
||||
$form->delete();
|
||||
|
||||
Reference in New Issue
Block a user