Files
ladill-pos/resources/views/pos/team/index.blade.php
T
isaaccladandCursor 9d7dac6c24
Deploy Ladill POS / deploy (push) Successful in 1m58s
Add multi-branch POS with team roles and branch-scoped cashiers.
Pro and Business users can manage branches, invite cashiers with branch assignment, and switch registers; sales and register flows respect acting location.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-08 06:05:30 +00:00

89 lines
5.5 KiB
PHP

<x-app-layout title="Team">
<x-settings.page description="Invite cashiers and managers, and assign them to branches.">
<div class="mb-4 flex flex-wrap gap-2 text-sm">
<a href="{{ route('pos.settings') }}" class="text-slate-500 hover:text-slate-800">Settings</a>
<span class="text-slate-300">/</span>
<span class="font-medium text-slate-900">Team</span>
@if (! empty($canManageBranches))
<a href="{{ route('pos.branches.index') }}" class="ml-3 text-indigo-600 hover:text-indigo-800">Branches</a>
@endif
</div>
<x-settings.card title="Invite team member" description="Invited users sign in with Ladill and get access to this POS account.">
<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="email" class="text-sm font-medium text-slate-700">Email</label>
<input type="email" id="email" name="email" value="{{ old('email') }}" 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">
</div>
<div>
<label for="role" class="text-sm font-medium text-slate-700">Role</label>
<select id="role" name="role" x-data x-on:change="$dispatch('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')) }" @role-changed.window="role = $event.detail">
<label for="location_id" class="text-sm font-medium text-slate-700">Branch</label>
<select id="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 limits the register and sales to one branch.</p>
</div>
<div class="md:col-span-2 flex justify-end">
<button type="submit" class="btn-primary">Send invite</button>
</div>
</form>
</x-settings.card>
<x-settings.card title="Team members" class="mt-6">
@if ($members->isEmpty())
<p class="text-sm text-slate-500">No team members yet.</p>
@else
<div class="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
</x-settings.card>
</x-settings.page>
</x-app-layout>