revised approval system (all forms)
This commit is contained in:
@@ -74,7 +74,7 @@ NEXT_CLOUD_PASSWORD=userdev12345
|
|||||||
NEXT_CLOUD_PATHPREFIX=""
|
NEXT_CLOUD_PATHPREFIX=""
|
||||||
|
|
||||||
WABLAS_HOST=https://bdg.wablas.com
|
WABLAS_HOST=https://bdg.wablas.com
|
||||||
WABLAS_TOKEN=5iCaiP0nEgfl3lzrdsZGb9TvNYuwFZF8s4rp8AYwCx5OrYeiKXgixFMo9nDWNrJN.IF98hujz
|
WABLAS_TOKEN=5iCaiP0nEgfl3lzrdsZGb9TvNYuwFZF8s4rp8AYwCx5OrYeiKXgixFMo9nDWNrJN.xvAwySaa
|
||||||
|
|
||||||
STARTING_DATE='12'
|
STARTING_DATE='12'
|
||||||
CLOSING_DATE='20'
|
CLOSING_DATE='20'
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use Illuminate\Support\Str;
|
|||||||
|
|
||||||
class WhatsappHelper
|
class WhatsappHelper
|
||||||
{
|
{
|
||||||
public static function approveExpense($phones, $expense_number, $url = null)
|
public static function approveExpense($phones, $expense_number, $url = null, $tanggal, $total, $name)
|
||||||
{
|
{
|
||||||
$client = new Client();
|
$client = new Client();
|
||||||
|
|
||||||
@@ -17,15 +17,27 @@ class WhatsappHelper
|
|||||||
$url = 'https://' . $url;
|
$url = 'https://' . $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Format the message like the email example using Markdown for WhatsApp
|
||||||
|
$message = "
|
||||||
|
Halo *{$name}*,
|
||||||
|
Pengajuan Expense Anda telah di periksa & disetujui oleh *Admin Region Anda*:
|
||||||
|
*Expense Number:* {$expense_number}
|
||||||
|
*Expense Date:* " . \Carbon\Carbon::parse($tanggal)->locale('id')->isoFormat('D MMMM Y') . "
|
||||||
|
*Total:* Rp " . number_format($total, 0, ',', '.') . "
|
||||||
|
Silahkan buka link berikut untuk melihat detail expense Anda: {$url}
|
||||||
|
Terima kasih.";
|
||||||
|
|
||||||
|
// Prepare the message for each phone number
|
||||||
$data = [];
|
$data = [];
|
||||||
foreach ($phones as $phone) {
|
foreach ($phones as $phone) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'phone' => $phone,
|
'phone' => $phone,
|
||||||
'message' => 'Pengajuan pengeluaran anda dengan nomor *' . $expense_number . '* telah disetujui. Silahkan buka link berikut untuk melihat detailnya: ' . $url,
|
'message' => $message,
|
||||||
'source' => 'web'
|
'source' => 'web'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send the request to the WABLAS API
|
||||||
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
|
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'Authorization' => env('WABLAS_TOKEN'),
|
'Authorization' => env('WABLAS_TOKEN'),
|
||||||
@@ -39,23 +51,36 @@ class WhatsappHelper
|
|||||||
return $response->getBody()->getContents();
|
return $response->getBody()->getContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function rejectExpense($phones, $expense_number, $url = null)
|
public static function approve2Expense($phones, $expense_number, $url = null, $tanggal, $total, $name)
|
||||||
{
|
{
|
||||||
$client = new Client();
|
$client = new Client();
|
||||||
|
|
||||||
|
// Ensure the URL is formatted correctly
|
||||||
if ($url && !preg_match('/^https?:\/\//', $url)) {
|
if ($url && !preg_match('/^https?:\/\//', $url)) {
|
||||||
$url = 'https://' . $url;
|
$url = 'https://' . $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Format the message like the email example using Markdown for WhatsApp
|
||||||
|
$message = "
|
||||||
|
Halo *{$name}*,
|
||||||
|
Pengajuan Expense Anda telah di periksa & disetujui oleh *Area Manager Anda*:
|
||||||
|
*Expense Number:* {$expense_number}
|
||||||
|
*Expense Date:* " . \Carbon\Carbon::parse($tanggal)->locale('id')->isoFormat('D MMMM Y') . "
|
||||||
|
*Total:* Rp " . number_format($total, 0, ',', '.') . "
|
||||||
|
Silahkan buka link berikut untuk melihat detail expense Anda: {$url}
|
||||||
|
Terima kasih.";
|
||||||
|
|
||||||
|
// Prepare the message for each phone number
|
||||||
$data = [];
|
$data = [];
|
||||||
foreach ($phones as $phone) {
|
foreach ($phones as $phone) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'phone' => $phone,
|
'phone' => $phone,
|
||||||
'message' => 'Pengajuan pengeluaran anda dengan nomor *' . $expense_number . '* telah ditolak. Silahkan buka link berikut untuk melihat detailnya: ' . $url,
|
'message' => $message,
|
||||||
'source' => 'web'
|
'source' => 'web'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send the request to the WABLAS API
|
||||||
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
|
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'Authorization' => env('WABLAS_TOKEN'),
|
'Authorization' => env('WABLAS_TOKEN'),
|
||||||
@@ -69,23 +94,36 @@ class WhatsappHelper
|
|||||||
return $response->getBody()->getContents();
|
return $response->getBody()->getContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function finalApprove($phones, $expense_number, $url = null)
|
public static function rejectExpense($phones, $expense_number, $url = null, $tanggal, $total, $name)
|
||||||
{
|
{
|
||||||
$client = new Client();
|
$client = new Client();
|
||||||
|
|
||||||
|
// Ensure the URL is formatted correctly
|
||||||
if ($url && !preg_match('/^https?:\/\//', $url)) {
|
if ($url && !preg_match('/^https?:\/\//', $url)) {
|
||||||
$url = 'https://' . $url;
|
$url = 'https://' . $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Format the message like the email example using Markdown for WhatsApp
|
||||||
|
$message = "
|
||||||
|
Halo *{$name}*,
|
||||||
|
Pengajuan pengeluaran baru dengan detail berikut telah ditolak:
|
||||||
|
*Expense Number:* {$expense_number}
|
||||||
|
*Expense Date:* " . \Carbon\Carbon::parse($tanggal)->locale('id')->isoFormat('D MMMM Y') . "
|
||||||
|
*Total:* Rp " . number_format($total, 0, ',', '.') . "
|
||||||
|
Silahkan buka link berikut untuk melihat detail expense Anda: {$url}
|
||||||
|
Terima kasih.";
|
||||||
|
|
||||||
|
// Prepare the message for each phone number
|
||||||
$data = [];
|
$data = [];
|
||||||
foreach ($phones as $phone) {
|
foreach ($phones as $phone) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'phone' => $phone,
|
'phone' => $phone,
|
||||||
'message' => 'Pengajuan pengeluaran anda dengan nomor *' . $expense_number . '* telah ditutup karena telah selesai diproses. Silahkan buka link berikut untuk melihat detailnya: ' . $url,
|
'message' => $message,
|
||||||
'source' => 'web'
|
'source' => 'web'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send the request to the WABLAS API
|
||||||
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
|
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'Authorization' => env('WABLAS_TOKEN'),
|
'Authorization' => env('WABLAS_TOKEN'),
|
||||||
@@ -99,23 +137,79 @@ class WhatsappHelper
|
|||||||
return $response->getBody()->getContents();
|
return $response->getBody()->getContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function newExpense($phones, $expense_number, $url = null)
|
public static function finalApprove($phones, $expense_number, $url = null, $tanggal, $total, $name)
|
||||||
{
|
{
|
||||||
$client = new Client();
|
$client = new Client();
|
||||||
|
|
||||||
|
// Ensure the URL is formatted correctly
|
||||||
if ($url && !preg_match('/^https?:\/\//', $url)) {
|
if ($url && !preg_match('/^https?:\/\//', $url)) {
|
||||||
$url = 'https://' . $url;
|
$url = 'https://' . $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Format the message like the email example using Markdown for WhatsApp
|
||||||
|
$message = "
|
||||||
|
Halo *{$name}*,
|
||||||
|
Pengajuan Expense Anda telah di setujui *( FINAL APPROVE )* oleh *MOM Region / HOSM* anda:
|
||||||
|
*Expense Number:* {$expense_number}
|
||||||
|
*Expense Date:* " . \Carbon\Carbon::parse($tanggal)->locale('id')->isoFormat('D MMMM Y') . "
|
||||||
|
*Total:* Rp " . number_format($total, 0, ',', '.') . "
|
||||||
|
Silahkan buka link berikut untuk melihat detail expense Anda: {$url}
|
||||||
|
Terima kasih.";
|
||||||
|
|
||||||
|
// Prepare the message for each phone number
|
||||||
$data = [];
|
$data = [];
|
||||||
foreach ($phones as $phone) {
|
foreach ($phones as $phone) {
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'phone' => $phone,
|
'phone' => $phone,
|
||||||
'message' => 'Pengajuan pengeluaran baru dengan nomor *' . $expense_number . '* telah dibuat. Silahkan buka link berikut untuk melihat detailnya: ' . $url,
|
'message' => $message,
|
||||||
'source' => 'web'
|
'source' => 'web'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send the request to the WABLAS API
|
||||||
|
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
|
||||||
|
'headers' => [
|
||||||
|
'Authorization' => env('WABLAS_TOKEN'),
|
||||||
|
'Content-Type' => 'application/json'
|
||||||
|
],
|
||||||
|
'json' => [
|
||||||
|
'data' => $data
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $response->getBody()->getContents();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function newExpense($phones, $expense_number, $url = null, $tanggal, $total, $name)
|
||||||
|
{
|
||||||
|
$client = new Client();
|
||||||
|
|
||||||
|
// Ensure the URL is formatted correctly
|
||||||
|
if ($url && !preg_match('/^https?:\/\//', $url)) {
|
||||||
|
$url = 'https://' . $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format the message like the email example using Markdown for WhatsApp
|
||||||
|
$message = "
|
||||||
|
Halo *{$name}*,
|
||||||
|
Pengajuan pengeluaran baru dengan detail berikut telah dibuat:
|
||||||
|
*Expense Number:* {$expense_number}
|
||||||
|
*Expense Date:* " . \Carbon\Carbon::parse($tanggal)->locale('id')->isoFormat('D MMMM Y') . "
|
||||||
|
*Total:* Rp " . number_format($total, 0, ',', '.') . "
|
||||||
|
Silahkan buka link berikut untuk melihat detail expense Anda: {$url}
|
||||||
|
Terima kasih.";
|
||||||
|
|
||||||
|
// Prepare the message for each phone number
|
||||||
|
$data = [];
|
||||||
|
foreach ($phones as $phone) {
|
||||||
|
$data[] = [
|
||||||
|
'phone' => $phone,
|
||||||
|
'message' => $message,
|
||||||
|
'source' => 'web'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send the request to the WABLAS API
|
||||||
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
|
$response = $client->post(env('WABLAS_HOST') . '/api/v2/send-message', [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'Authorization' => env('WABLAS_TOKEN'),
|
'Authorization' => env('WABLAS_TOKEN'),
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ use App\Helpers\NextCloudHelper;
|
|||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use App\Mail\ExpenseApproved;
|
use App\Mail\ExpenseApproved;
|
||||||
|
use App\Mail\ExpenseApproved2;
|
||||||
use App\Mail\ExpenseRejected;
|
use App\Mail\ExpenseRejected;
|
||||||
use App\Mail\FinalApprove;
|
use App\Mail\FinalApprove;
|
||||||
use App\Mail\ExpenseCreated;
|
use App\Mail\ExpenseCreated;
|
||||||
@@ -127,7 +128,7 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
|
|
||||||
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
||||||
$region = Region::where('id', $cabang->region_id)->first();
|
$region = Region::where('id', $cabang->region_id)->first();
|
||||||
$kategori = Kategori::where('name', 'Entertainment & Presentation')->first();
|
$kategori = Kategori::where('name', 'Entertainment')->first();
|
||||||
|
|
||||||
$filePaths = [];
|
$filePaths = [];
|
||||||
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/entertainment';
|
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/entertainment';
|
||||||
@@ -189,7 +190,7 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
|
|
||||||
// Generate URL and send WhatsApp notification
|
// Generate URL and send WhatsApp notification
|
||||||
$url = route('forms.entertainment.view', $form->id);
|
$url = route('forms.entertainment.view', $form->id);
|
||||||
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url);
|
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseCreated(
|
Mail::to($recipients)->send(new ExpenseCreated(
|
||||||
@@ -246,7 +247,7 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
|
|
||||||
$cabang = UserHasCabang::with('cabang')->where('user_id', $form->user_id)->first()->cabang;
|
$cabang = UserHasCabang::with('cabang')->where('user_id', $form->user_id)->first()->cabang;
|
||||||
$region = Region::where('id', $cabang->region_id)->first();
|
$region = Region::where('id', $cabang->region_id)->first();
|
||||||
$kategori = Kategori::where('name', 'Entertainment & Presentation')->first();
|
$kategori = Kategori::where('name', 'Entertainment')->first();
|
||||||
|
|
||||||
$filePaths = [];
|
$filePaths = [];
|
||||||
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/entertainment';
|
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/entertainment';
|
||||||
@@ -282,33 +283,22 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function approve(Request $request, $id)
|
public function approve($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);
|
||||||
$cabang_id = UserHasCabang::where('user_id', $form->user_id)->first()->cabang_id;
|
|
||||||
if($form->total > BudgetHelper::getAvailableBudget($cabang_id)) {
|
|
||||||
session()->flash('error', 'The total nominal exceeds the available budget.');
|
|
||||||
return redirect()->back();
|
|
||||||
}
|
|
||||||
|
|
||||||
$form->update([
|
$form->update([
|
||||||
'approved_at' => now(),
|
'approved_at' => now(),
|
||||||
'approved_by' => auth()->user()->id,
|
'approved_by' => auth()->user()->id,
|
||||||
'status' => 'Approved',
|
'status' => 'Approved 1',
|
||||||
|
|
||||||
'approved_total' => $form->total,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$heads = $form->user->getCabangAndRegionHead();
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
$name = $form->user->name;
|
$name = $form->user->name;
|
||||||
$expense_number = $form->expense_number;
|
$expense_number = $form->expense_number;
|
||||||
$tanggal = $form->tanggal;
|
$tanggal = $form->created_at;
|
||||||
$total = $form->approved_total;
|
$total = $form->total;
|
||||||
|
|
||||||
// Collect all recipients
|
// Collect all recipients
|
||||||
$recipients = [$form->user->email, auth()->user()->email];
|
$recipients = [$form->user->email, auth()->user()->email];
|
||||||
@@ -324,15 +314,15 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
$phoneNumbers[] = $heads['region_head']['phone'];
|
$phoneNumbers[] = $heads['region_head']['phone'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove duplicate email addresses, if any
|
// Remove duplicate data, if any
|
||||||
$recipients = array_unique($recipients);
|
$recipients = array_unique($recipients);
|
||||||
$phoneNumbers = array_unique($phoneNumbers);
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
// Send bulk whatsapp
|
// send whatsapp message
|
||||||
$url = route('forms.entertainment.view', $form->id);
|
$url = route('forms.entertainment.view', $form->id);
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// // Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseApproved(
|
Mail::to($recipients)->send(new ExpenseApproved(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
@@ -341,31 +331,92 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
$url
|
$url
|
||||||
));
|
));
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Approve', 'Approved Expense at Form Entertainment Presentation (' . $expense_number . ')');
|
AuditTrailHelper::AddAuditTrail('Approve', 'Approve Expense at Form Entertainment (' . $form->expense_number . ')');
|
||||||
session()->flash('success', 'Form has been approved.');
|
session()->flash('success', 'Form has been approved.');
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function finalApprove($id)
|
public function approve2($id)
|
||||||
|
{
|
||||||
|
$this->checkAuthorization(auth()->user(), ['approval2.approve']);
|
||||||
|
|
||||||
|
$form = FormEntertaimentPresentation::findOrfail($id);
|
||||||
|
$form->update([
|
||||||
|
'approved2_at' => now(),
|
||||||
|
'approved2_by' => auth()->user()->id,
|
||||||
|
'status' => 'Approved 2',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
|
$name = $form->user->name;
|
||||||
|
$expense_number = $form->expense_number;
|
||||||
|
$tanggal = $form->created_at;
|
||||||
|
$total = $form->total;
|
||||||
|
|
||||||
|
// Collect all recipients
|
||||||
|
$recipients = [$form->user->email, auth()->user()->email];
|
||||||
|
$phoneNumbers = [$form->user->phone, auth()->user()->phone];
|
||||||
|
|
||||||
|
if ($heads['cabang_head']) {
|
||||||
|
$recipients[] = $heads['cabang_head']['email'];
|
||||||
|
$phoneNumbers[] = $heads['cabang_head']['phone'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($heads['region_head']) {
|
||||||
|
$recipients[] = $heads['region_head']['email'];
|
||||||
|
$phoneNumbers[] = $heads['region_head']['phone'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove duplicate data, if any
|
||||||
|
$recipients = array_unique($recipients);
|
||||||
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
|
// send whatsapp message
|
||||||
|
$url = route('forms.entertainment.view', $form->id);
|
||||||
|
WhatsappHelper::approve2Expense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
|
// // Send bulk email
|
||||||
|
Mail::to($recipients)->send(new ExpenseApproved2(
|
||||||
|
$name,
|
||||||
|
$expense_number,
|
||||||
|
$tanggal,
|
||||||
|
$total,
|
||||||
|
$url
|
||||||
|
));
|
||||||
|
|
||||||
|
AuditTrailHelper::AddAuditTrail('Approve', 'Approve Expense at Form Entertainment (' . $form->expense_number . ')');
|
||||||
|
session()->flash('success', 'Form has been approved.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function finalApprove(Request $request, $id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['final_approval.approve']);
|
$this->checkAuthorization(auth()->user(), ['final_approval.approve']);
|
||||||
|
|
||||||
$form = FormEntertaimentPresentation::findOrfail($id);
|
$form = FormEntertaimentPresentation::findOrfail($id);
|
||||||
if($form->approved_at == null) {
|
if($form->approved_at == null || $form->approved2_at == null) {
|
||||||
session()->flash('error', 'Form must be approved by MIS first.');
|
session()->flash('error', 'Form must be approved by both approvers before final approval.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the total nominal exceeds the available budget
|
||||||
|
$cabang_id = UserHasCabang::where('user_id', $form->user_id)->first()->cabang_id;
|
||||||
|
if($form->total > BudgetHelper::getAvailableBudget($cabang_id)) {
|
||||||
|
session()->flash('error', 'The total nominal exceeds the available budget.');
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
$form->update([
|
$form->update([
|
||||||
'final_approved_at' => now(),
|
'final_approved_at' => now(),
|
||||||
'final_approved_by' => auth()->user()->id,
|
'final_approved_by' => auth()->user()->id,
|
||||||
'status' => 'Closed'
|
'status' => 'Closed',
|
||||||
|
'approved_total' => $form->total,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$heads = $form->user->getCabangAndRegionHead();
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
$name = $form->user->name;
|
$name = $form->user->name;
|
||||||
$expense_number = $form->expense_number;
|
$expense_number = $form->expense_number;
|
||||||
$tanggal = $form->tanggal;
|
$tanggal = $form->created_at;
|
||||||
$total = $form->approved_total;
|
$total = $form->approved_total;
|
||||||
|
|
||||||
// Collect all recipients
|
// Collect all recipients
|
||||||
@@ -388,7 +439,7 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
|
|
||||||
// send whatsapp message
|
// send whatsapp message
|
||||||
$url = route('forms.entertainment.view', $form->id);
|
$url = route('forms.entertainment.view', $form->id);
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
WhatsappHelper::finalApprove($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new FinalApprove(
|
Mail::to($recipients)->send(new FinalApprove(
|
||||||
@@ -399,30 +450,14 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
$url
|
$url
|
||||||
));
|
));
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Final Approve', 'Final Approved Expense at Form Entertainment Presentation (' . $expense_number . ')');
|
AuditTrailHelper::AddAuditTrail('Final Approve', 'Final Approve Expense at Form Entertainment (' . $form->expense_number . ')');
|
||||||
session()->flash('success', 'Form has been final approved.');
|
session()->flash('success', 'Form has been final approved.');
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function open($id)
|
|
||||||
{
|
|
||||||
$this->checkAuthorization(auth()->user(), ['final_approval.open']);
|
|
||||||
|
|
||||||
$form = FormEntertaimentPresentation::findOrfail($id);
|
|
||||||
$form->update([
|
|
||||||
'final_approved_at' => null,
|
|
||||||
'final_approved_by' => null,
|
|
||||||
'status' => 'Approved'
|
|
||||||
]);
|
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Open', 'Open Expense at Form Entertainment Presentation (' . $form->expense_number . ')');
|
|
||||||
session()->flash('success', 'Form has been opened.');
|
|
||||||
return redirect()->back();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function reject($id)
|
public function reject($id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
$this->checkAuthorization(auth()->user(), ['approval.reject']);
|
||||||
|
|
||||||
$form = FormEntertaimentPresentation::findOrfail($id);
|
$form = FormEntertaimentPresentation::findOrfail($id);
|
||||||
$form->update([
|
$form->update([
|
||||||
@@ -432,7 +467,7 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
$heads = $form->user->getCabangAndRegionHead();
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
$name = $form->user->name;
|
$name = $form->user->name;
|
||||||
$expense_number = $form->expense_number;
|
$expense_number = $form->expense_number;
|
||||||
$tanggal = $form->tanggal;
|
$tanggal = $form->created_at;
|
||||||
$total = $form->total;
|
$total = $form->total;
|
||||||
|
|
||||||
// Collect all recipients
|
// Collect all recipients
|
||||||
@@ -453,9 +488,9 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
$recipients = array_unique($recipients);
|
$recipients = array_unique($recipients);
|
||||||
$phoneNumbers = array_unique($phoneNumbers);
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
// Send bulk whatsapp
|
// send whatsapp message
|
||||||
$url = route('forms.entertainment.view', $form->id);
|
$url = route('forms.entertainment.view', $form->id);
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseRejected(
|
Mail::to($recipients)->send(new ExpenseRejected(
|
||||||
@@ -466,11 +501,27 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
$url
|
$url
|
||||||
));
|
));
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Reject', 'Reject Expense at Form Entertainment Presentation (' . $expense_number . ')');
|
AuditTrailHelper::AddAuditTrail('Reject', 'Reject Expense at Form Entertainment (' . $form->expense_number . ')');
|
||||||
session()->flash('success', 'Form has been rejected.');
|
session()->flash('success', 'Form has been rejected.');
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function open($id)
|
||||||
|
{
|
||||||
|
$this->checkAuthorization(auth()->user(), ['final_approval.open']);
|
||||||
|
|
||||||
|
$form = FormEntertaimentPresentation::findOrfail($id);
|
||||||
|
$form->update([
|
||||||
|
'final_approved_at' => null,
|
||||||
|
'final_approved_by' => null,
|
||||||
|
'status' => 'Approved'
|
||||||
|
]);
|
||||||
|
|
||||||
|
AuditTrailHelper::AddAuditTrail('Open', 'Open Expense at Form Entertainment Presentation (' . $form->expense_number . ')');
|
||||||
|
session()->flash('success', 'Form has been opened.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['forms.entertainment.delete']);
|
$this->checkAuthorization(auth()->user(), ['forms.entertainment.delete']);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ use App\Helpers\NextCloudHelper;
|
|||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use App\Mail\ExpenseApproved;
|
use App\Mail\ExpenseApproved;
|
||||||
|
use App\Mail\ExpenseApproved2;
|
||||||
use App\Mail\ExpenseRejected;
|
use App\Mail\ExpenseRejected;
|
||||||
use App\Mail\ExpenseCreated;
|
use App\Mail\ExpenseCreated;
|
||||||
use App\Mail\FinalApprove;
|
use App\Mail\FinalApprove;
|
||||||
@@ -82,7 +83,7 @@ class FormMeetingSeminarController extends Controller
|
|||||||
|
|
||||||
public function detail($id)
|
public function detail($id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['forms.country.view']);
|
$this->checkAuthorization(auth()->user(), ['forms.meeting.view']);
|
||||||
|
|
||||||
$form = FormMeetingSeminar::with('user')->findOrFail($id);
|
$form = FormMeetingSeminar::with('user')->findOrFail($id);
|
||||||
$form->bukti_allowance = $form->bukti_allowance ? NextCloudHelper::getFileUrl($form->bukti_allowance) : null;
|
$form->bukti_allowance = $form->bukti_allowance ? NextCloudHelper::getFileUrl($form->bukti_allowance) : null;
|
||||||
@@ -94,7 +95,7 @@ class FormMeetingSeminarController extends Controller
|
|||||||
|
|
||||||
public function view($id)
|
public function view($id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['forms.country.view']);
|
$this->checkAuthorization(auth()->user(), ['forms.meeting.view']);
|
||||||
|
|
||||||
$form = FormMeetingSeminar::with('user')->findOrFail($id);
|
$form = FormMeetingSeminar::with('user')->findOrFail($id);
|
||||||
$form->bukti_allowance = $form->bukti_allowance ? NextCloudHelper::getFileUrl($form->bukti_allowance) : null;
|
$form->bukti_allowance = $form->bukti_allowance ? NextCloudHelper::getFileUrl($form->bukti_allowance) : null;
|
||||||
@@ -128,7 +129,7 @@ class FormMeetingSeminarController extends Controller
|
|||||||
|
|
||||||
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
||||||
$region = Region::where('id', $cabang->region_id)->first();
|
$region = Region::where('id', $cabang->region_id)->first();
|
||||||
$kategori = Kategori::where('name', 'Meeting & Seminar')->first();
|
$kategori = Kategori::where('name', 'Meeting / Seminar')->first();
|
||||||
|
|
||||||
$filePaths = [];
|
$filePaths = [];
|
||||||
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/meeting';
|
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/meeting';
|
||||||
@@ -227,7 +228,7 @@ class FormMeetingSeminarController extends Controller
|
|||||||
|
|
||||||
// Generate URL and send WhatsApp notification
|
// Generate URL and send WhatsApp notification
|
||||||
$url = route('forms.meeting.view', $form->id);
|
$url = route('forms.meeting.view', $form->id);
|
||||||
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url);
|
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseCreated(
|
Mail::to($recipients)->send(new ExpenseCreated(
|
||||||
@@ -281,7 +282,7 @@ class FormMeetingSeminarController extends Controller
|
|||||||
|
|
||||||
$cabang = UserHasCabang::with('cabang')->where('user_id', $form->user_id)->first()->cabang;
|
$cabang = UserHasCabang::with('cabang')->where('user_id', $form->user_id)->first()->cabang;
|
||||||
$region = Region::where('id', $cabang->region_id)->first();
|
$region = Region::where('id', $cabang->region_id)->first();
|
||||||
$kategori = Kategori::where('name', 'Meeting & Seminar')->first();
|
$kategori = Kategori::where('name', 'Meeting / Seminar')->first();
|
||||||
|
|
||||||
$filePaths = [];
|
$filePaths = [];
|
||||||
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/meeting';
|
$folderPath = '/expense/' . $region->code . '/' . $cabang->code . '/meeting';
|
||||||
@@ -354,11 +355,122 @@ class FormMeetingSeminarController extends Controller
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function approve(Request $request, $id)
|
public function approve($id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
||||||
|
|
||||||
$form = FormMeetingSeminar::findOrfail($id);
|
$form = FormMeetingSeminar::findOrfail($id);
|
||||||
|
$form->update([
|
||||||
|
'approved_at' => now(),
|
||||||
|
'approved_by' => auth()->user()->id,
|
||||||
|
'status' => 'Approved 1',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
|
$name = $form->user->name;
|
||||||
|
$expense_number = $form->expense_number;
|
||||||
|
$tanggal = $form->created_at;
|
||||||
|
$total = $form->total;
|
||||||
|
|
||||||
|
// Collect all recipients
|
||||||
|
$recipients = [$form->user->email, auth()->user()->email];
|
||||||
|
$phoneNumbers = [$form->user->phone, auth()->user()->phone];
|
||||||
|
|
||||||
|
if ($heads['cabang_head']) {
|
||||||
|
$recipients[] = $heads['cabang_head']['email'];
|
||||||
|
$phoneNumbers[] = $heads['cabang_head']['phone'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($heads['region_head']) {
|
||||||
|
$recipients[] = $heads['region_head']['email'];
|
||||||
|
$phoneNumbers[] = $heads['region_head']['phone'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove duplicate data, if any
|
||||||
|
$recipients = array_unique($recipients);
|
||||||
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
|
// send whatsapp message
|
||||||
|
$url = route('forms.meeting.view', $form->id);
|
||||||
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
|
// // Send bulk email
|
||||||
|
Mail::to($recipients)->send(new ExpenseApproved(
|
||||||
|
$name,
|
||||||
|
$expense_number,
|
||||||
|
$tanggal,
|
||||||
|
$total,
|
||||||
|
$url
|
||||||
|
));
|
||||||
|
|
||||||
|
AuditTrailHelper::AddAuditTrail('Approve', 'Approve Expense at Form Meeting Seminar (' . $form->expense_number . ')');
|
||||||
|
session()->flash('success', 'Form has been approved.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function approve2($id)
|
||||||
|
{
|
||||||
|
$this->checkAuthorization(auth()->user(), ['approval2.approve']);
|
||||||
|
|
||||||
|
$form = FormMeetingSeminar::findOrfail($id);
|
||||||
|
$form->update([
|
||||||
|
'approved2_at' => now(),
|
||||||
|
'approved2_by' => auth()->user()->id,
|
||||||
|
'status' => 'Approved 2',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
|
$name = $form->user->name;
|
||||||
|
$expense_number = $form->expense_number;
|
||||||
|
$tanggal = $form->created_at;
|
||||||
|
$total = $form->total;
|
||||||
|
|
||||||
|
// Collect all recipients
|
||||||
|
$recipients = [$form->user->email, auth()->user()->email];
|
||||||
|
$phoneNumbers = [$form->user->phone, auth()->user()->phone];
|
||||||
|
|
||||||
|
if ($heads['cabang_head']) {
|
||||||
|
$recipients[] = $heads['cabang_head']['email'];
|
||||||
|
$phoneNumbers[] = $heads['cabang_head']['phone'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($heads['region_head']) {
|
||||||
|
$recipients[] = $heads['region_head']['email'];
|
||||||
|
$phoneNumbers[] = $heads['region_head']['phone'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove duplicate data, if any
|
||||||
|
$recipients = array_unique($recipients);
|
||||||
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
|
// send whatsapp message
|
||||||
|
$url = route('forms.meeting.view', $form->id);
|
||||||
|
WhatsappHelper::approve2Expense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
|
// // Send bulk email
|
||||||
|
Mail::to($recipients)->send(new ExpenseApproved2(
|
||||||
|
$name,
|
||||||
|
$expense_number,
|
||||||
|
$tanggal,
|
||||||
|
$total,
|
||||||
|
$url
|
||||||
|
));
|
||||||
|
|
||||||
|
AuditTrailHelper::AddAuditTrail('Approve', 'Approve Expense at Form Meeting Seminar (' . $form->expense_number . ')');
|
||||||
|
session()->flash('success', 'Form has been approved.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function finalApprove(Request $request, $id)
|
||||||
|
{
|
||||||
|
$this->checkAuthorization(auth()->user(), ['final_approval.approve']);
|
||||||
|
|
||||||
|
$form = FormMeetingSeminar::findOrfail($id);
|
||||||
|
if($form->approved_at == null || $form->approved2_at == null) {
|
||||||
|
session()->flash('error', 'Form must be approved by both approvers before final approval.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
$approved_data = [
|
$approved_data = [
|
||||||
'allowance' => $request->allowance ? $form->allowance : 0,
|
'allowance' => $request->allowance ? $form->allowance : 0,
|
||||||
'transport_ankot' => $request->transport_ankot ? $form->transport_ankot : 0,
|
'transport_ankot' => $request->transport_ankot ? $form->transport_ankot : 0,
|
||||||
@@ -373,9 +485,9 @@ class FormMeetingSeminarController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$form->update([
|
$form->update([
|
||||||
'approved_at' => now(),
|
'final_approved_at' => now(),
|
||||||
'approved_by' => auth()->user()->id,
|
'final_approved_by' => auth()->user()->id,
|
||||||
'status' => 'Approved',
|
'status' => 'Closed',
|
||||||
'approved_allowance' => $approved_data['allowance'],
|
'approved_allowance' => $approved_data['allowance'],
|
||||||
'approved_transport_ankot' => $approved_data['transport_ankot'],
|
'approved_transport_ankot' => $approved_data['transport_ankot'],
|
||||||
'approved_hotel' => $approved_data['hotel'],
|
'approved_hotel' => $approved_data['hotel'],
|
||||||
@@ -406,67 +518,9 @@ class FormMeetingSeminarController extends Controller
|
|||||||
$recipients = array_unique($recipients);
|
$recipients = array_unique($recipients);
|
||||||
$phoneNumbers = array_unique($phoneNumbers);
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
// Send bulk WhatsApp message
|
|
||||||
$url = route('forms.meeting.view', $form->id);
|
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
|
||||||
|
|
||||||
// Send bulk email
|
|
||||||
Mail::to($recipients)->send(new ExpenseApproved(
|
|
||||||
$name,
|
|
||||||
$expense_number,
|
|
||||||
$tanggal,
|
|
||||||
$total,
|
|
||||||
$url
|
|
||||||
));
|
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Approve', 'Approve Expense at Form Meeting Seminar (' . $form->expense_number . ')');
|
|
||||||
session()->flash('success', 'Form has been approved.');
|
|
||||||
return redirect()->back();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function finalApprove($id)
|
|
||||||
{
|
|
||||||
$this->checkAuthorization(auth()->user(), ['final_approval.approve']);
|
|
||||||
|
|
||||||
$form = FormMeetingSeminar::findOrfail($id);
|
|
||||||
if($form->approved_at == null) {
|
|
||||||
session()->flash('error', 'Form must be approved by MIS first.');
|
|
||||||
return redirect()->back();
|
|
||||||
}
|
|
||||||
|
|
||||||
$form->update([
|
|
||||||
'final_approved_at' => now(),
|
|
||||||
'final_approved_by' => auth()->user()->id,
|
|
||||||
'status' => 'Closed'
|
|
||||||
]);
|
|
||||||
|
|
||||||
$heads = $form->user->getCabangAndRegionHead();
|
|
||||||
$name = $form->user->name;
|
|
||||||
$expense_number = $form->expense_number;
|
|
||||||
$tanggal = $form->created_at;
|
|
||||||
$total = $form->approved_total;
|
|
||||||
|
|
||||||
// Collect all recipients
|
|
||||||
$recipients = [$form->user->email, auth()->user()->email];
|
|
||||||
$phoneNumbers = [$form->user->phone, auth()->user()->phone];
|
|
||||||
|
|
||||||
if ($heads['cabang_head']) {
|
|
||||||
$recipients[] = $heads['cabang_head']['email'];
|
|
||||||
$phoneNumbers[] = $heads['cabang_head']['phone'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($heads['region_head']) {
|
|
||||||
$recipients[] = $heads['region_head']['email'];
|
|
||||||
$phoneNumbers[] = $heads['region_head']['phone'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove duplicate email addresses, if any
|
|
||||||
$recipients = array_unique($recipients);
|
|
||||||
$phoneNumbers = array_unique($phoneNumbers);
|
|
||||||
|
|
||||||
// send whatsapp message
|
// send whatsapp message
|
||||||
$url = route('forms.meeting.view', $form->id);
|
$url = route('forms.meeting.view', $form->id);
|
||||||
WhatsappHelper::finalApprove($phoneNumbers, $expense_number, $url);
|
WhatsappHelper::finalApprove($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new FinalApprove(
|
Mail::to($recipients)->send(new FinalApprove(
|
||||||
@@ -482,25 +536,9 @@ class FormMeetingSeminarController extends Controller
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function open($id)
|
|
||||||
{
|
|
||||||
$this->checkAuthorization(auth()->user(), ['final_approval.open']);
|
|
||||||
|
|
||||||
$form = FormMeetingSeminar::findOrfail($id);
|
|
||||||
$form->update([
|
|
||||||
'final_approved_at' => null,
|
|
||||||
'final_approved_by' => null,
|
|
||||||
'status' => 'Approved'
|
|
||||||
]);
|
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Open', 'Open Expense at Form Meeting Seminar (' . $form->expense_number . ')');
|
|
||||||
session()->flash('success', 'Form has been opened.');
|
|
||||||
return redirect()->back();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function reject($id)
|
public function reject($id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
$this->checkAuthorization(auth()->user(), ['approval.reject']);
|
||||||
|
|
||||||
$form = FormMeetingSeminar::findOrfail($id);
|
$form = FormMeetingSeminar::findOrfail($id);
|
||||||
$form->update([
|
$form->update([
|
||||||
@@ -531,9 +569,9 @@ class FormMeetingSeminarController extends Controller
|
|||||||
$recipients = array_unique($recipients);
|
$recipients = array_unique($recipients);
|
||||||
$phoneNumbers = array_unique($phoneNumbers);
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
// Send bulk WhatsApp message
|
// send whatsapp message
|
||||||
$url = route('forms.meeting.view', $form->id);
|
$url = route('forms.meeting.view', $form->id);
|
||||||
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url);
|
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseRejected(
|
Mail::to($recipients)->send(new ExpenseRejected(
|
||||||
@@ -549,6 +587,22 @@ class FormMeetingSeminarController extends Controller
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function open($id)
|
||||||
|
{
|
||||||
|
$this->checkAuthorization(auth()->user(), ['final_approval.open']);
|
||||||
|
|
||||||
|
$form = FormMeetingSeminar::findOrfail($id);
|
||||||
|
$form->update([
|
||||||
|
'final_approved_at' => null,
|
||||||
|
'final_approved_by' => null,
|
||||||
|
'status' => 'Approved'
|
||||||
|
]);
|
||||||
|
|
||||||
|
AuditTrailHelper::AddAuditTrail('Open', 'Open Expense at Form Meeting Seminar (' . $form->expense_number . ')');
|
||||||
|
session()->flash('success', 'Form has been opened.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['forms.meeting.delete']);
|
$this->checkAuthorization(auth()->user(), ['forms.meeting.delete']);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ use Illuminate\Support\Str;
|
|||||||
use App\Helpers\NextCloudHelper;
|
use App\Helpers\NextCloudHelper;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use App\Mail\ExpenseApproved;
|
use App\Mail\ExpenseApproved;
|
||||||
|
use App\Mail\ExpenseApproved2;
|
||||||
use App\Mail\ExpenseRejected;
|
use App\Mail\ExpenseRejected;
|
||||||
use App\Mail\FinalApprove;
|
use App\Mail\FinalApprove;
|
||||||
use App\Mail\ExpenseCreated;
|
use App\Mail\ExpenseCreated;
|
||||||
@@ -187,7 +188,7 @@ class FormOtherController extends Controller
|
|||||||
|
|
||||||
// Generate URL and send WhatsApp notification
|
// Generate URL and send WhatsApp notification
|
||||||
$url = route('forms.other.view', $form->id);
|
$url = route('forms.other.view', $form->id);
|
||||||
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url);
|
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseCreated(
|
Mail::to($recipients)->send(new ExpenseCreated(
|
||||||
@@ -275,34 +276,22 @@ class FormOtherController extends Controller
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function approve(Request $request, $id)
|
public function approve($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);
|
||||||
$cabang_id = UserHasCabang::where('user_id', $form->user_id)->first()->cabang_id;
|
|
||||||
if($form->total > BudgetHelper::getAvailableBudget($cabang_id)) {
|
|
||||||
session()->flash('error', 'The total nominal exceeds the available budget.');
|
|
||||||
return redirect()->back();
|
|
||||||
}
|
|
||||||
|
|
||||||
$form->update([
|
$form->update([
|
||||||
'approved_at' => now(),
|
'approved_at' => now(),
|
||||||
'approved_by' => auth()->user()->id,
|
'approved_by' => auth()->user()->id,
|
||||||
'status' => 'Approved',
|
'status' => 'Approved 1',
|
||||||
|
|
||||||
'approved_total' => $form->total,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$heads = $form->user->getCabangAndRegionHead();
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
$name = $form->user->name;
|
$name = $form->user->name;
|
||||||
$expense_number = $form->expense_number;
|
$expense_number = $form->expense_number;
|
||||||
$tanggal = $form->tanggal;
|
$tanggal = $form->created_at;
|
||||||
$total = $form->approved_total;
|
$total = $form->total;
|
||||||
|
|
||||||
// Collect all recipients
|
// Collect all recipients
|
||||||
$recipients = [$form->user->email, auth()->user()->email];
|
$recipients = [$form->user->email, auth()->user()->email];
|
||||||
@@ -318,15 +307,15 @@ class FormOtherController extends Controller
|
|||||||
$phoneNumbers[] = $heads['region_head']['phone'];
|
$phoneNumbers[] = $heads['region_head']['phone'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove duplicate email addresses, if any
|
// Remove duplicate data, if any
|
||||||
$recipients = array_unique($recipients);
|
$recipients = array_unique($recipients);
|
||||||
$phoneNumbers = array_unique($phoneNumbers);
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
// Send bulk WhatsApp message
|
// send whatsapp message
|
||||||
$url = route('forms.other.view', $form->id);
|
$url = route('forms.other.view', $form->id);
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// // Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseApproved(
|
Mail::to($recipients)->send(new ExpenseApproved(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
@@ -340,26 +329,87 @@ class FormOtherController extends Controller
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function finalApprove($id)
|
public function approve2($id)
|
||||||
|
{
|
||||||
|
$this->checkAuthorization(auth()->user(), ['approval2.approve']);
|
||||||
|
|
||||||
|
$form = FormOthers::findOrfail($id);
|
||||||
|
$form->update([
|
||||||
|
'approved2_at' => now(),
|
||||||
|
'approved2_by' => auth()->user()->id,
|
||||||
|
'status' => 'Approved 2',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
|
$name = $form->user->name;
|
||||||
|
$expense_number = $form->expense_number;
|
||||||
|
$tanggal = $form->created_at;
|
||||||
|
$total = $form->total;
|
||||||
|
|
||||||
|
// Collect all recipients
|
||||||
|
$recipients = [$form->user->email, auth()->user()->email];
|
||||||
|
$phoneNumbers = [$form->user->phone, auth()->user()->phone];
|
||||||
|
|
||||||
|
if ($heads['cabang_head']) {
|
||||||
|
$recipients[] = $heads['cabang_head']['email'];
|
||||||
|
$phoneNumbers[] = $heads['cabang_head']['phone'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($heads['region_head']) {
|
||||||
|
$recipients[] = $heads['region_head']['email'];
|
||||||
|
$phoneNumbers[] = $heads['region_head']['phone'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove duplicate data, if any
|
||||||
|
$recipients = array_unique($recipients);
|
||||||
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
|
// send whatsapp message
|
||||||
|
$url = route('forms.other.view', $form->id);
|
||||||
|
WhatsappHelper::approve2Expense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
|
// // Send bulk email
|
||||||
|
Mail::to($recipients)->send(new ExpenseApproved2(
|
||||||
|
$name,
|
||||||
|
$expense_number,
|
||||||
|
$tanggal,
|
||||||
|
$total,
|
||||||
|
$url
|
||||||
|
));
|
||||||
|
|
||||||
|
AuditTrailHelper::AddAuditTrail('Approve', 'Approve Expense at Form Other (' . $form->expense_number . ')');
|
||||||
|
session()->flash('success', 'Form has been approved.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function finalApprove(Request $request, $id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['final_approval.approve']);
|
$this->checkAuthorization(auth()->user(), ['final_approval.approve']);
|
||||||
|
|
||||||
$form = FormOthers::findOrfail($id);
|
$form = FormOthers::findOrfail($id);
|
||||||
if($form->approved_at == null) {
|
if($form->approved_at == null || $form->approved2_at == null) {
|
||||||
session()->flash('error', 'Form must be approved by MIS first.');
|
session()->flash('error', 'Form must be approved by both approvers before final approval.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the total nominal exceeds the available budget
|
||||||
|
$cabang_id = UserHasCabang::where('user_id', $form->user_id)->first()->cabang_id;
|
||||||
|
if($form->total > BudgetHelper::getAvailableBudget($cabang_id)) {
|
||||||
|
session()->flash('error', 'The total nominal exceeds the available budget.');
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
$form->update([
|
$form->update([
|
||||||
'final_approved_at' => now(),
|
'final_approved_at' => now(),
|
||||||
'final_approved_by' => auth()->user()->id,
|
'final_approved_by' => auth()->user()->id,
|
||||||
'status' => 'Closed'
|
'status' => 'Closed',
|
||||||
|
'approved_total' => $form->total,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$heads = $form->user->getCabangAndRegionHead();
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
$name = $form->user->name;
|
$name = $form->user->name;
|
||||||
$expense_number = $form->expense_number;
|
$expense_number = $form->expense_number;
|
||||||
$tanggal = $form->tanggal;
|
$tanggal = $form->created_at;
|
||||||
$total = $form->approved_total;
|
$total = $form->approved_total;
|
||||||
|
|
||||||
// Collect all recipients
|
// Collect all recipients
|
||||||
@@ -382,7 +432,7 @@ class FormOtherController extends Controller
|
|||||||
|
|
||||||
// send whatsapp message
|
// send whatsapp message
|
||||||
$url = route('forms.other.view', $form->id);
|
$url = route('forms.other.view', $form->id);
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
WhatsappHelper::finalApprove($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new FinalApprove(
|
Mail::to($recipients)->send(new FinalApprove(
|
||||||
@@ -398,25 +448,9 @@ class FormOtherController extends Controller
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function open($id)
|
|
||||||
{
|
|
||||||
$this->checkAuthorization(auth()->user(), ['final_approval.open']);
|
|
||||||
|
|
||||||
$form = FormOthers::findOrfail($id);
|
|
||||||
$form->update([
|
|
||||||
'final_approved_at' => null,
|
|
||||||
'final_approved_by' => null,
|
|
||||||
'status' => 'Approved'
|
|
||||||
]);
|
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Open', 'Open Expense at Form Other (' . $form->expense_number . ')');
|
|
||||||
session()->flash('success', 'Form has been opened.');
|
|
||||||
return redirect()->back();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function reject($id)
|
public function reject($id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
$this->checkAuthorization(auth()->user(), ['approval.reject']);
|
||||||
|
|
||||||
$form = FormOthers::findOrfail($id);
|
$form = FormOthers::findOrfail($id);
|
||||||
$form->update([
|
$form->update([
|
||||||
@@ -426,7 +460,7 @@ class FormOtherController extends Controller
|
|||||||
$heads = $form->user->getCabangAndRegionHead();
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
$name = $form->user->name;
|
$name = $form->user->name;
|
||||||
$expense_number = $form->expense_number;
|
$expense_number = $form->expense_number;
|
||||||
$tanggal = $form->tanggal;
|
$tanggal = $form->created_at;
|
||||||
$total = $form->total;
|
$total = $form->total;
|
||||||
|
|
||||||
// Collect all recipients
|
// Collect all recipients
|
||||||
@@ -447,9 +481,9 @@ class FormOtherController extends Controller
|
|||||||
$recipients = array_unique($recipients);
|
$recipients = array_unique($recipients);
|
||||||
$phoneNumbers = array_unique($phoneNumbers);
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
// Send bulk WhatsApp message
|
// send whatsapp message
|
||||||
$url = route('forms.other.view', $form->id);
|
$url = route('forms.other.view', $form->id);
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseRejected(
|
Mail::to($recipients)->send(new ExpenseRejected(
|
||||||
@@ -465,6 +499,22 @@ class FormOtherController extends Controller
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function open($id)
|
||||||
|
{
|
||||||
|
$this->checkAuthorization(auth()->user(), ['final_approval.open']);
|
||||||
|
|
||||||
|
$form = FormOthers::findOrfail($id);
|
||||||
|
$form->update([
|
||||||
|
'final_approved_at' => null,
|
||||||
|
'final_approved_by' => null,
|
||||||
|
'status' => 'Approved'
|
||||||
|
]);
|
||||||
|
|
||||||
|
AuditTrailHelper::AddAuditTrail('Open', 'Open Expense at Form Other (' . $form->expense_number . ')');
|
||||||
|
session()->flash('success', 'Form has been opened.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['forms.other.delete']);
|
$this->checkAuthorization(auth()->user(), ['forms.other.delete']);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ use App\Models\Kategori;
|
|||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use App\Mail\ExpenseApproved;
|
use App\Mail\ExpenseApproved;
|
||||||
|
use App\Mail\ExpenseApproved2;
|
||||||
use App\Mail\ExpenseRejected;
|
use App\Mail\ExpenseRejected;
|
||||||
use App\Mail\FinalApprove;
|
use App\Mail\FinalApprove;
|
||||||
use App\Mail\ExpenseCreated;
|
use App\Mail\ExpenseCreated;
|
||||||
@@ -258,7 +259,7 @@ class FormUpCountryController extends Controller
|
|||||||
|
|
||||||
// Generate URL and send WhatsApp notification
|
// Generate URL and send WhatsApp notification
|
||||||
$url = route('forms.up-country.view', $form->id);
|
$url = route('forms.up-country.view', $form->id);
|
||||||
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url);
|
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseCreated(
|
Mail::to($recipients)->send(new ExpenseCreated(
|
||||||
@@ -280,8 +281,8 @@ class FormUpCountryController extends Controller
|
|||||||
$role = auth()->user()->getRoleNames()[0];
|
$role = auth()->user()->getRoleNames()[0];
|
||||||
|
|
||||||
$form = FormUpCountry::with('rayon')->findOrfail($id);
|
$form = FormUpCountry::with('rayon')->findOrfail($id);
|
||||||
if($form->status != 'On Progress' && $role == 'Medical Representatif') {
|
if (($form->status != 'On Progress' && $form->status != 'Rejected') && $role == 'Medical Representatif') {
|
||||||
session()->flash('error', 'You cannot edit this form because it has been approved or rejected.');
|
session()->flash('error', 'You cannot edit this form because it has been approved or closed.');
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,8 +313,8 @@ class FormUpCountryController extends Controller
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$form = FormUpCountry::findOrfail($id);
|
$form = FormUpCountry::findOrfail($id);
|
||||||
if($form->status != 'On Progress' && $role == 'Medical Representatif') {
|
if (($form->status != 'On Progress' && $form->status != 'Rejected') && $role == 'Medical Representatif') {
|
||||||
session()->flash('error', 'You cannot edit this form because it has been approved or rejected.');
|
session()->flash('error', 'You cannot edit this form because it has been approved or closed.');
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,11 +412,122 @@ class FormUpCountryController extends Controller
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function approve(Request $request, $id)
|
public function approve($id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
||||||
|
|
||||||
$form = FormUpCountry::findOrfail($id);
|
$form = FormUpCountry::findOrfail($id);
|
||||||
|
$form->update([
|
||||||
|
'approved_at' => now(),
|
||||||
|
'approved_by' => auth()->user()->id,
|
||||||
|
'status' => 'Approved 1',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
|
$name = $form->user->name;
|
||||||
|
$expense_number = $form->expense_number;
|
||||||
|
$tanggal = $form->tanggal;
|
||||||
|
$total = $form->total;
|
||||||
|
|
||||||
|
// Collect all recipients
|
||||||
|
$recipients = [$form->user->email, auth()->user()->email];
|
||||||
|
$phoneNumbers = [$form->user->phone, auth()->user()->phone];
|
||||||
|
|
||||||
|
if ($heads['cabang_head']) {
|
||||||
|
$recipients[] = $heads['cabang_head']['email'];
|
||||||
|
$phoneNumbers[] = $heads['cabang_head']['phone'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($heads['region_head']) {
|
||||||
|
$recipients[] = $heads['region_head']['email'];
|
||||||
|
$phoneNumbers[] = $heads['region_head']['phone'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove duplicate data, if any
|
||||||
|
$recipients = array_unique($recipients);
|
||||||
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
|
// send whatsapp message
|
||||||
|
$url = route('forms.up-country.view', $form->id);
|
||||||
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
|
// // Send bulk email
|
||||||
|
Mail::to($recipients)->send(new ExpenseApproved(
|
||||||
|
$name,
|
||||||
|
$expense_number,
|
||||||
|
$tanggal,
|
||||||
|
$total,
|
||||||
|
$url
|
||||||
|
));
|
||||||
|
|
||||||
|
AuditTrailHelper::AddAuditTrail('Approve', 'Approve Expense at Form Up Country (' . $form->expense_number . ')');
|
||||||
|
session()->flash('success', 'Form has been approved.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function approve2($id)
|
||||||
|
{
|
||||||
|
$this->checkAuthorization(auth()->user(), ['approval2.approve']);
|
||||||
|
|
||||||
|
$form = FormUpCountry::findOrfail($id);
|
||||||
|
$form->update([
|
||||||
|
'approved2_at' => now(),
|
||||||
|
'approved2_by' => auth()->user()->id,
|
||||||
|
'status' => 'Approved 2',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
|
$name = $form->user->name;
|
||||||
|
$expense_number = $form->expense_number;
|
||||||
|
$tanggal = $form->tanggal;
|
||||||
|
$total = $form->total;
|
||||||
|
|
||||||
|
// Collect all recipients
|
||||||
|
$recipients = [$form->user->email, auth()->user()->email];
|
||||||
|
$phoneNumbers = [$form->user->phone, auth()->user()->phone];
|
||||||
|
|
||||||
|
if ($heads['cabang_head']) {
|
||||||
|
$recipients[] = $heads['cabang_head']['email'];
|
||||||
|
$phoneNumbers[] = $heads['cabang_head']['phone'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($heads['region_head']) {
|
||||||
|
$recipients[] = $heads['region_head']['email'];
|
||||||
|
$phoneNumbers[] = $heads['region_head']['phone'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove duplicate data, if any
|
||||||
|
$recipients = array_unique($recipients);
|
||||||
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
|
// send whatsapp message
|
||||||
|
$url = route('forms.up-country.view', $form->id);
|
||||||
|
WhatsappHelper::approve2Expense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
|
// // Send bulk email
|
||||||
|
Mail::to($recipients)->send(new ExpenseApproved2(
|
||||||
|
$name,
|
||||||
|
$expense_number,
|
||||||
|
$tanggal,
|
||||||
|
$total,
|
||||||
|
$url
|
||||||
|
));
|
||||||
|
|
||||||
|
AuditTrailHelper::AddAuditTrail('Approve', 'Approve Expense at Form Up Country (' . $form->expense_number . ')');
|
||||||
|
session()->flash('success', 'Form has been approved.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function finalApprove(Request $request, $id)
|
||||||
|
{
|
||||||
|
$this->checkAuthorization(auth()->user(), ['final_approval.approve']);
|
||||||
|
|
||||||
|
$form = FormUpCountry::findOrfail($id);
|
||||||
|
if($form->approved_at == null || $form->approved2_at == null) {
|
||||||
|
session()->flash('error', 'Form must be approved by both approvers before final approval.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
$approved_data = [
|
$approved_data = [
|
||||||
'allowance' => $request->allowance ? $form->allowance : 0,
|
'allowance' => $request->allowance ? $form->allowance : 0,
|
||||||
'transport_dalkot' => $request->transport_dalkot ? $form->transport_dalkot : 0,
|
'transport_dalkot' => $request->transport_dalkot ? $form->transport_dalkot : 0,
|
||||||
@@ -431,9 +543,9 @@ class FormUpCountryController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$form->update([
|
$form->update([
|
||||||
'approved_at' => now(),
|
'final_approved_at' => now(),
|
||||||
'approved_by' => auth()->user()->id,
|
'final_approved_by' => auth()->user()->id,
|
||||||
'status' => 'Approved',
|
'status' => 'Closed',
|
||||||
'approved_allowance' => $approved_data['allowance'],
|
'approved_allowance' => $approved_data['allowance'],
|
||||||
'approved_transport_dalkot' => $approved_data['transport_dalkot'],
|
'approved_transport_dalkot' => $approved_data['transport_dalkot'],
|
||||||
'approved_transport_ankot' => $approved_data['transport_ankot'],
|
'approved_transport_ankot' => $approved_data['transport_ankot'],
|
||||||
@@ -461,16 +573,16 @@ class FormUpCountryController extends Controller
|
|||||||
$phoneNumbers[] = $heads['region_head']['phone'];
|
$phoneNumbers[] = $heads['region_head']['phone'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove duplicate data, if any
|
// Remove duplicate email addresses, if any
|
||||||
$recipients = array_unique($recipients);
|
$recipients = array_unique($recipients);
|
||||||
$phoneNumbers = array_unique($phoneNumbers);
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
// send whatsapp message
|
// send whatsapp message
|
||||||
$url = route('forms.up-country.view', $form->id);
|
$url = route('forms.up-country.view', $form->id);
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
WhatsappHelper::finalApprove($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// // Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseApproved(
|
Mail::to($recipients)->send(new FinalApprove(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
@@ -478,14 +590,14 @@ class FormUpCountryController extends Controller
|
|||||||
$url
|
$url
|
||||||
));
|
));
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Approve', 'Approve Expense at Form Up Country (' . $form->expense_number . ')');
|
AuditTrailHelper::AddAuditTrail('Final Approve', 'Final Approve Expense at Form Up Country (' . $form->expense_number . ')');
|
||||||
session()->flash('success', 'Form has been approved.');
|
session()->flash('success', 'Form has been final approved.');
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reject($id)
|
public function reject($id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
$this->checkAuthorization(auth()->user(), ['approval.reject']);
|
||||||
|
|
||||||
$form = FormUpCountry::findOrfail($id);
|
$form = FormUpCountry::findOrfail($id);
|
||||||
$form->update([
|
$form->update([
|
||||||
@@ -518,7 +630,7 @@ class FormUpCountryController extends Controller
|
|||||||
|
|
||||||
// send whatsapp message
|
// send whatsapp message
|
||||||
$url = route('forms.up-country.view', $form->id);
|
$url = route('forms.up-country.view', $form->id);
|
||||||
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url);
|
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseRejected(
|
Mail::to($recipients)->send(new ExpenseRejected(
|
||||||
@@ -534,64 +646,6 @@ class FormUpCountryController extends Controller
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function finalApprove($id)
|
|
||||||
{
|
|
||||||
$this->checkAuthorization(auth()->user(), ['final_approval.approve']);
|
|
||||||
|
|
||||||
$form = FormUpCountry::findOrfail($id);
|
|
||||||
if($form->approved_at == null) {
|
|
||||||
session()->flash('error', 'Form must be approved by MIS first.');
|
|
||||||
return redirect()->back();
|
|
||||||
}
|
|
||||||
|
|
||||||
$form->update([
|
|
||||||
'final_approved_at' => now(),
|
|
||||||
'final_approved_by' => auth()->user()->id,
|
|
||||||
'status' => 'Closed'
|
|
||||||
]);
|
|
||||||
|
|
||||||
$heads = $form->user->getCabangAndRegionHead();
|
|
||||||
$name = $form->user->name;
|
|
||||||
$expense_number = $form->expense_number;
|
|
||||||
$tanggal = $form->tanggal;
|
|
||||||
$total = $form->approved_total;
|
|
||||||
|
|
||||||
// Collect all recipients
|
|
||||||
$recipients = [$form->user->email, auth()->user()->email];
|
|
||||||
$phoneNumbers = [$form->user->phone, auth()->user()->phone];
|
|
||||||
|
|
||||||
if ($heads['cabang_head']) {
|
|
||||||
$recipients[] = $heads['cabang_head']['email'];
|
|
||||||
$phoneNumbers[] = $heads['cabang_head']['phone'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($heads['region_head']) {
|
|
||||||
$recipients[] = $heads['region_head']['email'];
|
|
||||||
$phoneNumbers[] = $heads['region_head']['phone'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove duplicate email addresses, if any
|
|
||||||
$recipients = array_unique($recipients);
|
|
||||||
$phoneNumbers = array_unique($phoneNumbers);
|
|
||||||
|
|
||||||
// send whatsapp message
|
|
||||||
$url = route('forms.up-country.view', $form->id);
|
|
||||||
WhatsappHelper::finalApprove($phoneNumbers, $expense_number, $url);
|
|
||||||
|
|
||||||
// Send bulk email
|
|
||||||
Mail::to($recipients)->send(new FinalApprove(
|
|
||||||
$name,
|
|
||||||
$expense_number,
|
|
||||||
$tanggal,
|
|
||||||
$total,
|
|
||||||
$url
|
|
||||||
));
|
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Final Approve', 'Final Approve Expense at Form Up Country (' . $form->expense_number . ')');
|
|
||||||
session()->flash('success', 'Form has been final approved.');
|
|
||||||
return redirect()->back();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function open($id)
|
public function open($id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['final_approval.open']);
|
$this->checkAuthorization(auth()->user(), ['final_approval.open']);
|
||||||
@@ -600,7 +654,7 @@ class FormUpCountryController extends Controller
|
|||||||
$form->update([
|
$form->update([
|
||||||
'final_approved_at' => null,
|
'final_approved_at' => null,
|
||||||
'final_approved_by' => null,
|
'final_approved_by' => null,
|
||||||
'status' => 'Approved'
|
'status' => 'Approved 2'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Open', 'Open Expense at Form Up Country (' . $form->expense_number . ')');
|
AuditTrailHelper::AddAuditTrail('Open', 'Open Expense at Form Up Country (' . $form->expense_number . ')');
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ use App\Helpers\NextCloudHelper;
|
|||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use App\Mail\ExpenseApproved;
|
use App\Mail\ExpenseApproved;
|
||||||
|
use App\Mail\ExpenseApproved2;
|
||||||
use App\Mail\ExpenseRejected;
|
use App\Mail\ExpenseRejected;
|
||||||
use App\Mail\FinalApprove;
|
use App\Mail\FinalApprove;
|
||||||
use App\Mail\ExpenseCreated;
|
use App\Mail\ExpenseCreated;
|
||||||
@@ -191,7 +192,7 @@ class FormVehicleController extends Controller
|
|||||||
|
|
||||||
// Generate URL and send WhatsApp notification
|
// Generate URL and send WhatsApp notification
|
||||||
$url = route('forms.vehicle.view', $form->id);
|
$url = route('forms.vehicle.view', $form->id);
|
||||||
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url);
|
WhatsappHelper::newExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseCreated(
|
Mail::to($recipients)->send(new ExpenseCreated(
|
||||||
@@ -285,33 +286,22 @@ class FormVehicleController extends Controller
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function approve(Request $request, $id)
|
public function approve($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);
|
||||||
$cabang_id = UserHasCabang::where('user_id', $form->user_id)->first()->cabang_id;
|
|
||||||
if($form->total > BudgetHelper::getAvailableBudget($cabang_id)) {
|
|
||||||
session()->flash('error', 'The total nominal exceeds the available budget.');
|
|
||||||
return redirect()->back();
|
|
||||||
}
|
|
||||||
|
|
||||||
$form->update([
|
$form->update([
|
||||||
'approved_at' => now(),
|
'approved_at' => now(),
|
||||||
'approved_by' => auth()->user()->id,
|
'approved_by' => auth()->user()->id,
|
||||||
'status' => 'Approved',
|
'status' => 'Approved 1',
|
||||||
|
|
||||||
'approved_total' => $form->total,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$heads = $form->user->getCabangAndRegionHead();
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
$name = $form->user->name;
|
$name = $form->user->name;
|
||||||
$expense_number = $form->expense_number;
|
$expense_number = $form->expense_number;
|
||||||
$tanggal = $form->tanggal;
|
$tanggal = $form->created_at;
|
||||||
$total = $form->approved_total;
|
$total = $form->total;
|
||||||
|
|
||||||
// Collect all recipients
|
// Collect all recipients
|
||||||
$recipients = [$form->user->email, auth()->user()->email];
|
$recipients = [$form->user->email, auth()->user()->email];
|
||||||
@@ -327,15 +317,15 @@ class FormVehicleController extends Controller
|
|||||||
$phoneNumbers[] = $heads['region_head']['phone'];
|
$phoneNumbers[] = $heads['region_head']['phone'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove duplicate email addresses, if any
|
// Remove duplicate data, if any
|
||||||
$recipients = array_unique($recipients);
|
$recipients = array_unique($recipients);
|
||||||
$phoneNumbers = array_unique($phoneNumbers);
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
// Send bulk WhatsApp message
|
// send whatsapp message
|
||||||
$url = route('forms.vehicle.view', $form->id);
|
$url = route('forms.vehicle.view', $form->id);
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// // Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseApproved(
|
Mail::to($recipients)->send(new ExpenseApproved(
|
||||||
$name,
|
$name,
|
||||||
$expense_number,
|
$expense_number,
|
||||||
@@ -349,26 +339,87 @@ class FormVehicleController extends Controller
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function finalApprove($id)
|
public function approve2($id)
|
||||||
|
{
|
||||||
|
$this->checkAuthorization(auth()->user(), ['approval2.approve']);
|
||||||
|
|
||||||
|
$form = FormVehicleRunningCost::findOrfail($id);
|
||||||
|
$form->update([
|
||||||
|
'approved2_at' => now(),
|
||||||
|
'approved2_by' => auth()->user()->id,
|
||||||
|
'status' => 'Approved 2',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
|
$name = $form->user->name;
|
||||||
|
$expense_number = $form->expense_number;
|
||||||
|
$tanggal = $form->created_at;
|
||||||
|
$total = $form->total;
|
||||||
|
|
||||||
|
// Collect all recipients
|
||||||
|
$recipients = [$form->user->email, auth()->user()->email];
|
||||||
|
$phoneNumbers = [$form->user->phone, auth()->user()->phone];
|
||||||
|
|
||||||
|
if ($heads['cabang_head']) {
|
||||||
|
$recipients[] = $heads['cabang_head']['email'];
|
||||||
|
$phoneNumbers[] = $heads['cabang_head']['phone'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($heads['region_head']) {
|
||||||
|
$recipients[] = $heads['region_head']['email'];
|
||||||
|
$phoneNumbers[] = $heads['region_head']['phone'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove duplicate data, if any
|
||||||
|
$recipients = array_unique($recipients);
|
||||||
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
|
// send whatsapp message
|
||||||
|
$url = route('forms.vehicle.view', $form->id);
|
||||||
|
WhatsappHelper::approve2Expense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
|
// // Send bulk email
|
||||||
|
Mail::to($recipients)->send(new ExpenseApproved2(
|
||||||
|
$name,
|
||||||
|
$expense_number,
|
||||||
|
$tanggal,
|
||||||
|
$total,
|
||||||
|
$url
|
||||||
|
));
|
||||||
|
|
||||||
|
AuditTrailHelper::AddAuditTrail('Approve', 'Approve Expense at Form Vehicle Running Cost (' . $form->expense_number . ')');
|
||||||
|
session()->flash('success', 'Form has been approved.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function finalApprove(Request $request, $id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['final_approval.approve']);
|
$this->checkAuthorization(auth()->user(), ['final_approval.approve']);
|
||||||
|
|
||||||
$form = FormVehicleRunningCost::findOrfail($id);
|
$form = FormVehicleRunningCost::findOrfail($id);
|
||||||
if($form->approved_at == null) {
|
if($form->approved_at == null || $form->approved2_at == null) {
|
||||||
session()->flash('error', 'Form must be approved by MIS first.');
|
session()->flash('error', 'Form must be approved by both approvers before final approval.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the total nominal exceeds the available budget
|
||||||
|
$cabang_id = UserHasCabang::where('user_id', $form->user_id)->first()->cabang_id;
|
||||||
|
if($form->total > BudgetHelper::getAvailableBudget($cabang_id)) {
|
||||||
|
session()->flash('error', 'The total nominal exceeds the available budget.');
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
$form->update([
|
$form->update([
|
||||||
'final_approved_at' => now(),
|
'final_approved_at' => now(),
|
||||||
'final_approved_by' => auth()->user()->id,
|
'final_approved_by' => auth()->user()->id,
|
||||||
'status' => 'Closed'
|
'status' => 'Closed',
|
||||||
|
'approved_total' => $form->total,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$heads = $form->user->getCabangAndRegionHead();
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
$name = $form->user->name;
|
$name = $form->user->name;
|
||||||
$expense_number = $form->expense_number;
|
$expense_number = $form->expense_number;
|
||||||
$tanggal = $form->tanggal;
|
$tanggal = $form->created_at;
|
||||||
$total = $form->approved_total;
|
$total = $form->approved_total;
|
||||||
|
|
||||||
// Collect all recipients
|
// Collect all recipients
|
||||||
@@ -391,7 +442,7 @@ class FormVehicleController extends Controller
|
|||||||
|
|
||||||
// send whatsapp message
|
// send whatsapp message
|
||||||
$url = route('forms.vehicle.view', $form->id);
|
$url = route('forms.vehicle.view', $form->id);
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
WhatsappHelper::finalApprove($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new FinalApprove(
|
Mail::to($recipients)->send(new FinalApprove(
|
||||||
@@ -407,25 +458,9 @@ class FormVehicleController extends Controller
|
|||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function open($id)
|
|
||||||
{
|
|
||||||
$this->checkAuthorization(auth()->user(), ['final_approval.open']);
|
|
||||||
|
|
||||||
$form = FormVehicleRunningCost::findOrfail($id);
|
|
||||||
$form->update([
|
|
||||||
'final_approved_at' => null,
|
|
||||||
'final_approved_by' => null,
|
|
||||||
'status' => 'Approved'
|
|
||||||
]);
|
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Open', 'Open Expense at Form Vehicle Running Cost (' . $form->expense_number . ')');
|
|
||||||
session()->flash('success', 'Form has been opened.');
|
|
||||||
return redirect()->back();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function reject($id)
|
public function reject($id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['approval.approve']);
|
$this->checkAuthorization(auth()->user(), ['approval.reject']);
|
||||||
|
|
||||||
$form = FormVehicleRunningCost::findOrfail($id);
|
$form = FormVehicleRunningCost::findOrfail($id);
|
||||||
$form->update([
|
$form->update([
|
||||||
@@ -435,7 +470,7 @@ class FormVehicleController extends Controller
|
|||||||
$heads = $form->user->getCabangAndRegionHead();
|
$heads = $form->user->getCabangAndRegionHead();
|
||||||
$name = $form->user->name;
|
$name = $form->user->name;
|
||||||
$expense_number = $form->expense_number;
|
$expense_number = $form->expense_number;
|
||||||
$tanggal = $form->tanggal;
|
$tanggal = $form->created_at;
|
||||||
$total = $form->total;
|
$total = $form->total;
|
||||||
|
|
||||||
// Collect all recipients
|
// Collect all recipients
|
||||||
@@ -456,9 +491,9 @@ class FormVehicleController extends Controller
|
|||||||
$recipients = array_unique($recipients);
|
$recipients = array_unique($recipients);
|
||||||
$phoneNumbers = array_unique($phoneNumbers);
|
$phoneNumbers = array_unique($phoneNumbers);
|
||||||
|
|
||||||
// Send bulk WhatsApp message
|
// send whatsapp message
|
||||||
$url = route('forms.vehicle.view', $form->id);
|
$url = route('forms.vehicle.view', $form->id);
|
||||||
WhatsappHelper::approveExpense($phoneNumbers, $expense_number, $url);
|
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
Mail::to($recipients)->send(new ExpenseRejected(
|
Mail::to($recipients)->send(new ExpenseRejected(
|
||||||
@@ -468,12 +503,28 @@ class FormVehicleController extends Controller
|
|||||||
$total,
|
$total,
|
||||||
$url
|
$url
|
||||||
));
|
));
|
||||||
|
|
||||||
AuditTrailHelper::AddAuditTrail('Reject', 'Reject Expense at Form Vehicle Running Cost (' . $form->expense_number . ')');
|
AuditTrailHelper::AddAuditTrail('Reject', 'Reject Expense at Form Vehicle Running Cost (' . $form->expense_number . ')');
|
||||||
session()->flash('success', 'Form has been rejected.');
|
session()->flash('success', 'Form has been rejected.');
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function open($id)
|
||||||
|
{
|
||||||
|
$this->checkAuthorization(auth()->user(), ['final_approval.open']);
|
||||||
|
|
||||||
|
$form = FormVehicleRunningCost::findOrfail($id);
|
||||||
|
$form->update([
|
||||||
|
'final_approved_at' => null,
|
||||||
|
'final_approved_by' => null,
|
||||||
|
'status' => 'Approved'
|
||||||
|
]);
|
||||||
|
|
||||||
|
AuditTrailHelper::AddAuditTrail('Open', 'Open Expense at Form Vehicle Running Cost (' . $form->expense_number . ')');
|
||||||
|
session()->flash('success', 'Form has been opened.');
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
$this->checkAuthorization(auth()->user(), ['forms.vehicle.delete']);
|
$this->checkAuthorization(auth()->user(), ['forms.vehicle.delete']);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class ExpenseApproved extends Mailable
|
|||||||
public function envelope(): Envelope
|
public function envelope(): Envelope
|
||||||
{
|
{
|
||||||
return new Envelope(
|
return new Envelope(
|
||||||
subject: 'Expense Approved',
|
subject: 'Expense First Approval',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Mail\Mailables\Content;
|
||||||
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class ExpenseApproved2 extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new message instance.
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
protected string $name,
|
||||||
|
protected string $expense_number,
|
||||||
|
protected string $tanggal,
|
||||||
|
protected int $total,
|
||||||
|
protected string $url,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message envelope.
|
||||||
|
*/
|
||||||
|
public function envelope(): Envelope
|
||||||
|
{
|
||||||
|
return new Envelope(
|
||||||
|
subject: 'Expense Second Approval',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message content definition.
|
||||||
|
*/
|
||||||
|
public function content(): Content
|
||||||
|
{
|
||||||
|
return new Content(
|
||||||
|
view: 'mail.approved2',
|
||||||
|
with: [
|
||||||
|
'name' => $this->name,
|
||||||
|
'expense_number' => $this->expense_number,
|
||||||
|
'tanggal' => $this->tanggal,
|
||||||
|
'total' => $this->total,
|
||||||
|
'url' => $this->url,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the attachments for the message.
|
||||||
|
*
|
||||||
|
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||||
|
*/
|
||||||
|
public function attachments(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,7 +30,7 @@ class FinalApprove extends Mailable
|
|||||||
public function envelope(): Envelope
|
public function envelope(): Envelope
|
||||||
{
|
{
|
||||||
return new Envelope(
|
return new Envelope(
|
||||||
subject: 'Expense Closed',
|
subject: 'Expense Final Approval',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ class FormEntertaimentPresentation extends Model
|
|||||||
'account_number',
|
'account_number',
|
||||||
'status',
|
'status',
|
||||||
'approved_at',
|
'approved_at',
|
||||||
|
'approved2_at',
|
||||||
'approved_by',
|
'approved_by',
|
||||||
|
'approved2_by',
|
||||||
'final_approved_at',
|
'final_approved_at',
|
||||||
'final_approved_by',
|
'final_approved_by',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ class FormMeetingSeminar extends Model
|
|||||||
'account_number',
|
'account_number',
|
||||||
'status',
|
'status',
|
||||||
'approved_at',
|
'approved_at',
|
||||||
|
'approved2_at',
|
||||||
'approved_by',
|
'approved_by',
|
||||||
|
'approved2_by',
|
||||||
'final_approved_at',
|
'final_approved_at',
|
||||||
'final_approved_by',
|
'final_approved_by',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ class FormOthers extends Model
|
|||||||
'account_number',
|
'account_number',
|
||||||
'status',
|
'status',
|
||||||
'approved_at',
|
'approved_at',
|
||||||
|
'approved2_at',
|
||||||
'approved_by',
|
'approved_by',
|
||||||
|
'approved2_by',
|
||||||
'final_approved_at',
|
'final_approved_at',
|
||||||
'final_approved_by',
|
'final_approved_by',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -34,7 +34,9 @@ class FormUpCountry extends Model
|
|||||||
'account_number',
|
'account_number',
|
||||||
'status',
|
'status',
|
||||||
'approved_at',
|
'approved_at',
|
||||||
|
'approved2_at',
|
||||||
'approved_by',
|
'approved_by',
|
||||||
|
'approved2_by',
|
||||||
'final_approved_at',
|
'final_approved_at',
|
||||||
'final_approved_by',
|
'final_approved_by',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ class FormVehicleRunningCost extends Model
|
|||||||
'account_number',
|
'account_number',
|
||||||
'status',
|
'status',
|
||||||
'approved_at',
|
'approved_at',
|
||||||
|
'approved2_at',
|
||||||
'approved_by',
|
'approved_by',
|
||||||
|
'approved2_by',
|
||||||
'final_approved_at',
|
'final_approved_at',
|
||||||
'final_approved_by',
|
'final_approved_by',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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_up_country', function (Blueprint $table) {
|
||||||
|
$table->timestamp('approved2_at')->nullable()->after('approved_at');
|
||||||
|
$table->foreignId('approved2_by')->nullable()->constrained('admins')->cascadeOnDelete()->after('approved_by');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('form_up_country', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('approved2_at');
|
||||||
|
$table->dropForeign(['approved2_by']);
|
||||||
|
$table->dropColumn('approved2_by');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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->timestamp('approved2_at')->nullable()->after('approved_at');
|
||||||
|
$table->foreignId('approved2_by')->nullable()->constrained('admins')->cascadeOnDelete()->after('approved_by');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('form_vehicle_running_cost', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('approved2_at');
|
||||||
|
$table->dropForeign(['approved2_by']);
|
||||||
|
$table->dropColumn('approved2_by');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
<?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->timestamp('approved2_at')->nullable()->after('approved_at');
|
||||||
|
$table->foreignId('approved2_by')->nullable()->constrained('admins')->cascadeOnDelete()->after('approved_by');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('form_entertainment_presentation', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('approved2_at');
|
||||||
|
$table->dropForeign(['approved2_by']);
|
||||||
|
$table->dropColumn('approved2_by');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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_meeting_seminar', function (Blueprint $table) {
|
||||||
|
$table->timestamp('approved2_at')->nullable()->after('approved_at');
|
||||||
|
$table->foreignId('approved2_by')->nullable()->constrained('admins')->cascadeOnDelete()->after('approved_by');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('form_meeting_seminar', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('approved2_at');
|
||||||
|
$table->dropForeign(['approved2_by']);
|
||||||
|
$table->dropColumn('approved2_by');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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->timestamp('approved2_at')->nullable()->after('approved_at');
|
||||||
|
$table->foreignId('approved2_by')->nullable()->constrained('admins')->cascadeOnDelete()->after('approved_by');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('form_others', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('approved2_at');
|
||||||
|
$table->dropForeign(['approved2_by']);
|
||||||
|
$table->dropColumn('approved2_by');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -12,6 +12,8 @@ use Database\Seeds\RolePermissionSeeder4;
|
|||||||
use Database\Seeds\RolePermissionSeeder5;
|
use Database\Seeds\RolePermissionSeeder5;
|
||||||
use Database\Seeds\RolePermissionSeeder6;
|
use Database\Seeds\RolePermissionSeeder6;
|
||||||
use Database\Seeds\RolePermissionSeeder7;
|
use Database\Seeds\RolePermissionSeeder7;
|
||||||
|
use Database\Seeds\RolePermissionSeeder8;
|
||||||
|
use Database\Seeds\RolePermissionSeeder9;
|
||||||
|
|
||||||
class DatabaseSeeder extends Seeder
|
class DatabaseSeeder extends Seeder
|
||||||
{
|
{
|
||||||
@@ -32,6 +34,8 @@ class DatabaseSeeder extends Seeder
|
|||||||
// $this->call(RolePermissionSeeder4::class);
|
// $this->call(RolePermissionSeeder4::class);
|
||||||
// $this->call(RolePermissionSeeder5::class);
|
// $this->call(RolePermissionSeeder5::class);
|
||||||
// $this->call(RolePermissionSeeder6::class);
|
// $this->call(RolePermissionSeeder6::class);
|
||||||
$this->call(RolePermissionSeeder7::class);
|
// $this->call(RolePermissionSeeder7::class);
|
||||||
|
// $this->call(RolePermissionSeeder8::class);
|
||||||
|
$this->call(RolePermissionSeeder9::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeds;
|
||||||
|
|
||||||
|
use App\Models\Admin;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Spatie\Permission\Models\Role;
|
||||||
|
use Spatie\Permission\Models\Permission;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class RolePermissionSeeder.
|
||||||
|
*
|
||||||
|
* @see https://spatie.be/docs/laravel-permission/v5/basic-usage/multiple-guards
|
||||||
|
*
|
||||||
|
* @package App\Database\Seeds
|
||||||
|
*/
|
||||||
|
class RolePermissionSeeder8 extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Enable these options if you need same role and other permission for User Model
|
||||||
|
* Else, please follow the below steps for admin guard
|
||||||
|
*/
|
||||||
|
$permissions = [
|
||||||
|
[
|
||||||
|
'group_name' => 'approval2',
|
||||||
|
'permissions' => [
|
||||||
|
'approval2.view',
|
||||||
|
'approval2.approve',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'group_name' => 'notification',
|
||||||
|
'permissions' => [
|
||||||
|
'notification.view',
|
||||||
|
'notification.delete',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Do same for the admin guard for tutorial purposes.
|
||||||
|
$admin = Admin::where('username', 'superadmin')->first();
|
||||||
|
$roleSuperAdmin = $this->maybeCreateSuperAdminRole($admin);
|
||||||
|
|
||||||
|
// Create and Assign Permissions
|
||||||
|
for ($i = 0; $i < count($permissions); $i++) {
|
||||||
|
$permissionGroup = $permissions[$i]['group_name'];
|
||||||
|
for ($j = 0; $j < count($permissions[$i]['permissions']); $j++) {
|
||||||
|
$permissionExist = Permission::where('name', $permissions[$i]['permissions'][$j])->first();
|
||||||
|
if (is_null($permissionExist)) {
|
||||||
|
$permission = Permission::create(
|
||||||
|
[
|
||||||
|
'name' => $permissions[$i]['permissions'][$j],
|
||||||
|
'group_name' => $permissionGroup,
|
||||||
|
'guard_name' => 'admin'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$roleSuperAdmin->givePermissionTo($permission);
|
||||||
|
$permission->assignRole($roleSuperAdmin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assign super admin role permission to superadmin user
|
||||||
|
if ($admin) {
|
||||||
|
$admin->assignRole($roleSuperAdmin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function maybeCreateSuperAdminRole($admin): Role
|
||||||
|
{
|
||||||
|
if (is_null($admin)) {
|
||||||
|
$roleSuperAdmin = Role::create(['name' => 'superadmin', 'guard_name' => 'admin']);
|
||||||
|
} else {
|
||||||
|
$roleSuperAdmin = Role::where('name', 'superadmin')->where('guard_name', 'admin')->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_null($roleSuperAdmin)) {
|
||||||
|
$roleSuperAdmin = Role::create(['name' => 'superadmin', 'guard_name' => 'admin']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $roleSuperAdmin;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeds;
|
||||||
|
|
||||||
|
use App\Models\Admin;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Spatie\Permission\Models\Role;
|
||||||
|
use Spatie\Permission\Models\Permission;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class RolePermissionSeeder.
|
||||||
|
*
|
||||||
|
* @see https://spatie.be/docs/laravel-permission/v5/basic-usage/multiple-guards
|
||||||
|
*
|
||||||
|
* @package App\Database\Seeds
|
||||||
|
*/
|
||||||
|
class RolePermissionSeeder9 extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Enable these options if you need same role and other permission for User Model
|
||||||
|
* Else, please follow the below steps for admin guard
|
||||||
|
*/
|
||||||
|
$permissions = [
|
||||||
|
[
|
||||||
|
'group_name' => 'approval',
|
||||||
|
'permissions' => [
|
||||||
|
'approval.reject',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'group_name' => 'approval2',
|
||||||
|
'permissions' => [
|
||||||
|
'approval2.reject',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Do same for the admin guard for tutorial purposes.
|
||||||
|
$admin = Admin::where('username', 'superadmin')->first();
|
||||||
|
$roleSuperAdmin = $this->maybeCreateSuperAdminRole($admin);
|
||||||
|
|
||||||
|
// Create and Assign Permissions
|
||||||
|
for ($i = 0; $i < count($permissions); $i++) {
|
||||||
|
$permissionGroup = $permissions[$i]['group_name'];
|
||||||
|
for ($j = 0; $j < count($permissions[$i]['permissions']); $j++) {
|
||||||
|
$permissionExist = Permission::where('name', $permissions[$i]['permissions'][$j])->first();
|
||||||
|
if (is_null($permissionExist)) {
|
||||||
|
$permission = Permission::create(
|
||||||
|
[
|
||||||
|
'name' => $permissions[$i]['permissions'][$j],
|
||||||
|
'group_name' => $permissionGroup,
|
||||||
|
'guard_name' => 'admin'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$roleSuperAdmin->givePermissionTo($permission);
|
||||||
|
$permission->assignRole($roleSuperAdmin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assign super admin role permission to superadmin user
|
||||||
|
if ($admin) {
|
||||||
|
$admin->assignRole($roleSuperAdmin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function maybeCreateSuperAdminRole($admin): Role
|
||||||
|
{
|
||||||
|
if (is_null($admin)) {
|
||||||
|
$roleSuperAdmin = Role::create(['name' => 'superadmin', 'guard_name' => 'admin']);
|
||||||
|
} else {
|
||||||
|
$roleSuperAdmin = Role::where('name', 'superadmin')->where('guard_name', 'admin')->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_null($roleSuperAdmin)) {
|
||||||
|
$roleSuperAdmin = Role::create(['name' => 'superadmin', 'guard_name' => 'admin']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $roleSuperAdmin;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -110,7 +110,10 @@
|
|||||||
<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'))
|
||||||
<th>Approval</th>
|
<th>Approval 1</th>
|
||||||
|
@endif
|
||||||
|
@if (auth()->user()->can('approval2.approve'))
|
||||||
|
<th>Approval 2</th>
|
||||||
@endif
|
@endif
|
||||||
@if (auth()->user()->can('final_approval.approve'))
|
@if (auth()->user()->can('final_approval.approve'))
|
||||||
<th>Final Approval</th>
|
<th>Final Approval</th>
|
||||||
@@ -148,7 +151,7 @@
|
|||||||
<td>
|
<td>
|
||||||
@if ($item->status == 'On Progress')
|
@if ($item->status == 'On Progress')
|
||||||
<span class="badge badge-warning text-white">{{ $item->status }}</span>
|
<span class="badge badge-warning text-white">{{ $item->status }}</span>
|
||||||
@elseif ($item->status == 'Approved' || $item->status == 'Final Approved')
|
@elseif ($item->status == 'Approved 1' || $item->status == 'Approved 2' || $item->status == 'Final Approved')
|
||||||
<span class="badge badge-success text-white">{{ $item->status }}</span>
|
<span class="badge badge-success text-white">{{ $item->status }}</span>
|
||||||
@else
|
@else
|
||||||
<span class="badge badge-danger text-white">{{ $item->status }}</span>
|
<span class="badge badge-danger text-white">{{ $item->status }}</span>
|
||||||
@@ -157,16 +160,16 @@
|
|||||||
@if (auth()->user()->can('approval.approve'))
|
@if (auth()->user()->can('approval.approve'))
|
||||||
<td>
|
<td>
|
||||||
{{-- approve / reject button --}}
|
{{-- approve / reject button --}}
|
||||||
@if ($item->status == 'On Progress')
|
@if ($item->status == 'On Progress' || $item->status == 'Rejected')
|
||||||
<form action="javascript:void(0);" class="d-inline">
|
<form action="javascript:void(0);" class="d-inline">
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="btn btn-success btn-sm open-approve-modal"
|
class="btn btn-success btn-sm open-approve-modal"
|
||||||
data-id="{{ route('forms.entertainment.approve', $item->id) }}">
|
data-id="{{ route('forms.entertainment.approve', $item->id) }}">
|
||||||
Approve
|
Approve 1
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form action="{{ route('forms.entertainment.reject', $item->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to reject this item?');">
|
<form action="{{ route('forms.entertainment.reject', $item->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to reject this item?');">
|
||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
<button type="submit" class="btn btn-danger btn-sm">
|
<button type="submit" class="btn btn-danger btn-sm">
|
||||||
@@ -184,14 +187,44 @@
|
|||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
@endif
|
@endif
|
||||||
|
@if (auth()->user()->can('approval2.approve'))
|
||||||
|
<td>
|
||||||
|
{{-- approve / reject button --}}
|
||||||
|
@if ($item->status == 'Approved 1' && $item->approved_at)
|
||||||
|
<form action="javascript:void(0);" class="d-inline">
|
||||||
|
<button type="button"
|
||||||
|
class="btn btn-success btn-sm open-approve-modal"
|
||||||
|
data-id="{{ route('forms.entertainment.approve2', $item->id) }}">
|
||||||
|
Approve 2
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form action="{{ route('forms.entertainment.reject', $item->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to reject this item?');">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
<button type="submit" class="btn btn-danger btn-sm">
|
||||||
|
Reject
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
@else
|
||||||
|
@if ($item->approved2_at)
|
||||||
|
{{ \Carbon\Carbon::parse($item->approved_at)->locale('id')->isoFormat('D MMMM Y') }}
|
||||||
|
@elseif($item->rejected_at)
|
||||||
|
{{ \Carbon\Carbon::parse($item->rejected_at)->locale('id')->isoFormat('D MMMM Y') }}
|
||||||
|
@else
|
||||||
|
-
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
@endif
|
||||||
@if(auth()->user()->can('final_approval.approve'))
|
@if(auth()->user()->can('final_approval.approve'))
|
||||||
<td>
|
<td>
|
||||||
{{-- approve / reject button --}}
|
{{-- approve / reject button --}}
|
||||||
@if ($item->status == 'Approved' && $item->approved_at && !$item->final_approved_at)
|
@if ($item->status == 'Approved 2' && $item->approved2_at && !$item->final_approved_at)
|
||||||
<form action="{{ route('forms.entertainment.final-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 final-approve-modal"
|
||||||
<button type="submit" class="btn btn-success btn-sm">
|
data-id="{{ route('forms.entertainment.final-approve', $item->id) }}">
|
||||||
Final Approve
|
Final Approve
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -280,22 +313,84 @@
|
|||||||
<strong>NIK/NPWP Penerima:</strong> <span id="nik_or_npwp"></span>
|
<strong>NIK/NPWP Penerima:</strong> <span id="nik_or_npwp"></span>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Nama Penerima:</strong> <span id="name"></span>
|
<strong>Tanggal:</strong> <span id="tanggal"></span>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Alamat Penerima:</strong> <span id="alamat"></span>
|
<strong>Nama Penerima:</strong> <span id="name"></span>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Jenis:</strong> <span id="jenis"></span>
|
<strong>Jenis:</strong> <span id="jenis"></span>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
|
||||||
<strong>Tanggal:</strong> <span id="tanggal"></span>
|
|
||||||
</li>
|
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Keterangan:</strong> <span id="keterangan"></span>
|
<strong>Keterangan:</strong> <span id="keterangan"></span>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Bukti Total Pengeluaran:</strong> <span id="bukti_total"></span>
|
<strong>Bukti Total:</strong> <span id="bukti_total"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Nominal Total:</strong> <span id="total_value"></span>
|
||||||
|
</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>
|
||||||
|
<section>
|
||||||
|
<div class="modal fade" id="finalApproveModal" tabindex="-1" role="dialog" aria-labelledby="finalApproveModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form id="finalApproveForm" 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="finalLoadingSpinner" 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="finalModalContent" 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="final_expense_number"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>User:</strong> <span id="final_user"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>NIK/NPWP Penerima:</strong> <span id="final_nik_or_npwp"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Tanggal:</strong> <span id="final_tanggal"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Nama Penerima:</strong> <span id="final_name"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Jenis:</strong> <span id="final_jenis"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Keterangan:</strong> <span id="final_keterangan"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Bukti Total:</strong> <span id="final_bukti_total"></span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p class="mt-2">Please select the items you want to approve:</p>
|
<p class="mt-2">Please select the items you want to approve:</p>
|
||||||
@@ -303,17 +398,11 @@
|
|||||||
<li>
|
<li>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="custom-control custom-checkbox">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox" class="custom-control-input" id="total_bensin" name="total_bensin">
|
<input type="checkbox" class="custom-control-input" id="final_total" name="total" required>
|
||||||
<label class="custom-control-label" for="total_bensin">Total Pengeluaran (<span id="total_bensin_value"></span>)</label>
|
<label class="custom-control-label" for="final_total">Total (<span id="final_total_value"></span>)</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</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>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -379,32 +468,31 @@
|
|||||||
$('#loadingSpinner').addClass('d-flex');
|
$('#loadingSpinner').addClass('d-flex');
|
||||||
$('#approveModal').modal('show'); // Show the modal
|
$('#approveModal').modal('show'); // Show the modal
|
||||||
|
|
||||||
// Get detail from /forms/up-country/detail/{id}
|
// Get detail from /forms/entertainment/detail/{id}
|
||||||
$.get(approveUrl.replace('approve', 'detail'), function (data) {
|
$.get(approveUrl.replace(/approve(2)?/, 'detail'), function (data) {
|
||||||
const formatter = new Intl.NumberFormat('id-ID', {
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: 'IDR',
|
currency: 'IDR',
|
||||||
minimumFractionDigits: 0
|
minimumFractionDigits: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#total_bensin_value').text(formatter.format(data.total));
|
$('#total_value').text(formatter.format(data.total));
|
||||||
$('#total_bensin').data('value', data.total);
|
|
||||||
|
|
||||||
// Detail data
|
// Detail data
|
||||||
$('#user').text(data.user.name);
|
$('#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);
|
$('#expense_number').text(data.expense_number);
|
||||||
$('#jenis').text(data.jenis);
|
$('#tanggal').text(new Date(data.created_at).toLocaleDateString('id-ID', {
|
||||||
$('#keterangan').text(data.keterangan);
|
|
||||||
$('#tanggal').text(new Date(data.tanggal).toLocaleDateString('id-ID', {
|
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
month: 'long',
|
month: 'long',
|
||||||
day: 'numeric',
|
day: 'numeric'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$('#bukti_total').html(data.bukti_total ? '<a href="' + data.bukti_total + '" target="_blank">Download</a>' : '-');
|
$('#nik_or_npwp').text(data.nik_or_npwp);
|
||||||
|
$('#name').text(data.name);
|
||||||
|
$('#jenis').text(data.jenis);
|
||||||
|
$('#keterangan').text(data.keterangan);
|
||||||
|
|
||||||
|
$('#bukti_total').html(data.total ? '<a href="' + data.total + '" target="_blank">Download</a>' : '-');
|
||||||
|
|
||||||
// Hide spinner and show content
|
// Hide spinner and show content
|
||||||
$('#loadingSpinner').hide();
|
$('#loadingSpinner').hide();
|
||||||
@@ -417,27 +505,79 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Handle Approve Button Click
|
||||||
|
$('.final-approve-modal').on('click', function () {
|
||||||
|
const approveUrl = $(this).data('id');
|
||||||
|
|
||||||
|
// Show spinner and hide content initially
|
||||||
|
$('#finalLoadingSpinner').show();
|
||||||
|
$('#finalModalContent').addClass('d-none');
|
||||||
|
|
||||||
|
$('#finalApproveForm').attr('action', approveUrl); // Set the form action
|
||||||
|
$('#finalLoadingSpinner').addClass('d-flex');
|
||||||
|
$('#finalApproveModal').modal('show'); // Show the modal
|
||||||
|
|
||||||
|
// Get detail from /forms/entertainment/detail/{id}
|
||||||
|
$.get(approveUrl.replace('final-approve', 'detail'), function (data) {
|
||||||
|
console.log(data);
|
||||||
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'IDR',
|
||||||
|
minimumFractionDigits: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#final_total_value').text(formatter.format(data.total));
|
||||||
|
|
||||||
|
// Assign data values to checkboxes
|
||||||
|
$('#final_total').data('value', data.total);
|
||||||
|
|
||||||
|
// Detail data
|
||||||
|
$('#final_user').text(data.user.name);
|
||||||
|
$('#final_expense_number').text(data.expense_number);
|
||||||
|
$('#final_tanggal').text(new Date(data.created_at).toLocaleDateString('id-ID', {
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'long',
|
||||||
|
day: 'numeric'
|
||||||
|
}));
|
||||||
|
|
||||||
|
$('#final_nik_or_npwp').text(data.nik_or_npwp);
|
||||||
|
$('#final_name').text(data.name);
|
||||||
|
$('#final_jenis').text(data.jenis);
|
||||||
|
$('#final_keterangan').text(data.keterangan);
|
||||||
|
|
||||||
|
|
||||||
|
$('#final_bukti_total').html(data.bukti_total ? '<a href="' + data.bukti_total + '" target="_blank">Download</a>' : '-');
|
||||||
|
|
||||||
|
// Hide spinner and show content
|
||||||
|
$('#finalLoadingSpinner').hide();
|
||||||
|
$('#finalLoadingSpinner').removeClass('d-flex');
|
||||||
|
$('#finalLoadingSpinner').addClass('d-none');
|
||||||
|
$('#finalModalContent').removeClass('d-none');
|
||||||
|
|
||||||
|
// Reset the total to zero
|
||||||
|
$('#total').val(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Update total dynamically
|
// Update total dynamically
|
||||||
$('.custom-control-input').on('change', function () {
|
$('.custom-control-input').on('change', function () {
|
||||||
let total = 0;
|
let total = 0;
|
||||||
|
|
||||||
// Calculate the total based on checked checkboxes
|
|
||||||
$('.custom-control-input:checked').each(function () {
|
$('.custom-control-input:checked').each(function () {
|
||||||
total += parseFloat($(this).data('value') || 0);
|
total += parseFloat($(this).data('value') || 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update the total field with formatted value
|
|
||||||
const formatter = new Intl.NumberFormat('id-ID', {
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: 'IDR',
|
currency: 'IDR',
|
||||||
minimumFractionDigits: 0
|
minimumFractionDigits: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#total').val(formatter.format(total));
|
$('#total').val(formatter.format(total));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Uncheck all checkboxes when the modal is closed
|
// Uncheck all checkboxes when the modal is closed
|
||||||
$('#approveModal').on('hidden.bs.modal', function () {
|
$('#finalApproveModal').on('hidden.bs.modal', function () {
|
||||||
$('.custom-control-input').prop('checked', false); // Uncheck all checkboxes
|
$('.custom-control-input').prop('checked', false); // Uncheck all checkboxes
|
||||||
$('#total').val('0'); // Reset total to 0
|
$('#total').val('0'); // Reset total to 0
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section class="content">
|
<section class="content">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="card card-primary card-outline">
|
<div class="card card-primary card-outline">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -109,7 +109,10 @@
|
|||||||
<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'))
|
||||||
<th>Approval</th>
|
<th>Approval 1</th>
|
||||||
|
@endif
|
||||||
|
@if (auth()->user()->can('approval2.approve'))
|
||||||
|
<th>Approval 2</th>
|
||||||
@endif
|
@endif
|
||||||
@if (auth()->user()->can('final_approval.approve'))
|
@if (auth()->user()->can('final_approval.approve'))
|
||||||
<th>Final Approval</th>
|
<th>Final Approval</th>
|
||||||
@@ -138,7 +141,7 @@
|
|||||||
<td>
|
<td>
|
||||||
@if ($item->status == 'On Progress')
|
@if ($item->status == 'On Progress')
|
||||||
<span class="badge badge-warning text-white">{{ $item->status }}</span>
|
<span class="badge badge-warning text-white">{{ $item->status }}</span>
|
||||||
@elseif ($item->status == 'Approved' || $item->status == 'Final Approved')
|
@elseif ($item->status == 'Approved 1' || $item->status == 'Approved 2' || $item->status == 'Final Approved')
|
||||||
<span class="badge badge-success text-white">{{ $item->status }}</span>
|
<span class="badge badge-success text-white">{{ $item->status }}</span>
|
||||||
@else
|
@else
|
||||||
<span class="badge badge-danger text-white">{{ $item->status }}</span>
|
<span class="badge badge-danger text-white">{{ $item->status }}</span>
|
||||||
@@ -147,16 +150,16 @@
|
|||||||
@if (auth()->user()->can('approval.approve'))
|
@if (auth()->user()->can('approval.approve'))
|
||||||
<td>
|
<td>
|
||||||
{{-- approve / reject button --}}
|
{{-- approve / reject button --}}
|
||||||
@if ($item->status == 'On Progress')
|
@if ($item->status == 'On Progress' || $item->status == 'Rejected')
|
||||||
<form action="javascript:void(0);" class="d-inline">
|
<form action="javascript:void(0);" class="d-inline">
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="btn btn-success btn-sm open-approve-modal"
|
class="btn btn-success btn-sm open-approve-modal"
|
||||||
data-id="{{ route('forms.meeting.approve', $item->id) }}">
|
data-id="{{ route('forms.meeting.approve', $item->id) }}">
|
||||||
Approve
|
Approve 1
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form action="{{ route('forms.meeting.reject', $item->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to reject this item?');">
|
<form action="{{ route('forms.meeting.reject', $item->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to reject this item?');">
|
||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
<button type="submit" class="btn btn-danger btn-sm">
|
<button type="submit" class="btn btn-danger btn-sm">
|
||||||
@@ -174,14 +177,44 @@
|
|||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
@endif
|
@endif
|
||||||
|
@if (auth()->user()->can('approval2.approve'))
|
||||||
|
<td>
|
||||||
|
{{-- approve / reject button --}}
|
||||||
|
@if ($item->status == 'Approved 1' && $item->approved_at)
|
||||||
|
<form action="javascript:void(0);" class="d-inline">
|
||||||
|
<button type="button"
|
||||||
|
class="btn btn-success btn-sm open-approve-modal"
|
||||||
|
data-id="{{ route('forms.meeting.approve2', $item->id) }}">
|
||||||
|
Approve 2
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form action="{{ route('forms.meeting.reject', $item->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to reject this item?');">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
<button type="submit" class="btn btn-danger btn-sm">
|
||||||
|
Reject
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
@else
|
||||||
|
@if ($item->approved2_at)
|
||||||
|
{{ \Carbon\Carbon::parse($item->approved_at)->locale('id')->isoFormat('D MMMM Y') }}
|
||||||
|
@elseif($item->rejected_at)
|
||||||
|
{{ \Carbon\Carbon::parse($item->rejected_at)->locale('id')->isoFormat('D MMMM Y') }}
|
||||||
|
@else
|
||||||
|
-
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
@endif
|
||||||
@if(auth()->user()->can('final_approval.approve'))
|
@if(auth()->user()->can('final_approval.approve'))
|
||||||
<td>
|
<td>
|
||||||
{{-- approve / reject button --}}
|
{{-- approve / reject button --}}
|
||||||
@if ($item->status == 'Approved' && $item->approved_at && !$item->final_approved_at)
|
@if ($item->status == 'Approved 2' && $item->approved2_at && !$item->final_approved_at)
|
||||||
<form action="{{ route('forms.meeting.final-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 final-approve-modal"
|
||||||
<button type="submit" class="btn btn-success btn-sm">
|
data-id="{{ route('forms.meeting.final-approve', $item->id) }}">
|
||||||
Final Approve
|
Final Approve
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -235,7 +268,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<div class="modal fade" id="approveModal" tabindex="-1" role="dialog" aria-labelledby="approveModalLabel" aria-hidden="true">
|
<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-dialog modal-lg" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@@ -267,44 +300,112 @@
|
|||||||
<strong>User:</strong> <span id="user"></span>
|
<strong>User:</strong> <span id="user"></span>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Tipe:</strong> Meeting & Seminar
|
<strong>Tipe:</strong> Meeting / Seminar
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Tanggal:</strong> <span id="tanggal"></span>
|
<strong>Tanggal:</strong> <span id="tanggal"></span>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Nominal Allowance:</strong> <span id="allowance_value"></span>
|
||||||
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Bukti Allowance:</strong> <span id="bukti_allowance"></span>
|
<strong>Bukti Allowance:</strong> <span id="bukti_allowance"></span>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Nominal Transport Antar Kota:</strong> <span id="transport_ankot_value"></span>
|
||||||
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Bukti Transport Antar Kota:</strong> <span id="bukti_transport_ankot"></span>
|
<strong>Bukti Transport Antar Kota:</strong> <span id="bukti_transport_ankot"></span>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Nominal Hotel:</strong> <span id="hotel_value"></span>
|
||||||
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Bukti Hotel:</strong> <span id="bukti_hotel"></span>
|
<strong>Bukti Hotel:</strong> <span id="bukti_hotel"></span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</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>
|
||||||
|
<section>
|
||||||
|
<div class="modal fade" id="finalApproveModal" tabindex="-1" role="dialog" aria-labelledby="finalApproveModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form id="finalApproveForm" 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="finalLoadingSpinner" 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="finalModalContent" 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="final_expense_number"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>User:</strong> <span id="final_user"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Tipe:</strong> Meeting / Seminar
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Tanggal:</strong> <span id="final_tanggal"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Bukti Allowance:</strong> <span id="final_bukti_allowance"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Bukti Transport Antar Kota:</strong> <span id="final_bukti_transport_ankot"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Bukti Hotel:</strong> <span id="final_bukti_hotel"></span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
<p class="mt-2">Please select the items you want to approve:</p>
|
<p class="mt-2">Please select the items you want to approve:</p>
|
||||||
<ul class="list-group list-unstyled">
|
<ul class="list-group list-unstyled">
|
||||||
<li>
|
<li>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="custom-control custom-checkbox">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox" class="custom-control-input" id="allowance" name="allowance">
|
<input type="checkbox" class="custom-control-input" id="final_allowance" name="allowance">
|
||||||
<label class="custom-control-label" for="allowance">Allowance (<span id="allowance_value"></span>)</label>
|
<label class="custom-control-label" for="final_allowance">Allowance (<span id="final_allowance_value"></span>)</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="custom-control custom-checkbox">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox" class="custom-control-input" id="transport_ankot" name="transport_ankot">
|
<input type="checkbox" class="custom-control-input" id="final_transport_ankot" name="transport_ankot">
|
||||||
<label class="custom-control-label" for="transport_ankot">Transport Ankot (<span id="transport_ankot_value"></span>)</label>
|
<label class="custom-control-label" for="final_transport_ankot">Transport Ankot (<span id="final_transport_ankot_value"></span>)</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="custom-control custom-checkbox">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox" class="custom-control-input" id="hotel" name="hotel">
|
<input type="checkbox" class="custom-control-input" id="final_hotel" name="hotel">
|
||||||
<label class="custom-control-label" for="hotel">Hotel (<span id="hotel_value"></span>)</label>
|
<label class="custom-control-label" for="final_hotel">Hotel (<span id="final_hotel_value"></span>)</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@@ -379,8 +480,8 @@
|
|||||||
$('#loadingSpinner').addClass('d-flex');
|
$('#loadingSpinner').addClass('d-flex');
|
||||||
$('#approveModal').modal('show'); // Show the modal
|
$('#approveModal').modal('show'); // Show the modal
|
||||||
|
|
||||||
// Get detail from /forms/up-country/detail/{id}
|
// Get detail from /forms/meeting/detail/{id}
|
||||||
$.get(approveUrl.replace('approve', 'detail'), function (data) {
|
$.get(approveUrl.replace(/approve(2)?/, 'detail'), function (data) {
|
||||||
const formatter = new Intl.NumberFormat('id-ID', {
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: 'IDR',
|
currency: 'IDR',
|
||||||
@@ -391,11 +492,6 @@
|
|||||||
$('#transport_ankot_value').text(formatter.format(data.transport_ankot));
|
$('#transport_ankot_value').text(formatter.format(data.transport_ankot));
|
||||||
$('#hotel_value').text(formatter.format(data.hotel));
|
$('#hotel_value').text(formatter.format(data.hotel));
|
||||||
|
|
||||||
// Assign data values to checkboxes
|
|
||||||
$('#allowance').data('value', data.allowance);
|
|
||||||
$('#transport_ankot').data('value', data.transport_ankot);
|
|
||||||
$('#hotel').data('value', data.hotel);
|
|
||||||
|
|
||||||
// Detail data
|
// Detail data
|
||||||
$('#user').text(data.user.name);
|
$('#user').text(data.user.name);
|
||||||
$('#expense_number').text(data.expense_number);
|
$('#expense_number').text(data.expense_number);
|
||||||
@@ -420,27 +516,79 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Handle Approve Button Click
|
||||||
|
$('.final-approve-modal').on('click', function () {
|
||||||
|
const approveUrl = $(this).data('id');
|
||||||
|
|
||||||
|
// Show spinner and hide content initially
|
||||||
|
$('#finalLoadingSpinner').show();
|
||||||
|
$('#finalModalContent').addClass('d-none');
|
||||||
|
|
||||||
|
$('#finalApproveForm').attr('action', approveUrl); // Set the form action
|
||||||
|
$('#finalLoadingSpinner').addClass('d-flex');
|
||||||
|
$('#finalApproveModal').modal('show'); // Show the modal
|
||||||
|
|
||||||
|
// Get detail from /forms/meeting/detail/{id}
|
||||||
|
$.get(approveUrl.replace('final-approve', 'detail'), function (data) {
|
||||||
|
console.log(data);
|
||||||
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'IDR',
|
||||||
|
minimumFractionDigits: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#final_allowance_value').text(formatter.format(data.allowance));
|
||||||
|
$('#final_transport_ankot_value').text(formatter.format(data.transport_ankot));
|
||||||
|
$('#final_hotel_value').text(formatter.format(data.hotel));
|
||||||
|
|
||||||
|
// Assign data values to checkboxes
|
||||||
|
$('#final_allowance').data('value', data.allowance);
|
||||||
|
$('#final_transport_ankot').data('value', data.transport_ankot);
|
||||||
|
$('#final_hotel').data('value', data.hotel);
|
||||||
|
|
||||||
|
// Detail data
|
||||||
|
$('#final_user').text(data.user.name);
|
||||||
|
$('#final_expense_number').text(data.expense_number);
|
||||||
|
$('#final_tanggal').text(new Date(data.created_at).toLocaleDateString('id-ID', {
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'long',
|
||||||
|
day: 'numeric'
|
||||||
|
}));
|
||||||
|
|
||||||
|
$('#final_bukti_allowance').html(data.bukti_allowance ? '<a href="' + data.bukti_allowance + '" target="_blank">Download</a>' : '-');
|
||||||
|
$('#final_bukti_transport_ankot').html(data.bukti_transport_ankot ? '<a href="' + data.bukti_transport_ankot + '" target="_blank">Download</a>' : '-');
|
||||||
|
$('#final_bukti_hotel').html(data.bukti_hotel ? '<a href="' + data.bukti_hotel + '" target="_blank">Download</a>' : '-');
|
||||||
|
|
||||||
|
// Hide spinner and show content
|
||||||
|
$('#finalLoadingSpinner').hide();
|
||||||
|
$('#finalLoadingSpinner').removeClass('d-flex');
|
||||||
|
$('#finalLoadingSpinner').addClass('d-none');
|
||||||
|
$('#finalModalContent').removeClass('d-none');
|
||||||
|
|
||||||
|
// Reset the total to zero
|
||||||
|
$('#total').val(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Update total dynamically
|
// Update total dynamically
|
||||||
$('.custom-control-input').on('change', function () {
|
$('.custom-control-input').on('change', function () {
|
||||||
let total = 0;
|
let total = 0;
|
||||||
|
|
||||||
// Calculate the total based on checked checkboxes
|
|
||||||
$('.custom-control-input:checked').each(function () {
|
$('.custom-control-input:checked').each(function () {
|
||||||
total += parseFloat($(this).data('value') || 0);
|
total += parseFloat($(this).data('value') || 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update the total field with formatted value
|
|
||||||
const formatter = new Intl.NumberFormat('id-ID', {
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: 'IDR',
|
currency: 'IDR',
|
||||||
minimumFractionDigits: 0
|
minimumFractionDigits: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#total').val(formatter.format(total));
|
$('#total').val(formatter.format(total));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Uncheck all checkboxes when the modal is closed
|
// Uncheck all checkboxes when the modal is closed
|
||||||
$('#approveModal').on('hidden.bs.modal', function () {
|
$('#finalApproveModal').on('hidden.bs.modal', function () {
|
||||||
$('.custom-control-input').prop('checked', false); // Uncheck all checkboxes
|
$('.custom-control-input').prop('checked', false); // Uncheck all checkboxes
|
||||||
$('#total').val('0'); // Reset total to 0
|
$('#total').val('0'); // Reset total to 0
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -109,7 +109,10 @@
|
|||||||
<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'))
|
||||||
<th>Approval</th>
|
<th>Approval 1</th>
|
||||||
|
@endif
|
||||||
|
@if (auth()->user()->can('approval2.approve'))
|
||||||
|
<th>Approval 2</th>
|
||||||
@endif
|
@endif
|
||||||
@if (auth()->user()->can('final_approval.approve'))
|
@if (auth()->user()->can('final_approval.approve'))
|
||||||
<th>Final Approval</th>
|
<th>Final Approval</th>
|
||||||
@@ -146,7 +149,7 @@
|
|||||||
<td>
|
<td>
|
||||||
@if ($item->status == 'On Progress')
|
@if ($item->status == 'On Progress')
|
||||||
<span class="badge badge-warning text-white">{{ $item->status }}</span>
|
<span class="badge badge-warning text-white">{{ $item->status }}</span>
|
||||||
@elseif ($item->status == 'Approved' || $item->status == 'Final Approved')
|
@elseif ($item->status == 'Approved 1' || $item->status == 'Approved 2' || $item->status == 'Final Approved')
|
||||||
<span class="badge badge-success text-white">{{ $item->status }}</span>
|
<span class="badge badge-success text-white">{{ $item->status }}</span>
|
||||||
@else
|
@else
|
||||||
<span class="badge badge-danger text-white">{{ $item->status }}</span>
|
<span class="badge badge-danger text-white">{{ $item->status }}</span>
|
||||||
@@ -155,16 +158,16 @@
|
|||||||
@if (auth()->user()->can('approval.approve'))
|
@if (auth()->user()->can('approval.approve'))
|
||||||
<td>
|
<td>
|
||||||
{{-- approve / reject button --}}
|
{{-- approve / reject button --}}
|
||||||
@if ($item->status == 'On Progress')
|
@if ($item->status == 'On Progress' || $item->status == 'Rejected')
|
||||||
<form action="javascript:void(0);" class="d-inline">
|
<form action="javascript:void(0);" class="d-inline">
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="btn btn-success btn-sm open-approve-modal"
|
class="btn btn-success btn-sm open-approve-modal"
|
||||||
data-id="{{ route('forms.other.approve', $item->id) }}">
|
data-id="{{ route('forms.other.approve', $item->id) }}">
|
||||||
Approve
|
Approve 1
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form action="{{ route('forms.other.reject', $item->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to reject this item?');">
|
<form action="{{ route('forms.other.reject', $item->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to reject this item?');">
|
||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
<button type="submit" class="btn btn-danger btn-sm">
|
<button type="submit" class="btn btn-danger btn-sm">
|
||||||
@@ -182,14 +185,44 @@
|
|||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
@endif
|
@endif
|
||||||
|
@if (auth()->user()->can('approval2.approve'))
|
||||||
|
<td>
|
||||||
|
{{-- approve / reject button --}}
|
||||||
|
@if ($item->status == 'Approved 1' && $item->approved_at)
|
||||||
|
<form action="javascript:void(0);" class="d-inline">
|
||||||
|
<button type="button"
|
||||||
|
class="btn btn-success btn-sm open-approve-modal"
|
||||||
|
data-id="{{ route('forms.other.approve2', $item->id) }}">
|
||||||
|
Approve 2
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form action="{{ route('forms.other.reject', $item->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to reject this item?');">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
<button type="submit" class="btn btn-danger btn-sm">
|
||||||
|
Reject
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
@else
|
||||||
|
@if ($item->approved2_at)
|
||||||
|
{{ \Carbon\Carbon::parse($item->approved_at)->locale('id')->isoFormat('D MMMM Y') }}
|
||||||
|
@elseif($item->rejected_at)
|
||||||
|
{{ \Carbon\Carbon::parse($item->rejected_at)->locale('id')->isoFormat('D MMMM Y') }}
|
||||||
|
@else
|
||||||
|
-
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
@endif
|
||||||
@if(auth()->user()->can('final_approval.approve'))
|
@if(auth()->user()->can('final_approval.approve'))
|
||||||
<td>
|
<td>
|
||||||
{{-- approve / reject button --}}
|
{{-- approve / reject button --}}
|
||||||
@if ($item->status == 'Approved' && $item->approved_at && !$item->final_approved_at)
|
@if ($item->status == 'Approved 2' && $item->approved2_at && !$item->final_approved_at)
|
||||||
<form action="{{ route('forms.other.final-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 final-approve-modal"
|
||||||
<button type="submit" class="btn btn-success btn-sm">
|
data-id="{{ route('forms.other.final-approve', $item->id) }}">
|
||||||
Final Approve
|
Final Approve
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -278,13 +311,72 @@
|
|||||||
<strong>Kategori:</strong> <span id="kategori"></span>
|
<strong>Kategori:</strong> <span id="kategori"></span>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Tanggal & Waktu:</strong> <span id="tanggal"></span>
|
<strong>Tanggal:</strong> <span id="tanggal"></span>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Keterangan:</strong> <span id="keterangan"></span>
|
<strong>Keterangan:</strong> <span id="keterangan"></span>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Bukti Total Pengeluaran:</strong> <span id="bukti_total"></span>
|
<strong>Bukti Total:</strong> <span id="bukti_total"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Nominal Total:</strong> <span id="total_value"></span>
|
||||||
|
</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>
|
||||||
|
<section>
|
||||||
|
<div class="modal fade" id="finalApproveModal" tabindex="-1" role="dialog" aria-labelledby="finalApproveModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form id="finalApproveForm" 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="finalLoadingSpinner" 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="finalModalContent" 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="final_expense_number"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>User:</strong> <span id="final_user"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Kategori:</strong> <span id="final_kategori"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Tanggal:</strong> <span id="final_tanggal"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Keterangan:</strong> <span id="final_keterangan"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Bukti Total:</strong> <span id="final_bukti_total"></span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p class="mt-2">Please select the items you want to approve:</p>
|
<p class="mt-2">Please select the items you want to approve:</p>
|
||||||
@@ -292,17 +384,11 @@
|
|||||||
<li>
|
<li>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="custom-control custom-checkbox">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox" class="custom-control-input" id="total_pengeluaran" name="total_pengeluaran">
|
<input type="checkbox" class="custom-control-input" id="final_total" name="total" required>
|
||||||
<label class="custom-control-label" for="total_pengeluaran">Total Pengeluaran (<span id="total_pengeluaran_value"></span>)</label>
|
<label class="custom-control-label" for="final_total">Total (<span id="final_total_value"></span>)</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</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>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -368,31 +454,29 @@
|
|||||||
$('#loadingSpinner').addClass('d-flex');
|
$('#loadingSpinner').addClass('d-flex');
|
||||||
$('#approveModal').modal('show'); // Show the modal
|
$('#approveModal').modal('show'); // Show the modal
|
||||||
|
|
||||||
// Get detail from /forms/up-country/detail/{id}
|
// Get detail from /forms/vehicle/detail/{id}
|
||||||
$.get(approveUrl.replace('approve', 'detail'), function (data) {
|
$.get(approveUrl.replace(/approve(2)?/, 'detail'), function (data) {
|
||||||
const formatter = new Intl.NumberFormat('id-ID', {
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: 'IDR',
|
currency: 'IDR',
|
||||||
minimumFractionDigits: 0
|
minimumFractionDigits: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#kategori').text(data.kategori.name);
|
$('#total_value').text(formatter.format(data.total));
|
||||||
$('#keterangan').text(data.keterangan);
|
|
||||||
$('#total_pengeluaran_value').text(formatter.format(data.total));
|
|
||||||
$('#total_pengeluaran').data('value', data.total);
|
|
||||||
|
|
||||||
// Detail data
|
// Detail data
|
||||||
$('#user').text(data.user.name);
|
$('#user').text(data.user.name);
|
||||||
$('#expense_number').text(data.expense_number);
|
$('#expense_number').text(data.expense_number);
|
||||||
$('#tanggal').text(new Date(data.tanggal).toLocaleDateString('id-ID', {
|
$('#tanggal').text(new Date(data.created_at).toLocaleDateString('id-ID', {
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
month: 'long',
|
month: 'long',
|
||||||
day: 'numeric',
|
day: 'numeric'
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
$('#kategori').text(data.kategori.name);
|
||||||
|
$('#keterangan').text(data.keterangan);
|
||||||
|
|
||||||
$('#bukti_total').html(data.bukti_total ? '<a href="' + data.bukti_total + '" target="_blank">Download</a>' : '-');
|
$('#bukti_total').html(data.total ? '<a href="' + data.total + '" target="_blank">Download</a>' : '-');
|
||||||
|
|
||||||
// Hide spinner and show content
|
// Hide spinner and show content
|
||||||
$('#loadingSpinner').hide();
|
$('#loadingSpinner').hide();
|
||||||
@@ -405,27 +489,76 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Handle Approve Button Click
|
||||||
|
$('.final-approve-modal').on('click', function () {
|
||||||
|
const approveUrl = $(this).data('id');
|
||||||
|
|
||||||
|
// Show spinner and hide content initially
|
||||||
|
$('#finalLoadingSpinner').show();
|
||||||
|
$('#finalModalContent').addClass('d-none');
|
||||||
|
|
||||||
|
$('#finalApproveForm').attr('action', approveUrl); // Set the form action
|
||||||
|
$('#finalLoadingSpinner').addClass('d-flex');
|
||||||
|
$('#finalApproveModal').modal('show'); // Show the modal
|
||||||
|
|
||||||
|
// Get detail from /forms/vehicle/detail/{id}
|
||||||
|
$.get(approveUrl.replace('final-approve', 'detail'), function (data) {
|
||||||
|
console.log(data);
|
||||||
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'IDR',
|
||||||
|
minimumFractionDigits: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#final_total_value').text(formatter.format(data.total));
|
||||||
|
|
||||||
|
// Assign data values to checkboxes
|
||||||
|
$('#final_total').data('value', data.total);
|
||||||
|
|
||||||
|
// Detail data
|
||||||
|
$('#final_user').text(data.user.name);
|
||||||
|
$('#final_expense_number').text(data.expense_number);
|
||||||
|
$('#final_tanggal').text(new Date(data.created_at).toLocaleDateString('id-ID', {
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'long',
|
||||||
|
day: 'numeric'
|
||||||
|
}));
|
||||||
|
|
||||||
|
$('#final_kategori').text(data.kategori.name);
|
||||||
|
$('#final_keterangan').text(data.keterangan);
|
||||||
|
|
||||||
|
$('#final_bukti_total').html(data.bukti_total ? '<a href="' + data.bukti_total + '" target="_blank">Download</a>' : '-');
|
||||||
|
|
||||||
|
// Hide spinner and show content
|
||||||
|
$('#finalLoadingSpinner').hide();
|
||||||
|
$('#finalLoadingSpinner').removeClass('d-flex');
|
||||||
|
$('#finalLoadingSpinner').addClass('d-none');
|
||||||
|
$('#finalModalContent').removeClass('d-none');
|
||||||
|
|
||||||
|
// Reset the total to zero
|
||||||
|
$('#total').val(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Update total dynamically
|
// Update total dynamically
|
||||||
$('.custom-control-input').on('change', function () {
|
$('.custom-control-input').on('change', function () {
|
||||||
let total = 0;
|
let total = 0;
|
||||||
|
|
||||||
// Calculate the total based on checked checkboxes
|
|
||||||
$('.custom-control-input:checked').each(function () {
|
$('.custom-control-input:checked').each(function () {
|
||||||
total += parseFloat($(this).data('value') || 0);
|
total += parseFloat($(this).data('value') || 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update the total field with formatted value
|
|
||||||
const formatter = new Intl.NumberFormat('id-ID', {
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: 'IDR',
|
currency: 'IDR',
|
||||||
minimumFractionDigits: 0
|
minimumFractionDigits: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#total').val(formatter.format(total));
|
$('#total').val(formatter.format(total));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Uncheck all checkboxes when the modal is closed
|
// Uncheck all checkboxes when the modal is closed
|
||||||
$('#approveModal').on('hidden.bs.modal', function () {
|
$('#finalApproveModal').on('hidden.bs.modal', function () {
|
||||||
$('.custom-control-input').prop('checked', false); // Uncheck all checkboxes
|
$('.custom-control-input').prop('checked', false); // Uncheck all checkboxes
|
||||||
$('#total').val('0'); // Reset total to 0
|
$('#total').val('0'); // Reset total to 0
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -109,7 +109,10 @@
|
|||||||
<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'))
|
||||||
<th>Approval</th>
|
<th>Approval 1</th>
|
||||||
|
@endif
|
||||||
|
@if (auth()->user()->can('approval2.approve'))
|
||||||
|
<th>Approval 2</th>
|
||||||
@endif
|
@endif
|
||||||
@if (auth()->user()->can('final_approval.approve'))
|
@if (auth()->user()->can('final_approval.approve'))
|
||||||
<th>Final Approval</th>
|
<th>Final Approval</th>
|
||||||
@@ -144,7 +147,7 @@
|
|||||||
<td>
|
<td>
|
||||||
@if ($item->status == 'On Progress')
|
@if ($item->status == 'On Progress')
|
||||||
<span class="badge badge-warning text-white">{{ $item->status }}</span>
|
<span class="badge badge-warning text-white">{{ $item->status }}</span>
|
||||||
@elseif ($item->status == 'Approved' || $item->status == 'Final Approved')
|
@elseif ($item->status == 'Approved 1' || $item->status == 'Approved 2' || $item->status == 'Final Approved')
|
||||||
<span class="badge badge-success text-white">{{ $item->status }}</span>
|
<span class="badge badge-success text-white">{{ $item->status }}</span>
|
||||||
@else
|
@else
|
||||||
<span class="badge badge-danger text-white">{{ $item->status }}</span>
|
<span class="badge badge-danger text-white">{{ $item->status }}</span>
|
||||||
@@ -153,12 +156,12 @@
|
|||||||
@if (auth()->user()->can('approval.approve'))
|
@if (auth()->user()->can('approval.approve'))
|
||||||
<td>
|
<td>
|
||||||
{{-- approve / reject button --}}
|
{{-- approve / reject button --}}
|
||||||
@if ($item->status == 'On Progress')
|
@if ($item->status == 'On Progress' || $item->status == 'Rejected')
|
||||||
<form action="javascript:void(0);" class="d-inline">
|
<form action="javascript:void(0);" class="d-inline">
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="btn btn-success btn-sm open-approve-modal"
|
class="btn btn-success btn-sm open-approve-modal"
|
||||||
data-id="{{ route('forms.up-country.approve', $item->id) }}">
|
data-id="{{ route('forms.up-country.approve', $item->id) }}">
|
||||||
Approve
|
Approve 1
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@@ -180,14 +183,44 @@
|
|||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
@endif
|
@endif
|
||||||
|
@if (auth()->user()->can('approval2.approve'))
|
||||||
|
<td>
|
||||||
|
{{-- approve / reject button --}}
|
||||||
|
@if ($item->status == 'Approved 1' && $item->approved_at)
|
||||||
|
<form action="javascript:void(0);" class="d-inline">
|
||||||
|
<button type="button"
|
||||||
|
class="btn btn-success btn-sm open-approve-modal"
|
||||||
|
data-id="{{ route('forms.up-country.approve2', $item->id) }}">
|
||||||
|
Approve 2
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form action="{{ route('forms.up-country.reject', $item->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to reject this item?');">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
<button type="submit" class="btn btn-danger btn-sm">
|
||||||
|
Reject
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
@else
|
||||||
|
@if ($item->approved2_at)
|
||||||
|
{{ \Carbon\Carbon::parse($item->approved_at)->locale('id')->isoFormat('D MMMM Y') }}
|
||||||
|
@elseif($item->rejected_at)
|
||||||
|
{{ \Carbon\Carbon::parse($item->rejected_at)->locale('id')->isoFormat('D MMMM Y') }}
|
||||||
|
@else
|
||||||
|
-
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
@endif
|
||||||
@if(auth()->user()->can('final_approval.approve'))
|
@if(auth()->user()->can('final_approval.approve'))
|
||||||
<td>
|
<td>
|
||||||
{{-- approve / reject button --}}
|
{{-- approve / reject button --}}
|
||||||
@if ($item->status == 'Approved' && $item->approved_at && !$item->final_approved_at)
|
@if ($item->status == 'Approved 2' && $item->approved2_at && !$item->final_approved_at)
|
||||||
<form action="{{ route('forms.up-country.final-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 final-approve-modal"
|
||||||
<button type="submit" class="btn btn-success btn-sm">
|
data-id="{{ route('forms.up-country.final-approve', $item->id) }}">
|
||||||
Final Approve
|
Final Approve
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -287,50 +320,133 @@
|
|||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Jarak:</strong> <span id="jarak"></span>
|
<strong>Jarak:</strong> <span id="jarak"></span>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Nominal Allowance:</strong> <span id="allowance_value"></span>
|
||||||
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Bukti Allowance:</strong> <span id="bukti_allowance"></span>
|
<strong>Bukti Allowance:</strong> <span id="bukti_allowance"></span>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Nominal Transport Dalam Kota:</strong> <span id="transport_dalkot_value"></span>
|
||||||
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Bukti Transport Dalam Kota:</strong> <span id="bukti_transport_dalkot"></span>
|
<strong>Bukti Transport Dalam Kota:</strong> <span id="bukti_transport_dalkot"></span>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Nominal Transport Antar Kota:</strong> <span id="transport_ankot_value"></span>
|
||||||
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Bukti Transport Antar Kota:</strong> <span id="bukti_transport_ankot"></span>
|
<strong>Bukti Transport Antar Kota:</strong> <span id="bukti_transport_ankot"></span>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Nominal Hotel:</strong> <span id="hotel_value"></span>
|
||||||
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Bukti Hotel:</strong> <span id="bukti_hotel"></span>
|
<strong>Bukti Hotel:</strong> <span id="bukti_hotel"></span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</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>
|
||||||
|
<section>
|
||||||
|
<div class="modal fade" id="finalApproveModal" tabindex="-1" role="dialog" aria-labelledby="finalApproveModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form id="finalApproveForm" 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="finalLoadingSpinner" 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="finalModalContent" 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="final_expense_number"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>User:</strong> <span id="final_user"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Tipe:</strong> Up Country
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Rayon:</strong> <span id="final_rayon"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Tanggal:</strong> <span id="final_tanggal"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Tujuan:</strong> <span id="final_tujuan"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Jarak:</strong> <span id="final_jarak"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Bukti Allowance:</strong> <span id="final_bukti_allowance"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Bukti Transport Dalam Kota:</strong> <span id="final_bukti_transport_dalkot"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Bukti Transport Antar Kota:</strong> <span id="final_bukti_transport_ankot"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Bukti Hotel:</strong> <span id="final_bukti_hotel"></span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
<p class="mt-2">Please select the items you want to approve:</p>
|
<p class="mt-2">Please select the items you want to approve:</p>
|
||||||
<ul class="list-group list-unstyled">
|
<ul class="list-group list-unstyled">
|
||||||
<li>
|
<li>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="custom-control custom-checkbox">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox" class="custom-control-input" id="allowance" name="allowance">
|
<input type="checkbox" class="custom-control-input" id="final_allowance" name="allowance">
|
||||||
<label class="custom-control-label" for="allowance">Allowance (<span id="allowance_value"></span>)</label>
|
<label class="custom-control-label" for="final_allowance">Allowance (<span id="final_allowance_value"></span>)</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="custom-control custom-checkbox">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox" class="custom-control-input" id="transport_dalkot" name="transport_dalkot">
|
<input type="checkbox" class="custom-control-input" id="final_transport_dalkot" name="transport_dalkot">
|
||||||
<label class="custom-control-label" for="transport_dalkot">Transport Dalkot (<span id="transport_dalkot_value"></span>)</label>
|
<label class="custom-control-label" for="final_transport_dalkot">Transport Dalkot (<span id="final_transport_dalkot_value"></span>)</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="custom-control custom-checkbox">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox" class="custom-control-input" id="transport_ankot" name="transport_ankot">
|
<input type="checkbox" class="custom-control-input" id="final_transport_ankot" name="transport_ankot">
|
||||||
<label class="custom-control-label" for="transport_ankot">Transport Ankot (<span id="transport_ankot_value"></span>)</label>
|
<label class="custom-control-label" for="final_transport_ankot">Transport Ankot (<span id="final_transport_ankot_value"></span>)</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="custom-control custom-checkbox">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox" class="custom-control-input" id="hotel" name="hotel">
|
<input type="checkbox" class="custom-control-input" id="final_hotel" name="hotel">
|
||||||
<label class="custom-control-label" for="hotel">Hotel (<span id="hotel_value"></span>)</label>
|
<label class="custom-control-label" for="final_hotel">Hotel (<span id="final_hotel_value"></span>)</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@@ -406,7 +522,7 @@
|
|||||||
$('#approveModal').modal('show'); // Show the modal
|
$('#approveModal').modal('show'); // Show the modal
|
||||||
|
|
||||||
// Get detail from /forms/up-country/detail/{id}
|
// Get detail from /forms/up-country/detail/{id}
|
||||||
$.get(approveUrl.replace('approve', 'detail'), function (data) {
|
$.get(approveUrl.replace(/approve(2)?/, 'detail'), function (data) {
|
||||||
const formatter = new Intl.NumberFormat('id-ID', {
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: 'IDR',
|
currency: 'IDR',
|
||||||
@@ -418,12 +534,6 @@
|
|||||||
$('#transport_ankot_value').text(formatter.format(data.transport_ankot));
|
$('#transport_ankot_value').text(formatter.format(data.transport_ankot));
|
||||||
$('#hotel_value').text(formatter.format(data.hotel));
|
$('#hotel_value').text(formatter.format(data.hotel));
|
||||||
|
|
||||||
// Assign data values to checkboxes
|
|
||||||
$('#allowance').data('value', data.allowance);
|
|
||||||
$('#transport_dalkot').data('value', data.transport_dalkot);
|
|
||||||
$('#transport_ankot').data('value', data.transport_ankot);
|
|
||||||
$('#hotel').data('value', data.hotel);
|
|
||||||
|
|
||||||
// Detail data
|
// Detail data
|
||||||
$('#user').text(data.user.name);
|
$('#user').text(data.user.name);
|
||||||
$('#expense_number').text(data.expense_number);
|
$('#expense_number').text(data.expense_number);
|
||||||
@@ -452,27 +562,85 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Handle Approve Button Click
|
||||||
|
$('.final-approve-modal').on('click', function () {
|
||||||
|
const approveUrl = $(this).data('id');
|
||||||
|
|
||||||
|
// Show spinner and hide content initially
|
||||||
|
$('#finalLoadingSpinner').show();
|
||||||
|
$('#finalModalContent').addClass('d-none');
|
||||||
|
|
||||||
|
$('#finalApproveForm').attr('action', approveUrl); // Set the form action
|
||||||
|
$('#finalLoadingSpinner').addClass('d-flex');
|
||||||
|
$('#finalApproveModal').modal('show'); // Show the modal
|
||||||
|
|
||||||
|
// Get detail from /forms/up-country/detail/{id}
|
||||||
|
$.get(approveUrl.replace('final-approve', 'detail'), function (data) {
|
||||||
|
console.log(data);
|
||||||
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'IDR',
|
||||||
|
minimumFractionDigits: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#final_allowance_value').text(formatter.format(data.allowance));
|
||||||
|
$('#final_transport_dalkot_value').text(formatter.format(data.transport_dalkot));
|
||||||
|
$('#final_transport_ankot_value').text(formatter.format(data.transport_ankot));
|
||||||
|
$('#final_hotel_value').text(formatter.format(data.hotel));
|
||||||
|
|
||||||
|
// Assign data values to checkboxes
|
||||||
|
$('#final_allowance').data('value', data.allowance);
|
||||||
|
$('#final_transport_dalkot').data('value', data.transport_dalkot);
|
||||||
|
$('#final_transport_ankot').data('value', data.transport_ankot);
|
||||||
|
$('#final_hotel').data('value', data.hotel);
|
||||||
|
|
||||||
|
// Detail data
|
||||||
|
$('#final_user').text(data.user.name);
|
||||||
|
$('#final_expense_number').text(data.expense_number);
|
||||||
|
$('#final_rayon').text(data.rayon.code);
|
||||||
|
$('#final_tanggal').text(new Date(data.tanggal).toLocaleDateString('id-ID', {
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'long',
|
||||||
|
day: 'numeric'
|
||||||
|
}));
|
||||||
|
$('#final_tujuan').text(data.tujuan);
|
||||||
|
$('#final_jarak').text(data.jarak + ' km');
|
||||||
|
|
||||||
|
$('#final_bukti_allowance').html(data.bukti_allowance ? '<a href="' + data.bukti_allowance + '" target="_blank">Download</a>' : '-');
|
||||||
|
$('#final_bukti_transport_dalkot').html(data.bukti_transport_dalkot ? '<a href="' + data.bukti_transport_dalkot + '" target="_blank">Download</a>' : '-');
|
||||||
|
$('#final_bukti_transport_ankot').html(data.bukti_transport_ankot ? '<a href="' + data.bukti_transport_ankot + '" target="_blank">Download</a>' : '-');
|
||||||
|
$('#final_bukti_hotel').html(data.bukti_hotel ? '<a href="' + data.bukti_hotel + '" target="_blank">Download</a>' : '-');
|
||||||
|
|
||||||
|
// Hide spinner and show content
|
||||||
|
$('#finalLoadingSpinner').hide();
|
||||||
|
$('#finalLoadingSpinner').removeClass('d-flex');
|
||||||
|
$('#finalLoadingSpinner').addClass('d-none');
|
||||||
|
$('#finalModalContent').removeClass('d-none');
|
||||||
|
|
||||||
|
// Reset the total to zero
|
||||||
|
$('#total').val(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Update total dynamically
|
// Update total dynamically
|
||||||
$('.custom-control-input').on('change', function () {
|
$('.custom-control-input').on('change', function () {
|
||||||
let total = 0;
|
let total = 0;
|
||||||
|
|
||||||
// Calculate the total based on checked checkboxes
|
|
||||||
$('.custom-control-input:checked').each(function () {
|
$('.custom-control-input:checked').each(function () {
|
||||||
total += parseFloat($(this).data('value') || 0);
|
total += parseFloat($(this).data('value') || 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update the total field with formatted value
|
|
||||||
const formatter = new Intl.NumberFormat('id-ID', {
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: 'IDR',
|
currency: 'IDR',
|
||||||
minimumFractionDigits: 0
|
minimumFractionDigits: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#total').val(formatter.format(total));
|
$('#total').val(formatter.format(total));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Uncheck all checkboxes when the modal is closed
|
// Uncheck all checkboxes when the modal is closed
|
||||||
$('#approveModal').on('hidden.bs.modal', function () {
|
$('#finalApproveModal').on('hidden.bs.modal', function () {
|
||||||
$('.custom-control-input').prop('checked', false); // Uncheck all checkboxes
|
$('.custom-control-input').prop('checked', false); // Uncheck all checkboxes
|
||||||
$('#total').val('0'); // Reset total to 0
|
$('#total').val('0'); // Reset total to 0
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -111,7 +111,10 @@
|
|||||||
<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'))
|
||||||
<th>Approval</th>
|
<th>Approval 1</th>
|
||||||
|
@endif
|
||||||
|
@if (auth()->user()->can('approval2.approve'))
|
||||||
|
<th>Approval 2</th>
|
||||||
@endif
|
@endif
|
||||||
@if (auth()->user()->can('final_approval.approve'))
|
@if (auth()->user()->can('final_approval.approve'))
|
||||||
<th>Final Approval</th>
|
<th>Final Approval</th>
|
||||||
@@ -150,7 +153,7 @@
|
|||||||
<td>
|
<td>
|
||||||
@if ($item->status == 'On Progress')
|
@if ($item->status == 'On Progress')
|
||||||
<span class="badge badge-warning text-white">{{ $item->status }}</span>
|
<span class="badge badge-warning text-white">{{ $item->status }}</span>
|
||||||
@elseif ($item->status == 'Approved' || $item->status == 'Final Approved')
|
@elseif ($item->status == 'Approved 1' || $item->status == 'Approved 2' || $item->status == 'Final Approved')
|
||||||
<span class="badge badge-success text-white">{{ $item->status }}</span>
|
<span class="badge badge-success text-white">{{ $item->status }}</span>
|
||||||
@else
|
@else
|
||||||
<span class="badge badge-danger text-white">{{ $item->status }}</span>
|
<span class="badge badge-danger text-white">{{ $item->status }}</span>
|
||||||
@@ -159,16 +162,16 @@
|
|||||||
@if (auth()->user()->can('approval.approve'))
|
@if (auth()->user()->can('approval.approve'))
|
||||||
<td>
|
<td>
|
||||||
{{-- approve / reject button --}}
|
{{-- approve / reject button --}}
|
||||||
@if ($item->status == 'On Progress')
|
@if ($item->status == 'On Progress' || $item->status == 'Rejected')
|
||||||
<form action="javascript:void(0);" class="d-inline">
|
<form action="javascript:void(0);" class="d-inline">
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="btn btn-success btn-sm open-approve-modal"
|
class="btn btn-success btn-sm open-approve-modal"
|
||||||
data-id="{{ route('forms.vehicle.approve', $item->id) }}">
|
data-id="{{ route('forms.vehicle.approve', $item->id) }}">
|
||||||
Approve
|
Approve 1
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form action="{{ route('forms.vehicle.reject', $item->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to reject this item?');">
|
<form action="{{ route('forms.vehicle.reject', $item->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to reject this item?');">
|
||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
<button type="submit" class="btn btn-danger btn-sm">
|
<button type="submit" class="btn btn-danger btn-sm">
|
||||||
@@ -186,14 +189,44 @@
|
|||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
@endif
|
@endif
|
||||||
|
@if (auth()->user()->can('approval2.approve'))
|
||||||
|
<td>
|
||||||
|
{{-- approve / reject button --}}
|
||||||
|
@if ($item->status == 'Approved 1' && $item->approved_at)
|
||||||
|
<form action="javascript:void(0);" class="d-inline">
|
||||||
|
<button type="button"
|
||||||
|
class="btn btn-success btn-sm open-approve-modal"
|
||||||
|
data-id="{{ route('forms.vehicle.approve2', $item->id) }}">
|
||||||
|
Approve 2
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form action="{{ route('forms.vehicle.reject', $item->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to reject this item?');">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
<button type="submit" class="btn btn-danger btn-sm">
|
||||||
|
Reject
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
@else
|
||||||
|
@if ($item->approved2_at)
|
||||||
|
{{ \Carbon\Carbon::parse($item->approved_at)->locale('id')->isoFormat('D MMMM Y') }}
|
||||||
|
@elseif($item->rejected_at)
|
||||||
|
{{ \Carbon\Carbon::parse($item->rejected_at)->locale('id')->isoFormat('D MMMM Y') }}
|
||||||
|
@else
|
||||||
|
-
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
@endif
|
||||||
@if(auth()->user()->can('final_approval.approve'))
|
@if(auth()->user()->can('final_approval.approve'))
|
||||||
<td>
|
<td>
|
||||||
{{-- approve / reject button --}}
|
{{-- approve / reject button --}}
|
||||||
@if ($item->status == 'Approved' && $item->approved_at && !$item->final_approved_at)
|
@if ($item->status == 'Approved 2' && $item->approved2_at && !$item->final_approved_at)
|
||||||
<form action="{{ route('forms.vehicle.final-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 final-approve-modal"
|
||||||
<button type="submit" class="btn btn-success btn-sm">
|
data-id="{{ route('forms.vehicle.final-approve', $item->id) }}">
|
||||||
Final Approve
|
Final Approve
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -297,10 +330,75 @@
|
|||||||
<strong>Tipe Bensin:</strong> <span id="tipe_bensin"></span>
|
<strong>Tipe Bensin:</strong> <span id="tipe_bensin"></span>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Keterangan:</strong> <span id="keterangan"></span>
|
<strong>Bukti Total:</strong> <span id="bukti_total"></span>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong>Bukti Total Harga Bensin:</strong> <span id="bukti_total"></span>
|
<strong>Nominal Total:</strong> <span id="total_value"></span>
|
||||||
|
</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>
|
||||||
|
<section>
|
||||||
|
<div class="modal fade" id="finalApproveModal" tabindex="-1" role="dialog" aria-labelledby="finalApproveModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form id="finalApproveForm" 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="finalLoadingSpinner" 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="finalModalContent" 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="final_expense_number"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>User:</strong> <span id="final_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="final_tanggal"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Jarak:</strong> <span id="final_jarak"></span> km
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Total Liter Bensin:</strong> <span id="final_liter"></span> liter
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>No Polisi:</strong> <span id="final_nopol"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Tipe Bensin:</strong> <span id="final_tipe_bensin"></span>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong>Bukti Total:</strong> <span id="final_bukti_total"></span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p class="mt-2">Please select the items you want to approve:</p>
|
<p class="mt-2">Please select the items you want to approve:</p>
|
||||||
@@ -308,17 +406,11 @@
|
|||||||
<li>
|
<li>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="custom-control custom-checkbox">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox" class="custom-control-input" id="total_bensin" name="total_bensin">
|
<input type="checkbox" class="custom-control-input" id="final_total" name="total" required>
|
||||||
<label class="custom-control-label" for="total_bensin">Total Harga Bensin (<span id="total_bensin_value"></span>)</label>
|
<label class="custom-control-label" for="final_total">Total (<span id="final_total_value"></span>)</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</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>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -384,34 +476,31 @@
|
|||||||
$('#loadingSpinner').addClass('d-flex');
|
$('#loadingSpinner').addClass('d-flex');
|
||||||
$('#approveModal').modal('show'); // Show the modal
|
$('#approveModal').modal('show'); // Show the modal
|
||||||
|
|
||||||
// Get detail from /forms/up-country/detail/{id}
|
// Get detail from /forms/vehicle/detail/{id}
|
||||||
$.get(approveUrl.replace('approve', 'detail'), function (data) {
|
$.get(approveUrl.replace(/approve(2)?/, 'detail'), function (data) {
|
||||||
const formatter = new Intl.NumberFormat('id-ID', {
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: 'IDR',
|
currency: 'IDR',
|
||||||
minimumFractionDigits: 0
|
minimumFractionDigits: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#total_bensin_value').text(formatter.format(data.total));
|
$('#total_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
|
// Detail data
|
||||||
$('#user').text(data.user.name);
|
$('#user').text(data.user.name);
|
||||||
$('#expense_number').text(data.expense_number);
|
$('#expense_number').text(data.expense_number);
|
||||||
$('#tanggal').text(new Date(data.tanggal).toLocaleDateString('id-ID', {
|
$('#tanggal').text(new Date(data.created_at).toLocaleDateString('id-ID', {
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
month: 'long',
|
month: 'long',
|
||||||
day: 'numeric',
|
day: 'numeric'
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
$('#jarak').text(data.jarak);
|
||||||
|
$('#liter').text(data.liter);
|
||||||
|
$('#tipe_bensin').text(data.tipe_bensin);
|
||||||
|
$('#nopol').text(data.nopol);
|
||||||
|
|
||||||
$('#bukti_total').html(data.bukti_total ? '<a href="' + data.bukti_total + '" target="_blank">Download</a>' : '-');
|
$('#bukti_total').html(data.total ? '<a href="' + data.total + '" target="_blank">Download</a>' : '-');
|
||||||
|
|
||||||
// Hide spinner and show content
|
// Hide spinner and show content
|
||||||
$('#loadingSpinner').hide();
|
$('#loadingSpinner').hide();
|
||||||
@@ -424,27 +513,78 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Handle Approve Button Click
|
||||||
|
$('.final-approve-modal').on('click', function () {
|
||||||
|
const approveUrl = $(this).data('id');
|
||||||
|
|
||||||
|
// Show spinner and hide content initially
|
||||||
|
$('#finalLoadingSpinner').show();
|
||||||
|
$('#finalModalContent').addClass('d-none');
|
||||||
|
|
||||||
|
$('#finalApproveForm').attr('action', approveUrl); // Set the form action
|
||||||
|
$('#finalLoadingSpinner').addClass('d-flex');
|
||||||
|
$('#finalApproveModal').modal('show'); // Show the modal
|
||||||
|
|
||||||
|
// Get detail from /forms/vehicle/detail/{id}
|
||||||
|
$.get(approveUrl.replace('final-approve', 'detail'), function (data) {
|
||||||
|
console.log(data);
|
||||||
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'IDR',
|
||||||
|
minimumFractionDigits: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#final_total_value').text(formatter.format(data.total));
|
||||||
|
|
||||||
|
// Assign data values to checkboxes
|
||||||
|
$('#final_total').data('value', data.total);
|
||||||
|
|
||||||
|
// Detail data
|
||||||
|
$('#final_user').text(data.user.name);
|
||||||
|
$('#final_expense_number').text(data.expense_number);
|
||||||
|
$('#final_tanggal').text(new Date(data.created_at).toLocaleDateString('id-ID', {
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'long',
|
||||||
|
day: 'numeric'
|
||||||
|
}));
|
||||||
|
|
||||||
|
$('#final_jarak').text(data.jarak);
|
||||||
|
$('#final_liter').text(data.liter);
|
||||||
|
$('#final_tipe_bensin').text(data.tipe_bensin);
|
||||||
|
$('#final_nopol').text(data.nopol);
|
||||||
|
|
||||||
|
$('#final_bukti_total').html(data.bukti_total ? '<a href="' + data.bukti_total + '" target="_blank">Download</a>' : '-');
|
||||||
|
|
||||||
|
// Hide spinner and show content
|
||||||
|
$('#finalLoadingSpinner').hide();
|
||||||
|
$('#finalLoadingSpinner').removeClass('d-flex');
|
||||||
|
$('#finalLoadingSpinner').addClass('d-none');
|
||||||
|
$('#finalModalContent').removeClass('d-none');
|
||||||
|
|
||||||
|
// Reset the total to zero
|
||||||
|
$('#total').val(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Update total dynamically
|
// Update total dynamically
|
||||||
$('.custom-control-input').on('change', function () {
|
$('.custom-control-input').on('change', function () {
|
||||||
let total = 0;
|
let total = 0;
|
||||||
|
|
||||||
// Calculate the total based on checked checkboxes
|
|
||||||
$('.custom-control-input:checked').each(function () {
|
$('.custom-control-input:checked').each(function () {
|
||||||
total += parseFloat($(this).data('value') || 0);
|
total += parseFloat($(this).data('value') || 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update the total field with formatted value
|
|
||||||
const formatter = new Intl.NumberFormat('id-ID', {
|
const formatter = new Intl.NumberFormat('id-ID', {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: 'IDR',
|
currency: 'IDR',
|
||||||
minimumFractionDigits: 0
|
minimumFractionDigits: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#total').val(formatter.format(total));
|
$('#total').val(formatter.format(total));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Uncheck all checkboxes when the modal is closed
|
// Uncheck all checkboxes when the modal is closed
|
||||||
$('#approveModal').on('hidden.bs.modal', function () {
|
$('#finalApproveModal').on('hidden.bs.modal', function () {
|
||||||
$('.custom-control-input').prop('checked', false); // Uncheck all checkboxes
|
$('.custom-control-input').prop('checked', false); // Uncheck all checkboxes
|
||||||
$('#total').val('0'); // Reset total to 0
|
$('#total').val('0'); // Reset total to 0
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<title>Expense Approved</title>
|
<title>Expense First Approval</title>
|
||||||
<style media="all" type="text/css">
|
<style media="all" type="text/css">
|
||||||
/* -------------------------------------
|
/* -------------------------------------
|
||||||
GLOBAL RESETS
|
GLOBAL RESETS
|
||||||
@@ -308,7 +308,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="wrapper">
|
<td class="wrapper">
|
||||||
<p>Halo {{ $name }},</p>
|
<p>Halo {{ $name }},</p>
|
||||||
<p>Kami ingin memberitahukan bahwa pengajuan pengeluaran dengan detail sebagai berikut telah disetujui:</p>
|
<p>Pengajuan Expense anda telah di periksa & setujui oleh <b>Admin Region</b> Anda:</p>
|
||||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -0,0 +1,361 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<title>Expense Second Approval</title>
|
||||||
|
<style media="all" type="text/css">
|
||||||
|
/* -------------------------------------
|
||||||
|
GLOBAL RESETS
|
||||||
|
------------------------------------- */
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: Helvetica, sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 1.3;
|
||||||
|
-ms-text-size-adjust: 100%;
|
||||||
|
-webkit-text-size-adjust: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
border-collapse: separate;
|
||||||
|
mso-table-lspace: 0pt;
|
||||||
|
mso-table-rspace: 0pt;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
table td {
|
||||||
|
font-family: Helvetica, sans-serif;
|
||||||
|
font-size: 16px;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
/* -------------------------------------
|
||||||
|
BODY & CONTAINER
|
||||||
|
------------------------------------- */
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #f4f5f6;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body {
|
||||||
|
background-color: #f4f5f6;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
margin: 0 auto !important;
|
||||||
|
max-width: 600px;
|
||||||
|
padding: 0;
|
||||||
|
padding-top: 24px;
|
||||||
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: block;
|
||||||
|
margin: 0 auto;
|
||||||
|
max-width: 600px;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
/* -------------------------------------
|
||||||
|
HEADER, FOOTER, MAIN
|
||||||
|
------------------------------------- */
|
||||||
|
|
||||||
|
.main {
|
||||||
|
background: #ffffff;
|
||||||
|
border: 1px solid #eaebed;
|
||||||
|
border-radius: 16px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
clear: both;
|
||||||
|
padding-top: 24px;
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer td,
|
||||||
|
.footer p,
|
||||||
|
.footer span,
|
||||||
|
.footer a {
|
||||||
|
color: #9a9ea6;
|
||||||
|
font-size: 16px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
/* -------------------------------------
|
||||||
|
TYPOGRAPHY
|
||||||
|
------------------------------------- */
|
||||||
|
|
||||||
|
p {
|
||||||
|
font-family: Helvetica, sans-serif;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: normal;
|
||||||
|
margin: 0;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #0867ec;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
/* -------------------------------------
|
||||||
|
BUTTONS
|
||||||
|
------------------------------------- */
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
box-sizing: border-box;
|
||||||
|
min-width: 100% !important;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn > tbody > tr > td {
|
||||||
|
padding-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn table {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn table td {
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 4px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn a {
|
||||||
|
background-color: #ffffff;
|
||||||
|
border: solid 2px #0867ec;
|
||||||
|
border-radius: 4px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: #0867ec;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: 0;
|
||||||
|
padding: 12px 24px;
|
||||||
|
text-decoration: none;
|
||||||
|
text-transform: capitalize;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary table td {
|
||||||
|
background-color: #0867ec;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary a {
|
||||||
|
background-color: #0867ec;
|
||||||
|
border-color: #0867ec;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media all {
|
||||||
|
.btn-primary table td:hover {
|
||||||
|
background-color: #ec0867 !important;
|
||||||
|
}
|
||||||
|
.btn-primary a:hover {
|
||||||
|
background-color: #ec0867 !important;
|
||||||
|
border-color: #ec0867 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------
|
||||||
|
OTHER STYLES THAT MIGHT BE USEFUL
|
||||||
|
------------------------------------- */
|
||||||
|
|
||||||
|
.last {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.first {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.align-center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.align-right {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.align-left {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-link {
|
||||||
|
color: #0867ec !important;
|
||||||
|
text-decoration: underline !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clear {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mt0 {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mb0 {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preheader {
|
||||||
|
color: transparent;
|
||||||
|
display: none;
|
||||||
|
height: 0;
|
||||||
|
max-height: 0;
|
||||||
|
max-width: 0;
|
||||||
|
opacity: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
mso-hide: all;
|
||||||
|
visibility: hidden;
|
||||||
|
width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.powered-by a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------
|
||||||
|
RESPONSIVE AND MOBILE FRIENDLY STYLES
|
||||||
|
------------------------------------- */
|
||||||
|
|
||||||
|
@media only screen and (max-width: 640px) {
|
||||||
|
.main p,
|
||||||
|
.main td,
|
||||||
|
.main span {
|
||||||
|
font-size: 16px !important;
|
||||||
|
}
|
||||||
|
.wrapper {
|
||||||
|
padding: 8px !important;
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
padding: 0 !important;
|
||||||
|
padding-top: 8px !important;
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
.main {
|
||||||
|
border-left-width: 0 !important;
|
||||||
|
border-radius: 0 !important;
|
||||||
|
border-right-width: 0 !important;
|
||||||
|
}
|
||||||
|
.btn table {
|
||||||
|
max-width: 100% !important;
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
.btn a {
|
||||||
|
font-size: 16px !important;
|
||||||
|
max-width: 100% !important;
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* -------------------------------------
|
||||||
|
PRESERVE THESE STYLES IN THE HEAD
|
||||||
|
------------------------------------- */
|
||||||
|
|
||||||
|
@media all {
|
||||||
|
.ExternalClass {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.ExternalClass,
|
||||||
|
.ExternalClass p,
|
||||||
|
.ExternalClass span,
|
||||||
|
.ExternalClass font,
|
||||||
|
.ExternalClass td,
|
||||||
|
.ExternalClass div {
|
||||||
|
line-height: 100%;
|
||||||
|
}
|
||||||
|
.apple-link a {
|
||||||
|
color: inherit !important;
|
||||||
|
font-family: inherit !important;
|
||||||
|
font-size: inherit !important;
|
||||||
|
font-weight: inherit !important;
|
||||||
|
line-height: inherit !important;
|
||||||
|
text-decoration: none !important;
|
||||||
|
}
|
||||||
|
#MessageViewBody a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: inherit;
|
||||||
|
font-family: inherit;
|
||||||
|
font-weight: inherit;
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="body">
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<td class="container">
|
||||||
|
<div class="content">
|
||||||
|
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="main">
|
||||||
|
<!-- START MAIN CONTENT AREA -->
|
||||||
|
<tr>
|
||||||
|
<td class="wrapper">
|
||||||
|
<p>Halo {{ $name }},</p>
|
||||||
|
<p>Pengajuan Expense anda telah di periksa & setujui oleh <b>Area Manager Anda</b> Anda:</p>
|
||||||
|
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td align="left">
|
||||||
|
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<strong>Expense Number:</strong> {{ $expense_number }}<br>
|
||||||
|
<strong>Expense Date:</strong> {{ \Carbon\Carbon::parse($tanggal)->locale('id')->isoFormat('D MMMM Y') }}<br>
|
||||||
|
<strong>Total:</strong> Rp {{ number_format($total, 0, ',', '.') }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p style="margin-top: 20px;">Silahkan buka link berikut untuk melihat detail expense anda: <a href="{{ $url }}">{{ $url }}</a></p>
|
||||||
|
<p>Terima kasih.</p>
|
||||||
|
</td>
|
||||||
|
<!-- END MAIN CONTENT AREA -->
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<!-- START FOOTER -->
|
||||||
|
<div class="footer">
|
||||||
|
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="content-block">
|
||||||
|
<span class="apple-link">© PT TUNGGAL IDAMAN ABDI.</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="content-block powered-by" style="margin-bottom: 20px;">
|
||||||
|
Jl. Jend. Ahmad Yani No 7, Jakarta 13230, Indonesia.
|
||||||
|
</td>
|
||||||
|
<br>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- END FOOTER -->
|
||||||
|
|
||||||
|
<!-- END CENTERED WHITE CONTAINER --></div>
|
||||||
|
</td>
|
||||||
|
<td> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<title>Expense Closed</title>
|
<title>Expense Final Approval</title>
|
||||||
<style media="all" type="text/css">
|
<style media="all" type="text/css">
|
||||||
/* -------------------------------------
|
/* -------------------------------------
|
||||||
GLOBAL RESETS
|
GLOBAL RESETS
|
||||||
@@ -308,7 +308,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="wrapper">
|
<td class="wrapper">
|
||||||
<p>Halo {{ $name }},</p>
|
<p>Halo {{ $name }},</p>
|
||||||
<p>Kami ingin memberitahukan bahwa pengajuan pengeluaran dengan detail sebagai berikut telah ditutup karena telah selesai:</p>
|
<p>Kami ingin memberitahukan bahwa pengajuan pengeluaran dengan detail sebagai berikut telah di setujui <b>( FINAL APPROVE )</b> oleh <b>MOM Region / HOSM</b> anda:</p>
|
||||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ Route::middleware(['auth:admin', 'menu'])->group(function () {
|
|||||||
Route::put('/up-country/update/{id}', [FormUpCountryController::class, 'update'])->name('forms.up-country.update');
|
Route::put('/up-country/update/{id}', [FormUpCountryController::class, 'update'])->name('forms.up-country.update');
|
||||||
Route::delete('/up-country/destroy/{id}', [FormUpCountryController::class, 'destroy'])->name('forms.up-country.destroy');
|
Route::delete('/up-country/destroy/{id}', [FormUpCountryController::class, 'destroy'])->name('forms.up-country.destroy');
|
||||||
Route::put('/up-country/approve/{id}', [FormUpCountryController::class, 'approve'])->name('forms.up-country.approve');
|
Route::put('/up-country/approve/{id}', [FormUpCountryController::class, 'approve'])->name('forms.up-country.approve');
|
||||||
|
Route::put('/up-country/approve2/{id}', [FormUpCountryController::class, 'approve2'])->name('forms.up-country.approve2');
|
||||||
Route::put('/up-country/reject/{id}', [FormUpCountryController::class, 'reject'])->name('forms.up-country.reject');
|
Route::put('/up-country/reject/{id}', [FormUpCountryController::class, 'reject'])->name('forms.up-country.reject');
|
||||||
Route::put('/up-country/final-approve/{id}', [FormUpCountryController::class, 'finalApprove'])->name('forms.up-country.final-approve');
|
Route::put('/up-country/final-approve/{id}', [FormUpCountryController::class, 'finalApprove'])->name('forms.up-country.final-approve');
|
||||||
Route::put('/up-country/open/{id}', [FormUpCountryController::class, 'open'])->name('forms.up-country.open');
|
Route::put('/up-country/open/{id}', [FormUpCountryController::class, 'open'])->name('forms.up-country.open');
|
||||||
@@ -141,6 +142,7 @@ Route::middleware(['auth:admin', 'menu'])->group(function () {
|
|||||||
Route::put('/vehicle-running-cost/update/{id}', [FormVehicleController::class, 'update'])->name('forms.vehicle.update');
|
Route::put('/vehicle-running-cost/update/{id}', [FormVehicleController::class, 'update'])->name('forms.vehicle.update');
|
||||||
Route::delete('/vehicle-running-cost/destroy/{id}', [FormVehicleController::class, 'destroy'])->name('forms.vehicle.destroy');
|
Route::delete('/vehicle-running-cost/destroy/{id}', [FormVehicleController::class, 'destroy'])->name('forms.vehicle.destroy');
|
||||||
Route::put('/vehicle-running-cost/approve/{id}', [FormVehicleController::class, 'approve'])->name('forms.vehicle.approve');
|
Route::put('/vehicle-running-cost/approve/{id}', [FormVehicleController::class, 'approve'])->name('forms.vehicle.approve');
|
||||||
|
Route::put('/vehicle-running-cost/approve2/{id}', [FormVehicleController::class, 'approve2'])->name('forms.vehicle.approve2');
|
||||||
Route::put('/vehicle-running-cost/reject/{id}', [FormVehicleController::class, 'reject'])->name('forms.vehicle.reject');
|
Route::put('/vehicle-running-cost/reject/{id}', [FormVehicleController::class, 'reject'])->name('forms.vehicle.reject');
|
||||||
Route::put('/vehicle-running-cost/final-approve/{id}', [FormVehicleController::class, 'finalApprove'])->name('forms.vehicle.final-approve');
|
Route::put('/vehicle-running-cost/final-approve/{id}', [FormVehicleController::class, 'finalApprove'])->name('forms.vehicle.final-approve');
|
||||||
Route::put('/vehicle-running-cost/open/{id}', [FormVehicleController::class, 'open'])->name('forms.vehicle.open');
|
Route::put('/vehicle-running-cost/open/{id}', [FormVehicleController::class, 'open'])->name('forms.vehicle.open');
|
||||||
@@ -155,6 +157,7 @@ Route::middleware(['auth:admin', 'menu'])->group(function () {
|
|||||||
Route::put('/entertainment-presentation/update/{id}', [FormEntertainmentPresentationController::class, 'update'])->name('forms.entertainment.update');
|
Route::put('/entertainment-presentation/update/{id}', [FormEntertainmentPresentationController::class, 'update'])->name('forms.entertainment.update');
|
||||||
Route::delete('/entertainment-presentation/destroy/{id}', [FormEntertainmentPresentationController::class, 'destroy'])->name('forms.entertainment.destroy');
|
Route::delete('/entertainment-presentation/destroy/{id}', [FormEntertainmentPresentationController::class, 'destroy'])->name('forms.entertainment.destroy');
|
||||||
Route::put('/entertainment-presentation/approve/{id}', [FormEntertainmentPresentationController::class, 'approve'])->name('forms.entertainment.approve');
|
Route::put('/entertainment-presentation/approve/{id}', [FormEntertainmentPresentationController::class, 'approve'])->name('forms.entertainment.approve');
|
||||||
|
Route::put('/entertainment-presentation/approve2/{id}', [FormEntertainmentPresentationController::class, 'approve2'])->name('forms.entertainment.approve2');
|
||||||
Route::put('/entertainment-presentation/reject/{id}', [FormEntertainmentPresentationController::class, 'reject'])->name('forms.entertainment.reject');
|
Route::put('/entertainment-presentation/reject/{id}', [FormEntertainmentPresentationController::class, 'reject'])->name('forms.entertainment.reject');
|
||||||
Route::put('/entertainment-presentation/final-approve/{id}', [FormEntertainmentPresentationController::class, 'finalApprove'])->name('forms.entertainment.final-approve');
|
Route::put('/entertainment-presentation/final-approve/{id}', [FormEntertainmentPresentationController::class, 'finalApprove'])->name('forms.entertainment.final-approve');
|
||||||
Route::put('/entertainment-presentation/open/{id}', [FormEntertainmentPresentationController::class, 'open'])->name('forms.entertainment.open');
|
Route::put('/entertainment-presentation/open/{id}', [FormEntertainmentPresentationController::class, 'open'])->name('forms.entertainment.open');
|
||||||
@@ -169,6 +172,7 @@ Route::middleware(['auth:admin', 'menu'])->group(function () {
|
|||||||
Route::put('/meeting-seminar/update/{id}', [FormMeetingSeminarController::class, 'update'])->name('forms.meeting.update');
|
Route::put('/meeting-seminar/update/{id}', [FormMeetingSeminarController::class, 'update'])->name('forms.meeting.update');
|
||||||
Route::delete('/meeting-seminar/destroy/{id}', [FormMeetingSeminarController::class, 'destroy'])->name('forms.meeting.destroy');
|
Route::delete('/meeting-seminar/destroy/{id}', [FormMeetingSeminarController::class, 'destroy'])->name('forms.meeting.destroy');
|
||||||
Route::put('/meeting-seminar/approve/{id}', [FormMeetingSeminarController::class, 'approve'])->name('forms.meeting.approve');
|
Route::put('/meeting-seminar/approve/{id}', [FormMeetingSeminarController::class, 'approve'])->name('forms.meeting.approve');
|
||||||
|
Route::put('/meeting-seminar/approve2/{id}', [FormMeetingSeminarController::class, 'approve2'])->name('forms.meeting.approve2');
|
||||||
Route::put('/meeting-seminar/reject/{id}', [FormMeetingSeminarController::class, 'reject'])->name('forms.meeting.reject');
|
Route::put('/meeting-seminar/reject/{id}', [FormMeetingSeminarController::class, 'reject'])->name('forms.meeting.reject');
|
||||||
Route::put('/meeting-seminar/final-approve/{id}', [FormMeetingSeminarController::class, 'finalApprove'])->name('forms.meeting.final-approve');
|
Route::put('/meeting-seminar/final-approve/{id}', [FormMeetingSeminarController::class, 'finalApprove'])->name('forms.meeting.final-approve');
|
||||||
Route::put('/meeting-seminar/open/{id}', [FormMeetingSeminarController::class, 'open'])->name('forms.meeting.open');
|
Route::put('/meeting-seminar/open/{id}', [FormMeetingSeminarController::class, 'open'])->name('forms.meeting.open');
|
||||||
@@ -183,6 +187,7 @@ Route::middleware(['auth:admin', 'menu'])->group(function () {
|
|||||||
Route::put('/other/update/{id}', [FormOtherController::class, 'update'])->name('forms.other.update');
|
Route::put('/other/update/{id}', [FormOtherController::class, 'update'])->name('forms.other.update');
|
||||||
Route::delete('/other/destroy/{id}', [FormOtherController::class, 'destroy'])->name('forms.other.destroy');
|
Route::delete('/other/destroy/{id}', [FormOtherController::class, 'destroy'])->name('forms.other.destroy');
|
||||||
Route::put('/other/approve/{id}', [FormOtherController::class, 'approve'])->name('forms.other.approve');
|
Route::put('/other/approve/{id}', [FormOtherController::class, 'approve'])->name('forms.other.approve');
|
||||||
|
Route::put('/other/approve2/{id}', [FormOtherController::class, 'approve2'])->name('forms.other.approve2');
|
||||||
Route::put('/other/reject/{id}', [FormOtherController::class, 'reject'])->name('forms.other.reject');
|
Route::put('/other/reject/{id}', [FormOtherController::class, 'reject'])->name('forms.other.reject');
|
||||||
Route::put('/other/final-approve/{id}', [FormOtherController::class, 'finalApprove'])->name('forms.other.final-approve');
|
Route::put('/other/final-approve/{id}', [FormOtherController::class, 'finalApprove'])->name('forms.other.final-approve');
|
||||||
Route::put('/other/open/{id}', [FormOtherController::class, 'open'])->name('forms.other.open');
|
Route::put('/other/open/{id}', [FormOtherController::class, 'open'])->name('forms.other.open');
|
||||||
|
|||||||
Reference in New Issue
Block a user