Surface branches and team as explicit settings sections.
Deploy Ladill POS / deploy (push) Successful in 37s
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>
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
@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>
|
||||
<a href="{{ route('pos.settings') }}#branches" class="block rounded-lg px-3 py-2 text-sm text-indigo-600 hover:bg-slate-50">Manage branches</a>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</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>
|
||||
<a href="{{ route('pos.settings') }}#branches" 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>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
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>
|
||||
<a href="{{ route('pos.settings') }}#branches" class="rounded-xl border border-slate-200 px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">Back</a>
|
||||
<button type="submit" class="btn-primary">Save branch</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -1,19 +1,6 @@
|
||||
<x-app-layout title="Settings">
|
||||
<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.">
|
||||
<x-settings.page description="Configure this branch, manage locations, and invite team members.">
|
||||
<x-settings.card title="This branch" description="Register name, currency, service style, and receipt options for {{ $location->name }}.">
|
||||
<form method="POST" action="{{ route('pos.settings.update') }}" enctype="multipart/form-data" class="space-y-4">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
@@ -98,6 +85,14 @@
|
||||
</form>
|
||||
</x-settings.card>
|
||||
|
||||
<div class="mt-6 space-y-6">
|
||||
@include('pos.settings._branches-section')
|
||||
|
||||
@if (! empty($canManageTeam))
|
||||
@include('pos.settings._team-section')
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@if ($location->isRestaurant())
|
||||
<x-settings.card title="Import catalog" description="Seed your local POS catalog from CRM or Merchant storefronts. (Retail mode reads products live from CRM, so no import is needed.)">
|
||||
<div class="flex flex-wrap gap-3">
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<x-settings.card id="branches" title="Branches" description="Each branch is a separate register with its own receipts, sales, and settings. Switch the active branch here or from the top bar.">
|
||||
@if ($branches->isNotEmpty())
|
||||
<ul class="divide-y divide-slate-100">
|
||||
@foreach ($branches as $branch)
|
||||
<li class="flex items-center justify-between gap-4 py-3 first:pt-0 last:pb-0">
|
||||
<div class="min-w-0">
|
||||
<p class="font-medium text-slate-900">
|
||||
{{ $branch->name }}
|
||||
@if ($branch->id === $location->id)
|
||||
<span class="ml-2 rounded-full bg-indigo-50 px-2 py-0.5 text-[10px] font-semibold uppercase text-indigo-700">Active</span>
|
||||
@endif
|
||||
@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="mt-0.5 text-xs text-slate-500">
|
||||
{{ strtoupper($branch->currency) }}
|
||||
· {{ $branch->isRestaurant() ? 'Restaurant' : 'Retail' }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex shrink-0 items-center gap-3">
|
||||
@if ($branch->id !== $location->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
|
||||
@if (! empty($canManageBranches) && $hasMultiLocation)
|
||||
<a href="{{ route('pos.branches.edit', $branch) }}" class="text-sm font-medium text-slate-600 hover:text-slate-900">Edit</a>
|
||||
@endif
|
||||
</div>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@else
|
||||
<p class="text-sm text-slate-500">No branches yet.</p>
|
||||
@endif
|
||||
|
||||
<div class="mt-4 flex flex-wrap items-center gap-3 border-t border-slate-100 pt-4">
|
||||
@if (! empty($canManageBranches) && $hasMultiLocation && $canAddBranch)
|
||||
<a href="{{ route('pos.branches.create') }}" class="btn-primary">Add branch</a>
|
||||
@endif
|
||||
@unless ($hasMultiLocation)
|
||||
<p class="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>.
|
||||
Your account is limited to one branch.
|
||||
</p>
|
||||
@endunless
|
||||
</div>
|
||||
</x-settings.card>
|
||||
@@ -0,0 +1,88 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user