WIP: SoftDelete Contract/Payment/Customer, collected_by, Notifications, ProjectReport, ExportDebtReport
This commit is contained in:
43
app/Notifications/PaymentDueNotification.php
Normal file
43
app/Notifications/PaymentDueNotification.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\PaymentScheduleItem;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class PaymentDueNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(
|
||||
public PaymentScheduleItem $scheduleItem
|
||||
) {}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
return ['database'];
|
||||
}
|
||||
|
||||
public function toDatabase(object $notifiable): array
|
||||
{
|
||||
$contract = $this->scheduleItem->schedule?->contract;
|
||||
$remaining = (float) $this->scheduleItem->remaining_amount;
|
||||
|
||||
return [
|
||||
'title' => 'Cảnh báo đợt thanh toán sắp đến hạn',
|
||||
'message' => sprintf(
|
||||
'HĐ %s - Đợt %d (%s) sẽ đến hạn vào %s. Còn thiếu: %s VNĐ.',
|
||||
$contract?->contract_number ?? 'N/A',
|
||||
$this->scheduleItem->installment_no,
|
||||
$this->scheduleItem->type?->getLabel() ?? 'N/A',
|
||||
$this->scheduleItem->due_date?->format('d/m/Y') ?? 'N/A',
|
||||
number_format($remaining)
|
||||
),
|
||||
'contract_id' => $contract?->id,
|
||||
'schedule_item_id' => $this->scheduleItem->id,
|
||||
'due_date' => $this->scheduleItem->due_date?->toDateString(),
|
||||
'remaining_amount' => $remaining,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user