début nouvelle config types ES

This commit is contained in:
Jean-Christophe Engel 2025-02-17 08:56:57 +01:00
parent b6de0c59c0
commit b19904b05b
10 changed files with 122 additions and 74 deletions

View file

@ -11,38 +11,41 @@
{{:include file="../_get_config.html" keep="config"}}
{{#form on="save"}}
{{* vérifier l'existence d'une entrée de même nom et générer le résultat *}}
{{#foreach from=$config.input_nature key="label" item="type"}}
{{#foreach from=$config.input_nature item=elem}}
{{if $label|trim|tolower == $_POST.input_fields.label|trim|tolower}}
{{:error message="Ce libellé d'entrée est déjà présent"}}
{{/if}}
{{:assign var="input_nature.label" value=$label}}
{{:assign var="input_nature.type" value=$type}}
{{:assign var="input_natures." from=input_nature}}
{{#foreach from=$elem key=label item=value}}
{{:assign var="in.%s"|args:$label value=$value}}
{{/foreach}}
{{:assign var="input_natures." from="in"}}
{{/foreach}}
{{* ajouter la nouvelle entrée *}}
{{if $_GET.dir == 'input'}}
{{:assign input_label=$_POST.input_fields.label|trim|tolower|ucfirst}}
{{:assign var="input_nature.key" value=""|uuid}}
{{:assign var="input_nature.label" value=$_POST.input_fields.label|trim|tolower|ucfirst}}
{{:assign var="input_nature.type" value=$_POST.input_fields.type}}
{{:assign var="input_natures." from=input_nature}}
{{/if}}
{{* vérifier l'existence d'une sortie de même nom et générer le résultat *}}
{{#foreach from=$config.output_nature key="label" item="type"}}
{{#foreach from=$config.output_nature item=elem}}
{{if $label|trim|tolower == $_POST.output_fields.label|trim|tolower}}
{{:error message="Ce libellé de sortie est déjà présent"}}
{{/if}}
{{:assign var="output_nature.label" value=$label}}
{{:assign var="output_nature.type" value=$type}}
{{:assign var="output_natures." from=output_nature}}
{{#foreach from=$elem key=label item=value}}
{{:assign var="out.%s"|args:$label value=$value}}
{{/foreach}}
{{:assign var="output_natures." from="out"}}
{{/foreach}}
{{* ajouter la nouvelle sortie *}}
{{if $_GET.dir == 'output'}}
{{:assign output_label=$_POST.output_fields.label|trim|tolower|ucfirst}}
{{:assign var="output_nature.key" value=""|uuid}}
{{:assign var="output_nature.label" value=$_POST.output_fields.label|trim|tolower|ucfirst}}
{{:assign var="output_nature.type" value=$_POST.output_fields.type}}
{{:assign var="output_natures." from=output_nature}}
@ -54,7 +57,7 @@
input_nature=$input_natures
output_nature=$output_natures
}}
{{:redirect to="./config.html?ok=1"}}
{{:redirect to="./config.html?ok=1"}}
{{/form}}
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
@ -62,10 +65,9 @@
{{if $_GET.dir == 'input'}}
{{* types d'entrées *}}
{{#foreach from=$config.input_nature key="label" item="type"}}
{{#foreach from=$config.input_nature}}
{{:assign var='input_types.%s'|args:$type value=$type}}
{{/foreach}}
<form method="post" action="">
<fieldset>
<legend>Type d'entrée</legend>
@ -102,7 +104,7 @@
</form>
{{else}}
{{* types de sorties *}}
{{#foreach from=$config.output_nature key="label" item="type"}}
{{#foreach from=$config.output_nature}}
{{:assign var='output_types.%s'|args:$type value=$type}}
{{/foreach}}

View file

@ -15,21 +15,25 @@
{{:include file="../_get_config.html" keep="config"}}
{{#form on="delete"}}
{{#foreach from=$config.input_nature key="label" item="type"}}
{{#foreach from=$config.input_nature item=elem}}
{{if $_GET.dir == 'input' && $label|trim|tolower != $_GET.mvt|trim|tolower ||
$_GET.dir == 'output'}}
{{:assign var="input_nature.label" value=$label}}
{{:assign var="input_nature.type" value=$type}}
{{:assign var="input_natures." from=input_nature}}
$_GET.dir == 'output'
}}
{{#foreach from=$elem key=label item=value}}
{{:assign var="in.%s"|args:$label value=$value}}
{{/foreach}}
{{:assign var="input_natures." from="in"}}
{{/if}}
{{/foreach}}
{{#foreach from=$config.output_nature key="label" item="type"}}
{{#foreach from=$config.output_nature item=elem}}
{{if $_GET.dir == 'output' && $label|trim|tolower != $_GET.mvt|trim|tolower ||
$_GET.dir == 'input'}}
{{:assign var="output_nature.label" value=$label}}
{{:assign var="output_nature.type" value=$type}}
{{:assign var="output_natures." from=output_nature}}
$_GET.dir == 'input'
}}
{{#foreach from=$elem key=label item=value}}
{{:assign var="out.%s"|args:$label value=$value}}
{{/foreach}}
{{:assign var="output_natures." from="out"}}
{{/if}}
{{/foreach}}