From 62d42d91579b5a72493051210d70d1ccc23a0e5e Mon Sep 17 00:00:00 2001 From: isaacclad Date: Fri, 17 Jul 2026 11:08:13 +0000 Subject: [PATCH] Show Care Enterprise upgrade banner to Pro users. 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 --- app/Providers/AppServiceProvider.php | 9 ++++- config/care.php | 15 ++++++-- .../views/partials/upgrade-banner.blade.php | 11 ++++-- tests/Feature/CareProTest.php | 35 +++++++++++++++++++ 4 files changed, 63 insertions(+), 7 deletions(-) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 22c6c0a..d6be4ca 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -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'; diff --git a/config/care.php b/config/care.php index 7d66f82..f5dbe2f 100644 --- a/config/care.php +++ b/config/care.php @@ -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', + ], ], ]; diff --git a/resources/views/partials/upgrade-banner.blade.php b/resources/views/partials/upgrade-banner.blade.php index 4ee1ee1..8619247 100644 --- a/resources/views/partials/upgrade-banner.blade.php +++ b/resources/views/partials/upgrade-banner.blade.php @@ -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))

{{ $banner['title'] }}

{{ $banner['description'] }}

- View plans + {{ $banner['cta'] ?? 'View plans' }}
@endif diff --git a/tests/Feature/CareProTest.php b/tests/Feature/CareProTest.php index c426001..6dc6676 100644 --- a/tests/Feature/CareProTest.php +++ b/tests/Feature/CareProTest.php @@ -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');