From f47e4b089247da28a511a60e80a1d3614088900f Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Sat, 25 Nov 2023 11:57:09 +0100 Subject: [PATCH] =?UTF-8?q?V=C3=A9rification=20de=20la=20possibilit=C3=A9?= =?UTF-8?q?=20de=20supprimer=20un=20type=20de=20mouvement=20dans=20la=20co?= =?UTF-8?q?nfig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.html | 54 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/config.html b/config.html index 2b5fd90..ae1b6d4 100644 --- a/config.html +++ b/config.html @@ -48,20 +48,43 @@ {{#foreach from=$module.config.inputNature item="input_field"}} + + {{* Vérifier si la suppression de ce type d'entrée est possible *}} + {{:assign suppr=true}} + {{#load type="movement" where="$$.inputNature = :libelle" :libelle=$input_field.label}} + {{:assign suppr=false}} + {{/load}} + {{:input type="text" name="input_fields[label][]" default=$input_field.label}} {{:input type="select" name="input_fields[type][]" options=$types_entrees default=$input_field.type required=true default_empty="— Choisir un type —"}} - {{:button label="Retirer" shape="minus" onclick="this.parentNode.parentNode.remove();"}} + {{if $suppr}} + {{:button label="Supprimer" shape="minus" onclick="this.parentNode.parentNode.remove();"}} + {{else}} + {{:button label="Supprimer" shape="minus" disabled=true}} + {{/if}} {{else}} + {{* pas de config enregistrée : utiliser les valeurs par défaut *}} {{#foreach from=$entrees_defaut key="label" item="value"}} + + {{* Vérifier si la suppression de ce type d'entrée est possible *}} + {{:assign suppr=true}} + {{#load type="movement" where="$$.inputNature = :libelle" :libelle=$label}} + {{:assign suppr=false}} + {{/load}} + {{:input type="text" name="input_fields[label][]" default=$label}} {{:input type="select" name="input_fields[type][]" options=$types_entrees required=true default=$value default_empty="— Choisir un type —"}} - {{:button label="Retirer" shape="minus" onclick="this.parentNode.parentNode.remove();"}} + {{if $suppr}} + {{:button label="Supprimer" shape="minus" onclick="this.parentNode.parentNode.remove();"}} + {{else}} + {{:button label="Supprimer" shape="minus" disabled=true}} + {{/if}} {{/foreach}} @@ -95,20 +118,43 @@ {{#foreach from=$module.config.outputNature item="output_field"}} + + {{* Vérifier si la suppression de ce type de sortie est possible *}} + {{:assign suppr=true}} + {{#load type="movement" where="$$.outputNature = :libelle" :libelle=$output_field.label}} + {{:assign suppr=false}} + {{/load}} + {{:input type="text" name="output_fields[label][]" default=$output_field.label}} {{:input type="select" name="output_fields[type][]" options=$types_sorties default=$output_field.type required=true default_empty="— Choisir un type —"}} - {{:button label="Retirer" shape="minus" onclick="this.parentNode.parentNode.remove();"}} + {{if $suppr}} + {{:button label="Supprimer" shape="minus" onclick="this.parentNode.parentNode.remove();"}} + {{else}} + {{:button label="Supprimer" shape="minus" disabled=true}} + {{/if}} {{else}} + {{* pas de config enregistrée : utiliser les valeurs par défaut *}} {{#foreach from=$sorties_defaut key="label" item="value"}} + + {{* Vérifier si la suppression de ce type de sortie est possible *}} + {{:assign suppr=true}} + {{#load type="movement" where="$$.inputNature = :libelle" :libelle=$label}} + {{:assign suppr=false}} + {{/load}} + {{:input type="text" name="output_fields[label][]" default=$label}} {{:input type="select" name="output_fields[type][]" options=$types_sorties required=true default=$value default_empty="— Choisir un type —"}} - {{:button label="Retirer" shape="minus" onclick="this.parentNode.parentNode.remove();"}} + {{if $suppr}} + {{:button label="Supprimer" shape="minus" onclick="this.parentNode.parentNode.remove();"}} + {{else}} + {{:button label="Supprimer" shape="minus" disabled=true}} + {{/if}} {{/foreach}}