{{-- ============================================================
PESTAÑAS DE ÁREAS
============================================================ --}}
@foreach($areas as $index => $area)
@endforeach
{{-- ============================================================
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
==================================================== --}}