@tekkare/romulus 0.1.285 → 0.1.286

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.284",
7
+ "version": "0.1.285",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -237,7 +237,7 @@ function urlOf(type: string, id: string, tab?: string, doc?: Record<string, any>
237
237
  * Les vues sans bandeau a elles (une carte de resultat) : le tiroir garde son
238
238
  * en-tete, titre et lien.
239
239
  */
240
- const CARD_VIEWS = new Set(["drugs-national-assembly", "science-phrc"]);
240
+ const CARD_VIEWS = new Set(["drugs-national-assembly", "drugs-national-assembly-amendment", "science-phrc"]);
241
241
 
242
242
  /** Une fiche du layer : elle porte son bandeau, le tiroir efface le sien. */
243
243
  function isPage(entry: Entry) {
@@ -22,6 +22,20 @@
22
22
  <template #title>{{ title }}</template>
23
23
  <template #subtitle>{{ subtitle }}</template>
24
24
 
25
+ <template #actions>
26
+ <!-- Emplacement libre pour un appelant (la fiche projet y pose son
27
+ bouton « Commenter ») avant le bouton projet : vide partout ailleurs. -->
28
+ <slot name="hubr-actions" />
29
+ <component
30
+ :is="projectButton"
31
+ v-if="projectButton"
32
+ :resource-id="amendmentId || amendment[AMENDMENT_FIELDS.id]"
33
+ type="FrNationalAssemblyAmendment"
34
+ :label="title"
35
+ compact
36
+ />
37
+ </template>
38
+
25
39
  <template #meta>
26
40
  <RmTag v-if="outcome" :variant="outcomeVariant">{{ outcome }}</RmTag>
27
41
  <RmTag v-if="statusLabel" variant="amber">{{ statusLabel }}</RmTag>
@@ -121,8 +135,13 @@ const props = withDefaults(
121
135
  highlight?: Record<string, string[]>;
122
136
  /** L'association dont on lit la fiche : elle ne se cite pas elle-meme. */
123
137
  currentAssociation?: string;
138
+ /**
139
+ * Le `_id` du document, pour le bouton Projet. A defaut, `amendment_id`,
140
+ * qui le vaut dans cet index (verifie sur les 2 364 amendements).
141
+ */
142
+ amendmentId?: string;
124
143
  }>(),
125
- { highlight: undefined, currentAssociation: "" },
144
+ { highlight: undefined, currentAssociation: "", amendmentId: "" },
126
145
  );
127
146
 
128
147
  /**
@@ -134,6 +153,7 @@ const emit = defineEmits<{ read: [amendment: any]; report: [amendment: any] }>()
134
153
 
135
154
  const { t, locale } = useI18n();
136
155
  const nav = useOipResourceNav();
156
+ const { projectButton } = useOipResourceHooks();
137
157
  const dateLang = computed(() => (locale.value === "en" ? "en" : "fr"));
138
158
  const blockId = `am-${useId()}`;
139
159
 
@@ -0,0 +1,126 @@
1
+ <!--
2
+ Vue de ressource d'un amendement PLFSS de l'Assemblee nationale
3
+ (FrNationalAssemblyAmendment) : le document relu par son `_id`, monte dans
4
+ la carte de la liste. Le PDF de l'Assemblee et le compte rendu de la seance
5
+ ou il est discute s'ouvrent dans la visionneuse.
6
+ -->
7
+ <template>
8
+ <div class="oip-drugs oip_list gap-12 full">
9
+
10
+ <RmLoadingState v-if="loading" />
11
+ <RmEmptyState v-else-if="!amendment" :title="t('oipDrugs.heart.errors.results')" icon="Prohibit" />
12
+ <OipDrugsHeartAssociationsNationalAssemblyAmendmentCard
13
+ v-else
14
+ :amendment="amendment"
15
+ :amendment-id="id"
16
+ @read="openPdf"
17
+ @report="openReport"
18
+ />
19
+
20
+ <OipDocumentPreview
21
+ v-model="previewOpen"
22
+ :src="previewSrc"
23
+ :title="previewTitle"
24
+ :external-src="previewExternal"
25
+ :query="previewQuery"
26
+ :fallback-src="previewFallback"
27
+ />
28
+ </div>
29
+ </template>
30
+
31
+ <script setup lang="ts">
32
+ import { ES_INDEX } from "../../../oip-drugs/esIndices";
33
+ import {
34
+ AMENDMENT_FIELDS,
35
+ NATIONAL_ASSEMBLY_FIELDS,
36
+ amendmentPdfUrl,
37
+ amendmentReportsQuery,
38
+ } from "../../../oip-drugs/utils/associationFields";
39
+ import { oipEsSearch } from "../../../composables/useOipResources";
40
+
41
+ const props = withDefaults(
42
+ defineProps<{
43
+ id: string;
44
+ type?: string;
45
+ lang?: "fr" | "en";
46
+ highlight?: string[];
47
+ }>(),
48
+ { type: "FrNationalAssemblyAmendment", lang: "fr", highlight: () => [] },
49
+ );
50
+
51
+ const { t } = useI18n();
52
+
53
+ const amendment = ref<any>(null);
54
+ const loading = ref(true);
55
+
56
+ watch(
57
+ () => props.id,
58
+ async (id) => {
59
+ loading.value = true;
60
+ amendment.value = null;
61
+ try {
62
+ const res: any = await oipEsSearch("drugs", ES_INDEX.ASSOCIATION_AMENDMENT_NATIONAL_ASSEMBLY, {
63
+ size: 1,
64
+ query: { ids: { values: [id] } },
65
+ });
66
+ amendment.value = res?.hits?.hits?.[0]?._source ?? null;
67
+ } catch {
68
+ amendment.value = null;
69
+ }
70
+ loading.value = false;
71
+ },
72
+ { immediate: true },
73
+ );
74
+
75
+ const previewOpen = ref(false);
76
+ const previewSrc = ref<string | null>(null);
77
+ const previewTitle = ref("");
78
+ const previewExternal = ref<string | null>(null);
79
+ const previewFallback = ref<string | null>(null);
80
+ const previewQuery = ref<string[] | null>(null);
81
+
82
+ /** Le PDF de l'Assemblee, par le proxy du layer (cf. amendmentPdfUrl). */
83
+ function openPdf(doc: any) {
84
+ const url = amendmentPdfUrl(doc);
85
+ if (!url) return;
86
+ previewQuery.value = null;
87
+ previewFallback.value = null;
88
+ previewExternal.value = url;
89
+ previewSrc.value = `/api/oip/pdf?url=${encodeURIComponent(url)}`;
90
+ previewTitle.value = t("oipDrugs.heart.associations.nationalAssembly.amendments.card.number", {
91
+ n: doc?.[AMENDMENT_FIELDS.number] ?? "",
92
+ });
93
+ previewOpen.value = true;
94
+ }
95
+
96
+ /**
97
+ * Le compte rendu de la seance ou il est discute, ouvert sur son numero
98
+ * (cf. amendmentReportsQuery). Sans compte rendu trouve, la page de
99
+ * l'amendement.
100
+ */
101
+ async function openReport(doc: any) {
102
+ let report: any = null;
103
+ try {
104
+ const res: any = await oipEsSearch(
105
+ "drugs",
106
+ ES_INDEX.ASSOCIATION_COMMISSION_SESSION_NATIONAL_ASSEMBLY,
107
+ amendmentReportsQuery(doc),
108
+ );
109
+ report = res?.hits?.hits?.[0]?._source ?? null;
110
+ } catch {
111
+ report = null;
112
+ }
113
+ const url = report?.[NATIONAL_ASSEMBLY_FIELDS.tekkareUrl];
114
+ if (!url) {
115
+ if (doc?.[AMENDMENT_FIELDS.url]) window.open(doc[AMENDMENT_FIELDS.url], "_blank");
116
+ return;
117
+ }
118
+ previewSrc.value = `/api/oip/pdf?url=${encodeURIComponent(url)}`;
119
+ previewFallback.value = url;
120
+ previewExternal.value = report[NATIONAL_ASSEMBLY_FIELDS.htmlUrl] || null;
121
+ previewQuery.value = [doc[AMENDMENT_FIELDS.number]];
122
+ previewTitle.value =
123
+ report[NATIONAL_ASSEMBLY_FIELDS.agenda] || t("oipDrugs.heart.associations.nationalAssembly.card.untitled");
124
+ previewOpen.value = true;
125
+ }
126
+ </script>
@@ -91,6 +91,8 @@ const VIEW_LOADERS: Record<string, () => Promise<any>> = {
91
91
  "drugs-association": () => import("../components/oip-drugs/resources/Association.vue"),
92
92
  "drugs-contribution": () => import("../components/oip-drugs/resources/Contribution.vue"),
93
93
  "drugs-national-assembly": () => import("../components/oip-drugs/resources/NationalAssembly.vue"),
94
+ "drugs-national-assembly-amendment": () =>
95
+ import("../components/oip-drugs/resources/NationalAssemblyAmendment.vue"),
94
96
  "drugs-medicam": () => import("../components/oip-drugs/resources/Medicam.vue"),
95
97
  "drugs-outpatient": () => import("../components/oip-drugs/resources/Outpatient.vue"),
96
98
  "drugs-hospital": () => import("../components/oip-drugs/resources/Hospital.vue"),
@@ -208,6 +208,26 @@ export const DRUG_PROJECT_KINDS: RmProjectKind[] = [
208
208
  source: ["agenda", "parliamentary_session", "session_date"],
209
209
  title: (s) => s?.agenda ?? "",
210
210
  subtitle: (s) => s?.parliamentary_session ?? "",
211
+ // Les amendements ouvrent la page : un compte rendu se lit sur son onglet.
212
+ path: () => "/hubr/heart/associations/national-assembly?tab=reports",
213
+ },
214
+ {
215
+ type: "FrNationalAssemblyAmendment",
216
+ index: ES_INDEX.ASSOCIATION_AMENDMENT_NATIONAL_ASSEMBLY,
217
+ label: { fr: "Amendements PLFSS", en: "Social security bill amendments" },
218
+ section: ASSOCIATIONS,
219
+ country: "fr",
220
+ icon: "Scales",
221
+ source: ["amendment_number", "location", "outcome", "status", "examination_date", "filing_date"],
222
+ // « AS592 · ART. 21 BIS », comme le titre de la carte.
223
+ title: (s) => [s?.amendment_number, s?.location].filter(Boolean).join(" · "),
224
+ // Le sort quand il existe, l'etat sinon (irrecevable, retire), puis la date.
225
+ subtitle: (s, l) => {
226
+ const raw = s?.examination_date ?? s?.filing_date;
227
+ const date = raw ? new Date(raw) : null;
228
+ const day = date && !Number.isNaN(date.getTime()) ? date.toLocaleDateString(l === "en" ? "en-GB" : "fr-FR") : "";
229
+ return [s?.outcome || s?.status, day].filter(Boolean).join(" · ");
230
+ },
211
231
  path: () => "/hubr/heart/associations/national-assembly",
212
232
  },
213
233
  {
@@ -222,6 +222,7 @@ const DRUG_VIEWS: Record<string, string> = {
222
222
  FrPatientAssociation: "drugs-association",
223
223
  FrPatientContribution: "drugs-contribution",
224
224
  FrNationalAssemblySession: "drugs-national-assembly",
225
+ FrNationalAssemblyAmendment: "drugs-national-assembly-amendment",
225
226
  FrMedicamBrand: "drugs-medicam",
226
227
  FrOutpatientBrand: "drugs-outpatient",
227
228
  FrSusBrand: "drugs-hospital",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/romulus",
3
- "version": "0.1.285",
3
+ "version": "0.1.286",
4
4
  "description": "Romulus Design System - Nuxt module by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",