début nouvelle config types ES
This commit is contained in:
parent
b6de0c59c0
commit
b19904b05b
@ -73,11 +73,14 @@
|
|||||||
{{:assign nonproprio=0}}
|
{{:assign nonproprio=0}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* 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}}
|
|
||||||
|
|
||||||
{{if $mvt.direction === 'input'}}
|
{{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}}
|
||||||
{{if $type_mvt == 'définitif'}}
|
{{if $type_mvt == 'définitif'}}
|
||||||
{{:assign stock="%d+%d"|math:$stock:$mvt.amount}}
|
{{:assign stock="%d+%d"|math:$stock:$mvt.amount}}
|
||||||
{{:assign
|
{{:assign
|
||||||
@ -95,6 +98,13 @@
|
|||||||
from=nonproprio}}
|
from=nonproprio}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{elseif $mvt.direction === 'output'}}
|
{{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}}
|
||||||
{{if $type_mvt == 'définitif'}}
|
{{if $type_mvt == 'définitif'}}
|
||||||
{{:assign stock="%d-%d"|math:$stock:$mvt.amount}}
|
{{:assign stock="%d-%d"|math:$stock:$mvt.amount}}
|
||||||
{{:assign
|
{{:assign
|
||||||
|
@ -8,29 +8,41 @@
|
|||||||
{{* config par défaut *}}
|
{{* config par défaut *}}
|
||||||
{{:read file="./defaut.json" assign="config_defaut"}}
|
{{:read file="./defaut.json" assign="config_defaut"}}
|
||||||
{{:assign config_defaut=$config_defaut|json_decode}}
|
{{:assign config_defaut=$config_defaut|json_decode}}
|
||||||
|
{{*:debug config_defaut=$config_defaut*}}
|
||||||
|
|
||||||
{{if $module.config.input_nature != null}}
|
{{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=$module.config.input_nature item="elem"}}
|
||||||
{{:assign var="config.input_nature.%s"|args:$elem.label value=$elem.type}}
|
{{#foreach from=$elem key=label item=value}}
|
||||||
|
{{:assign var="in.%s"|args:$label value=$value}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{:assign var="config.input_nature." from="in"}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* pas de config enregistrée : utiliser la config par défaut *}}
|
{{* pas de config enregistrée : utiliser la config par défaut *}}
|
||||||
{{#foreach from=$config_defaut.inputs item="elem"}}
|
{{#foreach from=$config_defaut.inputs item="elem"}}
|
||||||
{{#foreach from=$elem key=label item=value}}
|
{{#foreach from=$elem key=label item=value}}
|
||||||
{{:assign var="config.input_nature.%s"|args:$label value=$value}}
|
{{:assign var="in.%s"|args:$label value=$value}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
{{:assign var="config.input_nature." from="in"}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{*:debug config.input_nature=$config.input_nature*}}
|
||||||
|
|
||||||
{{if $module.config.output_nature != null}}
|
{{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=$module.config.output_nature item="elem"}}
|
||||||
{{:assign var="config.output_nature.%s"|args:$elem.label value=$elem.type}}
|
{{#foreach from=$elem key=label item=value}}
|
||||||
|
{{:assign var="out.%s"|args:$label value=$value}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{:assign var="config.output_nature." from="out"}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* pas de config enregistrée : utiliser la config par défaut *}}
|
{{* pas de config enregistrée : utiliser la config par défaut *}}
|
||||||
{{#foreach from=$config_defaut.outputs item="elem"}}
|
{{#foreach from=$config_defaut.outputs item="elem"}}
|
||||||
{{#foreach from=$elem key=label item=value}}
|
{{#foreach from=$elem key=label item=value}}
|
||||||
{{:assign var="config.output_nature.%s"|args:$label value=$value}}
|
{{:assign var="out.%s"|args:$label value=$value}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
{{:assign var="config.output_nature." from="out"}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
15
config.html
15
config.html
@ -11,22 +11,13 @@
|
|||||||
|
|
||||||
{{* 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.in=$config.input_nature config.out=$config.output_nature*}}
|
||||||
{{* types d'entrées *}}
|
|
||||||
{{#foreach from=$config.input_nature key="label" item="type"}}
|
|
||||||
{{:assign var='input_types.%s'|args:$type value=$type}}
|
|
||||||
{{/foreach}}
|
|
||||||
|
|
||||||
{{* types d'entrées qui ne peuvent être supprimées *}}
|
{{* types d'entrées qui ne peuvent être supprimées *}}
|
||||||
{{#load type="movement" where="$$.direction='input'" group="$$.input_nature"}}
|
{{#load type="movement" where="$$.direction='input'" group="$$.input_nature"}}
|
||||||
{{:assign var="locked_inputs." value=$input_nature}}
|
{{:assign var="locked_inputs." value=$input_nature}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{* types de sorties *}}
|
|
||||||
{{#foreach from=$config.output_nature key="label" item="type"}}
|
|
||||||
{{:assign var='output_types.%s'|args:$type value=$type}}
|
|
||||||
{{/foreach}}
|
|
||||||
|
|
||||||
{{* types de sorties qui ne peuvent être supprimées *}}
|
{{* types de sorties qui ne peuvent être supprimées *}}
|
||||||
{{#load type="movement" where="$$.direction='output'" group="$$.output_nature"}}
|
{{#load type="movement" where="$$.direction='output'" group="$$.output_nature"}}
|
||||||
{{:assign var="locked_outputs." value=$output_nature}}
|
{{:assign var="locked_outputs." value=$output_nature}}
|
||||||
@ -42,7 +33,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#foreach from=$config.input_nature key="label" item="type"}}
|
{{#foreach from=$config.input_nature}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{$label}}</td>
|
<td>{{$label}}</td>
|
||||||
<td>{{$type}}</td>
|
<td>{{$type}}</td>
|
||||||
@ -67,7 +58,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#foreach from=$config.output_nature key="label" item="type"}}
|
{{#foreach from=$config.output_nature}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{$label}}</td>
|
<td>{{$label}}</td>
|
||||||
<td>{{$type}}</td>
|
<td>{{$type}}</td>
|
||||||
|
@ -8,6 +8,9 @@
|
|||||||
"items": {
|
"items": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"key" : {
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
"label" : {
|
"label" : {
|
||||||
"type" : "string"
|
"type" : "string"
|
||||||
},
|
},
|
||||||
@ -24,6 +27,9 @@
|
|||||||
"items": {
|
"items": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"key" : {
|
||||||
|
"type" : "string"
|
||||||
|
},
|
||||||
"label" : {
|
"label" : {
|
||||||
"type" : "string"
|
"type" : "string"
|
||||||
},
|
},
|
||||||
|
@ -11,38 +11,41 @@
|
|||||||
{{:include file="../_get_config.html" keep="config"}}
|
{{:include file="../_get_config.html" keep="config"}}
|
||||||
|
|
||||||
{{#form on="save"}}
|
{{#form on="save"}}
|
||||||
|
|
||||||
{{* vérifier l'existence d'une entrée de même nom et générer le résultat *}}
|
{{* 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}}
|
{{if $label|trim|tolower == $_POST.input_fields.label|trim|tolower}}
|
||||||
{{:error message="Ce libellé d'entrée est déjà présent"}}
|
{{:error message="Ce libellé d'entrée est déjà présent"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign var="input_nature.label" value=$label}}
|
{{#foreach from=$elem key=label item=value}}
|
||||||
{{:assign var="input_nature.type" value=$type}}
|
{{:assign var="in.%s"|args:$label value=$value}}
|
||||||
{{:assign var="input_natures." from=input_nature}}
|
{{/foreach}}
|
||||||
|
{{:assign var="input_natures." from="in"}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
||||||
{{* ajouter la nouvelle entrée *}}
|
{{* ajouter la nouvelle entrée *}}
|
||||||
{{if $_GET.dir == 'input'}}
|
{{if $_GET.dir == 'input'}}
|
||||||
{{:assign input_label=$_POST.input_fields.label|trim|tolower|ucfirst}}
|
{{: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.label" value=$_POST.input_fields.label|trim|tolower|ucfirst}}
|
||||||
{{:assign var="input_nature.type" value=$_POST.input_fields.type}}
|
{{:assign var="input_nature.type" value=$_POST.input_fields.type}}
|
||||||
{{:assign var="input_natures." from=input_nature}}
|
{{:assign var="input_natures." from=input_nature}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* vérifier l'existence d'une sortie de même nom et générer le résultat *}}
|
{{* 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}}
|
{{if $label|trim|tolower == $_POST.output_fields.label|trim|tolower}}
|
||||||
{{:error message="Ce libellé de sortie est déjà présent"}}
|
{{:error message="Ce libellé de sortie est déjà présent"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign var="output_nature.label" value=$label}}
|
{{#foreach from=$elem key=label item=value}}
|
||||||
{{:assign var="output_nature.type" value=$type}}
|
{{:assign var="out.%s"|args:$label value=$value}}
|
||||||
{{:assign var="output_natures." from=output_nature}}
|
{{/foreach}}
|
||||||
|
{{:assign var="output_natures." from="out"}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
||||||
{{* ajouter la nouvelle sortie *}}
|
{{* ajouter la nouvelle sortie *}}
|
||||||
{{if $_GET.dir == 'output'}}
|
{{if $_GET.dir == 'output'}}
|
||||||
{{:assign output_label=$_POST.output_fields.label|trim|tolower|ucfirst}}
|
{{: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.label" value=$_POST.output_fields.label|trim|tolower|ucfirst}}
|
||||||
{{:assign var="output_nature.type" value=$_POST.output_fields.type}}
|
{{:assign var="output_nature.type" value=$_POST.output_fields.type}}
|
||||||
{{:assign var="output_natures." from=output_nature}}
|
{{:assign var="output_natures." from=output_nature}}
|
||||||
@ -54,7 +57,7 @@
|
|||||||
input_nature=$input_natures
|
input_nature=$input_natures
|
||||||
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"}}
|
||||||
@ -62,10 +65,9 @@
|
|||||||
|
|
||||||
{{if $_GET.dir == 'input'}}
|
{{if $_GET.dir == 'input'}}
|
||||||
{{* types d'entrées *}}
|
{{* 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}}
|
{{:assign var='input_types.%s'|args:$type value=$type}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Type d'entrée</legend>
|
<legend>Type d'entrée</legend>
|
||||||
@ -102,7 +104,7 @@
|
|||||||
</form>
|
</form>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* types de sorties *}}
|
{{* 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}}
|
{{:assign var='output_types.%s'|args:$type value=$type}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
||||||
|
@ -15,21 +15,25 @@
|
|||||||
{{:include file="../_get_config.html" keep="config"}}
|
{{:include file="../_get_config.html" keep="config"}}
|
||||||
|
|
||||||
{{#form on="delete"}}
|
{{#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 ||
|
{{if $_GET.dir == 'input' && $label|trim|tolower != $_GET.mvt|trim|tolower ||
|
||||||
$_GET.dir == 'output'}}
|
$_GET.dir == 'output'
|
||||||
{{:assign var="input_nature.label" value=$label}}
|
}}
|
||||||
{{:assign var="input_nature.type" value=$type}}
|
{{#foreach from=$elem key=label item=value}}
|
||||||
{{:assign var="input_natures." from=input_nature}}
|
{{:assign var="in.%s"|args:$label value=$value}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{:assign var="input_natures." from="in"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/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 ||
|
{{if $_GET.dir == 'output' && $label|trim|tolower != $_GET.mvt|trim|tolower ||
|
||||||
$_GET.dir == 'input'}}
|
$_GET.dir == 'input'
|
||||||
{{:assign var="output_nature.label" value=$label}}
|
}}
|
||||||
{{:assign var="output_nature.type" value=$type}}
|
{{#foreach from=$elem key=label item=value}}
|
||||||
{{:assign var="output_natures." from=output_nature}}
|
{{:assign var="out.%s"|args:$label value=$value}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{:assign var="output_natures." from="out"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
||||||
|
41
defaut.json
41
defaut.json
@ -1,12 +1,37 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"inputs" : [
|
"inputs": [
|
||||||
{ "Achat" : "définitif" },
|
{
|
||||||
{ "Location" : "temporaire" },
|
"key": "c3a955e3-4e6e-414e-90f4-ede7ac3e9e33",
|
||||||
{ "Retour de Location/Prêt" : "retour" }
|
"label": "Achat",
|
||||||
|
"type": "définitif"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "9e909c25-14dc-4e02-b97e-73c34ab2ee9b",
|
||||||
|
"label" : "Location",
|
||||||
|
"type": "temporaire"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "30eb854c-f89a-4c19-85e4-baa5e34a0317",
|
||||||
|
"label" : "Retour de Location/Prêt",
|
||||||
|
"type" : "retour"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"outputs" : [
|
"outputs": [
|
||||||
{ "Vente" : "définitif" },
|
{
|
||||||
{ "Prêt" : "temporaire" },
|
"key": "f0eb189b-0b72-46c7-8b48-c23eed7e9672",
|
||||||
{ "Retour de Location/Emprunt" : "retour" }
|
"label" : "Vente",
|
||||||
|
"type" : "définitif"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key" : "c9ba00d9-26ee-448b-9f02-73e479ec2980",
|
||||||
|
"label" : "Prêt",
|
||||||
|
"type" : "temporaire"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key" : "fefefa51-1a85-46ca-ab78-b594b10390ff",
|
||||||
|
"label" : "Retour de Location/Emprunt",
|
||||||
|
"type" : "retour"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -52,32 +52,35 @@
|
|||||||
|
|
||||||
{{* récupérer la config des entrées/sorties *}}
|
{{* récupérer la config des entrées/sorties *}}
|
||||||
{{:include file="./_get_config.html" keep="config"}}
|
{{:include file="./_get_config.html" keep="config"}}
|
||||||
|
{{:debug config.input_nature=$config.input_nature}}
|
||||||
|
|
||||||
{{* déterminer les types de mouvements selon l'affection du matériel *}}
|
{{* déterminer les types de mouvements selon l'affection du matériel *}}
|
||||||
{{#foreach from=$config.input_nature key=mvt item=type_mvt}}
|
{{#foreach from=$config.input_nature}}
|
||||||
|
{{:debug key=$key label=$label type=$type}}
|
||||||
{{if $_GET.prop}}
|
{{if $_GET.prop}}
|
||||||
{{* matériel propriété de l'asso *}}
|
{{* matériel propriété de l'asso *}}
|
||||||
{{if $type_mvt != 'temporaire'}}
|
{{if $type != 'temporaire'}}
|
||||||
{{:assign var="input_types." value=$mvt}}
|
{{:assign var="input_types." value=$label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* matériel non propriété de l'asso *}}
|
{{* matériel non propriété de l'asso *}}
|
||||||
{{if $type_mvt == 'temporaire'}}
|
{{if $type == 'temporaire'}}
|
||||||
{{:assign var="input_types." value=$mvt}}
|
{{:assign var="input_types." value=$label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
{{:debug input_types=$input_types}}
|
||||||
|
|
||||||
{{#foreach from=$config.output_nature key=mvt item=type_mvt}}
|
{{#foreach from=$config.output_nature}}
|
||||||
{{if $_GET.prop}}
|
{{if $_GET.prop}}
|
||||||
{{* matériel propriété de l'asso *}}
|
{{* matériel propriété de l'asso *}}
|
||||||
{{if $type_mvt != 'retour'}}
|
{{if $type != 'retour'}}
|
||||||
{{:assign var="output_types." value=$mvt}}
|
{{:assign var="output_types." value=$label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* matériel non propriété de l'asso *}}
|
{{* matériel non propriété de l'asso *}}
|
||||||
{{if $type_mvt == 'retour'}}
|
{{if $type == 'retour'}}
|
||||||
{{:assign var="output_types." value=$mvt}}
|
{{:assign var="output_types." value=$label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
{{:include file="../_get_config.html" keep="config"}}
|
{{:include file="../_get_config.html" keep="config"}}
|
||||||
|
|
||||||
{{* types d'entrées *}}
|
{{* types d'entrées *}}
|
||||||
{{#foreach from=$config.input_nature key="label" item="type"}}
|
{{#foreach from=$config.input_nature}} {{* key="label" item="type"*}}
|
||||||
{{if $type != 'retour'}}
|
{{if $type != 'retour'}}
|
||||||
{{:assign var='input_labels.' value="%s"|args:$label}}
|
{{:assign var="input_labels.%s"|args:$key value="%s"|args:$label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
||||||
@ -62,13 +62,12 @@
|
|||||||
{{* Enregistrer le mouvement *}}
|
{{* Enregistrer le mouvement *}}
|
||||||
{{:assign mvt_key=""|uuid}}
|
{{:assign mvt_key=""|uuid}}
|
||||||
{{:assign var="operation" from="input_labels.%d"|args:$_POST.type_operation}}
|
{{:assign var="operation" from="input_labels.%d"|args:$_POST.type_operation}}
|
||||||
|
|
||||||
{{:save
|
{{:save
|
||||||
key=$mvt_key
|
key=$mvt_key
|
||||||
validate_schema="./movement.schema.json"
|
validate_schema="./movement.schema.json"
|
||||||
type="movement"
|
type="movement"
|
||||||
direction="input"
|
direction="input"
|
||||||
input_nature=$operation
|
operation=$_POST.operation
|
||||||
amount=$_POST.quantite|intval
|
amount=$_POST.quantite|intval
|
||||||
equipment=$equipment_key
|
equipment=$equipment_key
|
||||||
date=$_POST.date|parse_date
|
date=$_POST.date|parse_date
|
||||||
@ -95,7 +94,7 @@
|
|||||||
<fieldset class="entree">
|
<fieldset class="entree">
|
||||||
<legend>Ajouter une entrée de matériel</legend>
|
<legend>Ajouter une entrée de matériel</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{:input type="select" name="type_operation" label="Type" required=true options=$input_labels}}
|
{{:input type="select" name="operation" label="Type" required=true options=$input_labels}}
|
||||||
{{:input type="date" name="date" label="Date" required=true default=$now|date_short}}
|
{{: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}}
|
{{:input type="number" name="quantite" label="Quantité" min=1 required=true default=1}}
|
||||||
</dl>
|
</dl>
|
||||||
|
@ -11,13 +11,9 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["input", "output"]
|
"enum": ["input", "output"]
|
||||||
},
|
},
|
||||||
"input_nature": {
|
"operation": {
|
||||||
"description": "Nature de l'entrée",
|
"description": "clé de l'opération",
|
||||||
"type": ["null", "string"]
|
"type": "string"
|
||||||
},
|
|
||||||
"output_nature": {
|
|
||||||
"description": "Nature de la sortie",
|
|
||||||
"type": ["null", "string"]
|
|
||||||
},
|
},
|
||||||
"amount": {
|
"amount": {
|
||||||
"description": "Quantité ajoutée ou retirée",
|
"description": "Quantité ajoutée ou retirée",
|
||||||
@ -38,5 +34,5 @@
|
|||||||
"type": ["null", "string"]
|
"type": ["null", "string"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["type", "direction", "amount", "equipment", "date", "comment"]
|
"required": ["type", "direction", "operation", "amount", "equipment", "date", "comment"]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user