update fixing by CODEX
This commit is contained in:
@@ -106,7 +106,7 @@ class WhatsappHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function rejectExpense($phones, $expense_number, $url = null, $tanggal, $total, $name)
|
public static function rejectExpense($phones, $expense_number, $url = null, $tanggal, $total, $name, ?string $remarks = null)
|
||||||
{
|
{
|
||||||
$client = new Client();
|
$client = new Client();
|
||||||
|
|
||||||
@@ -115,15 +115,28 @@ class WhatsappHelper
|
|||||||
$url = 'https://' . $url;
|
$url = 'https://' . $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format the message like the email example using Markdown for WhatsApp
|
$formattedDate = \Carbon\Carbon::parse($tanggal)->locale('id')->isoFormat('D MMMM Y');
|
||||||
$message = "
|
$formattedTotal = 'Rp ' . number_format($total, 0, ',', '.');
|
||||||
Halo *{$name}*,
|
|
||||||
Pengajuan pengeluaran baru dengan detail berikut telah ditolak:
|
$messageLines = [
|
||||||
*Expense Number:* {$expense_number}
|
"Halo *{$name}*,",
|
||||||
*Expense Date:* " . \Carbon\Carbon::parse($tanggal)->locale('id')->isoFormat('D MMMM Y') . "
|
'Pengajuan pengeluaran baru dengan detail berikut telah ditolak:',
|
||||||
*Total:* Rp " . number_format($total, 0, ',', '.') . "
|
"*Expense Number:* {$expense_number}",
|
||||||
Silahkan buka link berikut untuk melihat detail expense Anda: {$url}
|
"*Expense Date:* {$formattedDate}",
|
||||||
Terima kasih.";
|
"*Total:* {$formattedTotal}",
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!empty($remarks)) {
|
||||||
|
$messageLines[] = "*Remarks:* {$remarks}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($url)) {
|
||||||
|
$messageLines[] = "Silahkan buka link berikut untuk melihat detail expense Anda: {$url}";
|
||||||
|
}
|
||||||
|
|
||||||
|
$messageLines[] = 'Terima kasih.';
|
||||||
|
|
||||||
|
$message = implode("\n", $messageLines);
|
||||||
|
|
||||||
// Prepare the message for each phone number
|
// Prepare the message for each phone number
|
||||||
$data = [];
|
$data = [];
|
||||||
@@ -252,4 +265,4 @@ class WhatsappHelper
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -888,7 +888,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::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name, $request->remarks);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
$brevoService = app(BrevoService::class);
|
$brevoService = app(BrevoService::class);
|
||||||
@@ -899,7 +899,8 @@ class FormEntertainmentPresentationController extends Controller
|
|||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url,
|
||||||
|
$request->remarks
|
||||||
);
|
);
|
||||||
|
|
||||||
$response = $brevoService->expenseRejected($recipient, $name, $mail);
|
$response = $brevoService->expenseRejected($recipient, $name, $mail);
|
||||||
|
|||||||
@@ -883,7 +883,7 @@ class FormMeetingSeminarController extends Controller
|
|||||||
|
|
||||||
// send 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, $tanggal, $total, $name);
|
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name, $request->remarks);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
$brevoService = app(BrevoService::class);
|
$brevoService = app(BrevoService::class);
|
||||||
@@ -894,7 +894,8 @@ class FormMeetingSeminarController extends Controller
|
|||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url,
|
||||||
|
$request->remarks
|
||||||
);
|
);
|
||||||
|
|
||||||
$response = $brevoService->expenseRejected($recipient, $name, $mail);
|
$response = $brevoService->expenseRejected($recipient, $name, $mail);
|
||||||
|
|||||||
@@ -908,7 +908,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::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name, $request->remarks);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
$brevoService = app(BrevoService::class);
|
$brevoService = app(BrevoService::class);
|
||||||
@@ -919,7 +919,8 @@ class FormOtherController extends Controller
|
|||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url,
|
||||||
|
$request->remarks
|
||||||
);
|
);
|
||||||
|
|
||||||
$response = $brevoService->expenseRejected($recipient, $name, $mail);
|
$response = $brevoService->expenseRejected($recipient, $name, $mail);
|
||||||
|
|||||||
@@ -1023,7 +1023,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, $tanggal, $total, $name);
|
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name, $request->remarks);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
$brevoService = app(BrevoService::class);
|
$brevoService = app(BrevoService::class);
|
||||||
@@ -1034,7 +1034,8 @@ class FormUpCountryController extends Controller
|
|||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url,
|
||||||
|
$request->remarks
|
||||||
);
|
);
|
||||||
|
|
||||||
$response = $brevoService->expenseRejected($recipient, $name, $mail);
|
$response = $brevoService->expenseRejected($recipient, $name, $mail);
|
||||||
|
|||||||
@@ -913,7 +913,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::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name);
|
WhatsappHelper::rejectExpense($phoneNumbers, $expense_number, $url, $tanggal, $total, $name, $request->remarks);
|
||||||
|
|
||||||
// Send bulk email
|
// Send bulk email
|
||||||
$brevoService = app(BrevoService::class);
|
$brevoService = app(BrevoService::class);
|
||||||
@@ -924,7 +924,8 @@ class FormVehicleController extends Controller
|
|||||||
$expense_number,
|
$expense_number,
|
||||||
$tanggal,
|
$tanggal,
|
||||||
$total,
|
$total,
|
||||||
$url
|
$url,
|
||||||
|
$request->remarks
|
||||||
);
|
);
|
||||||
|
|
||||||
$response = $brevoService->expenseRejected($recipient, $name, $mail);
|
$response = $brevoService->expenseRejected($recipient, $name, $mail);
|
||||||
|
|||||||
@@ -18,17 +18,19 @@ class ExpenseRejected extends Mailable
|
|||||||
protected string $tanggal;
|
protected string $tanggal;
|
||||||
protected int $total;
|
protected int $total;
|
||||||
protected string $url;
|
protected string $url;
|
||||||
|
protected ?string $remarks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(string $name, string $expense_number, string $tanggal, int $total, string $url)
|
public function __construct(string $name, string $expense_number, string $tanggal, int $total, string $url, ?string $remarks = null)
|
||||||
{
|
{
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->expense_number = $expense_number;
|
$this->expense_number = $expense_number;
|
||||||
$this->tanggal = $tanggal;
|
$this->tanggal = $tanggal;
|
||||||
$this->total = $total;
|
$this->total = $total;
|
||||||
$this->url = $url;
|
$this->url = $url;
|
||||||
|
$this->remarks = $remarks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,6 +56,7 @@ class ExpenseRejected extends Mailable
|
|||||||
'tanggal' => $this->tanggal,
|
'tanggal' => $this->tanggal,
|
||||||
'total' => $this->total,
|
'total' => $this->total,
|
||||||
'url' => $this->url,
|
'url' => $this->url,
|
||||||
|
'remarks' => $this->remarks,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -79,6 +82,7 @@ class ExpenseRejected extends Mailable
|
|||||||
'tanggal' => $this->tanggal,
|
'tanggal' => $this->tanggal,
|
||||||
'total' => $this->total,
|
'total' => $this->total,
|
||||||
'url' => $this->url,
|
'url' => $this->url,
|
||||||
|
'remarks' => $this->remarks,
|
||||||
])->render();
|
])->render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,11 +72,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- Outstanding Expense -->
|
<!-- Outstanding Expense -->
|
||||||
<div class="col d-flex">
|
<div class="col d-flex">
|
||||||
<div class="small-box bg-danger flex-fill">
|
<div class="small-box bg-danger flex-fill" id="outstandingCard">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<h3>{{ $outstandingCount }}</h3>
|
<h3>{{ $outstandingCount }}</h3>
|
||||||
<p>Outstanding Expenses</p>
|
<p>Outstanding Expenses</p>
|
||||||
<p class="mb-0"><small>Total Rp {{ number_format($outstandingTotal, 0, ',', '.') }}</small></p>
|
<p class="mb-0"><small>Total Rp {{ number_format($outstandingTotal, 0, ',', '.') }}</small></p>
|
||||||
|
<p class="mb-0 filter-hint"><small>Klik untuk menampilkan detail</small></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
<i class="fas fa-exclamation-triangle"></i>
|
<i class="fas fa-exclamation-triangle"></i>
|
||||||
|
|||||||
@@ -139,21 +139,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="modal fade" id="newAttachmentPreviewModal" tabindex="-1" aria-hidden="true">
|
@include('backend.components.attachment-preview-modal', [
|
||||||
<div class="modal-dialog modal-lg modal-dialog-centered">
|
'modalId' => 'newAttachmentPreviewModal',
|
||||||
<div class="modal-content">
|
'title' => 'Pratinjau Lampiran',
|
||||||
<div class="modal-header">
|
])
|
||||||
<h5 class="modal-title">Pratinjau Lampiran - <span id="newAttachmentPreviewTitle" class="attachment-preview-modal-title"></span></h5>
|
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<img id="newAttachmentPreviewImage" class="img-fluid d-none" alt="Pratinjau lampiran">
|
|
||||||
<iframe id="newAttachmentPreviewPdf" class="w-100 d-none" style="min-height: 480px;" frameborder="0"></iframe>
|
|
||||||
<div id="newAttachmentPreviewPlaceholder" class="text-center text-muted">Tidak ada file untuk ditampilkan.</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="loading-spinner-overlay" class="d-none">
|
<div id="loading-spinner-overlay" class="d-none">
|
||||||
<div class="spinner-wrapper">
|
<div class="spinner-wrapper">
|
||||||
|
|||||||
@@ -319,7 +319,10 @@
|
|||||||
<td>
|
<td>
|
||||||
<strong>Expense Number:</strong> {{ $expense_number }}<br>
|
<strong>Expense Number:</strong> {{ $expense_number }}<br>
|
||||||
<strong>Expense Date:</strong> {{ \Carbon\Carbon::parse($tanggal)->locale('id')->isoFormat('D MMMM Y') }}<br>
|
<strong>Expense Date:</strong> {{ \Carbon\Carbon::parse($tanggal)->locale('id')->isoFormat('D MMMM Y') }}<br>
|
||||||
<strong>Total:</strong> Rp {{ number_format($total, 0, ',', '.') }}
|
<strong>Total:</strong> Rp {{ number_format($total, 0, ',', '.') }}<br>
|
||||||
|
@if(!empty($remarks))
|
||||||
|
<strong>Remarks:</strong> {{ $remarks }}
|
||||||
|
@endif
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -359,4 +362,4 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user