fin refonte config types ES

This commit is contained in:
Jean-Christophe Engel 2025-02-17 21:02:46 +01:00
parent 08ff1f82fd
commit 0af9cee03c
3 changed files with 39 additions and 38 deletions

View File

@ -34,15 +34,15 @@
</tr>
</thead>
<tbody>
{{#foreach from=$config.input_nature}}
{{#foreach from=$config.input_nature key=key}}
<tr>
<td>{{$label}}</td>
<td>{{$type}}</td>
<td class="actions">
{{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"}}
</td>
</tr>
{{/foreach}}
@ -59,15 +59,15 @@
</tr>
</thead>
<tbody>
{{#foreach from=$config.output_nature}}
{{#foreach from=$config.output_nature key=key}}
<tr>
<td>{{$label}}</td>
<td>{{$type}}</td>
<td class="actions">
{{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"}}
</td>
</tr>
{{/foreach}}

View File

@ -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 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}
{{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}}
{{#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}}
<form method="post" action="" data-focus="1">
<fieldset>
<legend>Modifier le libellé</legend>
<dl>
{{:input type="text" name="name" label="Libellé" default=$_GET.mvt required=true maxlength="100"}}
{{:input type="text" name="name" label="Libellé" default=$default_label required=true maxlength="100"}}
</dl>
<p class="submit">
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}

View File

@ -3,7 +3,7 @@
{{*
paramètres :
- dir : input ou output
- mvt : libellé du type de mouvement à supprimer
- op_key : clé du type de mouvement à supprimer
*}}
{{* barre de navigation *}}
@ -16,9 +16,7 @@
{{#form on="delete"}}
{{#foreach from=$config.input_nature key=key}}
{{if $_GET.dir == 'input' && $label|trim|tolower != $_GET.mvt|trim|tolower ||
$_GET.dir == 'output'
}}
{{if $_GET.dir == 'input' && $key != $_GET.op_key || $_GET.dir == 'output'}}
{{:assign var="input_nature.key" value=$key}}
{{:assign var="input_nature.label" value=$label}}
{{:assign var="input_nature.type" value=$type}}
@ -27,9 +25,7 @@
{{/foreach}}
{{#foreach from=$config.output_nature key=key}}
{{if $_GET.dir == 'output' && $label|trim|tolower != $_GET.mvt|trim|tolower ||
$_GET.dir == 'input'
}}
{{if $_GET.dir == 'output' && $key != $_GET.op_key || $_GET.dir == 'input'}}
{{:assign var="output_nature.key" value=$key}}
{{:assign var="output_nature.label" value=$label}}
{{:assign var="output_nature.type" value=$type}}