Match Care/Frontdesk: branches stepper next to billing period, live totals, and checkout charges for the selected seat count.
This commit is contained in:
@@ -1,12 +1,30 @@
|
||||
<x-app-layout title="Plans" heading="Queue plans">
|
||||
@php
|
||||
$proPerBranch = number_format($proPricePerBranchMinor / 100, 0);
|
||||
$proTotal = number_format($proPriceMinor / 100, 0);
|
||||
$enterprisePerBranch = number_format($enterprisePricePerBranchMinor / 100, 0);
|
||||
$enterpriseTotal = number_format($enterprisePriceMinor / 100, 0);
|
||||
$initialBranches = max(1, (int) $branchCount);
|
||||
@endphp
|
||||
|
||||
<div class="mx-auto max-w-5xl space-y-6" x-data="{ billing: 'monthly' }">
|
||||
<div class="mx-auto max-w-5xl space-y-6"
|
||||
x-data="{
|
||||
billing: 'monthly',
|
||||
branches: {{ $initialBranches }},
|
||||
proPerBranch: {{ (int) $proPricePerBranchMinor }},
|
||||
entPerBranch: {{ (int) $enterprisePricePerBranchMinor }},
|
||||
minBranches: {{ $initialBranches }},
|
||||
proTotal() {
|
||||
return this.proPerBranch * Math.max(this.minBranches, parseInt(this.branches) || this.minBranches);
|
||||
},
|
||||
entTotal() {
|
||||
return this.entPerBranch * Math.max(this.minBranches, parseInt(this.branches) || this.minBranches);
|
||||
},
|
||||
branchCount() {
|
||||
return Math.max(this.minBranches, parseInt(this.branches) || this.minBranches);
|
||||
},
|
||||
fmt(minor) {
|
||||
return (minor / 100).toLocaleString();
|
||||
}
|
||||
}">
|
||||
@if (session('success'))
|
||||
<div class="rounded-xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-800">{{ session('success') }}</div>
|
||||
@endif
|
||||
@@ -18,10 +36,10 @@
|
||||
<h1 class="text-2xl font-bold text-slate-900">Choose your Queue plan</h1>
|
||||
<p class="mt-1 text-sm text-slate-600">
|
||||
Pay monthly from your Ladill wallet, or prepay 6/12/24 months via Paystack.
|
||||
Pro and Enterprise are billed per active branch.
|
||||
Pro and Enterprise are billed per branch — set how many branches to include below.
|
||||
Enterprise includes a one-time setup fee — <a href="{{ $salesUrl }}" class="font-medium text-indigo-600 hover:text-indigo-800" target="_blank" rel="noopener">contact sales</a> for onboarding.
|
||||
</p>
|
||||
<div class="mt-4 flex flex-wrap gap-2">
|
||||
<div class="mt-4 flex flex-wrap items-center gap-2">
|
||||
<button type="button" @click="billing = 'monthly'"
|
||||
:class="billing === 'monthly' ? 'bg-indigo-600 text-white' : 'bg-slate-100 text-slate-700 hover:bg-slate-200'"
|
||||
class="rounded-lg px-3 py-1.5 text-sm font-medium transition">Monthly · wallet</button>
|
||||
@@ -30,7 +48,20 @@
|
||||
:class="billing === '{{ $months }}' ? 'bg-indigo-600 text-white' : 'bg-slate-100 text-slate-700 hover:bg-slate-200'"
|
||||
class="rounded-lg px-3 py-1.5 text-sm font-medium transition">{{ $months }} months · Paystack</button>
|
||||
@endforeach
|
||||
|
||||
<label class="inline-flex items-center gap-2 rounded-lg border border-slate-200 bg-slate-50 px-3 py-1.5 text-sm text-slate-700">
|
||||
<span class="font-medium text-slate-600">Branches</span>
|
||||
<input type="number"
|
||||
min="{{ $initialBranches }}"
|
||||
max="999"
|
||||
x-model.number="branches"
|
||||
@change="if (branches < minBranches) branches = minBranches"
|
||||
class="w-16 rounded-md border-slate-300 py-0.5 text-center text-sm focus:border-indigo-500 focus:ring-indigo-500">
|
||||
</label>
|
||||
</div>
|
||||
<p class="mt-2 text-xs text-slate-500">
|
||||
Minimum is your current active branch count ({{ $initialBranches }}). Totals update live for Pro and Enterprise.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-5 lg:grid-cols-3">
|
||||
@@ -55,16 +86,12 @@
|
||||
<x-plan-tier-price
|
||||
:currency="$currency"
|
||||
:monthly-minor="$proPricePerBranchMinor"
|
||||
:prepaid-minor="$proPriceMinor"
|
||||
:monthly-display="$proPerBranch"
|
||||
monthly-suffix="/branch/mo"
|
||||
/>
|
||||
<p class="mt-1 text-sm text-slate-500" x-show="billing === 'monthly'">
|
||||
@if ($branchCount > 0)
|
||||
{{ $branchCount }} active {{ str('branch')->plural($branchCount) }} = {{ $currency }} {{ $proTotal }}/mo
|
||||
@else
|
||||
Per-branch billing
|
||||
@endif
|
||||
<p class="mt-1 text-sm text-slate-500">
|
||||
<span x-text="branchCount()"></span> branch(es) × {{ $currency }} {{ $proPerBranch }}/branch
|
||||
= {{ $currency }} <span x-text="fmt(proTotal())"></span>/mo
|
||||
</p>
|
||||
<ul class="mt-5 flex-1 space-y-2 text-sm text-slate-700">
|
||||
<li>Advanced routing rules</li>
|
||||
@@ -88,17 +115,18 @@
|
||||
@elseif ($canManage)
|
||||
<form x-show="billing === 'monthly'" method="post" action="{{ route('qms.pro.subscribe') }}">
|
||||
@csrf
|
||||
<button class="btn-primary w-full">
|
||||
Upgrade to Pro — {{ $currency }} {{ $proTotal }}/mo wallet
|
||||
</button>
|
||||
<input type="hidden" name="branches" :value="branchCount()">
|
||||
<button type="submit" class="btn-primary w-full"
|
||||
x-text="'Upgrade to Pro — {{ $currency }} ' + fmt(proTotal()) + '/mo'"></button>
|
||||
</form>
|
||||
<template x-for="months in @js($prepaidMonths)" :key="months">
|
||||
<form x-show="billing == months" method="post" action="{{ route('qms.pro.subscribe-prepaid') }}">
|
||||
@csrf
|
||||
<input type="hidden" name="plan" value="pro">
|
||||
<input type="hidden" name="months" :value="months">
|
||||
<input type="hidden" name="branches" :value="branchCount()">
|
||||
<button type="submit" class="btn-primary w-full"
|
||||
x-text="'Pay ' + months + ' months via Paystack — {{ $currency }} ' + ({{ $proPriceMinor }} * months / 100).toLocaleString()"></button>
|
||||
x-text="'Pay ' + months + ' months via Paystack — {{ $currency }} ' + fmt(proTotal() * months)"></button>
|
||||
</form>
|
||||
</template>
|
||||
@else
|
||||
@@ -113,17 +141,13 @@
|
||||
<x-plan-tier-price
|
||||
:currency="$currency"
|
||||
:monthly-minor="$enterprisePricePerBranchMinor"
|
||||
:prepaid-minor="$enterprisePriceMinor"
|
||||
:monthly-display="$enterprisePerBranch"
|
||||
monthly-suffix="/branch/mo"
|
||||
dark
|
||||
/>
|
||||
<p class="mt-1 text-sm text-slate-300" x-show="billing === 'monthly'">
|
||||
@if ($branchCount > 0)
|
||||
{{ $branchCount }} active {{ str('branch')->plural($branchCount) }} = {{ $currency }} {{ $enterpriseTotal }}/mo
|
||||
@else
|
||||
Per-branch billing for multi-site
|
||||
@endif
|
||||
<p class="mt-1 text-sm text-slate-300">
|
||||
<span x-text="branchCount()"></span> branch(es) × {{ $currency }} {{ $enterprisePerBranch }}/branch
|
||||
= {{ $currency }} <span x-text="fmt(entTotal())"></span>/mo
|
||||
</p>
|
||||
<ul class="mt-5 flex-1 space-y-2 text-sm text-slate-200">
|
||||
<li>Everything in Pro</li>
|
||||
@@ -147,17 +171,18 @@
|
||||
@if ($canSubscribeEnterprise)
|
||||
<form x-show="billing === 'monthly'" method="post" action="{{ route('qms.pro.subscribe-enterprise') }}">
|
||||
@csrf
|
||||
<button class="w-full rounded-xl bg-amber-400 px-4 py-2.5 text-sm font-semibold text-slate-900 hover:bg-amber-300">
|
||||
Upgrade — {{ $currency }} {{ $enterpriseTotal }}/mo wallet
|
||||
</button>
|
||||
<input type="hidden" name="branches" :value="branchCount()">
|
||||
<button type="submit" class="w-full rounded-xl bg-amber-400 px-4 py-2.5 text-sm font-semibold text-slate-900 hover:bg-amber-300"
|
||||
x-text="'Upgrade — {{ $currency }} ' + fmt(entTotal()) + '/mo'"></button>
|
||||
</form>
|
||||
<template x-for="months in @js($prepaidMonths)" :key="'ent-' + months">
|
||||
<form x-show="billing == months" method="post" action="{{ route('qms.pro.subscribe-prepaid') }}">
|
||||
@csrf
|
||||
<input type="hidden" name="plan" value="enterprise">
|
||||
<input type="hidden" name="months" :value="months">
|
||||
<input type="hidden" name="branches" :value="branchCount()">
|
||||
<button type="submit" class="w-full rounded-xl bg-amber-400 px-4 py-2.5 text-sm font-semibold text-slate-900 hover:bg-amber-300"
|
||||
x-text="'Pay ' + months + ' months via Paystack — {{ $currency }} ' + ({{ $enterprisePriceMinor }} * months / 100).toLocaleString()"></button>
|
||||
x-text="'Pay ' + months + ' months via Paystack — {{ $currency }} ' + fmt(entTotal() * months)"></button>
|
||||
</form>
|
||||
</template>
|
||||
@else
|
||||
|
||||
Reference in New Issue
Block a user