refonte config types ES
This commit is contained in:
parent
b19904b05b
commit
08ff1f82fd
16 changed files with 133 additions and 208 deletions
|
|
@ -9,9 +9,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.%s"|args:$key value="%s"|args:$label}}
|
||||
{{:assign var="input_labels.%s"|args:$key value=$label}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
<fieldset class="entree">
|
||||
<legend>Ajouter une entrée de matériel</legend>
|
||||
<dl>
|
||||
{{:input type="select" name="operation" label="Type" required=true options=$input_labels}}
|
||||
{{: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=1}}
|
||||
</dl>
|
||||
|
|
|
|||
|
|
@ -4,28 +4,16 @@
|
|||
Dupliquer un mouvement
|
||||
paramètres :
|
||||
- key : clé du mouvement à dupliquer
|
||||
- direction du mouvement à dupliquer
|
||||
- prop = 1 si matériel appartient à l'asso
|
||||
*}}
|
||||
|
||||
{{if $_GET.direction == "input"}}
|
||||
{{:assign msg_direction="entrée"}}
|
||||
{{else}}
|
||||
{{:assign msg_direction="sortie"}}
|
||||
{{/if}}
|
||||
|
||||
{{* récupérer les infos du mouvement à dupliquer *}}
|
||||
{{#load key=$_GET.key assign="mvt_new"}}
|
||||
{{else}}
|
||||
{{:error message="Aucune %s avec la clé %s"|args:$msg_direction:$_GET.key}}
|
||||
{{:error message="Aucun mouvement avec la clé %s"|args:$_GET.key}}
|
||||
{{/load}}
|
||||
|
||||
{{* infos pour affichage *}}
|
||||
{{if $_GET.direction == "input"}}
|
||||
{{:assign mvt_nature=$mvt_new.input_nature}}
|
||||
{{else}}
|
||||
{{:assign mvt_nature=$mvt_new.output_nature}}
|
||||
{{/if}}
|
||||
{{:assign amount_init=$mvt_new.amount}}
|
||||
{{:assign date_init=$mvt_new.date|date_short}}
|
||||
{{:assign eqpmt_key=$mvt_new.equipment}}
|
||||
|
|
@ -40,28 +28,22 @@
|
|||
{{:include file="../_get_config.html" keep="config"}}
|
||||
|
||||
{{* limiter les opérations possibles *}}
|
||||
{{if $_GET.direction == "input"}}
|
||||
{{if $mvt_new.direction == "input"}}
|
||||
{{* types d'entrées *}}
|
||||
{{#foreach from=$config.input_nature key="label" item="type"}}
|
||||
{{#foreach from=$config.input_nature key=key}}
|
||||
{{if $_GET.prop && $type != "temporaire" ||
|
||||
! $_GET.prop && $type == "temporaire"
|
||||
}}
|
||||
{{:assign var="input_labels.%s"|args:$label value="%s"|args:$label}}
|
||||
{{/if}}
|
||||
{{if $label == $mvt_new.input_nature}}
|
||||
{{:assign nature_defaut=$label}}
|
||||
{{:assign var="input_labels.%s"|args:$key value=$label}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{else}}
|
||||
{{* types de sorties *}}
|
||||
{{#foreach from=$config.output_nature key="label" item="type"}}
|
||||
{{#foreach from=$config.output_nature key=key}}
|
||||
{{if $_GET.prop && $type != "retour" ||
|
||||
! $_GET.prop && $type == "retour"
|
||||
}}
|
||||
{{:assign var="output_labels.%s"|args:$label value="%s"|args:$label}}
|
||||
{{/if}}
|
||||
{{if $label == $mvt_new.output_nature}}
|
||||
{{:assign nature_defaut=$label}}
|
||||
{{:assign var="output_labels.%s"|args:$key value=$label}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
|
|
@ -75,17 +57,17 @@
|
|||
{{/if}}
|
||||
|
||||
{{* préparer le mouvement copié *}}
|
||||
{{if $_GET.direction == "input"}}
|
||||
{{:assign var="mvt_new.input_nature" value=$_POST.nature_operation}}
|
||||
{{:assign var="type_mvt" from="config.input_nature.%s"|args:$mvt_new.input_nature}}
|
||||
{{if $mvt_new.direction == "input"}}
|
||||
{{:assign var="mvt_new.input_nature" value=$_POST.operation}}
|
||||
{{:assign var="type_mvt" from="config.input_nature.%s.type"|args:$mvt_new.operation}}
|
||||
{{if $type_mvt == "temporaire"}}
|
||||
{{:assign prop=0}}
|
||||
{{else}}
|
||||
{{:assign prop=1}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:assign var="mvt_new.output_nature" value=$_POST.nature_operation}}
|
||||
{{:assign var="type_mvt" from="config.output_nature.%s"|args:$mvt_new.output_nature}}
|
||||
{{:assign var="mvt_new.output_nature" value=$_POST.operation}}
|
||||
{{:assign var="type_mvt" from="config.output_nature.%s.type"|args:$mvt_new.operation}}
|
||||
{{if $type_mvt == "retour"}}
|
||||
{{:assign prop=0}}
|
||||
{{else}}
|
||||
|
|
@ -113,8 +95,8 @@
|
|||
}}
|
||||
{{if! $insere}}
|
||||
{{if
|
||||
$_GET.direction == "input" && $date >= $mvt_new.date ||
|
||||
$_GET.direction == "output" && $date > $mvt_new.date
|
||||
$mvt_new.direction == "input" && $date >= $mvt_new.date ||
|
||||
$mvt_new.direction == "output" && $date > $mvt_new.date
|
||||
}}
|
||||
{{:assign var="movements_new." from=mvt_new}}
|
||||
{{:assign insere=true}}
|
||||
|
|
@ -136,7 +118,7 @@
|
|||
{{if $erreur}}
|
||||
<p class="block error">
|
||||
Impossible d'enregistrer ce mouvement :
|
||||
{{if $_GET.direction == "input"}}
|
||||
{{if $mvt_new.direction == "input"}}
|
||||
« {{$mvt_new.input_nature}}
|
||||
{{else}}
|
||||
« {{$mvt_new.output_nature}}
|
||||
|
|
@ -150,9 +132,8 @@
|
|||
key=$mvt_key
|
||||
validate_schema="movement.schema.json"
|
||||
type="movement"
|
||||
direction=$_GET.direction
|
||||
input_nature=$mvt_new.input_nature
|
||||
output_nature=$mvt_new.output_nature
|
||||
direction=$mvt_new.direction
|
||||
operation=$_POST.operation
|
||||
amount=$mvt_new.amount|intval
|
||||
equipment=$eqpmt_key
|
||||
date=$mvt_new.date
|
||||
|
|
@ -171,17 +152,18 @@
|
|||
|
||||
{{* récupérer les infos de la catégorie *}}
|
||||
{{#load key=$eqpmt.category assign="category"}}{{/load}}
|
||||
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||
|
||||
{{* formulaire de copie du mouvement *}}
|
||||
<form method="post" action="">
|
||||
<fieldset>
|
||||
<legend>Créer une copie de « {{$mvt_nature}} {{$eqpmt.designation}} (Catégorie : {{$category.name}}) »</legend>
|
||||
{{if $_GET.direction == "input"}}
|
||||
<legend>Créer une copie de « {{$op_label}} {{$eqpmt.designation}} (Catégorie : {{$category.name}}) »</legend>
|
||||
{{if $mvt_new.direction == "input"}}
|
||||
<dl>
|
||||
{{:input type="select" name="nature_operation" label="Type" required=true options=$input_labels|sort default=$nature_defaut}}
|
||||
{{:input type="select" name="operation" label="Type" required=true options=$input_labels|sort default=$mvt_new.operation}}
|
||||
{{else}}
|
||||
<dl>
|
||||
{{:input type="select" name="nature_operation" label="Type" required=true options=$output_labels|sort default=$nature_defaut}}
|
||||
{{:input type="select" name="operation" label="Type" required=true options=$output_labels|sort default=$mvt_new.operation}}
|
||||
{{/if}}
|
||||
{{:input type="date" name="date" label="Date" required=true default=$mvt_new.date}}
|
||||
{{:input type="number" name="amount" label="Quantité" min=1 required=true default=$mvt_new.amount}}
|
||||
|
|
|
|||
|
|
@ -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}}
|
||||
|
|
|
|||
|
|
@ -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}}
|
||||
|
|
|
|||
|
|
@ -4,27 +4,20 @@
|
|||
Modifier un mouvement
|
||||
paramètres :
|
||||
- key : clé du mouvement à modifier
|
||||
- direction : du mouvement à modifier
|
||||
*}}
|
||||
|
||||
{{if $_GET.direction == "input"}}
|
||||
{{:assign msg_direction="entrée"}}
|
||||
{{else}}
|
||||
{{:assign msg_direction="sortie"}}
|
||||
{{/if}}
|
||||
|
||||
{{* récupérer les infos du mouvement à modifier *}}
|
||||
{{#load key=$_GET.key assign="mvt_new"}}
|
||||
{{else}}
|
||||
{{:error message="Aucune %s avec la clé %s"|args:$msg_direction:$_GET.key}}
|
||||
{{:error message="Aucun mouvement avec la clé %s"|args:$_GET.key}}
|
||||
{{/load}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../_get_config.html" keep="config"}}
|
||||
|
||||
{{* infos pour affichage *}}
|
||||
{{if $_GET.direction == "input"}}
|
||||
{{:assign mvt_nature=$mvt_new.input_nature}}
|
||||
{{else}}
|
||||
{{:assign mvt_nature=$mvt_new.output_nature}}
|
||||
{{/if}}
|
||||
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||
{{:debug get=$_GET mvt_new=$mvt_new op_label=$op_label}}
|
||||
{{:assign amount_init=$mvt_new.amount}}
|
||||
{{:assign date_init=$mvt_new.date|date_short}}
|
||||
{{:assign eqpmt_key=$mvt_new.equipment}}
|
||||
|
|
@ -35,24 +28,15 @@
|
|||
{{:error message="Aucun matériel avec la clé « %s »"|args:$eqpmt_key}}
|
||||
{{/load}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../_get_config.html" keep="config"}}
|
||||
|
||||
{{if $_GET.direction == "input"}}
|
||||
{{if $mvt_new.direction == "input"}}
|
||||
{{* types d'entrées *}}
|
||||
{{#foreach from=$config.input_nature key="label" item="type"}}
|
||||
{{:assign var="input_labels.%s"|args:$label value="%s"|args:$label}}
|
||||
{{if $label == $mvt_new.input_nature}}
|
||||
{{:assign nature_defaut=$label}}
|
||||
{{/if}}
|
||||
{{#foreach from=$config.input_nature key=key}}
|
||||
{{:assign var="input_labels.%s"|args:$key value=$label}}
|
||||
{{/foreach}}
|
||||
{{else}}
|
||||
{{* types de sorties *}}
|
||||
{{#foreach from=$config.output_nature key="label" item="type"}}
|
||||
{{:assign var="output_labels.%s"|args:$label value="%s"|args:$label}}
|
||||
{{if $label == $mvt_new.output_nature}}
|
||||
{{:assign nature_defaut=$label}}
|
||||
{{/if}}
|
||||
{{#foreach from=$config.output_nature key=key}}
|
||||
{{:assign var="output_labels.%s"|args:$key value=$label}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
|
||||
|
|
@ -65,17 +49,17 @@
|
|||
{{/if}}
|
||||
|
||||
{{* préparer le mouvement modifié *}}
|
||||
{{if $_GET.direction == "input"}}
|
||||
{{:assign var="mvt_new.input_nature" value=$_POST.nature_operation}}
|
||||
{{:assign var="type_mvt" from="config.input_nature.%s"|args:$mvt_new.input_nature}}
|
||||
{{if $mvt_new.direction == "input"}}
|
||||
{{:assign var="mvt_new.input_nature" value=$_POST.operation}}
|
||||
{{:assign var="type_mvt" from="config.input_nature.%s.type"|args:$mvt_new.operation}}
|
||||
{{if $type_mvt == "temporaire"}}
|
||||
{{:assign prop=0}}
|
||||
{{else}}
|
||||
{{:assign prop=1}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:assign var="mvt_new.output_nature" value=$_POST.nature_operation}}
|
||||
{{:assign var="type_mvt" from="config.output_nature.%s"|args:$mvt_new.output_nature}}
|
||||
{{:assign var="mvt_new.output_nature" value=$_POST.operation}}
|
||||
{{:assign var="type_mvt" from="config.output_nature.%s.type"|args:$mvt_new.operation}}
|
||||
{{if $type_mvt == "retour"}}
|
||||
{{:assign prop=0}}
|
||||
{{else}}
|
||||
|
|
@ -105,8 +89,8 @@
|
|||
{{if $key != $_GET.key}}
|
||||
{{if! $insere}}
|
||||
{{if
|
||||
$_GET.direction == "input" && $date >= $mvt_new.date ||
|
||||
$_GET.direction == "output" && $date > $mvt_new.date
|
||||
$mvt_new.direction == "input" && $date >= $mvt_new.date ||
|
||||
$mvt_new.direction == "output" && $date > $mvt_new.date
|
||||
}}
|
||||
{{:assign var="movements_new." from=mvt_new}}
|
||||
{{:assign insere=true}}
|
||||
|
|
@ -127,14 +111,11 @@
|
|||
}}
|
||||
|
||||
{{if $erreur}}
|
||||
{{:assign var="new_op_label" from="config.%s_nature.%s.label"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||
<p class="block error">
|
||||
Modification demandée impossible :
|
||||
« {{$mvt_nature}} de {{$eqpmt.designation}} (qté : {{$amount_init}}) en date du {{$date_init}} » vers
|
||||
{{if $_GET.direction == "input"}}
|
||||
« {{$mvt_new.input_nature}}
|
||||
{{else}}
|
||||
« {{$mvt_new.output_nature}}
|
||||
{{/if}}
|
||||
« {{$op_label}} de {{$eqpmt.designation}} (qté : {{$amount_init}}) en date du {{$date_init}} » vers
|
||||
« {{$new_op_label}}
|
||||
de {{$eqpmt.designation}} (qté : {{$mvt_new.amount}}) à la date du {{$mvt_new.date|date_short}} »
|
||||
</p>
|
||||
{{else}}
|
||||
|
|
@ -143,9 +124,8 @@
|
|||
key=$_GET.key
|
||||
validate_schema="movement.schema.json"
|
||||
type="movement"
|
||||
direction=$_GET.direction
|
||||
input_nature=$mvt_new.input_nature
|
||||
output_nature=$mvt_new.output_nature
|
||||
direction=$mvt_new.direction
|
||||
operation=$_POST.operation
|
||||
amount=$mvt_new.amount|intval
|
||||
equipment=$eqpmt_key
|
||||
date=$mvt_new.date
|
||||
|
|
@ -168,13 +148,13 @@
|
|||
{{* formulaire de modification du mouvement *}}
|
||||
<form method="post" action="">
|
||||
<fieldset>
|
||||
<legend>Modifier « {{$mvt_nature}} {{$eqpmt.designation}} (Catégorie : {{$category.name}}) »</legend>
|
||||
{{if $_GET.direction == "input"}}
|
||||
<legend>Modifier « {{$op_label}} {{$eqpmt.designation}} (Catégorie : {{$category.name}}) »</legend>
|
||||
{{if $mvt_new.direction == "input"}}
|
||||
<dl>
|
||||
{{:input type="select" name="nature_operation" label="Type" required=true options=$input_labels|sort default=$nature_defaut}}
|
||||
{{:input type="select" name="operation" label="Type" required=true options=$input_labels|sort default=$mvt_new.operation}}
|
||||
{{else}}
|
||||
<dl>
|
||||
{{:input type="select" name="nature_operation" label="Type" required=true options=$output_labels|sort default=$nature_defaut}}
|
||||
{{:input type="select" name="operation" label="Type" required=true options=$output_labels|sort default=$mvt_new.operation}}
|
||||
{{/if}}
|
||||
{{:input type="date" name="date" label="Date" required=true default=$mvt_new.date}}
|
||||
{{:input type="number" name="amount" label="Quantité" min=1 required=true default=$mvt_new.amount}}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@
|
|||
{{:include file="../../_get_config.html" keep="config"}}
|
||||
|
||||
{{* types de sorties *}}
|
||||
{{#foreach from=$config.output_nature key="label" item="type"}}
|
||||
{{#foreach from=$config.output_nature key=key}}
|
||||
{{if $type == 'retour'}}
|
||||
{{:assign var='output_labels.' value="%s"|args:$label}}
|
||||
{{:assign var="output_labels.%s"|args:$key value=$label}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
|
|
@ -47,8 +47,7 @@
|
|||
{{/if}}
|
||||
|
||||
{{* traiter le mouvement courant *}}
|
||||
{{:assign var="mvt_nature" from="mvt.%s_nature"|args:$mvt.direction}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s"|args:$mvt.direction:$mvt_nature}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$mvt.direction:$mvt.operation}}
|
||||
|
||||
{{if $mvt.direction === 'input'}}
|
||||
{{if $type_mvt == 'définitif'}}
|
||||
|
|
@ -86,13 +85,12 @@
|
|||
|
||||
{{* Enregistrer le mouvement *}}
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:assign var="operation" from="output_labels.%d|args:$_POST.type_operation}}
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="../movement.schema.json"
|
||||
type="movement"
|
||||
direction="output"
|
||||
output_nature=$operation
|
||||
operation=$_POST.operation
|
||||
amount=$_POST.quantite|intval
|
||||
equipment=$equipment.key
|
||||
date=$_POST.date|parse_date
|
||||
|
|
@ -130,7 +128,7 @@
|
|||
<fieldset class="sortie">
|
||||
<legend>Ajouter une sortie d'un matériel présent temporairement</legend>
|
||||
<dl>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$output_labels|sort}}
|
||||
{{:input type="select" name="operation" label="Type" required=true options=$output_labels|sort}}
|
||||
{{:input type="date" name="date" label="Date de sortie" required=true default=$now|date_short}}
|
||||
{{:input type="number" name="quantite" label="Quantité" required=true default=$present min=1 max=$present}}
|
||||
{{:input type="textarea" name="remarques" label="Remarques" cols="40" rows="3" required=false}}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@
|
|||
{{:include file="../../_get_config.html" keep="config"}}
|
||||
|
||||
{{* types de sorties *}}
|
||||
{{#foreach from=$config.output_nature key="label" item="type"}}
|
||||
{{#foreach from=$config.output_nature key=key}}
|
||||
{{if $type != 'retour'}}
|
||||
{{:assign var='output_labels.' value="%s"|args:$label}}
|
||||
{{:assign var="output_labels.%s"|args:$key value=$label}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
|
|
@ -33,13 +33,11 @@
|
|||
|
||||
{{* lister tous les mouvements du matériel *}}
|
||||
{{#load type="movement" where="$$.equipment = '%s'"|args:$_GET.key assign="mvt" order="$$.date ASC"}}
|
||||
|
||||
{{* traiter le nouveau mouvement *}}
|
||||
{{if ! $insere && $mvt.date > $_POST.date|parse_date}}
|
||||
{{:assign insere=true}}
|
||||
{{:assign dispo_old="%d-%d"|math:$stock:$exterieur}}
|
||||
{{:assign var="operation" from="output_labels.%s|args:$_POST.type_operation}}
|
||||
{{:assign var="type_mvt" from="config.output_nature.%s"|args:$operation}}
|
||||
{{:assign var="type_mvt" from="config.output_nature.%s.type"|args:$_POST.operation}}
|
||||
|
||||
{{if $type_mvt == 'définitif'}}
|
||||
{{:assign stock="%d-%d"|math:$stock:$_POST.quantite}}
|
||||
|
|
@ -55,8 +53,7 @@
|
|||
{{/if}}
|
||||
|
||||
{{* traiter le mouvement courant *}}
|
||||
{{:assign var="mvt_nature" from="mvt.%s_nature"|args:$mvt.direction}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s"|args:$mvt.direction:$mvt_nature}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$mvt.direction:$mvt.operation}}
|
||||
|
||||
{{if $mvt.direction === 'input'}}
|
||||
{{if $type_mvt == 'définitif'}}
|
||||
|
|
@ -85,8 +82,7 @@
|
|||
{{/load}}
|
||||
{{if ! $insere}}
|
||||
{{:assign dispo_old="%d-%d"|math:$stock:$exterieur}}
|
||||
{{:assign var="operation" from="output_labels.%s|args:$_POST.type_operation}}
|
||||
{{:assign var="type_mvt" from="config.output_nature.%s"|args:$operation}}
|
||||
{{:assign var="type_mvt" from="config.output_nature.%s.type"|args:$_POST.operation}}
|
||||
|
||||
{{if $type_mvt == 'définitif'}}
|
||||
{{:assign stock="%d-%d"|math:$stock:$_POST.quantite}}
|
||||
|
|
@ -103,13 +99,12 @@
|
|||
|
||||
{{* Enregistrer le mouvement *}}
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:assign var="operation" from="output_labels.%d|args:$_POST.type_operation}}
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="../movement.schema.json"
|
||||
type="movement"
|
||||
direction="output"
|
||||
output_nature=$operation
|
||||
operation=$_POST.operation
|
||||
amount=$_POST.quantite|intval
|
||||
equipment=$equipment.key
|
||||
date=$_POST.date|parse_date
|
||||
|
|
@ -150,7 +145,7 @@
|
|||
<fieldset class="sortie">
|
||||
<legend>Ajouter une sortie</legend>
|
||||
<dl>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$output_labels|sort}}
|
||||
{{:input type="select" name="operation" label="Type" required=true options=$output_labels|sort}}
|
||||
{{:input type="date" name="date" label="Date de sortie" required=true default=$now|date_short}}
|
||||
{{:input type="number" name="quantite" label="Quantité" required=true default=$dispo min=1 max=$dispo}}
|
||||
{{:input type="textarea" name="remarques" label="Remarques" cols="40" rows="3" required=false}}
|
||||
|
|
|
|||
|
|
@ -40,8 +40,7 @@
|
|||
order="$$.date"}}
|
||||
|
||||
{{* déterminer le type de mouvement *}}
|
||||
{{:assign var="mvt_nature" from="mvt.%s_nature"|args:$mvt.direction}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s"|args:$mvt.direction:$mvt_nature}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$mvt.direction:$mvt.operation}}
|
||||
|
||||
{{if $key != $_GET.key}}
|
||||
{{* ce n'est pas le mouvement à supprimer : cumuler les entrées/sorties *}}
|
||||
|
|
@ -70,9 +69,9 @@
|
|||
{{else}}
|
||||
{{* sortie *}}
|
||||
{{:assign temporaire=false}}
|
||||
{{:assign var="output_nature" from="config.output_nature.%s"|args:$mvt_suppr.output_nature}}
|
||||
{{:assign var="type_operation" from="config.output_nature.%s.type"|args:$mvt_suppr.operation}}
|
||||
|
||||
{{if $output_nature == 'temporaire'}}
|
||||
{{if $type_operation == 'temporaire'}}
|
||||
{{:assign exterieur=0}}
|
||||
{{#load
|
||||
type="movement"
|
||||
|
|
@ -81,8 +80,7 @@
|
|||
order="$$.date"}}
|
||||
|
||||
{{* déterminer le type de mouvement *}}
|
||||
{{:assign var="mvt_nature" from="mvt.%s_nature"|args:$mvt.direction}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s"|args:$mvt.direction:$mvt_nature}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$mvt.direction:$mvt.operation}}
|
||||
|
||||
{{if $key != $_GET.key}}
|
||||
{{* ce n'est pas le mouvement à supprimer : cumuler les entrées/sorties *}}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,7 @@
|
|||
|
||||
{{#foreach from=$movements item="mvt"}}
|
||||
{{* déterminer le type de mouvement *}}
|
||||
{{:assign var="mvt_nature" from="mvt.%s_nature"|args:$mvt.direction}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s"|args:$mvt.direction:$mvt_nature}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$mvt.direction:$mvt.operation}}
|
||||
|
||||
{{if $mvt.direction == 'input'}}
|
||||
{{if $type_mvt == 'définitif'}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue