@php $pageConfigs = ['navbarType' => 'static', 'contentLayout' => 'wide']; $configData = Helper::appClasses(); $statusMap = [ 'pending' => ['Pendiente', 'warning', 10], 'confirmed' => ['Confirmado', 'info', 30], 'at_restaurant' => ['Confirmado', 'info', 45], 'en_route' => ['En camino', 'primary', 80], 'delivered' => ['Entregado', 'success', 100], 'cancelled' => ['Cancelado', 'danger', 0], ]; $confirmedTotal = ($statusCounts['confirmed'] ?? 0) + ($statusCounts['at_restaurant'] ?? 0); @endphp @extends('layouts/layoutMaster') @section('title', 'Operativa') @section('page-style') @vite('resources/assets/vendor/scss/pages/app-logistics-fleet.scss') @endsection @section('content')
€{{ number_format($restaurant?->wallet_balance ?? 0, 2) }}
€{{ number_format($restaurant?->delivery_fee ?? 0, 2) }}
@csrf
@forelse ($deliveries as $delivery) @php [$statusLabel, $statusColor, $progress] = $statusMap[$delivery->status] ?? ['Pendiente', 'warning', 20]; $courierName = $delivery->courier?->name ?? 'Sin asignar'; $courierStatusLabel = match ($delivery->status) { 'pending' => 'Buscando repartidor', 'confirmed' => 'Repartidor confirmado', 'at_restaurant' => 'Repartidor confirmado', 'en_route' => 'En camino', 'delivered' => 'Entregado', 'cancelled' => 'Cancelado', default => 'En espera', }; $courierStatusColor = match ($delivery->status) { 'pending' => 'warning', 'confirmed' => 'info', 'at_restaurant' => 'info', 'en_route' => 'primary', 'delivered' => 'success', 'cancelled' => 'danger', default => 'secondary', }; $courierStatusNote = match (true) { $delivery->courier_id && $delivery->status === 'at_restaurant' => 'Rider en el restaurante', $delivery->courier_id && $delivery->status === 'confirmed' => 'Rider en camino al restaurante', default => null, }; @endphp
@empty
No hay entregas todavía.
@endforelse
@foreach ($deliveries as $delivery) @php [$statusLabel, $statusColor, $progress] = $statusMap[$delivery->status] ?? ['Pendiente', 'warning', 20]; $courierName = $delivery->courier?->name ?? 'Sin asignar'; @endphp
Entrega #{{ $delivery->id }}
{{ $statusLabel }}
Cliente {{ $delivery->customer_name }}
Teléfono {{ $delivery->customer_phone ?? '-' }}
Dirección {{ $delivery->delivery_address }}
@if ($delivery->delivery_address_extra)
Adicional {{ $delivery->delivery_address_extra }}
@endif
Repartidor {{ $courierName }}
Estado

{{ $statusLabel }}

@if ($delivery->status === 'at_restaurant')
Rider en el restaurante
@endif
  • pedido creado
    {{ $delivery->restaurant?->name ?? 'Restaurante' }}
    {{ $delivery->created_at->format('d/m/Y H:i') }}
  • repartidor
    {{ $courierName }}
    {{ $delivery->status === 'pending' ? 'En espera' : 'Asignado' }}
  • entrega
    {{ $delivery->delivery_address }}
    {{ $delivery->status === 'delivered' ? 'Entregado' : 'En curso' }}
@if ($delivery->status === 'pending')
@csrf
@endif
@endforeach
Operativa

{{ $restaurant?->name ?? 'Restaurante' }}

Solicitar repartidor
Rider urgente

Solicitar rider

Saldo
€{{ number_format($restaurant?->wallet_balance ?? 0, 2) }}
Costo entrega
€{{ number_format($restaurant?->delivery_fee ?? 0, 2) }}
@php $last = $latestDelivery ?? (($allDeliveries ?? collect())->first()); $lastLabel = $last ? ($statusMap[$last->status][0] ?? 'Pendiente') : null; $lastBadge = $last ? ($statusMap[$last->status][1] ?? 'secondary') : 'secondary'; $lastAgo = $last?->created_at ? $last->created_at->locale('es')->diffForHumans() : null; $hasCourier = $last && $last->courier; $courierLine = $hasCourier ? ($last->courier->name ?? 'Repartidor asignado') : 'Sin repartidor'; $courierStatus = $hasCourier ? ($last && $last->status === 'at_restaurant' ? 'Rider en el restaurante' : 'Repartidor en camino') : ($last && $last->status === 'pending' ? 'Buscando repartidor' : 'Sin asignar'); @endphp
Ultimo pedido
@if ($last)
{{ $lastLabel }} #{{ $last->id }} {{ optional($last->created_at)->format('H:i') }} Urgente
@if ($lastAgo)
Tu ultimo pedido solicitado fue {{ $lastAgo }}.
@endif
{{ $last->customer_name ?? 'Por definir' }}
{{ $last->delivery_address ?? 'Por definir' }}
{{ $courierLine }}
{{ $courierStatus }}
@else
Aun no has solicitado ningun servicio hoy.
@endif
@forelse ($allDeliveries ?? collect() as $delivery)
#{{ $delivery->id }} · {{ $delivery->customer_name ?? 'Por definir' }}
{{ $delivery->delivery_address ?? 'Por definir' }}
{{ $statusMap[$delivery->status][0] ?? 'Pendiente' }}
{{ optional($delivery->created_at)->format('d/m/Y H:i') }} {{ $delivery->is_urgent ? 'Urgente' : 'Normal' }}
@empty
No hay pedidos hoy.
@endforelse
{{ strtoupper(substr($restaurant?->name ?? 'R', 0, 1)) }}
{{ $restaurant?->name ?? 'Restaurante' }}
{{ $restaurant?->address ?? 'Sin dirección' }}
Zona
{{ $restaurant?->zone?->name ?? 'No asignada' }}
Contacto
{{ $restaurant?->contact_name ?? 'Sin contacto' }}
Teléfono
{{ $restaurant?->phone ?? 'Sin teléfono' }}
Email
{{ $restaurant?->email ?? 'Sin email' }}
@csrf
Nueva entrega
@csrf
Se cobrará €{{ number_format($restaurant?->delivery_fee ?? 0, 2) }} por entrega.
Pedir repartidor urgente
Un repartidor llegará al restaurante con urgencia. El repartidor completará los datos del cliente al llegar.
@csrf
Se cobrará €{{ number_format($restaurant?->delivery_fee ?? 0, 2) }} por entrega.
@endsection @section('page-script') @endsection