From eb06baaa44a036b28a9e631dfdb07716334b854d Mon Sep 17 00:00:00 2001 From: isaacclad Date: Tue, 14 Jul 2026 23:06:34 +0000 Subject: [PATCH] Hide Care Pro upgrade banner from team members. Only account owners with billing access see the View plans CTA. Co-authored-by: Cursor --- .../views/partials/upgrade-banner.blade.php | 7 +++-- tests/Feature/CareProTest.php | 31 +++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/resources/views/partials/upgrade-banner.blade.php b/resources/views/partials/upgrade-banner.blade.php index 35e57ba..4ee1ee1 100644 --- a/resources/views/partials/upgrade-banner.blade.php +++ b/resources/views/partials/upgrade-banner.blade.php @@ -1,5 +1,8 @@ -@php $banner = config('care.upgrade_banner'); @endphp -@if (empty($hasPaidPlan) && ! empty($banner)) +@php + $banner = config('care.upgrade_banner'); + $canSeeBilling = \App\Support\StaffUx::showBilling(auth()->user()); +@endphp +@if ($canSeeBilling && empty($hasPaidPlan) && ! empty($banner))

{{ $banner['title'] }}

diff --git a/tests/Feature/CareProTest.php b/tests/Feature/CareProTest.php index 6a3dcfb..4a17274 100644 --- a/tests/Feature/CareProTest.php +++ b/tests/Feature/CareProTest.php @@ -75,6 +75,37 @@ class CareProTest extends TestCase ->assertSee('View plans'); } + public function test_team_member_does_not_see_upgrade_banner(): void + { + $member = User::create([ + 'public_id' => 'care-doctor-001', + 'name' => 'Doctor', + 'email' => 'doctor@example.com', + ]); + + Member::create([ + 'owner_ref' => $this->owner->public_id, + 'organization_id' => $this->organization->id, + 'user_ref' => $member->public_id, + 'role' => 'doctor', + ]); + + $this->actingAs($member); + \App\Support\StaffUx::remember([ + 'full_access' => false, + 'apps' => ['care'], + 'show_hub' => false, + 'show_billing' => false, + ]); + + $this->get(route('care.dashboard')) + ->assertOk() + ->assertDontSee('Unlock Care Pro or Enterprise') + ->assertDontSee('View plans') + ->assertDontSee('Upgrade to Pro') + ->assertSee('Report Issue'); + } + public function test_subscribe_upgrades_organization_to_pro(): void { Http::fake([