Strip healthcare packaging and Care integration from Queue.
Deploy Ladill Queue / deploy (push) Successful in 3m12s
Deploy Ladill Queue / deploy (push) Successful in 3m12s
Queue is general-purpose QMS only; Care runs its own native engine. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -57,7 +57,6 @@ DEMO_RESET_ON_LOGIN=true
|
||||
# --- Inbound service API keys (sibling Ladill apps calling Queue) ---
|
||||
QUEUE_API_KEY_POS=
|
||||
QUEUE_API_KEY_CRM=
|
||||
QUEUE_API_KEY_CARE=
|
||||
QUEUE_API_KEY_FRONTDESK=
|
||||
|
||||
# Optional: platform DB read for SSO user resolution (same host as monolith)
|
||||
|
||||
@@ -27,7 +27,7 @@ class IntegrationController extends Controller
|
||||
'data' => [
|
||||
'provisioned' => false,
|
||||
'onboarded' => false,
|
||||
'integrations' => ['care' => false, 'frontdesk' => false],
|
||||
'integrations' => ['frontdesk' => false],
|
||||
],
|
||||
]);
|
||||
}
|
||||
@@ -40,7 +40,6 @@ class IntegrationController extends Controller
|
||||
'industry' => data_get($organization->settings, 'industry'),
|
||||
'industry_package' => data_get($organization->settings, 'industry_package.key'),
|
||||
'integrations' => [
|
||||
'care' => (bool) data_get($organization->settings, 'integrations.care_enabled', false),
|
||||
'frontdesk' => (bool) data_get($organization->settings, 'integrations.frontdesk_enabled', false),
|
||||
],
|
||||
],
|
||||
@@ -61,7 +60,6 @@ class IntegrationController extends Controller
|
||||
]);
|
||||
|
||||
$defaultIndustry = match ($caller) {
|
||||
'care' => 'healthcare',
|
||||
'frontdesk' => 'visitor',
|
||||
'pos' => 'restaurant',
|
||||
default => 'custom',
|
||||
@@ -85,7 +83,6 @@ class IntegrationController extends Controller
|
||||
'industry' => $industry,
|
||||
'appointment_mode' => 'hybrid',
|
||||
'integrations' => [
|
||||
'care_enabled' => false,
|
||||
'frontdesk_enabled' => false,
|
||||
],
|
||||
],
|
||||
@@ -127,19 +124,17 @@ class IntegrationController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($caller, ['care', 'frontdesk'], true)) {
|
||||
if ($caller === 'frontdesk') {
|
||||
$this->syncIntegrationFlag($organization->fresh(), $caller, true);
|
||||
$organization = $organization->fresh();
|
||||
}
|
||||
|
||||
// Care owns clinical stage graphs; still apply healthcare terminology/package metadata.
|
||||
$packageResult = app(IndustryPackageInstaller::class)->install(
|
||||
$organization->fresh(),
|
||||
$branch,
|
||||
$industry,
|
||||
[
|
||||
'actor_ref' => $owner,
|
||||
'skip_stages' => $caller === 'care',
|
||||
'include_optional' => true,
|
||||
],
|
||||
);
|
||||
@@ -151,7 +146,6 @@ class IntegrationController extends Controller
|
||||
'industry' => $industry,
|
||||
'industry_package' => $packageResult,
|
||||
'integrations' => [
|
||||
'care' => (bool) data_get($organization->fresh()->settings, 'integrations.care_enabled', false),
|
||||
'frontdesk' => (bool) data_get($organization->fresh()->settings, 'integrations.frontdesk_enabled', false),
|
||||
],
|
||||
],
|
||||
@@ -161,7 +155,6 @@ class IntegrationController extends Controller
|
||||
public function update(Request $request): JsonResponse
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'care_enabled' => ['nullable', 'boolean'],
|
||||
'frontdesk_enabled' => ['nullable', 'boolean'],
|
||||
]);
|
||||
|
||||
@@ -170,9 +163,6 @@ class IntegrationController extends Controller
|
||||
$settings = $organization->settings ?? [];
|
||||
$integrations = $settings['integrations'] ?? [];
|
||||
|
||||
if (array_key_exists('care_enabled', $validated) && in_array($caller, ['care', 'crm'], true)) {
|
||||
$integrations['care_enabled'] = (bool) $validated['care_enabled'];
|
||||
}
|
||||
if (array_key_exists('frontdesk_enabled', $validated) && in_array($caller, ['frontdesk', 'crm'], true)) {
|
||||
$integrations['frontdesk_enabled'] = (bool) $validated['frontdesk_enabled'];
|
||||
}
|
||||
@@ -183,7 +173,6 @@ class IntegrationController extends Controller
|
||||
return response()->json([
|
||||
'data' => [
|
||||
'integrations' => [
|
||||
'care' => (bool) ($integrations['care_enabled'] ?? false),
|
||||
'frontdesk' => (bool) ($integrations['frontdesk_enabled'] ?? false),
|
||||
],
|
||||
],
|
||||
@@ -192,14 +181,13 @@ class IntegrationController extends Controller
|
||||
|
||||
protected function syncIntegrationFlag(Organization $organization, string $caller, bool $enabled): void
|
||||
{
|
||||
if (! in_array($caller, ['care', 'frontdesk'], true)) {
|
||||
if ($caller !== 'frontdesk') {
|
||||
return;
|
||||
}
|
||||
|
||||
$settings = $organization->settings ?? [];
|
||||
$integrations = $settings['integrations'] ?? [];
|
||||
$key = $caller.'_enabled';
|
||||
$integrations[$key] = $enabled;
|
||||
$integrations['frontdesk_enabled'] = $enabled;
|
||||
$settings['integrations'] = $integrations;
|
||||
$organization->update(['settings' => $settings]);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,6 @@ class SettingsController extends Controller
|
||||
'appointment_mode' => ['required', 'string', 'in:'.implode(',', array_keys(config('qms.appointment_modes')))],
|
||||
'industry' => ['nullable', 'string', 'max:64'],
|
||||
'notifications_enabled' => ['boolean'],
|
||||
'care_integration_enabled' => ['nullable', 'boolean'],
|
||||
'frontdesk_integration_enabled' => ['nullable', 'boolean'],
|
||||
'logo' => ['nullable', 'image', 'mimes:jpeg,png,jpg,webp,svg', 'max:2048'],
|
||||
'remove_logo' => ['nullable', 'boolean'],
|
||||
@@ -92,9 +91,6 @@ class SettingsController extends Controller
|
||||
}
|
||||
$settings['notifications_enabled'] = $request->boolean('notifications_enabled', true);
|
||||
$integrations = $settings['integrations'] ?? [];
|
||||
if ($request->has('care_integration_enabled')) {
|
||||
$integrations['care_enabled'] = $request->boolean('care_integration_enabled');
|
||||
}
|
||||
if ($request->has('frontdesk_integration_enabled')) {
|
||||
$integrations['frontdesk_enabled'] = $request->boolean('frontdesk_integration_enabled');
|
||||
}
|
||||
@@ -177,8 +173,6 @@ class SettingsController extends Controller
|
||||
|
||||
if (($result['skipped_reason'] ?? null) === 'plan_queue_limit') {
|
||||
$message .= ' Some stages were skipped because of your plan queue limit — upgrade to Pro for the full template.';
|
||||
} elseif (($result['skipped_reason'] ?? null) === 'stages_managed_by_integration') {
|
||||
$message .= ' Stages are managed by Ladill Care; terminology and announcements were updated.';
|
||||
}
|
||||
|
||||
return back()->with('success', $message);
|
||||
|
||||
@@ -12,7 +12,7 @@ class EnsureQueueIntegration
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
$caller = (string) $request->attributes->get('service_caller', '');
|
||||
if (! in_array($caller, ['care', 'frontdesk'], true)) {
|
||||
if ($caller !== 'frontdesk') {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
||||
@@ -63,11 +63,6 @@ class IndustryPackageInstaller
|
||||
$replace = (bool) ($options['replace'] ?? false);
|
||||
$actor = $options['actor_ref'] ?? $organization->owner_ref;
|
||||
|
||||
// Care (and similar) own clinical stage provisioning — still apply terminology.
|
||||
if (! $skipStages && data_get($organization->settings, 'integrations.care_enabled') && $key === 'healthcare') {
|
||||
$skipStages = true;
|
||||
}
|
||||
|
||||
$result = [
|
||||
'package' => $key,
|
||||
'departments' => 0,
|
||||
@@ -81,7 +76,6 @@ class IndustryPackageInstaller
|
||||
|
||||
return DB::transaction(function () use ($organization, $branch, $package, $key, $skipStages, $includeOptional, $replace, $actor, &$result) {
|
||||
// Replacing a package wipes queues/tickets/points so the new template is clean.
|
||||
// Care-managed healthcare keeps clinical queues (skip_stages).
|
||||
if ($replace && ! $skipStages) {
|
||||
$this->clearOperationalData($organization);
|
||||
$result['replaced'] = true;
|
||||
|
||||
@@ -186,19 +186,55 @@ final class DemoWorld
|
||||
* account_role?: string
|
||||
* }>>
|
||||
*/
|
||||
/**
|
||||
* Care specialty module doctors (Pro / Enterprise). Emails: demo-{tier}-{key}@ladill.com
|
||||
*
|
||||
* @var array<string, string> module key => display name
|
||||
*/
|
||||
public const SPECIALTY_DOCTORS = [
|
||||
'emergency' => 'Dr. Kojo Emergency',
|
||||
'blood_bank' => 'Dr. Ama Blood Bank',
|
||||
'dentistry' => 'Dr. Ama Dental',
|
||||
'ophthalmology' => 'Dr. Kofi Eye',
|
||||
'physiotherapy' => 'Dr. Efua Physio',
|
||||
'maternity' => 'Dr. Abena Maternity',
|
||||
'radiology' => 'Dr. Yaw Radiology',
|
||||
'cardiology' => 'Dr. Kwesi Cardiology',
|
||||
'psychiatry' => 'Dr. Adwoa Psychiatry',
|
||||
'pediatrics' => 'Dr. Fiifi Pediatrics',
|
||||
'orthopedics' => 'Dr. Kojo Orthopedics',
|
||||
'ent' => 'Dr. Esi ENT',
|
||||
'oncology' => 'Dr. Mansa Oncology',
|
||||
'renal' => 'Dr. Nana Renal',
|
||||
'surgery' => 'Dr. Kwadwo Surgery',
|
||||
'vaccination' => 'Dr. Afia Vaccination',
|
||||
'pathology' => 'Dr. Yaw Pathology',
|
||||
'infusion' => 'Dr. Akosua Infusion',
|
||||
'dermatology' => 'Dr. Ama Dermatology',
|
||||
'podiatry' => 'Dr. Kofi Podiatry',
|
||||
'fertility' => 'Dr. Abena Fertility',
|
||||
'child_welfare' => 'Dr. Efua Child Welfare',
|
||||
];
|
||||
|
||||
public const STAFF = [
|
||||
'free' => [
|
||||
[
|
||||
'key' => 'receptionist',
|
||||
'email' => 'demo-free-receptionist@ladill.com',
|
||||
'name' => 'Abena Reception (Free)',
|
||||
'apps' => ['care', 'frontdesk', 'queue'],
|
||||
'apps' => ['care', 'frontdesk'],
|
||||
'roles' => [
|
||||
'care' => 'receptionist',
|
||||
'frontdesk' => 'receptionist',
|
||||
'queue' => 'receptionist',
|
||||
],
|
||||
],
|
||||
[
|
||||
'key' => 'queue',
|
||||
'email' => 'demo-free-queue@ladill.com',
|
||||
'name' => 'Ama Queue (Free)',
|
||||
'apps' => ['queue'],
|
||||
'roles' => ['queue' => 'receptionist'],
|
||||
],
|
||||
],
|
||||
'pro' => [
|
||||
[
|
||||
@@ -219,13 +255,19 @@ final class DemoWorld
|
||||
'key' => 'receptionist',
|
||||
'email' => 'demo-pro-receptionist@ladill.com',
|
||||
'name' => 'Abena Reception (Pro)',
|
||||
'apps' => ['care', 'frontdesk', 'queue'],
|
||||
'apps' => ['care', 'frontdesk'],
|
||||
'roles' => [
|
||||
'care' => 'receptionist',
|
||||
'frontdesk' => 'receptionist',
|
||||
'queue' => 'receptionist',
|
||||
],
|
||||
],
|
||||
[
|
||||
'key' => 'queue',
|
||||
'email' => 'demo-pro-queue@ladill.com',
|
||||
'name' => 'Ama Queue (Pro)',
|
||||
'apps' => ['queue'],
|
||||
'roles' => ['queue' => 'receptionist'],
|
||||
],
|
||||
[
|
||||
'key' => 'pharmacist',
|
||||
'email' => 'demo-pro-pharmacist@ladill.com',
|
||||
@@ -292,13 +334,19 @@ final class DemoWorld
|
||||
'key' => 'receptionist',
|
||||
'email' => 'demo-enterprise-receptionist@ladill.com',
|
||||
'name' => 'Abena Reception',
|
||||
'apps' => ['care', 'frontdesk', 'queue'],
|
||||
'apps' => ['care', 'frontdesk'],
|
||||
'roles' => [
|
||||
'care' => 'receptionist',
|
||||
'frontdesk' => 'receptionist',
|
||||
'queue' => 'receptionist',
|
||||
],
|
||||
],
|
||||
[
|
||||
'key' => 'queue',
|
||||
'email' => 'demo-enterprise-queue@ladill.com',
|
||||
'name' => 'Ama Queue',
|
||||
'apps' => ['queue'],
|
||||
'roles' => ['queue' => 'receptionist'],
|
||||
],
|
||||
[
|
||||
'key' => 'pharmacist',
|
||||
'email' => 'demo-enterprise-pharmacist@ladill.com',
|
||||
@@ -471,7 +519,35 @@ final class DemoWorld
|
||||
*/
|
||||
public static function staff(string $tier): array
|
||||
{
|
||||
return self::STAFF[self::normalizeTier($tier)] ?? [];
|
||||
$tier = self::normalizeTier($tier);
|
||||
$roster = self::STAFF[$tier] ?? [];
|
||||
if (! in_array($tier, ['pro', 'enterprise'], true)) {
|
||||
return $roster;
|
||||
}
|
||||
|
||||
foreach (self::SPECIALTY_DOCTORS as $key => $name) {
|
||||
$email = sprintf('demo-%s-%s@ladill.com', $tier, $key);
|
||||
$already = false;
|
||||
foreach ($roster as $row) {
|
||||
if (strtolower((string) ($row['email'] ?? '')) === $email) {
|
||||
$already = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($already) {
|
||||
continue;
|
||||
}
|
||||
$suffix = $tier === 'pro' ? ' (Pro)' : '';
|
||||
$roster[] = [
|
||||
'key' => $key,
|
||||
'email' => $email,
|
||||
'name' => $name.$suffix,
|
||||
'apps' => ['care'],
|
||||
'roles' => ['care' => 'doctor'],
|
||||
];
|
||||
}
|
||||
|
||||
return $roster;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -484,8 +560,8 @@ final class DemoWorld
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach (self::STAFF as $roster) {
|
||||
foreach ($roster as $member) {
|
||||
foreach (['free', 'pro', 'enterprise'] as $tier) {
|
||||
foreach (self::staff($tier) as $member) {
|
||||
if (strtolower($member['email']) === $email) {
|
||||
return $member;
|
||||
}
|
||||
|
||||
@@ -16,140 +16,6 @@ return [
|
||||
|
||||
'packages' => [
|
||||
|
||||
'healthcare' => [
|
||||
'label' => 'Healthcare',
|
||||
'description' => 'Hospitals and clinics — multi-department patient journeys with doctor-specific service points.',
|
||||
'ticket_entity' => 'patient',
|
||||
'integrations' => ['care'],
|
||||
'display_layout' => 'standard',
|
||||
'terminology' => [
|
||||
'ticket' => 'Patient',
|
||||
'tickets' => 'Patients',
|
||||
'queue' => 'Waiting list',
|
||||
'service_point' => 'Room / desk',
|
||||
'worker' => 'Clinician',
|
||||
'customer' => 'Patient',
|
||||
'call_next' => 'Call next patient',
|
||||
],
|
||||
'announcement' => [
|
||||
'en' => 'Patient :ticket, please proceed to :destination.',
|
||||
'fr' => 'Patient :ticket, veuillez vous rendre au :destination.',
|
||||
'with_staff' => ':ticket, :staff, :destination.',
|
||||
],
|
||||
'kpis' => [
|
||||
'avg_wait_time',
|
||||
'consultation_time',
|
||||
'doctor_utilization',
|
||||
'patient_throughput',
|
||||
],
|
||||
'workflow' => [
|
||||
'name' => 'Patient journey',
|
||||
'description' => 'Registration through discharge',
|
||||
],
|
||||
'departments' => [
|
||||
['code' => 'reception', 'name' => 'Registration', 'type' => 'reception'],
|
||||
['code' => 'triage', 'name' => 'Triage', 'type' => 'consultation'],
|
||||
['code' => 'consultation', 'name' => 'Consultation', 'type' => 'consultation'],
|
||||
['code' => 'laboratory', 'name' => 'Laboratory', 'type' => 'laboratory'],
|
||||
['code' => 'imaging', 'name' => 'Imaging', 'type' => 'laboratory'],
|
||||
['code' => 'pharmacy', 'name' => 'Pharmacy', 'type' => 'pharmacy'],
|
||||
['code' => 'billing', 'name' => 'Billing', 'type' => 'cashier'],
|
||||
],
|
||||
'stages' => [
|
||||
[
|
||||
'code' => 'reception',
|
||||
'department' => 'reception',
|
||||
'name' => 'Registration',
|
||||
'prefix' => 'R',
|
||||
'strategy' => 'fifo',
|
||||
'routing_mode' => 'shared_pool',
|
||||
'routing_strategy' => 'round_robin',
|
||||
'optional' => false,
|
||||
'service_points' => [
|
||||
['name' => 'Registration Desk 1', 'destination' => 'Registration Desk 1', 'code' => 'RD1'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'code' => 'triage',
|
||||
'department' => 'triage',
|
||||
'name' => 'Triage',
|
||||
'prefix' => 'T',
|
||||
'strategy' => 'priority',
|
||||
'routing_mode' => 'assigned_only',
|
||||
'routing_strategy' => 'manual_assignment',
|
||||
'optional' => true,
|
||||
'service_points' => [
|
||||
['name' => 'Triage Station 1', 'destination' => 'Triage Station 1', 'code' => 'TS1'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'code' => 'consultation',
|
||||
'department' => 'consultation',
|
||||
'name' => 'Consultation',
|
||||
'prefix' => 'C',
|
||||
'strategy' => 'appointment',
|
||||
'routing_mode' => 'assigned_only',
|
||||
'routing_strategy' => 'doctor_assignment',
|
||||
'optional' => false,
|
||||
'service_points' => [
|
||||
['name' => 'Consultation Room 1', 'destination' => 'Consultation Room 1', 'code' => 'CR1'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'code' => 'laboratory',
|
||||
'department' => 'laboratory',
|
||||
'name' => 'Laboratory',
|
||||
'prefix' => 'L',
|
||||
'strategy' => 'fifo',
|
||||
'routing_mode' => 'shared_pool',
|
||||
'routing_strategy' => 'least_busy',
|
||||
'optional' => true,
|
||||
'service_points' => [
|
||||
['name' => 'Sample Collection Desk 1', 'destination' => 'Sample Desk 1', 'code' => 'LD1'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'code' => 'imaging',
|
||||
'department' => 'imaging',
|
||||
'name' => 'Imaging',
|
||||
'prefix' => 'I',
|
||||
'strategy' => 'fifo',
|
||||
'routing_mode' => 'shared_pool',
|
||||
'routing_strategy' => 'skill_based',
|
||||
'optional' => true,
|
||||
'service_points' => [
|
||||
['name' => 'X-Ray', 'destination' => 'X-Ray Room', 'code' => 'XR1'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'code' => 'pharmacy',
|
||||
'department' => 'pharmacy',
|
||||
'name' => 'Pharmacy',
|
||||
'prefix' => 'P',
|
||||
'strategy' => 'fifo',
|
||||
'routing_mode' => 'shared_pool',
|
||||
'routing_strategy' => 'least_busy',
|
||||
'optional' => false,
|
||||
'service_points' => [
|
||||
['name' => 'Pharmacy Counter 1', 'destination' => 'Pharmacy Counter 1', 'code' => 'PC1'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'code' => 'billing',
|
||||
'department' => 'billing',
|
||||
'name' => 'Billing',
|
||||
'prefix' => 'B',
|
||||
'strategy' => 'fifo',
|
||||
'routing_mode' => 'shared_pool',
|
||||
'routing_strategy' => 'round_robin',
|
||||
'optional' => false,
|
||||
'service_points' => [
|
||||
['name' => 'Cashier 1', 'destination' => 'Cashier 1', 'code' => 'CA1'],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'restaurant' => [
|
||||
'label' => 'Restaurant',
|
||||
'description' => 'Kitchen production queues and pickup — integrates with Ladill POS.',
|
||||
|
||||
+2
-20
@@ -58,14 +58,6 @@ return [
|
||||
| Missing keys fall back to ticket_priorities above.
|
||||
*/
|
||||
'ticket_priorities_by_industry' => [
|
||||
'healthcare' => [
|
||||
'emergency' => 'Emergency',
|
||||
'vip' => 'VIP',
|
||||
'elderly' => 'Elderly',
|
||||
'disabled' => 'Disabled',
|
||||
'appointment' => 'Appointment',
|
||||
'walk_in' => 'Walk-in',
|
||||
],
|
||||
'restaurant' => [
|
||||
'emergency' => 'Rush',
|
||||
'vip' => 'VIP table',
|
||||
@@ -243,7 +235,6 @@ return [
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'industry_templates' => [
|
||||
'healthcare' => 'Healthcare',
|
||||
'restaurant' => 'Restaurant',
|
||||
'banking' => 'Banking',
|
||||
'government' => 'Government Office',
|
||||
@@ -264,7 +255,7 @@ return [
|
||||
'round_robin' => 'Round robin',
|
||||
'least_busy' => 'Least busy',
|
||||
'skill_based' => 'Skill based',
|
||||
'doctor_assignment' => 'Doctor assignment',
|
||||
'doctor_assignment' => 'Staff assignment',
|
||||
'manual_assignment' => 'Manual assignment',
|
||||
'priority_assignment' => 'Priority assignment',
|
||||
'appointment_based' => 'Appointment based',
|
||||
@@ -407,14 +398,6 @@ return [
|
||||
| Legacy thin workflow name lists — prefer industry_packages.stages for installs.
|
||||
*/
|
||||
'workflow_templates' => [
|
||||
'healthcare' => [
|
||||
['name' => 'Registration', 'sort_order' => 1],
|
||||
['name' => 'Triage', 'sort_order' => 2],
|
||||
['name' => 'Consultation', 'sort_order' => 3],
|
||||
['name' => 'Laboratory', 'sort_order' => 4],
|
||||
['name' => 'Pharmacy', 'sort_order' => 5],
|
||||
['name' => 'Billing', 'sort_order' => 6],
|
||||
],
|
||||
'banking' => [
|
||||
['name' => 'Reception', 'sort_order' => 1],
|
||||
['name' => 'Teller', 'sort_order' => 2],
|
||||
@@ -438,7 +421,6 @@ return [
|
||||
'service_api_keys' => array_filter([
|
||||
'pos' => env('QUEUE_API_KEY_POS'),
|
||||
'crm' => env('QUEUE_API_KEY_CRM'),
|
||||
'care' => env('QUEUE_API_KEY_CARE'),
|
||||
'frontdesk' => env('QUEUE_API_KEY_FRONTDESK'),
|
||||
]),
|
||||
|
||||
@@ -446,7 +428,7 @@ return [
|
||||
|
||||
'upgrade_banner' => [
|
||||
'title' => 'Unlock Queue Pro or Enterprise',
|
||||
'description' => 'Unlimited branches, advanced routing, Care & Frontdesk integrations — from GHS 2490/branch/mo.',
|
||||
'description' => 'Unlimited branches, advanced routing, Frontdesk & POS integrations — from GHS 2490/branch/mo.',
|
||||
'route' => 'qms.pro.index',
|
||||
],
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
<li>Advanced routing rules</li>
|
||||
<li>Unlimited kiosks & displays</li>
|
||||
<li>Ladill-provided queue kiosk, display and audio system</li>
|
||||
<li>Care & Frontdesk API</li>
|
||||
<li>Frontdesk & POS API</li>
|
||||
<li>Reports & exports</li>
|
||||
</ul>
|
||||
<div class="mt-6">
|
||||
|
||||
@@ -132,12 +132,8 @@
|
||||
</x-settings.card>
|
||||
@endif
|
||||
|
||||
<x-settings.card title="Integrations" description="Allow Ladill Care and Frontdesk to manage queues in-app via the Queue API. Both apps must also enable integration in their settings.">
|
||||
<x-settings.card title="Integrations" description="Allow Ladill Frontdesk to manage queues in-app via the Queue API. Frontdesk must also enable integration in its settings.">
|
||||
<div class="space-y-2">
|
||||
<label class="flex items-center gap-2 text-sm">
|
||||
<input type="checkbox" name="care_integration_enabled" value="1" @checked(data_get($organization->settings, 'integrations.care_enabled')) @disabled(! $canManage)>
|
||||
Ladill Care can manage queues
|
||||
</label>
|
||||
<label class="flex items-center gap-2 text-sm">
|
||||
<input type="checkbox" name="frontdesk_integration_enabled" value="1" @checked(data_get($organization->settings, 'integrations.frontdesk_enabled')) @disabled(! $canManage)>
|
||||
Ladill Frontdesk can manage queues
|
||||
|
||||
@@ -1,242 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Branch;
|
||||
use App\Models\Counter;
|
||||
use App\Models\Organization;
|
||||
use App\Models\ServiceQueue;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class CareIntegrationTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function careHeaders(string $owner = 'care-owner-uuid'): array
|
||||
{
|
||||
config(['qms.service_api_keys.care' => 'test-care-key']);
|
||||
|
||||
return [
|
||||
'Authorization' => 'Bearer test-care-key',
|
||||
'Accept' => 'application/json',
|
||||
];
|
||||
}
|
||||
|
||||
protected function provisionCareOrg(string $owner = 'care-owner-uuid'): Organization
|
||||
{
|
||||
$this->postJson('/api/v1/integrations/provision', [
|
||||
'owner' => $owner,
|
||||
'organization_name' => 'Care Clinic',
|
||||
'branch_name' => 'Main',
|
||||
], $this->careHeaders($owner))->assertSuccessful();
|
||||
|
||||
return Organization::owned($owner)->firstOrFail();
|
||||
}
|
||||
|
||||
public function test_provision_enables_care_integration(): void
|
||||
{
|
||||
$owner = 'care-owner-uuid';
|
||||
|
||||
$this->postJson('/api/v1/integrations/provision', [
|
||||
'owner' => $owner,
|
||||
'organization_name' => 'Care Clinic',
|
||||
'branch_name' => 'Main',
|
||||
], $this->careHeaders($owner))
|
||||
->assertCreated()
|
||||
->assertJsonPath('data.integrations.care', true);
|
||||
|
||||
$organization = Organization::owned($owner)->first();
|
||||
$this->assertTrue((bool) data_get($organization->settings, 'integrations.care_enabled'));
|
||||
}
|
||||
|
||||
public function test_counters_allowed_after_care_provision(): void
|
||||
{
|
||||
$owner = 'care-owner-uuid';
|
||||
$headers = $this->careHeaders($owner);
|
||||
|
||||
$this->provisionCareOrg($owner);
|
||||
|
||||
$this->getJson('/api/v1/counters?owner='.$owner, $headers)
|
||||
->assertOk();
|
||||
}
|
||||
|
||||
public function test_counter_console_resolves_by_uuid(): void
|
||||
{
|
||||
$owner = 'care-owner-uuid';
|
||||
$headers = $this->careHeaders($owner);
|
||||
$organization = $this->provisionCareOrg($owner);
|
||||
$branch = Branch::owned($owner)->where('organization_id', $organization->id)->firstOrFail();
|
||||
$queue = ServiceQueue::create([
|
||||
'owner_ref' => $owner,
|
||||
'organization_id' => $organization->id,
|
||||
'branch_id' => $branch->id,
|
||||
'name' => 'Morning Shift',
|
||||
'prefix' => 'A',
|
||||
'strategy' => 'fifo',
|
||||
'is_active' => true,
|
||||
]);
|
||||
$counter = Counter::create([
|
||||
'owner_ref' => $owner,
|
||||
'organization_id' => $organization->id,
|
||||
'branch_id' => $branch->id,
|
||||
'name' => 'Counter 1',
|
||||
'code' => 'C001',
|
||||
'status' => 'available',
|
||||
'is_active' => true,
|
||||
]);
|
||||
$counter->serviceQueues()->sync([$queue->id]);
|
||||
|
||||
$this->getJson('/api/v1/counters/'.$counter->uuid.'/console?owner='.$owner, $headers)
|
||||
->assertOk()
|
||||
->assertJsonPath('data.counter.uuid', $counter->uuid);
|
||||
}
|
||||
|
||||
public function test_queue_models_use_uuid_route_key(): void
|
||||
{
|
||||
$this->assertSame('uuid', (new Counter)->getRouteKeyName());
|
||||
$this->assertSame('uuid', (new ServiceQueue)->getRouteKeyName());
|
||||
}
|
||||
|
||||
public function test_care_can_create_queue_and_counter_idempotently(): void
|
||||
{
|
||||
$owner = 'care-owner-uuid';
|
||||
$headers = $this->careHeaders($owner);
|
||||
$this->provisionCareOrg($owner);
|
||||
|
||||
$queueResponse = $this->postJson('/api/v1/queues', [
|
||||
'owner' => $owner,
|
||||
'name' => 'Dentistry',
|
||||
'prefix' => 'DEN',
|
||||
'branch_name' => 'Main',
|
||||
'external_key' => 'care:specialty:dentistry:queue:1',
|
||||
'strategy' => 'fifo',
|
||||
], $headers)
|
||||
->assertCreated()
|
||||
->assertJsonPath('data.name', 'Dentistry')
|
||||
->assertJsonPath('data.external_key', 'care:specialty:dentistry:queue:1');
|
||||
|
||||
$queueUuid = $queueResponse->json('data.uuid');
|
||||
|
||||
$this->postJson('/api/v1/queues', [
|
||||
'owner' => $owner,
|
||||
'name' => 'Dentistry Desk',
|
||||
'prefix' => 'DEN',
|
||||
'branch_name' => 'Main',
|
||||
'external_key' => 'care:specialty:dentistry:queue:1',
|
||||
'strategy' => 'fifo',
|
||||
], $headers)
|
||||
->assertOk()
|
||||
->assertJsonPath('data.uuid', $queueUuid)
|
||||
->assertJsonPath('data.name', 'Dentistry Desk');
|
||||
|
||||
$this->assertSame(1, ServiceQueue::owned($owner)->count());
|
||||
|
||||
$counterResponse = $this->postJson('/api/v1/counters', [
|
||||
'owner' => $owner,
|
||||
'name' => 'Dentistry counter',
|
||||
'branch_name' => 'Main',
|
||||
'queue_uuids' => [$queueUuid],
|
||||
'external_key' => 'care:specialty:dentistry:counter:1',
|
||||
], $headers)
|
||||
->assertCreated()
|
||||
->assertJsonPath('data.name', 'Dentistry counter')
|
||||
->assertJsonPath('data.branch', 'Main')
|
||||
->assertJsonPath('data.queues.0.uuid', $queueUuid);
|
||||
|
||||
$counterUuid = $counterResponse->json('data.uuid');
|
||||
|
||||
$this->postJson('/api/v1/counters', [
|
||||
'owner' => $owner,
|
||||
'name' => 'Dentistry counter',
|
||||
'branch_name' => 'Main',
|
||||
'queue_uuids' => [$queueUuid],
|
||||
'external_key' => 'care:specialty:dentistry:counter:1',
|
||||
], $headers)
|
||||
->assertOk()
|
||||
->assertJsonPath('data.uuid', $counterUuid);
|
||||
|
||||
$this->assertSame(1, Counter::owned($owner)->count());
|
||||
|
||||
$this->getJson('/api/v1/counters?owner='.$owner, $headers)
|
||||
->assertOk()
|
||||
->assertJsonPath('data.0.uuid', $counterUuid)
|
||||
->assertJsonPath('data.0.branch', 'Main')
|
||||
->assertJsonPath('data.0.queues.0.name', 'Dentistry Desk');
|
||||
}
|
||||
|
||||
public function test_care_can_soft_deactivate_counter(): void
|
||||
{
|
||||
$owner = 'care-owner-uuid';
|
||||
$headers = $this->careHeaders($owner);
|
||||
$organization = $this->provisionCareOrg($owner);
|
||||
$branch = Branch::owned($owner)->where('organization_id', $organization->id)->firstOrFail();
|
||||
$counter = Counter::create([
|
||||
'owner_ref' => $owner,
|
||||
'organization_id' => $organization->id,
|
||||
'branch_id' => $branch->id,
|
||||
'name' => 'Eye care counter',
|
||||
'status' => 'offline',
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
$this->patchJson('/api/v1/counters/'.$counter->uuid, [
|
||||
'owner' => $owner,
|
||||
'is_active' => false,
|
||||
], $headers)
|
||||
->assertOk()
|
||||
->assertJsonPath('data.is_active', false);
|
||||
|
||||
$this->assertFalse($counter->fresh()->is_active);
|
||||
$this->assertDatabaseHas('queue_counters', ['id' => $counter->id]);
|
||||
}
|
||||
|
||||
public function test_care_can_ensure_branch_by_name_idempotently(): void
|
||||
{
|
||||
$owner = 'care-owner-uuid';
|
||||
$headers = $this->careHeaders($owner);
|
||||
$this->provisionCareOrg($owner);
|
||||
|
||||
// Free plan is capped at 1 branch; provision already created Main — upsert must not duplicate.
|
||||
$this->postJson('/api/v1/branches', [
|
||||
'owner' => $owner,
|
||||
'name' => 'Main',
|
||||
], $headers)
|
||||
->assertOk()
|
||||
->assertJsonPath('data.name', 'Main')
|
||||
->assertJsonPath('data.is_active', true);
|
||||
|
||||
$this->assertSame(1, Branch::owned($owner)->count());
|
||||
}
|
||||
|
||||
public function test_care_can_issue_ticket_via_service_api(): void
|
||||
{
|
||||
$owner = 'care-owner-uuid';
|
||||
$headers = $this->careHeaders($owner);
|
||||
$this->provisionCareOrg($owner);
|
||||
|
||||
$queueUuid = $this->postJson('/api/v1/queues', [
|
||||
'owner' => $owner,
|
||||
'name' => 'Consultation',
|
||||
'prefix' => 'C',
|
||||
'branch_name' => 'Main',
|
||||
'external_key' => 'care:dept:consultation:queue:1',
|
||||
'strategy' => 'fifo',
|
||||
], $headers)->assertCreated()->json('data.uuid');
|
||||
|
||||
$this->postJson('/api/v1/tickets', [
|
||||
'owner' => $owner,
|
||||
'service_queue_id' => $queueUuid,
|
||||
'customer_name' => 'Ada Patient',
|
||||
'source' => 'appointment',
|
||||
'metadata' => [
|
||||
'care_entity' => 'appointment',
|
||||
'care_entity_id' => 42,
|
||||
],
|
||||
], $headers)
|
||||
->assertCreated()
|
||||
->assertJsonPath('data.ticket_number', 'C001')
|
||||
->assertJsonPath('data.status', 'waiting')
|
||||
->assertJsonPath('data.customer_name', 'Ada Patient');
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,7 @@ class DemoSeedCommandTest extends TestCase
|
||||
$this->assertTrue(
|
||||
Member::query()
|
||||
->where('owner_ref', $user->public_id)
|
||||
->where('user_ref', 'demo-pro-receptionist@ladill.com')
|
||||
->where('user_ref', 'demo-pro-queue@ladill.com')
|
||||
->where('role', 'receptionist')
|
||||
->exists()
|
||||
);
|
||||
|
||||
@@ -23,12 +23,13 @@ class IndustryPackageTest extends TestCase
|
||||
{
|
||||
$registry = app(IndustryPackageRegistry::class);
|
||||
|
||||
$this->assertTrue($registry->has('healthcare'));
|
||||
$this->assertTrue($registry->has('banking'));
|
||||
$this->assertTrue($registry->has('vehicle'));
|
||||
$this->assertTrue($registry->has('restaurant'));
|
||||
$this->assertTrue($registry->has('custom'));
|
||||
$this->assertSame('Healthcare', $registry->get('healthcare')->label());
|
||||
$this->assertSame('patient', $registry->get('healthcare')->ticketEntity());
|
||||
$this->assertSame('Banking', $registry->get('banking')->label());
|
||||
$this->assertSame('customer', $registry->get('banking')->ticketEntity());
|
||||
$this->assertSame('vehicle', $registry->get('vehicle')->ticketEntity());
|
||||
$this->assertSame('order', $registry->get('restaurant')->ticketEntity());
|
||||
}
|
||||
|
||||
@@ -76,18 +77,18 @@ class IndustryPackageTest extends TestCase
|
||||
$this->assertGreaterThanOrEqual(3, $workflow->steps()->count());
|
||||
}
|
||||
|
||||
public function test_healthcare_uses_assigned_only_for_consultation(): void
|
||||
public function test_vehicle_uses_assigned_only_for_mechanic(): void
|
||||
{
|
||||
$user = User::create([
|
||||
'public_id' => 'pkg-care-owner',
|
||||
'name' => 'Clinic Owner',
|
||||
'email' => 'clinic-owner@example.com',
|
||||
'public_id' => 'pkg-vehicle-owner',
|
||||
'name' => 'Garage Owner',
|
||||
'email' => 'garage-owner@example.com',
|
||||
'password' => bcrypt('password'),
|
||||
]);
|
||||
|
||||
// Pro plan so all healthcare stages fit under queue caps.
|
||||
// Pro plan so all vehicle stages fit under queue caps.
|
||||
$org = app(OrganizationResolver::class)->completeOnboarding($user, [
|
||||
'organization_name' => 'Ridge Clinic',
|
||||
'organization_name' => 'Ridge Motors',
|
||||
'industry' => 'custom',
|
||||
'appointment_mode' => 'hybrid',
|
||||
'branch_name' => 'Main',
|
||||
@@ -101,19 +102,19 @@ class IndustryPackageTest extends TestCase
|
||||
]);
|
||||
|
||||
$branch = Branch::where('organization_id', $org->id)->first();
|
||||
$result = app(IndustryPackageInstaller::class)->install($org->fresh(), $branch, 'healthcare');
|
||||
$result = app(IndustryPackageInstaller::class)->install($org->fresh(), $branch, 'vehicle');
|
||||
|
||||
$this->assertSame('healthcare', $result['package']);
|
||||
$this->assertSame('vehicle', $result['package']);
|
||||
$this->assertGreaterThanOrEqual(5, $result['stages']);
|
||||
|
||||
$consultation = ServiceQueue::query()
|
||||
$mechanic = ServiceQueue::query()
|
||||
->where('organization_id', $org->id)
|
||||
->where('settings->stage_code', 'consultation')
|
||||
->where('settings->stage_code', 'mechanic')
|
||||
->first();
|
||||
|
||||
$this->assertNotNull($consultation);
|
||||
$this->assertSame('assigned_only', $consultation->routingMode());
|
||||
$this->assertSame('C', $consultation->prefix);
|
||||
$this->assertNotNull($mechanic);
|
||||
$this->assertSame('assigned_only', $mechanic->routingMode());
|
||||
$this->assertSame('M', $mechanic->prefix);
|
||||
}
|
||||
|
||||
public function test_package_install_is_idempotent(): void
|
||||
@@ -182,38 +183,6 @@ class IndustryPackageTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function test_care_integration_skips_stage_materialization(): void
|
||||
{
|
||||
$user = User::create([
|
||||
'public_id' => 'pkg-care-skip',
|
||||
'name' => 'Care Skip',
|
||||
'email' => 'care-skip@example.com',
|
||||
'password' => bcrypt('password'),
|
||||
]);
|
||||
|
||||
$org = app(OrganizationResolver::class)->completeOnboarding($user, [
|
||||
'organization_name' => 'Care Linked',
|
||||
'industry' => 'custom',
|
||||
'appointment_mode' => 'hybrid',
|
||||
'branch_name' => 'Main',
|
||||
'timezone' => 'UTC',
|
||||
]);
|
||||
$org->update([
|
||||
'settings' => array_merge($org->settings ?? [], [
|
||||
'integrations' => ['care_enabled' => true],
|
||||
]),
|
||||
]);
|
||||
$before = ServiceQueue::where('organization_id', $org->id)->count();
|
||||
$branch = Branch::where('organization_id', $org->id)->first();
|
||||
|
||||
$result = app(IndustryPackageInstaller::class)->install($org->fresh(), $branch, 'healthcare');
|
||||
|
||||
$this->assertSame('stages_managed_by_integration', $result['skipped_reason']);
|
||||
$this->assertSame(0, $result['stages']);
|
||||
$this->assertSame($before, ServiceQueue::where('organization_id', $org->id)->count());
|
||||
$this->assertSame('patient', data_get($org->fresh()->settings, 'industry_package.ticket_entity'));
|
||||
}
|
||||
|
||||
public function test_replace_install_clears_previous_queues_and_tickets(): void
|
||||
{
|
||||
$user = User::create([
|
||||
|
||||
@@ -39,7 +39,7 @@ class ServicePointRoutingTest extends TestCase
|
||||
]);
|
||||
$org = app(OrganizationResolver::class)->completeOnboarding($user, [
|
||||
'organization_name' => 'Clinic',
|
||||
'industry' => 'healthcare',
|
||||
'industry' => 'banking',
|
||||
'appointment_mode' => 'hybrid',
|
||||
'branch_name' => 'Main',
|
||||
'timezone' => 'UTC',
|
||||
@@ -354,18 +354,18 @@ class ServicePointRoutingTest extends TestCase
|
||||
$this->assertSame($third->id, $engine->waitingTickets($queue)[0]->id);
|
||||
}
|
||||
|
||||
public function test_care_api_can_issue_assigned_ticket(): void
|
||||
public function test_frontdesk_api_can_issue_assigned_ticket(): void
|
||||
{
|
||||
config(['qms.service_api_keys.care' => 'test-care-key']);
|
||||
$owner = 'care-sp-owner';
|
||||
config(['qms.service_api_keys.frontdesk' => 'test-frontdesk-key']);
|
||||
$owner = 'frontdesk-sp-owner';
|
||||
$headers = [
|
||||
'Authorization' => 'Bearer test-care-key',
|
||||
'Authorization' => 'Bearer test-frontdesk-key',
|
||||
'Accept' => 'application/json',
|
||||
];
|
||||
|
||||
$this->postJson('/api/v1/integrations/provision', [
|
||||
'owner' => $owner,
|
||||
'organization_name' => 'Care Clinic',
|
||||
'organization_name' => 'Visitor Desk',
|
||||
'branch_name' => 'Main',
|
||||
], $headers)->assertSuccessful();
|
||||
|
||||
@@ -374,7 +374,7 @@ class ServicePointRoutingTest extends TestCase
|
||||
'name' => 'Consultation',
|
||||
'prefix' => 'C',
|
||||
'branch_name' => 'Main',
|
||||
'external_key' => 'care:dept:consultation:queue:1',
|
||||
'external_key' => 'frontdesk:dept:consultation:queue:1',
|
||||
'routing_mode' => 'assigned_only',
|
||||
], $headers)->assertCreated()->json('data.uuid');
|
||||
|
||||
@@ -385,7 +385,7 @@ class ServicePointRoutingTest extends TestCase
|
||||
'staff_display_name' => 'Dr. Mensah',
|
||||
'branch_name' => 'Main',
|
||||
'queue_uuids' => [$queueUuid],
|
||||
'external_key' => 'care:point:consultation:practitioner:9',
|
||||
'external_key' => 'frontdesk:point:consultation:practitioner:9',
|
||||
], $headers)->assertCreated()->json('data.uuid');
|
||||
|
||||
$this->postJson('/api/v1/tickets', [
|
||||
|
||||
@@ -59,7 +59,7 @@ class SettingsBranchesTeamTest extends TestCase
|
||||
'appointment_mode' => 'walk_in_only',
|
||||
'industry' => 'retail',
|
||||
'notifications_enabled' => '1',
|
||||
'care_integration_enabled' => '1',
|
||||
'frontdesk_integration_enabled' => '1',
|
||||
])
|
||||
->assertRedirect()
|
||||
->assertSessionHas('success');
|
||||
@@ -68,7 +68,7 @@ class SettingsBranchesTeamTest extends TestCase
|
||||
$this->assertSame('Settings Org Updated', $this->organization->name);
|
||||
$this->assertSame('Africa/Accra', $this->organization->timezone);
|
||||
$this->assertSame('walk_in_only', data_get($this->organization->settings, 'appointment_mode'));
|
||||
$this->assertTrue((bool) data_get($this->organization->settings, 'integrations.care_enabled'));
|
||||
$this->assertTrue((bool) data_get($this->organization->settings, 'integrations.frontdesk_enabled'));
|
||||
}
|
||||
|
||||
public function test_settings_page_does_not_nest_reinstall_form(): void
|
||||
|
||||
@@ -45,7 +45,7 @@ class TicketTransferProTest extends TestCase
|
||||
|
||||
$this->organization = app(OrganizationResolver::class)->completeOnboarding($this->owner, [
|
||||
'organization_name' => 'Transfer Org',
|
||||
'industry' => 'healthcare',
|
||||
'industry' => 'banking',
|
||||
'appointment_mode' => 'hybrid',
|
||||
'branch_name' => 'Main',
|
||||
'timezone' => 'UTC',
|
||||
|
||||
Reference in New Issue
Block a user