@ -5,7 +5,7 @@ import {
FormField , FormGrid , Notice , PageHeader , Skeleton , Toolbar , useToast ,
FormField , FormGrid , Notice , PageHeader , Skeleton , Toolbar , useToast ,
} from '@sims/ui'
} from '@sims/ui'
import {
import {
createTicket , getBranches , getClients , getEmployees , get Tickets, patchTicket , staffId ,
createTicket , getBranches , getClients , getEmployees , get Modules, get Tickets, patchTicket , staffId ,
TICKET_STATUSES ,
TICKET_STATUSES ,
type Branch , type Client , type Employee , type Ticket , type TicketStatus ,
type Branch , type Client , type Employee , type Ticket , type TicketStatus ,
} from '../api'
} from '../api'
@ -13,7 +13,8 @@ import { useData } from './Clients'
const PAGE_SIZE = 50
const PAGE_SIZE = 50
/** The five APEX service lines (D20 design §1) — suggestions only; module stays free text. */
/ * * F a l l b a c k s u g g e s t i o n s w h i l e t h e c a t a l o g l o a d s — t h e l i v e m o d u l e l i s t i s t h e
* real source , so a module added tomorrow shows up here with zero code changes . * /
export const TICKET_MODULE_CODES = [ 'SMS' , 'RTGS' , 'WHATSAPP' , 'MOBILEAPP' , 'ATM' ]
export const TICKET_MODULE_CODES = [ 'SMS' , 'RTGS' , 'WHATSAPP' , 'MOBILEAPP' , 'ATM' ]
export const TICKET_STATUS_LABEL : Record < TicketStatus , string > = {
export const TICKET_STATUS_LABEL : Record < TicketStatus , string > = {
@ -120,6 +121,8 @@ export function NewTicketDialog(props: {
const [ f , setF ] = useState ( { branchId : '' , module Code : '' , kind : '' , description : '' , onlineOffline : '' } )
const [ f , setF ] = useState ( { branchId : '' , module Code : '' , kind : '' , description : '' , onlineOffline : '' } )
const [ error , setError ] = useState < string | undefined > ( )
const [ error , setError ] = useState < string | undefined > ( )
const [ saving , setSaving ] = useState ( false )
const [ saving , setSaving ] = useState ( false )
// Live catalog feeds the suggestions — future modules appear with zero code changes.
const catalog = useData ( getModules , [ ] )
useEffect ( ( ) = > {
useEffect ( ( ) = > {
if ( ! props . open ) return
if ( ! props . open ) return
@ -230,7 +233,10 @@ export function NewTicketDialog(props: {
< / FormField >
< / FormField >
< / FormGrid >
< / FormGrid >
< datalist id = "hq-ticket-modules" >
< datalist id = "hq-ticket-modules" >
{ TICKET_MODULE_CODES . map ( ( m ) = > < option key = { m } value = { m } / > ) }
{ ( catalog . data !== undefined && catalog . data . length > 0
? catalog . data . filter ( ( m ) = > m . active ) . map ( ( m ) = > m . code )
: TICKET_MODULE_CODES
) . map ( ( m ) = > < option key = { m } value = { m } / > ) }
< / datalist >
< / datalist >
< datalist id = "hq-ticket-kinds" >
< datalist id = "hq-ticket-kinds" >
{ props . kinds . map ( ( k ) = > < option key = { k } value = { k } / > ) }
{ props . kinds . map ( ( k ) = > < option key = { k } value = { k } / > ) }