@php $totalPendiente = (float) $pendientes->sum('total'); $cantidadPendiente = (int) $pendientes->sum('cantidad'); $eventoHash = Hashids::encode( $evento->id, time() ); $mesaHash = Hashids::encode( $mesa->id, time() ); $accionHash = Hashids::encode( $evento->id, $mesa->id, time() ); $contenidoUrl = route( 'mozo.mesa.contenido', [ $eventoHash, $mesaHash ] ); $tienePendientes = $pendientes->count() > 0; $tieneCerradas = $cerradas->count() > 0; @endphp

{{ $mesa->nombre }} @if($tienePendientes) Pendiente @else Cerrada @endif

@if($tienePendientes) @endif
{{-- Cierres anteriores --}} @foreach($cerradas as $hash => $grupo) @php $primeraComanda = $grupo->first(); @endphp
@foreach($grupo as $comanda) @endforeach
Hora Por Producto Descuento Cantidad Subtotal
{{ optional($comanda->created_at)->format('H:i') }} {{ optional($comanda->user)->name }} {{ optional($comanda->producto)->nombre }} @if($comanda->descuento) {{ $comanda->descuento * 100 }}% @endif {{ $comanda->cantidad }} ${{ number_format( $comanda->total, 0, ',', '.' ) }}
{{ $primeraComanda ? optional($primeraComanda->updated_at)->format('H:i') : '' }} {{ $primeraComanda ? optional($primeraComanda->medio)->nombre : '' }} {{ $grupo->sum('cantidad') }} ${{ number_format( $grupo->sum('total'), 0, ',', '.' ) }}
@if(!$loop->last)
@endif @endforeach {{-- Separación entre cerradas y pendientes --}} @if($tieneCerradas && $tienePendientes)
@endif {{-- Pendientes --}} @if($tienePendientes)
@foreach($pendientes as $comanda) @endforeach
Hora Por Producto Cantidad Subtotal Borrar
{{ optional($comanda->created_at)->format('H:i') }} {{ optional($comanda->user)->name }} {{ optional($comanda->producto)->nombre }} {{ $comanda->cantidad }} ${{ number_format( $comanda->total, 0, ',', '.' ) }}
Total Pendiente de cierre {{ $cantidadPendiente }} ${{ number_format( $totalPendiente, 0, ',', '.' ) }}
@elseif(!$tieneCerradas)
Esta mesa no tiene comandas.
@endif