Integrate a complete workflow for commitment forms including secure template downloads, customer uploads via WordPress AJAX, and administrative verification with automated notifications. - Implement `downloadTemplate` and `downloadSigned` logic in `CommitmentFormController` to replace public symlinks with ownership-verified routes. - Add `CommitmentFormVerifiedNotification` and `CommitmentFormRejectedNotification` to alert customers of status changes. - Enhance WordPress bridge with AJAX-driven form listing, status badges, and upload capabilities. - Update Filament `CommitmentFormsRelationManager` to provide better visibility into form directions and descriptions while restricting status edits to specific actions. - Refactor Laravel 11 bootstrap configuration to handle guest redirection for API and web routes correctly. - Add administrative controllers for secure file access within the admin panel.
43 lines
1.4 KiB
PHP
43 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use App\Models\ShipmentCommitmentForm;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
/**
|
|
* اعلان به مشتری: تعهدنامهٔ آپلودشدهٔ شما رد شد — باید فایل جدید آپلود کنید.
|
|
* (Trigger: CommitmentFormsRelationManager::reject)
|
|
*/
|
|
class CommitmentFormRejectedNotification extends Notification
|
|
{
|
|
use Queueable;
|
|
|
|
public function __construct(
|
|
public ShipmentCommitmentForm $record,
|
|
) {}
|
|
|
|
public function via($notifiable): array
|
|
{
|
|
return ['database'];
|
|
}
|
|
|
|
public function toArray($notifiable): array
|
|
{
|
|
$this->record->loadMissing(['shipment', 'form']);
|
|
|
|
$awb = $this->record->shipment->awb_no;
|
|
$title = $this->record->form?->title ?? ('فرم #' . $this->record->commitment_form_id);
|
|
$reason = $this->record->notes ? " دلیل: {$this->record->notes}" : '';
|
|
|
|
return [
|
|
'type' => 'commitment_rejected',
|
|
'shipment_id' => $this->record->shipment_id,
|
|
'awb_no' => $awb,
|
|
'message' => "تعهدنامه «{$title}» سفارش {$awb} رد شد. لطفاً فایل اصلاحشده را دوباره آپلود کنید.{$reason}",
|
|
'action_url' => '/order-detail/?order_id=' . $this->record->shipment_id,
|
|
];
|
|
}
|
|
}
|