Harden per-branch billing with seat caps and mid-cycle expansion.
Deploy Ladill Frontdesk / deploy (push) Successful in 55s

Enforce billed_branches when adding or reactivating branches, charge
wallet for extra seats mid-cycle, fix Settings for Enterprise, and
cover multi-branch checkout and renewal amounts in tests.
This commit is contained in:
isaacclad
2026-07-16 08:08:10 +00:00
parent bdbf572f19
commit 59433f2b7b
8 changed files with 449 additions and 24 deletions
@@ -116,6 +116,19 @@
.
</p>
<p class="mt-2 text-xs text-slate-400">SMS host alerts bill at platform rates from your wallet.</p>
@if ($canManage)
<form method="post" action="{{ route('frontdesk.pro.expand-branches') }}" class="mt-4 space-y-2"
x-data="{ seats: {{ (int) $billedBranches + 1 }}, rate: {{ (int) $proPricePerBranchMinor }}, current: {{ (int) $billedBranches }} }">
@csrf
<label class="flex items-center justify-between gap-2 text-xs font-medium text-slate-600">
<span>Increase allotment</span>
<input type="number" name="branches" x-model.number="seats" min="{{ (int) $billedBranches + 1 }}" max="999"
class="w-20 rounded-md border-slate-300 py-1 text-center text-sm focus:border-indigo-500 focus:ring-indigo-500">
</label>
<button type="submit" class="btn-secondary w-full text-sm"
x-text="'Add seats — {{ $currency }} ' + (((Math.max(current + 1, seats) - current) * rate) / 100).toLocaleString() + ' from wallet'"></button>
</form>
@endif
@elseif ($canManage)
<form x-show="billing === 'monthly'" method="post" action="{{ route('frontdesk.pro.subscribe') }}">
@csrf
@@ -171,6 +184,19 @@
@endif
.
</p>
@if ($canManage)
<form method="post" action="{{ route('frontdesk.pro.expand-branches') }}" class="mt-4 space-y-2"
x-data="{ seats: {{ (int) $billedBranches + 1 }}, rate: {{ (int) $enterprisePricePerBranchMinor }}, current: {{ (int) $billedBranches }} }">
@csrf
<label class="flex items-center justify-between gap-2 text-xs font-medium text-slate-300">
<span>Increase allotment</span>
<input type="number" name="branches" x-model.number="seats" min="{{ (int) $billedBranches + 1 }}" max="999"
class="w-20 rounded-md border-slate-500 bg-slate-800 py-1 text-center text-sm text-white focus:border-amber-400 focus:ring-amber-400">
</label>
<button type="submit" class="w-full rounded-xl border border-amber-300/40 bg-slate-800 px-4 py-2 text-sm font-semibold text-amber-200 hover:bg-slate-700"
x-text="'Add seats — {{ $currency }} ' + (((Math.max(current + 1, seats) - current) * rate) / 100).toLocaleString() + ' from wallet'"></button>
</form>
@endif
@elseif ($canManage)
@if ($canSubscribeEnterprise)
<form x-show="billing === 'monthly'" method="post" action="{{ route('frontdesk.pro.subscribe-enterprise') }}">