Add per-store managers for Woo Business accounts.
Deploy Ladill Woo Manager / deploy (push) Successful in 39s
Deploy Ladill Woo Manager / deploy (push) Successful in 39s
Agencies can invite store-scoped managers via Identity, with access limited to one WooCommerce store while owners retain full multi-store control. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
<x-slot name="title">Settings</x-slot>
|
||||
|
||||
<x-settings.page description="Account links and preferences for Woo Manager.">
|
||||
@include('woo.settings._store-team-section')
|
||||
|
||||
<x-settings.card title="Integrations">
|
||||
<p class="text-sm text-slate-600">See which WooCommerce marketing and shipping extensions are installed on your store.</p>
|
||||
<a href="{{ route('woo.integrations.index') }}"
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
@if (! empty($isStoreOwner))
|
||||
<x-settings.card id="store-team" title="Store managers" description="Invite a client or teammate to manage one WooCommerce store in Ladill — they cannot see your other stores. Business plan only.">
|
||||
@if (! empty($canManageStoreTeam) && ($hasStoreTeamFeatures ?? false))
|
||||
<form method="POST" action="{{ route('woo.team.store') }}" class="grid gap-4 md:grid-cols-2">
|
||||
@csrf
|
||||
<div class="md:col-span-2">
|
||||
<label for="team_email" class="text-sm font-medium text-slate-700">Email address</label>
|
||||
<input type="email" id="team_email" name="email" value="{{ old('email') }}" required
|
||||
placeholder="client@example.com"
|
||||
class="mt-1.5 block w-full rounded-xl border-slate-300 text-sm shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
|
||||
</div>
|
||||
<div class="md:col-span-2">
|
||||
<label for="team_store_id" class="text-sm font-medium text-slate-700">Store access</label>
|
||||
<select id="team_store_id" name="woo_store_id" required
|
||||
class="mt-1.5 block w-full rounded-xl border-slate-300 text-sm shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
|
||||
<option value="">Select a store…</option>
|
||||
@foreach ($teamStores as $store)
|
||||
<option value="{{ $store->id }}" @selected((int) old('woo_store_id') === $store->id)>
|
||||
{{ $store->site_name ?? parse_url($store->site_url, PHP_URL_HOST) }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<p class="mt-1 text-xs text-slate-400">Managers only see orders, products, and settings for this store.</p>
|
||||
</div>
|
||||
<div class="md:col-span-2 flex justify-end">
|
||||
<button type="submit" class="rounded-xl bg-indigo-600 px-4 py-2 text-sm font-semibold text-white hover:bg-indigo-700">Send invite</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="mt-6 border-t border-slate-100 pt-5">
|
||||
<h3 class="text-sm font-semibold text-slate-900">Store managers</h3>
|
||||
@if (($members ?? collect())->isEmpty())
|
||||
<p class="mt-2 text-sm text-slate-500">No store managers yet. Invite a client above.</p>
|
||||
@else
|
||||
<div class="mt-3 overflow-x-auto">
|
||||
<table class="min-w-full text-sm">
|
||||
<thead class="text-left text-xs uppercase text-slate-500">
|
||||
<tr>
|
||||
<th class="pb-2 pr-4">Member</th>
|
||||
<th class="pb-2 pr-4">Store</th>
|
||||
<th class="pb-2 pr-4">Role</th>
|
||||
<th class="pb-2"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-100">
|
||||
@foreach ($members as $member)
|
||||
@php
|
||||
$display = str_contains($member->user_ref, '@')
|
||||
? $member->user_ref
|
||||
: (\App\Models\User::where('public_id', $member->user_ref)->value('email') ?? $member->user_ref);
|
||||
@endphp
|
||||
<tr>
|
||||
<td class="py-3 pr-4">{{ $display }}</td>
|
||||
<td class="py-3 pr-4">{{ $member->store?->site_name ?? $member->store?->site_url ?? '—' }}</td>
|
||||
<td class="py-3 pr-4">{{ $roles[$member->role] ?? $member->role }}</td>
|
||||
<td class="py-3 text-right">
|
||||
@if ($member->user_ref !== auth()->user()->public_id && $member->user_ref !== strtolower((string) auth()->user()->email))
|
||||
<form method="POST" action="{{ route('woo.team.destroy', $member) }}" class="inline" onsubmit="return confirm('Remove this store manager?');">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="text-red-600 hover:text-red-800">Remove</button>
|
||||
</form>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@else
|
||||
<p class="rounded-xl bg-amber-50 px-4 py-3 text-sm text-amber-900">
|
||||
Per-store managers require
|
||||
<a href="{{ route('woo.pro.index') }}" class="font-semibold underline">Ladill Woo Manager Business</a>.
|
||||
</p>
|
||||
@endif
|
||||
</x-settings.card>
|
||||
@endif
|
||||
@@ -14,7 +14,7 @@
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@if($stores->isEmpty())
|
||||
@if($stores->isEmpty() && ($isStoreOwner ?? true))
|
||||
<div class="rounded-2xl border border-indigo-100 bg-indigo-50/60 p-6">
|
||||
<div class="flex flex-wrap items-start justify-between gap-4">
|
||||
<div class="max-w-xl">
|
||||
@@ -50,20 +50,22 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
@if($store->status === \App\Models\WooStore::STATUS_ACTIVE)
|
||||
@if(($isStoreOwner ?? true) && $store->status === \App\Models\WooStore::STATUS_ACTIVE)
|
||||
@if($currentStore?->id === $store->id)
|
||||
<span class="rounded-lg bg-indigo-50 px-3 py-1.5 text-xs font-semibold text-indigo-700">Managing now</span>
|
||||
@else
|
||||
@elseif(($wooActiveStores ?? collect())->count() > 1)
|
||||
<form method="post" action="{{ route('woo.stores.switch') }}">
|
||||
@csrf
|
||||
<input type="hidden" name="store" value="{{ $store->id }}">
|
||||
<button type="submit" class="rounded-lg border border-slate-200 px-3 py-1.5 text-xs font-semibold text-slate-700 hover:bg-slate-50">Switch to this store</button>
|
||||
</form>
|
||||
@endif
|
||||
@if($isStoreOwner ?? true)
|
||||
<form method="post" action="{{ route('woo.stores.destroy', $store) }}" onsubmit="return confirm('Disconnect this store?')">
|
||||
@csrf @method('delete')
|
||||
<button type="submit" class="rounded-lg border border-red-200 px-3 py-1.5 text-xs font-semibold text-red-600 hover:bg-red-50">Disconnect</button>
|
||||
</form>
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user