Files
Mark Gregory 86f2bc75aa Commerce administration dashboard
* Product catalogue
* Product categories
* Physical, digital, service, and bundle product types
* Product variants and option storage
* SKU management
* Product publishing states
* Pricing and comparison pricing
* Inventory quantities
* Low-stock thresholds
* Inventory movement history
* Customer records and addresses
* Orders and order items
* Payment and fulfilment statuses
* Payment transaction storage
* Promotions and coupon codes
* Shipping methods
* Tax rates
* Payment, shipping, tax, and inventory provider contracts
* Default manual payment provider
* Default flat-rate shipping provider
* Public product REST API
* Administration navigation
* Commerce permissions
* Module registration
* Module boot tests
2026-07-24 12:24:12 +01:00

6 lines
4.1 KiB
PHP

<x-layouts.app :title="__('Commerce')"><div class="space-y-8"><div><h1 class="text-2xl font-semibold">Commerce</h1><p class="text-sm text-zinc-500">Catalogue, stock, customers, orders and promotions.</p></div>@if(session('status'))<div class="rounded border border-green-300 bg-green-50 p-3 text-green-800">{{ session('status') }}</div>@endif
<div class="grid gap-4 md:grid-cols-5"><div class="rounded-xl border p-4"><div class="text-sm text-zinc-500">Products</div><div class="text-2xl font-semibold">{{ $products->total() }}</div></div><div class="rounded-xl border p-4"><div class="text-sm text-zinc-500">Orders</div><div class="text-2xl font-semibold">{{ \Modules\Commerce\Models\Order::count() }}</div></div><div class="rounded-xl border p-4"><div class="text-sm text-zinc-500">Revenue</div><div class="text-2xl font-semibold">{{ config('commerce.currency_symbol','£') }}{{ number_format($revenue,2) }}</div></div><div class="rounded-xl border p-4"><div class="text-sm text-zinc-500">Customers</div><div class="text-2xl font-semibold">{{ $customers }}</div></div><div class="rounded-xl border p-4"><div class="text-sm text-zinc-500">Low stock</div><div class="text-2xl font-semibold">{{ $lowStock }}</div></div></div>
<div class="grid gap-6 lg:grid-cols-3"><form method="POST" action="{{ route('administration.commerce.products.store') }}" class="space-y-4 rounded-xl border p-5 lg:col-span-1">@csrf<h2 class="font-semibold">Add product</h2><flux:input name="name" label="Name" required/><div class="grid gap-4 md:grid-cols-2"><flux:input name="sku" label="SKU"/><flux:select name="type" label="Type"><option value="physical">Physical</option><option value="digital">Digital</option><option value="service">Service</option><option value="bundle">Bundle</option></flux:select><flux:input name="price" type="number" step="0.01" min="0" label="Price" required/><flux:input name="stock_quantity" type="number" value="0" label="Stock" required/></div><flux:textarea name="summary" label="Summary"/><flux:select name="status" label="Status"><option value="draft">Draft</option><option value="active">Active</option><option value="archived">Archived</option></flux:select><flux:button type="submit" variant="primary">Create product</flux:button></form>
<div class="overflow-hidden rounded-xl border lg:col-span-2"><table class="w-full text-sm"><thead class="bg-zinc-50"><tr><th class="p-3 text-left">Product</th><th class="p-3 text-left">SKU</th><th class="p-3 text-left">Price</th><th class="p-3 text-left">Stock</th><th class="p-3 text-left">Status</th><th class="p-3"></th></tr></thead><tbody>@forelse($products as $product)<tr class="border-t"><td class="p-3 font-medium">{{ $product->name }}</td><td class="p-3">{{ $product->sku ?: '—' }}</td><td class="p-3">{{ config('commerce.currency_symbol','£') }}{{ number_format($product->price,2) }}</td><td class="p-3">{{ $product->stock_quantity }}</td><td class="p-3">{{ ucfirst($product->status) }}</td><td class="p-3 text-right"><form method="POST" action="{{ route('administration.commerce.products.destroy',$product) }}">@csrf @method('DELETE')<flux:button size="sm" variant="danger" type="submit">Delete</flux:button></form></td></tr>@empty<tr><td colspan="6" class="p-6 text-center text-zinc-500">No products yet.</td></tr>@endforelse</tbody></table></div></div>{{ $products->links() }}
<div class="rounded-xl border p-5"><h2 class="mb-4 font-semibold">Recent orders</h2><div class="overflow-x-auto"><table class="w-full text-sm"><thead><tr><th class="p-2 text-left">Order</th><th class="p-2 text-left">Customer</th><th class="p-2 text-left">Total</th><th class="p-2 text-left">Status</th><th class="p-2 text-left">Payment</th></tr></thead><tbody>@forelse($orders as $order)<tr class="border-t"><td class="p-2 font-medium">{{ $order->number }}</td><td class="p-2">{{ $order->email }}</td><td class="p-2">{{ $order->currency }} {{ number_format($order->grand_total,2) }}</td><td class="p-2">{{ ucfirst($order->status) }}</td><td class="p-2">{{ ucfirst($order->payment_status) }}</td></tr>@empty<tr><td colspan="5" class="p-5 text-center text-zinc-500">No orders yet.</td></tr>@endforelse</tbody></table></div></div></div></x-layouts.app>