revised form vehicle, entertainment and other
This commit is contained in:
@@ -65,6 +65,28 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function detail($id)
|
||||||
|
{
|
||||||
|
$this->checkAuthorization(auth()->user(), ['forms.entertainment.view']);
|
||||||
|
|
||||||
|
$form = FormEntertaimentPresentation::with('user')->findOrFail($id);
|
||||||
|
$form->bukti_total = $form->bukti_total ? NextCloudHelper::getFileUrl($form->bukti_total) : null;
|
||||||
|
|
||||||
|
return response()->json($form);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($id)
|
||||||
|
{
|
||||||
|
$this->checkAuthorization(auth()->user(), ['forms.entertainment.view']);
|
||||||
|
|
||||||
|
$form = FormEntertaimentPresentation::with('user')->findOrFail($id);
|
||||||
|
$form->bukti_total = $form->bukti_total ? NextCloudHelper::getFileUrl($form->bukti_total) : null;
|
||||||
|
|
||||||
|
return view('backend.pages.forms.entertainment.view', [
|
||||||
|
'form' => $form,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['forms.entertainment.create']);
|
$this->checkAuthorization(auth()->user(), ['forms.entertainment.create']);
|
||||||
@@ -84,9 +106,7 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
'alamat' => 'required',
|
'alamat' => 'required',
|
||||||
'nik_or_npwp' => 'required',
|
'nik_or_npwp' => 'required',
|
||||||
'bukti1' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
'bukti_total' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
||||||
'bukti2' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
|
||||||
'bukti3' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
||||||
@@ -96,43 +116,19 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
$filePaths = [];
|
$filePaths = [];
|
||||||
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/entertainment';
|
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/entertainment';
|
||||||
|
|
||||||
if ($request->hasFile('bukti1')) {
|
if ($request->hasFile('bukti_total')) {
|
||||||
$bukti1 = $request->file('bukti1');
|
$bukti_total = $request->file('bukti_total');
|
||||||
$filename = Str::uuid() . '.' . $bukti1->extension();
|
$filename = Str::uuid() . '.' . $bukti_total->extension();
|
||||||
|
|
||||||
$filePaths['bukti1'] = $folderPath . '/' . $filename;
|
$filePaths['bukti_total'] = $folderPath . '/' . $filename;
|
||||||
|
|
||||||
NextCloudHelper::uploadFile(
|
NextCloudHelper::uploadFile(
|
||||||
$folderPath,
|
$folderPath,
|
||||||
$bukti1->getContent(),
|
$bukti_total->getContent(),
|
||||||
$filename
|
$filename
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($request->hasFile('bukti2')) {
|
|
||||||
$bukti2 = $request->file('bukti2');
|
|
||||||
$filename = Str::uuid() . '.' . $bukti2->extension();
|
|
||||||
|
|
||||||
$filePaths['bukti2'] = $folderPath . '/' . $filename;
|
|
||||||
|
|
||||||
NextCloudHelper::uploadFile(
|
|
||||||
$folderPath,
|
|
||||||
$bukti2->getContent(),
|
|
||||||
$filename
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ($request->hasFile('bukti3')) {
|
|
||||||
$bukti3 = $request->file('bukti3');
|
|
||||||
$filename = Str::uuid() . '.' . $bukti3->extension();
|
|
||||||
|
|
||||||
$filePaths['bukti3'] = $folderPath . '/' . $filename;
|
|
||||||
|
|
||||||
NextCloudHelper::uploadFile(
|
|
||||||
$folderPath,
|
|
||||||
$bukti3->getContent(),
|
|
||||||
$filename
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate sequence number and expense number
|
// Generate sequence number and expense number
|
||||||
$sequence_number = FormEntertaimentPresentation::withTrashed()->where('expense_number', 'like', $region->code . '-' . $cabang->code . '-ETY-' . date('ym') . '%')->count() + 1;
|
$sequence_number = FormEntertaimentPresentation::withTrashed()->where('expense_number', 'like', $region->code . '-' . $cabang->code . '-ETY-' . date('ym') . '%')->count() + 1;
|
||||||
@@ -150,9 +146,7 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
'name' => $request->name,
|
'name' => $request->name,
|
||||||
'alamat' => $request->alamat,
|
'alamat' => $request->alamat,
|
||||||
'nik_or_npwp' => $request->nik_or_npwp,
|
'nik_or_npwp' => $request->nik_or_npwp,
|
||||||
'bukti1' => $filePaths['bukti1'] ?? null,
|
'bukti_total' => $filePaths['bukti_total'] ?? null,
|
||||||
'bukti2' => $filePaths['bukti2'] ?? null,
|
|
||||||
'bukti3' => $filePaths['bukti3'] ?? null,
|
|
||||||
'account_number' => $kategori->account_number,
|
'account_number' => $kategori->account_number,
|
||||||
'status' => 'On Progress',
|
'status' => 'On Progress',
|
||||||
]);
|
]);
|
||||||
@@ -189,9 +183,7 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
'alamat' => 'required',
|
'alamat' => 'required',
|
||||||
'nik_or_npwp' => 'required',
|
'nik_or_npwp' => 'required',
|
||||||
'bukti1' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
'bukti_total' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
||||||
'bukti2' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
|
||||||
'bukti3' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$form = FormEntertaimentPresentation::findOrfail($id);
|
$form = FormEntertaimentPresentation::findOrfail($id);
|
||||||
@@ -207,43 +199,19 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
$filePaths = [];
|
$filePaths = [];
|
||||||
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/entertainment';
|
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/entertainment';
|
||||||
|
|
||||||
if ($request->hasFile('bukti1')) {
|
if ($request->hasFile('bukti_total')) {
|
||||||
$bukti1 = $request->file('bukti1');
|
$bukti_total = $request->file('bukti_total');
|
||||||
$filename = Str::uuid() . '.' . $bukti1->extension();
|
$filename = Str::uuid() . '.' . $bukti_total->extension();
|
||||||
|
|
||||||
$filePaths['bukti1'] = $folderPath . '/' . $filename;
|
$filePaths['bukti_total'] = $folderPath . '/' . $filename;
|
||||||
|
|
||||||
NextCloudHelper::uploadFile(
|
NextCloudHelper::uploadFile(
|
||||||
$folderPath,
|
$folderPath,
|
||||||
$bukti1->getContent(),
|
$bukti_total->getContent(),
|
||||||
$filename
|
$filename
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($request->hasFile('bukti2')) {
|
|
||||||
$bukti2 = $request->file('bukti2');
|
|
||||||
$filename = Str::uuid() . '.' . $bukti2->extension();
|
|
||||||
|
|
||||||
$filePaths['bukti2'] = $folderPath . '/' . $filename;
|
|
||||||
|
|
||||||
NextCloudHelper::uploadFile(
|
|
||||||
$folderPath,
|
|
||||||
$bukti2->getContent(),
|
|
||||||
$filename
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ($request->hasFile('bukti3')) {
|
|
||||||
$bukti3 = $request->file('bukti3');
|
|
||||||
$filename = Str::uuid() . '.' . $bukti3->extension();
|
|
||||||
|
|
||||||
$filePaths['bukti3'] = $folderPath . '/' . $filename;
|
|
||||||
|
|
||||||
NextCloudHelper::uploadFile(
|
|
||||||
$folderPath,
|
|
||||||
$bukti3->getContent(),
|
|
||||||
$filename
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save the form data
|
// Save the form data
|
||||||
$form->update([
|
$form->update([
|
||||||
@@ -254,9 +222,7 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
'name' => $request->name,
|
'name' => $request->name,
|
||||||
'alamat' => $request->alamat,
|
'alamat' => $request->alamat,
|
||||||
'nik_or_npwp' => $request->nik_or_npwp,
|
'nik_or_npwp' => $request->nik_or_npwp,
|
||||||
'bukti1' => $filePaths['bukti1'] ?? null,
|
'bukti_total' => $filePaths['bukti_total'] ?? $form->bukti_total,
|
||||||
'bukti2' => $filePaths['bukti2'] ?? null,
|
|
||||||
'bukti3' => $filePaths['bukti3'] ?? null,
|
|
||||||
'account_number' => $kategori->account_number,
|
'account_number' => $kategori->account_number,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -265,15 +231,20 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function approve($id)
|
public function approve(Request $request, $id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
||||||
|
$request->validate([
|
||||||
|
'total' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
$form = FormEntertaimentPresentation::findOrfail($id);
|
$form = FormEntertaimentPresentation::findOrfail($id);
|
||||||
$form->update([
|
$form->update([
|
||||||
'approved_at' => now(),
|
'approved_at' => now(),
|
||||||
'approved_by' => auth()->user()->id,
|
'approved_by' => auth()->user()->id,
|
||||||
'status' => 'Approved'
|
'status' => 'Approved',
|
||||||
|
|
||||||
|
'approved_total' => $form->total,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$heads = $form->user->getCabangAndRegionHead();
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
@@ -301,15 +272,16 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
$phoneNumbers = array_unique($phoneNumbers);
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseApproved(
|
// Mail::to($recipients)->send(new ExpenseApproved(
|
||||||
$name,
|
// $name,
|
||||||
$expense_number,
|
// $expense_number,
|
||||||
$tanggal,
|
// $tanggal,
|
||||||
$total
|
// $total
|
||||||
));
|
// ));
|
||||||
|
|
||||||
// Send bulk whatsapp
|
// Send bulk whatsapp
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number);
|
$url = route('forms.entertainment.view', $form->id);
|
||||||
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Approve', 'Approved Expense at Form Entertainment Presentation (' . $expense_number . ')');
|
AuditTrailHelper::AddAuditTrail('Approve', 'Approved Expense at Form Entertainment Presentation (' . $expense_number . ')');
|
||||||
session()->flash('success', 'Form has been approved.');
|
session()->flash('success', 'Form has been approved.');
|
||||||
@@ -357,15 +329,16 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
$phoneNumbers = array_unique($phoneNumbers);
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new FinalApprove(
|
// Mail::to($recipients)->send(new FinalApprove(
|
||||||
$name,
|
// $name,
|
||||||
$expense_number,
|
// $expense_number,
|
||||||
$tanggal,
|
// $tanggal,
|
||||||
$total
|
// $total
|
||||||
));
|
// ));
|
||||||
|
|
||||||
// send whatsapp message
|
// send whatsapp message
|
||||||
WhatsappHelper::finalApprove($phoneNumbers, $expense_number);
|
$url = route('forms.entertainment.view', $form->id);
|
||||||
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Final Approve', 'Final Approved Expense at Form Entertainment Presentation (' . $expense_number . ')');
|
AuditTrailHelper::AddAuditTrail('Final Approve', 'Final Approved Expense at Form Entertainment Presentation (' . $expense_number . ')');
|
||||||
session()->flash('success', 'Form has been final approved.');
|
session()->flash('success', 'Form has been final approved.');
|
||||||
@@ -422,15 +395,16 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
$phoneNumbers = array_unique($phoneNumbers);
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseRejected(
|
// Mail::to($recipients)->send(new ExpenseRejected(
|
||||||
$name,
|
// $name,
|
||||||
$expense_number,
|
// $expense_number,
|
||||||
$tanggal,
|
// $tanggal,
|
||||||
$total
|
// $total
|
||||||
));
|
// ));
|
||||||
|
|
||||||
// Send bulk whatsapp
|
// Send bulk whatsapp
|
||||||
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number);
|
$url = route('forms.entertainment.view', $form->id);
|
||||||
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Reject', 'Reject Expense at Form Entertainment Presentation (' . $expense_number . ')');
|
AuditTrailHelper::AddAuditTrail('Reject', 'Reject Expense at Form Entertainment Presentation (' . $expense_number . ')');
|
||||||
session()->flash('success', 'Form has been rejected.');
|
session()->flash('success', 'Form has been rejected.');
|
||||||
|
|||||||
@@ -65,6 +65,28 @@ class FormOtherController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function detail($id)
|
||||||
|
{
|
||||||
|
$this->checkAuthorization(auth()->user(), ['forms.other.view']);
|
||||||
|
|
||||||
|
$form = FormOthers::with(['user', 'kategori'])->findOrFail($id);
|
||||||
|
$form->bukti_total = $form->bukti_total ? NextCloudHelper::getFileUrl($form->bukti_total) : null;
|
||||||
|
|
||||||
|
return response()->json($form);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($id)
|
||||||
|
{
|
||||||
|
$this->checkAuthorization(auth()->user(), ['forms.other.view']);
|
||||||
|
|
||||||
|
$form = FormOthers::with(['user', 'kategori'])->findOrFail($id);
|
||||||
|
$form->bukti_total = $form->bukti_total ? NextCloudHelper::getFileUrl($form->bukti_total) : null;
|
||||||
|
|
||||||
|
return view('backend.pages.forms.other.view', [
|
||||||
|
'form' => $form,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['forms.other.create']);
|
$this->checkAuthorization(auth()->user(), ['forms.other.create']);
|
||||||
@@ -83,9 +105,7 @@ class FormOtherController extends Controller
|
|||||||
'tanggal' => 'required|date',
|
'tanggal' => 'required|date',
|
||||||
'keterangan' => 'required',
|
'keterangan' => 'required',
|
||||||
'total' => 'required',
|
'total' => 'required',
|
||||||
'bukti1' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
'bukti_total' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
||||||
'bukti2' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
|
||||||
'bukti3' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
||||||
@@ -95,43 +115,19 @@ class FormOtherController extends Controller
|
|||||||
$filePaths = [];
|
$filePaths = [];
|
||||||
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/other';
|
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/other';
|
||||||
|
|
||||||
if ($request->hasFile('bukti1')) {
|
if ($request->hasFile('bukti_total')) {
|
||||||
$bukti1 = $request->file('bukti1');
|
$bukti_total = $request->file('bukti_total');
|
||||||
$filename = Str::uuid() . '.' . $bukti1->extension();
|
$filename = Str::uuid() . '.' . $bukti_total->extension();
|
||||||
|
|
||||||
$filePaths['bukti1'] = $folderPath . '/' . $filename;
|
$filePaths['bukti_total'] = $folderPath . '/' . $filename;
|
||||||
|
|
||||||
NextCloudHelper::uploadFile(
|
NextCloudHelper::uploadFile(
|
||||||
$folderPath,
|
$folderPath,
|
||||||
$bukti1->getContent(),
|
$bukti_total->getContent(),
|
||||||
$filename
|
$filename
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($request->hasFile('bukti2')) {
|
|
||||||
$bukti2 = $request->file('bukti2');
|
|
||||||
$filename = Str::uuid() . '.' . $bukti2->extension();
|
|
||||||
|
|
||||||
$filePaths['bukti2'] = $folderPath . '/' . $filename;
|
|
||||||
|
|
||||||
NextCloudHelper::uploadFile(
|
|
||||||
$folderPath,
|
|
||||||
$bukti2->getContent(),
|
|
||||||
$filename
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ($request->hasFile('bukti3')) {
|
|
||||||
$bukti3 = $request->file('bukti3');
|
|
||||||
$filename = Str::uuid() . '.' . $bukti3->extension();
|
|
||||||
|
|
||||||
$filePaths['bukti3'] = $folderPath . '/' . $filename;
|
|
||||||
|
|
||||||
NextCloudHelper::uploadFile(
|
|
||||||
$folderPath,
|
|
||||||
$bukti3->getContent(),
|
|
||||||
$filename
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate sequence number and expense number
|
// Generate sequence number and expense number
|
||||||
$sequence_number = FormOthers::withTrashed()->where('expense_number', 'like', $region->code . '-' . $cabang->code . '-OTH-' . date('ym') . '%')->count() + 1;
|
$sequence_number = FormOthers::withTrashed()->where('expense_number', 'like', $region->code . '-' . $cabang->code . '-OTH-' . date('ym') . '%')->count() + 1;
|
||||||
@@ -146,9 +142,7 @@ class FormOtherController extends Controller
|
|||||||
'tanggal' => $request->tanggal,
|
'tanggal' => $request->tanggal,
|
||||||
'keterangan' => $request->keterangan,
|
'keterangan' => $request->keterangan,
|
||||||
'total' => $request->total,
|
'total' => $request->total,
|
||||||
'bukti1' => $filePaths['bukti1'] ?? null,
|
'bukti_total' => $filePaths['bukti_total'] ?? null,
|
||||||
'bukti2' => $filePaths['bukti2'] ?? null,
|
|
||||||
'bukti3' => $filePaths['bukti3'] ?? null,
|
|
||||||
'account_number' => $kategori->account_number,
|
'account_number' => $kategori->account_number,
|
||||||
'status' => 'On Progress',
|
'status' => 'On Progress',
|
||||||
]);
|
]);
|
||||||
@@ -183,9 +177,7 @@ class FormOtherController extends Controller
|
|||||||
'tanggal' => 'required|date',
|
'tanggal' => 'required|date',
|
||||||
'keterangan' => 'required',
|
'keterangan' => 'required',
|
||||||
'total' => 'required',
|
'total' => 'required',
|
||||||
'bukti1' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
'bukti_total' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
||||||
'bukti2' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
|
||||||
'bukti3' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$form = FormOthers::findOrfail($id);
|
$form = FormOthers::findOrfail($id);
|
||||||
@@ -201,43 +193,19 @@ class FormOtherController extends Controller
|
|||||||
$filePaths = [];
|
$filePaths = [];
|
||||||
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/other';
|
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/other';
|
||||||
|
|
||||||
if ($request->hasFile('bukti1')) {
|
if ($request->hasFile('bukti_total')) {
|
||||||
$bukti1 = $request->file('bukti1');
|
$bukti_total = $request->file('bukti_total');
|
||||||
$filename = Str::uuid() . '.' . $bukti1->extension();
|
$filename = Str::uuid() . '.' . $bukti_total->extension();
|
||||||
|
|
||||||
$filePaths['bukti1'] = $folderPath . '/' . $filename;
|
$filePaths['bukti_total'] = $folderPath . '/' . $filename;
|
||||||
|
|
||||||
NextCloudHelper::uploadFile(
|
NextCloudHelper::uploadFile(
|
||||||
$folderPath,
|
$folderPath,
|
||||||
$bukti1->getContent(),
|
$bukti_total->getContent(),
|
||||||
$filename
|
$filename
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($request->hasFile('bukti2')) {
|
|
||||||
$bukti2 = $request->file('bukti2');
|
|
||||||
$filename = Str::uuid() . '.' . $bukti2->extension();
|
|
||||||
|
|
||||||
$filePaths['bukti2'] = $folderPath . '/' . $filename;
|
|
||||||
|
|
||||||
NextCloudHelper::uploadFile(
|
|
||||||
$folderPath,
|
|
||||||
$bukti2->getContent(),
|
|
||||||
$filename
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ($request->hasFile('bukti3')) {
|
|
||||||
$bukti3 = $request->file('bukti3');
|
|
||||||
$filename = Str::uuid() . '.' . $bukti3->extension();
|
|
||||||
|
|
||||||
$filePaths['bukti3'] = $folderPath . '/' . $filename;
|
|
||||||
|
|
||||||
NextCloudHelper::uploadFile(
|
|
||||||
$folderPath,
|
|
||||||
$bukti3->getContent(),
|
|
||||||
$filename
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save the form data
|
// Save the form data
|
||||||
$form->update([
|
$form->update([
|
||||||
@@ -245,9 +213,7 @@ class FormOtherController extends Controller
|
|||||||
'tanggal' => $request->tanggal,
|
'tanggal' => $request->tanggal,
|
||||||
'keterangan' => $request->keterangan,
|
'keterangan' => $request->keterangan,
|
||||||
'total' => $request->total,
|
'total' => $request->total,
|
||||||
'bukti1' => $filePaths['bukti1'] ?? $form->bukti1,
|
'bukti_total' => $filePaths['bukti_total'] ?? $form->bukti_total,
|
||||||
'bukti2' => $filePaths['bukti2'] ?? $form->bukti2,
|
|
||||||
'bukti3' => $filePaths['bukti3'] ?? $form->bukti3,
|
|
||||||
'account_number' => $kategori->account_number,
|
'account_number' => $kategori->account_number,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -256,15 +222,21 @@ class FormOtherController extends Controller
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function approve($id)
|
public function approve(Request $request, $id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'total' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
$form = FormOthers::findOrfail($id);
|
$form = FormOthers::findOrfail($id);
|
||||||
$form->update([
|
$form->update([
|
||||||
'approved_at' => now(),
|
'approved_at' => now(),
|
||||||
'approved_by' => auth()->user()->id,
|
'approved_by' => auth()->user()->id,
|
||||||
'status' => 'Approved'
|
'status' => 'Approved',
|
||||||
|
|
||||||
|
'approved_total' => $form->total,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$heads = $form->user->getCabangAndRegionHead();
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
@@ -292,15 +264,16 @@ class FormOtherController extends Controller
|
|||||||
$phoneNumbers = array_unique($phoneNumbers);
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseApproved(
|
// Mail::to($recipients)->send(new ExpenseApproved(
|
||||||
$name,
|
// $name,
|
||||||
$expense_number,
|
// $expense_number,
|
||||||
$tanggal,
|
// $tanggal,
|
||||||
$total
|
// $total
|
||||||
));
|
// ));
|
||||||
|
|
||||||
// Send bulk WhatsApp message
|
// Send bulk WhatsApp message
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number);
|
$url = route('forms.other.view', $form->id);
|
||||||
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Approve', 'Approve Expense at Form Entertainment Presentation (' . $form->expense_number . ')');
|
AuditTrailHelper::AddAuditTrail('Approve', 'Approve Expense at Form Entertainment Presentation (' . $form->expense_number . ')');
|
||||||
session()->flash('success', 'Form has been approved.');
|
session()->flash('success', 'Form has been approved.');
|
||||||
@@ -348,15 +321,16 @@ class FormOtherController extends Controller
|
|||||||
$phoneNumbers = array_unique($phoneNumbers);
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new FinalApprove(
|
// Mail::to($recipients)->send(new FinalApprove(
|
||||||
$name,
|
// $name,
|
||||||
$expense_number,
|
// $expense_number,
|
||||||
$tanggal,
|
// $tanggal,
|
||||||
$total
|
// $total
|
||||||
));
|
// ));
|
||||||
|
|
||||||
// send whatsapp message
|
// send whatsapp message
|
||||||
WhatsappHelper::finalApprove($phoneNumbers, $expense_number);
|
$url = route('forms.other.view', $form->id);
|
||||||
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Final Approve', 'Final Approve Expense at Form Entertainment Presentation (' . $form->expense_number . ')');
|
AuditTrailHelper::AddAuditTrail('Final Approve', 'Final Approve Expense at Form Entertainment Presentation (' . $form->expense_number . ')');
|
||||||
session()->flash('success', 'Form has been final approved.');
|
session()->flash('success', 'Form has been final approved.');
|
||||||
@@ -413,15 +387,16 @@ class FormOtherController extends Controller
|
|||||||
$phoneNumbers = array_unique($phoneNumbers);
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseRejected(
|
// Mail::to($recipients)->send(new ExpenseRejected(
|
||||||
$name,
|
// $name,
|
||||||
$expense_number,
|
// $expense_number,
|
||||||
$tanggal,
|
// $tanggal,
|
||||||
$total
|
// $total
|
||||||
));
|
// ));
|
||||||
|
|
||||||
// Send bulk WhatsApp message
|
// Send bulk WhatsApp message
|
||||||
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number);
|
$url = route('forms.other.view', $form->id);
|
||||||
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Reject', 'Reject Expense at Form Entertainment Presentation (' . $form->expense_number . ')');
|
AuditTrailHelper::AddAuditTrail('Reject', 'Reject Expense at Form Entertainment Presentation (' . $form->expense_number . ')');
|
||||||
session()->flash('success', 'Form has been rejected.');
|
session()->flash('success', 'Form has been rejected.');
|
||||||
|
|||||||
@@ -65,6 +65,28 @@ class FormVehicleController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function detail($id)
|
||||||
|
{
|
||||||
|
$this->checkAuthorization(auth()->user(), ['forms.vehicle.view']);
|
||||||
|
|
||||||
|
$form = FormVehicleRunningCost::with('user')->findOrFail($id);
|
||||||
|
$form->bukti_total = $form->bukti_total ? NextCloudHelper::getFileUrl($form->bukti_total) : null;
|
||||||
|
|
||||||
|
return response()->json($form);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($id)
|
||||||
|
{
|
||||||
|
$this->checkAuthorization(auth()->user(), ['forms.vehicle.view']);
|
||||||
|
|
||||||
|
$form = FormVehicleRunningCost::with('user')->findOrFail($id);
|
||||||
|
$form->bukti_total = $form->bukti_total ? NextCloudHelper::getFileUrl($form->bukti_total) : null;
|
||||||
|
|
||||||
|
return view('backend.pages.forms.vehicle.view', [
|
||||||
|
'form' => $form,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['forms.vehicle.create']);
|
$this->checkAuthorization(auth()->user(), ['forms.vehicle.create']);
|
||||||
@@ -84,9 +106,7 @@ class FormVehicleController extends Controller
|
|||||||
'tipe_bensin' => 'required|in:pertalite,pertamax',
|
'tipe_bensin' => 'required|in:pertalite,pertamax',
|
||||||
'nopol' => 'required',
|
'nopol' => 'required',
|
||||||
'keterangan' => 'required',
|
'keterangan' => 'required',
|
||||||
'bukti1' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
'bukti_total' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
||||||
'bukti2' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
|
||||||
'bukti3' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
||||||
@@ -96,43 +116,19 @@ class FormVehicleController extends Controller
|
|||||||
$filePaths = [];
|
$filePaths = [];
|
||||||
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/vehicle';
|
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/vehicle';
|
||||||
|
|
||||||
if ($request->hasFile('bukti1')) {
|
if ($request->hasFile('bukti_total')) {
|
||||||
$bukti1 = $request->file('bukti1');
|
$bukti_total = $request->file('bukti_total');
|
||||||
$filename = Str::uuid() . '.' . $bukti1->extension();
|
$filename = Str::uuid() . '.' . $bukti_total->extension();
|
||||||
|
|
||||||
$filePaths['bukti1'] = $folderPath . '/' . $filename;
|
$filePaths['bukti_total'] = $folderPath . '/' . $filename;
|
||||||
|
|
||||||
NextCloudHelper::uploadFile(
|
NextCloudHelper::uploadFile(
|
||||||
$folderPath,
|
$folderPath,
|
||||||
$bukti1->getContent(),
|
$bukti_total->getContent(),
|
||||||
$filename
|
$filename
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($request->hasFile('bukti2')) {
|
|
||||||
$bukti2 = $request->file('bukti2');
|
|
||||||
$filename = Str::uuid() . '.' . $bukti2->extension();
|
|
||||||
|
|
||||||
$filePaths['bukti2'] = $folderPath . '/' . $filename;
|
|
||||||
|
|
||||||
NextCloudHelper::uploadFile(
|
|
||||||
$folderPath,
|
|
||||||
$bukti2->getContent(),
|
|
||||||
$filename
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ($request->hasFile('bukti3')) {
|
|
||||||
$bukti3 = $request->file('bukti3');
|
|
||||||
$filename = Str::uuid() . '.' . $bukti3->extension();
|
|
||||||
|
|
||||||
$filePaths['bukti3'] = $folderPath . '/' . $filename;
|
|
||||||
|
|
||||||
NextCloudHelper::uploadFile(
|
|
||||||
$folderPath,
|
|
||||||
$bukti3->getContent(),
|
|
||||||
$filename
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate sequence number and expense number
|
// Generate sequence number and expense number
|
||||||
$sequence_number = FormVehicleRunningCost::withTrashed()->where('expense_number', 'like', $region->code . '-' . $cabang->code . '-VHC-' . date('ym') . '%')->count() + 1;
|
$sequence_number = FormVehicleRunningCost::withTrashed()->where('expense_number', 'like', $region->code . '-' . $cabang->code . '-VHC-' . date('ym') . '%')->count() + 1;
|
||||||
@@ -150,9 +146,7 @@ class FormVehicleController extends Controller
|
|||||||
'tipe_bensin' => $request->tipe_bensin,
|
'tipe_bensin' => $request->tipe_bensin,
|
||||||
'nopol' => $request->nopol,
|
'nopol' => $request->nopol,
|
||||||
'keterangan' => $request->keterangan,
|
'keterangan' => $request->keterangan,
|
||||||
'bukti1' => $filePaths['bukti1'] ?? null,
|
'bukti_total' => $filePaths['bukti_total'] ?? null,
|
||||||
'bukti2' => $filePaths['bukti2'] ?? null,
|
|
||||||
'bukti3' => $filePaths['bukti3'] ?? null,
|
|
||||||
'account_number' => $kategori->account_number,
|
'account_number' => $kategori->account_number,
|
||||||
'status' => 'On Progress',
|
'status' => 'On Progress',
|
||||||
]);
|
]);
|
||||||
@@ -189,9 +183,7 @@ class FormVehicleController extends Controller
|
|||||||
'tipe_bensin' => 'required|in:pertalite,pertamax',
|
'tipe_bensin' => 'required|in:pertalite,pertamax',
|
||||||
'nopol' => 'required',
|
'nopol' => 'required',
|
||||||
'keterangan' => 'required',
|
'keterangan' => 'required',
|
||||||
'bukti1' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
'bukti_total' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
||||||
'bukti2' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
|
||||||
'bukti3' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$form = FormVehicleRunningCost::findOrfail($id);
|
$form = FormVehicleRunningCost::findOrfail($id);
|
||||||
@@ -207,43 +199,19 @@ class FormVehicleController extends Controller
|
|||||||
$filePaths = [];
|
$filePaths = [];
|
||||||
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/vehicle';
|
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/vehicle';
|
||||||
|
|
||||||
if ($request->hasFile('bukti1')) {
|
if ($request->hasFile('bukti_total')) {
|
||||||
$bukti1 = $request->file('bukti1');
|
$bukti_total = $request->file('bukti_total');
|
||||||
$filename = Str::uuid() . '.' . $bukti1->extension();
|
$filename = Str::uuid() . '.' . $bukti_total->extension();
|
||||||
|
|
||||||
$filePaths['bukti1'] = $folderPath . '/' . $filename;
|
$filePaths['bukti_total'] = $folderPath . '/' . $filename;
|
||||||
|
|
||||||
NextCloudHelper::uploadFile(
|
NextCloudHelper::uploadFile(
|
||||||
$folderPath,
|
$folderPath,
|
||||||
$bukti1->getContent(),
|
$bukti_total->getContent(),
|
||||||
$filename
|
$filename
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($request->hasFile('bukti2')) {
|
|
||||||
$bukti2 = $request->file('bukti2');
|
|
||||||
$filename = Str::uuid() . '.' . $bukti2->extension();
|
|
||||||
|
|
||||||
$filePaths['bukti2'] = $folderPath . '/' . $filename;
|
|
||||||
|
|
||||||
NextCloudHelper::uploadFile(
|
|
||||||
$folderPath,
|
|
||||||
$bukti2->getContent(),
|
|
||||||
$filename
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ($request->hasFile('bukti3')) {
|
|
||||||
$bukti3 = $request->file('bukti3');
|
|
||||||
$filename = Str::uuid() . '.' . $bukti3->extension();
|
|
||||||
|
|
||||||
$filePaths['bukti3'] = $folderPath . '/' . $filename;
|
|
||||||
|
|
||||||
NextCloudHelper::uploadFile(
|
|
||||||
$folderPath,
|
|
||||||
$bukti3->getContent(),
|
|
||||||
$filename
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save the form data
|
// Save the form data
|
||||||
$form->update([
|
$form->update([
|
||||||
@@ -254,9 +222,7 @@ class FormVehicleController extends Controller
|
|||||||
'tipe_bensin' => $request->tipe_bensin,
|
'tipe_bensin' => $request->tipe_bensin,
|
||||||
'nopol' => $request->nopol,
|
'nopol' => $request->nopol,
|
||||||
'keterangan' => $request->keterangan,
|
'keterangan' => $request->keterangan,
|
||||||
'bukti1' => $filePaths['bukti1'] ?? $form->bukti1,
|
'bukti_total' => $filePaths['bukti_total'] ?? $form->bukti_total,
|
||||||
'bukti2' => $filePaths['bukti2'] ?? $form->bukti2,
|
|
||||||
'bukti3' => $filePaths['bukti3'] ?? $form->bukti3,
|
|
||||||
'account_number' => $kategori->account_number,
|
'account_number' => $kategori->account_number,
|
||||||
'status' => 'On Progress',
|
'status' => 'On Progress',
|
||||||
]);
|
]);
|
||||||
@@ -266,15 +232,20 @@ class FormVehicleController extends Controller
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function approve($id)
|
public function approve(Request $request, $id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
||||||
|
$request->validate([
|
||||||
|
'total' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
$form = FormVehicleRunningCost::findOrfail($id);
|
$form = FormVehicleRunningCost::findOrfail($id);
|
||||||
$form->update([
|
$form->update([
|
||||||
'approved_at' => now(),
|
'approved_at' => now(),
|
||||||
'approved_by' => auth()->user()->id,
|
'approved_by' => auth()->user()->id,
|
||||||
'status' => 'Approved'
|
'status' => 'Approved',
|
||||||
|
|
||||||
|
'approved_total' => $form->total,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$heads = $form->user->getCabangAndRegionHead();
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
@@ -302,15 +273,16 @@ class FormVehicleController extends Controller
|
|||||||
$phoneNumbers = array_unique($phoneNumbers);
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseApproved(
|
// Mail::to($recipients)->send(new ExpenseApproved(
|
||||||
$name,
|
// $name,
|
||||||
$expense_number,
|
// $expense_number,
|
||||||
$tanggal,
|
// $tanggal,
|
||||||
$total
|
// $total
|
||||||
));
|
// ));
|
||||||
|
|
||||||
// Send bulk WhatsApp message
|
// Send bulk WhatsApp message
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number);
|
$url = route('forms.vehicle.view', $form->id);
|
||||||
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Approve', 'Approve Expense at Form Entertainment Presentation (' . $form->expense_number . ')');
|
AuditTrailHelper::AddAuditTrail('Approve', 'Approve Expense at Form Entertainment Presentation (' . $form->expense_number . ')');
|
||||||
session()->flash('success', 'Form has been approved.');
|
session()->flash('success', 'Form has been approved.');
|
||||||
@@ -358,15 +330,16 @@ class FormVehicleController extends Controller
|
|||||||
$phoneNumbers = array_unique($phoneNumbers);
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new FinalApprove(
|
// Mail::to($recipients)->send(new FinalApprove(
|
||||||
$name,
|
// $name,
|
||||||
$expense_number,
|
// $expense_number,
|
||||||
$tanggal,
|
// $tanggal,
|
||||||
$total
|
// $total
|
||||||
));
|
// ));
|
||||||
|
|
||||||
// send whatsapp message
|
// send whatsapp message
|
||||||
WhatsappHelper::finalApprove($phoneNumbers, $expense_number);
|
$url = route('forms.vehicle.view', $form->id);
|
||||||
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Final Approve', 'Final Approve Expense at Form Entertainment Presentation (' . $form->expense_number . ')');
|
AuditTrailHelper::AddAuditTrail('Final Approve', 'Final Approve Expense at Form Entertainment Presentation (' . $form->expense_number . ')');
|
||||||
session()->flash('success', 'Form has been final approved.');
|
session()->flash('success', 'Form has been final approved.');
|
||||||
@@ -423,15 +396,16 @@ class FormVehicleController extends Controller
|
|||||||
$phoneNumbers = array_unique($phoneNumbers);
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseRejected(
|
// Mail::to($recipients)->send(new ExpenseRejected(
|
||||||
$name,
|
// $name,
|
||||||
$expense_number,
|
// $expense_number,
|
||||||
$tanggal,
|
// $tanggal,
|
||||||
$total
|
// $total
|
||||||
));
|
// ));
|
||||||
|
|
||||||
// Send bulk WhatsApp message
|
// Send bulk WhatsApp message
|
||||||
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number);
|
$url = route('forms.vehicle.view', $form->id);
|
||||||
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Reject', 'Reject Expense at Form Entertainment Presentation (' . $form->expense_number . ')');
|
AuditTrailHelper::AddAuditTrail('Reject', 'Reject Expense at Form Entertainment Presentation (' . $form->expense_number . ')');
|
||||||
session()->flash('success', 'Form has been rejected.');
|
session()->flash('success', 'Form has been rejected.');
|
||||||
|
|||||||
@@ -21,9 +21,7 @@ class FormEntertaimentPresentation extends Model
|
|||||||
'name',
|
'name',
|
||||||
'alamat',
|
'alamat',
|
||||||
'nik_or_npwp',
|
'nik_or_npwp',
|
||||||
'bukti1',
|
'bukti_total',
|
||||||
'bukti2',
|
|
||||||
'bukti3',
|
|
||||||
'account_number',
|
'account_number',
|
||||||
'status',
|
'status',
|
||||||
'approved_at',
|
'approved_at',
|
||||||
|
|||||||
@@ -18,9 +18,7 @@ class FormOthers extends Model
|
|||||||
'keterangan',
|
'keterangan',
|
||||||
'total',
|
'total',
|
||||||
'approved_total',
|
'approved_total',
|
||||||
'bukti1',
|
'bukti_total',
|
||||||
'bukti2',
|
|
||||||
'bukti3',
|
|
||||||
'account_number',
|
'account_number',
|
||||||
'status',
|
'status',
|
||||||
'approved_at',
|
'approved_at',
|
||||||
|
|||||||
@@ -21,9 +21,7 @@ class FormVehicleRunningCost extends Model
|
|||||||
'tipe_bensin',
|
'tipe_bensin',
|
||||||
'nopol',
|
'nopol',
|
||||||
'keterangan',
|
'keterangan',
|
||||||
'bukti1',
|
'bukti_total',
|
||||||
'bukti2',
|
|
||||||
'bukti3',
|
|
||||||
'account_number',
|
'account_number',
|
||||||
'status',
|
'status',
|
||||||
'approved_at',
|
'approved_at',
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('form_vehicle_running_cost', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('bukti1');
|
||||||
|
$table->dropColumn('bukti2');
|
||||||
|
$table->dropColumn('bukti3');
|
||||||
|
|
||||||
|
$table->string('bukti_total')->after('approved_total')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('form_vehicle_running_cost', function (Blueprint $table) {
|
||||||
|
$table->string('bukti1')->after('approved_total')->nullable()->change();
|
||||||
|
$table->string('bukti2')->after('bukti1')->nullable()->change();
|
||||||
|
$table->string('bukti3')->after('bukti2')->nullable()->change();
|
||||||
|
|
||||||
|
$table->dropColumn('bukti_total');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('form_entertainment_presentation', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('bukti1');
|
||||||
|
$table->dropColumn('bukti2');
|
||||||
|
$table->dropColumn('bukti3');
|
||||||
|
|
||||||
|
$table->string('bukti_total')->after('approved_total')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('form_entertainment_presentation', function (Blueprint $table) {
|
||||||
|
$table->string('bukti1')->after('approved_total')->nullable()->change();
|
||||||
|
$table->string('bukti2')->after('bukti1')->nullable()->change();
|
||||||
|
$table->string('bukti3')->after('bukti2')->nullable()->change();
|
||||||
|
|
||||||
|
$table->dropColumn('bukti_total');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('form_others', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('bukti1');
|
||||||
|
$table->dropColumn('bukti2');
|
||||||
|
$table->dropColumn('bukti3');
|
||||||
|
|
||||||
|
$table->string('bukti_total')->after('approved_total')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('form_others', function (Blueprint $table) {
|
||||||
|
$table->string('bukti1')->after('approved_total')->nullable()->change();
|
||||||
|
$table->string('bukti2')->after('bukti1')->nullable()->change();
|
||||||
|
$table->string('bukti3')->after('bukti2')->nullable()->change();
|
||||||
|
|
||||||
|
$table->dropColumn('bukti_total');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -32,11 +32,11 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Tanggal</label>
|
<label class="form-label">Tanggal <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="date" class="form-control" name="tanggal" required value="{{ old('tanggal') }}">
|
<input type="date" class="form-control" name="tanggal" required value="{{ old('tanggal') }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Jenis</label>
|
<label class="form-label">Jenis <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<select class="form-control form-control-md" name="jenis" required>
|
<select class="form-control form-control-md" name="jenis" required>
|
||||||
<option value="">Pilih Jenis</option>
|
<option value="">Pilih Jenis</option>
|
||||||
<option value="entertainment" {{ old('jenis') == 'entertainment' ? 'selected' : '' }}>Entertainment</option>
|
<option value="entertainment" {{ old('jenis') == 'entertainment' ? 'selected' : '' }}>Entertainment</option>
|
||||||
@@ -45,39 +45,31 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Nama Penerima</label>
|
<label class="form-label">Nama Penerima <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="text" class="form-control" name="name" required value="{{ old('name') }}">
|
<input type="text" class="form-control" name="name" required value="{{ old('name') }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Alamat</label>
|
<label class="form-label">NPWP / NIK <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="text" class="form-control" name="alamat" id="alamat" required value="{{ old('alamat') }}">
|
<input type="text" class="form-control" name="nik_or_npwp" id="nik_or_npwp" required value="{{ old('nik_or_npwp') }}">
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label class="form-label">Keterangan</label>
|
|
||||||
<textarea class="form-control" name="keterangan" required>{{ old('keterangan') }}</textarea>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">NPWP / NIK</label>
|
<label class="form-label">Alamat <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="text" class="form-control" name="nik_or_npwp" id="nik_or_npwp" required value="{{ old('nik_or_npwp') }}">
|
<input type="text" class="form-control" name="alamat" id="alamat" required value="{{ old('alamat') }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Total</label>
|
<label class="form-label">Total <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="string" class="form-control" name="total" id="total" required value="{{ old('total') }}">
|
<input type="string" class="form-control" name="total" id="total" required value="{{ old('total') }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Bukti 1</label>
|
<label class="form-label">Bukti Total <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="file" class="form-control" name="bukti1" value="{{ old('bukti1') }}">
|
<input type="file" class="form-control" name="bukti_total" value="{{ old('bukti_total') }}" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Bukti 2</label>
|
<label class="form-label">Keterangan <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="file" class="form-control" name="bukti2" value="{{ old('bukti2') }}">
|
<textarea class="form-control" name="keterangan" required>{{ old('keterangan') }}</textarea>
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label class="form-label">Bukti 3</label>
|
|
||||||
<input type="file" class="form-control" name="bukti3" value="{{ old('bukti3') }}">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -33,11 +33,11 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Tanggal</label>
|
<label class="form-label">Tanggal <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="date" class="form-control" name="tanggal" required value="{{ $form->tanggal }}">
|
<input type="date" class="form-control" name="tanggal" required value="{{ $form->tanggal }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Jenis</label>
|
<label class="form-label">Jenis <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<select class="form-control form-control-md" name="jenis" required>
|
<select class="form-control form-control-md" name="jenis" required>
|
||||||
<option value="">Pilih Jenis</option>
|
<option value="">Pilih Jenis</option>
|
||||||
<option value="entertainment" {{ $form->jenis == 'entertainment' ? 'selected' : '' }}>Entertainment</option>
|
<option value="entertainment" {{ $form->jenis == 'entertainment' ? 'selected' : '' }}>Entertainment</option>
|
||||||
@@ -46,39 +46,31 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Nama Penerima</label>
|
<label class="form-label">Nama Penerima <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="text" class="form-control" name="name" required value="{{ $form->name }}">
|
<input type="text" class="form-control" name="name" required value="{{ $form->name }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Alamat</label>
|
<label class="form-label">NPWP / NIK <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="text" class="form-control" name="alamat" id="alamat" required value="{{ $form->alamat }}">
|
<input type="text" class="form-control" name="nik_or_npwp" id="nik_or_npwp" required value="{{ $form->nik_or_npwp }}">
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label class="form-label">Keterangan</label>
|
|
||||||
<textarea class="form-control" name="keterangan" required>{{ $form->keterangan }}</textarea>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">NPWP / NIK</label>
|
<label class="form-label">Alamat <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="text" class="form-control" name="nik_or_npwp" id="nik_or_npwp" required value="{{ $form->nik_or_npwp }}">
|
<input type="text" class="form-control" name="alamat" id="alamat" required value="{{ $form->alamat }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Total</label>
|
<label class="form-label">Total <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="string" class="form-control" name="total" id="total" required value="{{ $form->total }}">
|
<input type="string" class="form-control" name="total" id="total" required value="{{ $form->total }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Bukti 1</label>
|
<label class="form-label">Bukti Total <span class="font-italic font-weight-normal">(optional)</span></label>
|
||||||
<input type="file" class="form-control" name="bukti1" value="{{ old('bukti1') }}">
|
<input type="file" class="form-control" name="bukti_total" value="{{ old('bukti_total') }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Bukti 2</label>
|
<label class="form-label">Keterangan <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="file" class="form-control" name="bukti2" value="{{ old('bukti2') }}">
|
<textarea class="form-control" name="keterangan" required>{{ $form->keterangan }}</textarea>
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label class="form-label">Bukti 3</label>
|
|
||||||
<input type="file" class="form-control" name="bukti3" value="{{ old('bukti3') }}">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
<div class="col-lg-4 col-6">
|
<div class="col-lg-4 col-6">
|
||||||
<div class="small-box bg-success">
|
<div class="small-box bg-success">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<h3>Rp {{ number_format($forms->whereIn('status', ['Approved', 'Closed'])->sum('total'), 0, ',', '.') }}</h3>
|
<h3>Rp {{ number_format($forms->whereIn('status', ['Approved', 'Closed'])->sum('approved_total'), 0, ',', '.') }}</h3>
|
||||||
<p>Approved Expenses</p>
|
<p>Approved Expenses</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
@@ -84,15 +84,14 @@
|
|||||||
<thead class="bg-light text-capitalize">
|
<thead class="bg-light text-capitalize">
|
||||||
<tr>
|
<tr>
|
||||||
<th>#</th>
|
<th>#</th>
|
||||||
<th>Nama</th>
|
<th>User</th>
|
||||||
|
<th>Nama Penerima</th>
|
||||||
<th>Tanggal</th>
|
<th>Tanggal</th>
|
||||||
<th>Jenis</th>
|
<th>Jenis</th>
|
||||||
<th>Keterangan</th>
|
<th>Keterangan</th>
|
||||||
<th>Total</th>
|
<th>Total</th>
|
||||||
<th>Nama Penerima</th>
|
<th>Total Approved</th>
|
||||||
<th>Bukti 1</th>
|
<th>Bukti</th>
|
||||||
<th>Bukti 2</th>
|
|
||||||
<th>Bukti 3</th>
|
|
||||||
<th>Account Number</th>
|
<th>Account Number</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
@if (auth()->user()->can('approval.approve'))
|
@if (auth()->user()->can('approval.approve'))
|
||||||
@@ -112,32 +111,15 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{{ $loop->iteration }}</td>
|
<td>{{ $loop->iteration }}</td>
|
||||||
<td>{{ $item->user->name }}</td>
|
<td>{{ $item->user->name }}</td>
|
||||||
|
<td>{{ $item->name }}</td>
|
||||||
<td>{{ \Carbon\Carbon::parse($item->tanggal)->locale('id')->isoFormat('D MMMM Y') }}</td>
|
<td>{{ \Carbon\Carbon::parse($item->tanggal)->locale('id')->isoFormat('D MMMM Y') }}</td>
|
||||||
<td>{{ $item->jenis }}</td>
|
<td>{{ $item->jenis }}</td>
|
||||||
<td>{{ $item->keterangan }}</td>
|
<td>{{ $item->keterangan }}</td>
|
||||||
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
|
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
|
||||||
<td>{{ $item->name }}</td>
|
<td>{{ number_format($item->approved_total, 0, ',', '.') }}</td>
|
||||||
<td>
|
<td>
|
||||||
@if ($item->bukti1)
|
@if ($item->bukti_total)
|
||||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti1) }}" target="_blank">
|
<a href="{{ NextCloudHelper::getFileUrl($item->bukti_total) }}" target="_blank">
|
||||||
Download
|
|
||||||
</a>
|
|
||||||
@else
|
|
||||||
-
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@if ($item->bukti2)
|
|
||||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti2) }}" target="_blank">
|
|
||||||
Download
|
|
||||||
</a>
|
|
||||||
@else
|
|
||||||
-
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@if ($item->bukti3)
|
|
||||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti3) }}" target="_blank">
|
|
||||||
Download
|
Download
|
||||||
</a>
|
</a>
|
||||||
@else
|
@else
|
||||||
@@ -158,10 +140,10 @@
|
|||||||
<td>
|
<td>
|
||||||
{{-- approve / reject button --}}
|
{{-- approve / reject button --}}
|
||||||
@if ($item->status == 'On Progress')
|
@if ($item->status == 'On Progress')
|
||||||
<form action="{{ route('forms.entertainment.approve', $item->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this item?');">
|
<form action="javascript:void(0);" class="d-inline">
|
||||||
@csrf
|
<button type="button"
|
||||||
@method('PUT')
|
class="btn btn-success btn-sm open-approve-modal"
|
||||||
<button type="submit" class="btn btn-success btn-sm">
|
data-id="{{ route('forms.entertainment.approve', $item->id) }}">
|
||||||
Approve
|
Approve
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -213,6 +195,12 @@
|
|||||||
</td>
|
</td>
|
||||||
@endif
|
@endif
|
||||||
<td>
|
<td>
|
||||||
|
@if (auth()->user()->can('forms.entertainment.view'))
|
||||||
|
<a href="{{ route('forms.entertainment.view', $item->id) }}" class="btn btn-primary btn-sm">
|
||||||
|
<i class="fas fa-eye text-white"></i>
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
|
||||||
@if (auth()->user()->can('forms.entertainment.edit'))
|
@if (auth()->user()->can('forms.entertainment.edit'))
|
||||||
<a href="{{ route('forms.entertainment.edit', $item->id) }}" class="btn btn-warning btn-sm">
|
<a href="{{ route('forms.entertainment.edit', $item->id) }}" class="btn btn-warning btn-sm">
|
||||||
<i class="fas fa-edit text-white"></i>
|
<i class="fas fa-edit text-white"></i>
|
||||||
@@ -239,20 +227,178 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<section>
|
||||||
|
<div class="modal fade" id="approveModal" tabindex="-1" role="dialog" aria-labelledby="approveModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form id="approveForm" method="POST" action="">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="approveModalLabel">Approve Item</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<!-- Loading spinner -->
|
||||||
|
<div id="loadingSpinner" class="d-flex justify-content-center align-items-center" style="height: 200px;">
|
||||||
|
<div class="spinner-border text-primary" role="status">
|
||||||
|
<span class="sr-only">Loading...</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal content (hidden initially) -->
|
||||||
|
<div id="modalContent" class="d-none">
|
||||||
|
<p>Please review the details below:</p>
|
||||||
|
<ul class="list-group">
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Expense Number:</strong> <span id="expense_number"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>User:</strong> <span id="user"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>NIK/NPWP Penerima:</strong> <span id="nik_or_npwp"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Nama Penerima:</strong> <span id="name"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Alamat Penerima:</strong> <span id="alamat"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Jenis:</strong> <span id="jenis"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Tanggal:</strong> <span id="tanggal"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Keterangan:</strong> <span id="keterangan"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Bukti Total Pengeluaran:</strong> <span id="bukti_total"></span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<p class="mt-2">Please select the items you want to approve:</p>
|
||||||
|
<ul class="list-group list-unstyled">
|
||||||
|
<li>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="custom-control custom-checkbox">
|
||||||
|
<input type="checkbox" class="custom-control-input" id="total_bensin" name="total_bensin">
|
||||||
|
<label class="custom-control-label" for="total_bensin">Total Pengeluaran (<span id="total_bensin_value"></span>)</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="total">Total</label>
|
||||||
|
<input type="text" class="form-control" id="total" name="total" value="0" readonly>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||||
|
<button type="submit" class="btn btn-primary">Approve</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('scripts')
|
@section('scripts')
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
// Uncheck all checkboxes on page refresh
|
||||||
|
$('.custom-control-input').prop('checked', false);
|
||||||
|
|
||||||
if ($('#dataTable').length) {
|
if ($('#dataTable').length) {
|
||||||
$('#dataTable').DataTable({
|
$('#dataTable').DataTable({
|
||||||
responsive: false,
|
responsive: false,
|
||||||
dom: 'Bfrtip',
|
dom: 'Bfrtip',
|
||||||
buttons: [
|
buttons: ['excel', 'pdf', 'print']
|
||||||
'excel', 'pdf', 'print'
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle Approve Button Click
|
||||||
|
$('.open-approve-modal').on('click', function () {
|
||||||
|
const approveUrl = $(this).data('id');
|
||||||
|
|
||||||
|
// Show spinner and hide content initially
|
||||||
|
$('#loadingSpinner').show();
|
||||||
|
$('#modalContent').addClass('d-none');
|
||||||
|
|
||||||
|
$('#approveForm').attr('action', approveUrl); // Set the form action
|
||||||
|
$('#loadingSpinner').addClass('d-flex');
|
||||||
|
$('#approveModal').modal('show'); // Show the modal
|
||||||
|
|
||||||
|
// Get detail from /forms/up-country/detail/{id}
|
||||||
|
$.get(approveUrl.replace('approve', 'detail'), function (data) {
|
||||||
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'IDR',
|
||||||
|
minimumFractionDigits: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#total_bensin_value').text(formatter.format(data.total));
|
||||||
|
$('#total_bensin').data('value', data.total);
|
||||||
|
|
||||||
|
// Detail data
|
||||||
|
$('#user').text(data.user.name);
|
||||||
|
$('#nik_or_npwp').text(data.nik_or_npwp);
|
||||||
|
$('#name').text(data.name);
|
||||||
|
$('#alamat').text(data.alamat);
|
||||||
|
$('#expense_number').text(data.expense_number);
|
||||||
|
$('#jenis').text(data.jenis);
|
||||||
|
$('#keterangan').text(data.keterangan);
|
||||||
|
$('#tanggal').text(new Date(data.tanggal).toLocaleDateString('id-ID', {
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'long',
|
||||||
|
day: 'numeric',
|
||||||
|
}));
|
||||||
|
|
||||||
|
$('#bukti_total').html(data.bukti_total ? '<a href="' + data.bukti_total + '" target="_blank">Download</a>' : '-');
|
||||||
|
|
||||||
|
// Hide spinner and show content
|
||||||
|
$('#loadingSpinner').hide();
|
||||||
|
$('#loadingSpinner').removeClass('d-flex');
|
||||||
|
$('#loadingSpinner').addClass('d-none');
|
||||||
|
$('#modalContent').removeClass('d-none');
|
||||||
|
|
||||||
|
// Reset the total to zero
|
||||||
|
$('#total').val(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update total dynamically
|
||||||
|
$('.custom-control-input').on('change', function () {
|
||||||
|
let total = 0;
|
||||||
|
|
||||||
|
// Calculate the total based on checked checkboxes
|
||||||
|
$('.custom-control-input:checked').each(function () {
|
||||||
|
total += parseFloat($(this).data('value') || 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update the total field with formatted value
|
||||||
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'IDR',
|
||||||
|
minimumFractionDigits: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#total').val(formatter.format(total));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Uncheck all checkboxes when the modal is closed
|
||||||
|
$('#approveModal').on('hidden.bs.modal', function () {
|
||||||
|
$('.custom-control-input').prop('checked', false); // Uncheck all checkboxes
|
||||||
|
$('#total').val('0'); // Reset total to 0
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('title')
|
||||||
|
Dashboard
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('admin-content')
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/autonumeric@4.6.0/dist/autoNumeric.min.js"></script>
|
||||||
|
|
||||||
|
<section class="content-header">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row mb-2">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<h1>Lihat Expense Entertainment & Presentation</h1>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<ol class="breadcrumb float-sm-right">
|
||||||
|
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section class="content">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="card card-primary card-outline">
|
||||||
|
<div class="card-body">
|
||||||
|
<form method="POST" action="{{ route('forms.entertainment.update', $form->id) }}" enctype="multipart/form-data">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
@include('backend.layouts.partials.messages')
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">No Expense</label>
|
||||||
|
<input type="text" class="form-control" name="expense_number" value="{{ $form->expense_number }}" readonly>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Tanggal</label>
|
||||||
|
<input type="date" class="form-control" name="tanggal" readonly value="{{ $form->tanggal }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Jenis</label>
|
||||||
|
<select class="form-control form-control-md" name="jenis" disabled>
|
||||||
|
<option value="">Pilih Jenis</option>
|
||||||
|
<option value="entertainment" {{ $form->jenis == 'entertainment' ? 'selected' : '' }}>Entertainment</option>
|
||||||
|
<option value="presentation" {{ $form->jenis == 'presentation' ? 'selected' : '' }}>Presentation</option>
|
||||||
|
<option value="sponsorship" {{ $form->jenis == 'sponsorship' ? 'selected' : '' }}>Sponsorship</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Nama Penerima</label>
|
||||||
|
<input type="text" class="form-control" name="name" readonly value="{{ $form->name }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">NPWP / NIK</label>
|
||||||
|
<input type="text" class="form-control" name="nik_or_npwp" id="nik_or_npwp" readonly value="{{ $form->nik_or_npwp }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Alamat</label>
|
||||||
|
<input type="text" class="form-control" name="alamat" id="alamat" readonly value="{{ $form->alamat }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Total</label>
|
||||||
|
<input type="string" class="form-control" name="total" id="total" readonly value="{{ $form->total }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Bukti Total</label><br>
|
||||||
|
<a href="{{ $form->bukti_total }}" target="_blank">Lihat Bukti</a>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Keterangan</label>
|
||||||
|
<textarea class="form-control" name="keterangan" readonly>{{ $form->keterangan }}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<a href="{{ route('forms.entertainment') }}" class="btn btn-secondary">Kembali</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
new AutoNumeric('#total', {
|
||||||
|
digitGroupSeparator: '.', // Pemisah ribuan
|
||||||
|
decimalCharacter: ',', // Karakter desimal (tidak digunakan karena tanpa desimal)
|
||||||
|
currencySymbol: 'Rp.', // Simbol mata uang
|
||||||
|
decimalPlaces: 0, // Tidak ada angka desimal
|
||||||
|
unformatOnSubmit: true // Nilai asli tanpa format saat dikirimkan
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endsection
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Kategori</label>
|
<label class="form-label">Kategori <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<select class="form-control" name="kategori_id" id="kategori_id" required>
|
<select class="form-control" name="kategori_id" id="kategori_id" required>
|
||||||
<option value="">Pilih Kategori</option>
|
<option value="">Pilih Kategori</option>
|
||||||
@foreach ($kategori as $item)
|
@foreach ($kategori as $item)
|
||||||
@@ -43,31 +43,23 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Tanggal</label>
|
<label class="form-label">Tanggal <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="date" class="form-control" name="tanggal" id="tanggal" required value="{{ old('tanggal') }}">
|
<input type="date" class="form-control" name="tanggal" id="tanggal" required value="{{ old('tanggal') }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Total</label>
|
<label class="form-label">Total <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="string" class="form-control" name="total" id="total" required value="{{ old('total') }}">
|
<input type="string" class="form-control" name="total" id="total" required value="{{ old('total') }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
|
||||||
<label class="form-label">Keterangan</label>
|
|
||||||
<textarea class="form-control" name="keterangan" id="keterangan" required>{{ old('keterangan') }}</textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Bukti 1</label>
|
<label class="form-label">Bukti Total <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="file" class="form-control" name="bukti1" value="{{ old('bukti1') }}">
|
<input type="file" class="form-control" name="bukti_total" value="{{ old('bukti_total') }}" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Bukti 2</label>
|
<label class="form-label">Keterangan <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="file" class="form-control" name="bukti2" value="{{ old('bukti2') }}">
|
<textarea class="form-control" name="keterangan" id="keterangan" required>{{ old('keterangan') }}</textarea>
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label class="form-label">Bukti 3</label>
|
|
||||||
<input type="file" class="form-control" name="bukti3" value="{{ old('bukti3') }}">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Kategori</label>
|
<label class="form-label">Kategori <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<select class="form-control" name="kategori_id" id="kategori_id" required>
|
<select class="form-control" name="kategori_id" id="kategori_id" required>
|
||||||
<option value="">Pilih Kategori</option>
|
<option value="">Pilih Kategori</option>
|
||||||
@foreach ($kategori as $item)
|
@foreach ($kategori as $item)
|
||||||
@@ -44,31 +44,23 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Tanggal</label>
|
<label class="form-label">Tanggal <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="date" class="form-control" name="tanggal" id="tanggal" required value="{{ $form->tanggal }}">
|
<input type="date" class="form-control" name="tanggal" id="tanggal" required value="{{ $form->tanggal }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Total</label>
|
<label class="form-label">Total <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="string" class="form-control" name="total" id="total" required value="{{ $form->total }}">
|
<input type="string" class="form-control" name="total" id="total" required value="{{ $form->total }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
|
||||||
<label class="form-label">Keterangan</label>
|
|
||||||
<textarea class="form-control" name="keterangan" id="keterangan" required>{{ $form->keterangan }}</textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Bukti 1</label>
|
<label class="form-label">Bukti Total <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="file" class="form-control" name="bukti1" value="{{ $form->bukti1 }}">
|
<input type="file" class="form-control" name="bukti_total" value="{{ $form->bukti_total }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Bukti 2</label>
|
<label class="form-label">Keterangan <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="file" class="form-control" name="bukti2" value="{{ $form->bukti2 }}">
|
<textarea class="form-control" name="keterangan" id="keterangan" required>{{ $form->keterangan }}</textarea>
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label class="form-label">Bukti 3</label>
|
|
||||||
<input type="file" class="form-control" name="bukti3" value="{{ $form->bukti3 }}">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -89,9 +89,7 @@
|
|||||||
<th>Jenis</th>
|
<th>Jenis</th>
|
||||||
<th>Keterangan</th>
|
<th>Keterangan</th>
|
||||||
<th>Total</th>
|
<th>Total</th>
|
||||||
<th>Bukti 1</th>
|
<th>Bukti Total</th>
|
||||||
<th>Bukti 2</th>
|
|
||||||
<th>Bukti 3</th>
|
|
||||||
<th>Account Number</th>
|
<th>Account Number</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
@if (auth()->user()->can('approval.approve'))
|
@if (auth()->user()->can('approval.approve'))
|
||||||
@@ -116,26 +114,8 @@
|
|||||||
<td>{{ $item->keterangan }}</td>
|
<td>{{ $item->keterangan }}</td>
|
||||||
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
|
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
|
||||||
<td>
|
<td>
|
||||||
@if ($item->bukti1)
|
@if ($item->bukti_total)
|
||||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti1) }}" target="_blank">
|
<a href="{{ NextCloudHelper::getFileUrl($item->bukti_total) }}" target="_blank">
|
||||||
Download
|
|
||||||
</a>
|
|
||||||
@else
|
|
||||||
-
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@if ($item->bukti2)
|
|
||||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti2) }}" target="_blank">
|
|
||||||
Download
|
|
||||||
</a>
|
|
||||||
@else
|
|
||||||
-
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@if ($item->bukti3)
|
|
||||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti3) }}" target="_blank">
|
|
||||||
Download
|
Download
|
||||||
</a>
|
</a>
|
||||||
@else
|
@else
|
||||||
@@ -156,10 +136,10 @@
|
|||||||
<td>
|
<td>
|
||||||
{{-- approve / reject button --}}
|
{{-- approve / reject button --}}
|
||||||
@if ($item->status == 'On Progress')
|
@if ($item->status == 'On Progress')
|
||||||
<form action="{{ route('forms.other.approve', $item->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this item?');">
|
<form action="javascript:void(0);" class="d-inline">
|
||||||
@csrf
|
<button type="button"
|
||||||
@method('PUT')
|
class="btn btn-success btn-sm open-approve-modal"
|
||||||
<button type="submit" class="btn btn-success btn-sm">
|
data-id="{{ route('forms.other.approve', $item->id) }}">
|
||||||
Approve
|
Approve
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -237,20 +217,168 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<section>
|
||||||
|
<div class="modal fade" id="approveModal" tabindex="-1" role="dialog" aria-labelledby="approveModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form id="approveForm" method="POST" action="">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="approveModalLabel">Approve Item</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<!-- Loading spinner -->
|
||||||
|
<div id="loadingSpinner" class="d-flex justify-content-center align-items-center" style="height: 200px;">
|
||||||
|
<div class="spinner-border text-primary" role="status">
|
||||||
|
<span class="sr-only">Loading...</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal content (hidden initially) -->
|
||||||
|
<div id="modalContent" class="d-none">
|
||||||
|
<p>Please review the details below:</p>
|
||||||
|
<ul class="list-group">
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Expense Number:</strong> <span id="expense_number"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>User:</strong> <span id="user"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Kategori:</strong> <span id="kategori"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Tanggal & Waktu:</strong> <span id="tanggal"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Keterangan:</strong> <span id="keterangan"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Bukti Total Pengeluaran:</strong> <span id="bukti_total"></span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<p class="mt-2">Please select the items you want to approve:</p>
|
||||||
|
<ul class="list-group list-unstyled">
|
||||||
|
<li>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="custom-control custom-checkbox">
|
||||||
|
<input type="checkbox" class="custom-control-input" id="total_pengeluaran" name="total_pengeluaran">
|
||||||
|
<label class="custom-control-label" for="total_pengeluaran">Total Pengeluaran (<span id="total_pengeluaran_value"></span>)</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="total">Total</label>
|
||||||
|
<input type="text" class="form-control" id="total" name="total" value="0" readonly>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||||
|
<button type="submit" class="btn btn-primary">Approve</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('scripts')
|
@section('scripts')
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
// Uncheck all checkboxes on page refresh
|
||||||
|
$('.custom-control-input').prop('checked', false);
|
||||||
|
|
||||||
if ($('#dataTable').length) {
|
if ($('#dataTable').length) {
|
||||||
$('#dataTable').DataTable({
|
$('#dataTable').DataTable({
|
||||||
responsive: false,
|
responsive: false,
|
||||||
dom: 'Bfrtip',
|
dom: 'Bfrtip',
|
||||||
buttons: [
|
buttons: ['excel', 'pdf', 'print']
|
||||||
'excel', 'pdf', 'print'
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle Approve Button Click
|
||||||
|
$('.open-approve-modal').on('click', function () {
|
||||||
|
const approveUrl = $(this).data('id');
|
||||||
|
|
||||||
|
// Show spinner and hide content initially
|
||||||
|
$('#loadingSpinner').show();
|
||||||
|
$('#modalContent').addClass('d-none');
|
||||||
|
|
||||||
|
$('#approveForm').attr('action', approveUrl); // Set the form action
|
||||||
|
$('#loadingSpinner').addClass('d-flex');
|
||||||
|
$('#approveModal').modal('show'); // Show the modal
|
||||||
|
|
||||||
|
// Get detail from /forms/up-country/detail/{id}
|
||||||
|
$.get(approveUrl.replace('approve', 'detail'), function (data) {
|
||||||
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'IDR',
|
||||||
|
minimumFractionDigits: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#kategori').text(data.kategori.name);
|
||||||
|
$('#keterangan').text(data.keterangan);
|
||||||
|
$('#total_pengeluaran_value').text(formatter.format(data.total));
|
||||||
|
$('#total_pengeluaran').data('value', data.total);
|
||||||
|
|
||||||
|
// Detail data
|
||||||
|
$('#user').text(data.user.name);
|
||||||
|
$('#expense_number').text(data.expense_number);
|
||||||
|
$('#tanggal').text(new Date(data.tanggal).toLocaleDateString('id-ID', {
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'long',
|
||||||
|
day: 'numeric',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
}));
|
||||||
|
|
||||||
|
$('#bukti_total').html(data.bukti_total ? '<a href="' + data.bukti_total + '" target="_blank">Download</a>' : '-');
|
||||||
|
|
||||||
|
// Hide spinner and show content
|
||||||
|
$('#loadingSpinner').hide();
|
||||||
|
$('#loadingSpinner').removeClass('d-flex');
|
||||||
|
$('#loadingSpinner').addClass('d-none');
|
||||||
|
$('#modalContent').removeClass('d-none');
|
||||||
|
|
||||||
|
// Reset the total to zero
|
||||||
|
$('#total').val(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update total dynamically
|
||||||
|
$('.custom-control-input').on('change', function () {
|
||||||
|
let total = 0;
|
||||||
|
|
||||||
|
// Calculate the total based on checked checkboxes
|
||||||
|
$('.custom-control-input:checked').each(function () {
|
||||||
|
total += parseFloat($(this).data('value') || 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update the total field with formatted value
|
||||||
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'IDR',
|
||||||
|
minimumFractionDigits: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#total').val(formatter.format(total));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Uncheck all checkboxes when the modal is closed
|
||||||
|
$('#approveModal').on('hidden.bs.modal', function () {
|
||||||
|
$('.custom-control-input').prop('checked', false); // Uncheck all checkboxes
|
||||||
|
$('#total').val('0'); // Reset total to 0
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Pilih Rayon</label>
|
<label class="form-label">Pilih Rayon</label>
|
||||||
<select class="form-control form-control-md" name="rayon_id" readonly>
|
<select class="form-control form-control-md" name="rayon_id" disabled>
|
||||||
<option value="">Pilih Rayon</option>
|
<option value="">Pilih Rayon</option>
|
||||||
@foreach ($rayons as $rayon)
|
@foreach ($rayons as $rayon)
|
||||||
<option value="{{ $rayon->id }}" {{ $form->rayon_id == $rayon->id ? 'selected' : '' }}>{{ $rayon->name }}</option>
|
<option value="{{ $rayon->id }}" {{ $form->rayon_id == $rayon->id ? 'selected' : '' }}>{{ $rayon->name }}</option>
|
||||||
|
|||||||
@@ -32,52 +32,44 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Tanggal</label>
|
<label class="form-label">Tanggal <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="datetime-local" class="form-control" name="tanggal" required value="{{ old('tanggal') }}">
|
<input type="datetime-local" class="form-control" name="tanggal" required value="{{ old('tanggal') }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Liter Bensin</label>
|
<label class="form-label">Liter Bensin <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="text" class="form-control" name="liter" required value="{{ old('liter') }}">
|
<input type="text" class="form-control" name="liter" required value="{{ old('liter') }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Total Harga Bensin</label>
|
<label class="form-label">Total Harga Bensin <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="string" class="form-control" name="total" id="total" required value="{{ old('total') }}">
|
<input type="string" class="form-control" name="total" id="total" required value="{{ old('total') }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Jarak (km)</label>
|
<label class="form-label">Bukti Total Harga Bensin <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="number" class="form-control" name="jarak" id="jarak" required value="{{ old('jarak') }}">
|
<input type="file" class="form-control" name="bukti_total" value="{{ old('bukti_total') }}">
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label class="form-label">Keterangan</label>
|
|
||||||
<textarea class="form-control" name="keterangan" id="keterangan" required>
|
|
||||||
{{ old('keterangan') }}
|
|
||||||
</textarea>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Tipe Bensin</label>
|
<label class="form-label">Jarak (km) <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
|
<input type="number" class="form-control" name="jarak" id="jarak" required value="{{ old('jarak') }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Tipe Bensin <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<select class="form-control" name="tipe_bensin" required value="{{ old('tipe_bensin') }}">
|
<select class="form-control" name="tipe_bensin" required value="{{ old('tipe_bensin') }}">
|
||||||
<option value="pertamax">Pertamax</option>
|
<option value="pertamax">Pertamax</option>
|
||||||
<option value="pertalite">Pertalite</option>
|
<option value="pertalite">Pertalite</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Nomor Polisi</label>
|
<label class="form-label">Nomor Polisi <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="text" class="form-control" name="nopol" id="nopol" required value="{{ old('nopol') }}">
|
<input type="text" class="form-control" name="nopol" id="nopol" required value="{{ old('nopol') }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Bukti 1</label>
|
<label class="form-label">Keterangan <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="file" class="form-control" name="bukti1" value="{{ old('bukti1') }}">
|
<textarea class="form-control" name="keterangan" id="keterangan" required>
|
||||||
</div>
|
{{ old('keterangan') }}
|
||||||
<div class="mb-3">
|
</textarea>
|
||||||
<label class="form-label">Bukti 2</label>
|
|
||||||
<input type="file" class="form-control" name="bukti2" value="{{ old('bukti2') }}">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label class="form-label">Bukti 3</label>
|
|
||||||
<input type="file" class="form-control" name="bukti3" value="{{ old('bukti3') }}">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -32,50 +32,43 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Tanggal</label>
|
<label class="form-label">Tanggal <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="datetime-local" class="form-control" name="tanggal" required value="{{ $form->tanggal }}">
|
<input type="datetime-local" class="form-control" name="tanggal" required value="{{ $form->tanggal }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Liter Bensin</label>
|
<label class="form-label">Liter Bensin <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="text" class="form-control" name="liter" required value="{{ $form->liter }}">
|
<input type="text" class="form-control" name="liter" required value="{{ $form->liter }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Total Harga Bensin</label>
|
<label class="form-label">Total Harga Bensin <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="string" class="form-control" name="total" id="total" required value="{{ $form->total }}">
|
<input type="string" class="form-control" name="total" id="total" required value="{{ $form->total }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Jarak (km)</label>
|
<label class="form-label">Bukti Total Harga Bensin <span class="font-italic font-weight-normal">(optional)</span></label>
|
||||||
<input type="number" class="form-control" name="jarak" id="jarak" required value="{{ $form->jarak }}">
|
<input type="file" class="form-control" name="bukti_total" value="{{ old('bukti_total') }}">
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label class="form-label">Keterangan</label>
|
|
||||||
<textarea class="form-control" name="keterangan" id="keterangan" required>{{ $form->keterangan }}</textarea>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Tipe Bensin</label>
|
<label class="form-label">Jarak (km) <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
|
<input type="number" class="form-control" name="jarak" id="jarak" required value="{{ $form->jarak }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Tipe Bensin <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<select class="form-control" name="tipe_bensin" required>
|
<select class="form-control" name="tipe_bensin" required>
|
||||||
<option value="pertamax" {{ $form->tipe_bensin == 'pertamax' ? 'selected' : '' }}>Pertamax</option>
|
<option value="pertamax" {{ $form->tipe_bensin == 'pertamax' ? 'selected' : '' }}>Pertamax</option>
|
||||||
<option value="pertalite" {{ $form->tipe_bensin == 'pertalite' ? 'selected' : '' }}>Pertalite</option>
|
<option value="pertalite" {{ $form->tipe_bensin == 'pertalite' ? 'selected' : '' }}>Pertalite</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Nomor Polisi</label>
|
<label class="form-label">Nomor Polisi <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="text" class="form-control" name="nopol" id="nopol" required value="{{ $form->nopol }}">
|
<input type="text" class="form-control" name="nopol" id="nopol" required value="{{ $form->nopol }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Bukti 1</label>
|
<label class="form-label">Keterangan <span class="font-italic font-weight-normal">(required)</span></label>
|
||||||
<input type="file" class="form-control" name="bukti1" value="{{ $form->bukti1 }}">
|
<textarea class="form-control" name="keterangan" id="keterangan" required>{{ $form->keterangan }}</textarea>
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label class="form-label">Bukti 2</label>
|
|
||||||
<input type="file" class="form-control" name="bukti2" value="{{ $form->bukti2 }}">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label class="form-label">Bukti 3</label>
|
|
||||||
<input type="file" class="form-control" name="bukti3" value="{{ $form->bukti3 }}">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
<div class="col-lg-4 col-6">
|
<div class="col-lg-4 col-6">
|
||||||
<div class="small-box bg-success">
|
<div class="small-box bg-success">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<h3>Rp {{ number_format($forms->whereIn('status', ['Approved', 'Closed'])->sum('total'), 0, ',', '.') }}</h3>
|
<h3>Rp {{ number_format($forms->whereIn('status', ['Approved', 'Closed'])->sum('approved_total'), 0, ',', '.') }}</h3>
|
||||||
<p>Approved Expenses</p>
|
<p>Approved Expenses</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
@@ -88,12 +88,11 @@
|
|||||||
<th>Tanggal</th>
|
<th>Tanggal</th>
|
||||||
<th>Liter</th>
|
<th>Liter</th>
|
||||||
<th>Total</th>
|
<th>Total</th>
|
||||||
|
<th>Total Approved</th>
|
||||||
<th>Jarak</th>
|
<th>Jarak</th>
|
||||||
<th>Tipe Bensin</th>
|
<th>Tipe Bensin</th>
|
||||||
<th>Nomor Polisi</th>
|
<th>Nomor Polisi</th>
|
||||||
<th>Bukti 1</th>
|
<th>Bukti</th>
|
||||||
<th>Bukti 2</th>
|
|
||||||
<th>Bukti 3</th>
|
|
||||||
<th>Account Number</th>
|
<th>Account Number</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
@if (auth()->user()->can('approval.approve'))
|
@if (auth()->user()->can('approval.approve'))
|
||||||
@@ -116,30 +115,13 @@
|
|||||||
<td>{{ \Carbon\Carbon::parse($item->tanggal)->locale('id')->isoFormat('dddd, D MMMM Y HH:mm:ss') }}</td>
|
<td>{{ \Carbon\Carbon::parse($item->tanggal)->locale('id')->isoFormat('dddd, D MMMM Y HH:mm:ss') }}</td>
|
||||||
<td>{{ $item->liter }}</td>
|
<td>{{ $item->liter }}</td>
|
||||||
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
|
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
|
||||||
|
<td>{{ number_format($item->approved_total, 0, ',', '.') }}</td>
|
||||||
<td>{{ $item->jarak }} km</td>
|
<td>{{ $item->jarak }} km</td>
|
||||||
<td>{{ $item->tipe_bensin }}</td>
|
<td>{{ $item->tipe_bensin }}</td>
|
||||||
<td>{{ $item->nopol }}</td>
|
<td>{{ $item->nopol }}</td>
|
||||||
<td>
|
<td>
|
||||||
@if ($item->bukti1)
|
@if ($item->bukti_total)
|
||||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti1) }}" target="_blank">
|
<a href="{{ NextCloudHelper::getFileUrl($item->bukti_total) }}" target="_blank">
|
||||||
Download
|
|
||||||
</a>
|
|
||||||
@else
|
|
||||||
-
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@if ($item->bukti2)
|
|
||||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti2) }}" target="_blank">
|
|
||||||
Download
|
|
||||||
</a>
|
|
||||||
@else
|
|
||||||
-
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@if ($item->bukti3)
|
|
||||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti3) }}" target="_blank">
|
|
||||||
Download
|
Download
|
||||||
</a>
|
</a>
|
||||||
@else
|
@else
|
||||||
@@ -160,10 +142,10 @@
|
|||||||
<td>
|
<td>
|
||||||
{{-- approve / reject button --}}
|
{{-- approve / reject button --}}
|
||||||
@if ($item->status == 'On Progress')
|
@if ($item->status == 'On Progress')
|
||||||
<form action="{{ route('forms.vehicle.approve', $item->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this item?');">
|
<form action="javascript:void(0);" class="d-inline">
|
||||||
@csrf
|
<button type="button"
|
||||||
@method('PUT')
|
class="btn btn-success btn-sm open-approve-modal"
|
||||||
<button type="submit" class="btn btn-success btn-sm">
|
data-id="{{ route('forms.vehicle.approve', $item->id) }}">
|
||||||
Approve
|
Approve
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -215,6 +197,12 @@
|
|||||||
</td>
|
</td>
|
||||||
@endif
|
@endif
|
||||||
<td>
|
<td>
|
||||||
|
@if (auth()->user()->can('forms.vehicle.view'))
|
||||||
|
<a href="{{ route('forms.vehicle.view', $item->id) }}" class="btn btn-primary btn-sm">
|
||||||
|
<i class="fas fa-eye text-white"></i>
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
|
||||||
@if (auth()->user()->can('forms.vehicle.edit'))
|
@if (auth()->user()->can('forms.vehicle.edit'))
|
||||||
<a href="{{ route('forms.vehicle.edit', $item->id) }}" class="btn btn-warning btn-sm">
|
<a href="{{ route('forms.vehicle.edit', $item->id) }}" class="btn btn-warning btn-sm">
|
||||||
<i class="fas fa-edit text-white"></i>
|
<i class="fas fa-edit text-white"></i>
|
||||||
@@ -241,20 +229,183 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<section>
|
||||||
|
<div class="modal fade" id="approveModal" tabindex="-1" role="dialog" aria-labelledby="approveModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form id="approveForm" method="POST" action="">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="approveModalLabel">Approve Item</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<!-- Loading spinner -->
|
||||||
|
<div id="loadingSpinner" class="d-flex justify-content-center align-items-center" style="height: 200px;">
|
||||||
|
<div class="spinner-border text-primary" role="status">
|
||||||
|
<span class="sr-only">Loading...</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal content (hidden initially) -->
|
||||||
|
<div id="modalContent" class="d-none">
|
||||||
|
<p>Please review the details below:</p>
|
||||||
|
<ul class="list-group">
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Expense Number:</strong> <span id="expense_number"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>User:</strong> <span id="user"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Tipe:</strong> Vehicle Running Cost
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Tanggal & Waktu:</strong> <span id="tanggal"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Jarak:</strong> <span id="jarak"></span> km
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Total Liter Bensin:</strong> <span id="liter"></span> liter
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>No Polisi:</strong> <span id="nopol"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Tipe Bensin:</strong> <span id="tipe_bensin"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Keterangan:</strong> <span id="keterangan"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Bukti Total Harga Bensin:</strong> <span id="bukti_total"></span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<p class="mt-2">Please select the items you want to approve:</p>
|
||||||
|
<ul class="list-group list-unstyled">
|
||||||
|
<li>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="custom-control custom-checkbox">
|
||||||
|
<input type="checkbox" class="custom-control-input" id="total_bensin" name="total_bensin">
|
||||||
|
<label class="custom-control-label" for="total_bensin">Total Harga Bensin (<span id="total_bensin_value"></span>)</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="total">Total</label>
|
||||||
|
<input type="text" class="form-control" id="total" name="total" value="0" readonly>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||||
|
<button type="submit" class="btn btn-primary">Approve</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('scripts')
|
@section('scripts')
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
// Uncheck all checkboxes on page refresh
|
||||||
|
$('.custom-control-input').prop('checked', false);
|
||||||
|
|
||||||
if ($('#dataTable').length) {
|
if ($('#dataTable').length) {
|
||||||
$('#dataTable').DataTable({
|
$('#dataTable').DataTable({
|
||||||
responsive: false,
|
responsive: false,
|
||||||
dom: 'Bfrtip',
|
dom: 'Bfrtip',
|
||||||
buttons: [
|
buttons: ['excel', 'pdf', 'print']
|
||||||
'excel', 'pdf', 'print'
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle Approve Button Click
|
||||||
|
$('.open-approve-modal').on('click', function () {
|
||||||
|
const approveUrl = $(this).data('id');
|
||||||
|
|
||||||
|
// Show spinner and hide content initially
|
||||||
|
$('#loadingSpinner').show();
|
||||||
|
$('#modalContent').addClass('d-none');
|
||||||
|
|
||||||
|
$('#approveForm').attr('action', approveUrl); // Set the form action
|
||||||
|
$('#loadingSpinner').addClass('d-flex');
|
||||||
|
$('#approveModal').modal('show'); // Show the modal
|
||||||
|
|
||||||
|
// Get detail from /forms/up-country/detail/{id}
|
||||||
|
$.get(approveUrl.replace('approve', 'detail'), function (data) {
|
||||||
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'IDR',
|
||||||
|
minimumFractionDigits: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#total_bensin_value').text(formatter.format(data.total));
|
||||||
|
$('#total_bensin').data('value', data.total);
|
||||||
|
$('#jarak').text(data.jarak);
|
||||||
|
$('#liter').text(data.liter);
|
||||||
|
$('#nopol').text(data.nopol);
|
||||||
|
$('#tipe_bensin').text(data.tipe_bensin);
|
||||||
|
$('#keterangan').text(data.keterangan);
|
||||||
|
|
||||||
|
// Detail data
|
||||||
|
$('#user').text(data.user.name);
|
||||||
|
$('#expense_number').text(data.expense_number);
|
||||||
|
$('#tanggal').text(new Date(data.tanggal).toLocaleDateString('id-ID', {
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'long',
|
||||||
|
day: 'numeric',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
}));
|
||||||
|
|
||||||
|
$('#bukti_total').html(data.bukti_total ? '<a href="' + data.bukti_total + '" target="_blank">Download</a>' : '-');
|
||||||
|
|
||||||
|
// Hide spinner and show content
|
||||||
|
$('#loadingSpinner').hide();
|
||||||
|
$('#loadingSpinner').removeClass('d-flex');
|
||||||
|
$('#loadingSpinner').addClass('d-none');
|
||||||
|
$('#modalContent').removeClass('d-none');
|
||||||
|
|
||||||
|
// Reset the total to zero
|
||||||
|
$('#total').val(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update total dynamically
|
||||||
|
$('.custom-control-input').on('change', function () {
|
||||||
|
let total = 0;
|
||||||
|
|
||||||
|
// Calculate the total based on checked checkboxes
|
||||||
|
$('.custom-control-input:checked').each(function () {
|
||||||
|
total += parseFloat($(this).data('value') || 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update the total field with formatted value
|
||||||
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'IDR',
|
||||||
|
minimumFractionDigits: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#total').val(formatter.format(total));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Uncheck all checkboxes when the modal is closed
|
||||||
|
$('#approveModal').on('hidden.bs.modal', function () {
|
||||||
|
$('.custom-control-input').prop('checked', false); // Uncheck all checkboxes
|
||||||
|
$('#total').val('0'); // Reset total to 0
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('title')
|
||||||
|
Dashboard
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('admin-content')
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/autonumeric@4.6.0/dist/autoNumeric.min.js"></script>
|
||||||
|
<section class="content-header">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row mb-2">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<h1>Lihat Expense Vehicle Running Cost</h1>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<ol class="breadcrumb float-sm-right">
|
||||||
|
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section class="content">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="card card-primary card-outline">
|
||||||
|
<div class="card-body">
|
||||||
|
<form method="POST" enctype="multipart/form-data">
|
||||||
|
@csrf
|
||||||
|
@include('backend.layouts.partials.messages')
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">No Expense</label>
|
||||||
|
<input type="text" class="form-control" name="expense_number" value="{{ $form->expense_number }}" readonly>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Tanggal</label>
|
||||||
|
<input type="datetime-local" class="form-control" name="tanggal" readonly value="{{ $form->tanggal }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Liter Bensin</label>
|
||||||
|
<input type="text" class="form-control" name="liter" readonly value="{{ $form->liter }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Total Harga Bensin</label>
|
||||||
|
<input type="string" class="form-control" name="total" id="total" readonly value="{{ $form->total }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Bukti Total Harga Bensin</label><br>
|
||||||
|
<a href="{{ $form->bukti_total }}" target="_blank">Lihat Bukti</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Jarak (km)</label>
|
||||||
|
<input type="number" class="form-control" name="jarak" id="jarak" readonly value="{{ $form->jarak }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Tipe Bensin</label>
|
||||||
|
<select class="form-control" name="tipe_bensin" disabled>
|
||||||
|
<option value="pertamax" {{ $form->tipe_bensin == 'pertamax' ? 'selected' : '' }}>Pertamax</option>
|
||||||
|
<option value="pertalite" {{ $form->tipe_bensin == 'pertalite' ? 'selected' : '' }}>Pertalite</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Nomor Polisi</label>
|
||||||
|
<input type="text" class="form-control" name="nopol" id="nopol" readonly value="{{ $form->nopol }}">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Keterangan</label>
|
||||||
|
<textarea class="form-control" name="keterangan" id="keterangan" readonly>{{ $form->keterangan }}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<a href="{{ route('forms.vehicle') }}" class="btn btn-secondary">Kembali</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
new AutoNumeric('#total', {
|
||||||
|
digitGroupSeparator: '.', // Pemisah ribuan
|
||||||
|
decimalCharacter: ',', // Karakter desimal (tidak digunakan karena tanpa desimal)
|
||||||
|
currencySymbol: 'Rp.', // Simbol mata uang
|
||||||
|
decimalPlaces: 0, // Tidak ada angka desimal
|
||||||
|
unformatOnSubmit: true // Nilai asli tanpa format saat dikirimkan
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endsection
|
||||||
+7
-1
@@ -38,7 +38,7 @@ Route::group(['prefix' => 'admin', 'as' => 'admin.', 'middleware' => ['auth:admi
|
|||||||
Route::resource('admins', AdminsController::class);
|
Route::resource('admins', AdminsController::class);
|
||||||
Route::get('/admins/expense/{user_id}', [AdminsController::class, 'expense'])->name('admins.expense');
|
Route::get('/admins/expense/{user_id}', [AdminsController::class, 'expense'])->name('admins.expense');
|
||||||
Route::resource('roles', RolesController::class);
|
Route::resource('roles', RolesController::class);
|
||||||
Route::get('/admin', [DashboardController::class, 'index'])->name('dashboard');
|
Route::get('/', [DashboardController::class, 'index'])->name('dashboard');
|
||||||
|
|
||||||
// Rayon
|
// Rayon
|
||||||
Route::get('/rayon', [RayonController::class, 'index'])->name('rayon.index');
|
Route::get('/rayon', [RayonController::class, 'index'])->name('rayon.index');
|
||||||
@@ -90,6 +90,8 @@ Route::middleware(['auth:admin', 'menu'])->group(function () {
|
|||||||
|
|
||||||
// Vehicle Running Cost
|
// Vehicle Running Cost
|
||||||
Route::get('/vehicle-running-cost', [FormVehicleController::class, 'index'])->name('forms.vehicle');
|
Route::get('/vehicle-running-cost', [FormVehicleController::class, 'index'])->name('forms.vehicle');
|
||||||
|
Route::get('/vehicle-running-cost/detail/{id}', [FormVehicleController::class, 'detail'])->name('forms.vehicle.detail');
|
||||||
|
Route::get('/vehicle-running-cost/view/{id}', [FormVehicleController::class, 'view'])->name('forms.vehicle.view');
|
||||||
Route::get('/vehicle-running-cost/create', [FormVehicleController::class, 'create'])->name('forms.vehicle.create');
|
Route::get('/vehicle-running-cost/create', [FormVehicleController::class, 'create'])->name('forms.vehicle.create');
|
||||||
Route::post('/vehicle-running-cost/store', [FormVehicleController::class, 'store'])->name('forms.vehicle.store');
|
Route::post('/vehicle-running-cost/store', [FormVehicleController::class, 'store'])->name('forms.vehicle.store');
|
||||||
Route::get('/vehicle-running-cost/edit/{id}', [FormVehicleController::class, 'edit'])->name('forms.vehicle.edit');
|
Route::get('/vehicle-running-cost/edit/{id}', [FormVehicleController::class, 'edit'])->name('forms.vehicle.edit');
|
||||||
@@ -102,6 +104,8 @@ Route::middleware(['auth:admin', 'menu'])->group(function () {
|
|||||||
|
|
||||||
// Entertainment & Presentation
|
// Entertainment & Presentation
|
||||||
Route::get('/entertainment-presentation', [FormEntertainmentPresentationController::class, 'index'])->name('forms.entertainment');
|
Route::get('/entertainment-presentation', [FormEntertainmentPresentationController::class, 'index'])->name('forms.entertainment');
|
||||||
|
Route::get('/entertainment-presentation/detail/{id}', [FormEntertainmentPresentationController::class, 'detail'])->name('forms.entertainment.detail');
|
||||||
|
Route::get('/entertainment-presentation/view/{id}', [FormEntertainmentPresentationController::class, 'view'])->name('forms.entertainment.view');
|
||||||
Route::get('/entertainment-presentation/create', [FormEntertainmentPresentationController::class, 'create'])->name('forms.entertainment.create');
|
Route::get('/entertainment-presentation/create', [FormEntertainmentPresentationController::class, 'create'])->name('forms.entertainment.create');
|
||||||
Route::post('/entertainment-presentation/store', [FormEntertainmentPresentationController::class, 'store'])->name('forms.entertainment.store');
|
Route::post('/entertainment-presentation/store', [FormEntertainmentPresentationController::class, 'store'])->name('forms.entertainment.store');
|
||||||
Route::get('/entertainment-presentation/edit/{id}', [FormEntertainmentPresentationController::class, 'edit'])->name('forms.entertainment.edit');
|
Route::get('/entertainment-presentation/edit/{id}', [FormEntertainmentPresentationController::class, 'edit'])->name('forms.entertainment.edit');
|
||||||
@@ -128,6 +132,8 @@ Route::middleware(['auth:admin', 'menu'])->group(function () {
|
|||||||
|
|
||||||
// Other
|
// Other
|
||||||
Route::get('/other', [FormOtherController::class, 'index'])->name('forms.other');
|
Route::get('/other', [FormOtherController::class, 'index'])->name('forms.other');
|
||||||
|
Route::get('/other/detail/{id}', [FormOtherController::class, 'detail'])->name('forms.other.detail');
|
||||||
|
Route::get('/other/view/{id}', [FormOtherController::class, 'view'])->name('forms.other.view');
|
||||||
Route::get('/other/create', [FormOtherController::class, 'create'])->name('forms.other.create');
|
Route::get('/other/create', [FormOtherController::class, 'create'])->name('forms.other.create');
|
||||||
Route::post('/other/store', [FormOtherController::class, 'store'])->name('forms.other.store');
|
Route::post('/other/store', [FormOtherController::class, 'store'])->name('forms.other.store');
|
||||||
Route::get('/other/edit/{id}', [FormOtherController::class, 'edit'])->name('forms.other.edit');
|
Route::get('/other/edit/{id}', [FormOtherController::class, 'edit'])->name('forms.other.edit');
|
||||||
|
|||||||
Reference in New Issue
Block a user