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:
@@ -0,0 +1,120 @@
|
||||
<x-app-layout title="Blood Bank admin">
|
||||
<div class="space-y-6">
|
||||
<x-care.page-hero
|
||||
badge="Blood Bank · Operations · Inventory"
|
||||
title="Blood Bank admin"
|
||||
description="Maintain operational product stock, low-stock thresholds, and jump into clinical Blood Bank work."
|
||||
:stats="[
|
||||
['value' => number_format($overview['total_units']), 'label' => 'Units on hand'],
|
||||
['value' => number_format($overview['low_stock_count']), 'label' => 'Low stock'],
|
||||
['value' => number_format($report['requests_today'] ?? 0), 'label' => 'Requests today'],
|
||||
['value' => number_format($report['high_urgency_open'] ?? 0), 'label' => 'High urgency open'],
|
||||
]">
|
||||
<x-slot name="actions">
|
||||
<a href="{{ route('care.specialty.show', 'blood_bank') }}" class="rounded-lg border border-slate-200 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">Clinical list</a>
|
||||
<a href="{{ route('care.specialty.blood-bank.reports') }}" class="rounded-lg border border-slate-200 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">Reports</a>
|
||||
</x-slot>
|
||||
</x-care.page-hero>
|
||||
|
||||
@if (($canSwitchBranch ?? false) && isset($branches) && $branches->count() > 1)
|
||||
<form method="GET" class="rounded-2xl border border-slate-200 bg-white p-4">
|
||||
<label class="block text-xs font-medium text-slate-600">Branch</label>
|
||||
<select name="branch_id" class="mt-1 rounded-lg border-slate-300 text-sm" onchange="this.form.submit()">
|
||||
@foreach ($branches as $branch)
|
||||
<option value="{{ $branch->id }}" @selected($branchId == $branch->id)>{{ $branch->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</form>
|
||||
@elseif (isset($branches) && $branches->isNotEmpty())
|
||||
<p class="text-sm text-slate-600">Branch: <span class="font-medium text-slate-900">{{ $branches->firstWhere('id', $branchId)?->name ?? $branches->first()->name }}</span></p>
|
||||
@endif
|
||||
|
||||
@if ($overview['low_stock']->isNotEmpty())
|
||||
<div class="rounded-xl border border-amber-200 bg-amber-50 p-4 text-sm text-amber-900">
|
||||
{{ $overview['low_stock']->count() }} product(s) at or below reorder level.
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<section class="rounded-2xl border border-slate-200 bg-white p-5">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<div>
|
||||
<h2 class="text-sm font-semibold text-slate-900">Operational inventory</h2>
|
||||
<p class="mt-0.5 text-xs text-slate-500">Branch-level units on hand — separate from visit-scoped clinical inventory notes.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form method="POST" action="{{ route('care.blood-bank.admin.stock.update') }}" class="mt-4 space-y-3">
|
||||
@csrf
|
||||
@if ($branchId > 0)
|
||||
<input type="hidden" name="branch_id" value="{{ $branchId }}">
|
||||
@endif
|
||||
|
||||
<div class="overflow-hidden rounded-xl border border-slate-100">
|
||||
<table class="min-w-full text-sm">
|
||||
<thead class="bg-slate-50 text-left text-xs uppercase text-slate-500">
|
||||
<tr>
|
||||
<th class="px-4 py-3">Product</th>
|
||||
<th class="px-4 py-3">Units on hand</th>
|
||||
<th class="px-4 py-3">Reorder level</th>
|
||||
<th class="px-4 py-3">Notes</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-50">
|
||||
@foreach ($overview['stock'] as $i => $row)
|
||||
<tr @class(['bg-amber-50/60' => $row->isLowStock()])>
|
||||
<td class="px-4 py-3 font-medium text-slate-900">
|
||||
{{ $row->product_label }}
|
||||
@if ($row->isLowStock())
|
||||
<span class="ml-2 text-xs font-semibold text-amber-800">Low</span>
|
||||
@endif
|
||||
<input type="hidden" name="stock[{{ $i }}][product_code]" value="{{ $row->product_code }}">
|
||||
</td>
|
||||
<td class="px-4 py-3">
|
||||
<input type="number" min="0" name="stock[{{ $i }}][units_on_hand]" value="{{ old('stock.'.$i.'.units_on_hand', $row->units_on_hand) }}" class="w-24 rounded-lg border-slate-300 text-sm">
|
||||
</td>
|
||||
<td class="px-4 py-3">
|
||||
<input type="number" min="0" name="stock[{{ $i }}][reorder_level]" value="{{ old('stock.'.$i.'.reorder_level', $row->reorder_level) }}" class="w-24 rounded-lg border-slate-300 text-sm">
|
||||
</td>
|
||||
<td class="px-4 py-3">
|
||||
<input type="text" name="stock[{{ $i }}][notes]" value="{{ old('stock.'.$i.'.notes', $row->notes) }}" class="w-full max-w-xs rounded-lg border-slate-300 text-sm" placeholder="Optional">
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end">
|
||||
<button type="submit" class="btn-primary">Save inventory</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="rounded-2xl border border-slate-200 bg-white p-5">
|
||||
<h2 class="text-sm font-semibold text-slate-900">Recent visit inventory notes</h2>
|
||||
<p class="mt-0.5 text-xs text-slate-500">Clinical notes from Blood Bank visits (not the operational register above).</p>
|
||||
<ul class="mt-3 divide-y divide-slate-50 text-sm">
|
||||
@forelse ($overview['recent_notes'] as $note)
|
||||
<li class="flex flex-wrap items-center justify-between gap-2 py-3">
|
||||
<div>
|
||||
<p class="font-medium text-slate-900">
|
||||
{{ $note->visit?->patient?->fullName() ?? 'Visit #'.$note->visit_id }}
|
||||
</p>
|
||||
<p class="text-xs text-slate-500">
|
||||
{{ $note->recorded_at?->format('d M Y H:i') ?? '—' }}
|
||||
@if (! empty($note->payload['low_stock_alert']))
|
||||
· <span class="text-amber-800">Low stock flagged</span>
|
||||
@endif
|
||||
</p>
|
||||
</div>
|
||||
@if ($note->visit_id)
|
||||
<a href="{{ route('care.specialty.workspace', ['module' => 'blood_bank', 'visit' => $note->visit_id, 'tab' => 'inventory']) }}" class="text-sky-600">Open</a>
|
||||
@endif
|
||||
</li>
|
||||
@empty
|
||||
<li class="py-6 text-center text-slate-500">No recent inventory notes.</li>
|
||||
@endforelse
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
@@ -0,0 +1,95 @@
|
||||
<x-app-layout title="Lab admin">
|
||||
<div class="space-y-6">
|
||||
<x-care.page-hero
|
||||
badge="Laboratory · Catalog · Queue ops"
|
||||
title="Lab admin"
|
||||
description="Manage investigation catalog pricing, review open queue load, and jump into laboratory operations."
|
||||
:stats="[
|
||||
['value' => number_format($activeCatalogCount), 'label' => 'Active tests'],
|
||||
['value' => number_format($catalogCount), 'label' => 'Catalog total'],
|
||||
['value' => number_format($openQueue), 'label' => 'Open queue'],
|
||||
['value' => number_format($queueCounts[\App\Models\InvestigationRequest::STATUS_AWAITING_REVIEW] ?? 0), 'label' => 'Awaiting review'],
|
||||
]">
|
||||
<x-slot name="actions">
|
||||
<a href="{{ route('care.lab.catalog.index') }}" class="btn-primary">Manage catalog</a>
|
||||
<a href="{{ route('care.lab.queue.index') }}" class="rounded-lg border border-slate-200 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">Lab queue</a>
|
||||
<a href="{{ route('care.lab.catalog.create') }}" class="rounded-lg border border-slate-200 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">Add test</a>
|
||||
</x-slot>
|
||||
</x-care.page-hero>
|
||||
|
||||
@if (($canSwitchBranch ?? false) && isset($branches) && $branches->count() > 1)
|
||||
<form method="GET" class="rounded-2xl border border-slate-200 bg-white p-4">
|
||||
<label class="block text-xs font-medium text-slate-600">Branch</label>
|
||||
<select name="branch_id" class="mt-1 rounded-lg border-slate-300 text-sm" onchange="this.form.submit()">
|
||||
@foreach ($branches as $branch)
|
||||
<option value="{{ $branch->id }}" @selected($branchId == $branch->id)>{{ $branch->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</form>
|
||||
@elseif (isset($branches) && $branches->isNotEmpty())
|
||||
<p class="text-sm text-slate-600">Branch: <span class="font-medium text-slate-900">{{ $branches->firstWhere('id', $branchId)?->name ?? $branches->first()->name }}</span></p>
|
||||
@endif
|
||||
|
||||
<div class="grid gap-4 lg:grid-cols-2">
|
||||
<section class="rounded-2xl border border-slate-200 bg-white p-5">
|
||||
<h2 class="text-sm font-semibold text-slate-900">Queue by status</h2>
|
||||
<ul class="mt-3 space-y-2 text-sm">
|
||||
@foreach ([
|
||||
\App\Models\InvestigationRequest::STATUS_PENDING,
|
||||
\App\Models\InvestigationRequest::STATUS_SAMPLE_COLLECTED,
|
||||
\App\Models\InvestigationRequest::STATUS_IN_PROGRESS,
|
||||
\App\Models\InvestigationRequest::STATUS_AWAITING_REVIEW,
|
||||
] as $status)
|
||||
<li class="flex justify-between gap-3">
|
||||
<span>{{ $statuses[$status] ?? $status }}</span>
|
||||
<span class="tabular-nums text-slate-600">{{ number_format($queueCounts[$status] ?? 0) }}</span>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
<div class="mt-4">
|
||||
<a href="{{ route('care.lab.queue.index') }}" class="text-sm font-medium text-indigo-600">Open work queue →</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="rounded-2xl border border-slate-200 bg-white p-5">
|
||||
<h2 class="text-sm font-semibold text-slate-900">Catalog management</h2>
|
||||
<p class="mt-1 text-sm text-slate-500">Add or edit investigation types and prices. Technicians process samples from the queue; managers own the catalog.</p>
|
||||
<div class="mt-4 flex flex-wrap gap-2">
|
||||
<a href="{{ route('care.lab.catalog.index') }}" class="rounded-lg bg-indigo-600 px-3 py-2 text-sm font-semibold text-white">Investigation catalog</a>
|
||||
<a href="{{ route('care.lab.catalog.create') }}" class="rounded-lg border border-slate-200 px-3 py-2 text-sm font-medium text-slate-700">Add test</a>
|
||||
<a href="{{ route('care.lab.requests.index') }}" class="rounded-lg border border-slate-200 px-3 py-2 text-sm font-medium text-slate-700">All requests</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section class="rounded-2xl border border-slate-200 bg-white p-5">
|
||||
<h2 class="text-sm font-semibold text-slate-900">Current queue snapshot</h2>
|
||||
<div class="mt-3 overflow-hidden rounded-xl border border-slate-100">
|
||||
<table class="min-w-full text-sm">
|
||||
<thead class="bg-slate-50 text-left text-xs uppercase text-slate-500">
|
||||
<tr>
|
||||
<th class="px-4 py-3">Patient</th>
|
||||
<th class="px-4 py-3">Test</th>
|
||||
<th class="px-4 py-3">Status</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-50">
|
||||
@forelse ($recentQueue as $item)
|
||||
<tr>
|
||||
<td class="px-4 py-3 font-medium">{{ $item->patient?->fullName() ?? '—' }}</td>
|
||||
<td class="px-4 py-3">{{ $item->investigationType?->name ?? '—' }}</td>
|
||||
<td class="px-4 py-3">{{ $statuses[$item->status] ?? $item->status }}</td>
|
||||
<td class="px-4 py-3 text-right">
|
||||
<a href="{{ route('care.lab.requests.show', $item) }}" class="text-sky-600">Open</a>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr><td colspan="4" class="px-4 py-8 text-center text-slate-500">No open lab work for this branch.</td></tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
@@ -2,9 +2,12 @@
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 class="text-xl font-semibold text-slate-900">Investigation catalog</h1>
|
||||
<p class="mt-1 text-sm text-slate-500">Admins manage test types and prices. Lab technicians process samples from the laboratory queue.</p>
|
||||
<p class="mt-1 text-sm text-slate-500">Managers and admins set test types and prices. Lab technicians process samples from the laboratory queue.</p>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<a href="{{ route('care.lab.admin.index') }}" class="rounded-lg border border-slate-200 px-4 py-2 text-sm">Lab admin</a>
|
||||
<a href="{{ route('care.lab.catalog.create') }}" class="btn-primary">Add test</a>
|
||||
</div>
|
||||
<a href="{{ route('care.lab.catalog.create') }}" class="btn-primary">Add test</a>
|
||||
</div>
|
||||
<div class="mt-4 overflow-hidden rounded-2xl border border-slate-200 bg-white">
|
||||
<table class="min-w-full text-sm">
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<div class="flex gap-2">
|
||||
<a href="{{ route('care.lab.requests.index') }}" class="rounded-lg border border-slate-200 px-4 py-2 text-sm">All requests</a>
|
||||
@if (app(\App\Services\Care\CarePermissions::class)->can(auth()->user() ? app(\App\Services\Care\OrganizationResolver::class)->memberFor(auth()->user(), $organization) : null, 'lab.catalog.manage'))
|
||||
<a href="{{ route('care.lab.admin.index') }}" class="rounded-lg border border-slate-200 px-4 py-2 text-sm">Lab admin</a>
|
||||
<a href="{{ route('care.lab.catalog.index') }}" class="rounded-lg border border-slate-200 px-4 py-2 text-sm">Catalog</a>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@@ -127,12 +127,22 @@
|
||||
</a>
|
||||
</li>
|
||||
@if (! empty($hasPaidPlan) && ($canManageLabCatalog ?? false))
|
||||
<li>
|
||||
<a href="{{ route('care.lab.admin.index') }}"
|
||||
class="flex items-center justify-between rounded-xl border border-slate-100 bg-slate-50 px-4 py-3 text-sm text-slate-700 hover:text-indigo-700">
|
||||
<span>
|
||||
Laboratory admin
|
||||
<span class="mt-0.5 block text-xs text-slate-500">Queue overview, catalog entry points, and lab ops</span>
|
||||
</span>
|
||||
<span class="text-slate-400">→</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route('care.lab.catalog.index') }}"
|
||||
class="flex items-center justify-between rounded-xl border border-slate-100 bg-slate-50 px-4 py-3 text-sm text-slate-700 hover:text-indigo-700">
|
||||
<span>
|
||||
Laboratory catalog
|
||||
<span class="mt-0.5 block text-xs text-slate-500">Investigation types and lab test prices (admins only)</span>
|
||||
<span class="mt-0.5 block text-xs text-slate-500">Investigation types and lab test prices</span>
|
||||
</span>
|
||||
<span class="text-slate-400">→</span>
|
||||
</a>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
$inventoryPayload = $bloodBankInventory?->payload ?? [];
|
||||
$currentStage = $workspaceVisit->specialty_stage;
|
||||
$stageFlow = $bloodBankStageFlow ?? [];
|
||||
$canManage = $canConsult ?? false;
|
||||
$canManage = $canAdvanceStage ?? $canConsult ?? false;
|
||||
$urgency = (string) ($payload['urgency'] ?? '');
|
||||
$isHighUrgency = str_contains(strtolower($urgency), 'urgent')
|
||||
|| str_contains(strtolower($urgency), 'emergency')
|
||||
|
||||
@@ -25,6 +25,14 @@
|
||||
@endif
|
||||
@if ($moduleKey === 'blood_bank')
|
||||
<a href="{{ route('care.specialty.blood-bank.reports') }}" class="text-slate-600 hover:text-slate-900">Reports</a>
|
||||
@php
|
||||
$bbAdminMember = auth()->user()
|
||||
? app(\App\Services\Care\OrganizationResolver::class)->memberFor(auth()->user(), $organization)
|
||||
: null;
|
||||
@endphp
|
||||
@if (app(\App\Services\Care\CarePermissions::class)->can($bbAdminMember, 'blood_bank.manage'))
|
||||
<a href="{{ route('care.blood-bank.admin.index') }}" class="text-slate-600 hover:text-slate-900">Admin</a>
|
||||
@endif
|
||||
@endif
|
||||
<a href="{{ route('care.specialty.history', $moduleKey) }}" class="text-slate-600 hover:text-slate-900">History</a>
|
||||
@if ($canManageClinical ?? $canManageSpecialty ?? true)
|
||||
|
||||
@@ -103,8 +103,14 @@
|
||||
|
||||
$adminNav = [];
|
||||
if (! empty($hasPaidPlan) && $permissions->can($member, 'lab.catalog.manage')) {
|
||||
$adminNav[] = ['name' => 'Lab catalog', 'route' => route('care.lab.catalog.index'), 'active' => request()->routeIs('care.lab.catalog.*'),
|
||||
$adminNav[] = ['name' => 'Lab admin', 'route' => route('care.lab.admin.index'), 'active' => request()->routeIs('care.lab.admin.*'),
|
||||
'icon' => '<path stroke-linecap="round" stroke-linejoin="round" d="M9.75 3.104v5.714a2.25 2.25 0 0 1-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 0 1 4.5 0m0 0v5.714a2.25 2.25 0 0 0 .659 1.591L19 14.5M14.25 3.104c.251.023.501.05.75.082M19 14.5l-2.47 2.47a2.25 2.25 0 0 1-1.59.659H9.06a2.25 2.25 0 0 1-1.591-.659L5 14.5m14 0V17a2.25 2.25 0 0 1-2.25 2.25H7.25A2.25 2.25 0 0 1 5 17v-2.5" />'];
|
||||
$adminNav[] = ['name' => 'Lab catalog', 'route' => route('care.lab.catalog.index'), 'active' => request()->routeIs('care.lab.catalog.*'),
|
||||
'icon' => '<path stroke-linecap="round" stroke-linejoin="round" d="M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75" />'];
|
||||
}
|
||||
if (! empty($hasPaidPlan) && $permissions->can($member, 'blood_bank.manage')) {
|
||||
$adminNav[] = ['name' => 'Blood Bank admin', 'route' => route('care.blood-bank.admin.index'), 'active' => request()->routeIs('care.blood-bank.admin.*'),
|
||||
'icon' => '<path stroke-linecap="round" stroke-linejoin="round" d="M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12Z" />'];
|
||||
}
|
||||
if ($permissions->can($member, 'admin.departments.view')) {
|
||||
$adminNav[] = ['name' => 'Departments', 'route' => route('care.departments.index'), 'active' => request()->routeIs('care.departments.*'),
|
||||
|
||||
Reference in New Issue
Block a user