@php $subtotalAtual = round((float) $comanda->valor_total, 2); $valorPagoAtual = round((float) $valorPago, 2); $descontoAtual = round((float) ($comanda->desconto ?? 0), 2); $temPagamentos = $pagamentos->isNotEmpty(); /* * Mantém o comportamento antigo da tela: * antes do primeiro pagamento, os 10% aparecem marcados por padrão. * Depois que existir pagamento, respeitamos o estado salvo na comanda. */ $taxaAtivaInicial = $temPagamentos ? (bool) ($comanda->taxa_servico_ativa ?? false) : true; $taxaInicial = $taxaAtivaInicial ? round($subtotalAtual * 0.10, 2) : 0; $totalInicial = max( 0, round( $subtotalAtual + $taxaInicial - $descontoAtual, 2 ) ); $saldoInicial = max( 0, round( $totalInicial - $valorPagoAtual, 2 ) ); @endphp
{{-- ====================================================== --}} {{-- CABEÇALHO --}} {{-- ====================================================== --}}

Atendimento

Mesa {{ $mesa->numero }}

{{ $mesa->nome }}

← Voltar às mesas
{{-- ====================================================== --}} {{-- RESUMO DA MESA --}} {{-- ====================================================== --}}
🍺
Comanda aberta
{{ $mesa->nome }}
Subtotal
R$ {{ number_format($subtotalAtual, 2, ',', '.') }}
Já pago
R$ {{ number_format($valorPagoAtual, 2, ',', '.') }}
Saldo atual
R$ {{ number_format($saldoInicial, 2, ',', '.') }}
{{-- ====================================================== --}} {{-- LAYOUT PRINCIPAL --}} {{-- ====================================================== --}}
{{-- ================================================== --}} {{-- PRODUTOS --}} {{-- ================================================== --}}

Cardápio

Clique em um produto para adicionar à comanda.

{{-- Categorias --}}
@foreach($produtos as $categoria => $lista) @endforeach
{{-- Produtos --}}
@foreach($produtos as $categoria => $lista)

{{ ucfirst($categoria) }}

@foreach($lista as $produto) @php $semEstoque = !$produto->estoque_ilimitado && $produto->estoque < 1; @endphp @endforeach
@endforeach
{{-- ================================================== --}} {{-- COMANDA --}} {{-- ================================================== --}}
{{-- Cabeçalho --}}

Comanda

{{-- Itens --}}
@forelse($itens as $item)
{{ $item->produto->nome }}
{{ $item->quantidade }}
R$ {{ number_format($item->subtotal, 2, ',', '.') }}
@empty
Nenhum item adicionado
@endforelse
{{-- ================================================== --}} {{-- PAGAMENTOS JÁ REGISTRADOS --}} {{-- ================================================== --}} @if($pagamentos->isNotEmpty())
Pagamentos
{{ $pagamentos->count() }} {{ $pagamentos->count() === 1 ? 'baixa registrada' : 'baixas registradas' }}
R$ {{ number_format($valorPagoAtual, 2, ',', '.') }}
@foreach($pagamentos as $pagamento) @php $nomesPagamento = [ 'dinheiro' => 'Dinheiro', 'pix' => 'PIX', 'credito' => 'Crédito', 'debito' => 'Débito', ]; @endphp
{{ $nomesPagamento[$pagamento->forma_pagamento] ?? ucfirst($pagamento->forma_pagamento) }}
{{ optional($pagamento->pago_em)->format('d/m/Y H:i') }}
R$ {{ number_format((float) $pagamento->valor, 2, ',', '.') }}
@if($pagamento->observacao)
{{ $pagamento->observacao }}
@endif
@endforeach
@endif {{-- ================================================== --}} {{-- RESUMO FINANCEIRO --}} {{-- ================================================== --}}
R$ {{ number_format($taxaInicial, 2, ',', '.') }}
Subtotal R$ {{ number_format($subtotalAtual, 2, ',', '.') }}
Já pago - R$ {{ number_format($valorPagoAtual, 2, ',', '.') }}
Total da conta
R$ {{ number_format($totalInicial, 2, ',', '.') }}
Saldo
R$ {{ number_format($saldoInicial, 2, ',', '.') }}
{{-- ========================================================= --}} {{-- MODAL PAGAMENTO PARCIAL --}} {{-- ========================================================= --}} {{-- ========================================================= --}} {{-- MODAL FECHAR CONTA --}} {{-- ========================================================= --}} {{-- ========================================================= --}} {{-- MODAL CONTA FECHADA --}} {{-- ========================================================= --}} {{-- ========================================================= --}} {{-- JAVASCRIPT --}} {{-- ========================================================= --}}