codevdesign 2.0.12 → 2.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,372 +1,370 @@
1
- <template>
2
- <div class="pa-2 mt-2 mb-1 mr-1">
3
- <!-- Affiche la carte récap si activée et qu'il y a des unités -->
4
- <div v-if="activerDivPreferences && unites && unites.length > 0">
5
- <v-card
6
- max-width="375"
7
- width="100%"
8
- variant="outlined"
9
- >
10
- <v-card-text class="pt-0 mt-0">
11
- <v-progress-linear
12
- v-if="chargementEnCours"
13
- indeterminate
14
- />
15
-
16
- <div
17
- v-else
18
- class="pt-2"
19
- >
20
- <div class="text-label-small text-headline-small mb-2">{{ texteTitre }}</div>
21
-
22
- <div>
23
- <v-list-item
24
- v-for="uniteId in Object.keys(dictChaisesReleve)"
25
- :key="uniteId"
26
- class="mb-1"
27
- >
28
- <ChaisePreferenceItem
29
- :unite-id="Number(uniteId)"
30
- :preferences="preferences"
31
- :dict-chaises-releve="dictChaisesReleve"
32
- :unites="unites"
33
- />
34
- </v-list-item>
35
- </div>
36
- </div>
37
- </v-card-text>
38
-
39
- <v-card-actions>
40
- <div class="flex-grow-1" />
41
- <v-btn
42
- v-if="!chargementEnCours"
43
- rounded
44
- variant="outlined"
45
- size="small"
46
- @click.stop="modifier"
47
- >
48
- {{ texteBoutonModifier }}
49
- </v-btn>
50
- </v-card-actions>
51
- </v-card>
52
- </div>
53
-
54
- <csqcDialogue
55
- ref="modale"
56
- :operation-en-cours="chargementEnCours"
57
- :btn-ok-desactiver="chargementEnCours"
58
- :titre="texteTitre"
59
- :btn-annuler-texte="texteBoutonAnnuler"
60
- @annuler="annuler"
61
- @ok="ok"
62
- ><template #content>
63
- <div class="pt-2"></div>
64
- <hr class="pt-0 mt-0 pl-0" />
65
- <div class="pt-4">
66
- <i>{{ info }}</i>
67
-
68
- <v-progress-linear
69
- v-if="chargementEnCours"
70
- indeterminate
71
- />
72
-
73
- <div
74
- v-else
75
- class="pt-4"
76
- >
77
- <v-row v-if="!toutesUnitesPreferencesSelectionnees">
78
- <v-col cols="12">
79
- <v-alert
80
- v-model="afficherErreur"
81
- type="error"
82
- variant="tonal"
83
- closable
84
- >
85
- {{ texteMessageErreur }}
86
- </v-alert>
87
- </v-col>
88
- </v-row>
89
-
90
- <v-row>
91
- <v-col
92
- v-for="uniteId in Object.keys(dictChaisesReleve)"
93
- :key="uniteId"
94
- cols="12"
95
- sm="6"
96
- md="4"
97
- >
98
- <label>{{ getUnite(uniteId)?.nom ?? '' }}</label>
99
- <br />
100
- <v-radio-group v-model="selection[uniteId]">
101
- <v-radio
102
- v-for="chaise in dictChaisesReleve[uniteId]"
103
- :key="chaise.id"
104
- :label="chaise.nom"
105
- :value="chaise.id"
106
- />
107
- </v-radio-group>
108
- </v-col>
109
- </v-row>
110
- </div>
111
- </div>
112
- </template>
113
- </csqcDialogue>
114
- </div>
115
- </template>
116
-
117
- <script setup lang="ts">
118
- import { ref, computed, onMounted, nextTick, watch, toRefs } from 'vue'
119
- import { useDisplay } from 'vuetify'
120
- import ChaisePreferenceItem from './chaiseItem.vue'
121
- import csqcDialogue from '../csqcDialogue.vue'
122
- import axios from '../../outils/appAxios'
123
- import type { Unite } from '@/codev/modeles/unite'
124
- import { useI18n } from 'vue-i18n'
125
- const modale = ref<InstanceType<typeof csqcDialogue> | null>(null)
126
-
127
- interface Chaise {
128
- id: number
129
- nom: string
130
- }
131
- interface Preference {
132
- uniteId: number
133
- chaiseId: number
134
- }
135
-
136
- /** Props */
137
- const props = defineProps<{
138
- activerDivPreferences?: boolean
139
- typeIntervenant: number
140
- demandeId: number
141
- formulaireId: number
142
- urlBase: string
143
- texteTitre?: string
144
- texteInfo?: string
145
- largeurModale?: number
146
- }>()
147
- const { typeIntervenant, demandeId, formulaireId, urlBase } = toRefs(props)
148
- /** Emits */
149
- const emit = defineEmits<{
150
- (e: 'annuler'): void
151
- (e: 'confirmer'): void
152
- }>()
153
-
154
- const { t } = useI18n({ useScope: 'global' })
155
- const { xs } = useDisplay()
156
- const isXs = computed(() => xs.value)
157
-
158
- /** State */
159
- const visible = ref(false)
160
- const chargementEnCours = ref(false)
161
- const afficherErreur = ref(false)
162
- const unites = ref<Unite[]>([])
163
- const preferences = ref<Preference[]>([])
164
- const dictChaisesReleve = ref<Record<string, Chaise[]>>({})
165
- const selection = ref<Record<string, number>>({})
166
- const modeModifier = ref(false)
167
-
168
- /** Textes */
169
- const texteMessageErreur = computed(() => t('csqc.csqcChaise.erreur'))
170
- const texteBoutonAnnuler = computed(() => t('csqc.bouton.annuler'))
171
- const texteBoutonModifier = computed(() => t('csqc.bouton.modifier'))
172
- const texteTitre = computed(() =>
173
- props.texteTitre && props.texteTitre.length > 0 ? props.texteTitre : t('csqc.csqcChaise.titre'),
174
- )
175
- const info = computed(() =>
176
- props.texteInfo && props.texteInfo.length > 0 ? props.texteInfo : t('csqc.csqcChaise.info'),
177
- )
178
-
179
- // Option A ne recharger que si typeIntervenant change
180
-
181
- const largeur = computed(() => props.largeurModale ?? 1200)
182
- const activerDivPreferences = computed(() => props.activerDivPreferences ?? true)
183
-
184
- function getUnite(uniteId: string) {
185
- return unites.value.find((u: Unite) => String(u.id) === String(uniteId))
186
- }
187
-
188
- /*
189
- function estPrefere(uniteId: string | number, chaiseId: number) {
190
- return preferences.value.some(p => String(p.uniteId) === String(uniteId) && p.chaiseId === chaiseId)
191
- }*/
192
-
193
- /** Sélection par défaut à partir des préférences existantes */
194
- function definitionSelectionDepart() {
195
- for (const uniteId in dictChaisesReleve.value) {
196
- const chaises = dictChaisesReleve.value[uniteId] ?? []
197
- const pref = preferences.value.find(
198
- p => String(p.uniteId) === String(uniteId) && chaises.some(chaise => chaise.id === p.chaiseId),
199
- )
200
- const chaiseIdDefaut = pref?.chaiseId ?? (chaises.length === 1 ? (chaises[0]?.id ?? -1) : -1)
201
- selection.value[uniteId] = chaiseIdDefaut
202
- }
203
- }
204
-
205
- /** Toutes les unités ont-elles une préférence sélectionnée ? */
206
- const toutesUnitesPreferencesSelectionnees = computed(() => {
207
- for (const uniteId in dictChaisesReleve.value) {
208
- const chaises = dictChaisesReleve.value[uniteId] ?? []
209
- const uniteOk = chaises.some(c => preferences.value.some(p => p.chaiseId === c.id))
210
- if (!uniteOk) return false
211
- }
212
- return true
213
- })
214
-
215
- async function charger() {
216
- await chargerUnites()
217
- await chargementPreferences()
218
- }
219
-
220
- async function chargerUnites() {
221
- const url = `${props.urlBase}/api/ComposantUI/Unites`
222
- const unitesData = (await axios.getAxios().get<Unite[]>(url)) as unknown as Unite[]
223
- unites.value = unitesData ?? []
224
- }
225
-
226
- async function chargementPreferences() {
227
- chargementEnCours.value = true
228
-
229
- // Chaises par unité
230
- {
231
- const data = (await axios
232
- .getAxios()
233
- .get<
234
- Record<string, Chaise[]>
235
- >(`${props.urlBase}/api/ComposantUI/ReleveDe/${props.typeIntervenant}/Demande/${props.demandeId}`)) as unknown as Record<
236
- string,
237
- Chaise[]
238
- >
239
- dictChaisesReleve.value = data ?? {}
240
- }
241
-
242
- // Préférences de l'usager
243
- {
244
- const data = (await axios
245
- .getAxios()
246
- .get<
247
- Preference[]
248
- >(`${props.urlBase}/api/ComposantUI/Preferences/${props.formulaireId}/TypeIntervenant/${props.typeIntervenant}`)) as unknown as Preference[]
249
- preferences.value = (data ?? []).filter(Boolean)
250
- }
251
-
252
- definitionSelectionDepart()
253
-
254
- // Sauvegarde immédiate pour les choix uniques (si demandé par ton flux)
255
- await sauvegarder()
256
-
257
- chargementEnCours.value = false
258
- }
259
-
260
- async function ouvrir() {
261
- if (!activerDivPreferences.value) {
262
- await chargementPreferences()
263
- visible.value = true
264
- await nextTick()
265
- modale.value?.ouvrir()
266
- return
267
- }
268
-
269
- if (!toutesUnitesPreferencesSelectionnees.value) {
270
- visible.value = true
271
- await nextTick()
272
- modale.value?.ouvrir()
273
- return
274
- }
275
-
276
- await ok()
277
- }
278
-
279
- function annuler() {
280
- visible.value = false
281
- modeModifier.value = false
282
- emit('annuler')
283
- }
284
-
285
- function modifier() {
286
- modeModifier.value = true
287
- visible.value = true
288
- modale.value?.ouvrir()
289
- }
290
-
291
- async function sauvegarder() {
292
- for (const uniteId in dictChaisesReleve.value) {
293
- const chaiseId = selection.value[uniteId]
294
- if (!chaiseId || chaiseId <= 0) continue
295
-
296
- const chaises = dictChaisesReleve.value[uniteId] ?? []
297
- if (chaises.length === 0) continue
298
-
299
- // Préférence existante pour CETTE unité ?
300
- const prefIndexDeUnite = preferences.value.findIndex(p => chaises.some(c => c.id === p.chaiseId))
301
-
302
- try {
303
- const data = (await axios
304
- .getAxios()
305
- .put<Preference>(
306
- `${props.urlBase}/api/ComposantUI/Preferences/${props.formulaireId}` +
307
- `/Unite/${encodeURIComponent(uniteId)}` +
308
- `/Chaise/${chaiseId}` +
309
- `/TypeIntervenant/${props.typeIntervenant}`,
310
- )) as unknown as Preference
311
- const itemRecu = data as Preference
312
-
313
- if (prefIndexDeUnite >= 0) {
314
- // remplace l'élément à l'index
315
- preferences.value.splice(prefIndexDeUnite, 1, itemRecu)
316
- } else {
317
- // ajoute un nouvel élément
318
- preferences.value.push(itemRecu)
319
- }
320
- } catch (e) {
321
- console.error(e)
322
- }
323
- }
324
- }
325
- async function soumettre() {
326
- modeModifier.value = false
327
- await ouvrir()
328
- }
329
- /** Validation finale */
330
- async function ok() {
331
- await sauvegarder()
332
-
333
- if (toutesUnitesPreferencesSelectionnees.value) {
334
- if (!modeModifier.value) emit('confirmer')
335
- visible.value = false
336
- modeModifier.value = false
337
- } else {
338
- afficherErreur.value = true
339
- await nextTick()
340
- }
341
- modale.value?.fermer()
342
- }
343
-
344
- onMounted(async () => {
345
- chargementEnCours.value = true
346
- await charger()
347
- chargementEnCours.value = false
348
- })
349
-
350
- // si le type d'intervenant change
351
- watch(typeIntervenant, async (nv, ov) => {
352
- if (nv === ov) return
353
- await rechargerPourTypeIntervenant()
354
- })
355
-
356
- async function rechargerPourTypeIntervenant() {
357
- try {
358
- chargementEnCours.value = true
359
- preferences.value = []
360
- dictChaisesReleve.value = {}
361
- selection.value = {}
362
- afficherErreur.value = false
363
-
364
- // recharge les données dépendantes
365
- await chargementPreferences()
366
- } finally {
367
- chargementEnCours.value = false
368
- }
369
- }
370
-
371
- defineExpose({ charger, soumettre })
372
- </script>
1
+ <template>
2
+ <div class="pa-2 mt-2 mb-1 mr-1">
3
+ <!-- Affiche la carte récap si activée et qu'il y a des unités -->
4
+ <div v-if="activerDivPreferences && unites && unites.length > 0">
5
+ <v-card
6
+ max-width="375"
7
+ width="100%"
8
+ variant="outlined"
9
+ >
10
+ <v-card-text class="pt-0 mt-0">
11
+ <v-progress-linear
12
+ v-if="chargementEnCours"
13
+ indeterminate
14
+ />
15
+
16
+ <div
17
+ v-else
18
+ class="pt-2"
19
+ >
20
+ <div class="mb-2">{{ texteTitre }}</div>
21
+
22
+ <div>
23
+ <v-list-item
24
+ v-for="uniteId in Object.keys(dictChaisesReleve)"
25
+ :key="uniteId"
26
+ class="mb-1"
27
+ >
28
+ <ChaisePreferenceItem
29
+ :unite-id="Number(uniteId)"
30
+ :preferences="preferences"
31
+ :dict-chaises-releve="dictChaisesReleve"
32
+ :unites="unites"
33
+ />
34
+ </v-list-item>
35
+ </div>
36
+ </div>
37
+ </v-card-text>
38
+
39
+ <v-card-actions>
40
+ <div class="flex-grow-1" />
41
+ <bouton-secondaire
42
+ v-if="!chargementEnCours"
43
+ size="small"
44
+ @click.stop="modifier"
45
+ >
46
+ {{ texteBoutonModifier }}
47
+ </bouton-secondaire>
48
+ </v-card-actions>
49
+ </v-card>
50
+ </div>
51
+
52
+ <csqcDialogue
53
+ ref="modale"
54
+ :operation-en-cours="chargementEnCours"
55
+ :btn-ok-desactiver="chargementEnCours"
56
+ :titre="texteTitre"
57
+ :btn-annuler-texte="texteBoutonAnnuler"
58
+ @annuler="annuler"
59
+ @ok="ok"
60
+ ><template #content>
61
+ <div class="pt-2"></div>
62
+ <hr class="pt-0 mt-0 pl-0" />
63
+ <div class="pt-4">
64
+ <i>{{ info }}</i>
65
+
66
+ <v-progress-linear
67
+ v-if="chargementEnCours"
68
+ indeterminate
69
+ />
70
+
71
+ <div
72
+ v-else
73
+ class="pt-4"
74
+ >
75
+ <v-row v-if="!toutesUnitesPreferencesSelectionnees">
76
+ <v-col cols="12">
77
+ <v-alert
78
+ v-model="afficherErreur"
79
+ type="error"
80
+ variant="tonal"
81
+ closable
82
+ >
83
+ {{ texteMessageErreur }}
84
+ </v-alert>
85
+ </v-col>
86
+ </v-row>
87
+
88
+ <v-row>
89
+ <v-col
90
+ v-for="uniteId in Object.keys(dictChaisesReleve)"
91
+ :key="uniteId"
92
+ cols="12"
93
+ sm="6"
94
+ md="4"
95
+ >
96
+ <label>{{ getUnite(uniteId)?.nom ?? '' }}</label>
97
+ <br />
98
+ <v-radio-group v-model="selection[uniteId]">
99
+ <v-radio
100
+ v-for="chaise in dictChaisesReleve[uniteId]"
101
+ :key="chaise.id"
102
+ :label="chaise.nom"
103
+ :value="chaise.id"
104
+ />
105
+ </v-radio-group>
106
+ </v-col>
107
+ </v-row>
108
+ </div>
109
+ </div>
110
+ </template>
111
+ </csqcDialogue>
112
+ </div>
113
+ </template>
114
+
115
+ <script setup lang="ts">
116
+ import { ref, computed, onMounted, nextTick, watch, toRefs } from 'vue'
117
+ import { useDisplay } from 'vuetify'
118
+ import ChaisePreferenceItem from './chaiseItem.vue'
119
+ import csqcDialogue from '../csqcDialogue.vue'
120
+ import axios from '../../outils/appAxios'
121
+ import type { Unite } from '@/codev/modeles/unite'
122
+ import { useI18n } from 'vue-i18n'
123
+ const modale = ref<InstanceType<typeof csqcDialogue> | null>(null)
124
+
125
+ interface Chaise {
126
+ id: number
127
+ nom: string
128
+ }
129
+ interface Preference {
130
+ uniteId: number
131
+ chaiseId: number
132
+ }
133
+
134
+ /** Props */
135
+ const props = defineProps<{
136
+ activerDivPreferences?: boolean
137
+ typeIntervenant: number
138
+ demandeId: number
139
+ formulaireId: number
140
+ urlBase: string
141
+ texteTitre?: string
142
+ texteInfo?: string
143
+ largeurModale?: number
144
+ }>()
145
+ const { typeIntervenant, demandeId, formulaireId, urlBase } = toRefs(props)
146
+ /** Emits */
147
+ const emit = defineEmits<{
148
+ (e: 'annuler'): void
149
+ (e: 'confirmer'): void
150
+ }>()
151
+
152
+ const { t } = useI18n({ useScope: 'global' })
153
+ const { xs } = useDisplay()
154
+ const isXs = computed(() => xs.value)
155
+
156
+ /** State */
157
+ const visible = ref(false)
158
+ const chargementEnCours = ref(false)
159
+ const afficherErreur = ref(false)
160
+ const unites = ref<Unite[]>([])
161
+ const preferences = ref<Preference[]>([])
162
+ const dictChaisesReleve = ref<Record<string, Chaise[]>>({})
163
+ const selection = ref<Record<string, number>>({})
164
+ const modeModifier = ref(false)
165
+
166
+ /** Textes */
167
+ const texteMessageErreur = computed(() => t('csqc.csqcChaise.erreur'))
168
+ const texteBoutonAnnuler = computed(() => t('csqc.bouton.annuler'))
169
+ const texteBoutonModifier = computed(() => t('csqc.bouton.modifier'))
170
+ const texteTitre = computed(() =>
171
+ props.texteTitre && props.texteTitre.length > 0 ? props.texteTitre : t('csqc.csqcChaise.titre'),
172
+ )
173
+ const info = computed(() =>
174
+ props.texteInfo && props.texteInfo.length > 0 ? props.texteInfo : t('csqc.csqcChaise.info'),
175
+ )
176
+
177
+ // Option A — ne recharger que si typeIntervenant change
178
+
179
+ const largeur = computed(() => props.largeurModale ?? 1200)
180
+ const activerDivPreferences = computed(() => props.activerDivPreferences ?? true)
181
+
182
+ function getUnite(uniteId: string) {
183
+ return unites.value.find((u: Unite) => String(u.id) === String(uniteId))
184
+ }
185
+
186
+ /*
187
+ function estPrefere(uniteId: string | number, chaiseId: number) {
188
+ return preferences.value.some(p => String(p.uniteId) === String(uniteId) && p.chaiseId === chaiseId)
189
+ }*/
190
+
191
+ /** Sélection par défaut à partir des préférences existantes */
192
+ function definitionSelectionDepart() {
193
+ for (const uniteId in dictChaisesReleve.value) {
194
+ const chaises = dictChaisesReleve.value[uniteId] ?? []
195
+ const pref = preferences.value.find(
196
+ p => String(p.uniteId) === String(uniteId) && chaises.some(chaise => chaise.id === p.chaiseId),
197
+ )
198
+ const chaiseIdDefaut = pref?.chaiseId ?? (chaises.length === 1 ? (chaises[0]?.id ?? -1) : -1)
199
+ selection.value[uniteId] = chaiseIdDefaut
200
+ }
201
+ }
202
+
203
+ /** Toutes les unités ont-elles une préférence sélectionnée ? */
204
+ const toutesUnitesPreferencesSelectionnees = computed(() => {
205
+ for (const uniteId in dictChaisesReleve.value) {
206
+ const chaises = dictChaisesReleve.value[uniteId] ?? []
207
+ const uniteOk = chaises.some(c => preferences.value.some(p => p.chaiseId === c.id))
208
+ if (!uniteOk) return false
209
+ }
210
+ return true
211
+ })
212
+
213
+ async function charger() {
214
+ await chargerUnites()
215
+ await chargementPreferences()
216
+ }
217
+
218
+ async function chargerUnites() {
219
+ const url = `${props.urlBase}/api/ComposantUI/Unites`
220
+ const unitesData = (await axios.getAxios().get<Unite[]>(url)) as unknown as Unite[]
221
+ unites.value = unitesData ?? []
222
+ }
223
+
224
+ async function chargementPreferences() {
225
+ chargementEnCours.value = true
226
+
227
+ // Chaises par unité
228
+ {
229
+ const data = (await axios
230
+ .getAxios()
231
+ .get<
232
+ Record<string, Chaise[]>
233
+ >(`${props.urlBase}/api/ComposantUI/ReleveDe/${props.typeIntervenant}/Demande/${props.demandeId}`)) as unknown as Record<
234
+ string,
235
+ Chaise[]
236
+ >
237
+ dictChaisesReleve.value = data ?? {}
238
+ }
239
+
240
+ // Préférences de l'usager
241
+ {
242
+ const data = (await axios
243
+ .getAxios()
244
+ .get<
245
+ Preference[]
246
+ >(`${props.urlBase}/api/ComposantUI/Preferences/${props.formulaireId}/TypeIntervenant/${props.typeIntervenant}`)) as unknown as Preference[]
247
+ preferences.value = (data ?? []).filter(Boolean)
248
+ }
249
+
250
+ definitionSelectionDepart()
251
+
252
+ // Sauvegarde immédiate pour les choix uniques (si demandé par ton flux)
253
+ await sauvegarder()
254
+
255
+ chargementEnCours.value = false
256
+ }
257
+
258
+ async function ouvrir() {
259
+ if (!activerDivPreferences.value) {
260
+ await chargementPreferences()
261
+ visible.value = true
262
+ await nextTick()
263
+ modale.value?.ouvrir()
264
+ return
265
+ }
266
+
267
+ if (!toutesUnitesPreferencesSelectionnees.value) {
268
+ visible.value = true
269
+ await nextTick()
270
+ modale.value?.ouvrir()
271
+ return
272
+ }
273
+
274
+ await ok()
275
+ }
276
+
277
+ function annuler() {
278
+ visible.value = false
279
+ modeModifier.value = false
280
+ emit('annuler')
281
+ }
282
+
283
+ function modifier() {
284
+ modeModifier.value = true
285
+ visible.value = true
286
+ modale.value?.ouvrir()
287
+ }
288
+
289
+ async function sauvegarder() {
290
+ for (const uniteId in dictChaisesReleve.value) {
291
+ const chaiseId = selection.value[uniteId]
292
+ if (!chaiseId || chaiseId <= 0) continue
293
+
294
+ const chaises = dictChaisesReleve.value[uniteId] ?? []
295
+ if (chaises.length === 0) continue
296
+
297
+ // Préférence existante pour CETTE unité ?
298
+ const prefIndexDeUnite = preferences.value.findIndex(p => chaises.some(c => c.id === p.chaiseId))
299
+
300
+ try {
301
+ const data = (await axios
302
+ .getAxios()
303
+ .put<Preference>(
304
+ `${props.urlBase}/api/ComposantUI/Preferences/${props.formulaireId}` +
305
+ `/Unite/${encodeURIComponent(uniteId)}` +
306
+ `/Chaise/${chaiseId}` +
307
+ `/TypeIntervenant/${props.typeIntervenant}`,
308
+ )) as unknown as Preference
309
+ const itemRecu = data as Preference
310
+
311
+ if (prefIndexDeUnite >= 0) {
312
+ // remplace l'élément à l'index
313
+ preferences.value.splice(prefIndexDeUnite, 1, itemRecu)
314
+ } else {
315
+ // ajoute un nouvel élément
316
+ preferences.value.push(itemRecu)
317
+ }
318
+ } catch (e) {
319
+ console.error(e)
320
+ }
321
+ }
322
+ }
323
+ async function soumettre() {
324
+ modeModifier.value = false
325
+ await ouvrir()
326
+ }
327
+ /** Validation finale */
328
+ async function ok() {
329
+ await sauvegarder()
330
+
331
+ if (toutesUnitesPreferencesSelectionnees.value) {
332
+ if (!modeModifier.value) emit('confirmer')
333
+ visible.value = false
334
+ modeModifier.value = false
335
+ } else {
336
+ afficherErreur.value = true
337
+ await nextTick()
338
+ }
339
+ modale.value?.fermer()
340
+ }
341
+
342
+ onMounted(async () => {
343
+ chargementEnCours.value = true
344
+ await charger()
345
+ chargementEnCours.value = false
346
+ })
347
+
348
+ // si le type d'intervenant change
349
+ watch(typeIntervenant, async (nv, ov) => {
350
+ if (nv === ov) return
351
+ await rechargerPourTypeIntervenant()
352
+ })
353
+
354
+ async function rechargerPourTypeIntervenant() {
355
+ try {
356
+ chargementEnCours.value = true
357
+ preferences.value = []
358
+ dictChaisesReleve.value = {}
359
+ selection.value = {}
360
+ afficherErreur.value = false
361
+
362
+ // recharge les données dépendantes
363
+ await chargementPreferences()
364
+ } finally {
365
+ chargementEnCours.value = false
366
+ }
367
+ }
368
+
369
+ defineExpose({ charger, soumettre })
370
+ </script>