Improve specialty workspace actions and Call next handoff.
Deploy Ladill Care / deploy (push) Successful in 40s

Move timeline into a workspace tab, surface Complete consultation and Call again in Actions, and make Call next end the current encounter then open the next called patient.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-18 16:12:30 +00:00
co-authored by Cursor
parent 5bdc17777c
commit a00a8249ad
13 changed files with 587 additions and 149 deletions
+144
View File
@@ -291,4 +291,148 @@ class CareSpecialtyShellTest extends TestCase
]));
$this->assertSame(Appointment::STATUS_IN_CONSULTATION, $appointment->fresh()->status);
}
public function test_workspace_includes_timeline_tab_and_complete_action(): void
{
app(SpecialtyModuleService::class)->activate(
$this->organization,
$this->owner->public_id,
'dentistry',
);
$department = Department::query()
->where('branch_id', $this->branch->id)
->where('type', 'dental')
->firstOrFail();
$patient = Patient::create([
'owner_ref' => $this->owner->public_id,
'organization_id' => $this->organization->id,
'branch_id' => $this->branch->id,
'patient_number' => 'P-DEN-TL',
'first_name' => 'Afia',
'last_name' => 'Darko',
'gender' => 'female',
'date_of_birth' => '1992-01-01',
]);
$visit = Visit::create([
'owner_ref' => $this->owner->public_id,
'organization_id' => $this->organization->id,
'branch_id' => $this->branch->id,
'patient_id' => $patient->id,
'status' => Visit::STATUS_IN_PROGRESS,
'checked_in_at' => now(),
]);
$appointment = Appointment::create([
'owner_ref' => $this->owner->public_id,
'organization_id' => $this->organization->id,
'branch_id' => $this->branch->id,
'patient_id' => $patient->id,
'department_id' => $department->id,
'visit_id' => $visit->id,
'type' => Appointment::TYPE_WALK_IN,
'status' => Appointment::STATUS_IN_CONSULTATION,
'scheduled_at' => now(),
'waiting_at' => now(),
'checked_in_at' => now(),
'started_at' => now(),
'queue_ticket_status' => 'serving',
]);
\App\Models\Consultation::create([
'owner_ref' => $this->owner->public_id,
'visit_id' => $visit->id,
'appointment_id' => $appointment->id,
'patient_id' => $patient->id,
'status' => \App\Models\Consultation::STATUS_DRAFT,
'started_at' => now(),
]);
$tabs = app(SpecialtyShellService::class)->workspaceTabs('dentistry');
$this->assertArrayHasKey('timeline', $tabs);
$this->assertSame(['overview', 'timeline'], array_slice(array_keys($tabs), 0, 2));
$this->actingAs($this->owner)
->get(route('care.specialty.workspace', [
'module' => 'dentistry',
'visit' => $visit,
'tab' => 'timeline',
]))
->assertOk()
->assertSee('Timeline')
->assertSee('Patient timeline')
->assertSee('Complete consultation')
->assertDontSee('>Call again<', false);
$this->actingAs($this->owner)
->get(route('care.specialty.workspace', [
'module' => 'dentistry',
'visit' => $visit,
'tab' => 'overview',
]))
->assertOk()
->assertDontSee('Patient timeline');
}
public function test_called_workspace_shows_call_again_until_session_starts(): void
{
app(SpecialtyModuleService::class)->activate(
$this->organization,
$this->owner->public_id,
'dentistry',
);
$department = Department::query()
->where('branch_id', $this->branch->id)
->where('type', 'dental')
->firstOrFail();
$patient = Patient::create([
'owner_ref' => $this->owner->public_id,
'organization_id' => $this->organization->id,
'branch_id' => $this->branch->id,
'patient_number' => 'P-DEN-CALL',
'first_name' => 'Kofi',
'last_name' => 'Mensah',
'gender' => 'male',
'date_of_birth' => '1988-01-01',
]);
$visit = Visit::create([
'owner_ref' => $this->owner->public_id,
'organization_id' => $this->organization->id,
'branch_id' => $this->branch->id,
'patient_id' => $patient->id,
'status' => Visit::STATUS_OPEN,
'checked_in_at' => now(),
]);
Appointment::create([
'owner_ref' => $this->owner->public_id,
'organization_id' => $this->organization->id,
'branch_id' => $this->branch->id,
'patient_id' => $patient->id,
'department_id' => $department->id,
'visit_id' => $visit->id,
'type' => Appointment::TYPE_WALK_IN,
'status' => Appointment::STATUS_WAITING,
'scheduled_at' => now(),
'waiting_at' => now(),
'checked_in_at' => now(),
'queue_ticket_status' => 'called',
'queue_ticket_number' => 'DEN001',
]);
$this->actingAs($this->owner)
->get(route('care.specialty.workspace', [
'module' => 'dentistry',
'visit' => $visit,
]))
->assertOk()
->assertSee('Call again')
->assertSee('Start')
->assertDontSee('Complete consultation');
}
}