refonte config types ES

This commit is contained in:
Jean-Christophe Engel 2025-02-17 14:11:25 +01:00
parent b19904b05b
commit 08ff1f82fd
16 changed files with 133 additions and 208 deletions

View file

@ -15,9 +15,9 @@
{{:include file="../../_get_config.html" keep="config"}}
{{* types d'entrées *}}
{{#foreach from=$config.input_nature key="label" item="type"}}
{{#foreach from=$config.input_nature key=key}}
{{if $type != 'retour'}}
{{:assign var='input_labels.' value="%s"|args:$label}}
{{:assign var="input_labels.%s"|args:$key value=$label}}
{{/if}}
{{/foreach}}
@ -37,20 +37,18 @@
{{* Enregistrer le mouvement *}}
{{:assign mvt_key=""|uuid}}
{{:assign var="operation" from="input_labels.%d|args:$_POST.nature_operation}}
{{:save
key=$mvt_key
validate_schema="../movement.schema.json"
type="movement"
direction="input"
input_nature=$operation
operation=$_POST.operation
amount=$_POST.quantite|intval
equipment=$equipment.key
date=$_POST.date|parse_date
comment=$_POST.remarques|trim
}}
{{:assign var=type_entree from="config.input_nature.%s"|args:$operation}}
{{:assign var=type_entree from="config.input_nature.%s.type"|args:$_POST.operation}}
{{if $type_entree == "temporaire"}}
{{:assign prop=0}}
{{else}}
@ -76,7 +74,7 @@
<fieldset class="entree">
<legend>Ajouter une entrée de matériel</legend>
<dl>
{{:input type="select" name="nature_operation" label="Type" required=true options=$input_labels|sort}}
{{:input type="select" name="operation" label="Type" required=true options=$input_labels|sort}}
{{:input type="date" name="date" label="Date" required=true default=$now|date_short}}
{{:input type="number" name="quantite" label="Quantité" required=true min=1 default=1}}
{{:input type="textarea" name="remarques" label="Remarques" cols="40" rows="3" required=false}}

View file

@ -14,9 +14,9 @@
{{:include file="../../_get_config.html" keep="config"}}
{{* types d'entrées *}}
{{#foreach from=$config.input_nature key="label" item="type"}}
{{#foreach from=$config.input_nature key=key}}
{{if $type == 'retour'}}
{{:assign var='input_labels.' value="%s"|args:$label}}
{{:assign var="input_labels.%s"|args:$key value=$label}}
{{/if}}
{{/foreach}}
@ -43,14 +43,12 @@
{{* Enregistrer le mouvement *}}
{{:assign mvt_key=""|uuid}}
{{:assign var="operation" from="input_labels.%d|args:$_POST.type_operation}}
{{:save
key=$mvt_key
validate_schema="../movement.schema.json"
type="movement"
direction="input"
input_nature=$operation
operation=$_POST.operation
amount=$_POST.quantite|intval
equipment=$equipment.key
date=$_POST.date|parse_date
@ -91,7 +89,7 @@
<fieldset class="entree">
<legend>Ajouter un retour de matériel</legend>
<dl>
{{:input type="select" name="type_operation" label="Type" required=true options=$input_labels|sort}}
{{:input type="select" name="operation" label="Type" required=true options=$input_labels|sort}}
{{:input type="date" name="date" label="Date" required=true default=$now|date_short}}
{{:input type="number" name="quantite" label="Quantité" min=1 required=true default=$sorti max=$sorti}}
{{:input type="textarea" name="remarques" label="Remarques" cols="40", rows="3" required=false}}