Add multi-branch POS with team roles and branch-scoped cashiers.
Deploy Ladill POS / deploy (push) Successful in 1m58s

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>
This commit is contained in:
isaacclad
2026-07-08 06:05:30 +00:00
co-authored by Cursor
parent cac7c60415
commit 9d7dac6c24
34 changed files with 1434 additions and 30 deletions
@@ -21,6 +21,10 @@
@includeIf('partials.topbar-widgets-mid')
@include('partials.topbar-location-switcher')
@includeIf('partials.topbar-account-switcher')
<div class="hidden h-8 w-px bg-slate-200 lg:block"></div>
<div class="relative hidden lg:block" x-data="{ profileOpen: false }" @click.outside="profileOpen = false" @keydown.escape.window="profileOpen = false">
@@ -0,0 +1,30 @@
@if (isset($accessibleLocations) && $accessibleLocations->count() > 1)
<div x-data="{ branchOpen: false }" @click.outside="branchOpen = false" class="relative hidden lg:block">
<button type="button" @click="branchOpen = !branchOpen"
class="inline-flex items-center gap-1.5 rounded-full border border-slate-200 px-3 py-2 text-sm text-slate-700 transition hover:bg-slate-50">
<span class="max-w-[140px] truncate">{{ $actingLocation->name ?? 'Branch' }}</span>
<svg class="h-4 w-4 text-slate-400" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="m19 9-7 7-7-7"/></svg>
</button>
<div x-show="branchOpen" x-cloak x-transition
class="absolute right-0 z-30 mt-2 w-60 rounded-xl border border-slate-200 bg-white p-1 shadow-lg">
<p class="px-3 py-1.5 text-[10px] font-bold uppercase tracking-widest text-slate-400">Switch branch</p>
@foreach ($accessibleLocations as $branch)
<form method="POST" action="{{ route('pos.location.switch') }}">
@csrf
<input type="hidden" name="location" value="{{ $branch->id }}">
<button type="submit" class="flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-sm hover:bg-slate-50 {{ $branch->id === ($actingLocation->id ?? null) ? 'font-semibold text-indigo-700' : 'text-slate-700' }}">
<span class="truncate">{{ $branch->name }}</span>
@if ($branch->id === ($actingLocation->id ?? null))<span class="text-indigo-600"></span>@endif
</button>
</form>
@endforeach
@if (! empty($canManageBranches))
<div class="mt-1 border-t border-slate-100 pt-1">
<a href="{{ route('pos.branches.index') }}" class="block rounded-lg px-3 py-2 text-sm text-indigo-600 hover:bg-slate-50">Manage branches</a>
</div>
@endif
</div>
</div>
@elseif (isset($actingLocation))
<span class="hidden rounded-full border border-slate-200 px-3 py-2 text-sm text-slate-600 lg:inline-flex">{{ $actingLocation->name }}</span>
@endif
@@ -0,0 +1,32 @@
<x-app-layout title="Add branch">
<x-settings.page description="Create a new register location.">
<x-settings.card title="New branch">
<form method="POST" action="{{ route('pos.branches.store') }}" class="space-y-4">
@csrf
<div>
<label for="name" class="text-sm font-medium text-slate-700">Branch name</label>
<input type="text" id="name" name="name" value="{{ old('name') }}" required
placeholder="e.g. Airport kiosk"
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="currency" class="text-sm font-medium text-slate-700">Currency</label>
<input type="text" id="currency" name="currency" value="{{ old('currency', config('pos.default_currency', 'GHS')) }}" maxlength="3" required
class="mt-1.5 block w-full rounded-xl border-slate-300 text-sm uppercase shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
</div>
<div>
<label for="service_style" class="text-sm font-medium text-slate-700">Service style</label>
<select id="service_style" name="service_style"
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="retail" @selected(old('service_style') === 'retail')>Retail</option>
<option value="restaurant" @selected(old('service_style') === 'restaurant')>Restaurant / café</option>
</select>
</div>
<div class="flex justify-end gap-3">
<a href="{{ route('pos.branches.index') }}" class="rounded-xl border border-slate-200 px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">Cancel</a>
<button type="submit" class="btn-primary">Create branch</button>
</div>
</form>
</x-settings.card>
</x-settings.page>
</x-app-layout>
@@ -0,0 +1,42 @@
<x-app-layout title="Edit branch">
<x-settings.page description="Update branch details.">
<x-settings.card title="Edit {{ $location->name }}">
<form method="POST" action="{{ route('pos.branches.update', $location) }}" class="space-y-4">
@csrf
@method('PUT')
<div>
<label for="name" class="text-sm font-medium text-slate-700">Branch name</label>
<input type="text" id="name" name="name" value="{{ old('name', $location->name) }}" 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="currency" class="text-sm font-medium text-slate-700">Currency</label>
<input type="text" id="currency" name="currency" value="{{ old('currency', $location->currency) }}" maxlength="3" required
class="mt-1.5 block w-full rounded-xl border-slate-300 text-sm uppercase shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
</div>
<div>
<label for="service_style" class="text-sm font-medium text-slate-700">Service style</label>
<select id="service_style" name="service_style"
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="retail" @selected(old('service_style', $location->service_style) === 'retail')>Retail</option>
<option value="restaurant" @selected(old('service_style', $location->service_style) === 'restaurant')>Restaurant / café</option>
</select>
</div>
<label class="flex items-center gap-2 text-sm text-slate-700">
<input type="checkbox" name="is_default" value="1" @checked(old('is_default', $location->is_default))
class="rounded border-slate-300 text-indigo-600 focus:ring-indigo-500">
Default branch for admins
</label>
<div class="flex justify-end gap-3">
<a href="{{ route('pos.branches.index') }}" class="rounded-xl border border-slate-200 px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">Cancel</a>
<button type="submit" class="btn-primary">Save branch</button>
</div>
</form>
<form method="POST" action="{{ route('pos.branches.destroy', $location) }}" class="mt-4 border-t border-slate-100 pt-4" onsubmit="return confirm('Remove this branch?');">
@csrf
@method('DELETE')
<button type="submit" class="text-sm font-medium text-red-600 hover:text-red-800">Delete branch</button>
</form>
</x-settings.card>
</x-settings.page>
</x-app-layout>
@@ -0,0 +1,58 @@
<x-app-layout title="Branches">
<x-settings.page description="Manage registers and locations across your business.">
<div class="mb-4 flex flex-wrap items-center justify-between gap-3">
<div class="flex flex-wrap gap-2 text-sm">
<a href="{{ route('pos.settings') }}" class="text-slate-500 hover:text-slate-800">Branch settings</a>
<span class="text-slate-300">/</span>
<span class="font-medium text-slate-900">All branches</span>
@if (! empty($canManageTeam))
<a href="{{ route('pos.team.index') }}" class="ml-3 text-indigo-600 hover:text-indigo-800">Team</a>
@endif
</div>
@if ($canAddBranch)
<a href="{{ route('pos.branches.create') }}" class="btn-primary">Add branch</a>
@endif
</div>
<x-settings.card title="Branches" description="Each branch has its own register, receipts, and sales history.">
@if ($branches->isEmpty())
<p class="text-sm text-slate-500">No branches yet.</p>
@else
<ul class="divide-y divide-slate-100">
@foreach ($branches as $branch)
<li class="flex items-center justify-between gap-4 py-3">
<div>
<p class="font-medium text-slate-900">
{{ $branch->name }}
@if ($branch->is_default)
<span class="ml-2 rounded-full bg-slate-100 px-2 py-0.5 text-[10px] font-semibold uppercase text-slate-500">Default</span>
@endif
</p>
<p class="text-xs text-slate-500">
{{ strtoupper($branch->currency) }}
· {{ $branch->isRestaurant() ? 'Restaurant' : 'Retail' }}
</p>
</div>
<div class="flex items-center gap-3">
@if (($actingLocation->id ?? null) !== $branch->id)
<form method="POST" action="{{ route('pos.location.switch') }}">
@csrf
<input type="hidden" name="location" value="{{ $branch->id }}">
<button type="submit" class="text-sm font-medium text-indigo-600 hover:text-indigo-800">Switch</button>
</form>
@endif
<a href="{{ route('pos.branches.edit', $branch) }}" class="text-sm font-medium text-slate-600 hover:text-slate-900">Edit</a>
</div>
</li>
@endforeach
</ul>
@endif
@unless ($hasMultiLocation)
<p class="mt-4 rounded-xl bg-amber-50 px-4 py-3 text-sm text-amber-900">
Multi-branch POS is available on <a href="{{ route('pos.pro.index') }}" class="font-semibold underline">Pro or Business</a>.
</p>
@endunless
</x-settings.card>
</x-settings.page>
</x-app-layout>
+15 -2
View File
@@ -1,6 +1,19 @@
<x-app-layout title="Settings">
<x-settings.page description="Register location, receipt footer, and catalog imports.">
<x-settings.card title="Location" description="Register name, currency, service style, and receipt footer.">
<x-settings.page description="Branch settings, receipt footer, and catalog imports.">
<div class="mb-4 flex flex-wrap items-center justify-between gap-3">
<p class="text-sm text-slate-600">
Editing <span class="font-semibold text-slate-900">{{ $location->name }}</span>
</p>
<div class="flex flex-wrap gap-3 text-sm">
@if (! empty($canManageBranches))
<a href="{{ route('pos.branches.index') }}" class="font-medium text-indigo-600 hover:text-indigo-800">Branches</a>
@endif
@if (! empty($canManageTeam))
<a href="{{ route('pos.team.index') }}" class="font-medium text-indigo-600 hover:text-indigo-800">Team</a>
@endif
</div>
</div>
<x-settings.card title="Branch settings" description="Register name, currency, service style, and receipt footer for this branch.">
<form method="POST" action="{{ route('pos.settings.update') }}" enctype="multipart/form-data" class="space-y-4">
@csrf
@method('PUT')
+88
View File
@@ -0,0 +1,88 @@
<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>