@tekkare/romulus 0.1.280 → 0.1.282

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/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.16.0"
6
6
  },
7
- "version": "0.1.279",
7
+ "version": "0.1.281",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -1,8 +1,8 @@
1
1
  <!--
2
2
  Fiche d'une association de patients, portee de la page
3
3
  `hubr/heart/associations/[id]` de fr_drugs_app : identite dans le bandeau,
4
- puis quatre onglets (contributions HAS, debats HAS, comites ANSM,
5
- Assemblee nationale).
4
+ puis cinq onglets (contributions HAS, debats HAS, comites ANSM,
5
+ Assemblee nationale, amendements PLFSS).
6
6
 
7
7
  Montee par la page de fr_drugs_app et par le tiroir des projets. L'export et
8
8
  le bouton Projet de la page passent par le slot `actions` ; le tiroir pose
@@ -152,6 +152,23 @@
152
152
  />
153
153
  </div>
154
154
 
155
+ <!-- Amendements PLFSS de l'Assemblee nationale qui la citent. -->
156
+ <div v-else-if="activeTab === 5" class="oip_list gap-12 full">
157
+ <RmEmptyState
158
+ v-if="amendments.length === 0"
159
+ :title="t('oipDrugs.heart.associations.detail.noAmendments')"
160
+ icon="Prohibit"
161
+ />
162
+ <OipDrugsHeartAssociationsNationalAssemblyAmendmentCard
163
+ v-for="amendment in amendments"
164
+ :key="amendment[AMENDMENT_FIELDS.id]"
165
+ :amendment="amendment"
166
+ :current-association="label"
167
+ @read="openAmendment"
168
+ @report="openAmendmentReport"
169
+ />
170
+ </div>
171
+
155
172
  <!-- Seances du comite d'interface ANSM. -->
156
173
  <div v-else class="oip_list gap-12 full">
157
174
  <RmEmptyState
@@ -422,6 +439,8 @@
422
439
  :title="pdfTitle"
423
440
  :external-src="pdfExternal"
424
441
  :download-src="pdfExternal"
442
+ :query="pdfQuery"
443
+ :fallback-src="pdfFallback"
425
444
  />
426
445
  </div>
427
446
  </template>
@@ -429,9 +448,11 @@
429
448
  <script setup lang="ts">
430
449
  import { HEART_SOURCE_UUIDS } from "../../../oip-drugs/utils/sourceUuids";
431
450
  import {
451
+ AMENDMENT_FIELDS,
432
452
  ASSOCIATION_FIELDS,
433
453
  ASSOCIATION_FLAG_ON,
434
454
  NATIONAL_ASSEMBLY_FIELDS,
455
+ amendmentPdfUrl,
435
456
  associationDomains,
436
457
  } from "../../../oip-drugs/utils/associationFields";
437
458
  import { useAssociationDetail } from "../../../oip-drugs/composables/useAssociationDetail";
@@ -441,7 +462,7 @@ const props = withDefaults(
441
462
  defineProps<{
442
463
  /** Nom regroupe de l'association, `_id` de l'annuaire (l'id de la route de fr_drugs_app). */
443
464
  label: string;
444
- /** Onglet ouvert : "1" contributions, "2" debats, "3" comites ANSM, "4" Assemblee nationale. */
465
+ /** Onglet ouvert : "1" contributions, "2" debats, "3" comites ANSM, "4" Assemblee nationale, "5" amendements. */
445
466
  tab?: string;
446
467
  lang?: "fr" | "en";
447
468
  /** Termes de recherche, surlignes dans les titres des comptes rendus. */
@@ -466,10 +487,12 @@ const {
466
487
  transcriptions,
467
488
  sessions,
468
489
  nationalAssembly,
490
+ amendments,
469
491
  sessionAttendees,
470
492
  loading,
471
493
  load,
472
494
  loadBlocks,
495
+ loadAmendmentReports,
473
496
  brands,
474
497
  } = useAssociationDetail(label);
475
498
 
@@ -509,6 +532,11 @@ const headerTabs = computed(() =>
509
532
  label: t("oipDrugs.heart.associations.detail.tabs.nationalAssembly"),
510
533
  count: nationalAssembly.value.length,
511
534
  },
535
+ {
536
+ key: "5",
537
+ label: t("oipDrugs.heart.associations.detail.tabs.amendments"),
538
+ count: amendments.value.length,
539
+ },
512
540
  ].map((tab) => ({ ...tab, active: String(activeTab.value) === tab.key })),
513
541
  );
