@amsom-habitat/cresol 0.1.0 → 0.2.0

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.
package/dist/cresol.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import { AmsomModal as e, AmsomOverlay as t } from "@amsom-habitat/ui";
2
- import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createSlots as c, createTextVNode as l, createVNode as u, guardReactiveProps as d, inject as f, mergeProps as p, normalizeClass as m, normalizeProps as h, openBlock as g, provide as _, reactive as v, ref as y, renderList as b, renderSlot as x, resolveComponent as S, toDisplayString as C, toHandlers as ee, toRef as w, unref as T, vShow as E, withCtx as D, withDirectives as O } from "vue";
3
- import { AmsomNavTabsHorizontal as te } from "@amsom-habitat/nav-tabs";
4
- import ne from "@amsom-habitat/horizontal-stepper";
5
- import { AmsomAutocomplete as k } from "@amsom-habitat/amsom-autocomplete";
6
- import re from "@amsom-habitat/axios-overlay";
7
- import A from "@amsom-habitat/user-manager";
8
- import { library as ie } from "@fortawesome/fontawesome-svg-core";
9
- import { AmsomTextarea as ae } from "@amsom-habitat/amsom-textarea";
10
- import { AmsomUploadFile as oe } from "@amsom-habitat/file-manager";
2
+ import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createSlots as c, createTextVNode as l, createVNode as u, guardReactiveProps as d, inject as f, mergeProps as p, normalizeClass as m, normalizeProps as h, openBlock as g, provide as _, reactive as v, ref as y, renderList as b, renderSlot as x, resolveComponent as S, toDisplayString as C, toHandlers as ee, toRef as w, unref as T, vShow as te, withCtx as E, withDirectives as D } from "vue";
3
+ import { AmsomNavTabsHorizontal as ne } from "@amsom-habitat/nav-tabs";
4
+ import re from "@amsom-habitat/horizontal-stepper";
5
+ import { AmsomAutocomplete as O } from "@amsom-habitat/amsom-autocomplete";
6
+ import ie from "@amsom-habitat/axios-overlay";
7
+ import k from "@amsom-habitat/user-manager";
8
+ import { library as ae } from "@fortawesome/fontawesome-svg-core";
9
+ import { AmsomTextarea as oe } from "@amsom-habitat/amsom-textarea";
10
+ import { AmsomUploadFile as se } from "@amsom-habitat/file-manager";
11
11
  //#region src/utils/provenanceContact.js
