Show Care Enterprise upgrade banner to Pro users.
Deploy Ladill Care / deploy (push) Successful in 1m2s
Deploy Ladill Care / deploy (push) Successful in 1m2s
Pro dashboards now pitch Enterprise instead of the Free unlock copy, and plan context is shared with the banner so Pro tenants no longer see Free messaging. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -22,7 +22,14 @@ class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
Event::listen(ServiceEventOccurred::class, PlatformServiceEventListener::class);
|
||||
|
||||
View::composer(['partials.sidebar', 'partials.topbar-desktop-widgets', 'partials.afia', 'components.app-layout'], function ($view) {
|
||||
View::composer([
|
||||
'partials.sidebar',
|
||||
'partials.topbar-desktop-widgets',
|
||||
'partials.afia',
|
||||
'partials.upgrade-banner',
|
||||
'care.dashboard',
|
||||
'components.app-layout',
|
||||
], function ($view) {
|
||||
/** @var User|null $user */
|
||||
$user = auth()->user();
|
||||
$planKey = 'free';
|
||||
|
||||
+12
-3
@@ -320,9 +320,18 @@ return [
|
||||
],
|
||||
|
||||
'upgrade_banner' => [
|
||||
'title' => 'Unlock Care Pro or Enterprise',
|
||||
'description' => 'Pro from GHS 2490/branch/mo — lab, pharmacy, billing, and Queue. Enterprise adds custom multi-dept workflows, analytics, priority support, and AI-assisted healthcare integration.',
|
||||
'route' => 'care.pro.index',
|
||||
'free' => [
|
||||
'title' => 'Unlock Care Pro or Enterprise',
|
||||
'description' => 'Pro from GHS 2490/branch/mo — lab, pharmacy, billing, and Queue. Enterprise adds custom multi-dept workflows, analytics, priority support, and AI-assisted healthcare integration.',
|
||||
'route' => 'care.pro.index',
|
||||
'cta' => 'View plans',
|
||||
],
|
||||
'pro' => [
|
||||
'title' => 'Upgrade to Care Enterprise',
|
||||
'description' => 'Enterprise from GHS 4990/branch/mo — custom multi-dept workflows, assessment analytics, priority support, and AI-assisted healthcare integration on top of your Pro modules.',
|
||||
'route' => 'care.pro.index',
|
||||
'cta' => 'View Enterprise',
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
@php
|
||||
$banner = config('care.upgrade_banner');
|
||||
$canSeeBilling = \App\Support\StaffUx::showBilling(auth()->user());
|
||||
$plan = $planKey ?? 'free';
|
||||
$banner = match ($plan) {
|
||||
'pro' => config('care.upgrade_banner.pro'),
|
||||
'free' => config('care.upgrade_banner.free'),
|
||||
default => null,
|
||||
};
|
||||
@endphp
|
||||
@if ($canSeeBilling && empty($hasPaidPlan) && ! empty($banner))
|
||||
@if ($canSeeBilling && ! empty($banner))
|
||||
<div class="mb-6 flex flex-col gap-3 rounded-2xl border border-indigo-200 bg-gradient-to-r from-indigo-50 to-emerald-50 px-5 py-4 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div>
|
||||
<p class="font-semibold text-slate-900">{{ $banner['title'] }}</p>
|
||||
<p class="mt-0.5 text-sm text-slate-600">{{ $banner['description'] }}</p>
|
||||
</div>
|
||||
<a href="{{ route($banner['route']) }}" class="btn-primary shrink-0">View plans</a>
|
||||
<a href="{{ route($banner['route']) }}" class="btn-primary shrink-0">{{ $banner['cta'] ?? 'View plans' }}</a>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@@ -179,6 +179,40 @@ class CareProTest extends TestCase
|
||||
->assertSee('View plans');
|
||||
}
|
||||
|
||||
public function test_pro_dashboard_shows_enterprise_upgrade_banner(): void
|
||||
{
|
||||
$settings = $this->organization->settings ?? [];
|
||||
$settings['plan'] = 'pro';
|
||||
$settings['plan_expires_at'] = now()->addMonth()->toIso8601String();
|
||||
$settings['billed_branches'] = 1;
|
||||
$this->organization->update(['settings' => $settings]);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.dashboard'))
|
||||
->assertOk()
|
||||
->assertSee('Upgrade to Care Enterprise')
|
||||
->assertSee('View Enterprise')
|
||||
->assertDontSee('Unlock Care Pro or Enterprise')
|
||||
->assertSee('Care Pro');
|
||||
}
|
||||
|
||||
public function test_enterprise_dashboard_hides_upgrade_banner(): void
|
||||
{
|
||||
$settings = $this->organization->settings ?? [];
|
||||
$settings['plan'] = 'enterprise';
|
||||
$settings['plan_expires_at'] = now()->addMonth()->toIso8601String();
|
||||
$settings['billed_branches'] = 1;
|
||||
$this->organization->update(['settings' => $settings]);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.dashboard'))
|
||||
->assertOk()
|
||||
->assertDontSee('Unlock Care Pro or Enterprise')
|
||||
->assertDontSee('Upgrade to Care Enterprise')
|
||||
->assertDontSee('View Enterprise')
|
||||
->assertSee('Care Enterprise');
|
||||
}
|
||||
|
||||
public function test_team_member_does_not_see_upgrade_banner(): void
|
||||
{
|
||||
$member = User::create([
|
||||
@@ -205,6 +239,7 @@ class CareProTest extends TestCase
|
||||
$this->get(route('care.dashboard'))
|
||||
->assertOk()
|
||||
->assertDontSee('Unlock Care Pro or Enterprise')
|
||||
->assertDontSee('Upgrade to Care Enterprise')
|
||||
->assertDontSee('View plans')
|
||||
->assertDontSee('Upgrade to Pro')
|
||||
->assertSee('Report Issue');
|
||||
|
||||
Reference in New Issue
Block a user