diff --git a/config.html b/config.html
index 7052d47..b5d5411 100644
--- a/config.html
+++ b/config.html
@@ -34,15 +34,15 @@
- {{#foreach from=$config.input_nature}}
+ {{#foreach from=$config.input_nature key=key}}
{{$label}} |
{{$type}} |
{{if ! $locked_inputs|has:$label}}
- {{:linkbutton label="Supprimer" shape="delete" href="config/supprimer_type_mouvement.html?dir=input&mvt=%s"|args:$label target="_dialog"}}
+ {{:linkbutton label="Supprimer" shape="delete" href="config/supprimer_type_mouvement.html?dir=input&op_key=%s"|args:$key target="_dialog"}}
{{/if}}
- {{:linkbutton label="Modifier" shape="edit" href="config/modifier_type_mouvement.html?dir=input&mvt=%s"|args:$label target="_dialog"}}
+ {{:linkbutton label="Modifier" shape="edit" href="config/modifier_type_mouvement.html?dir=input&op_key=%s"|args:$key target="_dialog"}}
|
{{/foreach}}
@@ -59,15 +59,15 @@
- {{#foreach from=$config.output_nature}}
+ {{#foreach from=$config.output_nature key=key}}
{{$label}} |
{{$type}} |
{{if ! $locked_outputs|has:$label}}
- {{:linkbutton label="Supprimer" shape="delete" href="config/supprimer_type_mouvement.html?dir=output&mvt=%s"|args:$label target="_dialog"}}
+ {{:linkbutton label="Supprimer" shape="delete" href="config/supprimer_type_mouvement.html?dir=output&op_key=%s"|args:$key target="_dialog"}}
{{/if}}
- {{:linkbutton label="Modifier" shape="edit" href="config/modifier_type_mouvement.html?dir=output&mvt=%s"|args:$label target="_dialog"}}
+ {{:linkbutton label="Modifier" shape="edit" href="config/modifier_type_mouvement.html?dir=output&op_key=%s"|args:$key target="_dialog"}}
|
{{/foreach}}
diff --git a/config/modifier_type_mouvement.html b/config/modifier_type_mouvement.html
index 40749ee..b83032d 100644
--- a/config/modifier_type_mouvement.html
+++ b/config/modifier_type_mouvement.html
@@ -3,7 +3,7 @@
{{*
paramètres :
- dir : input ou output
- - mvt : libellé du type de mouvement à modifier
+ - op_key : clé du type de mouvement dont on veut modifier le libellé
*}}
{{* barre de navigation *}}
@@ -14,32 +14,38 @@
{{* lecture config (défaut ou enregistrée) *}}
{{:include file="../_get_config.html" keep="config"}}
-{{*:debug config.input_nature=$config.input_nature config.input_nature=$config.input_nature*}}
-{{*:debug mvt=$_GET.mvt*}}
{{#form on="save"}}
- {{#foreach from=$config.input_nature key="label" item="type"}}
- {{:debug key=$label item=$type}}
- {{if $_GET.dir == 'input'
- && $label|trim|tolower == $_GET.mvt|trim|tolower}}
- {{:assign var="input_nature.label" value=$_POST.name|trim|tolower|ucfirst}}
- {{else}
+ {{:assign input_nature=null}}
+ {{#foreach from=$config.input_nature key=key}}
+ {{:assign var="input_nature.key" value=$key}}
+ {{if $_GET.dir == 'input'}}
+ {{if $key == $_GET.op_key}}
+ {{:assign var="input_nature.label" value=$_POST.name|trim|tolower|ucfirst}}
+ {{else}}
+ {{:assign var="input_nature.label" value=$label}}
+ {{/if}}
+ {{else}}
{{:assign var="input_nature.label" value=$label}}
{{/if}}
{{:assign var="input_nature.type" value=$type}}
{{:assign var="input_natures." from=input_nature}}
{{/foreach}}
- {{#foreach from=$config.output_nature key="label" item="type"}}
- {{if $_GET.dir == 'output' && $label|trim|tolower == $_GET.mvt|trim|tolower}}
- {{:assign var="output_nature.label" value=$_POST.name|trim|tolower|ucfirst}}
+ {{#foreach from=$config.output_nature key=key}}
+ {{:assign var="output_nature.key" value=$key}}
+ {{if $_GET.dir == 'output'}}
+ {{if $key == $_GET.op_key}}
+ {{:assign var="output_nature.label" value=$_POST.name|trim|tolower|ucfirst}}
+ {{else}}
+ {{:assign var="output_nature.label" value=$label}}
+ {{/if}}
{{else}}
{{:assign var="output_nature.label" value=$label}}
{{/if}}
{{:assign var="output_nature.type" value=$type}}
{{:assign var="output_natures." from=output_nature}}
{{/foreach}}
-{{:debug input_natures=$input_natures output_natures=$output_natures}}
-{{*
+
{{:save
key="config"
validate_schema="../config.schema.json"
@@ -47,17 +53,16 @@
output_nature=$output_natures
}}
{{:redirect to="./config.html?ok=1"}}
-*}}
{{/form}}
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
{{:form_errors}}
-
+{{:assign var="default_label" from="config.%s_nature.%s.label"|args:$_GET.dir:$_GET.op_key}}