{{-- Diseño moderno (v3): lista de reservas. Misma búsqueda, pestañas y acciones que reservation/index; solo cambia la presentación. --}} @extends('layout.main') @section('content') @include('reservation._alerts') @php $tab = ['1' => 'activas', '2' => 'cerradas', '3' => 'cerradas', '4' => 'pagadas', 'cerradas' => 'cerradas', 'all' => 'todas', 'vencidas' => 'vencidas'][(string) $status] ?? 'activas'; $tabs = ['activas' => ['1', 'Activas'], 'vencidas' => ['vencidas', 'Vencidas'], 'pagadas' => ['4', 'Pagadas'], 'cerradas' => ['cerradas', 'Cerradas'], 'todas' => ['all', 'Todas']]; $pill = function ($r) { if ($r->is_overdue) return 'v3-pill-red'; return [1 => 'v3-pill-gray', 2 => 'v3-pill-green', 3 => 'v3-pill-gray', 4 => 'v3-pill-brand', 5 => 'v3-pill-brand'][$r->status] ?? 'v3-pill-gray'; }; $selectable = $tab == 'pagadas' && $can_edit; @endphp

Reservas

Activas{{ $kpis['activas'] }} Vencidas{{ $kpis['vencidas'] }} Por enviar / retirar{{ $kpis['pagadas'] }}
Saldo por cobrar${{ number_format($kpis['saldo'], 2) }}
@foreach($tabs as $key => [$value, $label]) {{ $label }} @endforeach
@if($tab == 'pagadas')

Ya pagadas. Cuando el paquete sale o el cliente lo retira, abre la reserva y pulsa Confirmar envío o Confirmar retiro; para varias, márcalas y usa el botón de abajo.

@endif @if($reservations->isEmpty())
@if($search !== '' && $status !== 'all') No hay reservas con "{{ $search }}" aquí. Buscar en todas @else No hay reservas aquí. Crear una reserva @endif
@else @if($selectable){!! Form::open(['route' => 'reservations.deliver-many', 'method' => 'post', 'id' => 'deliver-many-form']) !!}@endif
@if($selectable)@endif @foreach($reservations as $r) @if($selectable)@endif @endforeach
ClienteEntregaTotalSaldoEstado
{{ $r->customer->name ?? ($r->client_code ? 'Código ' . $r->client_code : 'Sin cliente') }}
{{ $r->reference_no }}@if($r->client_code && $r->customer) · {{ $r->client_code }}@endif @if($r->due_date && $r->status == 1) · vence {{ \Carbon\Carbon::parse($r->due_date)->format('d/m') }}@elseif($r->status == 2 && $r->delivered_at) · entregada {{ \Carbon\Carbon::parse($r->delivered_at)->format('d/m') }}@else · {{ $r->created_at->format('d/m') }}@endif · {{ preg_replace('/\s*-\s*Entre Tu y Yo$/i', '', $r->warehouse->name ?? '') }}
@if($r->shipping_method){{ $r->shipping_method }}@if($r->delivery_mode == 'envio' && $r->shipping_cost > 0)
${{ number_format($r->shipping_cost, 2) }}
@endif @elsePor definir@endif
${{ number_format($r->total, 2) }} @if($r->surplus > 0)Excedente ${{ number_format($r->surplus, 2) }}@else${{ number_format($r->balance, 2) }}@endif {{ $r->status_label }} @if($r->status == 4 && $r->exit_issues)
Falta: {{ implode('; ', $r->exit_issues) }}
@endif @if($r->merged_into && $r->mergedInto)
→ {{ $r->mergedInto->reference_no }}
@endif
@if($selectable) {!! Form::close() !!} @endif
{{ $reservations->links('pagination::bootstrap-4') }}
@endif
@endsection