Wire Care lists into Ladill Queue workflows instead of reception panels.
Deploy Ladill Care / deploy (push) Successful in 1m45s
Deploy Ladill Care / deploy (push) Successful in 1m45s
When Queue integration is on, role pages issue tickets into their own department queues and drive Call next → Serve → Complete on the native lists. Integration off leaves existing UI unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -9,9 +9,10 @@ use App\Models\Consultation;
|
||||
use App\Models\InvestigationRequest;
|
||||
use App\Models\InvestigationType;
|
||||
use App\Models\Member;
|
||||
use App\Services\Care\CareQueueBridge;
|
||||
use App\Services\Care\CareQueueContexts;
|
||||
use App\Services\Care\InvestigationService;
|
||||
use App\Services\Care\OrganizationResolver;
|
||||
use App\Services\Care\ServiceQueuePresenter;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
@@ -22,7 +23,7 @@ class InvestigationController extends Controller
|
||||
|
||||
public function __construct(
|
||||
protected InvestigationService $investigations,
|
||||
protected ServiceQueuePresenter $serviceQueues,
|
||||
protected CareQueueBridge $queueBridge,
|
||||
) {}
|
||||
|
||||
public function index(Request $request): View
|
||||
@@ -76,16 +77,46 @@ class InvestigationController extends Controller
|
||||
->where('organization_id', $organization->id)
|
||||
->orderBy('role')
|
||||
->get(),
|
||||
'serviceQueuePanel' => $this->serviceQueues->panel(
|
||||
$request,
|
||||
$organization,
|
||||
$this->member($request),
|
||||
'laboratory',
|
||||
$request->input('counter_uuid'),
|
||||
),
|
||||
'queueIntegration' => $branchId
|
||||
? $this->queueBridge->listMeta($organization, CareQueueContexts::LABORATORY, $branchId)
|
||||
: ['enabled' => false],
|
||||
]);
|
||||
}
|
||||
|
||||
public function callNext(Request $request): RedirectResponse
|
||||
{
|
||||
$this->authorizeAbility($request, 'lab.manage');
|
||||
$organization = $this->organization($request);
|
||||
$member = $this->member($request);
|
||||
$branchScope = app(OrganizationResolver::class)->branchScope($member);
|
||||
$branchId = (int) ($request->input('branch_id') ?: $branchScope);
|
||||
abort_unless($branchId > 0, 422);
|
||||
abort_unless($this->queueBridge->isEnabled($organization), 404);
|
||||
|
||||
$result = $this->queueBridge->callNext($organization, CareQueueContexts::LABORATORY, $branchId);
|
||||
$ticket = $result['ticket'] ?? null;
|
||||
if (! $ticket) {
|
||||
return back()->with('error', 'No lab work waiting in the laboratory queue.');
|
||||
}
|
||||
|
||||
return back()->with('success', 'Called '.$ticket['ticket_number'].'.');
|
||||
}
|
||||
|
||||
public function serve(Request $request, InvestigationRequest $investigation): RedirectResponse
|
||||
{
|
||||
$this->authorizeAbility($request, 'lab.manage');
|
||||
$this->authorizeInvestigation($request, $investigation);
|
||||
$organization = $this->organization($request);
|
||||
abort_unless($this->queueBridge->isEnabled($organization), 404);
|
||||
|
||||
$ticket = $this->queueBridge->serve($organization, $investigation);
|
||||
if (! $ticket) {
|
||||
return back()->with('error', 'Could not serve lab ticket.');
|
||||
}
|
||||
|
||||
return back()->with('success', 'Now serving '.$ticket['ticket_number'].'.');
|
||||
}
|
||||
|
||||
public function requestFromConsultation(Request $request, Consultation $consultation): RedirectResponse
|
||||
{
|
||||
$this->authorizeAbility($request, 'investigations.request');
|
||||
|
||||
Reference in New Issue
Block a user