From f964df76b9b998f8a9e2ee14199d4452a10b77c6 Mon Sep 17 00:00:00 2001
From: r-dev
Date: Mon, 6 Apr 2026 18:54:21 +0200
Subject: [PATCH] feat(custom-fields) : messages warning champs obligatoires +
commandes make frontend
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Ajoute des messages visuels (warning + error) quand des champs perso
obligatoires ne sont pas renseignés sur les pages composant (création
et édition). Ajoute make test-front et make test-front-watch au Makefile.
Co-Authored-By: Claude Opus 4.6 (1M context)
---
frontend/app/pages/component/[id]/index.vue | 9 +++++++++
frontend/app/pages/component/create.vue | 9 +++++++++
makefile | 6 ++++++
3 files changed, 24 insertions(+)
diff --git a/frontend/app/pages/component/[id]/index.vue b/frontend/app/pages/component/[id]/index.vue
index 28aa96e..4b6ab91 100644
--- a/frontend/app/pages/component/[id]/index.vue
+++ b/frontend/app/pages/component/[id]/index.vue
@@ -408,6 +408,9 @@
+
+ Certains champs personnalisés sont obligatoires. Veuillez les renseigner avant de valider.
+
@@ -468,6 +471,9 @@
Enregistrer les modifications
+
+ Merci de renseigner tous les champs personnalisés obligatoires.
+
@@ -511,6 +517,7 @@ const {
constructeurLinks,
constructeurIdsFromForm,
customFieldInputs,
+ requiredCustomFieldsFilled,
historyFieldLabels,
canSubmit,
componentTypeList,
@@ -538,6 +545,8 @@ const {
formatStructurePreview,
} = useComponentEdit(String(route.params.id))
+const hasRequiredCustomFields = computed(() => customFieldInputs.value.some(f => f.required))
+
const submitEdition = async () => {
await _submitEdition()
if (!saving.value) {
diff --git a/frontend/app/pages/component/create.vue b/frontend/app/pages/component/create.vue
index 8b2e005..05f63b8 100644
--- a/frontend/app/pages/component/create.vue
+++ b/frontend/app/pages/component/create.vue
@@ -223,6 +223,9 @@
+
+ Certains champs personnalisés sont obligatoires. Veuillez les renseigner avant de valider.
+
+
+ Merci de renseigner tous les champs personnalisés obligatoires avant de créer le composant.
+
@@ -290,8 +296,11 @@ const {
resolveProductLabel,
resolveSubcomponentLabel,
submitCreation,
+ requiredCustomFieldsFilled,
} = useComponentCreate()
+const hasRequiredCustomFields = computed(() => customFieldInputs.value.some(f => f.required))
+
const entityTabs = computed(() => [
{ key: 'general', label: 'Général' },
{ key: 'structure', label: 'Structure' },
diff --git a/makefile b/makefile
index 9a1b57c..1493086 100644
--- a/makefile
+++ b/makefile
@@ -127,6 +127,12 @@ php-cs-fixer-allow-risky:
test:
$(EXEC_PHP) php -d memory_limit="512M" vendor/bin/phpunit $(FILES)
+test-front:
+ cd frontend && npx vitest run $(FILES)
+
+test-front-watch:
+ cd frontend && npx vitest --watch $(FILES)
+
test-setup:
$(SYMFONY_CONSOLE) doctrine:database:create --if-not-exists --env=test
$(SYMFONY_CONSOLE) doctrine:schema:update --force --env=test