12
- var se = [
12
+ var ce = [
13
13
  {
14
14
  id: "T",
15
15
  libelle: "Téléphone",
@@ -40,7 +40,7 @@ var se = [
40
40
  libelle: "Courrier",
41
41
  icon: "envelope-open"
42
42
  }
43
- ], ce = "T", le = Symbol("cresol:draft"), j = () => ({
43
+ ], le = "T", ue = Symbol("cresol:draft"), A = () => ({
44
44
  idCommune: null,
45
45
  commune: null,
46
46
  idEntree: null,
@@ -55,7 +55,7 @@ var se = [
55
55
  typeContratActuel: null,
56
56
  idContratActuel: null,
57
57
  occupantActuel: null
58
- }), M = () => ({
58
+ }), j = () => ({
59
59
  idMotif: null,
60
60
  idCategorie: null,
61
61
  idType: null,
@@ -72,7 +72,7 @@ var se = [
72
72
  dateFaits: null,
73
73
  dateFaitsOverride: !1,
74
74
  fichier: null
75
- }), N = [
75
+ }), M = [
76
76
  "reclamant",
77
77
  "provenance",
78
78
  "motif",
@@ -81,23 +81,23 @@ var se = [
81
81
  "dateFaits",
82
82
  "responsable",
83
83
  "fichier"
84
- ], ue = [
84
+ ], de = [
85
85
  "D",
86
86
  "U",
87
87
  "T"
88
- ], P = (e = "T") => ({
88
+ ], N = (e = "T") => ({
89
89
  reclamant: {
90
90
  type: null,
91
91
  id: null
92
92
  },
93
93
  provenance: e,
94
94
  lignes: [{
95
- ...M(),
95
+ ...j(),
96
96
  cibleMode: "contrat",
97
- patrimoine: j(),
97
+ patrimoine: A(),
98
98
  description: ""
99
99
  }]
100
- }), de = (e) => e?.id ?? e ?? null, fe = (e) => {
100
+ }), fe = (e) => e?.id ?? e ?? null, pe = (e) => {
101
101
  if (!e) return "Cible non définie";
102
102
  let t = [
103
103
  e.commune,
@@ -105,17 +105,17 @@ var se = [
105
105
  e.libelleModule
106
106
  ].filter(Boolean);
107
107
  return e.etage != null && !e.libelleModule && t.push(`Étage ${e.etage}`), t.length ? t.join(" — ") : "Cible non définie";
108
- }, pe = (e) => !!e && (e.idModule != null || e.idEntree != null), me = (e, t) => e.cibleMode === "demande" || !e.cibleOverride && e.patrimoine == null ? !0 : e.cibleMode === "contrat" ? !!(e.contratReclamant && t || e.contratCible) && e.patrimoine?.idModule != null : pe(e.patrimoine), he = (e, t) => e.description == null ? !t : e.description.trim().length > 0, F = (e = {}) => {
108
+ }, me = (e) => !!e && (e.idModule != null || e.idEntree != null), he = (e, t) => e.cibleMode === "demande" || !e.cibleOverride && e.patrimoine == null ? !0 : e.cibleMode === "contrat" ? !!(e.contratReclamant && t || e.contratCible) && e.patrimoine?.idModule != null : me(e.patrimoine), ge = (e, t) => e.description == null ? !t : e.description.trim().length > 0, _e = (e = {}) => {
109
109
  let t = {
110
- ...M(),
110
+ ...j(),
111
111
  ...e
112
112
  };
113
113
  return e.patrimoine && (t.patrimoine = {
114
- ...j(),
114
+ ...A(),
115
115
  ...e.patrimoine
116
116
  }), t;
117
- }, ge = (e) => {
118
- let t = P();
117
+ }, ve = (e) => {
118
+ let t = N();
119
119
  if (!e) return t;
120
120
  let n = Array.isArray(e.lignes) && e.lignes.length ? e.lignes : null;
121
121
  return {
@@ -128,99 +128,102 @@ var se = [
128
128
  provenance: e.provenance ?? t.provenance,
129
129
  lignes: n ? n.map((e, n) => n === 0 ? {
130
130
  ...t.lignes[0],
131
- ...F(e)
132
- } : F(e)) : t.lignes
131
+ ..._e(e)
132
+ } : _e(e)) : t.lignes
133
133
  };
134
134
  };
135
- function _e({ reclamants: e, modules: t, idModulePrefere: n = y(null), readonly: i = y(!1) } = {}) {
136
- let a = v(P()), o = r(() => {
135
+ function ye({ reclamants: e, modules: t, idModulePrefere: n = y(null), readonly: i = y(!1) } = {}) {
136
+ let a = v(N()), o = r(() => {
137
137
  let e = T(i);
138
- return e === !0 ? N : Array.isArray(e) ? e : [];
139
- }), s = (e) => o.value.includes(e), c = r(() => a.lignes[0]), l = r(() => a.lignes.slice(1)), u = r(() => T(e) ?? []), d = r(() => u.value.find((e) => e.type === a.reclamant.type && String(e.id) === String(a.reclamant.id)) ?? u.value[0] ?? null), f = r(() => {
138
+ return e === !0 ? M : Array.isArray(e) ? e : [];
139
+ }), s = (e) => o.value.includes(e), c = r(() => a.lignes[0]), l = r(() => a.lignes.slice(1)), u = r(() => T(e) ?? []), d = y(null), f = (e, t) => e.type === t.type && String(e.id) === String(t.id), p = r(() => {
140
+ let e = d.value;
141
+ return !e || u.value.some((t) => f(t, e)) ? u.value : [...u.value, e];
142
+ }), m = r(() => p.value.find((e) => f(e, a.reclamant)) ?? p.value[0] ?? null), h = r(() => {
140
143
  let e = T(t) ?? [], r = T(n);
141
144
  return (r == null ? null : e.find((e) => String(e.idModule) === String(r))) ?? e.find((e) => e.estModulePrincipal) ?? e[0] ?? null;
142
- }), p = r(() => !!d.value && !ue.includes(d.value.type)), m = {
145
+ }), g = r(() => !!m.value && !de.includes(m.value.type)), _ = {
143
146
  draft: a,
144
147
  lignePrincipale: c,
145
148
  lignesAssociees: l,
146
- reclamantsDisponibles: u,
147
- reclamantSelectionne: d,
148
- moduleReclamantPrincipal: f,
149
- reclamantEstContrat: p,
150
- ciblesValid: r(() => a.lignes.every((e) => me(e, p.value))),
151
- detailsValid: r(() => a.lignes.every((e, t) => he(e, t === 0))),
149
+ reclamantsFournis: u,
150
+ reclamantsDisponibles: p,
151
+ reclamantSelectionne: m,
152
+ moduleReclamantPrincipal: h,
153
+ reclamantEstContrat: g,
154
+ ciblesValid: r(() => a.lignes.every((e) => he(e, g.value))),
155
+ detailsValid: r(() => a.lignes.every((e, t) => ge(e, t === 0))),
152
156
  isReadonly: s,
153
157
  reset(e = null) {
154
- let t = ge(e);
158
+ let t = ve(e);
155
159
  Object.assign(a, t), a.lignes = t.lignes;
156
160
  },
157
161
  setProvenance(e) {
158
162
  a.provenance = e;
159
163
  },
160
164
  syncReclamant() {
161
- let e = d.value;
162
- m.setReclamant({
165
+ let e = m.value;
166
+ _.setReclamant({
163
167
  type: e?.type ?? null,
164
168
  id: e?.id ?? null
165
169
  });
166
170
  },
171
+ selectReclamant(e) {
172
+ e && (u.value.some((t) => f(t, e)) || (d.value = e), _.setReclamant(e));
173
+ },
167
174
  setReclamant({ type: e, id: t }) {
168
175
  if (a.reclamant = {
169
176
  type: e ?? null,
170
177
  id: t ?? null
171
178
  }, s("cible")) return;
172
179
  let n = a.lignes[0];
173
- e === "D" ? (n.cibleMode = "demande", n.patrimoine = null) : (n.cibleMode = p.value ? "contrat" : "patrimoine", n.contratReclamant = p.value, n.contratCible = null, n.reprendreLocataireActuel = !1, n.patrimoine = j(), m.prefillCiblePrincipale());
180
+ e === "D" ? (n.cibleMode = "demande", n.patrimoine = null) : (n.cibleMode = g.value ? "contrat" : "patrimoine", n.contratReclamant = g.value, n.contratCible = null, n.reprendreLocataireActuel = !1, n.patrimoine = A(), _.prefillCiblePrincipale());
174
181
  },
175
182
  prefillCiblePrincipale() {
176
183
  if (s("cible")) return;
177
- let e = f.value;
178
- e && m.prefillFromModule(0, e);
184
+ let e = h.value;
185
+ e && _.prefillFromModule(0, e);
179
186
  },
180
187
  _resetAfterNomenclature() {
181
188
  a.lignes[0].responsable = null, a.lignes.splice(1);
182
189
  },
183
190
  setCategorie(e) {
184
191
  let t = a.lignes[0];
185
- t.idCategorie = e, t.idType = null, t.idNature = null, t.idMotif = null, m._resetAfterNomenclature();
192
+ t.idCategorie = e, t.idType = null, t.idNature = null, t.idMotif = null, _._resetAfterNomenclature();
186
193
  },
187
194
  setType(e) {
188
195
  let t = a.lignes[0];
189
- t.idType = e, t.idNature = null, t.idMotif = null, m._resetAfterNomenclature();
196
+ t.idType = e, t.idNature = null, t.idMotif = null, _._resetAfterNomenclature();
190
197
  },
191
198
  setNature(e) {
192
199
  let t = a.lignes[0];
193
- t.idNature = e, t.idMotif = null, m._resetAfterNomenclature();
200
+ t.idNature = e, t.idMotif = null, _._resetAfterNomenclature();
194
201
  },
195
202
  setMotif(e) {
196
- a.lignes[0].idMotif = e, m._resetAfterNomenclature();
203
+ a.lignes[0].idMotif = e, _._resetAfterNomenclature();
197
204
  },
198
205
  selectMotifChain(e) {
199
206
  let t = a.lignes[0];
200
- t.idCategorie = e?.idCategorie ?? null, t.idType = e?.idType ?? null, t.idNature = e?.idNature ?? null, t.idMotif = e?.id ?? null, m._resetAfterNomenclature();
207
+ t.idCategorie = e?.idCategorie ?? null, t.idType = e?.idType ?? null, t.idNature = e?.idNature ?? null, t.idMotif = e?.id ?? null, _._resetAfterNomenclature();
201
208
  },
202
209
  toggleLigneAssociee(e, t = {}) {
203
210
  let n = a.lignes.findIndex((t, n) => n > 0 && t.idMotif === e);
204
- if (n !== -1) {
205
- a.lignes.splice(n, 1);
206
- return;
207
- }
208
- a.lignes.push({
209
- ...M(),
211
+ n === -1 ? a.lignes.push({
212
+ ...j(),
210
213
  idMotif: e,
211
214
  ...t
212
- });
215
+ }) : a.lignes.splice(n, 1);
213
216
  },
214
217
  _patrimoine(e) {
215
218
  return a.lignes[e]?.patrimoine ?? null;
216
219
  },
217
220
  setCibleMode(e, t) {
218
221
  let n = a.lignes[e];
219
- n && (n.cibleMode = t, n.reprendreLocataireActuel = !1, n.contratReclamant = t === "contrat" && p.value, n.contratCible = null, t === "demande" ? n.patrimoine = null : n.patrimoine ??= j());
222
+ n && (n.cibleMode = t, n.reprendreLocataireActuel = !1, n.contratReclamant = t === "contrat" && g.value, n.contratCible = null, t === "demande" ? n.patrimoine = null : n.patrimoine ??= A());
220
223
  },
221
224
  toggleContratReclamant(e, t) {
222
225
  let n = a.lignes[e];
223
- n && (n.contratReclamant = t ?? !n.contratReclamant, n.contratCible = null, n.patrimoine && m.setPatrimoineModule(e, null));
226
+ n && (n.contratReclamant = t ?? !n.contratReclamant, n.contratCible = null, n.patrimoine && _.setPatrimoineModule(e, null));
224
227
  },
225
228
  setContratCible(e, t) {
226
229
  let n = a.lignes[e];
@@ -228,26 +231,26 @@ function _e({ reclamants: e, modules: t, idModulePrefere: n = y(null), readonly:
228
231
  typeContrat: t.typeContrat,
229
232
  idContrat: t.idContrat,
230
233
  libelle: t.libelleContrat ?? null
231
- } : null, m.setPatrimoineModule(e, null));
234
+ } : null, _.setPatrimoineModule(e, null));
232
235
  },
233
236
  setPatrimoineCommune(e, t) {
234
- let n = m._patrimoine(e);
235
- n && (n.idCommune = t?.idCommune ?? null, n.commune = t?.commune ?? null, m.setPatrimoineEntree(e, null));
237
+ let n = _._patrimoine(e);
238
+ n && (n.idCommune = t?.idCommune ?? null, n.commune = t?.commune ?? null, _.setPatrimoineEntree(e, null));
236
239
  },
237
240
  setPatrimoineEntree(e, t) {
238
- let n = m._patrimoine(e);
239
- n && (n.idEntree = t?.idEntree ?? null, n.entree = t?.entree ?? null, n.codeProgramme = t?.codeProgramme ?? null, n.codeTranche = t?.codeTranche ?? null, n.codeBatiment = t?.codeBatiment ?? null, n.codeEscalier = t?.codeEscalier ?? null, n.etage = null, m.setPatrimoineModule(e, null));
241
+ let n = _._patrimoine(e);
242
+ n && (n.idEntree = t?.idEntree ?? null, n.entree = t?.entree ?? null, n.codeProgramme = t?.codeProgramme ?? null, n.codeTranche = t?.codeTranche ?? null, n.codeBatiment = t?.codeBatiment ?? null, n.codeEscalier = t?.codeEscalier ?? null, n.etage = null, _.setPatrimoineModule(e, null));
240
243
  },
241
244
  setPatrimoineEtage(e, t) {
242
- let n = m._patrimoine(e);
243
- n && (n.etage = t, m.setPatrimoineModule(e, null));
245
+ let n = _._patrimoine(e);
246
+ n && (n.etage = t, _.setPatrimoineModule(e, null));
244
247
  },
245
248
  setPatrimoineModule(e, t) {
246
- let n = m._patrimoine(e);
249
+ let n = _._patrimoine(e);
247
250
  n && (n.idModule = t?.idModule ?? null, n.libelleModule = t?.libelleModule ?? null, n.typeContratActuel = t?.typeContratActuel ?? null, n.idContratActuel = t?.idContratActuel ?? null, n.occupantActuel = t?.occupantActuel ?? null, t && (n.codeProgramme = t.codeProgramme ?? n.codeProgramme, n.codeTranche = t.codeTranche ?? n.codeTranche, n.codeBatiment = t.codeBatiment ?? n.codeBatiment, n.codeEscalier = t.codeEscalier ?? n.codeEscalier, t.idEntree != null && (n.idEntree = t.idEntree), t.etage != null && (n.etage = t.etage)));
248
251
  },
249
252
  prefillFromModule(e, t) {
250
- let n = m._patrimoine(e);
253
+ let n = _._patrimoine(e);
251
254
  n && t && (n.idCommune = t.idCommune ?? null, n.commune = t.commune ?? null, n.idEntree = t.idEntree ?? null, n.entree = t.adresse ?? t.numeroRue ?? null, n.codeProgramme = t.codeProgramme ?? null, n.codeTranche = t.codeTranche ?? null, n.codeBatiment = t.codeBatiment ?? null, n.codeEscalier = t.codeEscalier ?? null, n.etage = t.etage ?? null, n.idModule = t.idModule ?? null, n.libelleModule = t.libelleModule ?? t.adresse ?? null, n.typeContratActuel = t.typeContratActuel ?? null, n.idContratActuel = t.idContratActuel ?? null, n.occupantActuel = t.occupantActuel ?? null);
252
255
  },
253
256
  toggleCibleOverride(e) {
@@ -301,7 +304,7 @@ function _e({ reclamants: e, modules: t, idModulePrefere: n = y(null), readonly:
301
304
  motif: e.idMotif,
302
305
  description: i,
303
306
  dateFaits: o,
304
- responsable: de(e.responsable)
307
+ responsable: fe(e.responsable)
305
308
  };
306
309
  if (r.cibleMode === "demande") return {
307
310
  ...c,
@@ -309,9 +312,9 @@ function _e({ reclamants: e, modules: t, idModulePrefere: n = y(null), readonly:
309
312
  idCible: a.reclamant.id,
310
313
  deduireCible: !1
311
314
  };
312
- let l = m._patrimoinePayload(r.patrimoine);
315
+ let l = _._patrimoinePayload(r.patrimoine);
313
316
  if (r.cibleMode === "contrat" && !r.reprendreLocataireActuel) {
314
- let e = r.contratReclamant && p.value ? {
317
+ let e = r.contratReclamant && g.value ? {
315
318
  typeContrat: a.reclamant.type,
316
319
  idContrat: a.reclamant.id
317
320
  } : r.contratCible;
@@ -334,10 +337,10 @@ function _e({ reclamants: e, modules: t, idModulePrefere: n = y(null), readonly:
334
337
  cibleResume(e) {
335
338
  let t = a.lignes[0], n = e !== t && !e.cibleOverride ? t : e;
336
339
  if (n.cibleMode === "demande") return "La demande";
337
- let r = fe(n.patrimoine);
340
+ let r = pe(n.patrimoine);
338
341
  if (n.cibleMode !== "contrat") return r;
339
342
  let i = "Contrat non défini";
340
- if (n.contratReclamant && p.value) i = "Contrat du réclamant";
343
+ if (n.contratReclamant && g.value) i = "Contrat du réclamant";
341
344
  else if (n.contratCible) {
342
345
  let e = n.contratCible;
343
346
  i = `${e.libelle ?? "Contrat"} (${e.typeContrat}/${e.idContrat})`;
@@ -345,43 +348,43 @@ function _e({ reclamants: e, modules: t, idModulePrefere: n = y(null), readonly:
345
348
  return `${i} — ${r}`;
346
349
  },
347
350
  lignesPayload() {
348
- return a.lignes.map((e, t) => m._lignePayload(e, t));
351
+ return a.lignes.map((e, t) => _._lignePayload(e, t));
349
352
  },
350
353
  creationPayload() {
351
- let e = d.value;
354
+ let e = m.value;
352
355
  return {
353
356
  typeReclamant: e?.type ?? null,
354
357
  reclamant: e?.id ?? null,
355
- lignes: m.lignesPayload(),
358
+ lignes: _.lignesPayload(),
356
359
  provenance: a.provenance
357
360
  };
358
361
  }
359
362
  };
360
- return v(m);
363
+ return v(_);
361
364
  }
362
- function ve(e) {
363
- return _(le, e), e;
365
+ function be(e) {
366
+ return _(ue, e), e;
364
367
  }
365
- function I() {
366
- let e = f(le, null);
368
+ function P() {
369
+ let e = f(ue, null);
367
370
  if (!e) throw Error("useSollicitationDraft() hors de <creer-sollicitation-form>");
368
371
  return e;
369
372
  }
370
373
  //#endregion
371
374
  //#region \0plugin-vue:export-helper
372
- var L = (e, t) => {
375
+ var F = (e, t) => {
373
376
  let n = e.__vccOpts || e;
374
377
  for (let [e, r] of t) n[e] = r;
375
378
  return n;
376
- }, ye = {
379
+ }, xe = {
377
380
  name: "AsideBlock",
378
- components: { AmsomNavTabsHorizontal: te },
381
+ components: { AmsomNavTabsHorizontal: ne },
379
382
  props: { nbSimilaires: {
380
383
  type: Number,
381
384
  default: 0
382
385
  } },
383
386
  setup() {
384
- return { draft: I() };
387
+ return { draft: P() };
385
388
  },
386
389
  data() {
387
390
  return { activeTab: null };
@@ -417,11 +420,11 @@ var L = (e, t) => {
417
420
  e.some((e) => e.id === this.activeTab) || (this.activeTab = e[0]?.id ?? null);
418
421
  }
419
422
  } }
420
- }, be = {
423
+ }, Se = {
421
424
  key: 0,
422
425
  class: "badge bg-danger ms-1"
423
- }, xe = { style: { "min-height": "320px" } }, Se = { key: 0 }, Ce = { key: 1 };
424
- function we(e, t, n, r, c, l) {
426
+ }, Ce = { style: { "min-height": "320px" } }, we = { key: 0 }, Te = { key: 1 };
427
+ function Ee(e, t, n, r, c, l) {
425
428
  let f = S("font-awesome-icon"), p = S("amsom-nav-tabs-horizontal");
426
429
  return l.tabs.length ? (g(), i(p, {
427
430
  key: 0,
@@ -431,201 +434,30 @@ function we(e, t, n, r, c, l) {
431
434
  "item-key": "id",
432
435
  "tab-spacing": 1
433
436
  }, {
434
- libelle: D(({ item: e }) => [
437
+ libelle: E(({ item: e }) => [
435
438
  u(f, { icon: e.icon }, null, 8, ["icon"]),
436
439
  s("span", null, C(e.label), 1),
437
- e.id === "similarite" && n.nbSimilaires > 0 ? (g(), o("span", be, C(n.nbSimilaires), 1)) : a("", !0)
440
+ e.id === "similarite" && n.nbSimilaires > 0 ? (g(), o("span", Se, C(n.nbSimilaires), 1)) : a("", !0)
438
441
  ]),
439
- content: D(() => [s("div", xe, [e.$slots.similaires ? O((g(), o("div", Se, [x(e.$slots, "similaires", h(d(l.scope)))], 512)), [[E, c.activeTab === "similarite"]]) : a("", !0), e.$slots.evenements ? O((g(), o("div", Ce, [x(e.$slots, "evenements")], 512)), [[E, c.activeTab === "evenements"]]) : a("", !0)])]),
442
+ content: E(() => [s("div", Ce, [e.$slots.similaires ? D((g(), o("div", we, [x(e.$slots, "similaires", h(d(l.scope)))], 512)), [[te, c.activeTab === "similarite"]]) : a("", !0), e.$slots.evenements ? D((g(), o("div", Te, [x(e.$slots, "evenements")], 512)), [[te, c.activeTab === "evenements"]]) : a("", !0)])]),
440
443
  _: 3
441
444
  }, 8, ["modelValue", "items"])) : a("", !0);
442
445
  }
443
- var Te = /*#__PURE__*/ L(ye, [["render", we]]), R = Symbol("cresol:options"), Ee = (e) => _(R, e), z = () => f(R, {});
444
- //#endregion
445
- //#region src/utils/text.js
446
- function B(e, t = !0) {
447
- if (!e) return null;
448
- let n = e.toString().normalize("NFD").replace(/[̀-ͯ]/g, "");
449
- return t ? n.toLowerCase() : n;
450
- }
451
- //#endregion
452
- //#region src/components/ReclamantSelecteurBlock.vue
453
- var De = {
454
- name: "ReclamantSelecteurBlock",
455
- components: { AmsomAutocomplete: k },
456
- props: {
457
- mode: {
458
- type: String,
459
- default: null
460
- },
461
- inline: {
462
- type: Boolean,
463
- default: !0
464
- }
465
- },
466
- setup() {
467
- return {
468
- draft: I(),
469
- options: z()
470
- };
471
- },
472
- computed: {
473
- reclamants() {
474
- return this.draft.reclamantsDisponibles;
475
- },
476
- reclamantSelectionne() {
477
- return this.draft.reclamantSelectionne;
478
- },
479
- presentation() {
480
- return this.mode ?? this.options.reclamantMode;
481
- },
482
- estFige() {
483
- return this.reclamants.length <= 1 || this.draft.isReadonly("reclamant");
484
- }
485
- },
486
- methods: {
487
- reclamantId(e) {
488
- let t = this.reclamants.indexOf(e);
489
- return t < 0 ? null : t;
490
- },
491
- select(e) {
492
- e && this.draft.setReclamant(e);
493
- },
494
- filterReclamants({ search: e, items: t }) {
495
- let n = (B(e) ?? "").trim();
496
- return n ? t.filter((e) => (B(e?.libelle) ?? "").includes(n)) : t;
497
- }
498
- }
499
- }, Oe = {
500
- key: 0,
501
- class: "fs-7 text-muted"
502
- }, ke = { class: "fw-medium" }, Ae = {
503
- key: 0,
504
- class: "btn-group btn-group-sm",
505
- role: "group"
506
- }, je = ["onClick"], Me = ["value"], Ne = ["value"];
507
- function Pe(e, t, r, a, c, u) {
508
- let d = S("amsom-autocomplete");
509
- return u.estFige ? (g(), o("div", Oe, [t[2] ||= l(" Réclamant : ", -1), s("span", ke, C(u.reclamantSelectionne?.libelle), 1)])) : (g(), o("div", {
510
- key: 1,
511
- class: m(r.inline ? "d-flex align-items-center justify-content-between gap-2 border-bottom pb-2" : "d-flex flex-column gap-1")
512
- }, [t[3] ||= s("span", { class: "fs-7 fw-semibold text-muted text-uppercase" }, "Réclamant", -1), u.presentation === "switch" ? (g(), o("div", Ae, [(g(!0), o(n, null, b(u.reclamants, (e, t) => (g(), o("button", {
513
- key: t,
514
- type: "button",
515
- class: m(["btn btn-sm py-0", e === u.reclamantSelectionne ? "btn-primary" : "btn-outline-primary"]),
516
- onClick: (t) => u.select(e)
517
- }, C(e.libelle), 11, je))), 128))])) : u.presentation === "autocomplete" ? (g(), i(d, {
518
- key: 1,
519
- "model-value": u.reclamantSelectionne,
520
- items: u.reclamants,
521
- "get-id": u.reclamantId,
522
- "get-input-libelle": (e) => e?.libelle ?? "",
523
- "filtering-function": u.filterReclamants,
524
- placeholder: "Rechercher un réclamant…",
525
- "input-size": "sm",
526
- "hide-choices": "",
527
- class: m(r.inline ? "" : "w-100"),
528
- "onUpdate:modelValue": t[0] ||= (e) => u.select(e)
529
- }, null, 8, [
530
- "model-value",
531
- "items",
532
- "get-id",
533
- "get-input-libelle",
534
- "filtering-function",
535
- "class"
536
- ])) : (g(), o("select", {
537
- key: 2,
538
- class: m(["form-select form-select-sm", r.inline ? "w-auto" : ""]),
539
- value: u.reclamants.indexOf(u.reclamantSelectionne),
540
- onChange: t[1] ||= (e) => u.select(u.reclamants[e.target.value])
541
- }, [(g(!0), o(n, null, b(u.reclamants, (e, t) => (g(), o("option", {
542
- key: t,
543
- value: t
544
- }, C(e.libelle), 9, Ne))), 128))], 42, Me))], 2));
545
- }
546
- var V = /*#__PURE__*/ L(De, [["render", Pe]]), Fe = {
547
- name: "ProvenanceSelecteurBlock",
548
- setup() {
549
- return { draft: I() };
550
- },
551
- computed: {
552
- provenances() {
553
- return se;
554
- },
555
- selected() {
556
- return this.draft.draft.provenance;
557
- },
558
- provenanceChoisie() {
559
- return this.provenances.find((e) => e.id === this.selected) ?? null;
560
- }
561
- }
562
- }, Ie = {
563
- key: 0,
564
- class: "fs-7 text-muted"
565
- }, Le = { class: "fw-medium" }, Re = { key: 1 }, ze = { class: "d-flex flex-wrap gap-2" }, Be = ["onClick"], Ve = {
566
- key: 0,
567
- class: "fs-7 text-danger mt-1"
568
- };
569
- function He(e, t, r, c, d, f) {
570
- let p = S("font-awesome-icon");
571
- return c.draft.isReadonly("provenance") ? (g(), o("div", Ie, [t[0] ||= l(" Provenance du contact : ", -1), s("span", Le, [f.provenanceChoisie?.icon ? (g(), i(p, {
572
- key: 0,
573
- icon: f.provenanceChoisie.icon,
574
- "fixed-width": ""
575
- }, null, 8, ["icon"])) : a("", !0), l(" " + C(f.provenanceChoisie?.libelle ?? "—"), 1)])])) : (g(), o("div", Re, [
576
- t[1] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, [l(" Provenance du contact "), s("span", { class: "text-danger" }, "*")], -1),
577
- s("div", ze, [(g(!0), o(n, null, b(f.provenances, (e) => (g(), o("button", {
578
- key: e.id,
579
- type: "button",
580
- class: m(["btn btn-sm d-inline-flex align-items-center gap-2", e.id === f.selected ? "btn-primary" : "btn-outline-primary"]),
581
- onClick: (t) => c.draft.setProvenance(e.id)
582
- }, [u(p, {
583
- icon: f.provenanceChoisie.icon,
584
- "fixed-width": ""
585
- }, null, 8, ["icon"]), s("span", null, C(e.libelle), 1)], 10, Be))), 128))]),
586
- f.selected ? a("", !0) : (g(), o("div", Ve, " Sélectionnez par quel canal la sollicitation vous est parvenue. "))
587
- ]));
588
- }
589
- var Ue = /*#__PURE__*/ L(Fe, [["render", He]]), We = {
590
- name: "EtapeReclamantBlock",
591
- components: {
592
- ReclamantSelecteurBlock: V,
593
- ProvenanceSelecteurBlock: Ue
594
- },
595
- props: { premiere: {
596
- type: Boolean,
597
- default: !1
598
- } }
599
- }, Ge = { class: "d-flex flex-column gap-3" }, Ke = { class: "alert alert-light border py-2 px-3 mb-0 fs-7" };
600
- function qe(e, t, n, r, c, d) {
601
- let f = S("font-awesome-icon"), p = S("reclamant-selecteur-block"), m = S("provenance-selecteur-block");
602
- return g(), o("div", Ge, [
603
- s("div", Ke, [u(f, {
604
- icon: "user",
605
- class: "text-primary me-2"
606
- }), t[0] ||= l(" Pour qui cette sollicitation est-elle créée\xA0? ", -1)]),
607
- u(p, {
608
- mode: "select",
609
- inline: !1
610
- }),
611
- n.premiere ? (g(), i(m, { key: 0 })) : a("", !0)
612
- ]);
613
- }
614
- var Je = /*#__PURE__*/ L(We, [["render", qe]]), Ye = {
446
+ var De = /*#__PURE__*/ F(xe, [["render", Ee]]), Oe = {
615
447
  baseUrl: "",
616
- getToken: () => A.getToken(),
617
- setToken: (e) => A.setToken(e),
618
- logout: () => A.logout(),
619
- goToLoginPage: () => A.goToLoginPage()
448
+ getToken: () => k.getToken(),
449
+ setToken: (e) => k.setToken(e),
450
+ logout: () => k.logout(),
451
+ goToLoginPage: () => k.goToLoginPage()
620
452
  };
621
- function Xe(e = {}) {
622
- Object.assign(Ye, e);
453
+ function ke(e = {}) {
454
+ Object.assign(Oe, e);
623
455
  }
624
- var H = () => Ye;
456
+ var I = () => Oe;
625
457
  //#endregion
626
458
  //#region src/api/transport/axiosOverlayConnector.js
627
- function Ze(e, t = {}) {
628
- let n = H(), r = {
459
+ function Ae(e, t = {}) {
460
+ let n = I(), r = {
629
461
  getToken: () => n.getToken?.() ?? null,
630
462
  setToken: (e) => n.setToken?.(e),
631
463
  logout: () => n.logout?.(),
@@ -647,40 +479,40 @@ function Ze(e, t = {}) {
647
479
  }, t.functions.errorsHandlers = {
648
480
  ...r.errorsHandlers,
649
481
  ...t.functions.errorsHandlers ?? {}
650
- }, re(e, t);
482
+ }, ie(e, t);
651
483
  }
652
484
  //#endregion
653
485
  //#region src/api/transport/httpClient.js
654
- var Qe = (e, t) => {
655
- let n = t || H().baseUrl;
486
+ var je = (e, t) => {
487
+ let n = t || I().baseUrl;
656
488
  if (!n) throw Error("Cresol : baseUrl non renseignée (configureCresol ou prop baseUrl)");
657
489
  return `${n}${e}`;
658
- }, $e = (e = {}) => {
490
+ }, Me = (e = {}) => {
659
491
  let t = new URLSearchParams();
660
492
  Object.entries(e).forEach(([e, n]) => {
661
493
  n != null && n !== "" && t.append(e, typeof n == "object" ? JSON.stringify(n) : n);
662
494
  });
663
495
  let n = t.toString();
664
496
  return n ? `?${n}` : "";
665
- }, et = (e = {}, t) => t ? {
497
+ }, Ne = (e = {}, t) => t ? {
666
498
  ...e,
667
499
  functions: {
668
500
  ...e.functions ?? {},
669
501
  getToken: () => t
670
502
  }
671
- } : e, tt = ({ method: e, path: t, params: n, data: r, signal: i, token: a, baseUrl: o }, s = {}) => Ze({
672
- url: Qe(`${t}${$e(n)}`, o),
503
+ } : e, Pe = ({ method: e, path: t, params: n, data: r, signal: i, token: a, baseUrl: o }, s = {}) => Ae({
504
+ url: je(`${t}${Me(n)}`, o),
673
505
  method: e,
674
506
  ...r === void 0 ? {} : { data: r },
675
507
  ...i ? { signal: i } : {}
676
- }, et(s, a)), U = (e, { params: t, signal: n, overlay: r, token: i, baseUrl: a } = {}) => tt({
508
+ }, Ne(s, a)), L = (e, { params: t, signal: n, overlay: r, token: i, baseUrl: a } = {}) => Pe({
677
509
  method: "GET",
678
510
  path: e,
679
511
  params: t,
680
512
  signal: n,
681
513
  token: i,
682
514
  baseUrl: a
683
- }, r).then((e) => e.data), nt = (e, t, { params: n, signal: r, overlay: i, token: a, baseUrl: o } = {}) => tt({
515
+ }, r).then((e) => e.data), Fe = (e, t, { params: n, signal: r, overlay: i, token: a, baseUrl: o } = {}) => Pe({
684
516
  method: "POST",
685
517
  path: e,
686
518
  params: n,
@@ -688,31 +520,34 @@ var Qe = (e, t) => {
688
520
  signal: r,
689
521
  token: a,
690
522
  baseUrl: o
691
- }, i).then((e) => e.data), rt = { mustBeAuthenticated: !1 }, W = (e, { signal: t, token: n, baseUrl: r } = {}) => U(e, {
523
+ }, i).then((e) => e.data), Ie = { mustBeAuthenticated: !1 }, R = (e, { signal: t, token: n, baseUrl: r } = {}) => L(e, {
692
524
  signal: t,
693
525
  token: n,
694
526
  baseUrl: r,
695
- overlay: rt
696
- }), it = (e) => W("/v2/sollicitation/motifs", e), at = (e) => W("/v2/sollicitation/categories", e), ot = (e) => W("/v2/sollicitation/types", e), st = (e) => W("/v2/sollicitation/natures", e), ct = (e) => W("/v2/sollicitation/etats", e), lt = ({ signal: e, token: t, baseUrl: n } = {}) => U("/collaborateurs", {
527
+ overlay: Ie
528
+ }), Le = (e) => R("/v2/sollicitation/motifs", e), Re = (e) => R("/v2/sollicitation/categories", e), ze = (e) => R("/v2/sollicitation/types", e), Be = (e) => R("/v2/sollicitation/natures", e), Ve = (e) => R("/v2/sollicitation/etats", e), He = ({ signal: e, token: t, baseUrl: n } = {}) => L("/collaborateurs", {
697
529
  params: { actif: !0 },
698
530
  signal: e,
699
531
  token: t,
700
532
  baseUrl: n
701
- }), ut = ({ signal: e, token: t, baseUrl: n } = {}) => U("/cally2/patrimoine_communes", {
533
+ }), Ue = async ({ signal: e, token: t, baseUrl: n } = {}) => (await L("/v2/patrimoine/communes", {
702
534
  signal: e,
703
535
  token: t,
704
536
  baseUrl: n
705
- }), dt = (e, { signal: t, token: n, baseUrl: r } = {}) => U("/cally2/patrimoine_entrees", {
537
+ }) ?? []).map((e) => ({
538
+ idCommune: e.id,
539
+ commune: e.libelle
540
+ })), We = (e, { signal: t, token: n, baseUrl: r } = {}) => L("/v2/patrimoine/entrees", {
706
541
  params: { idCommune: e },
707
542
  signal: t,
708
543
  token: n,
709
544
  baseUrl: r
710
- }), ft = (e, { signal: t, token: n, baseUrl: r } = {}) => U("/cally2/patrimoine_modules", {
545
+ }), Ge = (e, { signal: t, token: n, baseUrl: r } = {}) => L("/v2/patrimoine/modules", {
711
546
  params: { codeProgramme: e },
712
547
  signal: t,
713
548
  token: n,
714
549
  baseUrl: r
715
- }), pt = ({ idContrat: e, typeContrat: t }, { signal: n, token: r, baseUrl: i } = {}) => U("/cally2/contrat_modules", {
550
+ }), Ke = ({ idContrat: e, typeContrat: t }, { signal: n, token: r, baseUrl: i } = {}) => L("/v2/patrimoine/contrat_modules", {
716
551
  params: {
717
552
  idContrat: e,
718
553
  typeContrat: t
@@ -720,7 +555,7 @@ var Qe = (e, t) => {
720
555
  signal: n,
721
556
  token: r,
722
557
  baseUrl: i
723
- }), mt = ({ motif: e, categorie: t, type: n, nature: r }, { signal: i, token: a, baseUrl: o } = {}) => U("/v2/sollicitation/responsables", {
558
+ }), qe = ({ motif: e, categorie: t, type: n, nature: r }, { signal: i, token: a, baseUrl: o } = {}) => L("/v2/sollicitation/responsables", {
724
559
  params: {
725
560
  motif: e,
726
561
  categorie: t,
@@ -730,10 +565,15 @@ var Qe = (e, t) => {
730
565
  signal: i,
731
566
  token: a,
732
567
  baseUrl: o
733
- }), ht = ({ idContrat: e, libelle: t }, { signal: n, token: r, baseUrl: i } = {}) => U("/cockpit/circuit_achat/contrats", {
568
+ }), Je = (e, { signal: t, token: n, baseUrl: r } = {}) => L("/v2/patrimoine/contrat_module_rechercher", {
569
+ params: { recherche: e },
570
+ signal: t,
571
+ token: n,
572
+ baseUrl: r
573
+ }), Ye = ({ categorie: e, recherche: t }, { signal: n, token: r, baseUrl: i } = {}) => L("/v2/cresol/reclamant_rechercher", {
734
574
  params: {
735
- idContrat: e,
736
- libelle: t
575
+ categorie: e,
576
+ recherche: t
737
577
  },
738
578
  signal: n,
739
579
  token: r,
@@ -741,11 +581,11 @@ var Qe = (e, t) => {
741
581
  });
742
582
  //#endregion
743
583
  //#region src/utils/apiError.js
744
- function G(e) {
584
+ function z(e) {
745
585
  let t = e?.response?.data;
746
586
  return t?.error ? t.error : t?.errorList ? t.errorList.map((e) => e.message).join(", ") : e?.response?.status === 500 ? "Erreur interne" : e?.response?.status === 401 ? "Non autorisé à faire cette action" : "Erreur";
747
587
  }
748
- var gt = (e) => e?.name === "AbortError" || e?.name === "CanceledError", _t = Symbol("cresol:data"), vt = () => ({
588
+ var B = (e) => e?.name === "AbortError" || e?.name === "CanceledError", V = Symbol("cresol:data"), Xe = () => ({
749
589
  motifs: null,
750
590
  categories: null,
751
591
  types: null,
@@ -757,23 +597,23 @@ var gt = (e) => e?.name === "AbortError" || e?.name === "CanceledError", _t = Sy
757
597
  modulesByProgramme: {},
758
598
  modulesByContrat: {},
759
599
  responsablesByMotif: {}
760
- }), K = /* @__PURE__ */ new Map(), yt = (e) => (K.has(e) || K.set(e, v(vt())), K.get(e)), q = /* @__PURE__ */ new Map();
761
- function bt() {
762
- K.clear(), q.clear();
600
+ }), H = /* @__PURE__ */ new Map(), Ze = (e) => (H.has(e) || H.set(e, v(Xe())), H.get(e)), U = /* @__PURE__ */ new Map();
601
+ function Qe() {
602
+ H.clear(), U.clear();
763
603
  }
764
- var J = (e, t, n) => e?.find((e) => e[t] === n)?.libelle ?? n, Y = (e, t, n) => e?.find((e) => e[t] === n)?.icon ?? null;
765
- function xt({ onError: e, token: t, baseUrl: n } = {}) {
604
+ var W = (e, t, n) => e?.find((e) => e[t] === n)?.libelle ?? n, G = (e, t, n) => e?.find((e) => e[t] === n)?.icon ?? null;
605
+ function $e({ onError: e, token: t, baseUrl: n } = {}) {
766
606
  let i = y(0), a = () => ({
767
607
  token: T(t) || null,
768
608
  baseUrl: T(n) || null
769
- }), o = () => T(n) || H().baseUrl || "", s = () => yt(o()), c = (t, n) => {
609
+ }), o = () => T(n) || I().baseUrl || "", s = () => Ze(o()), c = (t, n) => {
770
610
  let r = `${o()}|${t}`;
771
- if (q.has(r)) return q.get(r);
611
+ if (U.has(r)) return U.get(r);
772
612
  i.value += 1;
773
- let a = Promise.resolve().then(n).catch((t) => (gt(t) || e?.(G(t)), null)).finally(() => {
774
- --i.value, q.delete(r);
613
+ let a = Promise.resolve().then(n).catch((t) => (B(t) || e?.(z(t)), null)).finally(() => {
614
+ --i.value, U.delete(r);
775
615
  });
776
- return q.set(r, a), a;
616
+ return U.set(r, a), a;
777
617
  }, l = (e, t) => s()[e]?.length ? Promise.resolve(s()[e]) : c(`referentiel:${e}`, async () => (s()[e] = await t(a()), s()[e])), u = {
778
618
  get cache() {
779
619
  return s();
@@ -782,26 +622,26 @@ function xt({ onError: e, token: t, baseUrl: n } = {}) {
782
622
  isLoading: r(() => i.value > 0),
783
623
  loadNomenclature() {
784
624
  return Promise.all([
785
- l("motifs", it),
786
- l("categories", at),
787
- l("types", ot),
788
- l("natures", st),
789
- l("etats", ct)
625
+ l("motifs", Le),
626
+ l("categories", Re),
627
+ l("types", ze),
628
+ l("natures", Be),
629
+ l("etats", Ve)
790
630
  ]);
791
631
  },
792
- loadCollaborateurs: () => l("collaborateurs", lt),
632
+ loadCollaborateurs: () => l("collaborateurs", He),
793
633
  loadCommunes() {
794
- return s().communes?.length ? Promise.resolve(s().communes) : c("communes", async () => (s().communes = await ut(a()), s().communes));
634
+ return s().communes?.length ? Promise.resolve(s().communes) : c("communes", async () => (s().communes = await Ue(a()), s().communes));
795
635
  },
796
636
  loadAdresses(e) {
797
637
  return e == null ? Promise.resolve([]) : s().adressesByCommune[e] ? Promise.resolve(s().adressesByCommune[e]) : c(`adresses:${e}`, async () => {
798
- let t = await dt(e, a());
638
+ let t = await We(e, a());
799
639
  return s().adressesByCommune[e] = t ?? [], t;
800
640
  });
801
641
  },
802
642
  loadModulesOfProgramme(e) {
803
643
  return e == null ? Promise.resolve([]) : s().modulesByProgramme[e] ? Promise.resolve(s().modulesByProgramme[e]) : c(`modules:${e}`, async () => {
804
- let t = await ft(e, a());
644
+ let t = await Ge(e, a());
805
645
  return s().modulesByProgramme[e] = t ?? [], t;
806
646
  });
807
647
  },
@@ -809,7 +649,7 @@ function xt({ onError: e, token: t, baseUrl: n } = {}) {
809
649
  if (e == null) return Promise.resolve([]);
810
650
  let n = `${t ?? ""}|${e}`;
811
651
  return s().modulesByContrat[n] ? Promise.resolve(s().modulesByContrat[n]) : c(`contratModules:${n}`, async () => {
812
- let r = await pt({
652
+ let r = await Ke({
813
653
  idContrat: e,
814
654
  typeContrat: t
815
655
  }, a());
@@ -819,29 +659,60 @@ function xt({ onError: e, token: t, baseUrl: n } = {}) {
819
659
  async searchContrats(e, { signal: t } = {}) {
820
660
  let n = (e ?? "").trim();
821
661
  if (!n) return [];
822
- let r = await ht(/^\d+$/.test(n) ? { idContrat: n } : { libelle: n }, {
662
+ let r = await Je(n, {
823
663
  ...a(),
824
664
  signal: t
825
665
  }), i = /* @__PURE__ */ new Map();
826
666
  for (let e of r ?? []) {
827
- let t = `${e.typeContrat}|${e.idContrat}`, n = i.get(t);
828
- if (!n) {
829
- i.set(t, {
830
- typeContrat: e.typeContrat,
831
- idContrat: e.idContrat,
832
- libelle: e.libelle ?? null,
833
- dateSortie: e.dateSortie ?? null,
834
- nbModules: 1
835
- });
836
- continue;
837
- }
838
- n.nbModules += 1, e.dateSortie ?? (n.dateSortie = null);
667
+ let t = `${e.typeContrat}|${e.idContrat}`;
668
+ i.has(t) || i.set(t, {
669
+ typeContrat: e.typeContrat,
670
+ idContrat: e.idContrat,
671
+ libelle: e.libelle ?? null,
672
+ estSorti: !!e.estContratSorti,
673
+ nbModules: e.nbModulesContrat ?? 1
674
+ });
839
675
  }
840
- return [...i.values()].sort((e, t) => (e.dateSortie == null ? 0 : 1) - (t.dateSortie == null ? 0 : 1) || (e.libelle ?? "").localeCompare(t.libelle ?? ""));
676
+ return [...i.values()].sort((e, t) => Number(e.estSorti) - Number(t.estSorti) || (e.libelle ?? "").localeCompare(t.libelle ?? ""));
677
+ },
678
+ async searchReclamants(e, t, { signal: n } = {}) {
679
+ let r = (t ?? "").trim();
680
+ if (!r) return [];
681
+ let i = await Ye({
682
+ categorie: e,
683
+ recherche: r
684
+ }, {
685
+ ...a(),
686
+ signal: n
687
+ }), o = /* @__PURE__ */ new Map();
688
+ for (let t of i ?? []) {
689
+ let n = `${t.typeReclamant}|${t.idReclamant}`;
690
+ o.has(n) || o.set(n, {
691
+ type: t.typeReclamant,
692
+ id: t.idReclamant,
693
+ categorie: t.categorie?.toLowerCase() ?? e,
694
+ libelleReclamant: t.libelleReclamant,
695
+ adresse: t.adresse,
696
+ estActif: !1,
697
+ individus: []
698
+ });
699
+ let r = o.get(n);
700
+ r.estActif ||= !!t.estActif, r.individus.push(t);
701
+ }
702
+ return [...o.values()].sort((e, t) => Number(t.estActif) - Number(e.estActif)).map((e) => {
703
+ let t = e.individus.map((e) => [e.nom, e.prenom].filter(Boolean).join(" ")).filter(Boolean).join(", "), n = {
704
+ locataire: `${e.libelleReclamant || t} — Contrat ${e.type}/${e.id}`,
705
+ demandeur: `${t} — ${e.libelleReclamant}`
706
+ }[e.categorie];
707
+ return {
708
+ ...e,
709
+ libelle: n ?? e.libelleReclamant
710
+ };
711
+ });
841
712
  },
842
713
  loadResponsables({ motif: e, categorie: t, type: n, nature: r }) {
843
714
  return e == null ? Promise.resolve([]) : s().responsablesByMotif[e] ? Promise.resolve(s().responsablesByMotif[e]) : c(`responsables:${e}`, async () => {
844
- let i = await mt({
715
+ let i = await qe({
845
716
  motif: e,
846
717
  categorie: t,
847
718
  type: n,
@@ -865,45 +736,441 @@ function xt({ onError: e, token: t, baseUrl: n } = {}) {
865
736
  libelle: l.libelleResponsable
866
737
  };
867
738
  },
868
- motifLibelle: (e) => J(s().motifs, "id", e),
869
- categorieLibelle: (e) => J(s().categories, "id", e),
870
- typeLibelle: (e) => J(s().types, "id", e),
871
- natureLibelle: (e) => J(s().natures, "id", e),
872
- etatLibelle: (e) => J(s().etats, "code", e),
873
- motifIcon: (e) => Y(s().motifs, "id", e),
874
- categorieIcon: (e) => Y(s().categories, "id", e),
875
- typeIcon: (e) => Y(s().types, "id", e),
876
- natureIcon: (e) => Y(s().natures, "id", e)
739
+ motifLibelle: (e) => W(s().motifs, "id", e),
740
+ categorieLibelle: (e) => W(s().categories, "id", e),
741
+ typeLibelle: (e) => W(s().types, "id", e),
742
+ natureLibelle: (e) => W(s().natures, "id", e),
743
+ etatLibelle: (e) => W(s().etats, "code", e),
744
+ motifIcon: (e) => G(s().motifs, "id", e),
745
+ categorieIcon: (e) => G(s().categories, "id", e),
746
+ typeIcon: (e) => G(s().types, "id", e),
747
+ natureIcon: (e) => G(s().natures, "id", e)
877
748
  };
878
749
  return v(u);
879
750
  }
880
- function St(e) {
881
- return _(_t, e), e;
751
+ function et(e) {
752
+ return _(V, e), e;
882
753
  }
883
- function X() {
884
- let e = f(_t, null);
754
+ function K() {
755
+ let e = f(V, null);
885
756
  if (!e) throw Error("useCresolData() hors de <creer-sollicitation-form>");
886
757
  return e;
887
758
  }
888
759
  //#endregion
889
760
  //#region src/utils/fontAwesomeIcons.js
890
- var Ct = (e) => "fa" + e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("");
891
- async function wt(e) {
761
+ var tt = (e) => "fa" + e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("");
762
+ async function nt(e) {
892
763
  let t = await import("@fortawesome/free-solid-svg-icons");
893
764
  [...new Set(e.filter(Boolean))].forEach((e) => {
894
- let n = t[Ct(e)];
895
- n && ie.add(n);
765
+ let n = t[tt(e)];
766
+ n && ae.add(n);
896
767
  });
897
768
  }
898
769
  //#endregion
770
+ //#region src/components/ReclamantRechercheBlock.vue
771
+ var q = [
772
+ {
773
+ key: "locataire",
774
+ label: "Locataire",
775
+ icon: "house-user",
776
+ recherche: "Rechercher un locataire",
777
+ aucun: "Aucun locataire trouvé.",
778
+ placeholder: "Nom, prénom, n° de contrat, adresse, téléphone ou mail…"
779
+ },
780
+ {
781
+ key: "demandeur",
782
+ label: "Demandeur",
783
+ icon: "hourglass-half",
784
+ recherche: "Rechercher un demandeur",
785
+ aucun: "Aucun demandeur trouvé.",
786
+ placeholder: "Nom, prénom, n° de demande ou unique, téléphone ou mail…"
787
+ },
788
+ {
789
+ key: "tiers",
790
+ label: "Tiers",
791
+ icon: "user-tie",
792
+ recherche: "Rechercher un tiers",
793
+ aucun: "Aucun tiers trouvé.",
794
+ placeholder: "Raison sociale, adresse, téléphone ou mail…"
795
+ },
796
+ {
797
+ key: "autre",
798
+ label: "Autre",
799
+ icon: "user",
800
+ recherche: "Rechercher un individu « Autre »",
801
+ aucun: "Aucun individu « Autre » trouvé.",
802
+ placeholder: "Nom, prénom, adresse, téléphone ou mail…"
803
+ },
804
+ {
805
+ key: "tout",
806
+ label: "Tout",
807
+ icon: "magnifying-glass",
808
+ recherche: "Rechercher parmi tous les réclamants",
809
+ aucun: "Aucun réclamant trouvé.",
810
+ placeholder: "Nom, prénom, n° de contrat ou de demande, adresse, téléphone ou mail…"
811
+ }
812
+ ], rt = {
813
+ signataire: "Signataire",
814
+ occupant: "Occupant",
815
+ demandeur: "Demandeur"
816
+ }, J = (e) => e ? e.categorie ? e.categorie : {
817
+ D: "demandeur",
818
+ T: "tiers",
819
+ U: "autre"
820
+ }[e.type] ?? "locataire" : null, it = {
821
+ name: "ReclamantRechercheBlock",
822
+ components: { AmsomAutocomplete: O },
823
+ setup() {
824
+ return {
825
+ draft: P(),
826
+ data: K()
827
+ };
828
+ },
829
+ data() {
830
+ return {
831
+ iconsReady: !1,
832
+ categorie: J(this.draft.reclamantSelectionne) ?? "locataire",
833
+ trouves: [],
834
+ rechercheEnCours: !1,
835
+ rechercheFaite: !1
836
+ };
837
+ },
838
+ computed: {
839
+ categories() {
840
+ return q;
841
+ },
842
+ categorieCourante() {
843
+ return q.find((e) => e.key === this.categorie);
844
+ },
845
+ selectionne() {
846
+ return this.draft.reclamantSelectionne;
847
+ },
848
+ selectedTrouve: {
849
+ get() {
850
+ return this.categorie === "tout" || J(this.selectionne) === this.categorie ? this.selectionne : null;
851
+ },
852
+ set(e) {
853
+ this.select(e);
854
+ }
855
+ }
856
+ },
857
+ async created() {
858
+ await nt(q.map((e) => e.icon)), this.iconsReady = !0;
859
+ },
860
+ beforeUnmount() {
861
+ clearTimeout(this.rechercheTimeout), this.controller?.abort();
862
+ },
863
+ methods: {
864
+ select(e) {
865
+ e && (this.draft.selectReclamant(e), this.categorie !== "tout" && (this.categorie = J(e)));
866
+ },
867
+ setCategorie(e) {
868
+ e !== this.categorie && (this.categorie = e, clearTimeout(this.rechercheTimeout), this.controller?.abort(), this.trouves = [], this.rechercheEnCours = !1, this.rechercheFaite = !1);
869
+ },
870
+ rechercherPlusTard(e) {
871
+ clearTimeout(this.rechercheTimeout), this.rechercheTimeout = setTimeout(() => this.rechercher(e), 400);
872
+ },
873
+ rechercher(e) {
874
+ let t = (e ?? "").trim();
875
+ t.length < 2 ? (this.trouves = [], this.rechercheEnCours = !1, this.rechercheFaite = !1) : (this.controller?.abort(), this.controller = new AbortController(), this.rechercheEnCours = !0, this.data.searchReclamants(this.categorie, t, { signal: this.controller.signal }).then((e) => {
876
+ this.trouves = e ?? [], this.rechercheFaite = !0, this.rechercheEnCours = !1;
877
+ }).catch(() => {
878
+ this.rechercheEnCours = !1;
879
+ }));
880
+ },
881
+ cleReclamant(e) {
882
+ return e ? `${e.type}|${e.id}` : null;
883
+ },
884
+ categorieOf: J,
885
+ iconOf(e) {
886
+ return q.find((t) => t.key === J(e))?.icon ?? "user";
887
+ },
888
+ nomsOf(e) {
889
+ return (e?.individus ?? []).map((e) => [e.nom, e.prenom].filter(Boolean).join(" ")).filter(Boolean).join(", ");
890
+ },
891
+ titreOf(e) {
892
+ if (!e?.individus) return e?.libelle ?? "";
893
+ let t = J(e);
894
+ return t === "locataire" ? e.libelleReclamant || this.nomsOf(e) : t === "demandeur" ? this.nomsOf(e) : e.libelleReclamant;
895
+ },
896
+ referenceOf(e) {
897
+ if (!e?.individus) return "";
898
+ let t = J(e);
899
+ return t === "locataire" ? `Contrat ${e.type}/${e.id}` : t === "demandeur" ? e.libelleReclamant : t === "autre" ? "Individu « Autre »" : "Tiers";
900
+ },
901
+ detailOf(e) {
902
+ let t = e?.individus ?? [];
903
+ if (["tiers", "autre"].includes(J(e))) {
904
+ let e = t[0];
905
+ return e ? [e.telephone, e.mail].filter(Boolean).join(" — ") : "";
906
+ }
907
+ return t.map((e) => {
908
+ let t = [e.nom, e.prenom].filter(Boolean).join(" ");
909
+ return rt[e.role] ? `${t} (${rt[e.role].toLowerCase()})` : t;
910
+ }).join(", ");
911
+ }
912
+ }
913
+ }, at = {
914
+ key: 0,
915
+ class: "d-flex flex-column gap-3"
916
+ }, ot = { class: "d-flex flex-wrap gap-2" }, st = ["onClick"], ct = { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, lt = { class: "min-w-0" }, ut = {
917
+ key: 0,
918
+ class: "badge bg-warning-subtle text-warning-emphasis ms-1"
919
+ }, dt = { class: "text-muted d-block text-truncate" }, ft = { key: 0 }, pt = {
920
+ key: 0,
921
+ class: "text-muted d-block text-truncate"
922
+ }, mt = {
923
+ key: 0,
924
+ class: "text-muted"
925
+ }, ht = {
926
+ key: 0,
927
+ class: "alert alert-primary py-2 px-3 mb-0 fs-7 d-flex align-items-start gap-2"
928
+ }, gt = { class: "min-w-0" }, _t = { class: "fw-semibold" }, vt = {
929
+ key: 0,
930
+ class: "text-truncate"
931
+ }, yt = {
932
+ key: 1,
933
+ class: "text-truncate"
934
+ }, bt = {
935
+ key: 1,
936
+ class: "fs-7 text-danger"
937
+ };
938
+ function xt(e, t, r, c, d, f) {
939
+ let p = S("font-awesome-icon"), h = S("amsom-autocomplete");
940
+ return d.iconsReady ? (g(), o("div", at, [
941
+ s("div", null, [t[1] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, " Le réclamant est… ", -1), s("div", ot, [(g(!0), o(n, null, b(f.categories, (e) => (g(), o("button", {
942
+ key: e.key,
943
+ type: "button",
944
+ class: m(["btn btn-sm d-inline-flex align-items-center gap-2", d.categorie === e.key ? "btn-primary" : "btn-outline-primary"]),
945
+ onClick: (t) => f.setCategorie(e.key)
946
+ }, [u(p, {
947
+ icon: e.icon,
948
+ "fixed-width": ""
949
+ }, null, 8, ["icon"]), s("span", null, C(e.label), 1)], 10, st))), 128))])]),
950
+ s("div", null, [
951
+ s("label", ct, C(f.categorieCourante.recherche), 1),
952
+ (g(), i(h, {
953
+ key: d.categorie,
954
+ modelValue: f.selectedTrouve,
955
+ "onUpdate:modelValue": t[0] ||= (e) => f.selectedTrouve = e,
956
+ items: d.trouves,
957
+ "filtering-function": ({ items: e }) => e,
958
+ loading: d.rechercheEnCours,
959
+ "get-id": f.cleReclamant,
960
+ "get-input-libelle": (e) => e?.libelle ?? "",
961
+ placeholder: f.categorieCourante.placeholder,
962
+ "input-size": "sm",
963
+ "hide-choices": "",
964
+ "debounce-delay": 0,
965
+ onSearch: f.rechercherPlusTard
966
+ }, {
967
+ options: E((e) => [s("div", lt, [
968
+ s("div", { class: m(["fw-medium text-truncate", e?.estActif ? "" : "text-muted"]) }, [l(C(f.titreOf(e)) + " ", 1), e?.estActif ? a("", !0) : (g(), o("span", ut, C(f.categorieOf(e) === "demandeur" ? "inactive" : "sorti"), 1))], 2),
969
+ s("small", dt, [l(C(f.referenceOf(e)) + " ", 1), e?.adresse ? (g(), o("span", ft, " — " + C(e.adresse), 1)) : a("", !0)]),
970
+ f.detailOf(e) ? (g(), o("small", pt, C(f.detailOf(e)), 1)) : a("", !0)
971
+ ])]),
972
+ _: 1
973
+ }, 8, [
974
+ "modelValue",
975
+ "items",
976
+ "filtering-function",
977
+ "loading",
978
+ "get-id",
979
+ "get-input-libelle",
980
+ "placeholder",
981
+ "onSearch"
982
+ ])),
983
+ d.rechercheFaite && !d.rechercheEnCours && !d.trouves.length ? (g(), o("small", mt, C(f.categorieCourante.aucun), 1)) : a("", !0)
984
+ ]),
985
+ f.selectionne ? (g(), o("div", ht, [u(p, {
986
+ icon: f.iconOf(f.selectionne),
987
+ class: "mt-1"
988
+ }, null, 8, ["icon"]), s("div", gt, [
989
+ s("div", _t, C(f.selectionne.libelle), 1),
990
+ f.selectionne.adresse ? (g(), o("div", vt, C(f.selectionne.adresse), 1)) : a("", !0),
991
+ f.detailOf(f.selectionne) ? (g(), o("div", yt, C(f.detailOf(f.selectionne)), 1)) : a("", !0)
992
+ ])])) : (g(), o("div", bt, "Recherchez puis sélectionnez le réclamant."))
993
+ ])) : a("", !0);
994
+ }
995
+ var St = /*#__PURE__*/ F(it, [["render", xt]]), Ct = {
996
+ name: "ProvenanceSelecteurBlock",
997
+ setup() {
998
+ return { draft: P() };
999
+ },
1000
+ computed: {
1001
+ provenances() {
1002
+ return ce;
1003
+ },
1004
+ selected() {
1005
+ return this.draft.draft.provenance;
1006
+ },
1007
+ provenanceChoisie() {
1008
+ return this.provenances.find((e) => e.id === this.selected) ?? null;
1009
+ }
1010
+ }
1011
+ }, wt = {
1012
+ key: 0,
1013
+ class: "fs-7 text-muted"
1014
+ }, Tt = { class: "fw-medium" }, Et = { key: 1 }, Dt = { class: "d-flex flex-wrap gap-2" }, Ot = ["onClick"], kt = {
1015
+ key: 0,
1016
+ class: "fs-7 text-danger mt-1"
1017
+ };
1018
+ function At(e, t, r, c, d, f) {
1019
+ let p = S("font-awesome-icon");
1020
+ return c.draft.isReadonly("provenance") ? (g(), o("div", wt, [t[0] ||= l(" Provenance du contact : ", -1), s("span", Tt, [f.provenanceChoisie?.icon ? (g(), i(p, {
1021
+ key: 0,
1022
+ icon: f.provenanceChoisie.icon,
1023
+ "fixed-width": ""
1024
+ }, null, 8, ["icon"])) : a("", !0), l(" " + C(f.provenanceChoisie?.libelle ?? "—"), 1)])])) : (g(), o("div", Et, [
1025
+ t[1] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, [l(" Provenance du contact "), s("span", { class: "text-danger" }, "*")], -1),
1026
+ s("div", Dt, [(g(!0), o(n, null, b(f.provenances, (e) => (g(), o("button", {
1027
+ key: e.id,
1028
+ type: "button",
1029
+ class: m(["btn btn-sm d-inline-flex align-items-center gap-2", e.id === f.selected ? "btn-primary" : "btn-outline-primary"]),
1030
+ onClick: (t) => c.draft.setProvenance(e.id)
1031
+ }, [u(p, {
1032
+ icon: e.icon,
1033
+ "fixed-width": ""
1034
+ }, null, 8, ["icon"]), s("span", null, C(e.libelle), 1)], 10, Ot))), 128))]),
1035
+ f.selected ? a("", !0) : (g(), o("div", kt, " Sélectionnez par quel canal la sollicitation vous est parvenue. "))
1036
+ ]));
1037
+ }
1038
+ var jt = /*#__PURE__*/ F(Ct, [["render", At]]), Mt = {
1039
+ name: "EtapeReclamantBlock",
1040
+ components: {
1041
+ ReclamantRechercheBlock: St,
1042
+ ProvenanceSelecteurBlock: jt
1043
+ },
1044
+ props: { premiere: {
1045
+ type: Boolean,
1046
+ default: !1
1047
+ } },
1048
+ setup() {
1049
+ return { draft: P() };
1050
+ }
1051
+ }, Nt = { class: "d-flex flex-column gap-3" }, Pt = { class: "alert alert-light border py-2 px-3 mb-0 fs-7" };
1052
+ function Ft(e, t, n, r, c, d) {
1053
+ let f = S("provenance-selecteur-block"), p = S("font-awesome-icon"), m = S("reclamant-recherche-block");
1054
+ return g(), o("div", Nt, [n.premiere ? (g(), i(f, { key: 0 })) : a("", !0), x(e.$slots, "reclamant", {
1055
+ reclamant: r.draft.reclamantSelectionne,
1056
+ select: r.draft.selectReclamant
1057
+ }, () => [s("div", Pt, [u(p, {
1058
+ icon: "user",
1059
+ class: "text-primary me-2"
1060
+ }), t[0] ||= l(" Pour qui cette sollicitation est-elle créée\xA0? ", -1)]), u(m)])]);
1061
+ }
1062
+ var It = /*#__PURE__*/ F(Mt, [["render", Ft]]), Lt = Symbol("cresol:options"), Rt = (e) => _(Lt, e), Y = () => f(Lt, {});
1063
+ //#endregion
1064
+ //#region src/utils/text.js
1065
+ function X(e, t = !0) {
1066
+ if (!e) return null;
1067
+ let n = e.toString().normalize("NFD").replace(/[̀-ͯ]/g, "");
1068
+ return t ? n.toLowerCase() : n;
1069
+ }
1070
+ //#endregion
1071
+ //#region src/components/ReclamantSelecteurBlock.vue
1072
+ var zt = {
1073
+ name: "ReclamantSelecteurBlock",
1074
+ components: { AmsomAutocomplete: O },
1075
+ props: {
1076
+ mode: {
1077
+ type: String,
1078
+ default: null
1079
+ },
1080
+ inline: {
1081
+ type: Boolean,
1082
+ default: !0
1083
+ }
1084
+ },
1085
+ setup() {
1086
+ return {
1087
+ draft: P(),
1088
+ options: Y()
1089
+ };
1090
+ },
1091
+ computed: {
1092
+ reclamants() {
1093
+ return this.draft.reclamantsDisponibles;
1094
+ },
1095
+ reclamantSelectionne() {
1096
+ return this.draft.reclamantSelectionne;
1097
+ },
1098
+ presentation() {
1099
+ return this.mode ?? this.options.reclamantMode;
1100
+ },
1101
+ estFige() {
1102
+ return this.reclamants.length <= 1 || this.draft.isReadonly("reclamant");
1103
+ }
1104
+ },
1105
+ methods: {
1106
+ reclamantId(e) {
1107
+ let t = this.reclamants.indexOf(e);
1108
+ return t < 0 ? null : t;
1109
+ },
1110
+ select(e) {
1111
+ this.draft.selectReclamant(e);
1112
+ },
1113
+ filterReclamants({ search: e, items: t }) {
1114
+ let n = (X(e) ?? "").trim();
1115
+ return n ? t.filter((e) => (X(e?.libelle) ?? "").includes(n)) : t;
1116
+ }
1117
+ }
1118
+ }, Bt = {
1119
+ key: 0,
1120
+ class: "fs-7 text-muted"
1121
+ }, Vt = { class: "fw-medium" }, Ht = {
1122
+ key: 0,
1123
+ class: "btn-group btn-group-sm",
1124
+ role: "group"
1125
+ }, Ut = ["onClick"], Wt = ["value"], Gt = ["value"];
1126
+ function Kt(e, t, r, a, c, u) {
1127
+ let d = S("amsom-autocomplete");
1128
+ return u.estFige ? (g(), o("div", Bt, [t[2] ||= l(" Réclamant : ", -1), s("span", Vt, C(u.reclamantSelectionne?.libelle), 1)])) : (g(), o("div", {
1129
+ key: 1,
1130
+ class: m(r.inline ? "d-flex align-items-center justify-content-between gap-2 border-bottom pb-2" : "d-flex flex-column gap-1")
1131
+ }, [t[3] ||= s("span", { class: "fs-7 fw-semibold text-muted text-uppercase" }, "Réclamant", -1), u.presentation === "switch" ? (g(), o("div", Ht, [(g(!0), o(n, null, b(u.reclamants, (e, t) => (g(), o("button", {
1132
+ key: t,
1133
+ type: "button",
1134
+ class: m(["btn btn-sm py-0", e === u.reclamantSelectionne ? "btn-primary" : "btn-outline-primary"]),
1135
+ onClick: (t) => u.select(e)
1136
+ }, C(e.libelle), 11, Ut))), 128))])) : u.presentation === "autocomplete" ? (g(), i(d, {
1137
+ key: 1,
1138
+ "model-value": u.reclamantSelectionne,
1139
+ items: u.reclamants,
1140
+ "get-id": u.reclamantId,
1141
+ "get-input-libelle": (e) => e?.libelle ?? "",
1142
+ "filtering-function": u.filterReclamants,
1143
+ placeholder: "Rechercher un réclamant…",
1144
+ "input-size": "sm",
1145
+ "hide-choices": "",
1146
+ class: m(r.inline ? "" : "w-100"),
1147
+ "onUpdate:modelValue": t[0] ||= (e) => u.select(e)
1148
+ }, null, 8, [
1149
+ "model-value",
1150
+ "items",
1151
+ "get-id",
1152
+ "get-input-libelle",
1153
+ "filtering-function",
1154
+ "class"
1155
+ ])) : (g(), o("select", {
1156
+ key: 2,
1157
+ class: m(["form-select form-select-sm", r.inline ? "w-auto" : ""]),
1158
+ value: u.reclamants.indexOf(u.reclamantSelectionne),
1159
+ onChange: t[1] ||= (e) => u.select(u.reclamants[e.target.value])
1160
+ }, [(g(!0), o(n, null, b(u.reclamants, (e, t) => (g(), o("option", {
1161
+ key: t,
1162
+ value: t
1163
+ }, C(e.libelle), 9, Gt))), 128))], 42, Wt))], 2));
1164
+ }
1165
+ //#endregion
899
1166
  //#region src/components/EtapeCategorieBlock.vue
900
- var Tt = {
1167
+ var qt = {
901
1168
  name: "EtapeCategorieBlock",
902
1169
  components: {
903
1170
  AmsomOverlay: t,
904
- AmsomAutocomplete: k,
905
- ReclamantSelecteurBlock: V,
906
- ProvenanceSelecteurBlock: Ue
1171
+ AmsomAutocomplete: O,
1172
+ ReclamantSelecteurBlock: /* @__PURE__ */ F(zt, [["render", Kt]]),
1173
+ ProvenanceSelecteurBlock: jt
907
1174
  },
908
1175
  props: { premiere: {
909
1176
  type: Boolean,
@@ -911,9 +1178,9 @@ var Tt = {
911
1178
  } },
912
1179
  setup() {
913
1180
  return {
914
- draft: I(),
915
- data: X(),
916
- options: z()
1181
+ draft: P(),
1182
+ data: K(),
1183
+ options: Y()
917
1184
  };
918
1185
  },
919
1186
  data() {
@@ -1030,7 +1297,7 @@ var Tt = {
1030
1297
  });
1031
1298
  },
1032
1299
  registerIcons() {
1033
- return wt([
1300
+ return nt([
1034
1301
  ...this.data.cache.categories ?? [],
1035
1302
  ...this.data.cache.types ?? [],
1036
1303
  ...this.data.cache.natures ?? [],
@@ -1038,11 +1305,11 @@ var Tt = {
1038
1305
  ].map((e) => e.icon));
1039
1306
  },
1040
1307
  filterMotifs({ search: e, items: t }) {
1041
- let n = (B(e) ?? "").trim();
1308
+ let n = (X(e) ?? "").trim();
1042
1309
  if (!n) return t;
1043
1310
  let r = n.split(/\s+/);
1044
1311
  return t.filter((e) => {
1045
- let t = B(`${e.libelle} ${e.categorie} ${e.type} ${e.nature}`) ?? "";
1312
+ let t = X(`${e.libelle} ${e.categorie} ${e.type} ${e.nature}`) ?? "";
1046
1313
  return r.every((e) => t.includes(e));
1047
1314
  });
1048
1315
  },
@@ -1065,40 +1332,40 @@ var Tt = {
1065
1332
  return this.activeMotifs.find((t) => t.id === e)?.libelle ?? e;
1066
1333
  }
1067
1334
  }
1068
- }, Et = {
1335
+ }, Jt = {
1069
1336
  key: 0,
1070
1337
  class: "d-flex flex-column gap-3"
1071
- }, Dt = { key: 2 }, Ot = { class: "d-flex flex-wrap align-items-center gap-2" }, kt = { class: "badge rounded-pill bg-primary d-inline-flex align-items-center gap-2" }, At = { key: 3 }, jt = { class: "d-flex align-items-center gap-2" }, Mt = { class: "min-w-0" }, Nt = { class: "fw-medium text-truncate" }, Pt = { class: "text-muted d-block text-truncate" }, Ft = {
1338
+ }, Yt = { key: 2 }, Xt = { class: "d-flex flex-wrap align-items-center gap-2" }, Zt = { class: "badge rounded-pill bg-primary d-inline-flex align-items-center gap-2" }, Qt = { key: 3 }, $t = { class: "d-flex align-items-center gap-2" }, en = { class: "min-w-0" }, tn = { class: "fw-medium text-truncate" }, nn = { class: "text-muted d-block text-truncate" }, rn = {
1072
1339
  key: 4,
1073
1340
  class: "d-flex align-items-center gap-2 text-muted fs-7"
1074
- }, It = {
1341
+ }, an = {
1075
1342
  key: 5,
1076
1343
  class: "d-flex flex-wrap align-items-center gap-2"
1077
- }, Lt = ["onClick"], Rt = { key: 6 }, zt = { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-2" }, Bt = { class: "row justify-content-around g-3" }, Vt = ["title", "onClick"], Ht = { class: "fs-7 mt-1 lh-sm" }, Ut = {
1344
+ }, on = ["onClick"], sn = { key: 6 }, cn = { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-2" }, ln = { class: "row justify-content-around g-3" }, un = ["title", "onClick"], dn = { class: "fs-7 mt-1 lh-sm" }, fn = {
1078
1345
  key: 0,
1079
1346
  class: "col-12 text-muted fs-7"
1080
- }, Wt = [
1347
+ }, pn = [
1081
1348
  "id",
1082
1349
  "checked",
1083
1350
  "disabled",
1084
1351
  "onChange"
1085
- ], Gt = ["for"];
1086
- function Kt(e, t, r, c, d, f) {
1087
- let p = S("reclamant-selecteur-block"), m = S("provenance-selecteur-block"), h = S("font-awesome-icon"), _ = S("amsom-autocomplete"), v = S("amsom-overlay");
1352
+ ], mn = ["for"];
1353
+ function hn(e, t, r, c, d, f) {
1354
+ let p = S("provenance-selecteur-block"), m = S("reclamant-selecteur-block"), h = S("font-awesome-icon"), _ = S("amsom-autocomplete"), v = S("amsom-overlay");
1088
1355
  return g(), i(v, { loading: c.data.isLoading && !c.data.cache.motifs || !d.iconsReady }, {
1089
- default: D(() => [d.iconsReady ? (g(), o("div", Et, [
1090
- c.options.reclamantMode === "step" ? a("", !0) : (g(), i(p, { key: 0 })),
1091
- r.premiere ? (g(), i(m, { key: 1 })) : a("", !0),
1092
- f.motifFige && f.selectionChain.length ? (g(), o("div", Dt, [t[1] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, "Motif", -1), s("div", Ot, [(g(!0), o(n, null, b(f.selectionChain, (e, t) => (g(), o(n, { key: e.level }, [t > 0 ? (g(), i(h, {
1356
+ default: E(() => [d.iconsReady ? (g(), o("div", Jt, [
1357
+ r.premiere ? (g(), i(p, { key: 0 })) : a("", !0),
1358
+ c.options.reclamantMode === "step" ? a("", !0) : (g(), i(m, { key: 1 })),
1359
+ f.motifFige && f.selectionChain.length ? (g(), o("div", Yt, [t[1] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, "Motif", -1), s("div", Xt, [(g(!0), o(n, null, b(f.selectionChain, (e, t) => (g(), o(n, { key: e.level }, [t > 0 ? (g(), i(h, {
1093
1360
  key: 0,
1094
1361
  icon: "fa-solid fa-chevron-right",
1095
1362
  class: "text-muted fs-7"
1096
- })) : a("", !0), s("span", kt, [e.icon ? (g(), i(h, {
1363
+ })) : a("", !0), s("span", Zt, [e.icon ? (g(), i(h, {
1097
1364
  key: 0,
1098
1365
  icon: e.icon,
1099
1366
  "fixed-width": ""
1100
1367
  }, null, 8, ["icon"])) : a("", !0), l(" " + C(e.libelle), 1)])], 64))), 128))])])) : a("", !0),
1101
- f.motifFige ? a("", !0) : (g(), o("div", At, [t[2] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, " Rechercher un motif ", -1), u(_, {
1368
+ f.motifFige ? a("", !0) : (g(), o("div", Qt, [t[2] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, " Rechercher un motif ", -1), u(_, {
1102
1369
  modelValue: f.motifRecherche,
1103
1370
  "onUpdate:modelValue": t[0] ||= (e) => f.motifRecherche = e,
1104
1371
  items: f.allowedMotifs,
@@ -1110,12 +1377,12 @@ function Kt(e, t, r, c, d, f) {
1110
1377
  "input-size": "sm",
1111
1378
  "hide-choices": ""
1112
1379
  }, {
1113
- options: D((e) => [s("div", jt, [e?.icon ? (g(), i(h, {
1380
+ options: E((e) => [s("div", $t, [e?.icon ? (g(), i(h, {
1114
1381
  key: 0,
1115
1382
  icon: e.icon,
1116
1383
  class: "text-primary",
1117
1384
  "fixed-width": ""
1118
- }, null, 8, ["icon"])) : a("", !0), s("div", Mt, [s("div", Nt, C(e?.libelle), 1), s("small", Pt, C(e?.categorie) + " › " + C(e?.type) + " › " + C(e?.nature), 1)])])]),
1385
+ }, null, 8, ["icon"])) : a("", !0), s("div", en, [s("div", tn, C(e?.libelle), 1), s("small", nn, C(e?.categorie) + " › " + C(e?.type) + " › " + C(e?.nature), 1)])])]),
1119
1386
  _: 1
1120
1387
  }, 8, [
1121
1388
  "modelValue",
@@ -1125,12 +1392,12 @@ function Kt(e, t, r, c, d, f) {
1125
1392
  "get-input-libelle-from-id",
1126
1393
  "filtering-function"
1127
1394
  ])])),
1128
- f.motifFige ? a("", !0) : (g(), o("div", Ft, [...t[3] ||= [
1395
+ f.motifFige ? a("", !0) : (g(), o("div", rn, [...t[3] ||= [
1129
1396
  s("hr", { class: "flex-grow-1 my-0" }, null, -1),
1130
1397
  s("span", null, "ou sélection guidée", -1),
1131
1398
  s("hr", { class: "flex-grow-1 my-0" }, null, -1)
1132
1399
  ]])),
1133
- !f.motifFige && f.selectionChain.length ? (g(), o("div", It, [(g(!0), o(n, null, b(f.selectionChain, (e, t) => (g(), o(n, { key: e.level }, [t > 0 ? (g(), i(h, {
1400
+ !f.motifFige && f.selectionChain.length ? (g(), o("div", an, [(g(!0), o(n, null, b(f.selectionChain, (e, t) => (g(), o(n, { key: e.level }, [t > 0 ? (g(), i(h, {
1134
1401
  key: 0,
1135
1402
  icon: "fa-solid fa-chevron-right",
1136
1403
  class: "text-muted fs-7"
@@ -1149,8 +1416,8 @@ function Kt(e, t, r, c, d, f) {
1149
1416
  icon: "fa-solid fa-xmark",
1150
1417
  class: "fs-7 opacity-75"
1151
1418
  })
1152
- ], 8, Lt)], 64))), 128))])) : a("", !0),
1153
- !f.motifFige && f.currentLevel ? (g(), o("div", Rt, [s("label", zt, C(f.currentLevel.title), 1), s("div", Bt, [(g(!0), o(n, null, b(f.currentLevel.options, (e) => (g(), o("div", {
1419
+ ], 8, on)], 64))), 128))])) : a("", !0),
1420
+ !f.motifFige && f.currentLevel ? (g(), o("div", sn, [s("label", cn, C(f.currentLevel.title), 1), s("div", ln, [(g(!0), o(n, null, b(f.currentLevel.options, (e) => (g(), o("div", {
1154
1421
  key: e.id,
1155
1422
  class: "col-3 text-center"
1156
1423
  }, [s("button", {
@@ -1162,7 +1429,7 @@ function Kt(e, t, r, c, d, f) {
1162
1429
  key: 0,
1163
1430
  icon: e.icon,
1164
1431
  size: "lg"
1165
- }, null, 8, ["icon"])) : a("", !0)], 8, Vt), s("div", Ht, C(e.libelle), 1)]))), 128)), f.currentLevel.options.length ? a("", !0) : (g(), o("div", Ut, " Aucun choix disponible "))])])) : a("", !0),
1432
+ }, null, 8, ["icon"])) : a("", !0)], 8, un), s("div", dn, C(e.libelle), 1)]))), 128)), f.currentLevel.options.length ? a("", !0) : (g(), o("div", fn, " Aucun choix disponible "))])])) : a("", !0),
1166
1433
  f.motifsAssocies.length ? (g(), o(n, { key: 7 }, [t[4] ||= s("div", { class: "d-flex align-items-center gap-2 text-muted fs-7" }, [
1167
1434
  s("hr", { class: "flex-grow-1 my-0" }),
1168
1435
  s("span", null, "Autres motifs liés"),
@@ -1177,15 +1444,15 @@ function Kt(e, t, r, c, d, f) {
1177
1444
  checked: f.isActive(e.idMotif),
1178
1445
  disabled: f.motifFige,
1179
1446
  onChange: (t) => f.toggleMotifAssocie(e)
1180
- }, null, 40, Wt), s("label", {
1447
+ }, null, 40, pn), s("label", {
1181
1448
  class: "form-check-label fs-7",
1182
1449
  for: `assoc-${e.idMotif}`
1183
- }, C(e.libelle) + " ? ", 9, Gt)]))), 128))], 64)) : a("", !0)
1450
+ }, C(e.libelle) + " ? ", 9, mn)]))), 128))], 64)) : a("", !0)
1184
1451
  ])) : a("", !0)]),
1185
1452
  _: 1
1186
1453
  }, 8, ["loading"]);
1187
1454
  }
1188
- var qt = /*#__PURE__*/ L(Tt, [["render", Kt]]), Jt = {
1455
+ var gn = /*#__PURE__*/ F(qt, [["render", hn]]), _n = {
1189
1456
  B: "briefcase",
1190
1457
  M: "store",
1191
1458
  W: "dungeon",
@@ -1195,21 +1462,21 @@ var qt = /*#__PURE__*/ L(Tt, [["render", Kt]]), Jt = {
1195
1462
  S: "square-parking",
1196
1463
  V: "hands-holding"
1197
1464
  };
1198
- function Yt(e, t = !1, n = "circle-question") {
1199
- return e === "L" ? t ? "building" : "house" : Jt[e] ?? n;
1465
+ function vn(e, t = !1, n = "circle-question") {
1466
+ return e === "L" ? t ? "building" : "house" : _n[e] ?? n;
1200
1467
  }
1201
- function Xt(e) {
1468
+ function yn(e) {
1202
1469
  return e ? e.idCategorieModule === "L" ? e.estCollectif ? "Appartement" : "Maison" : e.categorieModule ?? "" : "";
1203
1470
  }
1204
1471
  //#endregion
1205
1472
  //#region src/components/CiblePickerBlock.vue
1206
- var Zt = 0, Qt = {
1473
+ var bn = 0, xn = {
1207
1474
  name: "CiblePickerBlock",
1208
- components: { AmsomAutocomplete: k },
1475
+ components: { AmsomAutocomplete: O },
1209
1476
  props: {
1210
1477
  patrimoine: {
1211
1478
  type: Object,
1212
- required: !0
1479
+ default: null
1213
1480
  },
1214
1481
  cibleMode: {
1215
1482
  type: String,
@@ -1251,11 +1518,11 @@ var Zt = 0, Qt = {
1251
1518
  "toggle-reprendre-locataire-actuel"
1252
1519
  ],
1253
1520
  setup() {
1254
- return { data: X() };
1521
+ return { data: K() };
1255
1522
  },
1256
1523
  data() {
1257
1524
  return {
1258
- uid: ++Zt,
1525
+ uid: ++bn,
1259
1526
  rechercheContrat: "",
1260
1527
  contratsTrouves: [],
1261
1528
  rechercheEnCours: !1,
@@ -1288,22 +1555,22 @@ var Zt = 0, Qt = {
1288
1555
  return this.contratReclamant ? this.reclamantModules : this.contratCible ? this.data.modulesOfContrat(this.contratCible) ?? [] : [];
1289
1556
  },
1290
1557
  areModulesLocked() {
1291
- return this.cibleMode === "contrat" ? this.contratModules.length <= 1 : !this.patrimoine.idEntree;
1558
+ return this.cibleMode === "contrat" ? this.contratModules.length <= 1 : !this.patrimoine?.idEntree;
1292
1559
  },
1293
1560
  adresses() {
1294
- let e = this.patrimoine.idCommune;
1561
+ let e = this.patrimoine?.idCommune;
1295
1562
  return e == null ? [] : this.data.adressesOfCommune(e) ?? [];
1296
1563
  },
1297
1564
  programmeModules() {
1298
- let e = this.patrimoine.codeProgramme;
1565
+ let e = this.patrimoine?.codeProgramme;
1299
1566
  return e == null ? [] : this.data.modulesOfProgramme(e) ?? [];
1300
1567
  },
1301
1568
  adresseModules() {
1302
- let e = this.patrimoine.idEntree;
1569
+ let e = this.patrimoine?.idEntree;
1303
1570
  return e == null ? [] : this.programmeModules.filter((t) => t.idEntree === e);
1304
1571
  },
1305
1572
  autresModules() {
1306
- let e = this.patrimoine.idEntree, t = Object.fromEntries(this.data.allAdresses().map((e) => [e.idEntree, e]));
1573
+ let e = this.patrimoine?.idEntree, t = Object.fromEntries(this.data.allAdresses().map((e) => [e.idEntree, e]));
1307
1574
  return this.programmeModules.map((n) => {
1308
1575
  let r = t[n.idEntree]?.entree ?? `Adresse ${n.idEntree}`;
1309
1576
  return {
@@ -1314,7 +1581,7 @@ var Zt = 0, Qt = {
1314
1581
  },
1315
1582
  modules() {
1316
1583
  if (this.cibleMode === "contrat") return this.contratModules.slice().sort((e, t) => e.estModulePrincipal && !t.estModulePrincipal ? -1 : !e.estModulePrincipal && t.estModulePrincipal ? 1 : t.dateDebut - e.dateDebut);
1317
- let e = this.patrimoine.etage, t = e == null ? this.adresseModules : this.adresseModules.filter((t) => String(t.etage) === String(e)), n = new Set(t.map((e) => e.idModule));
1584
+ let e = this.patrimoine?.etage, t = e == null ? this.adresseModules : this.adresseModules.filter((t) => String(t.etage) === String(e)), n = new Set(t.map((e) => e.idModule));
1318
1585
  return [...t, ...this.autresModules.filter((e) => !n.has(e.idModule))];
1319
1586
  },
1320
1587
  etages() {
@@ -1337,7 +1604,7 @@ var Zt = 0, Qt = {
1337
1604
  },
1338
1605
  selectedCommune: {
1339
1606
  get() {
1340
- let e = this.patrimoine.idCommune;
1607
+ let e = this.patrimoine?.idCommune;
1341
1608
  return e == null ? null : (this.data.cache.communes || []).find((t) => t.idCommune === e) ?? null;
1342
1609
  },
1343
1610
  set(e) {
@@ -1346,7 +1613,7 @@ var Zt = 0, Qt = {
1346
1613
  },
1347
1614
  selectedAdresse: {
1348
1615
  get() {
1349
- let e = this.patrimoine.idEntree;
1616
+ let e = this.patrimoine?.idEntree;
1350
1617
  return e == null ? null : this.adresses.find((t) => t.idEntree === e) ?? null;
1351
1618
  },
1352
1619
  set(e) {
@@ -1355,7 +1622,7 @@ var Zt = 0, Qt = {
1355
1622
  },
1356
1623
  selectedEtage: {
1357
1624
  get() {
1358
- let e = this.patrimoine.etage;
1625
+ let e = this.patrimoine?.etage;
1359
1626
  return e == null ? null : this.etages.find((t) => t.id === e) ?? null;
1360
1627
  },
1361
1628
  set(e) {
@@ -1364,7 +1631,7 @@ var Zt = 0, Qt = {
1364
1631
  },
1365
1632
  selectedModule: {
1366
1633
  get() {
1367
- let e = this.patrimoine.idModule;
1634
+ let e = this.patrimoine?.idModule;
1368
1635
  return e == null ? null : this.modules.find((t) => t.idModule === e) ?? null;
1369
1636
  },
1370
1637
  set(e) {
@@ -1376,7 +1643,7 @@ var Zt = 0, Qt = {
1376
1643
  modules: {
1377
1644
  immediate: !0,
1378
1645
  handler(e) {
1379
- this.cibleMode === "contrat" && e.length === 1 && this.patrimoine.idModule == null && this.$emit("select-module", e[0]);
1646
+ this.cibleMode === "contrat" && e.length === 1 && this.patrimoine?.idModule == null && this.$emit("select-module", e[0]);
1380
1647
  }
1381
1648
  },
1382
1649
  contratReclamant() {
@@ -1392,31 +1659,27 @@ var Zt = 0, Qt = {
1392
1659
  },
1393
1660
  rechercherContrat(e) {
1394
1661
  let t = (e ?? "").trim();
1395
- if (t.length < 2) {
1396
- this.contratsTrouves = [], this.rechercheEnCours = !1;
1397
- return;
1398
- }
1399
- this.controller?.abort(), this.controller = new AbortController(), this.rechercheEnCours = !0, this.data.searchContrats(t, { signal: this.controller.signal }).then((e) => {
1662
+ t.length < 2 ? (this.contratsTrouves = [], this.rechercheEnCours = !1) : (this.controller?.abort(), this.controller = new AbortController(), this.rechercheEnCours = !0, this.data.searchContrats(t, { signal: this.controller.signal }).then((e) => {
1400
1663
  this.contratsTrouves = e ?? [], this.rechercheEnCours = !1;
1401
1664
  }).catch(() => {
1402
1665
  this.rechercheEnCours = !1;
1403
- });
1666
+ }));
1404
1667
  },
1405
1668
  contratInputLibelle(e) {
1406
1669
  return e ? [e.libelle, `${e.typeContrat}/${e.idContrat}`].filter(Boolean).join(" — ") : "";
1407
1670
  },
1408
1671
  filterOn(e) {
1409
1672
  return ({ search: t, items: n }) => {
1410
- let r = (B(t) ?? "").trim();
1411
- return r ? n.filter((t) => (B(t?.[e]) ?? "").includes(r)) : n;
1673
+ let r = (X(t) ?? "").trim();
1674
+ return r ? n.filter((t) => (X(t?.[e]) ?? "").includes(r)) : n;
1412
1675
  };
1413
1676
  },
1414
1677
  filterModules({ search: e, items: t }) {
1415
- let n = (B(e) ?? "").trim();
1416
- return n ? t.filter((e) => (B(this.moduleInputLibelle(e)) ?? "").includes(n) || (B(e?._autreLibelle) ?? "").includes(n)) : t;
1678
+ let n = (X(e) ?? "").trim();
1679
+ return n ? t.filter((e) => (X(this.moduleInputLibelle(e)) ?? "").includes(n) || (X(e?._autreLibelle) ?? "").includes(n)) : t;
1417
1680
  },
1418
- getCategorieModuleIcon: Yt,
1419
- categorieLibelle: Xt,
1681
+ getCategorieModuleIcon: vn,
1682
+ categorieLibelle: yn,
1420
1683
  moduleLibelle(e) {
1421
1684
  return e ? e.libelleModule ?? e.adresse ?? `Module ${e.idModule}` : "";
1422
1685
  },
@@ -1428,40 +1691,40 @@ var Zt = 0, Qt = {
1428
1691
  return !!e?.dateFin && e.dateFin < Math.floor(Date.now() / 1e3);
1429
1692
  }
1430
1693
  }
1431
- }, $t = { class: "d-flex flex-column gap-3" }, en = {
1694
+ }, Sn = { class: "d-flex flex-column gap-3" }, Cn = {
1432
1695
  class: "btn-group w-100",
1433
1696
  role: "group"
1434
- }, tn = ["onClick"], nn = { class: "text-muted d-block mt-1" }, rn = {
1697
+ }, wn = ["onClick"], Tn = { class: "text-muted d-block mt-1" }, En = {
1435
1698
  key: 0,
1436
1699
  class: "form-check"
1437
- }, an = ["id", "checked"], on = ["for"], sn = { key: 1 }, cn = { class: "min-w-0" }, ln = { class: "fw-medium text-truncate text-capitalize" }, un = { class: "text-muted d-block text-truncate" }, dn = { key: 0 }, fn = {
1700
+ }, Dn = ["id", "checked"], On = ["for"], kn = { key: 1 }, An = { class: "min-w-0" }, jn = { class: "fw-medium text-truncate text-capitalize" }, Mn = { class: "text-muted d-block text-truncate" }, Nn = { key: 0 }, Pn = {
1438
1701
  key: 1,
1439
1702
  class: "text-warning"
1440
- }, pn = { class: "min-w-0" }, mn = { class: "fw-medium text-truncate" }, hn = { class: "text-muted d-block text-truncate" }, gn = {
1703
+ }, Fn = { class: "min-w-0" }, In = { class: "fw-medium text-truncate" }, Ln = { class: "text-muted d-block text-truncate" }, Rn = {
1441
1704
  key: 2,
1442
1705
  class: "row g-2"
1443
- }, _n = { class: "col-12 col-md-5" }, vn = ["value"], yn = { class: "col-12 col-md-5" }, bn = ["value"], xn = { class: "col-12 col-md-2" }, Sn = ["value"], Cn = { key: 3 }, wn = { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, Tn = {
1706
+ }, zn = { class: "col-12 col-md-5" }, Bn = ["value"], Vn = { class: "col-12 col-md-5" }, Hn = ["value"], Un = { class: "col-12 col-md-2" }, Wn = ["value"], Gn = { key: 3 }, Kn = { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, qn = {
1444
1707
  key: 0,
1445
1708
  class: "text-lowercase fw-normal"
1446
- }, En = { class: "d-flex flex-wrap align-items-center gap-1" }, Dn = ["title"], On = { class: "text-muted" }, kn = {
1709
+ }, Jn = { class: "d-flex flex-wrap align-items-center gap-1" }, Yn = ["title"], Xn = { class: "text-muted" }, Zn = {
1447
1710
  key: 1,
1448
1711
  class: "d-block text-truncate"
1449
- }, An = {
1712
+ }, Qn = {
1450
1713
  key: 2,
1451
1714
  class: "text-muted d-block"
1452
- }, jn = {
1715
+ }, $n = {
1453
1716
  key: 0,
1454
1717
  class: "text-muted d-block"
1455
- }, Mn = {
1718
+ }, er = {
1456
1719
  key: 1,
1457
1720
  class: "mt-2 d-flex flex-column gap-2"
1458
- }, Nn = { class: "form-check mb-0 ms-3" }, Pn = ["id", "checked"], Fn = ["for"];
1459
- function In(e, t, r, c, d, f) {
1721
+ }, tr = { class: "form-check mb-0 ms-3" }, nr = ["id", "checked"], rr = ["for"];
1722
+ function ir(e, t, r, c, d, f) {
1460
1723
  let p = S("font-awesome-icon"), h = S("amsom-autocomplete");
1461
- return g(), o("div", $t, [
1724
+ return g(), o("div", Sn, [
1462
1725
  s("div", null, [
1463
1726
  t[7] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, " La sollicitation concerne… ", -1),
1464
- s("div", en, [(g(!0), o(n, null, b(f.availableModes, (t) => (g(), o("button", {
1727
+ s("div", Cn, [(g(!0), o(n, null, b(f.availableModes, (t) => (g(), o("button", {
1465
1728
  key: t.key,
1466
1729
  type: "button",
1467
1730
  class: m(["btn btn-sm", r.cibleMode === t.key ? "btn-primary" : "btn-outline-primary"]),
@@ -1469,19 +1732,19 @@ function In(e, t, r, c, d, f) {
1469
1732
  }, [u(p, {
1470
1733
  icon: t.icon,
1471
1734
  class: "me-1"
1472
- }, null, 8, ["icon"]), l(" " + C(t.label), 1)], 10, tn))), 128))]),
1473
- s("small", nn, C(f.currentMode?.aide), 1)
1735
+ }, null, 8, ["icon"]), l(" " + C(t.label), 1)], 10, wn))), 128))]),
1736
+ s("small", Tn, C(f.currentMode?.aide), 1)
1474
1737
  ]),
1475
- r.cibleMode === "contrat" ? (g(), o(n, { key: 0 }, [r.afficheCaseContratReclamant ? (g(), o("div", rn, [s("input", {
1738
+ r.cibleMode === "contrat" ? (g(), o(n, { key: 0 }, [r.afficheCaseContratReclamant ? (g(), o("div", En, [s("input", {
1476
1739
  id: `contrat-reclamant-${d.uid}`,
1477
1740
  class: "form-check-input",
1478
1741
  type: "checkbox",
1479
1742
  checked: r.contratReclamant,
1480
1743
  onChange: t[0] ||= (t) => e.$emit("toggle-contrat-reclamant", t.target.checked)
1481
- }, null, 40, an), s("label", {
1744
+ }, null, 40, Dn), s("label", {
1482
1745
  class: "form-check-label fs-7",
1483
1746
  for: `contrat-reclamant-${d.uid}`
1484
- }, " Contrat du réclamant ", 8, on)])) : a("", !0), r.contratReclamant ? a("", !0) : (g(), o("div", sn, [t[8] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, " Contrat ciblé ", -1), u(h, {
1747
+ }, " Contrat du réclamant ", 8, On)])) : a("", !0), r.contratReclamant ? a("", !0) : (g(), o("div", kn, [t[8] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, " Contrat ciblé ", -1), u(h, {
1485
1748
  modelValue: f.selectedContrat,
1486
1749
  "onUpdate:modelValue": t[1] ||= (e) => f.selectedContrat = e,
1487
1750
  items: d.contratsTrouves,
@@ -1489,16 +1752,16 @@ function In(e, t, r, c, d, f) {
1489
1752
  loading: d.rechercheEnCours,
1490
1753
  "get-id": (e) => e ? `${e.typeContrat}|${e.idContrat}` : null,
1491
1754
  "get-input-libelle": f.contratInputLibelle,
1492
- placeholder: "Numéro de contrat ou nom du locataire…",
1755
+ placeholder: "N° de contrat, locataire, module ou adresse…",
1493
1756
  "input-size": "sm",
1494
1757
  "hide-choices": "",
1495
1758
  "debounce-delay": 0,
1496
1759
  onSearch: f.rechercherPlusTard
1497
1760
  }, {
1498
- options: D((e) => [s("div", cn, [s("div", ln, C(e?.libelle ?? `Contrat ${e?.idContrat}`), 1), s("small", un, [
1761
+ options: E((e) => [s("div", An, [s("div", jn, C(e?.libelle ?? `Contrat ${e?.idContrat}`), 1), s("small", Mn, [
1499
1762
  l(C(e?.typeContrat) + "/" + C(e?.idContrat) + " ", 1),
1500
- e?.nbModules > 1 ? (g(), o("span", dn, " — " + C(e.nbModules) + " modules", 1)) : a("", !0),
1501
- e?.dateSortie ? (g(), o("span", fn, " — sorti")) : a("", !0)
1763
+ e?.nbModules > 1 ? (g(), o("span", Nn, " — " + C(e.nbModules) + " modules", 1)) : a("", !0),
1764
+ e?.estSorti ? (g(), o("span", Pn, " — sorti")) : a("", !0)
1502
1765
  ])])]),
1503
1766
  _: 1
1504
1767
  }, 8, [
@@ -1540,7 +1803,7 @@ function In(e, t, r, c, d, f) {
1540
1803
  "input-size": "sm",
1541
1804
  "hide-choices": ""
1542
1805
  }, {
1543
- options: D((e) => [s("div", pn, [s("div", mn, C(e?.entree), 1), s("small", hn, C(e?.commune) + " — Programme " + C(e?.codeProgramme), 1)])]),
1806
+ options: E((e) => [s("div", Fn, [s("div", In, C(e?.entree), 1), s("small", Ln, C(e?.commune) + " — Programme " + C(e?.codeProgramme), 1)])]),
1544
1807
  _: 1
1545
1808
  }, 8, [
1546
1809
  "modelValue",
@@ -1568,25 +1831,25 @@ function In(e, t, r, c, d, f) {
1568
1831
  "disabled"
1569
1832
  ])])
1570
1833
  ], 64)) : a("", !0),
1571
- r.cibleMode === "contrat" ? (g(), o("div", gn, [
1572
- s("div", _n, [t[12] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, "Commune", -1), s("input", {
1834
+ r.cibleMode === "contrat" ? (g(), o("div", Rn, [
1835
+ s("div", zn, [t[12] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, "Commune", -1), s("input", {
1573
1836
  class: "form-control form-control-sm",
1574
1837
  disabled: "",
1575
1838
  value: r.patrimoine.commune ?? "—"
1576
- }, null, 8, vn)]),
1577
- s("div", yn, [t[13] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, "Adresse", -1), s("input", {
1839
+ }, null, 8, Bn)]),
1840
+ s("div", Vn, [t[13] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, "Adresse", -1), s("input", {
1578
1841
  class: "form-control form-control-sm",
1579
1842
  disabled: "",
1580
1843
  value: r.patrimoine.entree ?? "—"
1581
- }, null, 8, bn)]),
1582
- s("div", xn, [t[14] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, "Étage", -1), s("input", {
1844
+ }, null, 8, Hn)]),
1845
+ s("div", Un, [t[14] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, "Étage", -1), s("input", {
1583
1846
  class: "form-control form-control-sm",
1584
1847
  disabled: "",
1585
1848
  value: r.patrimoine.etage ?? "—"
1586
- }, null, 8, Sn)])
1849
+ }, null, 8, Wn)])
1587
1850
  ])) : a("", !0),
1588
- r.cibleMode === "contrat" || r.cibleMode === "patrimoine" ? (g(), o("div", Cn, [
1589
- s("label", wn, [t[15] ||= l(" Module ", -1), r.cibleMode === "patrimoine" ? (g(), o("span", Tn, "(facultatif)")) : a("", !0)]),
1851
+ r.cibleMode === "contrat" || r.cibleMode === "patrimoine" ? (g(), o("div", Gn, [
1852
+ s("label", Kn, [t[15] ||= l(" Module ", -1), r.cibleMode === "patrimoine" ? (g(), o("span", qn, "(facultatif)")) : a("", !0)]),
1590
1853
  u(h, {
1591
1854
  modelValue: f.selectedModule,
1592
1855
  "onUpdate:modelValue": t[5] ||= (e) => f.selectedModule = e,
@@ -1599,7 +1862,7 @@ function In(e, t, r, c, d, f) {
1599
1862
  "input-size": "sm",
1600
1863
  "hide-choices": ""
1601
1864
  }, {
1602
- options: D((e) => [s("div", { class: m(["min-w-0 w-100 rounded position-relative", e?._autreLibelle ? "bg-yellow-subtle p-2" : ""]) }, [
1865
+ options: E((e) => [s("div", { class: m(["min-w-0 w-100 rounded position-relative", e?._autreLibelle ? "bg-yellow-subtle p-2" : ""]) }, [
1603
1866
  e?._autreLibelle ? (g(), i(p, {
1604
1867
  key: 0,
1605
1868
  icon: "building",
@@ -1607,12 +1870,12 @@ function In(e, t, r, c, d, f) {
1607
1870
  title: "Autre adresse ou étage du même programme"
1608
1871
  })) : a("", !0),
1609
1872
  s("div", { class: m(["fw-medium text-truncate", [e?._autreLibelle ? "text-muted" : "", f.isExit(e) ? "text-decoration-line-through" : ""]]) }, C(f.moduleLibelle(e)), 3),
1610
- s("div", En, [f.categorieLibelle(e) ? (g(), o("span", {
1873
+ s("div", Jn, [f.categorieLibelle(e) ? (g(), o("span", {
1611
1874
  key: 0,
1612
1875
  class: "badge bg-info",
1613
1876
  title: e?.categorieModule
1614
- }, [u(p, { icon: f.getCategorieModuleIcon(e?.idCategorieModule, e?.estCollectif) }, null, 8, ["icon"])], 8, Dn)) : a("", !0), s("small", On, "N° " + C(e?.idModule), 1)]),
1615
- e?._autreLibelle ? (g(), o("small", kn, C(e._autreLibelle), 1)) : e?.etage == null ? a("", !0) : (g(), o("small", An, " Étage " + C(e.etage), 1))
1877
+ }, [u(p, { icon: f.getCategorieModuleIcon(e?.idCategorieModule, e?.estCollectif) }, null, 8, ["icon"])], 8, Yn)) : a("", !0), s("small", Xn, "N° " + C(e?.idModule), 1)]),
1878
+ e?._autreLibelle ? (g(), o("small", Zn, C(e._autreLibelle), 1)) : e?.etage == null ? a("", !0) : (g(), o("small", Qn, " Étage " + C(e.etage), 1))
1616
1879
  ], 2)]),
1617
1880
  _: 1
1618
1881
  }, 8, [
@@ -1623,36 +1886,36 @@ function In(e, t, r, c, d, f) {
1623
1886
  "filtering-function",
1624
1887
  "disabled"
1625
1888
  ]),
1626
- r.cibleMode === "patrimoine" && !r.patrimoine.idModule ? (g(), o("small", jn, " Sans module, la sollicitation cible la partie commune de l’adresse. ")) : a("", !0),
1627
- r.locataireActuelOption ? (g(), o("div", Mn, [s("div", { class: m(["alert d-flex align-items-start gap-2 py-2 px-3 mt-2 mb-0 fs-7", r.locataireActuelOption.reprendre ? "alert-warning" : "alert-secondary border"]) }, [u(p, {
1889
+ r.cibleMode === "patrimoine" && !r.patrimoine.idModule ? (g(), o("small", $n, " Sans module, la sollicitation cible la partie commune de l’adresse. ")) : a("", !0),
1890
+ r.locataireActuelOption ? (g(), o("div", er, [s("div", { class: m(["alert d-flex align-items-start gap-2 py-2 px-3 mt-2 mb-0 fs-7", r.locataireActuelOption.reprendre ? "alert-warning" : "alert-secondary border"]) }, [u(p, {
1628
1891
  icon: "circle-info",
1629
1892
  class: "mt-1"
1630
- }), s("span", null, C(r.locataireActuelOption.hint), 1)], 2), s("div", Nn, [s("input", {
1893
+ }), s("span", null, C(r.locataireActuelOption.hint), 1)], 2), s("div", tr, [s("input", {
1631
1894
  id: `locataire-actuel-${d.uid}`,
1632
1895
  class: "form-check-input",
1633
1896
  type: "checkbox",
1634
1897
  checked: r.locataireActuelOption.reprendre,
1635
1898
  onChange: t[6] ||= (t) => e.$emit("toggle-reprendre-locataire-actuel", t.target.checked)
1636
- }, null, 40, Pn), s("label", {
1899
+ }, null, 40, nr), s("label", {
1637
1900
  class: "form-check-label fs-7",
1638
1901
  for: `locataire-actuel-${d.uid}`
1639
- }, " Rattacher au locataire actuel du module ", 8, Fn)])])) : a("", !0)
1902
+ }, " Rattacher au locataire actuel du module ", 8, rr)])])) : a("", !0)
1640
1903
  ])) : a("", !0)
1641
1904
  ]);
1642
1905
  }
1643
1906
  //#endregion
1644
1907
  //#region src/components/EtapeCibleBlock.vue
1645
- var Ln = {
1908
+ var ar = {
1646
1909
  name: "EtapeCibleBlock",
1647
1910
  components: {
1648
1911
  AmsomOverlay: t,
1649
- CiblePickerBlock: /* @__PURE__ */ L(Qt, [["render", In]])
1912
+ CiblePickerBlock: /* @__PURE__ */ F(xn, [["render", ir]])
1650
1913
  },
1651
1914
  setup() {
1652
1915
  return {
1653
- draft: I(),
1654
- data: X(),
1655
- options: z()
1916
+ draft: P(),
1917
+ data: K(),
1918
+ options: Y()
1656
1919
  };
1657
1920
  },
1658
1921
  computed: {
@@ -1748,39 +2011,35 @@ var Ln = {
1748
2011
  };
1749
2012
  },
1750
2013
  async applyMode(e, t = 0) {
1751
- if (e === "contrat") {
1752
- this.draft.prefillFromModule(t, this.mainModule);
1753
- return;
1754
- }
1755
- this.mainModule && (this.draft.prefillFromModule(t, this.mainModule), this.mainModule.idCommune != null && await this.data.loadAdresses(this.mainModule.idCommune), this.mainModule.codeProgramme != null && await this.data.loadModulesOfProgramme(this.mainModule.codeProgramme));
2014
+ e === "contrat" ? this.draft.prefillFromModule(t, this.mainModule) : this.mainModule && (this.draft.prefillFromModule(t, this.mainModule), this.mainModule.idCommune != null && await this.data.loadAdresses(this.mainModule.idCommune), this.mainModule.codeProgramme != null && await this.data.loadModulesOfProgramme(this.mainModule.codeProgramme));
1756
2015
  }
1757
2016
  }
1758
- }, Rn = { class: "d-flex flex-column gap-3" }, zn = {
2017
+ }, or = { class: "d-flex flex-column gap-3" }, sr = {
1759
2018
  key: 0,
1760
2019
  class: "alert alert-light border py-2 px-3 mb-0 d-flex align-items-center gap-2"
1761
- }, Bn = { class: "fs-7" }, Vn = {
2020
+ }, cr = { class: "fs-7" }, lr = {
1762
2021
  key: 1,
1763
2022
  class: "d-flex flex-column gap-1"
1764
- }, Hn = {
2023
+ }, ur = {
1765
2024
  key: 0,
1766
2025
  class: "text-muted me-1"
1767
- }, Un = { class: "d-flex align-items-center gap-2" }, Wn = { class: "fw-medium fs-7" }, Gn = { class: "form-check form-switch mb-0" }, Kn = [
2026
+ }, dr = { class: "d-flex align-items-center gap-2" }, fr = { class: "fw-medium fs-7" }, pr = { class: "form-check form-switch mb-0" }, mr = [
1768
2027
  "id",
1769
2028
  "checked",
1770
2029
  "onChange"
1771
- ], qn = ["for"], Jn = {
2030
+ ], hr = ["for"], gr = {
1772
2031
  key: 0,
1773
2032
  class: "mt-2"
1774
2033
  };
1775
- function Yn(e, t, r, c, d, f) {
2034
+ function _r(e, t, r, c, d, f) {
1776
2035
  let m = S("font-awesome-icon"), h = S("cible-picker-block"), _ = S("amsom-overlay");
1777
2036
  return g(), i(_, { loading: c.data.isLoading }, {
1778
- default: D(() => [s("div", Rn, [
1779
- f.motifLibelle ? (g(), o("div", zn, [u(m, {
2037
+ default: E(() => [s("div", or, [
2038
+ f.motifLibelle ? (g(), o("div", sr, [u(m, {
1780
2039
  icon: "tag",
1781
2040
  class: "text-primary"
1782
- }), s("span", Bn, [t[8] ||= s("span", { class: "text-muted text-uppercase fw-semibold me-1" }, "Motif", -1), l(C(f.motifLibelle), 1)])])) : a("", !0),
1783
- f.cibleFigee ? (g(), o("div", Vn, [(g(!0), o(n, null, b(c.draft.draft.lignes, (e, t) => (g(), o("span", {
2041
+ }), s("span", cr, [t[8] ||= s("span", { class: "text-muted text-uppercase fw-semibold me-1" }, "Motif", -1), l(C(f.motifLibelle), 1)])])) : a("", !0),
2042
+ f.cibleFigee ? (g(), o("div", lr, [(g(!0), o(n, null, b(c.draft.draft.lignes, (e, t) => (g(), o("span", {
1784
2043
  key: t,
1785
2044
  class: "fs-7"
1786
2045
  }, [
@@ -1788,7 +2047,7 @@ function Yn(e, t, r, c, d, f) {
1788
2047
  icon: "location-dot",
1789
2048
  class: "text-primary me-2"
1790
2049
  }),
1791
- f.lignesAssociees.length ? (g(), o("span", Hn, C(t === 0 ? f.motifLibelle : e.libelle) + " : ", 1)) : a("", !0),
2050
+ f.lignesAssociees.length ? (g(), o("span", ur, C(t === 0 ? f.motifLibelle : e.libelle) + " : ", 1)) : a("", !0),
1792
2051
  l(" " + C(c.draft.cibleResume(e)), 1)
1793
2052
  ]))), 128))])) : (g(), i(h, p({ key: 2 }, f.pickerProps(f.lignePrincipale), {
1794
2053
  onChangeMode: t[0] ||= (e) => f.onChangeMode(e),
@@ -1807,16 +2066,16 @@ function Yn(e, t, r, c, d, f) {
1807
2066
  ], -1), (g(!0), o(n, null, b(f.lignesAssociees, (e, t) => (g(), o("div", {
1808
2067
  key: e.idMotif,
1809
2068
  class: "border rounded p-2"
1810
- }, [s("div", Un, [s("span", Wn, C(e.libelle), 1), s("div", Gn, [s("input", {
2069
+ }, [s("div", dr, [s("span", fr, C(e.libelle), 1), s("div", pr, [s("input", {
1811
2070
  id: `memecible-${e.idMotif}`,
1812
2071
  class: "form-check-input",
1813
2072
  type: "checkbox",
1814
2073
  checked: !e.patrimoine,
1815
2074
  onChange: (e) => c.draft.toggleCibleOverride(t + 1)
1816
- }, null, 40, Kn), s("label", {
2075
+ }, null, 40, mr), s("label", {
1817
2076
  class: "form-check-label fs-7",
1818
2077
  for: `memecible-${e.idMotif}`
1819
- }, " Même cible que la ligne principale ", 8, qn)])]), e.patrimoine ? (g(), o("div", Jn, [u(h, p({ ref_for: !0 }, f.pickerProps(e), {
2078
+ }, " Même cible que la ligne principale ", 8, hr)])]), e.patrimoine ? (g(), o("div", gr, [u(h, p({ ref_for: !0 }, f.pickerProps(e), {
1820
2079
  onChangeMode: (e) => f.onChangeMode(e, t + 1),
1821
2080
  onSelectCommune: (e) => f.onSelectCommune(e, t + 1),
1822
2081
  onSelectAdresse: (e) => f.onSelectAdresse(e, t + 1),
@@ -1839,9 +2098,9 @@ function Yn(e, t, r, c, d, f) {
1839
2098
  _: 1
1840
2099
  }, 8, ["loading"]);
1841
2100
  }
1842
- var Xn = /*#__PURE__*/ L(Ln, [["render", Yn]]), Zn = {
2101
+ var vr = /*#__PURE__*/ F(ar, [["render", _r]]), yr = {
1843
2102
  name: "LigneDocumentBlock",
1844
- components: { AmsomUploadFile: oe },
2103
+ components: { AmsomUploadFile: se },
1845
2104
  props: {
1846
2105
  index: {
1847
2106
  type: Number,
@@ -1858,7 +2117,7 @@ var Xn = /*#__PURE__*/ L(Ln, [["render", Yn]]), Zn = {
1858
2117
  },
1859
2118
  emits: ["update"]
1860
2119
  };
1861
- function Qn(e, t, n, r, i, a) {
2120
+ function br(e, t, n, r, i, a) {
1862
2121
  let c = S("amsom-upload-file");
1863
2122
  return g(), o("div", null, [t[1] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, "Document", -1), u(c, {
1864
2123
  "model-value": n.fichier,
@@ -1874,23 +2133,23 @@ function Qn(e, t, n, r, i, a) {
1874
2133
  "read-only"
1875
2134
  ])]);
1876
2135
  }
1877
- var $n = /*#__PURE__*/ L(Zn, [["render", Qn]]);
2136
+ var xr = /*#__PURE__*/ F(yr, [["render", br]]);
1878
2137
  //#endregion
1879
2138
  //#region src/utils/date.js
1880
- function er(e) {
2139
+ function Sr(e) {
1881
2140
  return e == null ? "" : (/* @__PURE__ */ new Date(e * 1e3)).toISOString().slice(0, 10);
1882
2141
  }
1883
- function tr(e) {
2142
+ function Cr(e) {
1884
2143
  return e ? Math.floor(new Date(e).getTime() / 1e3) : null;
1885
2144
  }
1886
2145
  //#endregion
1887
2146
  //#region src/components/LigneDetailBlock.vue
1888
- var nr = 4e3, rr = {
2147
+ var wr = 4e3, Tr = {
1889
2148
  name: "LigneDetailBlock",
1890
2149
  components: {
1891
- AmsomAutocomplete: k,
1892
- AmsomTextarea: ae,
1893
- LigneDocumentBlock: $n
2150
+ AmsomAutocomplete: O,
2151
+ AmsomTextarea: oe,
2152
+ LigneDocumentBlock: xr
1894
2153
  },
1895
2154
  props: { index: {
1896
2155
  type: Number,
@@ -1898,12 +2157,12 @@ var nr = 4e3, rr = {
1898
2157
  } },
1899
2158
  setup() {
1900
2159
  return {
1901
- draft: I(),
1902
- data: X()
2160
+ draft: P(),
2161
+ data: K()
1903
2162
  };
1904
2163
  },
1905
2164
  computed: {
1906
- descriptionMaxLength: () => nr,
2165
+ descriptionMaxLength: () => wr,
1907
2166
  isPrincipale() {
1908
2167
  return this.index === 0;
1909
2168
  },
@@ -1921,64 +2180,64 @@ var nr = 4e3, rr = {
1921
2180
  }
1922
2181
  },
1923
2182
  methods: {
1924
- timestampToDateInput: er,
1925
- dateInputToTimestamp: tr,
2183
+ timestampToDateInput: Sr,
2184
+ dateInputToTimestamp: Cr,
1926
2185
  responsableLibelle(e) {
1927
2186
  let t = e && typeof e != "object" ? this.collaborateurs.find((t) => String(t.id) === String(e)) : e;
1928
2187
  return t ? `${t.prenom} ${t.nom}` : "";
1929
2188
  },
1930
2189
  filterCollaborateurs({ search: e, items: t }) {
1931
- let n = (B(e) ?? "").trim();
1932
- return n ? t.filter((e) => (B(`${e.prenom} ${e.nom} ${e.service}`) ?? "").includes(n)) : t;
2190
+ let n = (X(e) ?? "").trim();
2191
+ return n ? t.filter((e) => (X(`${e.prenom} ${e.nom} ${e.service}`) ?? "").includes(n)) : t;
1933
2192
  }
1934
2193
  }
1935
- }, ir = { class: "d-flex flex-column gap-2" }, ar = { class: "d-flex align-items-center gap-2 mb-1" }, or = { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-0" }, sr = {
2194
+ }, Er = { class: "d-flex flex-column gap-2" }, Dr = { class: "d-flex align-items-center gap-2 mb-1" }, Or = { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-0" }, kr = {
1936
2195
  key: 0,
1937
2196
  class: "ms-1 text-danger"
1938
- }, cr = {
2197
+ }, Ar = {
1939
2198
  key: 0,
1940
2199
  class: "form-check form-switch mb-0"
1941
- }, lr = [
2200
+ }, jr = [
1942
2201
  "id",
1943
2202
  "checked",
1944
2203
  "disabled"
1945
- ], ur = ["for"], dr = {
2204
+ ], Mr = ["for"], Nr = {
1946
2205
  key: 1,
1947
2206
  class: "text-muted d-block",
1948
2207
  style: { "white-space": "pre-line" }
1949
- }, fr = { class: "row g-3" }, pr = { class: "col-6" }, mr = { class: "d-flex align-items-center gap-2 mb-1" }, hr = {
2208
+ }, Pr = { class: "row g-3" }, Fr = { class: "col-6" }, Ir = { class: "d-flex align-items-center gap-2 mb-1" }, Lr = {
1950
2209
  key: 0,
1951
2210
  class: "form-check form-switch mb-0"
1952
- }, gr = [
2211
+ }, Rr = [
1953
2212
  "id",
1954
2213
  "checked",
1955
2214
  "disabled"
1956
- ], _r = ["for"], vr = ["value"], yr = {
2215
+ ], zr = ["for"], Br = ["value"], Vr = {
1957
2216
  key: 1,
1958
2217
  class: "text-muted d-block"
1959
- }, br = {
2218
+ }, Hr = {
1960
2219
  key: 0,
1961
2220
  class: "text-muted d-block"
1962
- }, xr = { class: "min-w-0" }, Sr = { class: "fw-medium text-truncate" }, Cr = {
2221
+ }, Ur = { class: "min-w-0" }, Wr = { class: "fw-medium text-truncate" }, Gr = {
1963
2222
  key: 0,
1964
2223
  class: "text-muted d-block"
1965
- }, wr = {
2224
+ }, Kr = {
1966
2225
  key: 2,
1967
2226
  class: "text-muted"
1968
- }, Tr = { class: "col-12 col-md-6" };
1969
- function Er(e, t, n, r, c, d) {
2227
+ }, qr = { class: "col-12 col-md-6" };
2228
+ function Jr(e, t, n, r, c, d) {
1970
2229
  let f = S("amsom-textarea"), p = S("amsom-autocomplete"), m = S("ligne-document-block");
1971
- return g(), o("div", ir, [s("div", null, [s("div", ar, [s("label", or, [t[6] ||= l(" Description", -1), d.isPrincipale ? (g(), o("span", sr, "*")) : a("", !0)]), d.isPrincipale ? a("", !0) : (g(), o("div", cr, [s("input", {
2230
+ return g(), o("div", Er, [s("div", null, [s("div", Dr, [s("label", Or, [t[6] ||= l(" Description", -1), d.isPrincipale ? (g(), o("span", kr, "*")) : a("", !0)]), d.isPrincipale ? a("", !0) : (g(), o("div", Ar, [s("input", {
1972
2231
  id: `memedetail-${d.ligne.idMotif}`,
1973
2232
  class: "form-check-input",
1974
2233
  type: "checkbox",
1975
2234
  checked: d.ligne.description == null,
1976
2235
  disabled: r.draft.isReadonly("description"),
1977
2236
  onChange: t[0] ||= (e) => r.draft.toggleDescriptionOverride(n.index)
1978
- }, null, 40, lr), s("label", {
2237
+ }, null, 40, jr), s("label", {
1979
2238
  class: "form-check-label fs-7",
1980
2239
  for: `memedetail-${d.ligne.idMotif}`
1981
- }, " Même description ", 8, ur)]))]), !r.draft.isReadonly("description") && (d.isPrincipale || d.ligne.description != null) ? (g(), i(f, {
2240
+ }, " Même description ", 8, Mr)]))]), !r.draft.isReadonly("description") && (d.isPrincipale || d.ligne.description != null) ? (g(), i(f, {
1982
2241
  key: 0,
1983
2242
  "model-value": d.ligne.description,
1984
2243
  "input-size": "sm",
@@ -1991,25 +2250,25 @@ function Er(e, t, n, r, c, d) {
1991
2250
  "rows",
1992
2251
  "maxlength",
1993
2252
  "placeholder"
1994
- ])) : (g(), o("small", dr, C((d.ligne.description ?? d.lignePrincipale.description) || "—"), 1))]), s("div", fr, [s("div", pr, [s("div", null, [s("div", mr, [t[7] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-0" }, " Date des faits ", -1), d.isPrincipale ? a("", !0) : (g(), o("div", hr, [s("input", {
2253
+ ])) : (g(), o("small", Nr, C((d.ligne.description ?? d.lignePrincipale.description) || "—"), 1))]), s("div", Pr, [s("div", Fr, [s("div", null, [s("div", Ir, [t[7] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-0" }, " Date des faits ", -1), d.isPrincipale ? a("", !0) : (g(), o("div", Lr, [s("input", {
1995
2254
  id: `memedate-${d.ligne.idMotif}`,
1996
2255
  class: "form-check-input",
1997
2256
  type: "checkbox",
1998
2257
  checked: !d.ligne.dateFaitsOverride,
1999
2258
  disabled: r.draft.isReadonly("dateFaits"),
2000
2259
  onChange: t[2] ||= (e) => r.draft.toggleDateFaitsOverride(n.index)
2001
- }, null, 40, gr), s("label", {
2260
+ }, null, 40, Rr), s("label", {
2002
2261
  class: "form-check-label fs-7",
2003
2262
  for: `memedate-${d.ligne.idMotif}`
2004
- }, " Même date ", 8, _r)]))]), !r.draft.isReadonly("dateFaits") && (d.isPrincipale || d.ligne.dateFaitsOverride) ? (g(), o("input", {
2263
+ }, " Même date ", 8, zr)]))]), !r.draft.isReadonly("dateFaits") && (d.isPrincipale || d.ligne.dateFaitsOverride) ? (g(), o("input", {
2005
2264
  key: 0,
2006
2265
  value: d.timestampToDateInput(d.ligne.dateFaits),
2007
2266
  type: "date",
2008
2267
  class: "form-control form-control-sm",
2009
2268
  onInput: t[3] ||= (e) => r.draft.setDateFaits(n.index, d.dateInputToTimestamp(e.target.value))
2010
- }, null, 40, vr)) : (g(), o("small", yr, C(d.timestampToDateInput(d.dateFaits) || "—"), 1))]), s("div", null, [
2269
+ }, null, 40, Br)) : (g(), o("small", Vr, C(d.timestampToDateInput(d.dateFaits) || "—"), 1))]), s("div", null, [
2011
2270
  t[8] ||= s("label", { class: "form-label fs-7 fw-semibold text-muted text-uppercase mb-1" }, " Responsable ", -1),
2012
- r.draft.isReadonly("responsable") ? (g(), o("small", br, C(d.responsableLibelle(d.ligne.responsable) || "Déterminé automatiquement"), 1)) : (g(), i(p, {
2271
+ r.draft.isReadonly("responsable") ? (g(), o("small", Hr, C(d.responsableLibelle(d.ligne.responsable) || "Déterminé automatiquement"), 1)) : (g(), i(p, {
2013
2272
  key: 1,
2014
2273
  "model-value": d.ligne.responsable,
2015
2274
  items: d.collaborateurs,
@@ -2021,7 +2280,7 @@ function Er(e, t, n, r, c, d) {
2021
2280
  "hide-choices": "",
2022
2281
  "onUpdate:modelValue": t[4] ||= (e) => r.draft.setResponsable(n.index, e ?? null)
2023
2282
  }, {
2024
- options: D((e) => [s("div", xr, [s("div", Sr, C(e?.prenom) + " " + C(e?.nom), 1), e?.service ? (g(), o("small", Cr, C(e.service), 1)) : a("", !0)])]),
2283
+ options: E((e) => [s("div", Ur, [s("div", Wr, C(e?.prenom) + " " + C(e?.nom), 1), e?.service ? (g(), o("small", Gr, C(e.service), 1)) : a("", !0)])]),
2025
2284
  _: 1
2026
2285
  }, 8, [
2027
2286
  "model-value",
@@ -2030,8 +2289,8 @@ function Er(e, t, n, r, c, d) {
2030
2289
  "get-input-libelle",
2031
2290
  "filtering-function"
2032
2291
  ])),
2033
- d.isPrincipale && !d.ligne.responsable && !r.draft.isReadonly("responsable") ? (g(), o("small", wr, " Aucun paramétrage trouvé : le responsable sera déterminé automatiquement. ")) : a("", !0)
2034
- ])]), s("div", Tr, [u(m, {
2292
+ d.isPrincipale && !d.ligne.responsable && !r.draft.isReadonly("responsable") ? (g(), o("small", Kr, " Aucun paramétrage trouvé : le responsable sera déterminé automatiquement. ")) : a("", !0)
2293
+ ])]), s("div", qr, [u(m, {
2035
2294
  index: n.index,
2036
2295
  fichier: d.ligne.fichier,
2037
2296
  readonly: r.draft.isReadonly("fichier"),
@@ -2044,16 +2303,16 @@ function Er(e, t, n, r, c, d) {
2044
2303
  }
2045
2304
  //#endregion
2046
2305
  //#region src/components/EtapeDetailsBlock.vue
2047
- var Dr = {
2306
+ var Yr = {
2048
2307
  name: "EtapeDetailsBlock",
2049
2308
  components: {
2050
2309
  AmsomOverlay: t,
2051
- LigneDetailBlock: /* @__PURE__ */ L(rr, [["render", Er]])
2310
+ LigneDetailBlock: /* @__PURE__ */ F(Tr, [["render", Jr]])
2052
2311
  },
2053
2312
  setup() {
2054
2313
  return {
2055
- draft: I(),
2056
- data: X()
2314
+ draft: P(),
2315
+ data: K()
2057
2316
  };
2058
2317
  },
2059
2318
  computed: {
@@ -2104,22 +2363,22 @@ var Dr = {
2104
2363
  }
2105
2364
  }
2106
2365
  }
2107
- }, Or = { class: "d-flex flex-column gap-3" }, kr = { class: "alert alert-light border py-2 px-3 mb-0 d-flex flex-column gap-1" }, Ar = {
2366
+ }, Xr = { class: "d-flex flex-column gap-3" }, Zr = { class: "alert alert-light border py-2 px-3 mb-0 d-flex flex-column gap-1" }, Qr = {
2108
2367
  key: 0,
2109
2368
  class: "fs-7"
2110
- }, jr = { class: "fs-7" }, Mr = { class: "bg-light rounded px-2 py-1 d-flex flex-column gap-1" }, Nr = { class: "fs-7" }, Pr = { class: "fs-7" };
2111
- function Fr(e, t, r, c, d, f) {
2369
+ }, $r = { class: "fs-7" }, ei = { class: "bg-light rounded px-2 py-1 d-flex flex-column gap-1" }, ti = { class: "fs-7" }, ni = { class: "fs-7" };
2370
+ function ri(e, t, r, c, d, f) {
2112
2371
  let p = S("font-awesome-icon"), m = S("ligne-detail-block"), h = S("amsom-overlay");
2113
2372
  return g(), i(h, { loading: c.data.isLoading && !c.data.cache.collaborateurs }, {
2114
- default: D(() => [s("div", Or, [
2115
- s("div", kr, [f.motifLibelle ? (g(), o("span", Ar, [
2373
+ default: E(() => [s("div", Xr, [
2374
+ s("div", Zr, [f.motifLibelle ? (g(), o("span", Qr, [
2116
2375
  u(p, {
2117
2376
  icon: "tag",
2118
2377
  class: "text-primary me-2"
2119
2378
  }),
2120
2379
  t[0] ||= s("span", { class: "text-muted text-uppercase fw-semibold me-1" }, "Motif", -1),
2121
2380
  l(C(f.motifLibelle), 1)
2122
- ])) : a("", !0), s("span", jr, [
2381
+ ])) : a("", !0), s("span", $r, [
2123
2382
  u(p, {
2124
2383
  icon: "location-dot",
2125
2384
  class: "text-primary me-2"
@@ -2135,14 +2394,14 @@ function Fr(e, t, r, c, d, f) {
2135
2394
  ], -1), (g(!0), o(n, null, b(f.lignesAssociees, (e, n) => (g(), o("div", {
2136
2395
  key: e.idMotif,
2137
2396
  class: "border rounded p-2 d-flex flex-column gap-2"
2138
- }, [s("div", Mr, [s("span", Nr, [
2397
+ }, [s("div", ei, [s("span", ti, [
2139
2398
  u(p, {
2140
2399
  icon: "tag",
2141
2400
  class: "text-primary me-2"
2142
2401
  }),
2143
2402
  t[2] ||= s("span", { class: "text-muted text-uppercase fw-semibold me-1" }, "Motif", -1),
2144
2403
  l(" " + C(e.libelle), 1)
2145
- ]), s("span", Pr, [
2404
+ ]), s("span", ni, [
2146
2405
  u(p, {
2147
2406
  icon: "location-dot",
2148
2407
  class: "text-primary me-2"
@@ -2156,15 +2415,15 @@ function Fr(e, t, r, c, d, f) {
2156
2415
  }
2157
2416
  //#endregion
2158
2417
  //#region src/components/StepperBlock.vue
2159
- var Ir = {
2418
+ var ii = {
2160
2419
  name: "StepperBlock",
2161
2420
  components: {
2162
- AmsomHorizontalStepper: ne,
2421
+ AmsomHorizontalStepper: re,
2163
2422
  AmsomOverlay: t,
2164
- EtapeReclamantBlock: Je,
2165
- EtapeCategorieBlock: qt,
2166
- EtapeCibleBlock: Xn,
2167
- EtapeDetailsBlock: /* @__PURE__ */ L(Dr, [["render", Fr]])
2423
+ EtapeReclamantBlock: It,
2424
+ EtapeCategorieBlock: gn,
2425
+ EtapeCibleBlock: vr,
2426
+ EtapeDetailsBlock: /* @__PURE__ */ F(Yr, [["render", ri]])
2168
2427
  },
2169
2428
  props: {
2170
2429
  step: {
@@ -2183,9 +2442,9 @@ var Ir = {
2183
2442
  ],
2184
2443
  setup() {
2185
2444
  return {
2186
- draft: I(),
2187
- data: X(),
2188
- options: z()
2445
+ draft: P(),
2446
+ data: K(),
2447
+ options: Y()
2189
2448
  };
2190
2449
  },
2191
2450
  computed: {
@@ -2276,64 +2535,68 @@ var Ir = {
2276
2535
  }));
2277
2536
  }
2278
2537
  }
2279
- }, Lr = { class: "d-flex flex-column gap-3" }, Rr = {
2538
+ }, ai = { class: "d-flex flex-column gap-3" }, oi = {
2280
2539
  key: 0,
2281
2540
  class: "w-100 fs-6 fw-medium my-3 alert alert-info",
2282
2541
  style: { "white-space": "pre-line" }
2283
- }, zr = { style: { "min-height": "260px" } }, Br = { class: "d-flex justify-content-between" }, Vr = { key: 1 }, Hr = ["disabled"], Ur = ["disabled"];
2284
- function Wr(e, t, n, r, c, d) {
2285
- let f = S("amsom-horizontal-stepper"), p = S("font-awesome-icon"), m = S("etape-reclamant-block"), h = S("etape-categorie-block"), _ = S("etape-cible-block"), v = S("etape-details-block"), y = S("amsom-overlay");
2286
- return g(), i(y, { loading: n.creating }, {
2287
- default: D(() => [s("div", Lr, [
2288
- u(f, {
2289
- steps: d.stepperSteps,
2542
+ }, si = { style: { "min-height": "260px" } }, ci = { class: "d-flex justify-content-between" }, li = { key: 1 }, ui = ["disabled"], di = ["disabled"];
2543
+ function fi(e, t, n, r, f, p) {
2544
+ let m = S("amsom-horizontal-stepper"), _ = S("font-awesome-icon"), v = S("etape-reclamant-block"), y = S("etape-categorie-block"), b = S("etape-cible-block"), ee = S("etape-details-block"), w = S("amsom-overlay");
2545
+ return g(), i(w, { loading: n.creating }, {
2546
+ default: E(() => [s("div", ai, [
2547
+ u(m, {
2548
+ steps: p.stepperSteps,
2290
2549
  size: "md",
2291
- onStepClick: d.onStepClick
2550
+ onStepClick: p.onStepClick
2292
2551
  }, null, 8, ["steps", "onStepClick"]),
2293
- d.aideMotif ? (g(), o("div", Rr, [u(p, {
2552
+ p.aideMotif ? (g(), o("div", oi, [u(_, {
2294
2553
  icon: "circle-info",
2295
2554
  class: "text-info-emphasis me-2"
2296
- }), s("span", null, C(d.aideMotif), 1)])) : a("", !0),
2297
- s("div", zr, [d.currentKey === "reclamant" ? (g(), i(m, {
2555
+ }), s("span", null, C(p.aideMotif), 1)])) : a("", !0),
2556
+ s("div", si, [p.currentKey === "reclamant" ? (g(), i(v, {
2298
2557
  key: 0,
2299
2558
  premiere: n.step === 1
2300
- }, null, 8, ["premiere"])) : d.currentKey === "categorie" ? (g(), i(h, {
2559
+ }, c({ _: 2 }, [e.$slots.reclamant ? {
2560
+ name: "reclamant",
2561
+ fn: E((t) => [x(e.$slots, "reclamant", h(d(t)))]),
2562
+ key: "0"
2563
+ } : void 0]), 1032, ["premiere"])) : p.currentKey === "categorie" ? (g(), i(y, {
2301
2564
  key: 1,
2302
2565
  premiere: n.step === 1
2303
- }, null, 8, ["premiere"])) : d.currentKey === "cible" ? (g(), i(_, { key: 2 })) : d.currentKey === "details" ? (g(), i(v, { key: 3 })) : a("", !0)]),
2304
- s("div", Br, [n.step > 1 ? (g(), o("button", {
2566
+ }, null, 8, ["premiere"])) : p.currentKey === "cible" ? (g(), i(b, { key: 2 })) : p.currentKey === "details" ? (g(), i(ee, { key: 3 })) : a("", !0)]),
2567
+ s("div", ci, [n.step > 1 ? (g(), o("button", {
2305
2568
  key: 0,
2306
2569
  class: "btn btn-sm btn-outline-secondary",
2307
- onClick: t[0] ||= (...e) => d.goPrevious && d.goPrevious(...e)
2308
- }, [u(p, {
2570
+ onClick: t[0] ||= (...e) => p.goPrevious && p.goPrevious(...e)
2571
+ }, [u(_, {
2309
2572
  icon: "chevron-left",
2310
2573
  class: "me-1"
2311
- }), t[3] ||= l(" Précédent ", -1)])) : (g(), o("span", Vr)), n.step < d.steps.length ? (g(), o("button", {
2574
+ }), t[3] ||= l(" Précédent ", -1)])) : (g(), o("span", li)), n.step < p.steps.length ? (g(), o("button", {
2312
2575
  key: 2,
2313
2576
  class: "btn btn-sm btn-primary",
2314
- disabled: !d.canGoNext,
2315
- onClick: t[1] ||= (...e) => d.goNext && d.goNext(...e)
2316
- }, [t[4] ||= l(" Suivant ", -1), u(p, {
2577
+ disabled: !p.canGoNext,
2578
+ onClick: t[1] ||= (...e) => p.goNext && p.goNext(...e)
2579
+ }, [t[4] ||= l(" Suivant ", -1), u(_, {
2317
2580
  icon: "chevron-right",
2318
2581
  class: "ms-1"
2319
- })], 8, Hr)) : (g(), o("button", {
2582
+ })], 8, ui)) : (g(), o("button", {
2320
2583
  key: 3,
2321
2584
  class: "btn btn-sm btn-success",
2322
- disabled: !d.canCreer || n.creating,
2585
+ disabled: !p.canCreer || n.creating,
2323
2586
  onClick: t[2] ||= (t) => e.$emit("submit")
2324
- }, [u(p, {
2587
+ }, [u(_, {
2325
2588
  icon: "check",
2326
2589
  class: "me-1"
2327
- }), t[5] ||= l(" Créer la sollicitation ", -1)], 8, Ur))])
2590
+ }), t[5] ||= l(" Créer la sollicitation ", -1)], 8, di))])
2328
2591
  ])]),
2329
- _: 1
2592
+ _: 3
2330
2593
  }, 8, ["loading"]);
2331
2594
  }
2332
- var Gr = /*#__PURE__*/ L(Ir, [["render", Wr]]), Kr = (e, { signal: t, token: n, baseUrl: r } = {}) => nt("/cally2/creer_sollicitation", e, {
2595
+ var pi = /*#__PURE__*/ F(ii, [["render", fi]]), mi = (e, { signal: t, token: n, baseUrl: r } = {}) => Fe("/v2/cresol/creer_sollicitation", e, {
2333
2596
  signal: t,
2334
2597
  token: n,
2335
2598
  baseUrl: r
2336
- }), qr = ({ idSollicitation: e, pj: t }, { signal: n, token: r, baseUrl: i } = {}) => nt("/cally2/upload_sollicitation_ged", {
2599
+ }), hi = ({ idSollicitation: e, pj: t }, { signal: n, token: r, baseUrl: i } = {}) => Fe("/v2/cresol/upload_sollicitation_ged", {
2337
2600
  idSollicitation: e,
2338
2601
  pj: t
2339
2602
  }, {
@@ -2362,7 +2625,7 @@ var Gr = /*#__PURE__*/ L(Ir, [["render", Wr]]), Kr = (e, { signal: t, token: n,
2362
2625
  readonly: {
2363
2626
  type: [Boolean, Array],
2364
2627
  default: !1,
2365
- validator: (e) => typeof e == "boolean" || e.every((e) => N.includes(e))
2628
+ validator: (e) => typeof e == "boolean" || e.every((e) => M.includes(e))
2366
2629
  },
2367
2630
  modules: {
2368
2631
  type: Array,
@@ -2392,7 +2655,7 @@ var Gr = /*#__PURE__*/ L(Ir, [["render", Wr]]), Kr = (e, { signal: t, token: n,
2392
2655
  type: String,
2393
2656
  default: null
2394
2657
  }
2395
- }, Jr = Object.keys(Z), Q = [
2658
+ }, gi = Object.keys(Z), Q = [
2396
2659
  "update:modelValue",
2397
2660
  "reclamantChange",
2398
2661
  "motifChange",
@@ -2401,11 +2664,11 @@ var Gr = /*#__PURE__*/ L(Ir, [["render", Wr]]), Kr = (e, { signal: t, token: n,
2401
2664
  "created",
2402
2665
  "createError",
2403
2666
  "error"
2404
- ], Yr = {
2667
+ ], _i = {
2405
2668
  name: "CreerSollicitationForm",
2406
2669
  components: {
2407
- AsideBlock: Te,
2408
- StepperBlock: Gr
2670
+ AsideBlock: De,
2671
+ StepperBlock: pi
2409
2672
  },
2410
2673
  props: { ...Z },
2411
2674
  emits: [...Q],
@@ -2413,16 +2676,16 @@ var Gr = /*#__PURE__*/ L(Ir, [["render", Wr]]), Kr = (e, { signal: t, token: n,
2413
2676
  let n = (e) => t("error", e), i = {
2414
2677
  token: w(e, "token"),
2415
2678
  baseUrl: w(e, "baseUrl")
2416
- }, a = St(xt({
2679
+ }, a = et($e({
2417
2680
  onError: n,
2418
2681
  ...i
2419
- })), o = y(null), s = r(() => e.modules ?? o.value ?? []), c = ve(_e({
2420
- reclamants: w(e, "reclamants"),
2682
+ })), o = y(null), s = r(() => o.value ?? e.modules ?? []), c = be(ye({
2683
+ reclamants: r(() => e.reclamantMode === "step" ? [] : e.reclamants),
2421
2684
  modules: s,
2422
2685
  idModulePrefere: w(e, "idModule"),
2423
2686
  readonly: w(e, "readonly")
2424
2687
  }));
2425
- return Ee(v({
2688
+ return Rt(v({
2426
2689
  nomenclatureFilter: w(e, "nomenclatureFilter"),
2427
2690
  reclamantMode: w(e, "reclamantMode"),
2428
2691
  modulesReclamant: s,
@@ -2465,14 +2728,22 @@ var Gr = /*#__PURE__*/ L(Ir, [["render", Wr]]), Kr = (e, { signal: t, token: n,
2465
2728
  }
2466
2729
  } },
2467
2730
  async created() {
2468
- this.draft.reset(this.modelValue), this.draft.syncReclamant(), this.$watch("draft.reclamantSelectionne", (e) => this.$emit("reclamantChange", e)), this.$watch(() => JSON.stringify(this.motifChoisi), () => this.$emit("motifChange", this.motifChoisi)), this.data.loadNomenclature();
2731
+ this.draft.reset(this.modelValue), this.draft.syncReclamant();
2469
2732
  let e = this.draft.reclamantSelectionne;
2470
- !this.modules && this.draft.reclamantEstContrat && (this.modulesCharges = await this.data.loadModulesOfContrat({
2471
- idContrat: e.id,
2472
- typeContrat: e.type
2473
- }), this.draft.prefillCiblePrincipale());
2733
+ this.$watch("draft.reclamantSelectionne", async (t) => {
2734
+ this.$emit("reclamantChange", t), await this.chargerModulesReclamant(t, e) && this.draft.syncReclamant();
2735
+ }), this.$watch(() => JSON.stringify(this.motifChoisi), () => this.$emit("motifChange", this.motifChoisi)), this.data.loadNomenclature(), await this.chargerModulesReclamant(e, e) && this.draft.prefillCiblePrincipale();
2474
2736
  },
2475
2737
  methods: {
2738
+ async chargerModulesReclamant(e, t) {
2739
+ if (this.modules && e === t) return this.modulesCharges = null, !0;
2740
+ if (!this.draft.reclamantEstContrat) return this.modulesCharges = [], !0;
2741
+ let n = await this.data.loadModulesOfContrat({
2742
+ idContrat: e.id,
2743
+ typeContrat: e.type
2744
+ });
2745
+ return e === this.draft.reclamantSelectionne && (this.modulesCharges = n ?? [], !0);
2746
+ },
2476
2747
  async creer() {
2477
2748
  if (!this.creating) {
2478
2749
  this.creating = !0;
@@ -2481,10 +2752,10 @@ var Gr = /*#__PURE__*/ L(Ir, [["render", Wr]]), Kr = (e, { signal: t, token: n,
2481
2752
  if (!await this.autoriserCreation(e)) return;
2482
2753
  let t;
2483
2754
  try {
2484
- t = await Kr(e, this.requestOptions) ?? [];
2755
+ t = await mi(e, this.requestOptions) ?? [];
2485
2756
  } catch (t) {
2486
- if (gt(t)) return;
2487
- let n = G(t);
2757
+ if (B(t)) return;
2758
+ let n = z(t);
2488
2759
  this.$emit("createError", {
2489
2760
  error: t,
2490
2761
  message: n,
@@ -2534,7 +2805,7 @@ var Gr = /*#__PURE__*/ L(Ir, [["render", Wr]]), Kr = (e, { signal: t, token: n,
2534
2805
  message: t
2535
2806
  };
2536
2807
  };
2537
- return a?.id ? qr({
2808
+ return a?.id ? hi({
2538
2809
  idSollicitation: a.id,
2539
2810
  pj: {
2540
2811
  name: n.name,
@@ -2545,24 +2816,24 @@ var Gr = /*#__PURE__*/ L(Ir, [["render", Wr]]), Kr = (e, { signal: t, token: n,
2545
2816
  ...o,
2546
2817
  ok: !0,
2547
2818
  message: null
2548
- })).catch((e) => s(G(e))) : Promise.resolve(s("sollicitation introuvable dans la réponse"));
2819
+ })).catch((e) => s(z(e))) : Promise.resolve(s("sollicitation introuvable dans la réponse"));
2549
2820
  });
2550
2821
  return Promise.all(n);
2551
2822
  }
2552
2823
  }
2553
- }, Xr = { class: "row g-3" }, Zr = {
2824
+ }, vi = { class: "row g-3" }, yi = {
2554
2825
  key: 0,
2555
2826
  class: "col-12 col-lg-4"
2556
2827
  };
2557
- function Qr(e, t, n, r, i, l) {
2828
+ function bi(e, t, n, r, i, l) {
2558
2829
  let f = S("aside-block"), p = S("stepper-block");
2559
- return g(), o("div", Xr, [e.aside ? (g(), o("div", Zr, [x(e.$slots, "aside", {}, () => [u(f, { "nb-similaires": e.nbSimilaires }, c({ _: 2 }, [e.$slots["aside-similaires"] ? {
2830
+ return g(), o("div", vi, [e.aside ? (g(), o("div", yi, [x(e.$slots, "aside", {}, () => [u(f, { "nb-similaires": e.nbSimilaires }, c({ _: 2 }, [e.$slots["aside-similaires"] ? {
2560
2831
  name: "similaires",
2561
- fn: D((t) => [x(e.$slots, "aside-similaires", h(d(t)))]),
2832
+ fn: E((t) => [x(e.$slots, "aside-similaires", h(d(t)))]),
2562
2833
  key: "0"
2563
2834
  } : void 0, e.$slots["aside-evenements"] ? {
2564
2835
  name: "evenements",
2565
- fn: D(() => [x(e.$slots, "aside-evenements")]),
2836
+ fn: E(() => [x(e.$slots, "aside-evenements")]),
2566
2837
  key: "1"
2567
2838
  } : void 0]), 1032, ["nb-similaires"])])])) : a("", !0), s("div", { class: m(["col-12", e.aside ? "col-lg-8" : ""]) }, [u(p, {
2568
2839
  step: i.currentStep,
@@ -2570,13 +2841,17 @@ function Qr(e, t, n, r, i, l) {
2570
2841
  creating: i.creating,
2571
2842
  onStepChange: t[1] ||= (t) => e.$emit("stepChange", t),
2572
2843
  onSubmit: l.creer
2573
- }, null, 8, [
2844
+ }, c({ _: 2 }, [e.$slots.reclamant ? {
2845
+ name: "reclamant",
2846
+ fn: E((t) => [x(e.$slots, "reclamant", h(d(t)))]),
2847
+ key: "0"
2848
+ } : void 0]), 1032, [
2574
2849
  "step",
2575
2850
  "creating",
2576
2851
  "onSubmit"
2577
2852
  ])], 2)]);
2578
2853
  }
2579
- var $ = /*#__PURE__*/ L(Yr, [["render", Qr]]), $r = {
2854
+ var $ = /*#__PURE__*/ F(_i, [["render", bi]]), xi = {
2580
2855
  name: "CreerSollicitationModal",
2581
2856
  components: {
2582
2857
  AmsomModal: e,
@@ -2596,7 +2871,7 @@ var $ = /*#__PURE__*/ L(Yr, [["render", Qr]]), $r = {
2596
2871
  emits: [...Q, "close"],
2597
2872
  computed: {
2598
2873
  formProps() {
2599
- return Object.fromEntries(Jr.map((e) => [e, this[e]]));
2874
+ return Object.fromEntries(gi.map((e) => [e, this[e]]));
2600
2875
  },
2601
2876
  formListeners() {
2602
2877
  return Object.fromEntries(Q.filter((e) => e !== "created").map((e) => [e, (...t) => this.$emit(e, ...t)]));
@@ -2605,24 +2880,24 @@ var $ = /*#__PURE__*/ L(Yr, [["render", Qr]]), $r = {
2605
2880
  methods: { onCreated(...e) {
2606
2881
  this.$emit("created", ...e), this.closeOnCreated && this.$emit("close");
2607
2882
  } }
2608
- }, ei = { class: "fw-medium fs-5" };
2609
- function ti(e, t, n, r, a, o) {
2883
+ }, Si = { class: "fw-medium fs-5" };
2884
+ function Ci(e, t, n, r, a, o) {
2610
2885
  let l = S("creer-sollicitation-form"), f = S("amsom-modal");
2611
2886
  return g(), i(f, {
2612
2887
  "close-option": "",
2613
2888
  size: "xl",
2614
2889
  onClose: t[0] ||= (t) => e.$emit("close")
2615
2890
  }, {
2616
- default: D(() => [s("span", ei, C(n.titre), 1), u(l, p({ class: "pt-3" }, o.formProps, ee(o.formListeners), { onCreated: o.onCreated }), c({ _: 2 }, [b(e.$slots, (t, n) => ({
2891
+ default: E(() => [s("span", Si, C(n.titre), 1), u(l, p({ class: "pt-3" }, o.formProps, ee(o.formListeners), { onCreated: o.onCreated }), c({ _: 2 }, [b(e.$slots, (t, n) => ({
2617
2892
  name: n,
2618
- fn: D((t) => [x(e.$slots, n, h(d(t ?? {})))])
2893
+ fn: E((t) => [x(e.$slots, n, h(d(t ?? {})))])
2619
2894
  }))]), 1040, ["onCreated"])]),
2620
2895
  _: 3
2621
2896
  });
2622
2897
  }
2623
- var ni = /*#__PURE__*/ L($r, [["render", ti]]), ri = {
2624
- CreerSollicitationModal: ni,
2898
+ var wi = /*#__PURE__*/ F(xi, [["render", Ci]]), Ti = {
2899
+ CreerSollicitationModal: wi,
2625
2900
  CreerSollicitationForm: $
2626
2901
  };
2627
2902
  //#endregion
2628
- export { $ as CreerSollicitationForm, ni as CreerSollicitationModal, ce as DEFAULT_PROVENANCE_CONTACT, se as PROVENANCES_CONTACT, N as READONLY_FIELDS, Xe as configureCresol, ri as default, P as getDefaultDraft, M as getDefaultLigne, j as getDefaultPatrimoine, bt as resetCresolCache };
2903
+ export { $ as CreerSollicitationForm, wi as CreerSollicitationModal, le as DEFAULT_PROVENANCE_CONTACT, ce as PROVENANCES_CONTACT, M as READONLY_FIELDS, ke as configureCresol, Ti as default, N as getDefaultDraft, j as getDefaultLigne, A as getDefaultPatrimoine, Qe as resetCresolCache };