Files
ladill-pos/resources/views/partials/topbar-location-switcher.blade.php
T
isaaccladandCursor 35970dfd2a
Deploy Ladill POS / deploy (push) Successful in 37s
Surface branches and team as explicit settings sections.
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>
2026-07-08 06:46:17 +00:00

31 lines
2.2 KiB
PHP

@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.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>
</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