add budgets
This commit is contained in:
@@ -127,7 +127,6 @@ class FormOtherController extends Controller
|
||||
$bukti_total->getContent(),
|
||||
$filename
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
// Generate sequence number and expense number
|
||||
@@ -156,10 +155,11 @@ class FormOtherController extends Controller
|
||||
public function edit($id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.other.edit']);
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
|
||||
$form = FormOthers::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();
|
||||
}
|
||||
|
||||
@@ -172,6 +172,7 @@ class FormOtherController extends Controller
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.other.edit']);
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
|
||||
$request->validate([
|
||||
'kategori_id' => 'required',
|
||||
@@ -182,8 +183,8 @@ class FormOtherController extends Controller
|
||||
]);
|
||||
|
||||
$form = FormOthers::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();
|
||||
}
|
||||
|
||||
@@ -205,7 +206,6 @@ class FormOtherController extends Controller
|
||||
$bukti_total->getContent(),
|
||||
$filename
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
// Save the form data
|
||||
@@ -407,8 +407,14 @@ class FormOtherController extends Controller
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.other.delete']);
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
|
||||
$form = FormOthers::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