@extends('layouts.motoboy_dashboard') @section('content')

Painel do Motoboy

Usuário: {{ auth()->user()->name }}
Perfil: {{ optional(auth()->user()->roles()->first())->name ?? 'Sem perfil' }}

Concluídas (Mês)

{{ $completedDeliveriesMonth ?? 0 }}

Entregas Disponíveis

{{ $availableDeliveriesCount ?? 0 }}

Em Andamento

{{ $acceptedByMotoboyCount ?? 0 }}

Recusadas/Canceladas

{{ $rejectedCancelledDeliveriesCount ?? 0 }}

Suas Entregas (Disponíveis e Ativas)

Total de Entregas: {{ $entregasDashboard->total() ?? 0 }}

@forelse($entregasDashboard as $entrega)
$entrega->status === 'pending_acceptance_motoboy', // Disponível 'border-l-4 border-yellow-500' => in_array($entrega->status, ['accepted_by_motoboy', 'picked_up', 'in_transit']), // Em Andamento ])>
Cod. Pedido:

{{ optional($entrega->pedidoTroca)->codigo_troca ?? 'N/A' }}

@php $statusClasses = [ 'pending_acceptance_motoboy' => 'bg-blue-100 text-blue-800', 'accepted_by_motoboy' => 'bg-yellow-100 text-yellow-800', 'picked_up' => 'bg-orange-100 text-orange-800', 'in_transit' => 'bg-purple-100 text-purple-800', 'delivered' => 'bg-green-100 text-green-800', 'canceled' => 'bg-red-100 text-red-800', ]; $currentStatusClass = $statusClasses[$entrega->status] ?? 'bg-gray-200 text-gray-700'; @endphp {{ ucfirst(str_replace('_', ' ', $entrega->status)) }}

Medicamento: {{ optional(optional($entrega->pedidoTroca)->medicamento)->name ?? 'Medicamento Não Encontrado' }}

Origem: {{ optional($entrega->enderecoOrigem)->bairro ?? 'Bairro N/A' }} @if (optional($entrega->enderecoOrigem)->cidade) , {{ $entrega->enderecoOrigem->cidade }} @endif

Destino: {{ optional($entrega->enderecoDestino)->bairro ?? 'Bairro N/A' }} @if (optional($entrega->enderecoDestino)->cidade) , {{ $entrega->enderecoDestino->cidade }} @endif

Criado em: {{ \Carbon\Carbon::parse($entrega->created_at)->format('d/m/Y H:i') }}

{{-- Ações baseadas no status da Entrega --}}
@if ($entrega->status === 'pending_acceptance_motoboy' && is_null($entrega->motoboy_id))
@csrf
@elseif ($entrega->status === 'accepted_by_motoboy') Gerenciar Coleta @elseif ($entrega->status === 'picked_up') Gerenciar Trânsito @elseif ($entrega->status === 'in_transit') Finalizar Entrega @else Ver Detalhes @endif
@empty

🎉 Nenhuma entrega disponível ou em andamento no momento!

Fique atento, novas entregas podem surgir a qualquer instante.

@endforelse
@if ($entregasDashboard->hasPages())
{{ $entregasDashboard->links() }}
@endif
@endsection @section('scripts') @endsection