@php
// Build a UNIVERSALLY DIALABLE tel: target in E.164 (+CC…) form. The caller
// number often arrives as E.164 WITHOUT the leading + (e.g. 27825515416),
// which phones won't dial correctly — a bare tel:27825515416 is treated as a
// local string. Normalise to +27… so tapping it always works.
$raw = trim((string) $callerNumber);
$digits = preg_replace('/\D/', '', $raw);
if (str_starts_with($raw, '+')) {
$telHref = '+' . $digits; // already E.164
} elseif (str_starts_with($digits, '0') && strlen($digits) === 10) {
$telHref = '+27' . substr($digits, 1); // SA local 0XXXXXXXXX → +27…
} elseif (strlen($digits) >= 11) {
$telHref = '+' . $digits; // E.164 missing its +
} else {
$telHref = $digits; // short/internal — leave as-is
}
// Show the dialable form so the record and the tap-to-call match.
$telDisplay = $telHref !== '' ? $telHref : $raw;
@endphp
@extends('emails.layouts.base', [
'subject' => 'Standby Call — ' . ($callerName ?? $callerNumber),
'title' => 'Standby Call',
'subtitle' => 'A call was routed to you on standby.',
'icon' => '📞',
'iconColor' => '#2563eb',
])
@section('content')
| Caller |
{{ $callerName ?? 'Unknown' }} |
| Number |
{{ $telDisplay }}
|
| Standby Line |
{{ $speedDialLabel }} |
| Time |
{{ $callTime }} |
|
This call was routed to your standby line. If you missed it, tap the number
above to call them straight back. This email is also a record of the call
for your follow-up.
@endsection