@extends('layouts.app') @section('content')
{{-- ============================================================ ENCABEZADO ============================================================ --}}

Punto de Venta

Selecciona una mesa para comenzar

{{-- LEYENDA --}}
{{-- LIBRE --}}
Disponible
{{-- OCUPADA --}}
Ocupada
{{-- RESERVADA --}}
Reservada (Hoy)
{{-- ============================================================ PESTAÑAS DE ÁREAS ============================================================ --}} {{-- ============================================================ CONTENIDO DE LAS ÁREAS ============================================================ --}}
@foreach($areas as $index => $area)
{{-- ==================================================== MESAS ==================================================== --}} @foreach($area->tables as $table) @php /* |-------------------------------------------------------------------------- | ORDEN PENDIENTE |-------------------------------------------------------------------------- */ $order = $table->orders->first(); /* |-------------------------------------------------------------------------- | RESERVAS |-------------------------------------------------------------------------- */ $reservations = $table->reservations; /* |-------------------------------------------------------------------------- | COMPROBAR SI REALMENTE TIENE PRODUCTOS |-------------------------------------------------------------------------- */ $hasProducts = false; if ($order) { $hasProducts = $order->details && $order->details->count() > 0; } /* |-------------------------------------------------------------------------- | ESTADO REAL DE LA MESA |-------------------------------------------------------------------------- | | 🔴 ROJA: | Tiene orden pendiente + productos. | | 🟡 AMARILLA: | No tiene productos pero tiene reserva. | | 🟢 VERDE: | No tiene productos ni reserva. |-------------------------------------------------------------------------- */ $isBusy = $hasProducts; $hasReservations = $reservations->count() > 0; /* |-------------------------------------------------------------------------- | CLASE VISUAL |-------------------------------------------------------------------------- */ if ($isBusy) { $cardClass = 'bg-white border-danger border-2 text-danger shadow-sm'; $icon = 'bi-display-fill'; } elseif ($hasReservations) { $cardClass = 'bg-white border-warning border-2 text-dark shadow-sm'; $icon = 'bi-display'; } else { $cardClass = 'bg-white border-success border-2 text-success shadow-sm'; $icon = 'bi-display'; } @endphp {{-- ==================================================== ENLACE A LA MESA ==================================================== --}}
{{-- ================================================= NOMBRE DE MESA ================================================== --}}
{{ $table->name }}
{{-- ================================================= ICONO ================================================== --}}
{{-- ================================================= RESERVAS ================================================== --}} @if($hasReservations && !$isBusy)
@foreach($reservations as $res)
{{ $res->reservation_time ->format('H:i') }}
{{ Str::limit( $res->client_name, 9 ) }}
@endforeach
@endif
{{-- ================================================= ESTADO / TOTAL ================================================== --}}
{{-- ================================ OCUPADA ================================= --}} @if($isBusy)
CONSUMO
{{ $currency ?? 'S/' }}{{ number_format( $order->total, 2 ) }}
{{-- ================================ RESERVADA ================================= --}} @elseif($hasReservations)
{{ $reservations->count() }} RESERVA(S)
{{-- ================================ LIBRE ================================= --}} @else
LIBRE
@endif
@endforeach
@endforeach
{{-- ================================================================ ESTILOS ================================================================ --}} @endsection