Move Branches and Team into Settings as Pro features.
Deploy Ladill Frontdesk / deploy (push) Successful in 48s

Gate multi-branch and team management behind paid plans, nest their
routes under Settings, and remove them from the sidebar Administration
section.
This commit is contained in:
isaacclad
2026-07-16 08:13:42 +00:00
parent 59433f2b7b
commit 5526a10342
19 changed files with 377 additions and 50 deletions
+58 -4
View File
@@ -63,8 +63,16 @@ class FrontdeskPhase2Test extends TestCase
$this->assertDatabaseHas('frontdesk_members', ['role' => 'org_admin']);
}
public function test_org_admin_can_create_branch(): void
public function test_org_admin_can_create_branch_on_pro(): void
{
$this->organization->update([
'settings' => array_merge($this->organization->settings ?? [], [
'plan' => 'pro',
'billed_branches' => 3,
'plan_expires_at' => now()->addMonth()->toIso8601String(),
]),
]);
$this->actingAs($this->admin)
->post(route('frontdesk.branches.store'), [
'name' => 'East Wing',
@@ -75,8 +83,31 @@ class FrontdeskPhase2Test extends TestCase
$this->assertDatabaseHas('frontdesk_branches', ['name' => 'East Wing']);
}
public function test_org_admin_can_add_team_member(): void
public function test_free_plan_cannot_manage_branches(): void
{
$this->actingAs($this->admin)
->get(route('frontdesk.branches.index'))
->assertOk()
->assertSee('Upgrade to Pro');
$this->actingAs($this->admin)
->post(route('frontdesk.branches.store'), [
'name' => 'East Wing',
])
->assertRedirect(route('frontdesk.pro.index'))
->assertSessionHas('error');
}
public function test_org_admin_can_add_team_member_on_pro(): void
{
$this->organization->update([
'settings' => array_merge($this->organization->settings ?? [], [
'plan' => 'pro',
'billed_branches' => 1,
'plan_expires_at' => now()->addMonth()->toIso8601String(),
]),
]);
$branch = Branch::create([
'owner_ref' => $this->admin->public_id,
'organization_id' => $this->organization->id,
@@ -84,20 +115,43 @@ class FrontdeskPhase2Test extends TestCase
'is_active' => true,
]);
$this->mock(\App\Services\Identity\IdentityTeamClient::class, function ($mock) {
$mock->shouldReceive('inviteAppMember')->once();
});
$this->actingAs($this->admin)
->post(route('frontdesk.members.store'), [
'user_ref' => 'receptionist-001',
'email' => 'receptionist@example.com',
'role' => 'receptionist',
'branch_id' => $branch->id,
])
->assertRedirect(route('frontdesk.members.index'));
$this->assertDatabaseHas('frontdesk_members', [
'user_ref' => 'receptionist-001',
'user_ref' => 'receptionist@example.com',
'role' => 'receptionist',
]);
}
public function test_free_plan_cannot_manage_team(): void
{
$this->actingAs($this->admin)
->get(route('frontdesk.members.index'))
->assertOk()
->assertSee('Upgrade to Pro');
}
public function test_settings_links_to_branches_and_team(): void
{
$this->actingAs($this->admin)
->get(route('frontdesk.settings'))
->assertOk()
->assertSee('Branches')
->assertSee('Team')
->assertSee(route('frontdesk.branches.index'), false)
->assertSee(route('frontdesk.members.index'), false);
}
public function test_receptionist_cannot_manage_branches(): void
{
$receptionist = User::create([