Deploy Ladill Woo Manager / deploy (push) Successful in 24s
Sync full image sets through the plugin, with upload/URL support in the product editor and thumbnails in the list. Co-authored-by: Cursor <cursoragent@cursor.com>
100 lines
6.2 KiB
PHP
100 lines
6.2 KiB
PHP
<x-user-layout>
|
|
<x-slot name="title">Products</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">Products</h1>
|
|
<p class="mt-1 text-sm text-slate-500">Manage WooCommerce products synced from your connected stores.</p>
|
|
</div>
|
|
<div class="flex flex-wrap items-center gap-2">
|
|
@if($stores->isNotEmpty())
|
|
<form method="post" action="{{ route('woo.products.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
|
|
<a href="{{ route('woo.products.create', ['store' => $storeFilter]) }}" class="rounded-xl bg-indigo-600 px-4 py-2 text-sm font-semibold text-white hover:bg-indigo-700">New product</a>
|
|
</div>
|
|
</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 name or SKU…"
|
|
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
|
|
<select name="status" class="rounded-xl border-slate-200 text-sm" onchange="this.form.submit()">
|
|
<option value="">All statuses</option>
|
|
@foreach(\App\Models\WooProduct::STATUSES as $val => $label)
|
|
<option value="{{ $val }}" @selected($statusFilter === $val)>{{ $label }}</option>
|
|
@endforeach
|
|
</select>
|
|
</form>
|
|
|
|
<div class="overflow-hidden rounded-2xl border border-slate-200 bg-white">
|
|
@if($products->isEmpty())
|
|
<p class="px-6 py-10 text-sm text-slate-500">No products yet. Sync from a connected store or create one here.</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">Image</th>
|
|
<th class="px-6 py-3">Product</th>
|
|
<th class="px-6 py-3">Store</th>
|
|
<th class="px-6 py-3">SKU</th>
|
|
<th class="px-6 py-3">Price</th>
|
|
<th class="px-6 py-3">Stock</th>
|
|
<th class="px-6 py-3">Status</th>
|
|
<th class="px-6 py-3"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-slate-100">
|
|
@foreach($products as $product)
|
|
<tr>
|
|
<td class="px-6 py-4">
|
|
@if($product->thumbnailUrl())
|
|
<img src="{{ $product->thumbnailUrl() }}" alt="" class="h-12 w-12 rounded-lg border border-slate-200 object-cover">
|
|
@else
|
|
<span class="inline-flex h-12 w-12 items-center justify-center rounded-lg border border-dashed border-slate-200 bg-slate-50 text-[10px] text-slate-400">No image</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-6 py-4">
|
|
<p class="font-medium text-slate-900">{{ $product->name }}</p>
|
|
@if($product->categoryNames())
|
|
<p class="text-xs text-slate-500">{{ implode(', ', $product->categoryNames()) }}</p>
|
|
@endif
|
|
</td>
|
|
<td class="px-6 py-4 text-slate-600">{{ $product->store?->site_name ?? parse_url($product->store?->site_url ?? '', PHP_URL_HOST) }}</td>
|
|
<td class="px-6 py-4 text-slate-600">{{ $product->sku ?: '—' }}</td>
|
|
<td class="px-6 py-4 text-slate-900">{{ $product->priceFormatted() }}</td>
|
|
<td class="px-6 py-4 text-slate-600">
|
|
@if($product->manage_stock)
|
|
{{ $product->stock_quantity ?? 0 }}
|
|
@else
|
|
—
|
|
@endif
|
|
</td>
|
|
<td class="px-6 py-4 text-slate-600">{{ $product->statusLabel() }}</td>
|
|
<td class="px-6 py-4 text-right">
|
|
<a href="{{ route('woo.products.edit', $product) }}" class="font-medium text-indigo-600 hover:text-indigo-800">Edit</a>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@if($products->hasPages())<div class="border-t border-slate-100 px-6 py-4">{{ $products->links() }}</div>@endif
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</x-user-layout>
|