514
542
 
@@ -634,6 +662,12 @@ const lastActivity = computed(() => {
634
662
  dates: transcriptions.value.map((row: any) => row?.session_date),
635
663
  };
636
664
  }
665
+ if (activeTab.value === 5) {
666
+ return {
667
+ label: t("oipDrugs.heart.sources.lastAmendment"),
668
+ dates: amendments.value.map((row: any) => row?.[AMENDMENT_FIELDS.filingDate]),
669
+ };
670
+ }
637
671
  if (activeTab.value === 4) {
638
672
  return {
639
673
  label: t("oipDrugs.heart.sources.lastSession"),
@@ -675,9 +709,14 @@ const pdfOpen = ref(false);
675
709
  const pdfSrc = ref<string | null>(null);
676
710
  const pdfTitle = ref("");
677
711
  const pdfExternal = ref<string | null>(null);
712
+ /** Le terme ou la lecture s'ouvre, et la copie brute en repli (compte rendu d'un amendement). */
713
+ const pdfQuery = ref<string[] | null>(null);
714
+ const pdfFallback = ref<string | null>(null);
678
715
 
679
716
  function openPdf(url: string, title: string) {
680
717
  if (!url) return;
718
+ pdfQuery.value = null;
719
+ pdfFallback.value = null;
681
720
  pdfExternal.value = url;
682
721
  pdfSrc.value = `/api/oip/pdf?url=${encodeURIComponent(url)}`;
683
722
  pdfTitle.value = title;
@@ -689,6 +728,8 @@ function openReport(report: any) {
689
728
  const src = report?.[NATIONAL_ASSEMBLY_FIELDS.tekkareUrl];
690
729
  if (!src) return;
691
730
  pdfExternal.value = report[NATIONAL_ASSEMBLY_FIELDS.htmlUrl] || null;
731
+ pdfQuery.value = null;
732
+ pdfFallback.value = null;
692
733
  pdfSrc.value = src;
693
734
  pdfTitle.value =
694
735
  report[NATIONAL_ASSEMBLY_FIELDS.agenda] ||
@@ -696,6 +737,39 @@ function openReport(report: any) {
696
737
  pdfOpen.value = true;
697
738
  }
698
739
 
740
+ /** Le PDF d'un amendement, chez l'Assemblee, par le proxy du layer. */
741
+ function openAmendment(amendment: any) {
742
+ openPdf(
743
+ amendmentPdfUrl(amendment),
744
+ t("oipDrugs.heart.associations.nationalAssembly.amendments.card.number", {
745
+ n: amendment?.[AMENDMENT_FIELDS.number] ?? "",
746
+ }),
747
+ );
748
+ }
749
+
750
+ /**
751
+ * Le compte rendu de la seance ou l'amendement est discute, ouvert sur son
752
+ * numero. La copie passe par le proxy : la visionneuse la lit par `fetch` pour
753
+ * y chercher le numero, et S3 ne repond pas a une autre origine. Sans compte
754
+ * rendu trouve (cite sous une forme groupee), la page de l'amendement.
755
+ */
756
+ async function openAmendmentReport(amendment: any) {
757
+ const [report] = await loadAmendmentReports(amendment);
758
+ const url = report?.[NATIONAL_ASSEMBLY_FIELDS.tekkareUrl];
759
+ if (!url) {
760
+ openLink(amendment?.[AMENDMENT_FIELDS.url]);
761
+ return;
762
+ }
763
+ pdfSrc.value = `/api/oip/pdf?url=${encodeURIComponent(url)}`;
764
+ pdfFallback.value = url;
765
+ pdfExternal.value = report[NATIONAL_ASSEMBLY_FIELDS.htmlUrl] || null;
766
+ pdfQuery.value = [amendment[AMENDMENT_FIELDS.number]];
767
+ pdfTitle.value =
768
+ report[NATIONAL_ASSEMBLY_FIELDS.agenda] ||
769
+ t("oipDrugs.heart.associations.nationalAssembly.card.untitled");
770
+ pdfOpen.value = true;
771
+ }
772
+
699
773
  function openLink(url: string) {
700
774
  if (url) window.open(url, "_blank");
701
775
  }
@@ -717,6 +791,7 @@ defineExpose({
717
791
  transcriptions,
718
792
  sessions,
719
793
  nationalAssembly,
794
+ amendments,
720
795
  sessionAttendees,
721
796
  brands,
722
797
  activeTab,
@@ -0,0 +1,308 @@
1
+ <!--
2
+ Carte d'un amendement au PLFSS examine par la commission des affaires
3
+ sociales de l'Assemblee nationale.
4
+
5
+ Meme dessin que la carte d'un compte rendu (RmResultCard) : quel amendement
6
+ (numero, article vise, texte amende, stade de lecture), ce qu'il est devenu
7
+ (sort en commission ou motif d'irrecevabilite), qui y est cite (les
8
+ associations, chacune ouvrant sa fiche) et ce qu'il dit (dispositif et
9
+ expose sommaire, replies au-dela de quelques lignes). Le PDF de
10
+ l'Assemblee (`read`) et le compte rendu de la seance ou il est discute
11
+ (`report`) s'ouvrent dans la visionneuse de l'appelant.
12
+
13
+ Le dispositif et l'expose arrivent surlignes quand la barre cherche quelque
14
+ chose : le moteur renvoie le champ entier (`number_of_fragments: 0`), coupe
15
+ en segments sans `v-html` (cf. highlightSegments).
16
+
17
+ La meme carte sert a la liste de fr_drugs_app et a la fiche d'une
18
+ association ; la fiche retire son propre nom de la liste des citees.
19
+ -->
20
+ <template>
21
+ <RmResultCard class="oip-drugs" :lang="dateLang" :link="amendment[AMENDMENT_FIELDS.url]">
22
+ <template #title>{{ title }}</template>
23
+ <template #subtitle>{{ subtitle }}</template>
24
+
25
+ <template #meta>
26
+ <RmTag v-if="outcome" :variant="outcomeVariant">{{ outcome }}</RmTag>
27
+ <RmTag v-if="statusLabel" variant="amber">{{ statusLabel }}</RmTag>
28
+ <RmTag v-if="amendment[AMENDMENT_FIELDS.code]" variant="blue">
29
+ {{ amendment[AMENDMENT_FIELDS.code] }}
30
+ </RmTag>
31
+ <RmTag v-if="amendment[AMENDMENT_FIELDS.targetText]" variant="gray">
32
+ {{ amendment[AMENDMENT_FIELDS.targetText] }}
33
+ </RmTag>
34
+ </template>
35
+
36
+ <!-- Les associations citees, en tete de carte : chacune ouvre sa fiche. -->
37
+ <div v-if="associations.length > 0" class="oip_list gap-4">
38
+ <p class="oip_label">{{ t("oipDrugs.heart.associations.nationalAssembly.amendments.card.associations") }}</p>
39
+ <div class="oip_row gap-8 wrap">
40
+ <a
41
+ v-for="name in associations"
42
+ :key="name"
43
+ :href="drugsAssociationPath(name)"
44
+ class="am_association"
45
+ @click="openAssociation($event, name)"
46
+ >
47
+ <RmIcon name="UsersThree" :size="16" />
48
+ {{ name }}
49
+ </a>
50
+ </div>
51
+ </div>
52
+
53
+ <div v-for="block in textBlocks" :key="block.key" class="oip_list gap-4">
54
+ <p class="oip_label">{{ block.label }}</p>
55
+ <p :id="`${blockId}-${block.key}`" class="am_text" :class="{ 'am_text--clamped': !expanded[block.key] }">
56
+ <template v-for="(seg, si) in block.segments" :key="si"><mark v-if="seg.hit">{{ seg.text }}</mark><template v-else>{{ seg.text }}</template></template>
57
+ </p>
58
+ <button
59
+ v-if="block.long"
60
+ type="button"
61
+ class="am_toggle"
62
+ :aria-expanded="!!expanded[block.key]"
63
+ :aria-controls="`${blockId}-${block.key}`"
64
+ @click="expanded[block.key] = !expanded[block.key]"
65
+ >
66
+ {{
67
+ expanded[block.key]
68
+ ? t("oipDrugs.heart.associations.nationalAssembly.amendments.card.showLess")
69
+ : t("oipDrugs.heart.associations.nationalAssembly.amendments.card.showMore")
70
+ }}
71
+ </button>
72
+ </div>
73
+
74
+ <p v-if="amendment[AMENDMENT_FIELDS.irrecevability]" class="am_irrecevable">
75
+ {{ amendment[AMENDMENT_FIELDS.irrecevability] }}
76
+ </p>
77
+
78
+ <div v-if="amendment[AMENDMENT_FIELDS.url]" class="oip_row gap-8 wrap">
79
+ <RmButton
80
+ v-if="amendmentDiscussed(amendment)"
81
+ variant="secondary"
82
+ prefix-icon="FileText"
83
+ @click="emit('report', amendment)"
84
+ >
85
+ {{ t("oipDrugs.heart.associations.nationalAssembly.amendments.card.report") }}
86
+ </RmButton>
87
+ <RmButton variant="secondary" prefix-icon="FilePdf" @click="emit('read', amendment)">
88
+ {{ t("oipDrugs.heart.associations.nationalAssembly.amendments.card.pdf") }}
89
+ </RmButton>
90
+ <RmButton
91
+ variant="tertiary"
92
+ ghost
93
+ prefix-icon="ArrowSquareOut"
94
+ @click="openLink(amendment[AMENDMENT_FIELDS.url])"
95
+ >
96
+ {{ t("oipDrugs.heart.associations.nationalAssembly.amendments.card.seeOnAn") }}
97
+ </RmButton>
98
+ </div>
99
+ </RmResultCard>
100
+ </template>
101
+
102
+ <script lang="ts" setup>
103
+ import { useId } from "vue";
104
+ import { AMENDMENT_FIELDS, amendmentDiscussed } from "../../../../oip-drugs/utils/associationFields";
105
+ import { highlightSegments } from "../../../../oip-drugs/utils/esHighlight";
106
+ import { drugsAssociationPath } from "../../../../oip-drugs/kinds";
107
+
108
+ const props = withDefaults(
109
+ defineProps<{
110
+ /** Le `_source` d'un amendement. */
111
+ amendment: any;
112
+ /** Surlignage du hit, champ entier (balises de controle, cf. highlightSegments). */
113
+ highlight?: Record<string, string[]>;
114
+ /** L'association dont on lit la fiche : elle ne se cite pas elle-meme. */
115
+ currentAssociation?: string;
116
+ }>(),
117
+ { highlight: undefined, currentAssociation: "" },
118
+ );
119
+
120
+ /**
121
+ * `read` : le PDF de l'Assemblee (cf. amendmentPdfUrl). `report` : le compte
122
+ * rendu de la seance ou il est discute (cf. amendmentReportsQuery). Les deux
123
+ * s'ouvrent dans la visionneuse de l'appelant.
124
+ */
125
+ const emit = defineEmits<{ read: [amendment: any]; report: [amendment: any] }>();
126
+
127
+ const { t, locale } = useI18n();
128
+ const nav = useOipResourceNav();
129
+ const dateLang = computed(() => (locale.value === "en" ? "en" : "fr"));
130
+ const blockId = `am-${useId()}`;
131
+
132
+ /** Le Ctrl/Cmd-clic garde le lien : il ouvre un onglet. */
133
+ function openAssociation(event: MouseEvent, name: string) {
134
+ if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
135
+ event.preventDefault();
136
+ nav.openApp("fr_drugs_app", drugsAssociationPath(name));
137
+ }
138
+
139
+ const formatDate = (raw: unknown) =>
140
+ raw
141
+ ? new Date(raw as number).toLocaleDateString(dateLang.value === "en" ? "en-GB" : "fr-FR", {
142
+ day: "numeric",
143
+ month: "long",
144
+ year: "numeric",
145
+ })
146
+ : null;
147
+
148
+ /** « Amendement AS3 · ART. 21 » : le numero en commission, puis l'article vise. */
149
+ const title = computed(() =>
150
+ [
151
+ t("oipDrugs.heart.associations.nationalAssembly.amendments.card.number", {
152
+ n: props.amendment[AMENDMENT_FIELDS.number] ?? "",
153
+ }),
154
+ props.amendment[AMENDMENT_FIELDS.location],
155
+ ]
156
+ .filter(Boolean)
157
+ .join(" · "),
158
+ );
159
+
160
+ /** Examen en commission quand il a eu lieu, depot sinon, puis le stade de lecture. */
161
+ const subtitle = computed(() => {
162
+ const examined = formatDate(props.amendment[AMENDMENT_FIELDS.examinationDate]);
163
+ const filed = formatDate(props.amendment[AMENDMENT_FIELDS.filingDate]);
164
+ return [
165
+ examined
166
+ ? t("oipDrugs.heart.associations.nationalAssembly.amendments.card.examined", { date: examined })
167
+ : null,
168
+ filed ? t("oipDrugs.heart.associations.nationalAssembly.amendments.card.filed", { date: filed }) : null,
169
+ props.amendment[AMENDMENT_FIELDS.readingStage] || null,
170
+ ]
171
+ .filter(Boolean)
172
+ .join(" · ");
173
+ });
174
+
175
+ const outcome = computed<string>(() => props.amendment[AMENDMENT_FIELDS.outcome] || "");
176
+
177
+ const outcomeVariant = computed(() => {
178
+ if (outcome.value === "Adopté") return "emerald";
179
+ if (outcome.value === "Rejeté") return "rose";
180
+ return "gray";
181
+ });
182
+
183
+ /**
184
+ * L'etat ne se dit que quand il apporte quelque chose au sort : un
185
+ * amendement « Discuté » a son sort, un « Retiré » le repete. Restent les
186
+ * irrecevables, avec leur motif court (« Irrecevable 40 · Charge »).
187
+ */
188
+ const statusLabel = computed(() => {
189
+ const status = props.amendment[AMENDMENT_FIELDS.status];
190
+ if (!status || status === "Discuté" || status === "Retiré") return "";
191
+ const sub = props.amendment[AMENDMENT_FIELDS.subStatus];
192
+ return sub && sub !== status ? `${status} · ${sub}` : status;
193
+ });
194
+
195
+ const associations = computed<string[]>(() => {
196
+ const raw = props.amendment[AMENDMENT_FIELDS.associations];
197
+ const list: string[] = Array.isArray(raw) ? raw : typeof raw === "string" && raw ? [raw] : [];
198
+ const mine = props.currentAssociation.toLowerCase();
199
+ return [...new Set(list.map((name) => name.trim()))]
200
+ .filter((name) => name && name.toLowerCase() !== mine)
201
+ .sort((a, b) => a.localeCompare(b, "fr"));
202
+ });
203
+
204
+ /** Au-dela, le texte se replie sur quatre lignes. */
205
+ const LONG_TEXT = 320;
206
+
207
+ /** Dispositif puis expose, surlignes quand le moteur l'a fait. */
208
+ const textBlocks = computed(() =>
209
+ (
210
+ [
211
+ ["dispositif", AMENDMENT_FIELDS.dispositif],
212
+ ["summary", AMENDMENT_FIELDS.summary],
213
+ ] as const
214
+ )
215
+ .map(([key, field]) => {
216
+ const plain = String(props.amendment[field] ?? "").trim();
217
+ const highlighted = props.highlight?.[field]?.[0];
218
+ return {
219
+ key,
220
+ label: t(`oipDrugs.heart.associations.nationalAssembly.amendments.card.${key}`),
221
+ long: plain.length > LONG_TEXT,
222
+ segments: highlighted ? highlightSegments(highlighted) : [{ text: plain, hit: false }],
223
+ plain,
224
+ };
225
+ })
226
+ .filter((block) => block.plain),
227
+ );
228
+
229
+ const expanded = reactive<Record<string, boolean>>({});
230
+
231
+ function openLink(url: string) {
232
+ if (url) window.open(url, "_blank");
233
+ }
234
+ </script>
235
+
236
+ <style scoped>
237
+ /* Les associations citees : memes pastilles que la carte d'un compte rendu. */
238
+ .am_association {
239
+ display: inline-flex;
240
+ align-items: center;
241
+ gap: 6px;
242
+ padding: 4px 12px;
243
+ border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
244
+ border-radius: 999px;
245
+ background: color-mix(in srgb, var(--primary) 10%, transparent);
246
+ color: var(--primary);
247
+ font-size: 13px;
248
+ font-weight: 600;
249
+ text-decoration: none;
250
+ }
251
+
252
+ .am_association:hover {
253
+ background: color-mix(in srgb, var(--primary) 18%, transparent);
254
+ border-color: var(--primary);
255
+ }
256
+
257
+ .am_association:focus-visible,
258
+ .am_toggle:focus-visible {
259
+ outline: 2px solid var(--primary);
260
+ outline-offset: 2px;
261
+ }
262
+
263
+ .am_text {
264
+ margin: 0;
265
+ color: var(--text-primary);
266
+ font-size: 13px;
267
+ line-height: 1.55;
268
+ white-space: pre-line;
269
+ }
270
+
271
+ .am_text--clamped {
272
+ display: -webkit-box;
273
+ -webkit-box-orient: vertical;
274
+ -webkit-line-clamp: 4;
275
+ line-clamp: 4;
276
+ overflow: hidden;
277
+ }
278
+
279
+ .am_text mark {
280
+ background: color-mix(in srgb, var(--color-primary) 18%, transparent);
281
+ color: inherit;
282
+ border-radius: 3px;
283
+ padding: 0 2px;
284
+ }
285
+
286
+ .am_toggle {
287
+ align-self: flex-start;
288
+ padding: 0;
289
+ border: none;
290
+ background: none;
291
+ color: var(--primary);
292
+ font: inherit;
293
+ font-size: 13px;
294
+ font-weight: 600;
295
+ cursor: pointer;
296
+ }
297
+
298
+ .am_irrecevable {
299
+ margin: 0;
300
+ padding: 8px 12px;
301
+ border-left: 3px solid var(--border-default);
302
+ border-radius: 0 6px 6px 0;
303
+ background: var(--lightest);
304
+ color: var(--text-secondary);
305
+ font-size: 13px;
306
+ line-height: 1.55;
307
+ }
308
+ </style>