Bill Frontdesk Pro and Enterprise per branch.
Deploy Ladill Frontdesk / deploy (push) Successful in 47s
Deploy Ladill Frontdesk / deploy (push) Successful in 47s
Pro is GHS 990/branch/mo and Enterprise is GHS 1990/branch/mo, with the Care-style branch selector UI, self-serve Enterprise checkout, and renewal charges scaled to billed branches.
This commit is contained in:
@@ -26,6 +26,7 @@ class ProController extends Controller
|
||||
? Carbon::parse($settings['plan_expires_at'])
|
||||
: null;
|
||||
$planKey = $plans->planKey($organization);
|
||||
$branchCount = max(1, $plans->activeBranchCount($organization));
|
||||
|
||||
return view('frontdesk.pro.index', [
|
||||
'organization' => $organization,
|
||||
@@ -34,10 +35,17 @@ class ProController extends Controller
|
||||
'isEnterprise' => $planKey === 'enterprise',
|
||||
'hasPaidPlan' => $plans->hasPaidPlan($organization),
|
||||
'canManage' => $canManage,
|
||||
'proPriceMinor' => $plans->proPriceMinor(),
|
||||
'proPricePerBranchMinor' => $plans->proPricePerBranchMinor(),
|
||||
'proPriceMinor' => $plans->proPriceTotalMinor($organization),
|
||||
'enterprisePricePerBranchMinor' => $plans->enterprisePricePerBranchMinor(),
|
||||
'enterprisePriceMinor' => $plans->enterprisePriceMinor($organization),
|
||||
'branchCount' => $branchCount,
|
||||
'canSubscribeEnterprise' => $plans->canSubscribeEnterprise($organization),
|
||||
'enterpriseMinBranches' => (int) config('frontdesk.enterprise.min_branches', 1),
|
||||
'prepaidMonths' => (array) config('frontdesk.prepaid_months', [6, 12, 24]),
|
||||
'currency' => (string) config('billing.currency', 'GHS'),
|
||||
'planExpiresAt' => $expiresAt,
|
||||
'billedBranches' => (int) ($settings['billed_branches'] ?? $branchCount),
|
||||
'salesUrl' => ladill_platform_url('contact-sales'),
|
||||
]);
|
||||
}
|
||||
@@ -52,20 +60,60 @@ class ProController extends Controller
|
||||
->with('success', 'Your organization already has an active paid plan.');
|
||||
}
|
||||
|
||||
if ($plans->isEnterprise($organization)) {
|
||||
return redirect()->route('frontdesk.pro.index')
|
||||
->with('success', 'Your organization is on Frontdesk Enterprise.');
|
||||
}
|
||||
$validated = $request->validate([
|
||||
'branches' => ['required', 'integer', 'min:1', 'max:999'],
|
||||
]);
|
||||
|
||||
$branches = $plans->resolveCheckoutBranches($organization, (int) $validated['branches']);
|
||||
$amountMinor = $plans->priceForBranches('pro', $branches);
|
||||
|
||||
return $this->chargeMonthlyWallet(
|
||||
$organization,
|
||||
$billing,
|
||||
$plans->proPriceMinor(),
|
||||
$amountMinor,
|
||||
'pro',
|
||||
'frontdesk_pro',
|
||||
'frontdesk-pro-'.$organization->id.'-'.now()->format('Y-m-d-His'),
|
||||
'Ladill Frontdesk Pro — monthly subscription',
|
||||
'Ladill Frontdesk Pro — '.$branches.' branch(es) monthly',
|
||||
'Welcome to Frontdesk Pro — active for one month.',
|
||||
$branches,
|
||||
);
|
||||
}
|
||||
|
||||
public function subscribeEnterprise(Request $request, PlanService $plans, BillingClient $billing): RedirectResponse
|
||||
{
|
||||
$this->authorizeAbility($request, 'settings.manage');
|
||||
$organization = $this->organization($request);
|
||||
|
||||
if ($plans->hasPaidPlan($organization)) {
|
||||
return redirect()->route('frontdesk.pro.index')
|
||||
->with('success', 'Your organization already has an active paid plan.');
|
||||
}
|
||||
|
||||
if (! $plans->canSubscribeEnterprise($organization)) {
|
||||
$min = (int) config('frontdesk.enterprise.min_branches', 1);
|
||||
|
||||
return redirect()->route('frontdesk.pro.index')
|
||||
->with('error', "Enterprise requires at least {$min} active branch. Add a branch or contact sales.");
|
||||
}
|
||||
|
||||
$validated = $request->validate([
|
||||
'branches' => ['required', 'integer', 'min:1', 'max:999'],
|
||||
]);
|
||||
|
||||
$branches = $plans->resolveCheckoutBranches($organization, (int) $validated['branches']);
|
||||
$amountMinor = $plans->priceForBranches('enterprise', $branches);
|
||||
|
||||
return $this->chargeMonthlyWallet(
|
||||
$organization,
|
||||
$billing,
|
||||
$amountMinor,
|
||||
'enterprise',
|
||||
'frontdesk_enterprise',
|
||||
'frontdesk-enterprise-'.$organization->id.'-'.now()->format('Y-m-d-His'),
|
||||
'Ladill Frontdesk Enterprise — '.$branches.' branch(es) monthly',
|
||||
'Welcome to Frontdesk Enterprise — active for one month.',
|
||||
$branches,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -73,27 +121,41 @@ class ProController extends Controller
|
||||
{
|
||||
$this->authorizeAbility($request, 'settings.manage');
|
||||
$validated = $request->validate([
|
||||
'plan' => ['required', 'in:pro'],
|
||||
'plan' => ['required', 'in:pro,enterprise'],
|
||||
'months' => ['required', 'integer', 'in:6,12,24'],
|
||||
'branches' => ['required', 'integer', 'min:1', 'max:999'],
|
||||
]);
|
||||
|
||||
$organization = $this->organization($request);
|
||||
if ($plans->hasPaidPlan($organization) || $plans->isEnterprise($organization)) {
|
||||
if ($plans->hasPaidPlan($organization)) {
|
||||
return redirect()->route('frontdesk.pro.index')
|
||||
->with('success', 'Your organization already has an active plan.');
|
||||
}
|
||||
|
||||
$plan = $validated['plan'];
|
||||
$months = (int) $validated['months'];
|
||||
$amountMinor = $plans->proPriceMinor() * $months;
|
||||
|
||||
if ($plan === 'enterprise' && ! $plans->canSubscribeEnterprise($organization)) {
|
||||
$min = (int) config('frontdesk.enterprise.min_branches', 1);
|
||||
|
||||
return redirect()->route('frontdesk.pro.index')
|
||||
->with('error', "Enterprise requires at least {$min} active branch.");
|
||||
}
|
||||
|
||||
$branches = $plans->resolveCheckoutBranches($organization, (int) $validated['branches']);
|
||||
$amountMinor = $plans->priceForBranches($plan, $branches) * $months;
|
||||
|
||||
try {
|
||||
$checkout = $billing->initiatePlanCheckout(
|
||||
$organization->owner_ref,
|
||||
'pro',
|
||||
$plan,
|
||||
$months,
|
||||
$amountMinor,
|
||||
route('frontdesk.pro.paystack.callback'),
|
||||
['organization_id' => $organization->id],
|
||||
[
|
||||
'organization_id' => $organization->id,
|
||||
'billed_branches' => $branches,
|
||||
],
|
||||
);
|
||||
} catch (\Throwable) {
|
||||
return redirect()->route('frontdesk.pro.index')
|
||||
@@ -140,11 +202,18 @@ class ProController extends Controller
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$plan = (string) ($result['plan'] ?? 'pro');
|
||||
$months = (int) ($result['months'] ?? 0);
|
||||
$this->activatePrepaidPlan($organization, 'pro', $months);
|
||||
$branches = isset($metadata['billed_branches'])
|
||||
? (int) $metadata['billed_branches']
|
||||
: max(1, $plans->activeBranchCount($organization));
|
||||
|
||||
$this->activatePrepaidPlan($organization, $plan, $months, $branches);
|
||||
|
||||
$label = $plan === 'enterprise' ? 'Frontdesk Enterprise' : 'Frontdesk Pro';
|
||||
|
||||
return redirect()->route('frontdesk.pro.index')
|
||||
->with('success', "Frontdesk Pro is active for {$months} months.");
|
||||
->with('success', "{$label} is active for {$months} months.");
|
||||
}
|
||||
|
||||
private function chargeMonthlyWallet(
|
||||
@@ -156,6 +225,7 @@ class ProController extends Controller
|
||||
string $reference,
|
||||
string $description,
|
||||
string $successMessage,
|
||||
int $billedBranches,
|
||||
): RedirectResponse {
|
||||
try {
|
||||
if (! $billing->canAfford($organization->owner_ref, $priceMinor)) {
|
||||
@@ -184,23 +254,29 @@ class ProController extends Controller
|
||||
$settings['plan'] = $plan;
|
||||
$settings['auto_renew'] = true;
|
||||
$settings['billing_method'] = 'wallet_monthly';
|
||||
$settings['billed_branches'] = $billedBranches;
|
||||
$settings['plan_expires_at'] = now()
|
||||
->addDays((int) config('frontdesk.pro.period_days', 30))
|
||||
->toIso8601String();
|
||||
unset($settings['plan_renewal_error']);
|
||||
unset($settings['plan_renewal_error'], $settings['enterprise_billed_branches']);
|
||||
$organization->update(['settings' => $settings]);
|
||||
|
||||
return redirect()->route('frontdesk.pro.index')->with('success', $successMessage);
|
||||
}
|
||||
|
||||
private function activatePrepaidPlan(Organization $organization, string $plan, int $months): void
|
||||
{
|
||||
private function activatePrepaidPlan(
|
||||
Organization $organization,
|
||||
string $plan,
|
||||
int $months,
|
||||
int $billedBranches,
|
||||
): void {
|
||||
$settings = $organization->settings ?? [];
|
||||
$settings['plan'] = $plan;
|
||||
$settings['auto_renew'] = false;
|
||||
$settings['billing_method'] = 'paystack_prepaid';
|
||||
$settings['billed_branches'] = $billedBranches;
|
||||
$settings['plan_expires_at'] = now()->addMonths($months)->toIso8601String();
|
||||
unset($settings['plan_renewal_error']);
|
||||
unset($settings['plan_renewal_error'], $settings['enterprise_billed_branches']);
|
||||
$organization->update(['settings' => $settings]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Services\Frontdesk;
|
||||
|
||||
use App\Models\Branch;
|
||||
use App\Models\Device;
|
||||
use App\Models\Organization;
|
||||
use Carbon\Carbon;
|
||||
@@ -32,10 +33,9 @@ class PlanService
|
||||
return $this->planKey($organization) === 'enterprise';
|
||||
}
|
||||
|
||||
/** Self-serve paid plans only — enterprise is sales-led. */
|
||||
public function hasPaidPlan(Organization $organization): bool
|
||||
{
|
||||
return $this->planKey($organization) === 'pro';
|
||||
return in_array($this->planKey($organization), ['pro', 'enterprise'], true);
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
@@ -49,7 +49,7 @@ class PlanService
|
||||
];
|
||||
}
|
||||
|
||||
/** Null means unlimited included host emails (Pro). */
|
||||
/** Null means unlimited included host emails (Pro / Enterprise). */
|
||||
public function freeEmailsPerMonth(Organization $organization): ?int
|
||||
{
|
||||
$value = config('frontdesk.plans.'.$this->planKey($organization).'.free_emails_per_month', 100);
|
||||
@@ -57,6 +57,14 @@ class PlanService
|
||||
return $value === null ? null : (int) $value;
|
||||
}
|
||||
|
||||
public function activeBranchCount(Organization $organization): int
|
||||
{
|
||||
return Branch::query()
|
||||
->where('organization_id', $organization->id)
|
||||
->where('is_active', true)
|
||||
->count();
|
||||
}
|
||||
|
||||
public function canAddBranch(Organization $organization, int $currentCount): bool
|
||||
{
|
||||
$limit = config('frontdesk.plans.'.$this->planKey($organization).'.max_branches');
|
||||
@@ -86,8 +94,59 @@ class PlanService
|
||||
return in_array($feature, $features, true);
|
||||
}
|
||||
|
||||
public function proPricePerBranchMinor(): int
|
||||
{
|
||||
return (int) config(
|
||||
'frontdesk.plans.pro.price_minor_per_branch',
|
||||
config('frontdesk.plans.pro.price_minor', 99000),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Per-branch rate (legacy callers treated this as a flat monthly fee).
|
||||
*
|
||||
* @deprecated Prefer proPricePerBranchMinor() / priceForBranches().
|
||||
*/
|
||||
public function proPriceMinor(): int
|
||||
{
|
||||
return (int) config('frontdesk.plans.pro.price_minor', 7900);
|
||||
return $this->proPricePerBranchMinor();
|
||||
}
|
||||
|
||||
public function enterprisePricePerBranchMinor(): int
|
||||
{
|
||||
return (int) config('frontdesk.plans.enterprise.price_minor_per_branch', 199000);
|
||||
}
|
||||
|
||||
public function proPriceTotalMinor(Organization $organization): int
|
||||
{
|
||||
return $this->priceForBranches('pro', $this->activeBranchCount($organization));
|
||||
}
|
||||
|
||||
public function enterprisePriceMinor(Organization $organization): int
|
||||
{
|
||||
return $this->priceForBranches('enterprise', $this->activeBranchCount($organization));
|
||||
}
|
||||
|
||||
public function priceForBranches(string $plan, int $branches): int
|
||||
{
|
||||
$branches = max(1, $branches);
|
||||
$rate = $plan === 'enterprise'
|
||||
? $this->enterprisePricePerBranchMinor()
|
||||
: $this->proPricePerBranchMinor();
|
||||
|
||||
return $branches * $rate;
|
||||
}
|
||||
|
||||
public function resolveCheckoutBranches(Organization $organization, int $requested): int
|
||||
{
|
||||
$branches = max(1, $requested);
|
||||
$active = max(1, $this->activeBranchCount($organization));
|
||||
|
||||
return max($branches, $active);
|
||||
}
|
||||
|
||||
public function canSubscribeEnterprise(Organization $organization): bool
|
||||
{
|
||||
return $this->activeBranchCount($organization) >= (int) config('frontdesk.enterprise.min_branches', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class ProRenewalService
|
||||
public function dueOrganizations(): Collection
|
||||
{
|
||||
return Organization::query()
|
||||
->where('settings->plan', 'pro')
|
||||
->whereIn('settings->plan', ['pro', 'enterprise'])
|
||||
->whereNotNull('settings->plan_expires_at')
|
||||
->get()
|
||||
->filter(fn (Organization $organization) => $this->isDue($organization));
|
||||
@@ -27,7 +27,7 @@ class ProRenewalService
|
||||
public function isDue(Organization $organization): bool
|
||||
{
|
||||
$settings = $organization->settings ?? [];
|
||||
if (($settings['plan'] ?? '') !== 'pro') {
|
||||
if (! in_array($settings['plan'] ?? '', ['pro', 'enterprise'], true)) {
|
||||
return false;
|
||||
}
|
||||
if (array_key_exists('auto_renew', $settings) && $settings['auto_renew'] === false) {
|
||||
@@ -47,24 +47,32 @@ class ProRenewalService
|
||||
}
|
||||
|
||||
$settings = $organization->settings ?? [];
|
||||
$price = $this->plans->proPriceMinor();
|
||||
$reference = 'frontdesk-pro-'.$organization->id.'-'.now()->format('YmdHis');
|
||||
$plan = (string) ($settings['plan'] ?? 'pro');
|
||||
$branches = max(
|
||||
1,
|
||||
(int) ($settings['billed_branches'] ?? 0),
|
||||
$this->plans->activeBranchCount($organization),
|
||||
);
|
||||
$price = $this->plans->priceForBranches($plan, $branches);
|
||||
$reference = 'frontdesk-'.$plan.'-'.$organization->id.'-'.now()->format('YmdHis');
|
||||
$label = $plan === 'enterprise' ? 'Enterprise' : 'Pro';
|
||||
|
||||
try {
|
||||
$charged = $this->billing->debit(
|
||||
$organization->owner_ref,
|
||||
$price,
|
||||
'frontdesk_pro_renewal',
|
||||
'frontdesk_'.$plan.'_renewal',
|
||||
$reference,
|
||||
'Ladill Frontdesk Pro — monthly renewal',
|
||||
'Ladill Frontdesk '.$label.' — '.$branches.' branch(es) monthly renewal',
|
||||
);
|
||||
} catch (\Throwable) {
|
||||
$charged = false;
|
||||
}
|
||||
|
||||
if ($charged) {
|
||||
$settings['plan'] = 'pro';
|
||||
$settings['plan'] = $plan;
|
||||
$settings['auto_renew'] = true;
|
||||
$settings['billed_branches'] = $branches;
|
||||
$settings['plan_expires_at'] = now()
|
||||
->addDays((int) config('frontdesk.pro.period_days', 30))
|
||||
->toIso8601String();
|
||||
@@ -78,7 +86,7 @@ class ProRenewalService
|
||||
$graceEnd = $expires->copy()->addDays((int) config('frontdesk.pro.grace_days', 3));
|
||||
if ($graceEnd->isPast()) {
|
||||
$settings['plan'] = 'free';
|
||||
unset($settings['plan_expires_at']);
|
||||
unset($settings['plan_expires_at'], $settings['billed_branches']);
|
||||
$settings['plan_renewal_error'] = 'Suspended after failed renewal.';
|
||||
} else {
|
||||
$settings['plan_renewal_error'] = 'Renewal failed — top up your wallet.';
|
||||
|
||||
+13
-6
@@ -141,8 +141,15 @@ return [
|
||||
],
|
||||
'pro' => [
|
||||
'label' => 'Pro',
|
||||
// Aligned with Queue Pro (GHS 990/mo).
|
||||
'price_minor' => (int) env('FRONTDESK_PRO_PRICE_MINOR', 99000),
|
||||
// GHS 990/branch/mo (legacy FRONTDESK_PRO_PRICE_MINOR still honored).
|
||||
'price_minor_per_branch' => (int) env(
|
||||
'FRONTDESK_PRO_PRICE_PER_BRANCH_MINOR',
|
||||
env('FRONTDESK_PRO_PRICE_MINOR', 99000),
|
||||
),
|
||||
'price_minor' => (int) env(
|
||||
'FRONTDESK_PRO_PRICE_PER_BRANCH_MINOR',
|
||||
env('FRONTDESK_PRO_PRICE_MINOR', 99000),
|
||||
),
|
||||
'max_branches' => null,
|
||||
'max_kiosk_devices' => null,
|
||||
'free_emails_per_month' => env('FRONTDESK_PRO_FREE_EMAILS_PER_MONTH') !== null
|
||||
@@ -161,8 +168,8 @@ return [
|
||||
],
|
||||
'enterprise' => [
|
||||
'label' => 'Enterprise',
|
||||
// Aligned with Queue Enterprise (GHS 2990+/mo per branch).
|
||||
'price_minor_per_branch' => (int) env('FRONTDESK_ENTERPRISE_PRICE_PER_BRANCH_MINOR', 299000),
|
||||
// GHS 1990/branch/mo.
|
||||
'price_minor_per_branch' => (int) env('FRONTDESK_ENTERPRISE_PRICE_PER_BRANCH_MINOR', 199000),
|
||||
'max_branches' => null,
|
||||
'max_kiosk_devices' => null,
|
||||
'free_emails_per_month' => null,
|
||||
@@ -180,7 +187,7 @@ return [
|
||||
],
|
||||
|
||||
'enterprise' => [
|
||||
'min_branches' => (int) env('FRONTDESK_ENTERPRISE_MIN_BRANCHES', 2),
|
||||
'min_branches' => (int) env('FRONTDESK_ENTERPRISE_MIN_BRANCHES', 1),
|
||||
],
|
||||
|
||||
'prepaid_months' => [6, 12, 24],
|
||||
@@ -344,7 +351,7 @@ return [
|
||||
|
||||
'upgrade_banner' => [
|
||||
'title' => 'Unlock Frontdesk Pro or Enterprise',
|
||||
'description' => 'Unlimited kiosks, webhooks, iCal sync & scheduled reports — from GHS 990/mo.',
|
||||
'description' => 'Unlimited kiosks, webhooks, iCal sync & scheduled reports — from GHS 990/branch/mo.',
|
||||
'route' => 'frontdesk.pro.index',
|
||||
],
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<div class="mt-6 rounded-2xl border border-indigo-200 bg-indigo-50 p-6">
|
||||
<h2 class="font-semibold text-indigo-900">Upgrade to Pro</h2>
|
||||
<p class="mt-2 text-sm text-indigo-800">
|
||||
GHS {{ number_format($proPriceMinor / 100, 0) }} / month from your Ladill wallet — unlimited branches and kiosks, integrations, scheduled reports, and more.
|
||||
GHS {{ number_format($proPriceMinor / 100, 0) }} / branch / month from your Ladill wallet — unlimited kiosks, integrations, scheduled reports, and more.
|
||||
</p>
|
||||
<a href="{{ route('frontdesk.pro.index') }}" class="btn-primary mt-4 inline-flex">View Pro plans</a>
|
||||
<p class="mt-3 text-xs text-indigo-700">
|
||||
|
||||
@@ -1,9 +1,30 @@
|
||||
<x-app-layout title="Plans" heading="Frontdesk plans">
|
||||
@php
|
||||
$proPrice = number_format($proPriceMinor / 100, 0);
|
||||
$proPerBranch = number_format($proPricePerBranchMinor / 100, 0);
|
||||
$enterprisePerBranch = number_format($enterprisePricePerBranchMinor / 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('upsell'))
|
||||
<div class="rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800">{{ session('upsell') }}</div>
|
||||
@endif
|
||||
@@ -17,10 +38,11 @@
|
||||
<div class="rounded-2xl border border-slate-200 bg-white px-6 py-5">
|
||||
<h1 class="text-2xl font-bold text-slate-900">Choose your Frontdesk 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 for Pro.
|
||||
Enterprise is custom — <a href="{{ $salesUrl }}" class="font-medium text-indigo-600 hover:text-indigo-800" target="_blank" rel="noopener">contact sales</a> for multi-site onboarding.
|
||||
Pay monthly from your Ladill wallet, or prepay 6/12/24 months via Paystack.
|
||||
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>
|
||||
@@ -29,7 +51,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">
|
||||
@@ -51,13 +86,22 @@
|
||||
{{-- Pro --}}
|
||||
<div class="flex flex-col rounded-2xl border border-slate-200 bg-white p-6 {{ $planKey === 'pro' ? 'ring-2 ring-indigo-500' : '' }}">
|
||||
<p class="text-xs font-semibold uppercase tracking-wide text-indigo-600">Pro</p>
|
||||
<x-plan-tier-price :currency="$currency" :monthly-minor="$proPriceMinor" />
|
||||
<p class="mt-1 text-sm text-slate-500" x-show="billing === 'monthly'">Unlimited branches & kiosks</p>
|
||||
<x-plan-tier-price
|
||||
:currency="$currency"
|
||||
:monthly-minor="$proPricePerBranchMinor"
|
||||
:monthly-display="$proPerBranch"
|
||||
monthly-suffix="/branch/mo"
|
||||
/>
|
||||
<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>Unlimited host email alerts</li>
|
||||
<li>Webhooks & iCal feeds</li>
|
||||
<li>Scheduled report exports</li>
|
||||
<li>Custom badge templates</li>
|
||||
<li>Unlimited kiosks (billed per branch)</li>
|
||||
</ul>
|
||||
<div class="mt-6">
|
||||
@if ($planKey === 'pro')
|
||||
@@ -66,20 +110,27 @@
|
||||
@if ($planExpiresAt)
|
||||
until <strong>{{ $planExpiresAt->format('d M Y') }}</strong>
|
||||
@endif
|
||||
@if ($billedBranches > 0)
|
||||
· billed for {{ $billedBranches }} {{ str('branch')->plural($billedBranches) }}
|
||||
@endif
|
||||
.
|
||||
</p>
|
||||
<p class="mt-2 text-xs text-slate-400">SMS host alerts bill at platform rates from your wallet.</p>
|
||||
@elseif ($canManage)
|
||||
<form x-show="billing === 'monthly'" method="post" action="{{ route('frontdesk.pro.subscribe') }}">
|
||||
@csrf
|
||||
<button class="btn-primary w-full">Upgrade to Pro — monthly 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 wallet'"></button>
|
||||
</form>
|
||||
<template x-for="months in @js($prepaidMonths)" :key="months">
|
||||
<form x-show="billing == months" method="post" action="{{ route('frontdesk.pro.subscribe-prepaid') }}">
|
||||
@csrf
|
||||
<input type="hidden" name="plan" value="pro">
|
||||
<input type="hidden" name="months" :value="months">
|
||||
<button type="submit" class="btn-primary w-full" x-text="'Pay ' + months + ' months via Paystack'"></button>
|
||||
<input type="hidden" name="branches" :value="branchCount()">
|
||||
<button type="submit" class="btn-primary w-full"
|
||||
x-text="'Pay ' + months + ' months via Paystack — {{ $currency }} ' + fmt(proTotal() * months)"></button>
|
||||
</form>
|
||||
</template>
|
||||
@else
|
||||
@@ -91,8 +142,17 @@
|
||||
{{-- Enterprise --}}
|
||||
<div class="flex flex-col rounded-2xl border border-slate-200 bg-gradient-to-b from-slate-900 to-slate-800 p-6 text-white {{ $planKey === 'enterprise' ? 'ring-2 ring-amber-400' : '' }}">
|
||||
<p class="text-xs font-semibold uppercase tracking-wide text-amber-300">Enterprise</p>
|
||||
<p class="mt-2 text-3xl font-bold">Custom</p>
|
||||
<p class="mt-1 text-sm text-slate-300">Multi-site · SLA · dedicated onboarding</p>
|
||||
<x-plan-tier-price
|
||||
:currency="$currency"
|
||||
:monthly-minor="$enterprisePricePerBranchMinor"
|
||||
:monthly-display="$enterprisePerBranch"
|
||||
monthly-suffix="/branch/mo"
|
||||
dark
|
||||
/>
|
||||
<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>
|
||||
<li>Custom integrations</li>
|
||||
@@ -106,16 +166,35 @@
|
||||
@if ($planExpiresAt)
|
||||
until <strong class="text-white">{{ $planExpiresAt->format('d M Y') }}</strong>
|
||||
@endif
|
||||
@if ($billedBranches > 0)
|
||||
· billed for {{ $billedBranches }} {{ str('branch')->plural($billedBranches) }}
|
||||
@endif
|
||||
.
|
||||
</p>
|
||||
@elseif ($canManage)
|
||||
<a href="{{ $salesUrl }}" target="_blank" rel="noopener"
|
||||
class="block w-full rounded-xl bg-amber-400 px-4 py-2.5 text-center text-sm font-semibold text-slate-900 hover:bg-amber-300">
|
||||
Contact sales
|
||||
</a>
|
||||
<p class="text-center text-xs text-amber-200">Includes one-time setup fee</p>
|
||||
@if ($canSubscribeEnterprise)
|
||||
<form x-show="billing === 'monthly'" method="post" action="{{ route('frontdesk.pro.subscribe-enterprise') }}">
|
||||
@csrf
|
||||
<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 wallet'"></button>
|
||||
</form>
|
||||
<template x-for="months in @js($prepaidMonths)" :key="'ent-' + months">
|
||||
<form x-show="billing == months" method="post" action="{{ route('frontdesk.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 }} ' + fmt(entTotal() * months)"></button>
|
||||
</form>
|
||||
</template>
|
||||
@else
|
||||
<p class="text-sm text-slate-300">Add an active branch to subscribe, or contact sales.</p>
|
||||
@endif
|
||||
<a href="{{ $salesUrl }}" target="_blank" rel="noopener" class="block text-center text-xs text-amber-200 underline hover:text-white">Contact sales for setup & SLA</a>
|
||||
@else
|
||||
<p class="text-sm text-slate-300">Ask an admin to contact sales.</p>
|
||||
<p class="text-sm text-slate-300">Ask an admin to upgrade.</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
<div class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
|
||||
<p class="text-sm leading-6 text-slate-600">
|
||||
@if ($isPro)
|
||||
<span class="font-medium text-indigo-700">{{ $plan['label'] ?? 'Pro' }}</span> — unlimited branches and kiosks, integrations, and unlimited host emails (SMS still billed per segment).
|
||||
<span class="font-medium text-indigo-700">{{ $plan['label'] ?? 'Pro' }}</span> — unlimited kiosks, integrations, and unlimited host emails, billed per branch (SMS still billed per segment).
|
||||
@else
|
||||
<span class="font-medium text-slate-900">Free</span> — one branch, one kiosk, core check-in and badges. Host alerts billed after {{ number_format($freeEmailAllowance) }} free emails per month.
|
||||
@endif
|
||||
</p>
|
||||
@if (! $isPro)
|
||||
<a href="{{ route('frontdesk.pro.index') }}" class="btn-primary shrink-0 text-sm">Upgrade to Pro (GHS {{ number_format($proPriceMinor / 100, 0) }}/mo)</a>
|
||||
<a href="{{ route('frontdesk.pro.index') }}" class="btn-primary shrink-0 text-sm">Upgrade to Pro (GHS {{ number_format($proPriceMinor / 100, 0) }}/branch/mo)</a>
|
||||
@endif
|
||||
</div>
|
||||
<dl class="mt-5 grid gap-4 border-t border-slate-100 pt-5 text-sm sm:grid-cols-2">
|
||||
|
||||
@@ -178,6 +178,7 @@ Route::middleware(['auth', 'platform.session'])->group(function () {
|
||||
|
||||
Route::get('/pro', [ProController::class, 'index'])->name('frontdesk.pro.index');
|
||||
Route::post('/pro/subscribe', [ProController::class, 'subscribe'])->name('frontdesk.pro.subscribe');
|
||||
Route::post('/pro/subscribe-enterprise', [ProController::class, 'subscribeEnterprise'])->name('frontdesk.pro.subscribe-enterprise');
|
||||
Route::post('/pro/subscribe-prepaid', [ProController::class, 'subscribePrepaid'])->name('frontdesk.pro.subscribe-prepaid');
|
||||
Route::get('/pro/paystack/callback', [ProController::class, 'paystackCallback'])->name('frontdesk.pro.paystack.callback');
|
||||
|
||||
|
||||
@@ -59,11 +59,11 @@ class FrontdeskProTest extends TestCase
|
||||
->get(route('frontdesk.pro.index'))
|
||||
->assertOk()
|
||||
->assertSee('Choose your Frontdesk plan')
|
||||
->assertSee('GHS 79')
|
||||
->assertSee('Custom')
|
||||
->assertSee('Upgrade to Pro')
|
||||
->assertSee('GHS 990')
|
||||
->assertSee('/branch/mo')
|
||||
->assertSee('GHS 1,990')
|
||||
->assertSee('Enterprise')
|
||||
->assertSee('Contact sales');
|
||||
->assertSee('Branches');
|
||||
}
|
||||
|
||||
public function test_sidebar_shows_upgrade_to_pro_on_dashboard(): void
|
||||
@@ -84,13 +84,16 @@ class FrontdeskProTest extends TestCase
|
||||
]);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('frontdesk.pro.subscribe'))
|
||||
->post(route('frontdesk.pro.subscribe'), [
|
||||
'branches' => 1,
|
||||
])
|
||||
->assertRedirect(route('frontdesk.pro.index'))
|
||||
->assertSessionHas('success');
|
||||
|
||||
$settings = $this->organization->fresh()->settings;
|
||||
$this->assertSame('pro', $settings['plan']);
|
||||
$this->assertSame('wallet_monthly', $settings['billing_method']);
|
||||
$this->assertSame(1, (int) ($settings['billed_branches'] ?? 0));
|
||||
}
|
||||
|
||||
public function test_subscribe_prepaid_redirects_to_paystack(): void
|
||||
@@ -106,6 +109,7 @@ class FrontdeskProTest extends TestCase
|
||||
->post(route('frontdesk.pro.subscribe-prepaid'), [
|
||||
'plan' => 'pro',
|
||||
'months' => 12,
|
||||
'branches' => 1,
|
||||
])
|
||||
->assertRedirect('https://checkout.paystack.com/test');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user