WIP: SoftDelete Contract/Payment/Customer, collected_by, Notifications, ProjectReport, ExportDebtReport

This commit is contained in:
2026-04-29 04:46:58 +00:00
parent 0712046f4b
commit 78c22690eb
18 changed files with 1015 additions and 12 deletions

View 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,
];
}
}