@tekkare/romulus 0.1.355 → 0.1.356
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 +1 -1
- package/dist/runtime/components/ProjectAddButton.vue +4 -1
- package/layer/app/components/panels/OipPanelProjects.vue +5 -2
- package/layer/app/components/project/AddButton.vue +4 -0
- package/layer/app/components/project/Guided.vue +20 -9
- package/layer/app/components/project/NewButton.vue +5 -3
- package/layer/app/oip-defaults/projects.ts +18 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -44,6 +44,8 @@ const props = withDefaults(
|
|
|
44
44
|
creating?: boolean
|
|
45
45
|
/** La fiche est archivee dans ce projet (v-model:archived). */
|
|
46
46
|
archived?: boolean
|
|
47
|
+
/** Faux : pas de formulaire « nouveau projet » (licence sans droit de creer). */
|
|
48
|
+
canCreate?: boolean
|
|
47
49
|
lang?: 'fr' | 'en'
|
|
48
50
|
}>(),
|
|
49
51
|
{
|
|
@@ -58,6 +60,7 @@ const props = withDefaults(
|
|
|
58
60
|
projectsLoading: false,
|
|
59
61
|
projectsFailed: false,
|
|
60
62
|
creating: false,
|
|
63
|
+
canCreate: true,
|
|
61
64
|
archived: false,
|
|
62
65
|
lang: 'fr',
|
|
63
66
|
},
|
|
@@ -212,7 +215,7 @@ function create() {
|
|
|
212
215
|
</button>
|
|
213
216
|
<p v-if="!projects.length" class="rm-project-add__muted">{{ T.none }}</p>
|
|
214
217
|
</template>
|
|
215
|
-
<form class="rm-project-add__create" @submit.prevent="create">
|
|
218
|
+
<form v-if="canCreate" class="rm-project-add__create" @submit.prevent="create">
|
|
216
219
|
<RmInput v-model="draft" :placeholder="T.newName" />
|
|
217
220
|
<RmButton type="submit" variant="primary" size="sm" :loading="creating">{{ T.create }}</RmButton>
|
|
218
221
|
</form>
|
|
@@ -34,7 +34,9 @@
|
|
|
34
34
|
@pin="pin"
|
|
35
35
|
@create="onCreate"
|
|
36
36
|
>
|
|
37
|
-
|
|
37
|
+
<!-- Sans droit de creer (licence) : pas de « Nouveau projet ». -->
|
|
38
|
+
<template v-if="!canCreate" #new><span /></template>
|
|
39
|
+
<template v-else-if="button" #new="{ openForm }">
|
|
38
40
|
<!-- Branche sur le layer : les memes gestes que « Mes projets » (creation
|
|
39
41
|
libre dans la meme fenetre, nom et description, ou creation guidee). -->
|
|
40
42
|
<component :is="button" size="sm" @free="own ? (dialogOpen = true) : openForm()" />
|
|
@@ -55,7 +57,7 @@
|
|
|
55
57
|
import type { Component } from "vue";
|
|
56
58
|
import ProjectNewButton from "../project/NewButton.vue";
|
|
57
59
|
import type { RmProject } from "@tekkare/romulus/utils/projects";
|
|
58
|
-
import { PROJECTS_PATH, PROJECTS_UPSELL, useProjectsAccess } from "#oip-projects";
|
|
60
|
+
import { PROJECTS_PATH, PROJECTS_UPSELL, useProjectsAccess, useProjectsCreateAccess } from "#oip-projects";
|
|
59
61
|
|
|
60
62
|
const props = withDefaults(
|
|
61
63
|
defineProps<{
|
|
@@ -110,6 +112,7 @@ const creating = ref(false);
|
|
|
110
112
|
const wired = props.projects === undefined;
|
|
111
113
|
const own = wired ? useProjects() : null;
|
|
112
114
|
const allowed = useProjectsAccess();
|
|
115
|
+
const canCreate = useProjectsCreateAccess();
|
|
113
116
|
// Importe, pas resolu par son nom : un composant du layer n'est pas enregistre
|
|
114
117
|
// globalement, `resolveComponent` rendait une chaine et le panneau retombait
|
|
115
118
|
// sur son seul formulaire du nom.
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
:projects-loading="projects.pending.value"
|
|
21
21
|
:projects-failed="!!projects.failure.value"
|
|
22
22
|
:creating="creating"
|
|
23
|
+
:can-create="canCreate"
|
|
23
24
|
:lang="projects.lang.value"
|
|
24
25
|
@toggle="toggle"
|
|
25
26
|
@pick="projects.load()"
|
|
@@ -31,6 +32,7 @@
|
|
|
31
32
|
|
|
32
33
|
<script setup lang="ts">
|
|
33
34
|
import type { ProjectResourceId } from "../../composables/useProjects";
|
|
35
|
+
import { useProjectsCreateAccess } from "#oip-projects";
|
|
34
36
|
|
|
35
37
|
const props = defineProps<{
|
|
36
38
|
/** `_id` Elasticsearch du document, cf. useOipProjectKinds. Une liste quand la carte en porte plusieurs. */
|
|
@@ -47,6 +49,8 @@ const projects = useProjects();
|
|
|
47
49
|
|
|
48
50
|
const busy = ref(false);
|
|
49
51
|
const creating = ref(false);
|
|
52
|
+
/** Sans droit de creer (licence) : on range dans un projet existant, sans en creer. */
|
|
53
|
+
const canCreate = useProjectsCreateAccess();
|
|
50
54
|
const archived = ref(false);
|
|
51
55
|
const error = ref("");
|
|
52
56
|
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
{{ tr("Tous", "All") }}
|
|
133
133
|
</button>
|
|
134
134
|
<button
|
|
135
|
-
v-for="entry in
|
|
135
|
+
v-for="entry in allowedCountries"
|
|
136
136
|
:key="entry.code"
|
|
137
137
|
type="button"
|
|
138
138
|
class="prj_gd_country"
|
|
@@ -418,7 +418,7 @@
|
|
|
418
418
|
|
|
419
419
|
<script setup lang="ts">
|
|
420
420
|
import { rmPanelRegister } from "@tekkare/romulus/utils/panels";
|
|
421
|
-
import { PROJECT_GUIDED_BLOCKS } from "#oip-projects";
|
|
421
|
+
import { PROJECT_GUIDED_BLOCKS, useGuidedCountries } from "#oip-projects";
|
|
422
422
|
import {
|
|
423
423
|
GUIDED_BLOCKS,
|
|
424
424
|
GUIDED_COUNTRIES,
|
|
@@ -463,14 +463,25 @@ const KIND_META: Record<GuidedMatchKind, { label: { fr: string; en: string }; he
|
|
|
463
463
|
/** Les blocs que l'app propose (`PROJECT_GUIDED_BLOCKS`), dans l'ordre du layer. */
|
|
464
464
|
const blocks = computed<GuidedBlock[]>(() => GUIDED_BLOCKS.filter((block) => (PROJECT_GUIDED_BLOCKS ?? []).includes(block.key)));
|
|
465
465
|
|
|
466
|
-
/** Les pays
|
|
466
|
+
/** Les pays que la licence ouvre ; `null` : tous. */
|
|
467
|
+
const licensed = useGuidedCountries();
|
|
468
|
+
/** Les pays proposes : ceux de la creation guidee que la licence ouvre. */
|
|
469
|
+
const allowedCountries = computed(() =>
|
|
470
|
+
GUIDED_COUNTRIES.filter((entry) => !licensed.value || licensed.value.includes(entry.code)),
|
|
471
|
+
);
|
|
472
|
+
|
|
473
|
+
/** Les pays choisis a l'etape des sujets ; vide : tous ceux de la licence. */
|
|
467
474
|
const countries = ref<GuidedCountry[]>([]);
|
|
475
|
+
/** Les pays effectivement cherches : le choix, sinon tous ceux de la licence. */
|
|
476
|
+
const searchedCountries = computed<GuidedCountry[]>(() =>
|
|
477
|
+
countries.value.length ? countries.value : licensed.value ? allowedCountries.value.map((entry) => entry.code) : [],
|
|
478
|
+
);
|
|
468
479
|
function toggleCountry(code: GuidedCountry) {
|
|
469
480
|
countries.value = countries.value.includes(code) ? countries.value.filter((entry) => entry !== code) : [...countries.value, code];
|
|
470
481
|
}
|
|
471
|
-
const inCountries = (type: string) => !
|
|
482
|
+
const inCountries = (type: string) => !searchedCountries.value.length || searchedCountries.value.includes(guidedFamilyCountry(type));
|
|
472
483
|
/** Plusieurs pays en jeu : le libelle d'une famille d'un autre pays que la France le dit. */
|
|
473
|
-
const manyCountries = computed(() =>
|
|
484
|
+
const manyCountries = computed(() => searchedCountries.value.length !== 1);
|
|
474
485
|
|
|
475
486
|
const step = ref<Step>("subjects");
|
|
476
487
|
const stepIndex = computed(() => STEPS.findIndex((entry) => entry.key === step.value));
|
|
@@ -593,7 +604,7 @@ const sortedTypes = (block: GuidedBlock) =>
|
|
|
593
604
|
const countLabel = (count: number) => (count ? tr(`${count} fiches`, `${count} records`) : tr("rien trouvé", "nothing found"));
|
|
594
605
|
|
|
595
606
|
function startSearch() {
|
|
596
|
-
const key = [...subjects.value.map((subject) => subject.key).sort(), ...[...
|
|
607
|
+
const key = [...subjects.value.map((subject) => subject.key).sort(), ...[...searchedCountries.value].sort()].join("|");
|
|
597
608
|
if (key === searchedKey) return;
|
|
598
609
|
searchedKey = key;
|
|
599
610
|
states.value = {};
|
|
@@ -605,7 +616,7 @@ function startSearch() {
|
|
|
605
616
|
states.value = { ...states.value, [type]: state };
|
|
606
617
|
// Une famille qui repond se coche si elle a des fiches, sauf choix deja fait.
|
|
607
618
|
if (!state.loading && families[type] === undefined) families[type] = state.rows.length > 0;
|
|
608
|
-
}, [...
|
|
619
|
+
}, [...searchedCountries.value]).finally(() => {
|
|
609
620
|
if (searchedKey === mine) searching.value = false;
|
|
610
621
|
});
|
|
611
622
|
}
|
|
@@ -674,8 +685,8 @@ function propose() {
|
|
|
674
685
|
? `${tr("Médicaments", "Drugs")}${sep}${drugs.map((subject) => withHint(subject.label, subject.focus === "brand" ? subject.hint.toLowerCase() : subject.hint, subject.focus === "molecule")).join(", ")}.`
|
|
675
686
|
: "",
|
|
676
687
|
`${tr("Périmètre", "Scope")}${sep}${
|
|
677
|
-
|
|
678
|
-
?
|
|
688
|
+
searchedCountries.value.length
|
|
689
|
+
? searchedCountries.value.map((code) => GUIDED_COUNTRIES.find((entry) => entry.code === code)?.label[lang.value]).join(", ")
|
|
679
690
|
: tr("tous les pays", "all countries")
|
|
680
691
|
}.`,
|
|
681
692
|
followed.length ? `${tr("Sources suivies", "Followed sources")}${sep}${followed.join(", ")}.` : "",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
page « Mes projets », pour que les deux proposent les memes choix.
|
|
12
12
|
-->
|
|
13
13
|
<template>
|
|
14
|
-
<span ref="anchor" class="prj_pnb">
|
|
14
|
+
<span v-if="canCreate" ref="anchor" class="prj_pnb">
|
|
15
15
|
<RmButton
|
|
16
16
|
variant="primary"
|
|
17
17
|
:size="size"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
</span>
|
|
25
25
|
|
|
26
26
|
<RmPopover
|
|
27
|
-
v-if="guided"
|
|
27
|
+
v-if="guided && canCreate"
|
|
28
28
|
v-model="choosing"
|
|
29
29
|
:anchor="anchor"
|
|
30
30
|
:label="en ? 'New project' : 'Nouveau projet'"
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
</template>
|
|
62
62
|
|
|
63
63
|
<script setup lang="ts">
|
|
64
|
-
import { PROJECT_ASSISTANT, PROJECT_GUIDED_BLOCKS } from "#oip-projects";
|
|
64
|
+
import { PROJECT_ASSISTANT, PROJECT_GUIDED_BLOCKS, useProjectsCreateAccess } from "#oip-projects";
|
|
65
65
|
import { defineAsyncComponent } from "vue";
|
|
66
66
|
|
|
67
67
|
withDefaults(
|
|
@@ -85,6 +85,8 @@ const guided = PROJECT_GUIDED_BLOCKS?.length ? defineAsyncComponent(() => import
|
|
|
85
85
|
const anchor = ref<HTMLElement | null>(null);
|
|
86
86
|
const choosing = ref(false);
|
|
87
87
|
const guiding = ref(false);
|
|
88
|
+
/** Sans droit de creer (licence), le bouton ne s'affiche pas. */
|
|
89
|
+
const canCreate = useProjectsCreateAccess();
|
|
88
90
|
|
|
89
91
|
function startFree() {
|
|
90
92
|
choosing.value = false;
|
|
@@ -19,7 +19,7 @@ import type { RmExportSheet } from "@tekkare/romulus/utils/export";
|
|
|
19
19
|
import type { RmDashboardModel, RmDashboardWidget, RmWidgetContext, RmWidgetKind } from "@tekkare/romulus/utils/dashboard";
|
|
20
20
|
import { rmAddableWidgets, rmNewWidgetId } from "@tekkare/romulus/utils/dashboard";
|
|
21
21
|
import type { ProjectInboxItem, ProjectSuggestion } from "../types/projects";
|
|
22
|
-
import type { GuidedBlockKey } from "../oip-guided/families";
|
|
22
|
+
import type { GuidedBlockKey, GuidedCountry } from "../oip-guided/families";
|
|
23
23
|
import { oipProjectBrands } from "../oip-drugs/dashboardWidgets";
|
|
24
24
|
|
|
25
25
|
type Lang = "fr" | "en";
|
|
@@ -57,6 +57,23 @@ export function useProjectsAccess(): Ref<boolean> | ComputedRef<boolean> {
|
|
|
57
57
|
return computed(() => true);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* L'utilisateur peut-il creer un projet (licence) ? Faux : pas de « Nouveau
|
|
62
|
+
* projet », ni dans la page, ni dans le rail, ni dans le bouton Projet d'une
|
|
63
|
+
* carte ; les projets partages restent lisibles.
|
|
64
|
+
*/
|
|
65
|
+
export function useProjectsCreateAccess(): Ref<boolean> | ComputedRef<boolean> {
|
|
66
|
+
return computed(() => true);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Les pays que l'utilisateur peut chercher dans la creation guidee (licence).
|
|
71
|
+
* `null` : tous ceux que la creation guidee connait.
|
|
72
|
+
*/
|
|
73
|
+
export function useGuidedCountries(): Ref<GuidedCountry[] | null> | ComputedRef<GuidedCountry[] | null> {
|
|
74
|
+
return computed(() => null);
|
|
75
|
+
}
|
|
76
|
+
|
|
60
77
|
/** Ce qui remplace les projets sans acces, avec la prop `feature` ({ fr, en }). */
|
|
61
78
|
export const PROJECTS_UPSELL: Component | null = null;
|
|
62
79
|
|