@@ -72,6 +73,7 @@ import { getPagesForPagination } from "@/utils/components"
import CompanyDeclarationsTable from "./CompanyDeclarationsTable"
import ProgressSpinner from "@/components/ProgressSpinner"
import StatusFilter from "@/components/StatusFilter.vue"
+import HistoryAlert from "@/components/HistoryAlert.vue"
const route = useRoute()
const store = useRootStore()
diff --git a/frontend/src/views/DeclarationsHomePage/DeclarationsTable.vue b/frontend/src/views/DeclarationsHomePage/DeclarationsTable.vue
index 4972c05b0..ef3ffde57 100644
--- a/frontend/src/views/DeclarationsHomePage/DeclarationsTable.vue
+++ b/frontend/src/views/DeclarationsHomePage/DeclarationsTable.vue
@@ -23,7 +23,7 @@ const emit = defineEmits("open")
// Les données pour la table
const headers = computed(() => {
if (useShortTable.value) return ["Nom", "État"]
- return ["ID", "", "Nom du produit", "Entreprise", "Déclarant·e", "État", "Date de modification", ""]
+ return ["ID", "Nom du produit", "Entreprise", "Déclarant·e", "État", "Date de modification", ""]
})
const rows = computed(() => {
@@ -38,14 +38,15 @@ const rows = computed(() => {
return props.data.results.map((d) => ({
rowData: [
- d.id,
d.declaredInTeleicare
? {
component: "DsfrBadge",
- label: "Déclaration soumise sur Teleicare",
+ label: "issue de Teleicare",
type: "info",
+ small: true,
+ noIcon: true,
}
- : "",
+ : d.id,
{
component: "router-link",
text: d.name,
@@ -60,11 +61,13 @@ const rows = computed(() => {
d.author ? `${d.author.firstName} ${d.author.lastName}` : "",
getStatusTagForCell(d.status, true),
timeAgo(d.modificationDate),
- {
- component: "router-link",
- text: "Dupliquer",
- to: { name: "NewDeclaration", query: { duplicate: d.id } },
- },
+ d.declaredInTeleicare
+ ? ""
+ : {
+ component: "router-link",
+ text: "Dupliquer",
+ to: { name: "NewDeclaration", query: { duplicate: d.id } },
+ },
],
}))
})
diff --git a/frontend/src/views/DeclarationsHomePage/index.vue b/frontend/src/views/DeclarationsHomePage/index.vue
index dc525d781..4f0b166ed 100644
--- a/frontend/src/views/DeclarationsHomePage/index.vue
+++ b/frontend/src/views/DeclarationsHomePage/index.vue
@@ -13,16 +13,8 @@
@click="createNewDeclaration"
/>
-
-
-
+
+
@@ -93,6 +85,7 @@ import { storeToRefs } from "pinia"
import { getPagesForPagination } from "@/utils/components"
import PaginationSizeSelect from "@/components/PaginationSizeSelect"
import StatusFilter from "@/components/StatusFilter"
+import HistoryAlert from "@/components/HistoryAlert.vue"
const store = useRootStore()
const { loggedUser } = storeToRefs(store)
diff --git a/frontend/src/views/InstructionDeclarationsPage/InstructionDeclarationsTable.vue b/frontend/src/views/InstructionDeclarationsPage/InstructionDeclarationsTable.vue
index ae832bbba..c85a89979 100644
--- a/frontend/src/views/InstructionDeclarationsPage/InstructionDeclarationsTable.vue
+++ b/frontend/src/views/InstructionDeclarationsPage/InstructionDeclarationsTable.vue
@@ -33,7 +33,15 @@ const rows = computed(() =>
component: CircleIndicators,
declaration: x,
},
- x.id,
+ x.declaredInTeleicare
+ ? {
+ component: "DsfrBadge",
+ label: "issue de Teleicare",
+ type: "info",
+ small: true,
+ noIcon: true,
+ }
+ : x.id,
{
component: "router-link",
text: x.name,
diff --git a/frontend/src/views/InstructionPage/index.vue b/frontend/src/views/InstructionPage/index.vue
index e2b71270f..97a74b78f 100644
--- a/frontend/src/views/InstructionPage/index.vue
+++ b/frontend/src/views/InstructionPage/index.vue
@@ -27,11 +27,25 @@
+
+ L'import de l'historique est en cours. Les informations suivantes arriveront bientôt :
+
+ - la composition
+ - les entreprises mandantes s'il y en a
+ - l'étiquettage
+ - l'attestation
+
+
-
+
+ L'import de l'historique est en cours. Les informations suivantes arriveront bientôt :
+
+ - la composition
+ - les entreprises mandantes s'il y en a
+ - l'étiquettage
+ - l'attestation
+
+
+
@@ -28,7 +48,7 @@
From b1a36bc608189ef5715803e77ccf272363c21140 Mon Sep 17 00:00:00 2001
From: Alejandro MG
Date: Tue, 14 Jan 2025 22:36:06 +0100
Subject: [PATCH 14/40] Adds necessary fields for populations and conditions
---
api/serializers/condition.py | 4 +
api/serializers/population.py | 2 +
data/admin/condition.py | 3 +
data/admin/population.py | 1 +
data/models/condition.py | 16 ++++
data/models/population.py | 13 ++++
frontend/src/utils/mappings.js | 8 ++
.../PopulationsCheckboxes.vue | 73 +++++++++++++++++++
.../src/views/ProducerFormPage/ProductTab.vue | 27 +------
9 files changed, 123 insertions(+), 24 deletions(-)
create mode 100644 frontend/src/views/ProducerFormPage/PopulationsCheckboxes.vue
diff --git a/api/serializers/condition.py b/api/serializers/condition.py
index 040979204..7e0de7817 100644
--- a/api/serializers/condition.py
+++ b/api/serializers/condition.py
@@ -1,4 +1,5 @@
from rest_framework import serializers
+
from data.models import Condition
@@ -9,5 +10,8 @@ class Meta:
"name",
"id",
"name_en",
+ "min_age",
+ "max_age",
+ "category",
]
read_only_fields = fields
diff --git a/api/serializers/population.py b/api/serializers/population.py
index 2cfacb300..b0bec33b6 100644
--- a/api/serializers/population.py
+++ b/api/serializers/population.py
@@ -1,4 +1,5 @@
from rest_framework import serializers
+
from data.models import Population
@@ -11,5 +12,6 @@ class Meta:
"is_obsolete",
"min_age",
"max_age",
+ "category",
]
read_only_fields = fields
diff --git a/data/admin/condition.py b/data/admin/condition.py
index 3403f0036..361a3b8a9 100644
--- a/data/admin/condition.py
+++ b/data/admin/condition.py
@@ -17,9 +17,12 @@ class ConditionAdmin(admin.ModelAdmin):
fields = [
"name",
"ca_name",
+ "category",
"siccrf_name_en",
"is_obsolete",
"ca_is_obsolete",
+ "min_age",
+ "max_age",
"creation_date",
"modification_date",
]
diff --git a/data/admin/population.py b/data/admin/population.py
index 23abb32bf..b4c479da8 100644
--- a/data/admin/population.py
+++ b/data/admin/population.py
@@ -17,6 +17,7 @@ class PopulationAdmin(admin.ModelAdmin):
fields = [
"name",
"ca_name",
+ "category",
"is_obsolete",
"ca_is_obsolete",
"is_defined_by_anses",
diff --git a/data/models/condition.py b/data/models/condition.py
index 4b24ba07b..f611d214a 100644
--- a/data/models/condition.py
+++ b/data/models/condition.py
@@ -1,15 +1,31 @@
from django.db import models
+
from simple_history.models import HistoricalRecords
from .abstract_models import CommonModel
class Condition(CommonModel):
+ class ConditionCategory(models.TextChoices):
+ AGE = "AGE", "âge"
+ MEDICAL = "MEDICAL", "conditions médicales spécifiques"
+ PREGNANCY = "PREGNANCY", "grossesse et allaitement"
+ MEDICAMENTS = "MEDICAMENTS", "interactions médicamenteuses"
+ OTHER = "OTHER", "autres"
+
class Meta:
verbose_name = "condition de santé / facteurs de risque"
siccrf_name_en = models.TextField(blank=True, verbose_name="nom en anglais selon la base SICCRF")
+ min_age = models.FloatField(blank=True, null=True, default=None)
+ max_age = models.FloatField(blank=True, null=True, default=None)
history = HistoricalRecords(inherit=True, excluded_fields=["name", "is_obsolete"])
+ category = models.CharField(
+ max_length=50,
+ choices=ConditionCategory.choices,
+ default=ConditionCategory.OTHER,
+ verbose_name="categorie",
+ )
@property
def name_en(self):
diff --git a/data/models/population.py b/data/models/population.py
index 05561cbdf..5a747f4f9 100644
--- a/data/models/population.py
+++ b/data/models/population.py
@@ -1,10 +1,17 @@
from django.db import models
+
from simple_history.models import HistoricalRecords
from .abstract_models import CommonModel
class Population(CommonModel):
+ class PopulationCategory(models.TextChoices):
+ AGE = "AGE", "âge"
+ MEDICAL = "MEDICAL", "conditions médicales spécifiques"
+ PREGNANCY = "PREGNANCY", "grossesse et allaitement"
+ OTHER = "OTHER", "autres"
+
class Meta:
verbose_name = "Population cible"
verbose_name_plural = "Populations cibles"
@@ -13,3 +20,9 @@ class Meta:
max_age = models.FloatField(blank=True, null=True, default=None)
is_defined_by_anses = models.BooleanField(default=False)
history = HistoricalRecords(inherit=True, excluded_fields=["name", "is_obsolete"])
+ category = models.CharField(
+ max_length=50,
+ choices=PopulationCategory.choices,
+ default=PopulationCategory.OTHER,
+ verbose_name="categorie",
+ )
diff --git a/frontend/src/utils/mappings.js b/frontend/src/utils/mappings.js
index 38c112890..19771dd85 100644
--- a/frontend/src/utils/mappings.js
+++ b/frontend/src/utils/mappings.js
@@ -254,6 +254,14 @@ export const authorizationModesMapping = {
EU: "Autorisé dans un État membre de l'UE ou EEE",
}
+export const populationCategoriesMapping = {
+ AGE: "Âge",
+ MEDICAL: "Conditions médicales spécifiques",
+ PREGNANCY: "Grossesse et allaitement",
+ MEDICAMENTS: "Interactions médicamenteuses",
+ OTHER: "Autres",
+}
+
export const getAuthorizationModeInFrench = (type) => {
return authorizationModesMapping[type] || null
}
diff --git a/frontend/src/views/ProducerFormPage/PopulationsCheckboxes.vue b/frontend/src/views/ProducerFormPage/PopulationsCheckboxes.vue
new file mode 100644
index 000000000..a0464d356
--- /dev/null
+++ b/frontend/src/views/ProducerFormPage/PopulationsCheckboxes.vue
@@ -0,0 +1,73 @@
+
+
+
+
{{ section.title }}
+
+
+
+
+
+
diff --git a/frontend/src/views/ProducerFormPage/ProductTab.vue b/frontend/src/views/ProducerFormPage/ProductTab.vue
index 444475f2b..c4079a45c 100644
--- a/frontend/src/views/ProducerFormPage/ProductTab.vue
+++ b/frontend/src/views/ProducerFormPage/ProductTab.vue
@@ -143,23 +143,7 @@
-
-
-
+
{
- const checkboxColumnNumbers = {
- sm: 1,
- md: 2,
- lg: 2,
- xl: 3,
- }
+ const checkboxColumnNumbers = { sm: 1, md: 2, lg: 2, xl: 3 }
numberOfColumns.value = checkboxColumnNumbers[getCurrentBreakpoint()] || 1
},
{ immediate: true }
)
-const orderedPopulations = computed(() => transformArrayByColumn(populations.value, numberOfColumns.value))
const orderedConditions = computed(() => transformArrayByColumn(conditions.value, numberOfColumns.value))
const orderedEffects = computed(() => transformArrayByColumn(effects.value, numberOfColumns.value))
From e42366b41f8a2feeb8f58db5e5fa1c7f845f44d0 Mon Sep 17 00:00:00 2001
From: hfroot <9282816+hfroot@users.noreply.github.com>
Date: Wed, 15 Jan 2025 14:23:26 +0100
Subject: [PATCH 15/40] Apply suggestions from code review
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Alejandro M Guillén
---
api/tests/test_declaration.py | 2 +-
frontend/src/views/DeclaredElementPage/ManageSynonyms.vue | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/api/tests/test_declaration.py b/api/tests/test_declaration.py
index 44ac78e8f..7c7df26e7 100644
--- a/api/tests/test_declaration.py
+++ b/api/tests/test_declaration.py
@@ -1904,7 +1904,7 @@ def test_cannot_replace_element_different_type(self):
def test_can_add_synonym_on_replace(self):
"""
C'est possible d'envoyer une liste avec un nouvel element pour
- ajouter une synonyme et laisser des synonymes existantes non-modifiées
+ ajouter un synonyme et laisser des synonymes existantes non-modifiées
"""
InstructionRoleFactory(user=authenticate.user)
diff --git a/frontend/src/views/DeclaredElementPage/ManageSynonyms.vue b/frontend/src/views/DeclaredElementPage/ManageSynonyms.vue
index e1cafa86c..970b00c5d 100644
--- a/frontend/src/views/DeclaredElementPage/ManageSynonyms.vue
+++ b/frontend/src/views/DeclaredElementPage/ManageSynonyms.vue
@@ -1,14 +1,14 @@
-
Les synonymes existantes :
+
Les synonymes existants :
From 20d6cbf1b881b8e1d9183b1e4a5a6362284ce74d Mon Sep 17 00:00:00 2001
From: Helen Root
Date: Wed, 15 Jan 2025 14:26:42 +0100
Subject: [PATCH 16/40] Rename file
---
.../{ManageSynonyms.vue => ElementSynonyms.vue} | 1 -
frontend/src/views/DeclaredElementPage/index.vue | 4 ++--
2 files changed, 2 insertions(+), 3 deletions(-)
rename frontend/src/views/DeclaredElementPage/{ManageSynonyms.vue => ElementSynonyms.vue} (94%)
diff --git a/frontend/src/views/DeclaredElementPage/ManageSynonyms.vue b/frontend/src/views/DeclaredElementPage/ElementSynonyms.vue
similarity index 94%
rename from frontend/src/views/DeclaredElementPage/ManageSynonyms.vue
rename to frontend/src/views/DeclaredElementPage/ElementSynonyms.vue
index 970b00c5d..69abe593b 100644
--- a/frontend/src/views/DeclaredElementPage/ManageSynonyms.vue
+++ b/frontend/src/views/DeclaredElementPage/ElementSynonyms.vue
@@ -17,7 +17,6 @@
From 9381d3cbcca23aa1c136e0d3e64d074ce02277b7 Mon Sep 17 00:00:00 2001
From: Helen Root
Date: Wed, 15 Jan 2025 14:45:28 +0100
Subject: [PATCH 18/40] Remove unnecessary if - will always have at least empty
array for synonyms
---
frontend/src/views/DeclaredElementPage/index.vue | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/frontend/src/views/DeclaredElementPage/index.vue b/frontend/src/views/DeclaredElementPage/index.vue
index 32112d5c3..1508fe611 100644
--- a/frontend/src/views/DeclaredElementPage/index.vue
+++ b/frontend/src/views/DeclaredElementPage/index.vue
@@ -100,9 +100,7 @@ const openModal = (type) => {
const replacement = ref()
const synonyms = ref()
watch(replacement, () => {
- if (replacement.value.synonyms) {
- synonyms.value = JSON.parse(JSON.stringify(replacement.value.synonyms)) // initialise synonyms that might be updated
- }
+ synonyms.value = JSON.parse(JSON.stringify(replacement.value.synonyms)) // initialise synonyms that might be updated
})
const cannotReplace = computed(() => replacement.value?.objectType !== element.value.type)
From 1cb720b7f11843ba4abf5896dcd8fcd0ef9a7531 Mon Sep 17 00:00:00 2001
From: Perrine Letellier
Date: Thu, 16 Jan 2025 11:51:59 +0100
Subject: [PATCH 19/40] avoid comments on historic declarations
---
.../components/DeclarationSummary/index.vue | 187 +++++++++---------
frontend/src/views/InstructionPage/index.vue | 5 +-
frontend/src/views/ProducerFormPage/index.vue | 8 +-
frontend/src/views/VisaPage/index.vue | 13 +-
4 files changed, 114 insertions(+), 99 deletions(-)
diff --git a/frontend/src/components/DeclarationSummary/index.vue b/frontend/src/components/DeclarationSummary/index.vue
index 3ec80eab0..4074503e6 100644
--- a/frontend/src/components/DeclarationSummary/index.vue
+++ b/frontend/src/components/DeclarationSummary/index.vue
@@ -21,99 +21,102 @@
-
-
- Composition
-
-
-
-
-
-
-
-
-
-
-
-
-
Substances contenues dans la composition :
-
- Les ingrédients suivants, ajoutés pour remplacer une demande, rajoutent des substances dans la composition.
-
- Veuillez vérifier que les doses totales des substances restent pertinentes. Si besoin, renvoyez la déclaration
- vers le déclarant pour les mettre à jour.
-
-
- -
- {{ i.element.name }}
-
-
-
-
-
-
- Adresse sur l'étiquetage
-
-
-
-
-
- Pièces jointes
-
-
-
-
+
+ Composition
+
+
+
+
+
+
+
+
+
+
+
+
+ Substances contenues dans la composition :
+
+
+ Les ingrédients suivants, ajoutés pour remplacer une demande, rajoutent des substances dans la composition.
+
+
+ Veuillez vérifier que les doses totales des substances restent pertinentes. Si besoin, renvoyez la déclaration
+ vers le déclarant pour les mettre à jour.
+
+
+ -
+ {{ i.element.name }}
+
+
+
+
+
+
+ Adresse sur l'étiquetage
+
+
+
+
+
+ Pièces jointes
+
+
+
+
+
diff --git a/frontend/src/views/InstructionPage/index.vue b/frontend/src/views/InstructionPage/index.vue
index 97a74b78f..0131b6472 100644
--- a/frontend/src/views/InstructionPage/index.vue
+++ b/frontend/src/views/InstructionPage/index.vue
@@ -87,7 +87,7 @@
@forward="selectedTabIndex += 1"
:removeSaveLabel="true"
>
-
+
Notes à destination de l'administration
@@ -217,7 +217,8 @@ onMounted(async () => {
// Tab management
const components = computed(() => {
- const baseComponents = [IdentityTab, DeclarationSummary, HistoryTab]
+ const baseComponents = [IdentityTab, DeclarationSummary]
+ if (!declaration.value.declaredInTeleicare) baseComponents.push(HistoryTab)
if (canInstruct.value) baseComponents.push(DecisionTab)
return baseComponents
})
diff --git a/frontend/src/views/ProducerFormPage/index.vue b/frontend/src/views/ProducerFormPage/index.vue
index cc61e298d..bbf977005 100644
--- a/frontend/src/views/ProducerFormPage/index.vue
+++ b/frontend/src/views/ProducerFormPage/index.vue
@@ -219,8 +219,12 @@ const readonly = computed(
payload.value.status !== "OBJECTION"
)
-const showHistory = computed(() => readonly.value || (!isNewDeclaration.value && payload.value.status !== "DRAFT"))
-const showWithdrawal = computed(() => payload.value.status === "AUTHORIZED")
+const showHistory = computed(
+ () =>
+ !payload.value.declaredInTeleicare &&
+ (readonly.value || (!isNewDeclaration.value && payload.value.status !== "DRAFT"))
+)
+const showWithdrawal = computed(() => !payload.value.declaredInTeleicare && payload.value.status === "AUTHORIZED")
const components = computed(() => {
const baseComponents = readonly.value ? [SummaryTab] : [ProductTab, CompositionTab, AttachmentTab, SummaryTab]
diff --git a/frontend/src/views/VisaPage/index.vue b/frontend/src/views/VisaPage/index.vue
index b0128e9d8..3144f279b 100644
--- a/frontend/src/views/VisaPage/index.vue
+++ b/frontend/src/views/VisaPage/index.vue
@@ -21,7 +21,13 @@
Vous pouvez vous assigner cette déclaration pour visa / signature
-
+
-
+
Notes à destination de l'administration
@@ -194,7 +200,8 @@ const saveComment = useDebounceFn(async () => {
// Tab management
const components = computed(() => {
- const baseComponents = [IdentityTab, DeclarationSummary, HistoryTab]
+ const baseComponents = [IdentityTab, DeclarationSummary]
+ if (!declaration.value.declaredInTeleicare) baseComponents.push(HistoryTab)
if (canInstruct.value) baseComponents.push(VisaValidationTab)
return baseComponents
})
From 3c2669b78ed3a54aa30b70aff94c634d26a3a6f2 Mon Sep 17 00:00:00 2001
From: Alejandro MG
Date: Thu, 16 Jan 2025 12:03:07 +0100
Subject: [PATCH 20/40] =?UTF-8?q?Divise=20les=20populations=20et=20conditi?=
=?UTF-8?q?ons=20en=20sections=20diff=C3=A9rentes?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...ion_category_condition_max_age_and_more.py | 53 ++++++++++++++++
data/models/population.py | 1 -
frontend/src/utils/forms.js | 14 +++--
frontend/src/utils/mappings.js | 20 ++++--
frontend/src/utils/screen.js | 20 ++++--
.../ProducerFormPage/ConditionsCheckboxes.vue | 63 +++++++++++++++++++
.../PopulationsCheckboxes.vue | 60 ++++++------------
.../src/views/ProducerFormPage/ProductTab.vue | 43 ++-----------
8 files changed, 181 insertions(+), 93 deletions(-)
create mode 100644 data/migrations/0116_condition_category_condition_max_age_and_more.py
create mode 100644 frontend/src/views/ProducerFormPage/ConditionsCheckboxes.vue
diff --git a/data/migrations/0116_condition_category_condition_max_age_and_more.py b/data/migrations/0116_condition_category_condition_max_age_and_more.py
new file mode 100644
index 000000000..8fcd1a52c
--- /dev/null
+++ b/data/migrations/0116_condition_category_condition_max_age_and_more.py
@@ -0,0 +1,53 @@
+# Generated by Django 5.1.4 on 2025-01-16 09:58
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('data', '0115_alter_blogpost_content'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='condition',
+ name='category',
+ field=models.CharField(choices=[('AGE', 'âge'), ('MEDICAL', 'conditions médicales spécifiques'), ('PREGNANCY', 'grossesse et allaitement'), ('MEDICAMENTS', 'interactions médicamenteuses'), ('OTHER', 'autres')], default='OTHER', max_length=50, verbose_name='categorie'),
+ ),
+ migrations.AddField(
+ model_name='condition',
+ name='max_age',
+ field=models.FloatField(blank=True, default=None, null=True),
+ ),
+ migrations.AddField(
+ model_name='condition',
+ name='min_age',
+ field=models.FloatField(blank=True, default=None, null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalcondition',
+ name='category',
+ field=models.CharField(choices=[('AGE', 'âge'), ('MEDICAL', 'conditions médicales spécifiques'), ('PREGNANCY', 'grossesse et allaitement'), ('MEDICAMENTS', 'interactions médicamenteuses'), ('OTHER', 'autres')], default='OTHER', max_length=50, verbose_name='categorie'),
+ ),
+ migrations.AddField(
+ model_name='historicalcondition',
+ name='max_age',
+ field=models.FloatField(blank=True, default=None, null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalcondition',
+ name='min_age',
+ field=models.FloatField(blank=True, default=None, null=True),
+ ),
+ migrations.AddField(
+ model_name='historicalpopulation',
+ name='category',
+ field=models.CharField(choices=[('AGE', 'âge'), ('PREGNANCY', 'grossesse et allaitement'), ('OTHER', 'autres')], default='OTHER', max_length=50, verbose_name='categorie'),
+ ),
+ migrations.AddField(
+ model_name='population',
+ name='category',
+ field=models.CharField(choices=[('AGE', 'âge'), ('PREGNANCY', 'grossesse et allaitement'), ('OTHER', 'autres')], default='OTHER', max_length=50, verbose_name='categorie'),
+ ),
+ ]
diff --git a/data/models/population.py b/data/models/population.py
index 5a747f4f9..83e98c935 100644
--- a/data/models/population.py
+++ b/data/models/population.py
@@ -8,7 +8,6 @@
class Population(CommonModel):
class PopulationCategory(models.TextChoices):
AGE = "AGE", "âge"
- MEDICAL = "MEDICAL", "conditions médicales spécifiques"
PREGNANCY = "PREGNANCY", "grossesse et allaitement"
OTHER = "OTHER", "autres"
diff --git a/frontend/src/utils/forms.js b/frontend/src/utils/forms.js
index 0565dd106..172629eb9 100644
--- a/frontend/src/utils/forms.js
+++ b/frontend/src/utils/forms.js
@@ -43,13 +43,19 @@ export const transformArrayByColumn = (arr, numberOfColumns) => {
Utile pour l'affichage des checkboxes dans des grilles de colonnes.
*/
const result = []
- const numberOfRows = Math.ceil(arr.length / numberOfColumns)
+ const fullRows = Math.floor(arr.length / numberOfColumns) // Les rangées pleines
+ const remainingItems = arr.length % numberOfColumns // Les éléments qui resterons dans une dernière rangée
- for (let row = 0; row < numberOfRows; row++) {
+ const numRows = remainingItems > 0 ? fullRows + 1 : fullRows
+
+ for (let row = 0; row < numRows; row++) {
for (let col = 0; col < numberOfColumns; col++) {
- const index = col * numberOfRows + row
- if (index < arr.length) result.push(arr[index])
+ const index = col * fullRows + Math.min(col, remainingItems) + row
+ if (row < fullRows || (row === fullRows && col < remainingItems)) result.push(arr[index])
}
}
+
return result
}
+
+export const checkboxColumnNumbers = { sm: 1, md: 2, lg: 2, xl: 3 }
diff --git a/frontend/src/utils/mappings.js b/frontend/src/utils/mappings.js
index 19771dd85..4d9ea11ac 100644
--- a/frontend/src/utils/mappings.js
+++ b/frontend/src/utils/mappings.js
@@ -255,11 +255,21 @@ export const authorizationModesMapping = {
}
export const populationCategoriesMapping = {
- AGE: "Âge",
- MEDICAL: "Conditions médicales spécifiques",
- PREGNANCY: "Grossesse et allaitement",
- MEDICAMENTS: "Interactions médicamenteuses",
- OTHER: "Autres",
+ AGE: {
+ label: "Âge",
+ },
+ MEDICAL: {
+ label: "Conditions médicales spécifiques",
+ },
+ PREGNANCY: {
+ label: "Grossesse et allaitement",
+ },
+ MEDICAMENTS: {
+ label: "Interactions médicamenteuses",
+ },
+ OTHER: {
+ label: "Autres",
+ },
}
export const getAuthorizationModeInFrench = (type) => {
diff --git a/frontend/src/utils/screen.js b/frontend/src/utils/screen.js
index cc37847cd..aedb9d486 100644
--- a/frontend/src/utils/screen.js
+++ b/frontend/src/utils/screen.js
@@ -1,11 +1,21 @@
import tailwindConfig from "/tailwind.config.js"
+import { ref, watch } from "vue"
+import { useWindowSize } from "@vueuse/core"
-export const getCurrentBreakpoint = () => {
- /*
- Retourne le breakpoint actif depuis notre config tailwind.
- */
+const { width } = useWindowSize()
+
+const getCurrentBreakpoint = () => {
const screensArray = Object.entries(tailwindConfig.theme.screens).map((x) => [x[0], parseInt(x[1].replace("px", ""))])
const sortedScreens = screensArray.sort((a, b) => a[1] - b[1])
- for (const [key, value] of sortedScreens) if (window.innerWidth < value) return key
+ for (const [key, value] of sortedScreens) if (width.value < value) return key
return null
}
+
+export const useCurrentBreakpoint = () => {
+ /*
+ Retourne une ref vers le breakpoint actif depuis notre config tailwind.
+ */
+ const breakpoint = ref(null)
+ watch(width, () => (breakpoint.value = getCurrentBreakpoint()), { immediate: true })
+ return breakpoint
+}
diff --git a/frontend/src/views/ProducerFormPage/ConditionsCheckboxes.vue b/frontend/src/views/ProducerFormPage/ConditionsCheckboxes.vue
new file mode 100644
index 000000000..525097284
--- /dev/null
+++ b/frontend/src/views/ProducerFormPage/ConditionsCheckboxes.vue
@@ -0,0 +1,63 @@
+
+
+
+
{{ section.title }}
+
+
+
+
+
+
diff --git a/frontend/src/views/ProducerFormPage/PopulationsCheckboxes.vue b/frontend/src/views/ProducerFormPage/PopulationsCheckboxes.vue
index a0464d356..3ebd2d4ff 100644
--- a/frontend/src/views/ProducerFormPage/PopulationsCheckboxes.vue
+++ b/frontend/src/views/ProducerFormPage/PopulationsCheckboxes.vue
@@ -1,11 +1,11 @@
-