Skip to content

Commit

Permalink
fix: some typo +remove a type
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminDNUM committed Sep 25, 2024
1 parent 3d37e91 commit eabf658
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 41 deletions.
4 changes: 4 additions & 0 deletions packages/backend/src/helpers/eig.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,7 @@ module.exports.mustMarkAsRead = (territoireCode, eig) => {
))
);
};

module.exports.isTypeActive = (type) => {
return ![Types[Categorie.VICTIMES].VIOLS].includes(type);
};
23 changes: 18 additions & 5 deletions packages/backend/src/schemas/eig.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
const yup = require("yup");
const { UpdateTypes, Types, Categorie } = require("../helpers/eig");
const {
UpdateTypes,
Types,
Categorie,
isTypeActive,
} = require("../helpers/eig");
const personne = require("./parts/personne.js");

const selectionSejourSchema = (dateDebut, dateFin) => ({
Expand All @@ -26,10 +31,18 @@ const eigTypeBase = yup
.string()
.oneOf(
[
...Object.values(Types[Categorie.VICTIMES]),
...Object.values(Types[Categorie.SECURITE]),
...Object.values(Types[Categorie.SANTE]),
...Object.values(Types[Categorie.FONCTIONNEMENT_ORGANISME]),
...Object.values(Types[Categorie.VICTIMES]).filter((type) =>
isTypeActive(type),
),
...Object.values(Types[Categorie.SECURITE]).filter((type) =>
isTypeActive(type),
),
...Object.values(Types[Categorie.SANTE]).filter((type) =>
isTypeActive(type),
),
...Object.values(Types[Categorie.FONCTIONNEMENT_ORGANISME]).filter(
(type) => isTypeActive(type),
),
],
"la valeur insérée ne fait pas partie de la liste des possibles",
)
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/utils/mail.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ module.exports = {
{
p: [
`Bonjour`,
`L’organisme ${orgName}, dont l’agrément vacances adaptées organisées (VAO) a été délivré dans votre région, a déclaré un évènement indésirable grave qui s’est produit le ${dayjs(eig.date).format("DD/MM/YYYY")}, lors d’un séjour organisé dans la commune de ${communeName} le département de ${departementName}.`,
`L’organisme ${orgName}, dont l’agrément vacances adaptées organisées (VAO) a été délivré dans votre région, a déclaré un évènement indésirable grave qui s’est produit le ${dayjs(eig.date).format("DD/MM/YYYY")}, lors d’un séjour organisé dans la commune de ${communeName} dans le département de ${departementName}.`,
`Référence de la déclaration de séjour : ${eig.idFonctionnelle} du ${dayjs(declarationSejour.dateDebut).format("DD/MM/YYYY")} au ${dayjs(declarationSejour.dateFin).format("DD/MM/YYYY")}`,
`Le type d'évènement déclaré est :`,
generateTypes(eig),
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend-bo/src/pages/eig/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ const headers = [
},
{
column: "dateDepot",
text: "Dates de depot",
text: "Dates de dépôt",
format: (value) => dayjs(value.dateDepot).format("DD/MM/YYYY"),
sort: true,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend-usagers/src/components/EIG/Recap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<article>{{ eigStore.currentEig.dispositionInformations }}</article>
<hr />
<article>
La déclaration de cet EIG sera envoyé à :
La déclaration de cet incident sera envoyé à :
<h6 class="fr-mb-0">DDETS</h6>
<ul class="fr-mt-0 fr-mb-4w">
<li v-for="email in eigStore.currentEig.emailsDDETS" :key="email">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<h6>Renseignements generaux</h6>
<h6>Renseignements généraux</h6>
<dsfr-alert class="fr-mb-6v">
<Summary :eig="eigStore.currentEig" env="USAGER" />
</dsfr-alert>
<fieldset class="fr-fieldset">
<h6>Personnel présent lors de événements</h6>
<dsfr-fieldset>
<h6>Personnel présent lors de l'événement</h6>
<div class="fr-fieldset__element">
<div class="wrapper">
<div class="parent">
Expand Down Expand Up @@ -44,8 +44,13 @@
</div>
</div>
</div>
<h6>Les faits</h6>
<div class="fr-fieldset__element">
</dsfr-fieldset>
<h6>Les faits</h6>
<dsfr-alert type="warning" class="fr-mb-4w"
>Merci de ne pas mettre d'éléments nominatifs
</dsfr-alert>
<div class="fr-container fr-my-2v">
<dsfr-fieldset>
<DsfrInputGroup
name="deroulement"
:required="true"
Expand All @@ -58,8 +63,8 @@
:is-valid="deroulementMeta"
@update:model-value="deroulementChange"
/>
</div>
<div class="fr-fieldset__element">
</dsfr-fieldset>
<dsfr-fieldset>
<DsfrInputGroup
name="dispositionRemediation"
:required="true"
Expand All @@ -72,8 +77,8 @@
:is-valid="dispositionRemediationMeta"
@update:model-value="dispositionRemediationChange"
/>
</div>
<div class="fr-fieldset__element">
</dsfr-fieldset>
<dsfr-fieldset>
<DsfrInputGroup
name="dispositionVictimes"
:required="true"
Expand All @@ -86,8 +91,8 @@
:is-valid="dispositionVictimesMeta"
@update:model-value="dispositionVictimesChange"
/>
</div>
<div class="fr-fieldset__element">
</dsfr-fieldset>
<dsfr-fieldset>
<DsfrInputGroup
name="dispositionInformations"
:required="true"
Expand All @@ -100,8 +105,8 @@
:is-valid="dispositionInformationsMeta"
@update:model-value="dispositionInformationsChange"
/>
</div>
</fieldset>
</dsfr-fieldset>
</div>
<UtilsNavigationButtons
:show-buttons="props.showButtons"
:is-downloading="props.isDownloading"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<div class="fr-fieldset__element">
<DsfrSelect
v-if="!!selectedDemande"
label="Sélection du département ou a eu lieu l'EIG"
label="Sélection du département a eu lieu l'incident"
name="departements"
:close-on-select="true"
:options="departementsOptions"
Expand Down
41 changes: 25 additions & 16 deletions packages/frontend-usagers/src/components/EIG/Type.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ import { useField, useForm } from "vee-validate";
import * as yup from "yup";
import { eigModel, eigSchema, Summary } from "@vao/shared";
import { mapEigToLabel } from "@vao/shared/src/utils/eigUtils";
import { isTypeActive } from "@vao/shared/src/models";
const emit = defineEmits(["previous", "next", "update"]);
Expand Down Expand Up @@ -242,28 +243,36 @@ const {
const types = {
[eigModel.Categorie.VICTIMES]: Object.values(
eigModel.Types[eigModel.Categorie.VICTIMES],
).map((t) => ({
label: mapEigToLabel[t],
name: t,
})),
)
.filter((t) => isTypeActive(t))
.map((t) => ({
label: mapEigToLabel[t],
name: t,
})),
[eigModel.Categorie.SANTE]: Object.values(
eigModel.Types[eigModel.Categorie.SANTE],
).map((t) => ({
label: mapEigToLabel[t],
name: t,
})),
)
.filter((t) => isTypeActive(t))
.map((t) => ({
label: mapEigToLabel[t],
name: t,
})),
[eigModel.Categorie.SECURITE]: Object.values(
eigModel.Types[eigModel.Categorie.SECURITE],
).map((t) => ({
label: mapEigToLabel[t],
name: t,
})),
)
.filter((t) => isTypeActive(t))
.map((t) => ({
label: mapEigToLabel[t],
name: t,
})),
[eigModel.Categorie.FONCTIONNEMENT_ORGANISME]: Object.values(
eigModel.Types[eigModel.Categorie.FONCTIONNEMENT_ORGANISME],
).map((t) => ({
label: mapEigToLabel[t],
name: t,
})),
)
.filter((t) => isTypeActive(t))
.map((t) => ({
label: mapEigToLabel[t],
name: t,
})),
};
const expandedIndex = ref(-1);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.up = function (knex) {
return knex.raw(
`
ALTER TABLE FRONT.EIG_TYPE
ADD COLUMN IS_ACTIVE BOOLEAN DEFAULT TRUE ;
UPDATE FRONT.EIG_TYPE
SET IS_ACTIVE = FALSE
WHERE TYPE = 'VIOLS' ;
`,
);
};

/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.down = function (knex) {
return knex.raw(`
ALTER TABLE FRONT.EIG_TYPE
DROP COLUMN IS_ACTIVE ;
`);
};
8 changes: 6 additions & 2 deletions packages/shared/src/components/eig/Summary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const currentEigValues = computed(() => [
value: props.eig?.idFonctionnelle ?? "",
},
{
label: "Département ou a eu lieu l'EIG",
label: "Département a eu lieu l'incident",
value: props.eig?.departement ?? "",
},
{
Expand Down Expand Up @@ -68,12 +68,16 @@ const currentEigValues = computed(() => [
value: props.eig?.adresses ?? [],
},
{
label: "type d'événements",
label: "type d'événement",
value:
props.eig?.types?.map(
(t) => mapEigToLabel[t.type] + (t.precision ? " : " + t.precision : ""),
) ?? [],
},
{
label: "Personnel présent lors de l'évènement",
value: props.eig?.personnel?.map((p) => `${p.prenom} ${p.nom}`) ?? [],
},
]);
</script>
Expand Down
6 changes: 5 additions & 1 deletion packages/shared/src/models/eig.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,8 @@ const UpdateTypes = {
EMAIL_AUTRES_DESTINATAIRES: "EMAIL_AUTRES_DESTINATAIRES",
};

export { Statuts, Categorie, Types, UpdateTypes };
const isTypeActive = (type) => {
return ![Types[Categorie.VICTIMES].VIOLS].includes(type);
};

export { Statuts, Categorie, Types, UpdateTypes, isTypeActive };

0 comments on commit eabf658

Please sign in to comment.