feat: Initialize core application structure including authentication, role-based dashboards, service task management, and integration workflows.
This commit is contained in:
40
app/Notifications/IntegrationCompletedWithAttachment.php
Normal file
40
app/Notifications/IntegrationCompletedWithAttachment.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\IntegrationRequest;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class IntegrationCompletedWithAttachment extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(
|
||||
public IntegrationRequest $integrationRequest,
|
||||
public string $base64PdfContent
|
||||
) {}
|
||||
|
||||
public function via($notifiable): array
|
||||
{
|
||||
return ['mail'];
|
||||
}
|
||||
|
||||
public function toMail($notifiable): MailMessage
|
||||
{
|
||||
$agentName = $this->integrationRequest->agent->first_name . ' ' . $this->integrationRequest->agent->last_name;
|
||||
$filename = "Fiche_Agent_{$this->integrationRequest->agent->last_name}_{$this->integrationRequest->agent->first_name}.pdf";
|
||||
|
||||
$pdfContent = base64_decode($this->base64PdfContent);
|
||||
|
||||
return (new MailMessage)
|
||||
->subject("Intégration terminée - {$agentName}")
|
||||
->line("L'intégration de l'agent {$agentName} est désormais terminée.")
|
||||
->line("Veuillez trouver la fiche agent récapitulative en pièce jointe.")
|
||||
->attachData($pdfContent, $filename, [
|
||||
'mime' => 'application/pdf',
|
||||
]);
|
||||
}
|
||||
}
|
||||
48
app/Notifications/NewIntegrationRequestNotification.php
Normal file
48
app/Notifications/NewIntegrationRequestNotification.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\IntegrationRequest;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class NewIntegrationRequestNotification extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(public IntegrationRequest $integrationRequest)
|
||||
{
|
||||
}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
return ['database', 'mail'];
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
{
|
||||
$agentName = $this->integrationRequest->agent->first_name . ' ' . $this->integrationRequest->agent->last_name;
|
||||
$type = $this->integrationRequest->type === 'onboarding' ? 'Arrivée' : 'Départ';
|
||||
$createdBy = $this->integrationRequest->agent->creator->name ?? 'Un prescripteur';
|
||||
|
||||
return (new MailMessage)
|
||||
->subject("Nouvelle fiche agent : {$agentName}")
|
||||
->greeting("Bonjour {$notifiable->name},")
|
||||
->line("Une nouvelle fiche agent de type **{$type}** a été initiée par **{$createdBy}**.")
|
||||
->line("Agent concerné : **{$agentName}**")
|
||||
->line("Cette demande est en attente de validation RH.")
|
||||
->action('Voir la demande', route('integrations.show', $this->integrationRequest))
|
||||
->line('Merci de traiter cette demande.');
|
||||
}
|
||||
|
||||
public function toArray(object $notifiable): array
|
||||
{
|
||||
return [
|
||||
'integration_request_id' => $this->integrationRequest->id,
|
||||
'message' => "Nouvelle fiche agent pour {$this->integrationRequest->agent->first_name}",
|
||||
'type' => 'new_request',
|
||||
];
|
||||
}
|
||||
}
|
||||
40
app/Notifications/ProcessCompletedNotification.php
Normal file
40
app/Notifications/ProcessCompletedNotification.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\IntegrationRequest;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class ProcessCompletedNotification extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(public IntegrationRequest $integration)
|
||||
{
|
||||
}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
return ['database']; // Keeping it simple for now, can add 'mail'
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
{
|
||||
return (new MailMessage)
|
||||
->line('L\'intégration de ' . $this->integration->agent->first_name . ' ' . $this->integration->agent->last_name . ' est terminée.')
|
||||
->action('Voir la demande', route('integrations.show', $this->integration));
|
||||
}
|
||||
|
||||
public function toArray(object $notifiable): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Processus terminé',
|
||||
'message' => 'L\'intégration de ' . $this->integration->agent->first_name . ' ' . $this->integration->agent->last_name . ' est complète.',
|
||||
'integration_id' => $this->integration->id,
|
||||
'type' => 'process_completed',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\ServiceTask;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class ServiceTaskReadyForValidationNotification extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(public ServiceTask $serviceTask)
|
||||
{
|
||||
}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
return ['database', 'mail'];
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
{
|
||||
$serviceName = $this->serviceTask->service->name;
|
||||
$agentName = $this->serviceTask->integrationRequest->agent->first_name . ' ' . $this->serviceTask->integrationRequest->agent->last_name;
|
||||
|
||||
return (new MailMessage)
|
||||
->subject("Validation requise : {$serviceName} - {$agentName}")
|
||||
->greeting("Bonjour {$notifiable->name},")
|
||||
->line("Toutes les tâches obligatoires pour le service **{$serviceName}** concernant l'agent **{$agentName}** ont été effectuées.")
|
||||
->line("Merci de vérifier et de valider la tâche.")
|
||||
->action('Valider la tâche', route('integrations.show', $this->serviceTask->integrationRequest));
|
||||
}
|
||||
|
||||
public function toArray(object $notifiable): array
|
||||
{
|
||||
return [
|
||||
'service_task_id' => $this->serviceTask->id,
|
||||
'integration_request_id' => $this->serviceTask->integration_request_id,
|
||||
'message' => "Tâche prête pour validation.",
|
||||
'type' => 'task_ready_validation',
|
||||
];
|
||||
}
|
||||
}
|
||||
51
app/Notifications/ServiceTaskRejectedNotification.php
Normal file
51
app/Notifications/ServiceTaskRejectedNotification.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\ServiceTask;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class ServiceTaskRejectedNotification extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(public ServiceTask $serviceTask, public string $reason)
|
||||
{
|
||||
}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
return ['database', 'mail'];
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
{
|
||||
$agentName = $this->serviceTask->data['agent_name'] ?? 'Agent';
|
||||
// Try to fetch agent name if avail
|
||||
if ($this->serviceTask->integrationRequest && $this->serviceTask->integrationRequest->agent) {
|
||||
$agentName = $this->serviceTask->integrationRequest->agent->first_name . ' ' . $this->serviceTask->integrationRequest->agent->last_name;
|
||||
}
|
||||
|
||||
return (new MailMessage)
|
||||
->error()
|
||||
->subject("Tâche REJETÉE : {$agentName}")
|
||||
->greeting("Bonjour {$notifiable->name},")
|
||||
->line("La tâche pour l'agent **{$agentName}** a été rejetée.")
|
||||
->line("**Raison du rejet :** {$this->reason}")
|
||||
->action('Voir la tâche', route('integrations.show', $this->serviceTask->integrationRequest))
|
||||
->line('Merci de corriger les éléments nécessaires puis de valider à nouveau.');
|
||||
}
|
||||
|
||||
public function toArray(object $notifiable): array
|
||||
{
|
||||
return [
|
||||
'service_task_id' => $this->serviceTask->id,
|
||||
'integration_request_id' => $this->serviceTask->integration_request_id,
|
||||
'message' => "La tâche a été rejetée. Motif : {$this->reason}",
|
||||
'type' => 'task_rejected',
|
||||
];
|
||||
}
|
||||
}
|
||||
46
app/Notifications/ServiceTaskValidatedNotification.php
Normal file
46
app/Notifications/ServiceTaskValidatedNotification.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\ServiceTask;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class ServiceTaskValidatedNotification extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(public ServiceTask $serviceTask)
|
||||
{
|
||||
}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
return ['database', 'mail'];
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
{
|
||||
$agentName = $this->serviceTask->integrationRequest->agent->first_name . ' ' . $this->serviceTask->integrationRequest->agent->last_name;
|
||||
$serviceName = $this->serviceTask->service->name;
|
||||
|
||||
return (new MailMessage)
|
||||
->subject("Tâche validée : {$serviceName} - {$agentName}")
|
||||
->greeting("Bonjour {$notifiable->name},")
|
||||
->line("Le service **{$serviceName}** a validé sa tâche pour l'agent **{$agentName}**.")
|
||||
->action('Voir la demande', route('integrations.show', $this->serviceTask->integrationRequest))
|
||||
->line('Merci d\'utiliser notre application.');
|
||||
}
|
||||
|
||||
public function toArray(object $notifiable): array
|
||||
{
|
||||
return [
|
||||
'service_task_id' => $this->serviceTask->id,
|
||||
'integration_request_id' => $this->serviceTask->integration_request_id,
|
||||
'message' => "Le service {$this->serviceTask->service->name} a validé sa tâche.",
|
||||
'type' => 'task_validated',
|
||||
];
|
||||
}
|
||||
}
|
||||
42
app/Notifications/SlaOverdueNotification.php
Normal file
42
app/Notifications/SlaOverdueNotification.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\ServiceTask;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class SlaOverdueNotification extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(protected ServiceTask $serviceTask)
|
||||
{
|
||||
}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
return ['database', 'mail'];
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): array|MailMessage
|
||||
{
|
||||
return (new MailMessage)
|
||||
->error()
|
||||
->subject('ALERTE : SLA Dépassé')
|
||||
->line('Le délai SLA pour la tâche ' . $this->serviceTask->service->name . ' (Agent: ' . $this->serviceTask->integrationRequest->agent->first_name . ' ' . $this->serviceTask->integrationRequest->agent->last_name . ') est dépassé.')
|
||||
->action('Voir la tâche', route('integrations.show', $this->serviceTask->integrationRequest))
|
||||
->line('Merci d\'intervenir immédiatement.');
|
||||
}
|
||||
|
||||
public function toArray(object $notifiable): array
|
||||
{
|
||||
return [
|
||||
'service_task_id' => $this->serviceTask->id,
|
||||
'message' => 'SLA dépassé pour ' . $this->serviceTask->service->name,
|
||||
'type' => 'overdue',
|
||||
];
|
||||
}
|
||||
}
|
||||
43
app/Notifications/TaskAssignedNotification.php
Normal file
43
app/Notifications/TaskAssignedNotification.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\ServiceTask;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class TaskAssignedNotification extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(protected ServiceTask $serviceTask)
|
||||
{
|
||||
}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
return ['database', 'mail'];
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): array|MailMessage
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject('Nouvelle tâche d\'intégration assignée')
|
||||
->line('Une nouvelle tâche d\'intégration pour l\'agent ' . $this->serviceTask->integrationRequest->agent->first_name . ' ' . $notifiable->name . ' a été assignée à votre service.')
|
||||
->action('Voir la tâche', route('integrations.show', $this->serviceTask->integrationRequest))
|
||||
->line('Merci de traiter cette demande dans les plus brefs délais.');
|
||||
}
|
||||
|
||||
public function toArray(object $notifiable): array
|
||||
{
|
||||
return [
|
||||
'service_task_id' => $this->serviceTask->id,
|
||||
'integration_request_id' => $this->serviceTask->integration_request_id,
|
||||
'service_name' => $this->serviceTask->service->name,
|
||||
'agent_name' => $this->serviceTask->integrationRequest->agent->first_name . ' ' . $this->serviceTask->integrationRequest->agent->last_name,
|
||||
'message' => 'Nouvelle tâche assignée',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user