Files
ladill-woo-manager/resources/views/partials/store-switcher.blade.php
T
isaaccladandCursor cebf0d2e61
Deploy Ladill Woo Manager / deploy (push) Successful in 51s
Add Woo Manager Pro with multi-store switching and free-tier limits.
Free: 1 store and 20 products. Pro/Business mirrors Invoice pricing (GHS 49/149)
with wallet renewals, Paystack prepay, session-based store switcher, and scoped UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 01:14:08 +00:00

33 lines
2.9 KiB
PHP

@if(($wooActiveStores ?? collect())->count() > 0)
<div class="relative hidden lg:block" x-data="{ open: false }" @click.outside="open = false">
<button type="button" @click="open = !open"
class="flex max-w-[14rem] items-center gap-2 rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-left text-sm text-slate-700 hover:bg-white">
<svg class="h-4 w-4 shrink-0 text-slate-400" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" d="M13.5 21v-7.5a.75.75 0 0 1 .75-.75h3a.75.75 0 0 1 .75.75V21m-4.5 0H2.36m11.14 0H18m0 0h3.64m-1.39 0V9.349M3.75 21V9.349m0 0a3.001 3.001 0 0 0 3.75-.615A2.993 2.993 0 0 0 9.75 9.75c.896 0 1.7-.393 2.25-1.016a2.993 2.993 0 0 0 2.25 1.016c.896 0 1.7-.393 2.25-1.016a3.001 3.001 0 0 0 3.75.614m-16.5 0a3.004 3.004 0 0 1-.621-4.72L4.318 3.44A1.5 1.5 0 0 1 5.378 3h13.243a1.5 1.5 0 0 1 1.06.44l1.19 1.189a3 3 0 0 1-.621 4.72M6.75 18h3.75a.75.75 0 0 0 .75-.75V13.5a.75.75 0 0 0-.75-.75H6.75a.75.75 0 0 0-.75.75v3.75c0 .414.336.75.75.75Z" />
</svg>
<span class="truncate font-medium">{{ $currentWooStore?->site_name ?? parse_url($currentWooStore?->site_url ?? '', PHP_URL_HOST) ?? 'Select store' }}</span>
<svg class="ml-auto h-4 w-4 shrink-0 text-slate-400" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5"/></svg>
</button>
<div x-show="open" x-cloak x-transition
class="absolute left-0 top-full z-50 mt-2 w-72 overflow-hidden rounded-xl border border-slate-200 bg-white py-1 shadow-lg">
<p class="px-3 py-2 text-xs font-semibold uppercase tracking-wide text-slate-400">Switch store</p>
@foreach($wooActiveStores as $store)
<form method="post" action="{{ route('woo.stores.switch') }}">
@csrf
<input type="hidden" name="store" value="{{ $store->id }}">
<button type="submit"
class="flex w-full items-start gap-2 px-3 py-2 text-left text-sm hover:bg-slate-50 {{ $currentWooStore?->id === $store->id ? 'bg-indigo-50 text-indigo-700' : 'text-slate-700' }}">
<span class="font-medium">{{ $store->site_name ?? parse_url($store->site_url, PHP_URL_HOST) }}</span>
@if($currentWooStore?->id === $store->id)
<span class="ml-auto text-xs text-indigo-600">Active</span>
@endif
</button>
</form>
@endforeach
<div class="border-t border-slate-100 px-3 py-2">
<a href="{{ route('woo.stores.index') }}" class="text-xs font-medium text-indigo-600 hover:text-indigo-800">Manage stores</a>
</div>
</div>
</div>
@endif