Add branch seat selector on Care plan checkout.
Deploy Ladill Care / deploy (push) Successful in 40s
Deploy Ladill Care / deploy (push) Successful in 40s
Let operators pick how many branches to bill next to the monthly/prepaid toggles so Pro and Enterprise totals and charges use branches × per-branch rate.
This commit is contained in:
@@ -62,12 +62,17 @@ class ProController extends Controller
|
||||
->with('success', 'Your organization already has an active paid plan.');
|
||||
}
|
||||
|
||||
$branches = max(1, $plans->activeBranchCount($organization));
|
||||
$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->proPriceTotalMinor($organization),
|
||||
$amountMinor,
|
||||
'pro',
|
||||
'care_pro',
|
||||
'care-pro-'.$organization->id.'-'.now()->format('Y-m-d-His'),
|
||||
@@ -94,12 +99,17 @@ class ProController extends Controller
|
||||
->with('error', "Enterprise requires at least {$min} active branch. Contact sales for custom multi-site onboarding.");
|
||||
}
|
||||
|
||||
$branches = max(1, $plans->activeBranchCount($organization));
|
||||
$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,
|
||||
$plans->enterprisePriceMinor($organization),
|
||||
$amountMinor,
|
||||
'enterprise',
|
||||
'care_enterprise',
|
||||
'care-enterprise-'.$organization->id.'-'.now()->format('Y-m-d-His'),
|
||||
@@ -115,6 +125,7 @@ class ProController extends Controller
|
||||
$validated = $request->validate([
|
||||
'plan' => ['required', 'in:pro,enterprise'],
|
||||
'months' => ['required', 'integer', 'in:6,12,24'],
|
||||
'branches' => ['required', 'integer', 'min:1', 'max:999'],
|
||||
]);
|
||||
|
||||
$organization = $this->organization($request);
|
||||
@@ -133,8 +144,8 @@ class ProController extends Controller
|
||||
->with('error', "Enterprise requires at least {$min} active branch.");
|
||||
}
|
||||
|
||||
$branches = max(1, $plans->activeBranchCount($organization));
|
||||
$monthlyMinor = $plans->monthlyPriceMinor($organization, $plan);
|
||||
$branches = $plans->resolveCheckoutBranches($organization, (int) $validated['branches']);
|
||||
$monthlyMinor = $plans->priceForBranches($plan, $branches);
|
||||
$amountMinor = $monthlyMinor * $months;
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user