Files
ladill-woo-manager/resources/views/woo/settings/_store-team-section.blade.php
T
isaaccladandCursor 09359ca86a
Deploy Ladill Woo Manager / deploy (push) Successful in 39s
Add per-store managers for Woo Business accounts.
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>
2026-07-08 07:51:08 +00:00

80 lines
5.2 KiB
PHP

@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