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

View File

@ -3,7 +3,7 @@
{{* {{*
paramètres : paramètres :
- dir : input ou output - 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 *}} {{* barre de navigation *}}
@ -14,32 +14,38 @@
{{* lecture config (défaut ou enregistrée) *}} {{* lecture config (défaut ou enregistrée) *}}
{{:include file="../_get_config.html" keep="config"}} {{: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"}} {{#form on="save"}}
{{#foreach from=$config.input_nature key="label" item="type"}} {{:assign input_nature=null}}
{{:debug key=$label item=$type}} {{#foreach from=$config.input_nature key=key}}
{{if $_GET.dir == 'input' {{:assign var="input_nature.key" value=$key}}
&& $label|trim|tolower == $_GET.mvt|trim|tolower}} {{if $_GET.dir == 'input'}}
{{if $key == $_GET.op_key}}
{{:assign var="input_nature.label" value=$_POST.name|trim|tolower|ucfirst}} {{: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}} {{:assign var="input_nature.label" value=$label}}
{{/if}} {{/if}}
{{:assign var="input_nature.type" value=$type}} {{:assign var="input_nature.type" value=$type}}
{{:assign var="input_natures." from=input_nature}} {{:assign var="input_natures." from=input_nature}}
{{/foreach}} {{/foreach}}
{{#foreach from=$config.output_nature key="label" item="type"}} {{#foreach from=$config.output_nature key=key}}
{{if $_GET.dir == 'output' && $label|trim|tolower == $_GET.mvt|trim|tolower}} {{: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}} {{:assign var="output_nature.label" value=$_POST.name|trim|tolower|ucfirst}}
{{else}} {{else}}
{{:assign var="output_nature.label" value=$label}} {{:assign var="output_nature.label" value=$label}}
{{/if}} {{/if}}
{{else}}
{{:assign var="output_nature.label" value=$label}}
{{/if}}
{{:assign var="output_nature.type" value=$type}} {{:assign var="output_nature.type" value=$type}}
{{:assign var="output_natures." from=output_nature}} {{:assign var="output_natures." from=output_nature}}
{{/foreach}} {{/foreach}}
{{:debug input_natures=$input_natures output_natures=$output_natures}}
{{*
{{:save {{:save
key="config" key="config"
validate_schema="../config.schema.json" validate_schema="../config.schema.json"
@ -47,17 +53,16 @@
output_nature=$output_natures output_nature=$output_natures
}} }}
{{:redirect to="./config.html?ok=1"}} {{:redirect to="./config.html?ok=1"}}
*}}
{{/form}} {{/form}}
{{:admin_header title="Gestion des matériels" current="module_equipment"}} {{:admin_header title="Gestion des matériels" current="module_equipment"}}
{{:form_errors}} {{: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"> <form method="post" action="" data-focus="1">
<fieldset> <fieldset>
<legend>Modifier le libellé</legend> <legend>Modifier le libellé</legend>
<dl> <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> </dl>
<p class="submit"> <p class="submit">
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}} {{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}

View File

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