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:
Matthieu
2026-06-21 01:03:58 +02:00
parent a2bbc8311d
commit 144a8a4685
24 changed files with 1189 additions and 29 deletions
@@ -20,6 +20,12 @@
name="mdi:flag-variant"
class="h-3.5 w-3.5 text-red-600"
/>
<Icon
v-if="task.clientTicket"
name="heroicons:user-circle"
class="h-3.5 w-3.5 text-primary-500"
:title="$t('clientTicket.linkedTooltip', { number: formatTicketNumber(task.clientTicket.number) })"
/>
</div>
<h4 class="line-clamp-2 text-sm font-semibold text-neutral-900">{{ task.title }}</h4>
</div>
@@ -103,6 +109,7 @@
<script setup lang="ts">
import type { Task } from '~/modules/project-management/services/dto/task'
import { formatTicketNumber } from '~/modules/client-portal/utils/ticket'
const props = withDefaults(defineProps<{
task: Task
@@ -50,13 +50,14 @@ import { useTaskDocumentService } from '~/modules/project-management/services/ta
const props = defineProps<{
taskId?: number
clientTicketId?: number
}>()
const emit = defineEmits<{
uploaded: []
}>()
const { upload: uploadFile } = useTaskDocumentService()
const { upload: uploadFile, uploadForClientTicket } = useTaskDocumentService()
const toast = useToast()
const { t } = useI18n()
@@ -111,6 +112,8 @@ async function processFiles(files: File[]) {
try {
if (props.taskId) {
await uploadFile(props.taskId, file)
} else if (props.clientTicketId) {
await uploadForClientTicket(props.clientTicketId, file)
}
state.uploading = false
state.progress = 100
@@ -28,6 +28,12 @@
name="mdi:flag-variant"
class="h-3.5 w-3.5 text-red-600"
/>
<Icon
v-if="task.clientTicket"
name="heroicons:user-circle"
class="h-3.5 w-3.5 text-primary-500"
:title="$t('clientTicket.linkedTooltip', { number: formatTicketNumber(task.clientTicket.number) })"
/>
</div>
<!-- Row 2: title -->
<h4 class="mt-1 text-sm font-semibold text-neutral-900">{{ task.title }}</h4>
@@ -111,6 +117,7 @@
<script setup lang="ts">
import type { Task } from '~/modules/project-management/services/dto/task'
import { formatTicketNumber } from '~/modules/client-portal/utils/ticket'
const props = withDefaults(defineProps<{
task: Task
@@ -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 }
}