{{--
App\Mail\ShiftActivityMail — sent via NotificationService event 'shift.activity'.
Vars: $branding, $shift, $activity (created|accepted|assigned|cancelled), $headline, $reference, $cancelReason
Shift times are stored in the shift's own (site) local time, so they're shown as-is.
--}}
@extends('emails.layouts.tenant')
@php
$site = $shift->recipient();
$hcp = $shift->hcp;
$start = $shift->start_time ? \Carbon\Carbon::parse($shift->start_time) : null;
$end = $shift->end_time ? \Carbon\Carbon::parse($shift->end_time) : null;
$cancel = $shift->cancelled_shift;
$reason = $cancelReason ?: ($cancel->cancel_reason ?? null);
$intro = match ($activity) {
'created' => 'A new shift has been broadcasted to available workers. It will be confirmed once a worker accepts it.',
'accepted' => 'A worker has accepted this shift.',
'assigned' => 'A worker has been assigned to this shift.',
'cancelled' => 'This shift has been cancelled.',
default => 'This shift has been updated.',
};
@endphp
@section('title', $headline)
@section('preheader')
{{ $headline }}: {{ $reference }}@if ($site) at {{ $site->name }}@endif @if ($start) on {{ $start->format('D j M, g:i a') }}@endif.
@endsection
@section('content')
Hello,
{{ $intro }} Here are the details for shift {{ $reference }}.
{{ $reference }}
@if ($site)
{{ ucwords($site->name) }}
@endif
@if ($shift->word_wing)
{{ $shift->word_wing }}
@endif
@if ($start)
{{ $start->format('l j F Y') }}
{{ $start->format('g:i a') }}@if ($end) – {{ $end->format('g:i a') }}@if (!$end->isSameDay($start)) (next day)@endif @endif
@endif
@if ($shift->profession)
{{ ucwords($shift->profession->name) }}@if ($shift->level) · {{ ucwords($shift->level->name) }}@endif
@endif
@if ($shift->shift_type)
{{ ucwords(str_replace('-', ' ', $shift->shift_type)) }}
@endif
@if ($hcp && $activity !== 'created')
{{ ucwords($hcp->first_name . ' ' . $hcp->last_name) }} ({{ $hcp->hcp_prefix . $hcp->id }})
@endif
@if ($shift->booked_by)
{{ ucwords($shift->booked_by) }}
@endif
@if ($activity === 'cancelled')
@if ($cancel && $cancel->cancel_by)
{{ ucwords($cancel->cancel_by) }}
@endif
{{ $reason ?: 'Not given' }}
@endif
View shift {{ $reference ?? '' }}
You're receiving this because your address is set up for shift notifications with {{ $branding->name }}.
Questions about this shift? Reply to this email.
@endsection