@php /** Expected: $job, $payment. Optional: $brand, $amountCents, $currency, $bookingRef, $startAt, $endAt, $viewUrl */ // Brand / logo (keeps parity with the request template) $brandName = $brand->short_name ?? 'Dream Drives'; $logo = $brand->email_logo_url ?? null; // Currency + formatter $ccy = strtoupper($currency ?? $payment->currency ?? $job->currency ?? 'NZD'); $sym = [ 'NZD' => 'NZ$', 'AUD' => 'A$', 'USD' => '$', 'GBP' => '£', 'EUR' => '€', 'CAD' => 'C$', ][$ccy] ?? $ccy; $fmt = fn ($c) => $sym . number_format(((int) $c) / 100, 2); // Amount (prefer explicit amountCents if passed) $amount = isset($amountCents) ? (int) $amountCents : (int) ($payment->amount_cents ?? $payment->amount ?? 0); // Person/name $firstName = trim(explode(' ', $job->customer_name ?? 'there')[0] ?? 'there'); // Times / dates $formatDt = function ($v, $fmt = 'D d M Y, h:ia') { try { if ($v instanceof \Illuminate\Support\Carbon || $v instanceof \Carbon\Carbon) return $v->format($fmt); return \Carbon\Carbon::parse($v)->format($fmt); } catch (\Throwable $e) { return null; } }; $paidAt = $formatDt($payment->created_at ?? now()); $startTxt = isset($startAt) ? $formatDt($startAt, 'D d M Y, H:i') : ($job->start_at ? $formatDt($job->start_at, 'D d M Y, H:i') : null); $endTxt = isset($endAt) ? $formatDt($endAt, 'D d M Y, H:i') : ($job->end_at ? $formatDt($job->end_at, 'D d M Y, H:i') : null); // References $ref = $bookingRef ?? $job->external_reference ?? null; $charge = $payment->stripe_charge ?? $payment->stripe_charge_id ?? null; $pi = $payment->stripe_payment_intent ?? $payment->stripe_payment_intent_id ?? null; @endphp @component('mail::message') @if($logo)