@php
  $ordine = $asporto->ordine;
  $info = is_array($ordine?->info) ? $ordine->info : [];
  $cliente = $info['cliente'] ?? ($ordine->nome ?? '—');
  $telefono = trim((string) ($info['telefono'] ?? ''));
  $codice = $ordine->codice ?? ('A-'.$asporto->ordine_id);
  $orario = $asporto->ora_ritiro
    ? \Illuminate\Support\Carbon::parse($asporto->ora_ritiro)->format('H:i')
    : ($info['ora_ritiro'] ?? '');
  $note = $ordine->note ?? ($info['note'] ?? '');
  $righe = $ordine?->righe_ordine ?? collect();
  $qta = (int) $righe->sum('quantita');
@endphp

<section
  class="asporto-prep-panel asporto-pick-panel"
  id="asportoPickPanel{{ $asporto->id }}"
  data-pick-panel
  data-asporto-id="{{ $asporto->id }}"
  data-asporto-codice="{{ $codice }}"
  data-ora-ritiro="{{ $orario }}"
  data-completa-url="{{ route('asporto.postazione.ritiro.completa', $asporto) }}"
  data-timing-target
  hidden
>
  <div class="asporto-prep-detail__body asporto-pick-panel__body">
    <div class="asporto-pick-split">
      <div class="asporto-pick-split__info">
        <div class="asporto-pick-split__code-row">
          <div class="asporto-prep-panel__code">{{ $codice }}</div>
          <div class="asporto-timing-chip" data-timing-chip>
            <span data-timing-badge></span>
          </div>
        </div>

        @include('asporto._partials.ordine_facts', ['asporto' => $asporto])

        <div class="asporto-pick-alert">
          <i class="bx bx-receipt"></i>
          <div>
            <strong>Ritira lo scontrino</strong>
            <div>Consegna l’ordine e verifica lo scontrino.</div>
          </div>
        </div>
      </div>

      <div class="asporto-pick-split__items">
        <p class="asporto-pick-split__items-title">Contenuto ordine</p>
        <div class="asporto-call-riepilogo">
          @include('asporto._partials.ordine_righe_table', ['asporto' => $asporto, 'righe' => $righe])
        </div>
      </div>
    </div>
  </div>

  <div class="asporto-prep-detail__foot asporto-pick-panel__foot">
    <button type="button" class="btn btn-success asporto-prep-continua is-ready" data-pick-continua>
      <i class="bx bx-check-double me-1"></i>Consegnato
    </button>
  </div>
</section>
