Deploy Ladill POS / deploy (push) Successful in 37s
Embed branch list, switching, and team invites on the main settings page; dedicated routes redirect back with anchors. Co-authored-by: Cursor <cursoragent@cursor.com>
89 lines
5.5 KiB
PHP
89 lines
5.5 KiB
PHP
<x-settings.card id="team" title="Team & branch access" description="Invite cashiers and managers to this POS account. Cashiers must be assigned to a branch — they can only use the register and view sales for that location.">
|
|
@if (! empty($canManageTeam) && $hasTeamFeatures)
|
|
<form method="POST" action="{{ route('pos.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="cashier@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>
|
|
<label for="team_role" class="text-sm font-medium text-slate-700">Role</label>
|
|
<select id="team_role" name="role"
|
|
x-data
|
|
x-on:change="$dispatch('team-role-changed', $event.target.value)"
|
|
class="mt-1.5 block w-full rounded-xl border-slate-300 text-sm shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
|
|
@foreach ($roles as $key => $label)
|
|
<option value="{{ $key }}" @selected(old('role') === $key)>{{ $label }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div x-data="{ role: @js(old('role', 'cashier')) }" @team-role-changed.window="role = $event.detail">
|
|
<label for="team_location_id" class="text-sm font-medium text-slate-700">Assigned branch</label>
|
|
<select id="team_location_id" name="location_id"
|
|
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="">All branches</option>
|
|
@foreach ($branches as $branch)
|
|
<option value="{{ $branch->id }}" @selected((int) old('location_id') === $branch->id)>{{ $branch->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
<p class="mt-1 text-xs text-slate-400" x-show="role === 'cashier'" x-cloak>
|
|
Required for cashiers — they will only see this branch on the register and in sales.
|
|
</p>
|
|
</div>
|
|
<div class="md:col-span-2 flex justify-end">
|
|
<button type="submit" class="btn-primary">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">Team members</h3>
|
|
@if ($members->isEmpty())
|
|
<p class="mt-2 text-sm text-slate-500">No team members yet. Invite a cashier or manager 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">Role</th>
|
|
<th class="pb-2 pr-4">Branch</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">{{ $roles[$member->role] ?? $member->role }}</td>
|
|
<td class="py-3 pr-4">{{ $member->location?->name ?? 'All branches' }}</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('pos.team.destroy', $member) }}" class="inline" onsubmit="return confirm('Remove this member?');">
|
|
@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">
|
|
Team invites and branch assignment require
|
|
<a href="{{ route('pos.pro.index') }}" class="font-semibold underline">Ladill POS Pro or Business</a>.
|
|
</p>
|
|
@endif
|
|
</x-settings.card>
|