feat: complete administration and reporting
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Domain\Administration\Services\NotificationTemplateService;
|
||||
use App\Domain\Reservations\Models\Reservation;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
@@ -27,28 +28,27 @@ class ReservationSubmittedNotification extends Notification implements ShouldQue
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
{
|
||||
$template = app(NotificationTemplateService::class)->render($this->event, $this->reservation);
|
||||
|
||||
return (new MailMessage)
|
||||
->subject($this->event === 'information_provided'
|
||||
? "Resposta recebida para {$this->reservation->reference}"
|
||||
: "Nova requisição {$this->reservation->reference}")
|
||||
->subject($template['subject'])
|
||||
->greeting($this->event === 'information_provided'
|
||||
? 'O requisitante respondeu ao pedido de esclarecimentos'
|
||||
: 'Nova requisição para aprovação')
|
||||
->line("{$this->reservation->requester->name} submeteu a requisição {$this->reservation->reference} para decisão.")
|
||||
->line("Período: {$this->reservation->starts_at->format('d/m/Y H:i')} — {$this->reservation->ends_at->format('d/m/Y H:i')}.")
|
||||
->line($template['message'])
|
||||
->action('Analisar requisição', url('/aprovacoes'));
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
public function toArray(object $notifiable): array
|
||||
{
|
||||
$template = app(NotificationTemplateService::class)->render($this->event, $this->reservation);
|
||||
|
||||
return [
|
||||
'reservation_uuid' => $this->reservation->uuid,
|
||||
'reference' => $this->reservation->reference,
|
||||
'event' => $this->event,
|
||||
'message' => $this->event === 'information_provided'
|
||||
? "Foram prestados esclarecimentos para {$this->reservation->reference}."
|
||||
: "Nova requisição {$this->reservation->reference} aguarda decisão.",
|
||||
'message' => $template['message'],
|
||||
'url' => '/aprovacoes',
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user