Redirect cashiers from legacy service queues to Billing.
Deploy Ladill Care / deploy (push) Successful in 48s

Doctor-only Queue left non-doctors landing on Appointments, which cashiers
(and pharmacists/lab techs) cannot open — restore role-natural list routes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-18 23:11:32 +00:00
co-authored by Cursor
parent d422797050
commit ff316f15c6
2 changed files with 43 additions and 4 deletions
@@ -4,12 +4,14 @@ namespace App\Http\Controllers\Care;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Controllers\Care\Concerns\ScopesToAccount; use App\Http\Controllers\Care\Concerns\ScopesToAccount;
use App\Models\Member;
use App\Services\Care\CarePermissions;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
/** /**
* Legacy Ladill Queue console routes redirect to the Care patient queue (doctors) * Legacy Ladill Queue console routes redirect each role to its natural
* or appointments list when the actor cannot open the patient-flow board. * Care list (billing booth, pharmacy/lab queues, doctor patient-flow board).
*/ */
class ServiceQueueController extends Controller class ServiceQueueController extends Controller
{ {
@@ -38,10 +40,29 @@ class ServiceQueueController extends Controller
protected function redirectAwayFromLegacyConsole(Request $request): RedirectResponse protected function redirectAwayFromLegacyConsole(Request $request): RedirectResponse
{ {
if (app(\App\Services\Care\CarePermissions::class)->canAccessPatientQueue($this->member($request))) { $member = $this->member($request);
$permissions = app(CarePermissions::class);
if ($permissions->canAccessPatientQueue($member)) {
return redirect()->route('care.queue.index'); return redirect()->route('care.queue.index');
} }
return redirect()->route('care.appointments.index'); return redirect()->route($this->naturalListRouteFor($member));
}
/**
* Role pages that own Call next / payment ops after the old counter console
* was removed. Must be a route the member can open (not appointments for
* cashiers / pharmacists / lab techs who lack appointments.view).
*/
protected function naturalListRouteFor(?Member $member): string
{
return match ($member?->role) {
'cashier' => 'care.bills.index',
'pharmacist' => 'care.prescriptions.queue',
'lab_technician' => 'care.lab.queue.index',
'receptionist', 'nurse' => 'care.appointments.index',
default => 'care.dashboard',
};
} }
} }
+18
View File
@@ -90,6 +90,24 @@ class CareNaturalQueueTest extends TestCase
->assertRedirect(route('care.queue.index')); ->assertRedirect(route('care.queue.index'));
} }
public function test_service_queues_redirect_cashiers_to_billing_not_appointments(): void
{
Member::query()->where('user_ref', $this->owner->public_id)->update(['role' => 'cashier']);
$this->actingAs($this->owner)
->get(route('care.service-queues.index'))
->assertRedirect(route('care.bills.index'));
}
public function test_service_queues_redirect_pharmacists_to_pharmacy_queue(): void
{
Member::query()->where('user_ref', $this->owner->public_id)->update(['role' => 'pharmacist']);
$this->actingAs($this->owner)
->get(route('care.service-queues.index'))
->assertRedirect(route('care.prescriptions.queue'));
}
public function test_clinical_queue_shows_inline_ops_not_service_counter(): void public function test_clinical_queue_shows_inline_ops_not_service_counter(): void
{ {
Member::query()->where('user_ref', $this->owner->public_id)->update(['role' => 'doctor']); Member::query()->where('user_ref', $this->owner->public_id)->update(['role' => 'doctor']);