@extends('layouts.app') @section('head') @if (request()->boolean('auto')) @endif @endsection @section('content')
{{-- HEADER --}}

{{ __('Uber Eats Orders') }}

{{ __('Orders received via webhook. Total :total, not sent to POS :unsynced.', ['total' => $stats['total'], 'unsynced' => $stats['unsynced']]) }}

{{-- Auto-refresh toggle (meta refresh, preserves filters) --}} @php $autoUrl = request()->fullUrlWithQuery(['auto' => request()->boolean('auto') ? null : 1]); @endphp cached {{ __('Auto refresh:') }} {{ request()->boolean('auto') ? __('On') : __('Off') }} refresh {{ __('Refresh') }}
{{-- FILTERS --}}
@if (request()->boolean('auto')) @endif @if (request()->hasAny(['q', 'status', 'unsynced'])) {{ __('Clear') }} @endif
{{-- ORDERS TABLE --}}
@if ($orders->count() > 0)
@foreach ($orders as $order) @php $status = (string) ($order->status ?? ''); $badge = match (true) { in_array(strtoupper($status), ['ACCEPTED', 'READY_FOR_PICKUP', 'FINISHED', 'COMPLETED', 'DELIVERED'], true) => 'bg-green-100 text-green-700', in_array(strtoupper($status), ['DENIED', 'CANCELED', 'CANCELLED'], true) => 'bg-red-100 text-red-700', in_array(strtoupper($status), ['CREATED', 'PLACED'], true) => 'bg-amber-100 text-amber-700', str_contains(strtolower($status), 'cancel') => 'bg-red-100 text-red-700', $status === '' => 'bg-stone-100 text-stone-500', default => 'bg-blue-100 text-blue-700', }; @endphp @endforeach
{{ __('Order') }} {{ __('Store') }} {{ __('Business') }} {{ __('Status') }} POS {{ __('Order Time') }} {{ __('Received') }}
{{ data_get($order->payload, 'display_id') ?: ('#' . substr($order->order_id, 0, 8)) }}
{{ substr($order->order_id, 0, 8) }}…
{{ $order->store_id ? substr($order->store_id, 0, 8) . '…' : '-' }} {{ $order->integration?->posAccess?->note ?? ($order->pos_service_id ? __('Business #:id', ['id' => $order->pos_service_id]) : '-') }} {{ $status !== '' ? __(strtoupper($status)) : __('unknown') }} @if ($order->synced_to_pos) {{ __('Sent') }} @else {{ __('Pending') }} @endif {{ $order->placed_at ? $order->placed_at->format('d.m.Y H:i') : '-' }} {{ $order->created_at ? $order->created_at->diffForHumans() : '-' }}
{{ $orders->links() }}
@else
local_shipping

{{ __('No orders yet.') }}

{{ __('To generate a test order:') }} php artisan uber-eats:simulate-webhook

@endif
@endsection