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();
|
||||
|
||||
@@ -115,15 +115,28 @@ class WhatsappHelper
|
||||
$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.";
|
||||
$formattedDate = \Carbon\Carbon::parse($tanggal)->locale('id')->isoFormat('D MMMM Y');
|
||||
$formattedTotal = 'Rp ' . number_format($total, 0, ',', '.');
|
||||
|
||||
$messageLines = [
|
||||
"Halo *{$name}*,",
|
||||
'Pengajuan pengeluaran baru dengan detail berikut telah ditolak:',
|
||||
"*Expense Number:* {$expense_number}",
|
||||
"*Expense Date:* {$formattedDate}",
|
||||
"*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
|
||||
$data = [];
|
||||
@@ -252,4 +265,4 @@ class WhatsappHelper
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user