Seed Blood Bank demo inventory_note on open visits.
Deploy Ladill Care / deploy (push) Successful in 28s

Pro/enterprise DemoTenantSeeder now upserts visit-scoped facility stock so the Inventory tab and reports show unit counts and a low-stock alert without manual entry.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-18 21:46:13 +00:00
co-authored by Cursor
parent f688a48c37
commit ad3d8b5ce4
2 changed files with 113 additions and 0 deletions
+17
View File
@@ -12,6 +12,7 @@ use App\Models\InvestigationType;
use App\Models\Organization;
use App\Models\Patient;
use App\Models\Prescription;
use App\Models\SpecialtyClinicalRecord;
use App\Models\User;
use App\Services\Care\DemoTenantSeeder;
use App\Services\Care\PlanService;
@@ -120,6 +121,22 @@ class DemoSeedCommandTest extends TestCase
"Expected waiting specialty appointments for [{$key}]"
);
}
$inventoryNotes = SpecialtyClinicalRecord::query()
->where('owner_ref', $user->public_id)
->where('module_key', 'blood_bank')
->where('record_type', 'inventory_note')
->get();
$this->assertGreaterThan(
0,
$inventoryNotes->count(),
'Expected blood bank inventory_note records after pro demo seed'
);
$this->assertNotNull($inventoryNotes->first()?->payload['packed_rbc_units'] ?? null);
$this->assertTrue(
$inventoryNotes->contains(fn (SpecialtyClinicalRecord $r) => ! empty($r->payload['low_stock_alert'])),
'Expected at least one low-stock inventory demo flag'
);
}
public function test_free_demo_does_not_enable_specialty_modules(): void