@php // Progress step pulled from the computed status so the // indicator and the form stay in lock-step. Terminal // states (Locked / Expired) hide the indicator. $progressStep = match ($status) { \App\Enums\SelfHelpSessionStatus::PendingEmail => 1, \App\Enums\SelfHelpSessionStatus::PendingCode => 2, \App\Enums\SelfHelpSessionStatus::PendingOrder => 3, default => null, }; @endphp {{-- ─── Header ──────────────────────────────────────────────── --}}

{{ __('Quick check') }}

{{ __('Let\'s find your order') }}

{{ __('We\'ll verify your email and pull up your recent orders. Your details stay on this device.') }}

{{-- ─── Progress steps ──────────────────────────────────────── --}} @if ($progressStep !== null)
    @foreach ([ 1 => __('Email'), 2 => __('Code'), 3 => __('Order'), ] as $step => $label)
  1. @if ($progressStep > $step) @else {{ $step }} @endif {{ $label }} @if (! $loop->last) @endif
  2. @endforeach
@endif {{-- ─── Flash banner ────────────────────────────────────────── --}} @if ($flashKey !== null) @php $flashCopy = match ($flashKey) { 'code_sent' => __('We\'ve sent a 6-digit code to your inbox. It expires in 10 minutes.'), 'code_resent' => __('A fresh code is on its way.'), 'cooldown' => __('Hold tight — you can request another code in :seconds seconds.', ['seconds' => $flashPayload ?? 60]), 'mail_failed' => __('We couldn\'t send the email. Double-check the address and try again.'), 'wrong_code' => __('That code doesn\'t match. Have another go — you\'ve got a couple of attempts left.'), 'expired_code' => __('That code has expired. Tap Resend for a fresh one.'), 'locked' => __('We\'ve paused this session after too many attempts. Start over below.'), 'manual_not_found' => __('We couldn\'t find an order matching that number for your email.'), 'no_orders' => __('We don\'t see any recent orders for that email. You can still continue.'), default => null, }; @endphp @if ($flashCopy !== null)
{{ $flashCopy }}
@endif @endif {{-- ─── State 1: Email entry ────────────────────────────────── --}} @if ($status === \App\Enums\SelfHelpSessionStatus::PendingEmail)

{{ __('Use the email you placed your order with.') }}

@error('emailInput')

{{ $message }}

@enderror
@endif {{-- ─── State 2: Code entry + Alpine countdown ──────────────── --}} @if ($status === \App\Enums\SelfHelpSessionStatus::PendingCode)

{!! __('We\'ve sent a 6-digit code to :email. It expires in 10 minutes.', ['email' => e($session?->email ?? '')]) !!}

{{-- Resend countdown. Alpine drives the visible seconds counter locally; the backend remains the authority (resendCode re-checks `cooldownSecondsRemaining` before issuing). On a successful re-issue, the server dispatches the `self-help-resend-issued` browser event, which the Alpine listener picks up to restart the timer. --}}
{{-- Back to email entry. Lives BELOW the resend affordance so the most-likely-used action (resend) is still the first one the eye lands on. The link clears the verification state on the same session row — no fresh cookie minted, audit trail preserved. --}}
@endif {{-- ─── State 3: Order picker — paginated card grid ─────────── --}} @if ($status === \App\Enums\SelfHelpSessionStatus::PendingOrder) @if (! $showManualLookup)
@if ($orderCards->isEmpty()) {{-- Empty / no-orders state ─────────────────── --}}

{{ __('No recent orders found') }}

{{ __('We couldn\'t find any orders under :email. You can still continue and we\'ll do our best to help.', ['email' => $session?->email]) }}

@else {{-- Picker header ───────────────────────────── --}}

{{ __('Which order is this about?') }}

{{ __('Showing :count of your recent orders.', ['count' => $orderCards->count()]) }}

@if (($ordersSource ?? null) === 'refresh-failed')
{{ __('Couldn\'t reach our order system just now — showing the most recent orders we have on file.') }}
@endif {{-- Order picker grid. `sh-grid` is the canonical responsive grid class (1 col mobile, 2 cols ≥ 760px viewport) defined in the layout's