codevdesign 1.0.24 → 1.0.25

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