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();
|
||||
|
||||
|
||||
@@ -190,10 +190,11 @@ class FormMeetingSeminarController extends Controller
|
||||
public function edit($id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.meeting.edit']);
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
|
||||
$form = FormMeetingSeminar::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,6 +206,7 @@ class FormMeetingSeminarController extends Controller
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.meeting.edit']);
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
|
||||
$request->validate([
|
||||
'allowance' => 'nullable|numeric',
|
||||
@@ -216,8 +218,8 @@ class FormMeetingSeminarController extends Controller
|
||||
]);
|
||||
|
||||
$form = FormMeetingSeminar::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();
|
||||
}
|
||||
|
||||
@@ -477,8 +479,14 @@ class FormMeetingSeminarController extends Controller
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.meeting.delete']);
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
|
||||
$form = FormMeetingSeminar::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 Meeting Seminar (' . $form->expense_number . ')');
|
||||
|
||||
$form->delete();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -159,10 +159,11 @@ class FormVehicleController extends Controller
|
||||
public function edit($id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.vehicle.edit']);
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
|
||||
$form = FormVehicleRunningCost::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 FormVehicleController extends Controller
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.vehicle.edit']);
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
|
||||
$request->validate([
|
||||
'tanggal' => 'required',
|
||||
@@ -187,8 +189,8 @@ class FormVehicleController extends Controller
|
||||
]);
|
||||
|
||||
$form = FormVehicleRunningCost::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();
|
||||
}
|
||||
|
||||
@@ -210,7 +212,6 @@ class FormVehicleController extends Controller
|
||||
$bukti_total->getContent(),
|
||||
$filename
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
// Save the form data
|
||||
@@ -415,8 +416,14 @@ class FormVehicleController extends Controller
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->checkAuthorization(auth()->user(), ['forms.vehicle.delete']);
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
|
||||
$form = FormVehicleRunningCost::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