add budgets
This commit is contained in:
@@ -159,10 +159,11 @@ class FormEntertainmentPresentationController extends Controller
|
||||
public function edit($id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.entertainment.edit']);
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
|
||||
$form = FormEntertaimentPresentation::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();
|
||||
}
|
||||
|
||||
@@ -174,6 +175,7 @@ class FormEntertainmentPresentationController extends Controller
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.entertainment.edit']);
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
|
||||
$request->validate([
|
||||
'tanggal' => 'required',
|
||||
@@ -187,8 +189,8 @@ class FormEntertainmentPresentationController extends Controller
|
||||
]);
|
||||
|
||||
$form = FormEntertaimentPresentation::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();
|
||||
}
|
||||
|
||||
@@ -414,8 +416,14 @@ class FormEntertainmentPresentationController extends Controller
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.entertainment.delete']);
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
|
||||
$form = FormEntertaimentPresentation::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