réorganisation (cf remarques Bohwaz)
This commit is contained in:
parent
6006bdd169
commit
0e669a7c21
@ -7,18 +7,15 @@
|
||||
|
||||
{{* liste des catégories *}}
|
||||
{{if $categories === null}}
|
||||
{{#select
|
||||
key
|
||||
FROM module_data_equipment as cat
|
||||
WHERE json_extract(cat.document, '$.type') = 'category'}}
|
||||
{{#load type="category"}}
|
||||
{{:assign var="categories." value=$key}}
|
||||
{{/select}}
|
||||
{{/load}}
|
||||
{{/if}}
|
||||
|
||||
{{* date *}}
|
||||
{{if $date === null}}
|
||||
{{* :assign date=$now|date:"Y-m-d" *}}
|
||||
{{:assign date="31/12/9999"|parse_date"}}
|
||||
{{:assign date="31/12/9999"|parse_date}}
|
||||
{{* si on veut aussi lister les mouvements du futur :-) *}}
|
||||
{{/if}}
|
||||
|
||||
@ -32,8 +29,8 @@
|
||||
mvt.key as 'mvt_key',
|
||||
json_extract(mvt.document, '$.direction') as 'direction',
|
||||
CASE json_extract(mvt.document, '$.direction')
|
||||
WHEN 'entrée' THEN json_extract(mvt.document, '$.inputNature')
|
||||
WHEN 'sortie' THEN json_extract(mvt.document, '$.outputNature')
|
||||
WHEN 'input' THEN json_extract(mvt.document, '$.input_nature')
|
||||
WHEN 'output' THEN json_extract(mvt.document, '$.output_nature')
|
||||
END
|
||||
AS 'operation',
|
||||
json_extract(mvt.document, '$.amount') AS 'nombre'
|
||||
@ -87,9 +84,9 @@
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="./_get_config.html" keep="config"}}
|
||||
|
||||
{{if $direction === 'entrée'}}
|
||||
{{if $direction === 'input'}}
|
||||
{{* chercher le type d'entrée parmi les types de la config *}}
|
||||
{{#foreach from=$config.inputNature item="elem"}}
|
||||
{{#foreach from=$config.input_nature item="elem"}}
|
||||
{{if $operation == $elem.label}}
|
||||
{{if $elem.type == 'définitif'}}
|
||||
{{:assign stock="%d+%d"|math:$stock:$nombre}}
|
||||
@ -110,9 +107,9 @@
|
||||
{{:break}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{elseif $direction === 'sortie'}}
|
||||
{{elseif $direction === 'output'}}
|
||||
{{* chercher le type de sortie parmi les types de la config *}}
|
||||
{{#foreach from=$config.outputNature item="elem"}}
|
||||
{{#foreach from=$config.output_nature item="elem"}}
|
||||
{{if $operation == $elem.label}}
|
||||
{{if $elem.type == 'définitif'}}
|
||||
{{:assign stock="%d-%d"|math:$stock:$nombre}}
|
||||
|
@ -1,34 +1,34 @@
|
||||
{{*
|
||||
Récupérer soit la config enregistrée, soit la config par défaut
|
||||
résultat : config.inputNature et config.outputNature
|
||||
résultat : config.input_nature et config.output_nature
|
||||
*}}
|
||||
|
||||
{{* config par défaut *}}
|
||||
{{:read file="./defaut.json" assign="config_defaut"}}
|
||||
{{:assign config_defaut=$config_defaut|json_decode}}
|
||||
|
||||
{{if $module.config.inputNature != null}}
|
||||
{{:assign var=config.inputNature value=$module.config.inputNature}}
|
||||
{{if $module.config.input_nature != null}}
|
||||
{{:assign var=config.input_nature value=$module.config.input_nature}}
|
||||
{{else}}
|
||||
{{* pas de config enregistrée : utiliser la config par défaut *}}
|
||||
{{#foreach from=$config_defaut.entrées item="elem"}}
|
||||
{{#foreach from=$config_defaut.inputs item="elem"}}
|
||||
{{#foreach from=$elem key=label item=value}}
|
||||
{{:assign var="item.label" value=$label}}
|
||||
{{:assign var="item.type" value=$value}}
|
||||
{{:assign var="config.inputNature." value=$item}}
|
||||
{{:assign var="config.input_nature." value=$item}}
|
||||
{{/foreach}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
|
||||
{{if $module.config.outputNature != null}}
|
||||
{{:assign var=config.outputNature value=$module.config.outputNature}}
|
||||
{{if $module.config.output_nature != null}}
|
||||
{{:assign var=config.output_nature value=$module.config.output_nature}}
|
||||
{{else}}
|
||||
{{* pas de config enregistrée : utiliser la config par défaut *}}
|
||||
{{#foreach from=$config_defaut.sorties item="elem"}}
|
||||
{{#foreach from=$config_defaut.outputs item="elem"}}
|
||||
{{#foreach from=$elem key=label item=value}}
|
||||
{{:assign var="item.label" value=$label}}
|
||||
{{:assign var="item.type" value=$value}}
|
||||
{{:assign var="config.outputNature." value=$item}}
|
||||
{{:assign var="config.output_nature." value=$item}}
|
||||
{{/foreach}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
|
@ -9,11 +9,11 @@
|
||||
{{#form on="delete"}}
|
||||
{{* Vérifier s'il reste des matériels dans cette catégorie *}}
|
||||
{{#load type="equipment" category=$_GET.key assign="equipment"}}
|
||||
{{:redirect force="./index.html?err=1&msg=Cette catégorie ne peut être supprimée car elle contient encore des matériels"}}
|
||||
{{:redirect force="./index.html?err=1&msg=suppression"}}
|
||||
{{else}}
|
||||
{{* supprimer la catégorie sélectionnée*}}
|
||||
{{:delete where="key = :key" :key=$category.key}}
|
||||
{{:redirect force="./index.html?ok=1&msg=La catégorie « %s » a été supprimée"|args:$category.name}}
|
||||
{{:redirect force="./index.html?ok=1&msg=suppression"}}
|
||||
{{/load}}
|
||||
|
||||
{{/form}}
|
||||
|
@ -5,10 +5,18 @@
|
||||
{{:include file="../_nav.html" current="categories"}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
<p class="block confirm">{{$_GET.msg}}</p>
|
||||
{{else}}
|
||||
{{if $_GET.err}}
|
||||
{{if $_GET.msg == "modification"}}
|
||||
<p class="block confirm">Modification enregistrée</p>
|
||||
{{elseif $_GET.msg == "suppression"}}
|
||||
<p class="block confirm">Catégorie supprimée</p>
|
||||
{{/if}}
|
||||
{{elseif $_GET.err}}
|
||||
{{if $_GET.msg == "modification"}}
|
||||
<p class="block error">{{$_GET.msg}}</p>
|
||||
{{elseif $_GET.msg == "suppression"}}
|
||||
<p class="block error">
|
||||
Cette catégorie ne peut être supprimée car elle contient encore des matériels
|
||||
</p>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
type="category"
|
||||
name=$_POST.name|trim
|
||||
}}
|
||||
{{:redirect force="./index.html?ok=1&msg=Catégorie modifiée"}}
|
||||
{{:redirect force="./index.html?ok=1&msg=modification"}}
|
||||
{{/form}}
|
||||
|
||||
{{:form_errors}}
|
||||
|
36
config.html
36
config.html
@ -13,8 +13,8 @@
|
||||
|
||||
{{:save key="config"
|
||||
validate_schema="./config.schema.json"
|
||||
inputNature=$_POST.input_fields|array_transpose
|
||||
outputNature=$_POST.output_fields|array_transpose
|
||||
input_nature=$_POST.input_fields|array_transpose
|
||||
output_nature=$_POST.output_fields|array_transpose
|
||||
}}
|
||||
{{:redirect to="./config.html?ok=1"}}
|
||||
{{/form}}
|
||||
@ -24,16 +24,16 @@
|
||||
{{:assign config_defaut=$config_defaut|json_decode}}
|
||||
|
||||
{{* types d'entrées *}}
|
||||
{{#foreach from=$config_defaut.entrées item="elem"}}
|
||||
{{#foreach from=$config_defaut.inputs item="elem"}}
|
||||
{{#foreach from=$elem key=label item=value}}
|
||||
{{:assign var='types_entrees.%s'|args:$value value=$value}}
|
||||
{{:assign var='input_types.%s'|args:$value value=$value}}
|
||||
{{/foreach}}
|
||||
{{/foreach}}
|
||||
|
||||
{{* types de sorties *}}
|
||||
{{#foreach from=$config_defaut.sorties item="elem"}}
|
||||
{{#foreach from=$config_defaut.outputs item="elem"}}
|
||||
{{#foreach from=$elem key=label item=value}}
|
||||
{{:assign var='types_sorties.%s'|args:$value value=$value}}
|
||||
{{:assign var='output_typess.%s'|args:$value value=$value}}
|
||||
{{/foreach}}
|
||||
{{/foreach}}
|
||||
|
||||
@ -49,11 +49,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="input_body">
|
||||
{{#foreach from=$module.config.inputNature item="input_field"}}
|
||||
{{#foreach from=$module.config.input_nature item="input_field"}}
|
||||
|
||||
{{* Vérifier si la suppression de ce type d'entrée est possible *}}
|
||||
{{:assign suppr=true}}
|
||||
{{#load type="movement" where="$$.inputNature = :libelle" :libelle=$input_field.label}}
|
||||
{{#load type="movement" where="$$.input_nature = :libelle" :libelle=$input_field.label}}
|
||||
{{:assign suppr=false}}
|
||||
{{/load}}
|
||||
|
||||
@ -61,7 +61,7 @@
|
||||
<td>{{:input type="text" name="input_fields[label][]" default=$input_field.label}}</td>
|
||||
<td>{{:input type="select"
|
||||
name="input_fields[type][]"
|
||||
options=$types_entrees
|
||||
options=$input_types
|
||||
default=$input_field.type
|
||||
required=true
|
||||
default_empty="— Choisir un type —"}}
|
||||
@ -76,12 +76,12 @@
|
||||
</tr>
|
||||
{{else}}
|
||||
{{* pas de config enregistrée : utiliser les valeurs par défaut *}}
|
||||
{{#foreach from=$config_defaut.entrées item="elem"}}
|
||||
{{#foreach from=$config_defaut.inputs item="elem"}}
|
||||
{{#foreach from=$elem key=label item=value}}
|
||||
|
||||
{{* Vérifier si la suppression de ce type d'entrée est possible *}}
|
||||
{{:assign suppr=true}}
|
||||
{{#load type="movement" where="$$.inputNature = :libelle" :libelle=$label}}
|
||||
{{#load type="movement" where="$$.input_nature = :libelle" :libelle=$label}}
|
||||
{{:assign suppr=false}}
|
||||
{{/load}}
|
||||
|
||||
@ -90,7 +90,7 @@
|
||||
<td>{{:input
|
||||
type="select"
|
||||
name="input_fields[type][]"
|
||||
options=$types_entrees
|
||||
options=$input_types
|
||||
required=true
|
||||
default=$value
|
||||
default_empty="— Choisir un type —"}}
|
||||
@ -134,11 +134,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="output_body">
|
||||
{{#foreach from=$module.config.outputNature item="output_field"}}
|
||||
{{#foreach from=$module.config.output_nature item="output_field"}}
|
||||
|
||||
{{* Vérifier si la suppression de ce type de sortie est possible *}}
|
||||
{{:assign suppr=true}}
|
||||
{{#load type="movement" where="$$.outputNature = :libelle" :libelle=$output_field.label}}
|
||||
{{#load type="movement" where="$$.output_nature = :libelle" :libelle=$output_field.label}}
|
||||
{{:assign suppr=false}}
|
||||
{{/load}}
|
||||
|
||||
@ -147,7 +147,7 @@
|
||||
<td>{{:input
|
||||
type="select"
|
||||
name="output_fields[type][]"
|
||||
options=$types_sorties
|
||||
options=$output_typess
|
||||
default=$output_field.type
|
||||
required=true
|
||||
default_empty="— Choisir un type —"}}
|
||||
@ -162,12 +162,12 @@
|
||||
</tr>
|
||||
{{else}}
|
||||
{{* pas de config enregistrée : utiliser les valeurs par défaut *}}
|
||||
{{#foreach from=$config_defaut.sorties item="elem"}}
|
||||
{{#foreach from=$config_defaut.outputs item="elem"}}
|
||||
{{#foreach from=$elem key=label item=value}}
|
||||
|
||||
{{* Vérifier si la suppression de ce type de sortie est possible *}}
|
||||
{{:assign suppr=true}}
|
||||
{{#load type="movement" where="$$.inputNature = :libelle" :libelle=$label}}
|
||||
{{#load type="movement" where="$$.input_nature = :libelle" :libelle=$label}}
|
||||
{{:assign suppr=false}}
|
||||
{{/load}}
|
||||
|
||||
@ -176,7 +176,7 @@
|
||||
<td>{{:input
|
||||
type="select"
|
||||
name="output_fields[type][]"
|
||||
options=$types_sorties
|
||||
options=$output_typess
|
||||
required=true
|
||||
default=$value
|
||||
default_empty="— Choisir un type —"}}
|
||||
|
@ -2,7 +2,7 @@
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"inputNature": {
|
||||
"input_nature": {
|
||||
"description": "Nature des entrées",
|
||||
"type": ["array", "null"],
|
||||
"items": {
|
||||
@ -18,7 +18,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"outputNature": {
|
||||
"output_nature": {
|
||||
"description": "Nature des sorties",
|
||||
"type": ["array", "null"],
|
||||
"items": {
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"entrées" : [
|
||||
"inputs" : [
|
||||
{ "Achat" : "définitif" },
|
||||
{ "Location" : "temporaire" },
|
||||
{ "Retour de Location/Prêt" : "retour" }
|
||||
],
|
||||
"sorties" : [
|
||||
"outputs" : [
|
||||
{ "Vente" : "définitif" },
|
||||
{ "Prêt" : "temporaire" },
|
||||
{ "Retour de Location/Emprunt" : "retour" }
|
||||
|
@ -20,8 +20,8 @@
|
||||
{{#list
|
||||
type="movement"
|
||||
select="$$.date AS 'Date';
|
||||
$$.direction AS 'Mvt';
|
||||
CASE $$.direction WHEN 'entrée' THEN $$.inputNature WHEN 'sortie' THEN $$.outputNature END AS 'Type';
|
||||
CASE $$.direction WHEN 'input' THEN 'Entrée' WHEN 'output' THEN 'Sortie' END AS 'Mvt';
|
||||
CASE $$.direction WHEN 'input' THEN $$.input_nature WHEN 'output' THEN $$.output_nature END AS 'Type';
|
||||
$$.amount AS 'Nombre';
|
||||
$$.comment AS 'Commentaire'"
|
||||
equipment=$equipment_key
|
||||
@ -29,7 +29,7 @@
|
||||
}}
|
||||
<tr>
|
||||
<td>{{$date|date_short}}</td>
|
||||
<td>{{$direction}}</td>
|
||||
<td>{{$col2}}</td>
|
||||
<td>{{$col3}}</td>
|
||||
<td>{{$amount}}</td>
|
||||
<td>{{$comment}}</td>
|
||||
|
15
index.html
15
index.html
@ -1,16 +1,17 @@
|
||||
{{#restrict section="accounting" level="read"}}{{/restrict}}
|
||||
{{:admin_header title="Gestion des matériels" custom_css=$custom_css current="module_equipment"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="_nav.html" current="index"}}
|
||||
|
||||
{{#select
|
||||
key
|
||||
FROM module_data_equipment as cat
|
||||
WHERE json_extract(cat.document, '$.type') = 'category'
|
||||
}}
|
||||
{{if $_GET.ok}}
|
||||
<p class="block confirm">Modification effectuée</p>
|
||||
{{elseif $_GET.err}}
|
||||
<p class="block error">Modification refusée</p>
|
||||
{{/if}}
|
||||
|
||||
{{#load type="category"}}
|
||||
{{:assign var="categories." value=$key}}
|
||||
{{/select}}
|
||||
{{/load}}
|
||||
|
||||
{{if $categories|count == 0}}
|
||||
<p class="block alert">Il n'y a aucune catégorie : vous devez en ajouter.</p>
|
||||
|
@ -48,7 +48,7 @@
|
||||
category=$category.key
|
||||
designation=$_POST.designation|trim
|
||||
}}
|
||||
{{:redirect force="index.html?ok=1&msg=Modification enregistrée"}}
|
||||
{{:redirect force="index.html?ok=1"}}
|
||||
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
@ -62,8 +62,10 @@
|
||||
<form method="post" action="">
|
||||
<fieldset class="modification">
|
||||
<legend>Modifier un matériel</legend>
|
||||
<dl>
|
||||
{{:input type="select" name="category" label="Catégorie" default=$default_category required=true options=$categories}}
|
||||
{{:input type="text" name="designation" label="Désignation" default=$equipment.designation required=true}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
|
@ -34,10 +34,10 @@
|
||||
|
||||
{{if $key != $_GET.key}}
|
||||
{{* ce n'est pas le mouvement à supprimer : cumuler les entrées/sorties *}}
|
||||
{{if $movement.direction == 'entrée'}}
|
||||
{{if $movement.direction == 'input'}}
|
||||
{{* chercher le type d'entrée parmi les types de la config *}}
|
||||
{{#foreach from=$config.inputNature item="elem"}}
|
||||
{{if $movement.inputNature == $elem.label}}
|
||||
{{#foreach from=$config.input_nature item="elem"}}
|
||||
{{if $movement.input_nature == $elem.label}}
|
||||
{{if $elem.type == 'temporaire'}}
|
||||
{{:assign nonprop="%d+%d"|math:$nonprop:$movement.amount}}
|
||||
{{else}}
|
||||
@ -45,10 +45,10 @@
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{elseif $movement.direction == 'sortie'}}
|
||||
{{elseif $movement.direction == 'output'}}
|
||||
{{* chercher le type de sortie parmi les types de la config *}}
|
||||
{{#foreach from=$config.outputNature item="elem"}}
|
||||
{{if $movement.outputNature == $elem.label}}
|
||||
{{#foreach from=$config.output_nature item="elem"}}
|
||||
{{if $movement.output_nature == $elem.label}}
|
||||
{{if $elem.type == 'retour'}}
|
||||
{{:assign nonprop="%d-%d"|math:$nonprop:$movement.amount}}
|
||||
{{else}}
|
||||
@ -60,7 +60,7 @@
|
||||
|
||||
{{* problème ? *}}
|
||||
{{if $dispo < 0 || $nonprop < 0}}
|
||||
{{:redirect force="./index.html?err=1&msg=Impossible de supprimer l'entrée « %s %s (%d) en date du %s »"|args:$mvt_suppr.inputNature:$eqpmt_suppr.designation:$amount_suppr:$date_suppr}}
|
||||
{{:redirect force="./index.html?err=1&msg=suppression"}}
|
||||
{{/if}}
|
||||
|
||||
{{/if}}
|
||||
@ -68,14 +68,14 @@
|
||||
|
||||
{{* vérification réussie : supprimer l'entrée *}}
|
||||
{{:delete key=$_GET.key}}
|
||||
{{:assign var="msg" value="Entrée « %s %s (%d) en date du %s » supprimée"|args:$mvt_suppr.inputNature:$eqpmt_suppr.designation:$amount_suppr:$date_suppr}}
|
||||
{{:assign var="msg" value="suppression"}}
|
||||
|
||||
{{* voir s'il reste des mouvements pour le matériel concerné par le mouvement supprimé *}}
|
||||
{{#load type="movement" where="$$.equipment = :eqpmt_key" :eqpmt_key=$key_eqpmt_suppr}}
|
||||
{{else}}
|
||||
{{* supprimer le matériel *}}
|
||||
{{:delete key=$key_eqpmt_suppr}}
|
||||
{{:assign var="msg" value="%s - Matériel « %s » supprimé"|args:$msg:$eqpmt_suppr.designation}}
|
||||
{{:assign var="msg" value="%s - matériel"|args:$msg}}
|
||||
{{/load}}
|
||||
|
||||
{{:redirect force="./index.html?ok=1&msg=%s"|args:$msg}}
|
||||
@ -83,7 +83,7 @@
|
||||
|
||||
{{:delete_form
|
||||
legend="Supprimer cette entrée ?"
|
||||
warning="Supprimer l'entrée « %s %s (%d) en date du %s » ?"|args:$mvt_suppr.inputNature:$eqpmt_suppr.designation:$amount_suppr:$date_suppr
|
||||
warning="Supprimer l'entrée « %s %s (%d) en date du %s » ?"|args:$mvt_suppr.input_nature:$eqpmt_suppr.designation:$amount_suppr:$date_suppr
|
||||
info="S'il ne reste aucun mouvement pour ce matériel, le matériel sera supprimé"
|
||||
}}
|
||||
|
||||
|
@ -5,17 +5,31 @@
|
||||
{{:include file="../../_nav.html" current="entrees"}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
<p class="block confirm">{{$_GET.msg}}</p>
|
||||
{{if $_GET.msg|match:"suppression"}}
|
||||
{{:assign msg="Entrée supprimée"}}
|
||||
{{if $_GET.msg|match:"matériel"}}
|
||||
{{:assign var="msg" value="%s - Matériel supprimé"|args:$msg}}
|
||||
{{/if}}
|
||||
{{elseif $_GET.msg == "entrée"}}
|
||||
{{:assign msg="Entrée enregistrée"}}
|
||||
{{elseif $_GET.msg == "modification"}}
|
||||
{{:assign msg="Entrée modifiée"}}
|
||||
{{/if}}
|
||||
<p class="block confirm">{{$msg}}</p>
|
||||
{{elseif $_GET.err}}
|
||||
<p class="block error">{{$_GET.msg}}</p>
|
||||
{{if $_GET.msg == "suppression"}}
|
||||
<p class="block error">Impossible de supprimer l'entrée</p>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset class="entree">
|
||||
<legend>Ajouter une entrée</legend>
|
||||
{{:linkbutton label="Matériel répertorié" shape="plus" href="repertorie.html?dialog" target="_dialog"}}
|
||||
{{:linkbutton label="Matériel non répertorié" shape="plus" href="non_repertorie.html?dialog" target="_dialog"}}
|
||||
{{:linkbutton label="Retour de sortie temporaire" shape="plus" href="retour.html?dialog" target="_dialog"}}
|
||||
<dl>
|
||||
{{:linkbutton label="Matériel répertorié" shape="plus" href="repertorie.html" target="_dialog"}}
|
||||
{{:linkbutton label="Matériel non répertorié" shape="plus" href="non_repertorie.html" target="_dialog"}}
|
||||
{{:linkbutton label="Retour de sortie temporaire" shape="plus" href="retour.html" target="_dialog"}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@ -26,7 +40,7 @@
|
||||
{{#list
|
||||
select="
|
||||
$$.date AS 'Date' ;
|
||||
$$.inputNature AS 'Type' ;
|
||||
$$.input_nature AS 'Type' ;
|
||||
$$.amount AS 'Nombre' ;
|
||||
(SELECT $$.designation
|
||||
FROM @TABLE AS b
|
||||
@ -34,13 +48,13 @@
|
||||
AS 'Matériel' ;
|
||||
$$.comment AS 'Remarques'"
|
||||
type="movement"
|
||||
direction="entrée"
|
||||
direction="input"
|
||||
order=1}}
|
||||
|
||||
{{:assign var='mvt_key' value=$key}}
|
||||
<tr>
|
||||
<td>{{$date|date_short}}</td>
|
||||
<td>{{$inputNature}}</td>
|
||||
<td>{{$input_nature}}</td>
|
||||
<td>{{$amount}}</td>
|
||||
<td>{{$col4}}</td>
|
||||
<td>{{$comment}}</td>
|
||||
@ -52,7 +66,7 @@
|
||||
target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Modifier"
|
||||
href="../modifier_mouvement.html?key=%s&direction=entrée&caller=%s"|args:$mvt_key:$request_url
|
||||
href="../modifier_mouvement.html?key=%s&direction=input&caller=%s"|args:$mvt_key:$request_url
|
||||
shape="edit"
|
||||
target="_dialog"}}
|
||||
</td>
|
||||
|
@ -1,22 +1,18 @@
|
||||
{{#restrict section="accounting" level="write" block=true}}{{/restrict}}
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
{{:admin_header title="Entrée de matériel" current="module_equipment"}}
|
||||
|
||||
{{if $_GET.dialog === null}}
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="../../_nav.html" current="entrees"}}
|
||||
{{else}}
|
||||
<header class="header">
|
||||
<h1>Entrée de matériel</h1>
|
||||
</header>
|
||||
{{/if}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../../_get_config.html" keep="config"}}
|
||||
|
||||
{{* types d'entrées *}}
|
||||
{{#foreach from=$config.inputNature item="elem"}}
|
||||
{{#foreach from=$config.input_nature item="elem"}}
|
||||
{{if $elem.type != 'retour'}}
|
||||
{{:assign var='types_entrees.' value="%s"|args:$elem.label}}
|
||||
{{:assign var='input_types.' value="%s"|args:$elem.label}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
@ -47,21 +43,21 @@
|
||||
|
||||
{{* Enregistrer le mouvement *}}
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:assign var="operation" from="types_entrees.%d|args:$_POST.type_operation}}
|
||||
{{:assign var="operation" from="input_types.%d"|args:$_POST.type_operation}}
|
||||
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="../movement.schema.json"
|
||||
type="movement"
|
||||
direction="entrée"
|
||||
inputNature=$operation
|
||||
direction="input"
|
||||
input_nature=$operation
|
||||
amount=$_POST.quantite|intval
|
||||
equipment=$equipment_key
|
||||
date=$_POST.date|parse_date
|
||||
comment=$_POST.remarques|trim
|
||||
}}
|
||||
|
||||
{{:redirect force="index.html?ok=1&msg=Entrée de « %s » enregistrée"|args:$_POST.designation}}
|
||||
{{:redirect force="index.html?ok=1&msg=entrée"}}
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
{{/form}}
|
||||
@ -77,16 +73,20 @@
|
||||
|
||||
<fieldset class="entree">
|
||||
<legend>Ajouter une entrée d'un matériel non répertorié</legend>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$types_entrees}}
|
||||
<dl>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$input_types}}
|
||||
{{:input type="date" name="date" label="Date" required=true default=$now|date_short}}
|
||||
{{:input type="number" name="quantite" label="Quantité" required=true default=1}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Matériel</legend>
|
||||
<dl>
|
||||
{{:input type="select" name="category" label="Catégorie" required=true options=$categories}}
|
||||
{{:input type="text" name="designation" label="Désignation" required=true}}
|
||||
{{:input type="textarea" name="remarques" label="Remarques" cols="40", rows="3" required=false}}
|
||||
</fieldset>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
|
@ -1,22 +1,18 @@
|
||||
{{#restrict section="accounting" level="write" block=true}}{{/restrict}}
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
{{:admin_header title="Entrée de matériel" current="module_equipment"}}
|
||||
|
||||
{{if $_GET.dialog === null}}
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="../../_nav.html" current="entrees"}}
|
||||
{{else}}
|
||||
<header class="header">
|
||||
<h1>Entrée de matériel</h1>
|
||||
</header>
|
||||
{{/if}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../../_get_config.html" keep="config"}}
|
||||
|
||||
{{* types d'entrées *}}
|
||||
{{#foreach from=$config.inputNature item="elem"}}
|
||||
{{#foreach from=$config.input_nature item="elem"}}
|
||||
{{if $elem.type != 'retour'}}
|
||||
{{:assign var='types_entrees.' value="%s"|args:$elem.label}}
|
||||
{{:assign var='input_types.' value="%s"|args:$elem.label}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
@ -28,21 +24,21 @@
|
||||
|
||||
{{* Enregistrer le mouvement *}}
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:assign var="operation" from="types_entrees.%d|args:$_POST.type_operation}}
|
||||
{{:assign var="operation" from="input_types.%d|args:$_POST.type_operation}}
|
||||
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="../movement.schema.json"
|
||||
type="movement"
|
||||
direction="entrée"
|
||||
inputNature=$operation
|
||||
direction="input"
|
||||
input_nature=$operation
|
||||
amount=$_POST.quantite|intval
|
||||
equipment=$equipment.key
|
||||
date=$_POST.date|parse_date
|
||||
comment=$_POST.remarques|trim
|
||||
}}
|
||||
|
||||
{{:redirect force="index.html?ok=1&msg=Entrée de « %s » enregistrée"|args:$equipment.designation}}
|
||||
{{:redirect force="index.html?ok=1&msg=entrée"}}
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
{{/form}}
|
||||
@ -64,15 +60,19 @@
|
||||
|
||||
<fieldset class="entree">
|
||||
<legend>Ajouter une entrée d'un matériel répertorié</legend>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$types_entrees}}
|
||||
<dl>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$input_types}}
|
||||
{{:input type="date" name="date" label="Date" required=true default=$now|date_short}}
|
||||
{{:input type="number" name="quantite" label="Quantité" required=true default=1}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Matériel</legend>
|
||||
<dl>
|
||||
{{:input type="select_groups" name="equipment" label="Matériel" required=true options=$equipments}}
|
||||
{{:input type="textarea" name="remarques" label="Remarques" cols="40", rows="3" required=false}}
|
||||
</fieldset>
|
||||
{{:input type="textarea" name="remarques" label="Remarques" cols="40" rows="3" required=false}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
|
@ -1,22 +1,18 @@
|
||||
{{#restrict section="accounting" level="write" block=true}}{{/restrict}}
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
{{:admin_header title="Entrée de matériel" current="module_equipment"}}
|
||||
|
||||
{{if $_GET.dialog === null}}
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="../../_nav.html" current="entrees"}}
|
||||
{{else}}
|
||||
<header class="header">
|
||||
<h1>Entrée de matériel</h1>
|
||||
</header>
|
||||
{{/if}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../../_get_config.html" keep="config"}}
|
||||
|
||||
{{* types d'entrées *}}
|
||||
{{#foreach from=$config.inputNature item="elem"}}
|
||||
{{#foreach from=$config.input_nature item="elem"}}
|
||||
{{if $elem.type == 'retour'}}
|
||||
{{:assign var='types_entrees.' value="%s"|args:$elem.label}}
|
||||
{{:assign var='input_types.' value="%s"|args:$elem.label}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
@ -44,21 +40,21 @@
|
||||
|
||||
{{* Enregistrer le mouvement *}}
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:assign var="operation" from="types_entrees.%d|args:$_POST.type_operation}}
|
||||
{{:assign var="operation" from="input_types.%d|args:$_POST.type_operation}}
|
||||
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="../movement.schema.json"
|
||||
type="movement"
|
||||
direction="entrée"
|
||||
inputNature=$operation
|
||||
direction="input"
|
||||
input_nature=$operation
|
||||
amount=$_POST.quantite|intval
|
||||
equipment=$equipment.key
|
||||
date=$_POST.date|parse_date
|
||||
comment=$_POST.remarques|trim
|
||||
}}
|
||||
|
||||
{{:redirect force="index.html?ok=1&msg=Entrée de « %s » enregistrée"|args:$equipment.designation}}
|
||||
{{:redirect force="index.html?ok=1&msg=entrée"}}
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
{{/form}}
|
||||
@ -88,15 +84,19 @@
|
||||
|
||||
<fieldset class="entree">
|
||||
<legend>Ajouter une entrée pour un retour de matériel</legend>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$types_entrees}}
|
||||
<dl>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$input_types}}
|
||||
{{:input type="date" name="date" label="Date" required=true default=$now|date_short}}
|
||||
{{:input type="number" name="quantite" label="Quantité" required=true default=1}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Matériel</legend>
|
||||
<dl>
|
||||
{{:input type="select_groups" name="equipment" label="Matériel" required=true options=$temporaire}}
|
||||
{{:input type="textarea" name="remarques" label="Remarques" cols="40", rows="3" required=false}}
|
||||
</fieldset>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
|
@ -16,10 +16,10 @@
|
||||
{{else}}
|
||||
{{:error message="Aucune %s avec la clé %s"|args:$_GET.direction:$key_mvt}}
|
||||
{{/load}}
|
||||
{{if $direction == "entrée"}}
|
||||
{{:assign input_init=$mvt_modif.inputNature}}
|
||||
{{if $direction == "input"}}
|
||||
{{:assign input_init=$mvt_modif.input_nature}}
|
||||
{{else}}
|
||||
{{:assign output_init=$mvt_modif.outputNature}}
|
||||
{{:assign output_init=$mvt_modif.output_nature}}
|
||||
{{/if}}
|
||||
{{:assign amount_init=$mvt_modif.amount}}
|
||||
{{:assign date_init=$mvt_modif.date|date_short}}
|
||||
@ -30,19 +30,19 @@
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../_get_config.html" keep="config"}}
|
||||
|
||||
{{if $direction == "entrée"}}
|
||||
{{if $direction == "input"}}
|
||||
{{* types d'entrées *}}
|
||||
{{#foreach from=$config.inputNature key="rang" item="elem"}}
|
||||
{{:assign var='types_entrees.' value="%s"|args:$elem.label}}
|
||||
{{if $elem.label == $mvt_modif.inputNature}}
|
||||
{{#foreach from=$config.input_nature key="rang" item="elem"}}
|
||||
{{:assign var='input_types.' value="%s"|args:$elem.label}}
|
||||
{{if $elem.label == $mvt_modif.input_nature}}
|
||||
{{:assign type_defaut=$rang}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{else}}
|
||||
{{* types de sorties *}}
|
||||
{{#foreach from=$config.outputNature key="rang" item="elem"}}
|
||||
{{#foreach from=$config.output_nature key="rang" item="elem"}}
|
||||
{{:assign var='types_sorties.' value="%s"|args:$elem.label}}
|
||||
{{if $elem.label == $mvt_modif.outputNature}}
|
||||
{{if $elem.label == $mvt_modif.output_nature}}
|
||||
{{:assign type_defaut=$rang}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
@ -59,10 +59,10 @@
|
||||
*}}
|
||||
{{#form on="change"}}
|
||||
{{* préparer le mouvement modifié *}}
|
||||
{{if $direction == "entrée"}}
|
||||
{{:assign var="mvt_modif.inputNature" from="types_entrees.%d"|args:$_POST.type_operation}}
|
||||
{{if $direction == "input"}}
|
||||
{{:assign var="mvt_modif.input_nature" from="input_types.%d"|args:$_POST.type_operation}}
|
||||
{{else}}
|
||||
{{:assign var="mvt_modif.outputNature" from="types_sorties.%d"|args:$_POST.type_operation}}
|
||||
{{:assign var="mvt_modif.output_nature" from="types_sorties.%d"|args:$_POST.type_operation}}
|
||||
{{/if}}
|
||||
{{:assign var="mvt_modif.amount" value=$_POST.amount}}
|
||||
{{:assign var="mvt_modif.equipment" value=$_POST.equipment}}
|
||||
@ -78,8 +78,8 @@
|
||||
id, key,
|
||||
json_extract(document, '$.type') as 'type',
|
||||
json_extract(document, '$.direction') as 'direction',
|
||||
json_extract(document, '$.inputNature') as 'inputNature',
|
||||
json_extract(document, '$.outputNature') as 'outputNature',
|
||||
json_extract(document, '$.input_nature') as 'input_nature',
|
||||
json_extract(document, '$.output_nature') as 'output_nature',
|
||||
json_extract(document, '$.amount') as 'amount',
|
||||
json_extract(document, '$.equipment') as 'equipment',
|
||||
json_extract(document, '$.date') as 'date',
|
||||
@ -130,12 +130,12 @@
|
||||
{{if $erreur}}
|
||||
<p class="block error">
|
||||
Modification demandée impossible :
|
||||
{{if $direction == "entrée"}}
|
||||
{{if $direction == "input"}}
|
||||
« {{$input_init}} de {{$eqpmt_init.designation}} (qté : {{$amount_init}}) en date du {{$date_init}} » vers
|
||||
« {{$mvt_modif.inputNature}} de {{$eqpmt.designation}} (qté : {{$mvt_modif.amount}}) à la date du {{$mvt_modif.date|date_short}} »
|
||||
« {{$mvt_modif.input_nature}} de {{$eqpmt.designation}} (qté : {{$mvt_modif.amount}}) à la date du {{$mvt_modif.date|date_short}} »
|
||||
{{else}}
|
||||
« {{$output_init}} de {{$eqpmt_init.designation}} (qté : {{$amount_init}}) en date du {{$date_init}} » vers
|
||||
« {{$mvt_modif.outputNature}} de {{$eqpmt.designation}} (qté : {{$mvt_modif.amount}}) à la date du {{$mvt_modif.date|date_short}} »
|
||||
« {{$mvt_modif.output_nature}} de {{$eqpmt.designation}} (qté : {{$mvt_modif.amount}}) à la date du {{$mvt_modif.date|date_short}} »
|
||||
{{/if}}
|
||||
</p>
|
||||
{{else}}
|
||||
@ -145,14 +145,14 @@
|
||||
validate_schema="./movement.schema.json"
|
||||
type="movement"
|
||||
direction=$direction
|
||||
inputNature=$mvt_modif.inputNature
|
||||
outputNature=$mvt_modif.outputNature
|
||||
input_nature=$mvt_modif.input_nature
|
||||
output_nature=$mvt_modif.output_nature
|
||||
amount=$mvt_modif.amount|intval
|
||||
equipment=$mvt_modif.equipment
|
||||
date=$mvt_modif.date
|
||||
comment=$mvt_modif.comment
|
||||
}}
|
||||
{{:redirect force="%s?ok=1&msg=Modification enregistrée"|args:$url}}
|
||||
{{:redirect force="%s?ok=1&msg=modification"|args:$url}}
|
||||
{{/if}}
|
||||
|
||||
{{/form}}
|
||||
@ -173,21 +173,26 @@
|
||||
<form method="post" action="">
|
||||
|
||||
<fieldset class="entree">
|
||||
{{if $direction == "entrée"}}
|
||||
{{if $direction == "input"}}
|
||||
<legend>Modifier l'entrée « {{$input_init}} {{$eqpmt_init.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$types_entrees default=$type_defaut}}
|
||||
<dl>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$input_types default=$type_defaut}}
|
||||
{{else}}
|
||||
<legend>Modifier la sortie « {{$output_init}} {{$eqpmt_init.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
||||
<dl>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$types_sorties default=$type_defaut}}
|
||||
{{/if}}
|
||||
{{:input type="date" name="date" label="Date" required=true default=$mvt_modif.date}}
|
||||
{{:input type="number" name="amount" label="Quantité" required=true default=$mvt_modif.amount}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Matériel</legend>
|
||||
<dl>
|
||||
{{:input type="select_groups" name="equipment" label="Matériel" required=true options=$equipments default=$key_eqpmt_init}}
|
||||
{{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false default=$mvt_modif.comment}}
|
||||
</fieldset>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
|
@ -9,13 +9,13 @@
|
||||
"direction" : {
|
||||
"description": "Entrée ou sortie",
|
||||
"type": "string",
|
||||
"enum": ["entrée", "sortie"]
|
||||
"enum": ["input", "output"]
|
||||
},
|
||||
"inputNature": {
|
||||
"input_nature": {
|
||||
"description": "Nature de l'entrée",
|
||||
"type": ["null", "string"]
|
||||
},
|
||||
"outputNature": {
|
||||
"output_nature": {
|
||||
"description": "Nature de la sortie",
|
||||
"type": ["null", "string"]
|
||||
},
|
||||
|
@ -23,8 +23,8 @@
|
||||
|
||||
{{* déterminer s'il s'agit d'une sortie temporaire *}}
|
||||
{{:assign temporaire=false}}
|
||||
{{#foreach from=$config.outputNature item="elem"}}
|
||||
{{if $mvt_suppr.outputNature == $elem.label && $elem.type == 'temporaire'}}
|
||||
{{#foreach from=$config.output_nature item="elem"}}
|
||||
{{if $mvt_suppr.output_nature == $elem.label && $elem.type == 'temporaire'}}
|
||||
{{:assign temporaire=true}}
|
||||
{{:break}}
|
||||
{{/if}}
|
||||
@ -41,17 +41,17 @@
|
||||
|
||||
{{if $key != $_GET.key}}
|
||||
{{* ce n'est pas le mouvement à supprimer : cumuler les entrées/sorties *}}
|
||||
{{if $movement.direction == 'entrée'}}
|
||||
{{if $movement.direction == 'input'}}
|
||||
{{* chercher le type d'entrée parmi les types de la config *}}
|
||||
{{#foreach from=$config.inputNature item="elem"}}
|
||||
{{if $movement.inputNature == $elem.label && $elem.type == 'retour'}}
|
||||
{{#foreach from=$config.input_nature item="elem"}}
|
||||
{{if $movement.input_nature == $elem.label && $elem.type == 'retour'}}
|
||||
{{:assign exterieur="%d-%d"|math:$exterieur:$movement.amount}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{elseif $movement.direction == 'sortie'}}
|
||||
{{elseif $movement.direction == 'output'}}
|
||||
{{* chercher le type de sortie parmi les types de la config *}}
|
||||
{{#foreach from=$config.outputNature item="elem"}}
|
||||
{{if $movement.outputNature == $elem.label && $elem.type == 'temporaire'}}
|
||||
{{#foreach from=$config.output_nature item="elem"}}
|
||||
{{if $movement.output_nature == $elem.label && $elem.type == 'temporaire'}}
|
||||
{{:assign exterieur="%d+%d"|math:$exterieur:$movement.amount}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
@ -59,7 +59,7 @@
|
||||
|
||||
{{* problème ? *}}
|
||||
{{if $exterieur < 0}}
|
||||
{{:redirect force="./index.html?err=1&msg=Impossible de supprimer la sortie « %s %s (%d) en date du %s »"|args:$mvt_suppr.outputNature:$eqpmt_suppr.designation:$amount_suppr:$date_suppr}}
|
||||
{{:redirect force="./index.html?err=1&msg=suppression"}}
|
||||
{{/if}}
|
||||
|
||||
{{/if}}
|
||||
@ -68,14 +68,14 @@
|
||||
|
||||
{{* vérification réussie : supprimer la sortie *}}
|
||||
{{:delete key=$_GET.key}}
|
||||
{{:assign var="msg" value="Sortie « %s %s (%d) en date du %s » supprimée"|args:$mvt_suppr.outputNature:$eqpmt_suppr.designation:$amount_suppr:$date_suppr}}
|
||||
{{:assign var="msg" value="suppression"}}
|
||||
|
||||
{{* voir s'il reste des mouvements pour le matériel concerné par le mouvement supprimé *}}
|
||||
{{#load type="movement" where="$$.equipment = :eqpmt_key" :eqpmt_key=$key_eqpmt_suppr}}
|
||||
{{else}}
|
||||
{{* supprimer le matériel *}}
|
||||
{{:delete key=$key_eqpmt_suppr}}
|
||||
{{:assign var="msg" value="%s - Matériel « %s » supprimé"|args:$msg:$eqpmt_suppr.designation}}
|
||||
{{:assign var="msg" value="%s - matériel"|args:$msg}}
|
||||
{{/load}}
|
||||
|
||||
{{:redirect force="./index.html?ok=1&msg=%s"|args:$msg}}
|
||||
@ -83,7 +83,7 @@
|
||||
|
||||
{{:delete_form
|
||||
legend="Supprimer cette sortie ?"
|
||||
warning="Supprimer la sortie « %s %s (%d) en date du %s » ?"|args:$mvt_suppr.outputNature:$eqpmt_suppr.designation:$amount_suppr:$date_suppr
|
||||
warning="Supprimer la sortie « %s %s (%d) en date du %s » ?"|args:$mvt_suppr.output_nature:$eqpmt_suppr.designation:$amount_suppr:$date_suppr
|
||||
info="S'il ne reste aucun mouvement pour ce matériel, le matériel sera supprimé"
|
||||
}}
|
||||
|
||||
|
@ -1,22 +1,18 @@
|
||||
{{#restrict section="accounting" level="read"}}{{/restrict}}
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
{{:admin_header title="Sortie de matériel" current="module_equipment"}}
|
||||
|
||||
{{if $_GET.dialog === null}}
|
||||
{{if ! $dialog}}
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="../../_nav.html" current="sorties"}}
|
||||
{{else}}
|
||||
<header class="header">
|
||||
<h1>Sortie de matériel</h1>
|
||||
</header>
|
||||
{{/if}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../../_get_config.html" keep="config"}}
|
||||
|
||||
{{* types de sorties *}}
|
||||
{{#foreach from=$config.outputNature item="elem"}}
|
||||
{{#foreach from=$config.output_nature item="elem"}}
|
||||
{{if $elem.type == 'retour'}}
|
||||
{{:assign var='types_sorties.' value="%s"|args:$elem.label}}
|
||||
{{:assign var='output_types.' value="%s"|args:$elem.label}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
@ -45,19 +41,19 @@
|
||||
{{* Enregistrer le mouvement *}}
|
||||
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:assign var="operation" from="types_sorties.%d|args:$_POST.type_operation}}
|
||||
{{:assign var="operation" from="output_types.%d|args:$_POST.type_operation}}
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="../movement.schema.json"
|
||||
type="movement"
|
||||
direction="sortie"
|
||||
outputNature=$operation
|
||||
direction="output"
|
||||
output_nature=$operation
|
||||
amount=$_POST.quantite|intval
|
||||
equipment=$equipment.key
|
||||
date=$_POST.date|parse_date
|
||||
comment=$_POST.remarques|trim
|
||||
}}
|
||||
{{:redirect force="index.html?ok=1&msg=Sortie de « %s » (%d) enregistrée"|args:$designation:$_POST.quantite}}
|
||||
{{:redirect force="index.html?ok=1&msg=sortie"}}
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
{{/form}}
|
||||
@ -85,15 +81,20 @@
|
||||
|
||||
<fieldset class="sortie">
|
||||
<legend>Ajouter une sortie d'un matériel disponible en stock</legend>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$types_sorties}}
|
||||
<dl>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$output_types}}
|
||||
{{: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=1 min=1}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Matériel</legend>
|
||||
<p><span class="alert">La quantité disponible est celle à la date du jour</span></p>
|
||||
<dl>
|
||||
{{:input type="select_groups" name="equipment" label="Matériel" required=true options=$temporaire onchange="fixerValeurMax('f_equipment', 'f_quantite')"}}
|
||||
{{:input type="textarea" name="remarques" label="Remarques" cols="40" rows="3" required=false}}
|
||||
</fieldset>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
|
@ -5,16 +5,30 @@
|
||||
{{:include file="../../_nav.html" current="sorties"}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
<p class="block confirm">{{$_GET.msg}}</p>
|
||||
{{if $_GET.msg|match:"suppression"}}
|
||||
{{:assign msg="Sortie supprimée"}}
|
||||
{{if $_GET.msg|match:"matériel"}}
|
||||
{{:assign var="msg" value="%s - Matériel supprimé"|args:$msg}}
|
||||
{{/if}}
|
||||
{{elseif $_GET.msg == "sortie"}}
|
||||
{{:assign msg="Sortie enregistrée"}}
|
||||
{{elseif $_GET.msg == "modification"}}
|
||||
{{:assign msg="Sortie modifiée"}}
|
||||
{{/if}}
|
||||
<p class="block confirm">{{$msg}}</p>
|
||||
{{elseif $_GET.err}}
|
||||
<p class="block error">{{$_GET.msg}}</p>
|
||||
{{if $_GET.msg == "suppression"}}
|
||||
<p class="block error">Impossible de supprimer la sortie</p>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset class="sortie">
|
||||
<legend>Ajouter une sortie </legend>
|
||||
{{:linkbutton label="Matériel en stock disponible" shape="plus" href="stock_disponible.html?dialog" target="_dialog"}}
|
||||
{{:linkbutton label="Matériel emprunté" shape="plus" href="emprunte.html?dialog" target="_dialog"}}
|
||||
<dl>
|
||||
{{:linkbutton label="Matériel en stock disponible" shape="plus" href="stock_disponible.html" target="_dialog"}}
|
||||
{{:linkbutton label="Matériel emprunté" shape="plus" href="emprunte.html" target="_dialog"}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@ -25,7 +39,7 @@
|
||||
{{#list
|
||||
select="
|
||||
$$.date AS 'Date' ;
|
||||
$$.outputNature AS 'Type' ;
|
||||
$$.output_nature AS 'Type' ;
|
||||
$$.amount AS 'Nombre' ;
|
||||
(SELECT $$.designation
|
||||
FROM @TABLE AS b
|
||||
@ -33,13 +47,13 @@
|
||||
AS 'Matériel' ;
|
||||
$$.comment AS 'Remarques'"
|
||||
type="movement"
|
||||
direction="sortie"
|
||||
direction="output"
|
||||
order=1}}
|
||||
|
||||
{{:assign var='mvt_key' value=$key}}
|
||||
<tr>
|
||||
<td>{{$date|date_short}}</td>
|
||||
<td>{{$outputNature}}</td>
|
||||
<td>{{$output_nature}}</td>
|
||||
<td>{{$amount}}</td>
|
||||
<td>{{$col4}}</td>
|
||||
<td>{{$comment}}</td>
|
||||
@ -51,7 +65,7 @@
|
||||
target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Modifier"
|
||||
href="../modifier_mouvement.html?key=%s&direction=sortie&caller=%s"|args:$mvt_key:$request_url
|
||||
href="../modifier_mouvement.html?key=%s&direction=output&caller=%s"|args:$mvt_key:$request_url
|
||||
shape="edit"
|
||||
target="_dialog"}}
|
||||
</td>
|
||||
|
@ -1,22 +1,18 @@
|
||||
{{#restrict section="accounting" level="write" block=true}}{{/restrict}}
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
{{:admin_header title="Sortie de matériel" current="module_equipment"}}
|
||||
|
||||
{{if $_GET.dialog === null}}
|
||||
{{if ! $dialog}}
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="../../_nav.html" current="sorties"}}
|
||||
{{else}}
|
||||
<header class="header">
|
||||
<h1>Sortie de matériel</h1>
|
||||
</header>
|
||||
{{/if}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../../_get_config.html" keep="config"}}
|
||||
|
||||
{{* types de sorties *}}
|
||||
{{#foreach from=$config.outputNature item="elem"}}
|
||||
{{#foreach from=$config.output_nature item="elem"}}
|
||||
{{if $elem.type != 'retour'}}
|
||||
{{:assign var='types_sorties.' value="%s"|args:$elem.label}}
|
||||
{{:assign var='output_types.' value="%s"|args:$elem.label}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
@ -47,19 +43,19 @@
|
||||
{{* Enregistrer le mouvement *}}
|
||||
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:assign var="operation" from="types_sorties.%d|args:$_POST.type_operation}}
|
||||
{{:assign var="operation" from="output_types.%d|args:$_POST.type_operation}}
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="../movement.schema.json"
|
||||
type="movement"
|
||||
direction="sortie"
|
||||
outputNature=$operation
|
||||
direction="output"
|
||||
output_nature=$operation
|
||||
amount=$_POST.quantite|intval
|
||||
equipment=$equipment.key
|
||||
date=$_POST.date|parse_date
|
||||
comment=$_POST.remarques|trim
|
||||
}}
|
||||
{{:redirect force="index.html?ok=1&msg=Sortie de « %s » (%d) enregistrée"|args:$designation:$_POST.quantite}}
|
||||
{{:redirect force="index.html?ok=1&msg=sortie"}}
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
{{/form}}
|
||||
@ -87,15 +83,20 @@
|
||||
|
||||
<fieldset class="sortie">
|
||||
<legend>Ajouter une sortie d'un matériel disponible en stock</legend>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$types_sorties}}
|
||||
<dl>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$output_types}}
|
||||
{{: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=1 min=1}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Matériel</legend>
|
||||
<p><span class="alert">La quantité disponible est celle à la date du jour</span></p>
|
||||
<dl>
|
||||
{{:input type="select_groups" name="equipment" label="Matériel" required=true options=$disponibilites onchange="fixerValeurMax('f_equipment', 'f_quantite')"}}
|
||||
{{:input type="textarea" name="remarques" label="Remarques" cols="40" rows="3" required=false}}
|
||||
</fieldset>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
|
@ -14,10 +14,10 @@
|
||||
{{:assign nonprop=0}}
|
||||
{{#foreach from=$movements item="movement"}}
|
||||
{{if $movement.equipment == $eqpmt_key}}
|
||||
{{if $movement.direction == 'entrée'}}
|
||||
{{if $movement.direction == 'input'}}
|
||||
{{* chercher le type d'entrée parmi les types de la config *}}
|
||||
{{#foreach from=$config.inputNature item="elem"}}
|
||||
{{if $movement.inputNature == $elem.label}}
|
||||
{{#foreach from=$config.input_nature item="elem"}}
|
||||
{{if $movement.input_nature == $elem.label}}
|
||||
{{if $elem.type == 'définitif'}}
|
||||
{{:assign stock="%d+%d"|math:$stock:$movement.amount}}
|
||||
{{elseif $elem.type == 'retour'}}
|
||||
@ -27,10 +27,10 @@
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{elseif $movement.direction == 'sortie'}}
|
||||
{{elseif $movement.direction == 'output'}}
|
||||
{{* chercher le type de sortie parmi les types de la config *}}
|
||||
{{#foreach from=$config.outputNature item="elem"}}
|
||||
{{if $movement.outputNature == $elem.label}}
|
||||
{{#foreach from=$config.output_nature item="elem"}}
|
||||
{{if $movement.output_nature == $elem.label}}
|
||||
{{if $elem.type == 'définitif'}}
|
||||
{{:assign stock="%d-%d"|math:$stock:$movement.amount}}
|
||||
{{elseif $elem.type == 'temporaire'}}
|
||||
|
Loading…
Reference in New Issue
Block a user