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.
This commit is contained in:
@@ -28,6 +28,14 @@ export type Task = {
|
||||
deadline: string | null
|
||||
syncToCalendar: boolean
|
||||
calendarSyncError: string | null
|
||||
clientTicket: {
|
||||
id: number
|
||||
'@id'?: string
|
||||
number: number
|
||||
type: 'bug' | 'improvement' | 'other'
|
||||
status: 'new' | 'in_progress' | 'done' | 'rejected'
|
||||
title: string
|
||||
} | null
|
||||
recurrence: {
|
||||
id: number
|
||||
'@id'?: string
|
||||
|
||||
@@ -15,6 +15,13 @@ export function useTaskDocumentService() {
|
||||
return extractHydraMembers(data)
|
||||
}
|
||||
|
||||
async function getByClientTicket(clientTicketId: number): Promise<TaskDocument[]> {
|
||||
const data = await api.get<HydraCollection<TaskDocument>>('/task_documents', {
|
||||
clientTicket: `/api/client_tickets/${clientTicketId}`,
|
||||
})
|
||||
return extractHydraMembers(data)
|
||||
}
|
||||
|
||||
async function uploadWithRelation(relationField: string, relationIri: string, file: File): Promise<TaskDocument> {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
@@ -31,6 +38,10 @@ export function useTaskDocumentService() {
|
||||
return uploadWithRelation('task', `/api/tasks/${taskId}`, file)
|
||||
}
|
||||
|
||||
async function uploadForClientTicket(clientTicketId: number, file: File): Promise<TaskDocument> {
|
||||
return uploadWithRelation('clientTicket', `/api/client_tickets/${clientTicketId}`, file)
|
||||
}
|
||||
|
||||
async function linkShare(taskId: number, sharePath: string): Promise<TaskDocument> {
|
||||
return $fetch<TaskDocument>(`${baseURL}/task_documents`, {
|
||||
method: 'POST',
|
||||
@@ -51,11 +62,12 @@ export function useTaskDocumentService() {
|
||||
}
|
||||
|
||||
async function getContent(id: number): Promise<string> {
|
||||
return $fetch<string>(`${baseURL}/task_documents/${id}/download`, {
|
||||
const response = await fetch(`${baseURL}/task_documents/${id}/download`, {
|
||||
credentials: 'include',
|
||||
responseType: 'text',
|
||||
})
|
||||
|
||||
return response.text()
|
||||
}
|
||||
|
||||
return { getByTask, upload, linkShare, remove, getDownloadUrl, getContent }
|
||||
return { getByTask, getByClientTicket, upload, uploadForClientTicket, linkShare, remove, getDownloadUrl, getContent }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user