Files
Lesstime/frontend/modules/client-portal/utils/ticket.ts
T
Matthieu 144a8a4685 feat(client-portal) : portal front + client account admin (phases 1-2 front)
LST-69 (3.2) front. Client portal UI on the phase-1 backend.

- New frontend/modules/client-portal/ layer: /portal (project cards from the
  client's allowedProjects via /me), /portal/projects/[id] (tickets list,
  detail modal, create modal with document upload), client-tickets service +
  DTO, CT-XXX formatting.
- Front tenancy: auth.global.ts redirects a pure ROLE_CLIENT to /portal and
  blocks internal routes; portal pages open to any authenticated user.
- Admin: UserDrawer manages client accounts (ROLE_CLIENT + client +
  allowedProjects); new "Tickets client" admin tab (list, filters, status
  change with required comment on reject, detail modal).
- Kanban/my-tasks: client-ticket icon + tooltip when task.clientTicket is set
  (data via task:read, no extra call). TaskDocument upload generalized with a
  clientTicketId prop. getContent uses native fetch (text response).
- i18n portal/clientTicket keys; sidebar /portal item (module client-portal).

nuxt build passes; /portal routes present, existing routes intact.
2026-06-21 01:03:58 +02:00

19 lines
518 B
TypeScript

/**
* Format a client-ticket number for display, e.g. `CT-001`.
*/
export function formatTicketNumber(value: number): string {
return `CT-${String(value).padStart(3, '0')}`
}
/**
* Extract the numeric id from an API Platform IRI (e.g. `/api/projects/5` → 5).
* Returns null when the IRI cannot be parsed.
*/
export function iriToId(iri: string | null | undefined): number | null {
if (!iri) {
return null
}
const match = iri.match(/(\d+)$/)
return match ? Number(match[1]) : null
}