Add Lab and Blood Bank manager roles with admin UIs.
Deploy Ladill Care / deploy (push) Successful in 46s
Deploy Ladill Care / deploy (push) Successful in 46s
Give lab_manager catalog/ops admin access and blood_bank_manager a branch-level stock register plus specialty admin surface, while keeping technicians on clinical queues. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -295,4 +295,82 @@ class CareBloodBankSuiteTest extends TestCase
|
||||
->assertSee('Blood Bank summary')
|
||||
->assertSee($this->patient->fullName());
|
||||
}
|
||||
|
||||
public function test_blood_bank_manager_can_manage_admin_inventory(): void
|
||||
{
|
||||
Member::query()->where('user_ref', $this->owner->public_id)->update([
|
||||
'role' => 'blood_bank_manager',
|
||||
'branch_id' => $this->branch->id,
|
||||
]);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.blood-bank.admin.index', ['branch_id' => $this->branch->id]))
|
||||
->assertOk()
|
||||
->assertSee('Blood Bank admin')
|
||||
->assertSee('Operational inventory');
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('care.blood-bank.admin.stock.update'), [
|
||||
'branch_id' => $this->branch->id,
|
||||
'stock' => [
|
||||
[
|
||||
'product_code' => 'packed_rbc',
|
||||
'units_on_hand' => 12,
|
||||
'reorder_level' => 3,
|
||||
'notes' => 'Restocked',
|
||||
],
|
||||
[
|
||||
'product_code' => 'whole_blood',
|
||||
'units_on_hand' => 1,
|
||||
'reorder_level' => 2,
|
||||
'notes' => null,
|
||||
],
|
||||
[
|
||||
'product_code' => 'platelets',
|
||||
'units_on_hand' => 4,
|
||||
'reorder_level' => 2,
|
||||
],
|
||||
[
|
||||
'product_code' => 'ffp',
|
||||
'units_on_hand' => 5,
|
||||
'reorder_level' => 2,
|
||||
],
|
||||
[
|
||||
'product_code' => 'cryo',
|
||||
'units_on_hand' => 2,
|
||||
'reorder_level' => 1,
|
||||
],
|
||||
],
|
||||
])
|
||||
->assertRedirect();
|
||||
|
||||
$this->assertDatabaseHas('care_blood_bank_stock', [
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $this->branch->id,
|
||||
'product_code' => 'packed_rbc',
|
||||
'units_on_hand' => 12,
|
||||
'reorder_level' => 3,
|
||||
]);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.show', 'blood_bank'))
|
||||
->assertOk();
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.specialty.blood-bank.reports'))
|
||||
->assertOk()
|
||||
->assertSee('Blood Bank reports');
|
||||
}
|
||||
|
||||
public function test_lab_technician_cannot_access_blood_bank_admin(): void
|
||||
{
|
||||
Member::query()->where('user_ref', $this->owner->public_id)->update([
|
||||
'role' => 'lab_technician',
|
||||
'branch_id' => $this->branch->id,
|
||||
]);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->get(route('care.blood-bank.admin.index'))
|
||||
->assertForbidden();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,6 +286,50 @@ class CareLabTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_lab_manager_can_access_admin_and_catalog(): void
|
||||
{
|
||||
Member::where('user_ref', $this->user->public_id)->update([
|
||||
'role' => 'lab_manager',
|
||||
'branch_id' => $this->branch->id,
|
||||
]);
|
||||
|
||||
$this->actingAs($this->user)
|
||||
->get(route('care.lab.admin.index', ['branch_id' => $this->branch->id]))
|
||||
->assertOk()
|
||||
->assertSee('Lab admin')
|
||||
->assertSee('Manage catalog');
|
||||
|
||||
$this->actingAs($this->user)
|
||||
->get(route('care.lab.catalog.index'))
|
||||
->assertOk()
|
||||
->assertSee('Investigation catalog');
|
||||
|
||||
$this->actingAs($this->user)
|
||||
->post(route('care.lab.catalog.store'), [
|
||||
'name' => 'Manager Panel',
|
||||
'code' => 'MGR',
|
||||
'category' => 'blood',
|
||||
'price_minor' => 2200,
|
||||
'is_active' => true,
|
||||
])
|
||||
->assertRedirect(route('care.lab.catalog.index'));
|
||||
|
||||
$this->assertDatabaseHas('care_investigation_types', [
|
||||
'organization_id' => $this->organization->id,
|
||||
'name' => 'Manager Panel',
|
||||
'price_minor' => 2200,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_lab_technician_cannot_access_lab_admin(): void
|
||||
{
|
||||
Member::where('user_ref', $this->user->public_id)->update(['role' => 'lab_technician']);
|
||||
|
||||
$this->actingAs($this->user)
|
||||
->get(route('care.lab.admin.index'))
|
||||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function test_api_can_request_investigation(): void
|
||||
{
|
||||
Sanctum::actingAs($this->user);
|
||||
|
||||
Reference in New Issue
Block a user