Files
ladill-woo-manager/resources/views/woo/integrations/index.blade.php
T
isaaccladandCursor 644c3d9cde
Deploy Ladill Woo Manager / deploy (push) Successful in 1m5s
Add catalog sync trigger, metrics, and shipping label actions to integrations.
Surfaces actionable controls in Ladill instead of status-only cards: sync catalogs via the plugin proxy, show channel metrics, and link to orders/labels for fulfillment.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-08 11:28:42 +00:00

194 lines
11 KiB
PHP

<x-user-layout>
<x-slot name="title">Integrations</x-slot>
<div class="space-y-6">
<div class="flex flex-wrap items-start justify-between gap-4">
<div>
<h1 class="hidden text-xl font-semibold text-slate-900 lg:block">Integrations</h1>
<p class="mt-1 text-sm text-slate-500">
@if($store)
Marketing and shipping extensions for {{ $store->site_name ?? $store->site_url }}.
@else
Connect a store to see which WooCommerce extensions are installed and configured.
@endif
</p>
</div>
@if($store)
<form method="post" action="{{ route('woo.integrations.refresh') }}">
@csrf
<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">
Refresh status
</button>
</form>
@endif
@if($store && ! $reachable)
<span class="rounded-full bg-amber-50 px-3 py-1 text-xs font-medium text-amber-800 ring-1 ring-amber-200">
Store unreachable update the Ladill plugin on WordPress
</span>
@endif
</div>
@if(session('success'))
<div class="rounded-xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-800">
{{ session('success') }}
</div>
@endif
@if(session('error'))
<div class="rounded-xl border border-rose-200 bg-rose-50 px-4 py-3 text-sm text-rose-800">
{{ session('error') }}
</div>
@endif
@if(! $store)
<div class="rounded-2xl border border-dashed border-slate-200 bg-white px-6 py-10 text-center">
<p class="text-sm text-slate-600">No active store selected.</p>
<a href="{{ route('woo.stores.index') }}"
class="mt-4 inline-flex items-center gap-2 text-sm font-medium text-indigo-600 hover:text-indigo-800">
Connect a WooCommerce store
<span aria-hidden="true">&rarr;</span>
</a>
</div>
@endif
@if($store && ($cached ?? false))
<p class="text-xs text-slate-400">Status cached for {{ (int) config('woo.integrations_cache_ttl_seconds', 300) }} seconds. Use Refresh status for the latest from WordPress.</p>
@endif
<div class="grid gap-4 lg:grid-cols-2">
@foreach($integrations as $integration)
@php
$state = $integration['state'];
$metrics = $integration['metrics'] ?? [];
$badge = match ($state) {
'connected' => ['Connected', 'bg-emerald-50 text-emerald-700 ring-emerald-200'],
'available', 'needs_setup' => $integration['installed']
? ['Needs setup', 'bg-amber-50 text-amber-800 ring-amber-200']
: ['Not installed', 'bg-slate-100 text-slate-600 ring-slate-200'],
'not_installed' => ['Not installed', 'bg-slate-100 text-slate-600 ring-slate-200'],
'no_store' => ['No store', 'bg-slate-100 text-slate-600 ring-slate-200'],
default => ['Unavailable', 'bg-rose-50 text-rose-700 ring-rose-200'],
};
@endphp
<article class="flex h-full flex-col rounded-2xl border border-slate-200 bg-white p-5 shadow-sm">
<div class="flex items-start justify-between gap-3">
<div>
<p class="text-xs font-semibold uppercase tracking-wide text-slate-400">{{ $integration['category'] }}</p>
<h2 class="mt-1 text-base font-semibold text-slate-900">{{ $integration['name'] }}</h2>
</div>
<span class="shrink-0 rounded-full px-2.5 py-1 text-xs font-medium ring-1 {{ $badge[1] }}">{{ $badge[0] }}</span>
</div>
<p class="mt-3 flex-1 text-sm text-slate-600">{{ $integration['description'] }}</p>
@if($integration['summary'])
<p class="mt-3 text-sm text-slate-500">{{ $integration['summary'] }}</p>
@endif
@if(! empty($metrics['available']))
<dl class="mt-4 grid grid-cols-2 gap-3 rounded-xl bg-slate-50 p-3 text-xs">
@if(isset($metrics['published_products']))
<div>
<dt class="font-medium text-slate-500">Published products</dt>
<dd class="mt-0.5 text-sm font-semibold text-slate-900">{{ number_format((int) $metrics['published_products']) }}</dd>
</div>
@endif
@if(isset($metrics['synced_products']))
<div>
<dt class="font-medium text-slate-500">Synced to channel</dt>
<dd class="mt-0.5 text-sm font-semibold text-slate-900">{{ number_format((int) $metrics['synced_products']) }}</dd>
</div>
@endif
@if(isset($metrics['pending_products']))
<div>
<dt class="font-medium text-slate-500">Pending sync</dt>
<dd class="mt-0.5 text-sm font-semibold text-slate-900">{{ number_format((int) $metrics['pending_products']) }}</dd>
</div>
@endif
@if(isset($metrics['orders_awaiting_fulfillment']))
<div>
<dt class="font-medium text-slate-500">Awaiting fulfillment</dt>
<dd class="mt-0.5 text-sm font-semibold text-slate-900">{{ number_format((int) $metrics['orders_awaiting_fulfillment']) }}</dd>
</div>
@endif
@if(isset($metrics['labeled_orders']))
<div>
<dt class="font-medium text-slate-500">Labeled orders</dt>
<dd class="mt-0.5 text-sm font-semibold text-slate-900">{{ number_format((int) $metrics['labeled_orders']) }}</dd>
</div>
@endif
@if(! empty($metrics['catalog_sync_status']) && $metrics['catalog_sync_status'] !== 'unknown')
<div class="col-span-2">
<dt class="font-medium text-slate-500">Catalog sync</dt>
<dd class="mt-0.5 text-sm font-semibold capitalize text-slate-900">{{ str_replace('_', ' ', $metrics['catalog_sync_status']) }}</dd>
</div>
@endif
</dl>
@endif
@if($integration['key'] === 'shipping' && ! empty($integration['details']['woocommerce_shipping']))
<p class="mt-2 text-xs text-slate-500">
WooCommerce Shipping
@if(! empty($integration['details']['labels_ready']))
· labels enabled
@else
· labels not connected
@endif
</p>
@endif
<div class="mt-5 flex flex-wrap items-center gap-2">
@if($integration['supports_catalog_sync'] && $integration['connected'] && $reachable)
<form method="post" action="{{ route('woo.integrations.sync', $integration['key']) }}">
@csrf
<button type="submit"
class="inline-flex items-center rounded-xl bg-slate-900 px-4 py-2 text-sm font-semibold text-white hover:bg-slate-800">
Sync catalog
</button>
</form>
@endif
@if($integration['supports_label_actions'] && $store)
<a href="{{ route('woo.orders.index') }}"
class="inline-flex items-center rounded-xl border border-slate-200 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">
View orders
</a>
@endif
@if($integration['key'] === 'shipping' && ! empty($integration['details']['labels_manage_url']))
<a href="{{ $integration['details']['labels_manage_url'] }}" target="_blank" rel="noopener noreferrer"
class="inline-flex items-center rounded-xl border border-slate-200 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">
Manage labels
</a>
@endif
@if($integration['manage_url'])
<a href="{{ $integration['manage_url'] }}" target="_blank" rel="noopener noreferrer"
class="inline-flex items-center rounded-xl bg-indigo-600 px-4 py-2 text-sm font-semibold text-white hover:bg-indigo-700">
Manage in WordPress
</a>
@elseif($integration['install_url'] && in_array($state, ['not_installed', 'no_store', 'unavailable'], true))
<a href="{{ $integration['install_url'] }}" target="_blank" rel="noopener noreferrer"
class="inline-flex items-center rounded-xl border border-slate-200 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">
Get extension
</a>
@endif
@if($integration['docs_url'])
<a href="{{ $integration['docs_url'] }}" target="_blank" rel="noopener noreferrer"
class="inline-flex items-center rounded-xl px-3 py-2 text-sm font-medium text-indigo-600 hover:text-indigo-800">
Docs
</a>
@endif
</div>
</article>
@endforeach
</div>
<div class="rounded-2xl border border-slate-200 bg-slate-50 px-5 py-4 text-sm text-slate-600">
Ladill surfaces official WooCommerce extensions on your store. Use <strong>Sync catalog</strong> to trigger a product feed sync from Ladill, or open <strong>Manage in WordPress</strong> for OAuth, ads, and advanced setup.
</div>
</div>
</x-user-layout>