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}}