Files
ladill-woo-manager/resources/views/woo/orders/index.blade.php
T
isaaccladandCursor e3ef23218f
Deploy Ladill Woo Manager / deploy (push) Successful in 39s
Fix Woo sync: exempt webhooks from CSRF and backfill on connect.
Auto-import catalog and orders after store activation, add manual order sync, and allow WooCommerce webhooks without CSRF tokens.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 00:15:37 +00:00

82 lines
5.2 KiB
PHP

<x-user-layout>
<x-slot name="title">Orders</x-slot>
<div class="space-y-6">
<div class="flex flex-wrap items-start justify-between gap-4">
<div>
<h1 class="text-xl font-semibold text-slate-900">Orders</h1>
<p class="mt-1 text-sm text-slate-500">WooCommerce orders synced for fulfillment.</p>
</div>
@if($stores->isNotEmpty())
<form method="post" action="{{ route('woo.orders.sync') }}">
@csrf
<input type="hidden" name="store" value="{{ $storeFilter ?: $stores->first()->id }}">
<button type="submit" class="rounded-xl border border-slate-200 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">Sync from store</button>
</form>
@endif
</div>
<form method="get" class="flex flex-wrap items-end gap-3">
<div class="min-w-[12rem] flex-1 max-w-md">
<input type="search" name="q" value="{{ $search }}" placeholder="Search customer, order #…"
class="w-full rounded-xl border-slate-200 text-sm focus:border-indigo-500 focus:ring-indigo-500">
</div>
@if($stores->isNotEmpty())
<select name="store" class="rounded-xl border-slate-200 text-sm" onchange="this.form.submit()">
<option value="">All stores</option>
@foreach($stores as $store)
<option value="{{ $store->id }}" @selected((string) $storeFilter === (string) $store->id)>{{ $store->site_name ?? $store->site_url }}</option>
@endforeach
</select>
@endif
</form>
<div class="overflow-hidden rounded-2xl border border-slate-200 bg-white">
@if($orders->isEmpty())
<p class="px-6 py-10 text-sm text-slate-500">No orders yet. Use <strong>Sync from store</strong> to import existing orders, or wait for new WooCommerce order events.</p>
@else
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-slate-100 text-sm">
<thead class="bg-slate-50 text-left text-xs font-semibold uppercase tracking-wide text-slate-500">
<tr>
<th class="px-6 py-3">When</th>
<th class="px-6 py-3">Order</th>
<th class="px-6 py-3">Customer</th>
<th class="px-6 py-3">Store</th>
<th class="px-6 py-3">Total</th>
<th class="px-6 py-3">WC status</th>
<th class="px-6 py-3">Fulfillment</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-100">
@foreach($orders as $order)
<tr>
<td class="px-6 py-4 text-slate-600">{{ $order->created_at->format('D j M, g:i A') }}</td>
<td class="px-6 py-4 font-medium text-slate-900">#{{ $order->order_number }}</td>
<td class="px-6 py-4">
<p class="font-medium text-slate-900">{{ $order->customer_name ?: '—' }}</p>
@if($order->customer_email)<p class="text-xs text-slate-500">{{ $order->customer_email }}</p>@endif
</td>
<td class="px-6 py-4 text-slate-600">{{ $order->store?->site_name ?? parse_url($order->store?->site_url ?? '', PHP_URL_HOST) }}</td>
<td class="px-6 py-4 text-slate-900">{{ $order->totalFormatted() }}</td>
<td class="px-6 py-4 text-slate-600">{{ $order->wc_status ?: '—' }}</td>
<td class="px-6 py-4">
<form method="post" action="{{ route('woo.orders.update-status', $order) }}" class="inline">
@csrf @method('patch')
<select name="fulfillment_status" onchange="this.form.submit()" class="rounded-lg border-slate-200 text-xs">
@foreach(\App\Models\WooOrder::FULFILLMENT_STATUSES as $val => $label)
<option value="{{ $val }}" @selected(($order->fulfillment_status ?? 'new') === $val)>{{ $label }}</option>
@endforeach
</select>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@if($orders->hasPages())<div class="border-t border-slate-100 px-6 py-4">{{ $orders->links() }}</div>@endif
@endif
</div>
</div>
</x-user-layout>