@foreach ($produtos as $nome_produto => $postos_combustiveis)

{{ $nome_produto }}

@if ($permissao->criar_agendamentos_pedidos) @endif @foreach($postos_combustiveis as $posto_combustivel) @if ($posto_combustivel->media_venda_inicial && $posto_combustivel->dias_proximo_reabastecimento) @else @endif @if ($posto_combustivel->media_venda_inicial && $posto_combustivel->data_proximo_reabastecimento) @else @endif @if ($permissao->criar_agendamentos_pedidos) {{-- --}} @endif @endforeach
Posto Tanque Data Última Sondagem Última Sondagem Média de Vendas Dias restantes Reabastecer antes deAgendar
{{ $posto_combustivel->posto->nome_posto }} {{ $posto_combustivel->num_tanque }} @if ($posto_combustivel->sondagens_combustiveis()->latest()->first()) {{ $posto_combustivel->sondagens_combustiveis()->latest()->first()->data_sondagem }} {{ date('d/m/Y', strtotime($posto_combustivel->sondagens_combustiveis()->latest()->first()->data_sondagem)) }} @else - @endif @if ($posto_combustivel->sondagens_combustiveis()->latest()->first()) {{ $posto_combustivel->sondagens_combustiveis()->latest()->first()->sondagem_final }} {{ number_format($posto_combustivel->sondagens_combustiveis()->latest()->first()->sondagem_final, 0, ',', ' ') }} @else - @endif {{ number_format($posto_combustivel->media_vendas, 0, ',', ' ') }} {{ $posto_combustivel->dias_proximo_reabastecimento }} - {{ $posto_combustivel->data_proximo_reabastecimento }} {{ date('d/m/Y', strtotime($posto_combustivel->data_proximo_reabastecimento)) }} - @if(isset($posto_combustivel->agendamentos_pedidos()->where('data_recebimento', '=', null)->orderBy('data_agendamento')->first()->data_agendamento) && $posto_combustivel->agendamentos_pedidos()->where('data_recebimento', '=', null)->orderBy('data_agendamento')->first()->data_agendamento < date('Y-m-d')) @elseif(isset($posto_combustivel->agendamentos_pedidos()->where('data_recebimento', '=', null)->orderBy('data_agendamento')->first()->data_agendamento) ) @else @endif
@endforeach