From 08ff1f82fd84d40a955b3aa4961b6f15f1ea94bc Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Mon, 17 Feb 2025 14:11:25 +0100 Subject: [PATCH] refonte config types ES --- _calcul_dispo.html | 14 +---- _get_config.html | 28 +++------ _nav.html | 2 +- config.html | 9 +-- config/ajouter_type_mouvement.html | 20 +++---- config/supprimer_type_mouvement.html | 21 ++++--- historique.html | 41 +++++++------ mouvements/ajouter_entree.html | 6 +- mouvements/dupliquer_mouvement.html | 60 +++++++------------ mouvements/entrees/repertorie.html | 12 ++-- mouvements/entrees/retour.html | 10 ++-- mouvements/modifier_mouvement.html | 74 +++++++++--------------- mouvements/sorties/emprunte.html | 12 ++-- mouvements/sorties/stock_disponible.html | 19 +++--- mouvements/supprimer_mouvement.html | 10 ++-- mouvements/valider_modification.html | 3 +- 16 files changed, 133 insertions(+), 208 deletions(-) diff --git a/_calcul_dispo.html b/_calcul_dispo.html index a6eae0c..36289fd 100644 --- a/_calcul_dispo.html +++ b/_calcul_dispo.html @@ -75,12 +75,7 @@ {{if $mvt.direction === 'input'}} {{* déterminer le type de mouvement *}} - {{#foreach from=$config.input_nature}} - {{if $key == $mvt.operation}} - {{:assign type_mvt=$type}} - {{:break}} - {{/if}} - {{/foreach}} + {{:assign var=type_mvt from="config.input_nature.%s.type"|args:$mvt.operation}} {{if $type_mvt == 'définitif'}} {{:assign stock="%d+%d"|math:$stock:$mvt.amount}} {{:assign @@ -99,12 +94,7 @@ {{/if}} {{elseif $mvt.direction === 'output'}} {{* déterminer le type de mouvement *}} - {{#foreach from=config.output_nature}} - {{if $key == $mvt.operation}} - {{:assign type_mvt=$type}} - {{:break}} - {{/if}} - {{/foreach}} + {{:assign var=type_mvt from="config.output_nature.%s.type"|args:$mvt.operation}} {{if $type_mvt == 'définitif'}} {{:assign stock="%d-%d"|math:$stock:$mvt.amount}} {{:assign diff --git a/_get_config.html b/_get_config.html index f03f643..d143240 100644 --- a/_get_config.html +++ b/_get_config.html @@ -8,41 +8,29 @@ {{* config par défaut *}} {{:read file="./defaut.json" assign="config_defaut"}} {{:assign config_defaut=$config_defaut|json_decode}} -{{*:debug config_defaut=$config_defaut*}} {{if $module.config.input_nature != null}} -{{*:debug module.config.input_nature=$module.config.input_nature*}} {{#foreach from=$module.config.input_nature item="elem"}} - {{#foreach from=$elem key=label item=value}} - {{:assign var="in.%s"|args:$label value=$value}} - {{/foreach}} - {{:assign var="config.input_nature." from="in"}} + {{:assign var="item" label=$label type=$type}} + {{:assign var="config.input_nature.%s"|args:$key value=$item}} {{/foreach}} {{else}} {{* pas de config enregistrée : utiliser la config par défaut *}} {{#foreach from=$config_defaut.inputs item="elem"}} - {{#foreach from=$elem key=label item=value}} - {{:assign var="in.%s"|args:$label value=$value}} - {{/foreach}} - {{:assign var="config.input_nature." from="in"}} + {{:assign var="item" label=$label type=$type}} + {{:assign var="config.input_nature.%s"|args:$key value=$item}} {{/foreach}} {{/if}} -{{*:debug config.input_nature=$config.input_nature*}} {{if $module.config.output_nature != null}} -{{*:debug module.config.output_nature=$module.config.output_nature*}} {{#foreach from=$module.config.output_nature item="elem"}} - {{#foreach from=$elem key=label item=value}} - {{:assign var="out.%s"|args:$label value=$value}} - {{/foreach}} - {{:assign var="config.output_nature." from="out"}} + {{:assign var="item" label=$label type=$type}} + {{:assign var="config.output_nature.%s"|args:$key value=$item}} {{/foreach}} {{else}} {{* pas de config enregistrée : utiliser la config par défaut *}} {{#foreach from=$config_defaut.outputs item="elem"}} - {{#foreach from=$elem key=label item=value}} - {{:assign var="out.%s"|args:$label value=$value}} - {{/foreach}} - {{:assign var="config.output_nature." from="out"}} + {{:assign var="item" label=$label type=$type}} + {{:assign var="config.output_nature.%s"|args:$key value=$item}} {{/foreach}} {{/if}} diff --git a/_nav.html b/_nav.html index 007a7a8..ac6d921 100644 --- a/_nav.html +++ b/_nav.html @@ -3,7 +3,7 @@