Use industry-specific ticket priority labels.
Deploy Ladill Queue / deploy (push) Successful in 55s

Restaurant (and other packages) now show Rush, Reservation, VIP table, etc. instead of clinic terms like Emergency and Elderly.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-17 20:15:56 +00:00
co-authored by Cursor
parent a2d5a8affd
commit b5ffa499b9
11 changed files with 252 additions and 4 deletions
@@ -28,6 +28,7 @@ class QueueRuleController extends Controller
'queue' => $serviceQueue,
'rules' => $rules,
'ruleTypes' => config('qms.rule_types'),
'ticketPriorities' => \App\Services\Qms\TicketPriorities::forOrganization($this->organization($request)),
]);
}
@@ -73,7 +73,12 @@ class TicketController extends Controller
);
$selectedQueue = $queues->firstWhere('id', $selectedQueueId) ?? $queues->first();
return view('qms.tickets.create', compact('queues', 'organization', 'selectedQueue'));
return view('qms.tickets.create', [
'queues' => $queues,
'organization' => $organization,
'selectedQueue' => $selectedQueue,
'ticketPriorities' => \App\Services\Qms\TicketPriorities::forOrganization($organization),
]);
}
public function store(Request $request): RedirectResponse
@@ -55,6 +55,19 @@ class IndustryPackage
return (array) ($this->definition['terminology'] ?? []);
}
/**
* Priority keys stay global; labels are industry-specific.
*
* @return array<string, string>
*/
public function priorities(): array
{
$fromPackage = (array) ($this->definition['priorities'] ?? []);
$fromIndustry = (array) config("qms.ticket_priorities_by_industry.{$this->key}", []);
return \App\Services\Qms\TicketPriorities::mergeDefaults(array_merge($fromIndustry, $fromPackage));
}
/**
* @return array<string, string>
*/
@@ -154,6 +154,7 @@ class IndustryPackageInstaller
'skipped_reason' => $result['skipped_reason'],
'ticket_entity' => $package->ticketEntity(),
'terminology' => $package->terminology(),
'priorities' => $package->priorities(),
'announcement' => $package->announcement(),
'display_layout' => $package->displayLayout(),
'kpis' => $package->kpis(),
+3 -1
View File
@@ -3,6 +3,7 @@
namespace App\Services\Qms;
use App\Models\Ticket;
use App\Services\Qms\TicketPriorities;
class TicketPresenter
{
@@ -11,7 +12,7 @@ class TicketPresenter
*/
public static function toArray(Ticket $ticket, bool $includeQr = true): array
{
$ticket->loadMissing(['serviceQueue', 'counter', 'assignedCounter']);
$ticket->loadMissing(['serviceQueue', 'counter', 'assignedCounter', 'organization']);
$serving = $ticket->counter;
$assigned = $ticket->assignedCounter;
@@ -22,6 +23,7 @@ class TicketPresenter
'ticket_number' => $ticket->ticket_number,
'status' => $ticket->status,
'priority' => $ticket->priority,
'priority_label' => TicketPriorities::label($ticket->organization, $ticket->priority),
'position' => $ticket->position,
'customer_name' => $ticket->customer_name,
'customer_phone' => $ticket->customer_phone,
+66
View File
@@ -0,0 +1,66 @@
<?php
namespace App\Services\Qms;
use App\Models\Organization;
use App\Services\Qms\Industry\IndustryPackageRegistry;
class TicketPriorities
{
/**
* @return array<string, string> priority key => industry label
*/
public static function forOrganization(?Organization $organization): array
{
$stored = data_get($organization?->settings, 'industry_package.priorities');
if (is_array($stored) && $stored !== []) {
return self::mergeDefaults($stored);
}
$key = (string) (
data_get($organization?->settings, 'industry_package.key')
?? data_get($organization?->settings, 'industry')
?? 'custom'
);
return self::forIndustryKey($key);
}
/**
* @return array<string, string>
*/
public static function forIndustryKey(string $key): array
{
$package = app(IndustryPackageRegistry::class)->get($key);
return $package?->priorities() ?? self::mergeDefaults(
(array) config("qms.ticket_priorities_by_industry.{$key}", [])
);
}
public static function label(?Organization $organization, ?string $priority): string
{
if ($priority === null || $priority === '') {
return '';
}
$map = self::forOrganization($organization);
return $map[$priority] ?? (string) (config("qms.ticket_priorities.{$priority}") ?? $priority);
}
/**
* @param array<string, string> $overrides
* @return array<string, string>
*/
public static function mergeDefaults(array $overrides): array
{
$defaults = (array) config('qms.ticket_priorities', []);
$merged = [];
foreach ($defaults as $key => $label) {
$merged[$key] = (string) ($overrides[$key] ?? $label);
}
return $merged;
}
}