libra/docs/stories/story-8.8-timeline-update-n...

1.5 KiB

Story 8.8: Timeline Update Notification

Epic Reference

Epic 8: Email Notification System

User Story

As a client, I want to be notified when my case timeline is updated, So that I stay informed about my case progress.

Acceptance Criteria

Trigger

  • Sent on timeline update creation
  • Queued for performance

Content

  • "Update on your case: [Case Name]"
  • Case reference number
  • Update content (full or summary)
  • Date of update
  • "View Timeline" button/link

Language

  • Email in client's preferred language

Design

  • Professional, informative tone

Technical Notes

class TimelineUpdateNotification extends Notification
{
    use Queueable;

    public function __construct(
        public TimelineUpdate $update
    ) {}

    public function via(object $notifiable): array
    {
        return ['mail'];
    }

    public function toMail(object $notifiable): MailMessage
    {
        $locale = $notifiable->preferred_language ?? 'ar';
        $timeline = $this->update->timeline;

        return (new MailMessage)
            ->subject($this->getSubject($locale, $timeline->case_name))
            ->markdown("emails.timeline.update.{$locale}", [
                'update' => $this->update,
                'timeline' => $timeline,
            ]);
    }
}

Definition of Done

  • Email sent on update
  • Case info included
  • Update content shown
  • View link works
  • Bilingual templates
  • Tests pass

Estimation

Complexity: Low | Effort: 2 hours