Skip to content

Commit a3e4654

Browse files
authored
feat: 1264 fusager monAgrement tab documents (#1190)
## Ticket(s) lié(s) 1264 ## Description Ajout des documents liés à l'agrément dans l'onglet documents ## Screenshot / liens loom <img width="1251" height="496" alt="image" src="https://github.com/user-attachments/assets/207c5b59-3f42-452b-bdbf-35b255274b36" />
2 parents 1bf5ae3 + 2a7e101 commit a3e4654

File tree

8 files changed

+178
-152
lines changed

8 files changed

+178
-152
lines changed

.talismanrc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,13 +273,8 @@ fileignoreconfig:
273273
checksum: 846543dfd36589a6fe10859c28fe0ca4e3a4f084f58ea56b42fce695d30b31c8
274274
- filename: packages/frontend-usagers/src/components/utils/TableFull.vue
275275
checksum: 05743cc5c3dfd946e8ee41cb11571b1e505bbdb5260e9c59a53e4ca16cb11f08
276-
- filename: packages/frontend-usagers/src/pages/connexion/enregistrement.vue
277-
checksum: dd393d7c31566dfa3864bb9a63fe98f9bf040cc8321e8cad0f74e8634e8365f8
278-
- filename: packages/frontend-usagers/src/pages/connexion/index.vue
279-
checksum: fcacdc94675ff0c9eedddafc751e3dc1149edbc8d853494e3c42d935677eceff
280-
checksum: 6a0259a5bfca987ea2d83fb1fa90116d8dda92335214993671111d7a04425429
281276
- filename: packages/frontend-usagers/src/pages/agrement/[[agrementId]].vue
282-
checksum: 9f1b4a0e00392a84b23746ab66cad677bddc49b1f9999454b123cb7111c204c3
277+
checksum: 8ab087483ddfb8b24d68de5ba5dcc292f06ffedcf6b5f89f16184f5906ff728b
283278
- filename: packages/frontend-usagers/src/pages/connexion/enregistrement.vue
284279
checksum: dd393d7c31566dfa3864bb9a63fe98f9bf040cc8321e8cad0f74e8634e8365f8
285280
- filename: packages/frontend-usagers/src/pages/connexion/index.vue
@@ -314,6 +309,8 @@ fileignoreconfig:
314309
checksum: 0c60a5a9f3321ab3c36025bdeb35663395586d5bca3d21984fdbe5997b46c6eb
315310
- filename: packages/migrations/src/scripts/reset-s3.js
316311
checksum: 7b52636c4c49bf85a592f649f8fbf653e0203b390f4f9d220fe3ae4da06422a7
312+
- filename: packages/shared-bridge/src/constantes/file.ts
313+
checksum: dded09b86eeb4c664e493ff12b023d20914b18ac5c9a98ac7e60235daec3927d
317314
- filename: packages/shared-bridge/src/utils/request.ts
318315
checksum: c29fc1527b710e177395fabd040b7e3cdd44b429b21d504ba6f192faf1cd861a
319316
- filename: packages/shared-ui/src/components/DsfrMultiselectV2.vue
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<template>
2+
<!-- TODO Filtrer ou mettre l'objet correspondant aux documents des DREETS-->
3+
<div
4+
v-if="
5+
props.initAgrement.dreetsFiles &&
6+
props.initAgrement.dreetsFiles.length > 0
7+
"
8+
>
9+
<TableFull
10+
title="Documents de la DREETS"
11+
:headers="headers"
12+
:data="props.initAgrement.dreetsFiles"
13+
/>
14+
</div>
15+
<div
16+
v-if="
17+
props.initAgrement.agrementFiles &&
18+
props.initAgrement.agrementFiles.length > 0
19+
"
20+
>
21+
<TableFull
22+
title="Documents de l'OVA"
23+
:headers="headers"
24+
:data="props.initAgrement.agrementFiles"
25+
/>
26+
</div>
27+
</template>
28+
29+
<script setup lang="ts">
30+
import { TableFull } from "@vao/shared-ui";
31+
import {
32+
type AgrementFilesDto,
33+
type DocumentDto,
34+
formatFRDateTime,
35+
getFileCategoryLabel,
36+
} from "@vao/shared-bridge";
37+
38+
const config = useRuntimeConfig();
39+
const NuxtLink = resolveComponent("NuxtLink");
40+
41+
const props = defineProps({
42+
initAgrement: { type: Object, required: true },
43+
});
44+
45+
const headers = [
46+
{
47+
column: "name",
48+
sorter: "name",
49+
text: "Nom du fichier",
50+
headerAttrs: {
51+
class: "suivi",
52+
},
53+
},
54+
{
55+
column: "category",
56+
sorter: "category",
57+
text: "Type de fichier",
58+
format: (item: AgrementFilesDto) => getFileCategoryLabel(item.category!),
59+
headerAttrs: {
60+
class: "suivi",
61+
},
62+
},
63+
{
64+
column: "createdAt",
65+
sorter: "createdAt",
66+
format: (item: DocumentDto) => formatFRDateTime(item.createdAt!),
67+
text: "Date de dépose",
68+
headerAttrs: {
69+
class: "suivi",
70+
},
71+
},
72+
{
73+
text: "téléchargement",
74+
component: (file: DocumentDto) => {
75+
return {
76+
component: NuxtLink,
77+
to: `${config.public.backendUrl}/documents/${file.uuid}`,
78+
class: "fr-icon-file-download-fill",
79+
};
80+
},
81+
},
82+
];
83+
</script>

packages/frontend-usagers/src/pages/agrement/[[agrementId]].vue

Lines changed: 13 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,8 @@
107107
</div>
108108
</template>
109109
<script setup lang="ts">
110-
import {
111-
FILE_CATEGORY,
112-
type AgrementDto,
113-
type FileKey,
114-
} from "@vao/shared-bridge";
110+
import type { FILE_CATEGORY, AgrementDto, FileKey } from "@vao/shared-bridge";
111+
import { FILE_CATEGORY_CONFIG } from "@vao/shared-bridge";
115112
import { useToaster } from "@vao/shared-ui";
116113
117114
const route = useRoute();
@@ -135,154 +132,25 @@ async function updateOrCreate(formValues: AgrementFormValues) {
135132
const updatedData: AgrementFormValues = { ...formValues };
136133
try {
137134
updatedData.agrementFiles = [];
138-
const fileMappings: {
139-
key: FileKey;
140-
multiple: boolean;
141-
category: FILE_CATEGORY;
142-
}[] = [
143-
{
144-
key: "filesMotivation",
145-
multiple: true,
146-
category: FILE_CATEGORY.MOTIVATION,
147-
},
148-
{
149-
key: "fileProcesVerbal",
150-
multiple: false,
151-
category: FILE_CATEGORY.PROCVERBAL,
152-
},
153-
{
154-
key: "fileImmatriculation",
155-
multiple: false,
156-
category: FILE_CATEGORY.IMMATRICUL,
157-
},
158-
{
159-
key: "fileAttestationsRespCivile",
160-
multiple: false,
161-
category: FILE_CATEGORY.ASSURRESP,
162-
},
163-
{
164-
key: "fileAttestationsRapatriement",
165-
multiple: false,
166-
category: FILE_CATEGORY.ASSURRAPAT,
167-
},
168-
{
169-
key: "filesChangeEvol",
170-
multiple: true,
171-
category: FILE_CATEGORY.CHANGEEVOL,
172-
},
173-
{
174-
key: "filesBilanQualit",
175-
multiple: true,
176-
category: FILE_CATEGORY.BILANQUALIT,
177-
},
178-
{
179-
key: "filesBilanFinancier",
180-
multiple: true,
181-
category: FILE_CATEGORY.BILANFINANC,
182-
},
183-
{
184-
key: "filesAgrementSejour",
185-
multiple: true,
186-
category: FILE_CATEGORY.SEJOUR,
187-
},
188-
{
189-
key: "filesAccompResp",
190-
multiple: true,
191-
category: FILE_CATEGORY.ACCOMPRESP,
192-
},
193-
{
194-
key: "filesSuiviMed",
195-
multiple: true,
196-
category: FILE_CATEGORY.SUIVIMED,
197-
},
198-
{
199-
key: "filesBilanQualitPerception",
200-
multiple: true,
201-
category: FILE_CATEGORY.BILANQUALITPERCEPTION,
202-
},
203-
{
204-
key: "filesBilanQualitPerspectives",
205-
multiple: true,
206-
category: FILE_CATEGORY.BILANQUALITPERSPECTIVE,
207-
},
208-
{
209-
key: "filesBilanQualitElementsMarquants",
210-
multiple: true,
211-
category: FILE_CATEGORY.BILANQUALITELEMARQ,
212-
},
213-
{
214-
key: "filesBilanQualitComplementaires",
215-
multiple: true,
216-
category: FILE_CATEGORY.BILANQUALITCOMPLEMENTAIRES,
217-
},
218-
{
219-
key: "filesBilanFinancierQuatreAnnees",
220-
multiple: true,
221-
category: FILE_CATEGORY.BILANFINANCIERQUATREANNEES,
222-
},
223-
{
224-
key: "filesProjetsSejoursPrevus",
225-
multiple: true,
226-
category: FILE_CATEGORY.PROJETSSEJOURSPREVUS,
227-
},
228-
{
229-
key: "filesProjetsSejoursCompetencesExperience",
230-
multiple: true,
231-
category: FILE_CATEGORY.PROJETSSEJOURSCOMPETENCESEXPERIENCE,
232-
},
233-
{
234-
key: "filesProjetsSejoursMesures",
235-
multiple: true,
236-
category: FILE_CATEGORY.PROJETSSEJOURSMESURES,
237-
},
238-
{
239-
key: "filesProjetsSejoursComplementaires",
240-
multiple: true,
241-
category: FILE_CATEGORY.PROJETSSEJOURSCOMPLEMENTAIRES,
242-
},
243-
{
244-
key: "fileProjetsSejoursCasier",
245-
multiple: false,
246-
category: FILE_CATEGORY.PROJETSSEJOURSCASIER,
247-
},
248-
{
249-
key: "filesProjetsSejoursOrgaTransports",
250-
multiple: true,
251-
category: FILE_CATEGORY.PROJETSSEJOURSORGATRANSPORT,
252-
},
253-
{
254-
key: "filesProjetsSejoursSuiviMed",
255-
multiple: true,
256-
category: FILE_CATEGORY.PROJETSSEJOURSSUIVIMED,
257-
},
258-
{
259-
key: "filesProjetsSejoursProtocoleReorientation",
260-
multiple: true,
261-
category: FILE_CATEGORY.PROJSEJPROTCOREORIENT,
262-
},
263-
{
264-
key: "filesProjetsSejoursProtocoleRapatriement",
265-
multiple: true,
266-
category: FILE_CATEGORY.PROJSSEJOURSPROTCOLERAPATR,
267-
},
268-
{
269-
key: "filesProjSejoursBudgetPersonnes",
270-
multiple: true,
271-
category: FILE_CATEGORY.PROJSEJOURSBUDGETPERSONNES,
272-
},
273-
];
274135
275-
for (const { key, multiple, category } of fileMappings) {
276-
const value = updatedData[key as FileKey];
136+
for (const category of Object.keys(
137+
FILE_CATEGORY_CONFIG,
138+
) as (keyof typeof FILE_CATEGORY_CONFIG)[]) {
139+
const { fileKey, multiple } = FILE_CATEGORY_CONFIG[category];
140+
const value = updatedData[fileKey];
277141
278142
if (!value) continue;
143+
279144
if (multiple) {
280-
const docs = await createDocuments({ documents: value, category });
145+
const docs = await createDocuments({
146+
documents: value,
147+
category: category as FILE_CATEGORY,
148+
});
281149
updatedData.agrementFiles.push(...docs);
282150
} else {
283151
const doc = await createDocument({
284152
document: value,
285-
category,
153+
category: category as FILE_CATEGORY,
286154
});
287155
if (doc) updatedData.agrementFiles.push(doc);
288156
}

packages/frontend-usagers/src/pages/mon-agrement/index.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
:selected="selectedTabIndex === 1"
4545
:asc="asc"
4646
>
47+
<AgrementDocuments
48+
:init-agrement="agrementStore.agrementCourant ?? {}"
49+
></AgrementDocuments>
4750
</DsfrTabContent>
4851
<DsfrTabContent
4952
panel-id="agrement-content-2"

packages/shared-bridge/src/constantes/file.ts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,69 @@ export type FileKey =
5555
| "filesProjetsSejoursProtocoleReorientation"
5656
| "filesProjetsSejoursProtocoleRapatriement"
5757
| "filesProjSejoursBudgetPersonnes";
58+
59+
export const FILE_CATEGORY_CONFIG = {
60+
[FILE_CATEGORY.PROCVERBAL]: {
61+
fileKey: "fileProcesVerbal",
62+
label: "Procès verbal d’assemblée générale",
63+
multiple: false,
64+
},
65+
[FILE_CATEGORY.MOTIVATION]: {
66+
fileKey: "filesMotivation",
67+
label: "Motivation, compétences et expériences",
68+
multiple: true,
69+
},
70+
[FILE_CATEGORY.IMMATRICUL]: {
71+
fileKey: "fileImmatriculation",
72+
label:
73+
"Certificat d’immatriculation au registre des opérateurs de voyages et de séjours",
74+
multiple: false,
75+
},
76+
[FILE_CATEGORY.ASSURRESP]: {
77+
fileKey: "fileAttestationsRespCivile",
78+
label: "Attestation Assurance Responsabilité",
79+
multiple: false,
80+
},
81+
[FILE_CATEGORY.ASSURRAPAT]: {
82+
fileKey: "fileAttestationsRapatriement",
83+
label: "Attestation Assurance Cas de rapatriement",
84+
multiple: false,
85+
},
86+
[FILE_CATEGORY.SEJOUR]: {
87+
fileKey: "filesAgrementSejour",
88+
label: "Projet de séjour",
89+
multiple: true,
90+
},
91+
[FILE_CATEGORY.ACCOMPRESP]: {
92+
fileKey: "filesAccompResp",
93+
label: "Accompagnants & responsables",
94+
multiple: true,
95+
},
96+
[FILE_CATEGORY.SUIVIMED]: {
97+
fileKey: "filesSuiviMed",
98+
label: "Suivi médical",
99+
multiple: true,
100+
},
101+
[FILE_CATEGORY.BUDGET]: {
102+
fileKey: "filesProjSejoursBudgetPersonnes",
103+
label: "Budget des personnes",
104+
multiple: true,
105+
},
106+
[FILE_CATEGORY.CHANGEEVOL]: {
107+
fileKey: "filesChangeEvol",
108+
label: "Bilan - Changement ou évolution",
109+
multiple: true,
110+
},
111+
[FILE_CATEGORY.BILANQUALIT]: {
112+
fileKey: "filesBilanQualit",
113+
label: "Bilan qualitatif 4 dernières années",
114+
multiple: true,
115+
},
116+
[FILE_CATEGORY.BILANFINANC]: {
117+
fileKey: "filesBilanFinancier",
118+
label: "Bilan financier 4 dernières années",
119+
multiple: true,
120+
},
121+
} as const;
122+
123+
export type FileCategoryConfig = typeof FILE_CATEGORY_CONFIG;

packages/shared-bridge/src/dto/agrement.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export interface AgrementAnimationDto {
6767

6868
export interface AgrementFilesDto {
6969
agrementId: number | null;
70-
category: FILE_CATEGORY | null;
70+
category: FILE_CATEGORY;
7171
fileUuid: string | null;
7272
}
7373

packages/shared-bridge/src/dto/document.dto.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { FILE_CATEGORY } from "../constantes/file";
22

33
export interface DocumentDto {
4+
name: string;
45
file: File;
56
category: FILE_CATEGORY;
7+
uuid?: string | null;
8+
createdAt?: Date | null;
69
}
710
export interface DocumentDtoOptional {
811
file?: File | null;

0 commit comments

Comments
 (0)