Compare commits
No commits in common. "d19c4ce3fd76737d846dcbd598974e8f1d3eb9e0" and "c70668831c982a9da27d63849be566655475d36a" have entirely different histories.
d19c4ce3fd
...
c70668831c
@ -7,15 +7,18 @@
|
||||
|
||||
{{* liste des catégories *}}
|
||||
{{if $categories === null}}
|
||||
{{#load type="category"}}
|
||||
{{#select
|
||||
key
|
||||
FROM module_data_equipment as cat
|
||||
WHERE json_extract(cat.document, '$.type') = 'category'}}
|
||||
{{:assign var="categories." value=$key}}
|
||||
{{/load}}
|
||||
{{/select}}
|
||||
{{/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}}
|
||||
|
||||
@ -29,8 +32,8 @@
|
||||
mvt.key as 'mvt_key',
|
||||
json_extract(mvt.document, '$.direction') as 'direction',
|
||||
CASE json_extract(mvt.document, '$.direction')
|
||||
WHEN 'input' THEN json_extract(mvt.document, '$.input_nature')
|
||||
WHEN 'output' THEN json_extract(mvt.document, '$.output_nature')
|
||||
WHEN 'entrée' THEN json_extract(mvt.document, '$.inputNature')
|
||||
WHEN 'sortie' THEN json_extract(mvt.document, '$.outputNature')
|
||||
END
|
||||
AS 'operation',
|
||||
json_extract(mvt.document, '$.amount') AS 'nombre'
|
||||
@ -82,11 +85,11 @@
|
||||
{{/if}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="./_get_config.html" keep="config"}}
|
||||
{{:include file="/%s/_get_config.html"|args:$module.name keep="config"}}
|
||||
|
||||
{{if $direction === 'input'}}
|
||||
{{if $direction === 'entrée'}}
|
||||
{{* chercher le type d'entrée parmi les types de la config *}}
|
||||
{{#foreach from=$config.input_nature item="elem"}}
|
||||
{{#foreach from=$config.inputNature item="elem"}}
|
||||
{{if $operation == $elem.label}}
|
||||
{{if $elem.type == 'définitif'}}
|
||||
{{:assign stock="%d+%d"|math:$stock:$nombre}}
|
||||
@ -107,9 +110,9 @@
|
||||
{{:break}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{elseif $direction === 'output'}}
|
||||
{{elseif $direction === 'sortie'}}
|
||||
{{* chercher le type de sortie parmi les types de la config *}}
|
||||
{{#foreach from=$config.output_nature item="elem"}}
|
||||
{{#foreach from=$config.outputNature item="elem"}}
|
||||
{{if $operation == $elem.label}}
|
||||
{{if $elem.type == 'définitif'}}
|
||||
{{:assign stock="%d-%d"|math:$stock:$nombre}}
|
||||
|
@ -1,34 +1,36 @@
|
||||
{{*
|
||||
Récupérer soit la config enregistrée, soit la config par défaut
|
||||
résultat : config.input_nature et config.output_nature
|
||||
résultat : config.inputNature et config.outputNature
|
||||
*}}
|
||||
|
||||
{{* config par défaut *}}
|
||||
{{:read file="./defaut.json" assign="config_defaut"}}
|
||||
{{:read file="/%s/defaut.json"|args:$module.name assign="config_defaut"}}
|
||||
{{:assign config_defaut=$config_defaut|json_decode}}
|
||||
|
||||
{{if $module.config.input_nature != null}}
|
||||
{{:assign var=config.input_nature value=$module.config.input_nature}}
|
||||
{{if $module.config.inputNature != null}}
|
||||
{{:assign var=config.inputNature value=$module.config.inputNature}}
|
||||
{{else}}
|
||||
{{* pas de config enregistrée : utiliser la config par défaut *}}
|
||||
{{#foreach from=$config_defaut.inputs item="elem"}}
|
||||
{{#foreach from=$config_defaut.entrées item="elem"}}
|
||||
{{#foreach from=$elem key=label item=value}}
|
||||
{{:assign var="item.label" value=$label}}
|
||||
{{:assign var="item.type" value=$value}}
|
||||
{{:assign var="config.input_nature." value=$item}}
|
||||
{{:assign var="config.inputNature." value=$item}}
|
||||
{{/foreach}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
|
||||
{{if $module.config.output_nature != null}}
|
||||
{{:assign var=config.output_nature value=$module.config.output_nature}}
|
||||
{{if $module.config.outputNature != null}}
|
||||
{{:assign var=config.outputNature value=$module.config.outputNature}}
|
||||
{{else}}
|
||||
{{* pas de config enregistrée : utiliser la config par défaut *}}
|
||||
{{#foreach from=$config_defaut.outputs item="elem"}}
|
||||
{{#foreach from=$config_defaut.sorties item="elem"}}
|
||||
{{#foreach from=$elem key=label item=value}}
|
||||
{{:assign var="item.label" value=$label}}
|
||||
{{:assign var="item.type" value=$value}}
|
||||
{{:assign var="config.output_nature." value=$item}}
|
||||
{{:assign var="config.outputNature." value=$item}}
|
||||
{{/foreach}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
|
||||
|
||||
|
11
_nav.html
11
_nav.html
@ -1,9 +1,10 @@
|
||||
{{:assign base_path="/m/%s"|args:$module.name}}
|
||||
<nav class="tabs">
|
||||
<ul>
|
||||
<li {{if $current == 'index'}} class="current"{{/if}}><a href="{{$module.url}}index.html">Inventaire</a></li>
|
||||
<li {{if $current == 'categories'}} class="current"{{/if}}><a href="{{$module.url}}categories/index.html">Catégories</a></li>
|
||||
<li {{if $current == 'entrees'}} class="current"{{/if}}><a href="{{$module.url}}mouvements/entrees/index.html">Entrées</a></li>
|
||||
<li {{if $current == 'sorties'}} class="current"{{/if}}><a href="{{$module.url}}mouvements/sorties/index.html">Sorties</a></li>
|
||||
<li {{if $current == 'config'}} class="current"{{/if}}><a href="{{$module.url}}config.html">Configuration</a></li>
|
||||
<li {{if $current == 'index'}} class="current"{{/if}}><a href="{{$base_path}}/index.html">Inventaire</a></li>
|
||||
<li {{if $current == 'categories'}} class="current"{{/if}}><a href="{{$base_path}}/categories/index.html">Catégories</a></li>
|
||||
<li {{if $current == 'entrees'}} class="current"{{/if}}><a href="{{$base_path}}/mouvements/entrees/index.html">Entrées</a></li>
|
||||
<li {{if $current == 'sorties'}} class="current"{{/if}}><a href="{{$base_path}}/mouvements/sorties/index.html">Sorties</a></li>
|
||||
<li {{if $current == 'config'}} class="current"{{/if}}><a href="{{$base_path}}/config.html">Configuration</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
@ -9,12 +9,13 @@
|
||||
{{#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=suppression"}}
|
||||
{{:redirect force="./index.html?err=1&msg=Cette catégorie ne peut être supprimée car elle contient encore des matériels"}}
|
||||
{{else}}
|
||||
{{* supprimer la catégorie sélectionnée*}}
|
||||
{{:delete where="key = :key" :key=$category.key}}
|
||||
{{:redirect force="./index.html?ok=1&msg=suppression"}}
|
||||
{{:redirect force="./index.html?ok=1&msg=La catégorie « %s » a été supprimée"|args:$category.name}}
|
||||
{{/load}}
|
||||
|
||||
{{/form}}
|
||||
|
||||
{{:delete_form
|
||||
|
@ -2,21 +2,13 @@
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="../_nav.html" current="categories"}}
|
||||
{{:include file="/%s/_nav.html"|args:$module.name current="categories"}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
{{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 confirm">{{$_GET.msg}}</p>
|
||||
{{else}}
|
||||
{{if $_GET.err}}
|
||||
<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}}
|
||||
|
||||
|
@ -8,14 +8,14 @@
|
||||
|
||||
{{if $_GET.dialog === null}}
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="../_nav.html" current="categories"}}
|
||||
{{:include file="/%s/_nav.html"|args:$module.name current="categories"}}
|
||||
{{else}}
|
||||
<header class="header">
|
||||
<header class="header">
|
||||
<h1>Matériels de la catégorie « {{$cat_name}} »</h1>
|
||||
</header>
|
||||
</header>
|
||||
{{/if}}
|
||||
|
||||
{{:assign var="categories." value=$_GET.key}}
|
||||
{{:include file="../inventaire.html"}}
|
||||
{{:include file="/%s/inventaire.html"|args:$module.name}}
|
||||
|
||||
{{:admin_footer}}
|
||||
|
@ -14,7 +14,7 @@
|
||||
type="category"
|
||||
name=$_POST.name|trim
|
||||
}}
|
||||
{{:redirect force="./index.html?ok=1&msg=modification"}}
|
||||
{{:redirect force="./index.html?ok=1&msg=Catégorie modifiée"}}
|
||||
{{/form}}
|
||||
|
||||
{{:form_errors}}
|
||||
|
56
config.html
56
config.html
@ -2,7 +2,7 @@
|
||||
{{:admin_header title="Configuration" current="module_equipment"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="_nav.html" current="config"}}
|
||||
{{:include file="/%s/_nav.html"|args:$module.name current="config"}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
<p class="block confirm">Configuration enregistrée.</p>
|
||||
@ -13,32 +13,32 @@
|
||||
|
||||
{{:save key="config"
|
||||
validate_schema="./config.schema.json"
|
||||
input_nature=$_POST.input_fields|array_transpose
|
||||
output_nature=$_POST.output_fields|array_transpose
|
||||
inputNature=$_POST.input_fields|array_transpose
|
||||
outputNature=$_POST.output_fields|array_transpose
|
||||
}}
|
||||
{{:redirect to="./config.html?ok=1"}}
|
||||
{{/form}}
|
||||
|
||||
{{* config par défaut *}}
|
||||
{{:read file="./defaut.json" assign="config_defaut"}}
|
||||
{{:read file="/%s/defaut.json"|args:$module.name assign="config_defaut"}}
|
||||
{{:assign config_defaut=$config_defaut|json_decode}}
|
||||
|
||||
{{* types d'entrées *}}
|
||||
{{#foreach from=$config_defaut.inputs item="elem"}}
|
||||
{{#foreach from=$config_defaut.entrées item="elem"}}
|
||||
{{#foreach from=$elem key=label item=value}}
|
||||
{{:assign var='input_types.%s'|args:$value value=$value}}
|
||||
{{:assign var='types_entrees.%s'|args:$value value=$value}}
|
||||
{{/foreach}}
|
||||
{{/foreach}}
|
||||
|
||||
{{* types de sorties *}}
|
||||
{{#foreach from=$config_defaut.outputs item="elem"}}
|
||||
{{#foreach from=$config_defaut.sorties item="elem"}}
|
||||
{{#foreach from=$elem key=label item=value}}
|
||||
{{:assign var='output_typess.%s'|args:$value value=$value}}
|
||||
{{:assign var='types_sorties.%s'|args:$value value=$value}}
|
||||
{{/foreach}}
|
||||
{{/foreach}}
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset>
|
||||
<fieldset>
|
||||
<legend>Entrées</legend>
|
||||
<table class="list input_fields">
|
||||
<thead>
|
||||
@ -49,11 +49,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="input_body">
|
||||
{{#foreach from=$module.config.input_nature item="input_field"}}
|
||||
{{#foreach from=$module.config.inputNature item="input_field"}}
|
||||
|
||||
{{* Vérifier si la suppression de ce type d'entrée est possible *}}
|
||||
{{:assign suppr=true}}
|
||||
{{#load type="movement" where="$$.input_nature = :libelle" :libelle=$input_field.label}}
|
||||
{{#load type="movement" where="$$.inputNature = :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=$input_types
|
||||
options=$types_entrees
|
||||
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.inputs item="elem"}}
|
||||
{{#foreach from=$config_defaut.entrées 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="$$.input_nature = :libelle" :libelle=$label}}
|
||||
{{#load type="movement" where="$$.inputNature = :libelle" :libelle=$label}}
|
||||
{{:assign suppr=false}}
|
||||
{{/load}}
|
||||
|
||||
@ -90,7 +90,7 @@
|
||||
<td>{{:input
|
||||
type="select"
|
||||
name="input_fields[type][]"
|
||||
options=$input_types
|
||||
options=$types_entrees
|
||||
required=true
|
||||
default=$value
|
||||
default_empty="— Choisir un type —"}}
|
||||
@ -109,7 +109,9 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="actions">
|
||||
{{:button shape="plus" label="Ajouter un champ" onclick="addLine('#input_body')"}}
|
||||
{{:button shape="plus"
|
||||
label="Ajouter un champ"
|
||||
onclick="addLine('#input_body')"}}
|
||||
</p>
|
||||
<div class="help block">
|
||||
<h3>Signification du type d'entrée</h3>
|
||||
@ -119,9 +121,9 @@
|
||||
<li><b>retour</b> : matériel qui revient après une sortie temporaire (ex : retour de location ou de prêt)</li>
|
||||
</ul>
|
||||
</div>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<fieldset>
|
||||
<legend>Sorties</legend>
|
||||
<table class="list output_fields">
|
||||
<thead>
|
||||
@ -132,11 +134,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="output_body">
|
||||
{{#foreach from=$module.config.output_nature item="output_field"}}
|
||||
{{#foreach from=$module.config.outputNature item="output_field"}}
|
||||
|
||||
{{* Vérifier si la suppression de ce type de sortie est possible *}}
|
||||
{{:assign suppr=true}}
|
||||
{{#load type="movement" where="$$.output_nature = :libelle" :libelle=$output_field.label}}
|
||||
{{#load type="movement" where="$$.outputNature = :libelle" :libelle=$output_field.label}}
|
||||
{{:assign suppr=false}}
|
||||
{{/load}}
|
||||
|
||||
@ -145,7 +147,7 @@
|
||||
<td>{{:input
|
||||
type="select"
|
||||
name="output_fields[type][]"
|
||||
options=$output_typess
|
||||
options=$types_sorties
|
||||
default=$output_field.type
|
||||
required=true
|
||||
default_empty="— Choisir un type —"}}
|
||||
@ -160,12 +162,12 @@
|
||||
</tr>
|
||||
{{else}}
|
||||
{{* pas de config enregistrée : utiliser les valeurs par défaut *}}
|
||||
{{#foreach from=$config_defaut.outputs item="elem"}}
|
||||
{{#foreach from=$config_defaut.sorties 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="$$.input_nature = :libelle" :libelle=$label}}
|
||||
{{#load type="movement" where="$$.inputNature = :libelle" :libelle=$label}}
|
||||
{{:assign suppr=false}}
|
||||
{{/load}}
|
||||
|
||||
@ -174,7 +176,7 @@
|
||||
<td>{{:input
|
||||
type="select"
|
||||
name="output_fields[type][]"
|
||||
options=$output_typess
|
||||
options=$types_sorties
|
||||
required=true
|
||||
default=$value
|
||||
default_empty="— Choisir un type —"}}
|
||||
@ -205,9 +207,9 @@
|
||||
<li><b>retour</b> : le matériel <strong>non propriété de l'asso</strong> est rendu à son propriétaire (ex : retour de location ou d'emprunt)</li>
|
||||
</dl>
|
||||
</div>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
<p class="submit">
|
||||
{{:button
|
||||
type="submit"
|
||||
name="save"
|
||||
@ -215,7 +217,7 @@
|
||||
shape="right"
|
||||
class="main"
|
||||
}}
|
||||
</p>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -2,7 +2,7 @@
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"input_nature": {
|
||||
"inputNature": {
|
||||
"description": "Nature des entrées",
|
||||
"type": ["array", "null"],
|
||||
"items": {
|
||||
@ -18,7 +18,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"output_nature": {
|
||||
"outputNature": {
|
||||
"description": "Nature des sorties",
|
||||
"type": ["array", "null"],
|
||||
"items": {
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"inputs" : [
|
||||
"entrées" : [
|
||||
{ "Achat" : "définitif" },
|
||||
{ "Location" : "temporaire" },
|
||||
{ "Retour de Location/Prêt" : "retour" }
|
||||
],
|
||||
"outputs" : [
|
||||
"sorties" : [
|
||||
{ "Vente" : "définitif" },
|
||||
{ "Prêt" : "temporaire" },
|
||||
{ "Retour de Location/Emprunt" : "retour" }
|
||||
|
@ -20,21 +20,21 @@
|
||||
{{#list
|
||||
type="movement"
|
||||
select="$$.date AS 'Date';
|
||||
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';
|
||||
$$.direction AS 'Mvt';
|
||||
CASE $$.direction WHEN 'entrée' THEN $$.inputNature WHEN 'sortie' THEN $$.outputNature END AS 'Type';
|
||||
$$.amount AS 'Nombre';
|
||||
$$.comment AS 'Commentaire'"
|
||||
equipment=$equipment_key
|
||||
order=1
|
||||
}}
|
||||
<tr>
|
||||
<tr>
|
||||
<td>{{$date|date_short}}</td>
|
||||
<td>{{$col2}}</td>
|
||||
<td>{{$direction}}</td>
|
||||
<td>{{$col3}}</td>
|
||||
<td>{{$amount}}</td>
|
||||
<td>{{$comment}}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tr>
|
||||
{{/list}}
|
||||
|
||||
{{:admin_footer}}
|
||||
|
17
index.html
17
index.html
@ -1,17 +1,16 @@
|
||||
{{#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"}}
|
||||
{{:include file="/%s/_nav.html"|args:$module.name current="index"}}
|
||||
|
||||
{{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"}}
|
||||
{{#select
|
||||
key
|
||||
FROM module_data_equipment as cat
|
||||
WHERE json_extract(cat.document, '$.type') = 'category'
|
||||
}}
|
||||
{{:assign var="categories." value=$key}}
|
||||
{{/load}}
|
||||
{{/select}}
|
||||
|
||||
{{if $categories|count == 0}}
|
||||
<p class="block alert">Il n'y a aucune catégorie : vous devez en ajouter.</p>
|
||||
|
@ -12,7 +12,8 @@
|
||||
<p class="block alert">Il n'y a aucun matériel dans ces catégories.</p>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<section class="inventaire">
|
||||
|
||||
<section class="inventaire">
|
||||
<h2 class="ruler">Matériels dont l'association est propriétaire</h2>
|
||||
|
||||
{{* itérer sur les catégories *}}
|
||||
@ -44,6 +45,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{{:assign base_path="/m/%s"|args:$module.name}}
|
||||
{{* itérer sur les matériels de la catégorie *}}
|
||||
{{#foreach from=$category.eqpmt key="eqpmt_key" item="eqpmt"}}
|
||||
|
||||
@ -58,12 +60,12 @@
|
||||
<td class="actions">
|
||||
{{:linkbutton
|
||||
label="Historique des mouvements"
|
||||
href="%shistorique.html?key=%s"|args:$module.url:$eqpmt_key
|
||||
href="%s/historique.html?key=%s"|args:$base_path:$eqpmt_key
|
||||
shape="table"
|
||||
target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Modifier"
|
||||
href="%smodifier_materiel.html?key=%s"|args:$module.url:$eqpmt_key
|
||||
href="%s/modifier_materiel.html?key=%s"|args:$base_path:$eqpmt_key
|
||||
shape="edit"
|
||||
target="_dialog"}}
|
||||
</td>
|
||||
@ -120,12 +122,12 @@
|
||||
<td class="actions">
|
||||
{{:linkbutton
|
||||
label="Historique des mouvements"
|
||||
href="%shistorique.html?key=%s"|args:$module.url:$eqpmt_key
|
||||
href="%s/historique.html?key=%s"|args:$base_path:$eqpmt_key
|
||||
shape="table"
|
||||
target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Modifier"
|
||||
href="%smodifier_materiel.html?key=%s"|args:$module.url:$eqpmt_key
|
||||
href="%s/modifier_materiel.html?key=%s"|args:$base_path:$eqpmt_key
|
||||
shape="edit"
|
||||
target="_dialog"}}
|
||||
</td>
|
||||
@ -140,5 +142,5 @@
|
||||
<p class="block alert">Il n'y a aucun matériel dans cette catégorie.</p>
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
</section>
|
||||
</section>
|
||||
{{/if}}
|
||||
|
@ -48,7 +48,7 @@
|
||||
category=$category.key
|
||||
designation=$_POST.designation|trim
|
||||
}}
|
||||
{{:redirect force="index.html?ok=1"}}
|
||||
{{:redirect force="index.html?ok=1&msg=Modification enregistrée"}}
|
||||
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
@ -62,10 +62,8 @@
|
||||
<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">
|
||||
|
@ -19,7 +19,7 @@
|
||||
{{#form on="delete"}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../../_get_config.html" keep="config"}}
|
||||
{{:include file="/%s/_get_config.html"|args:$module.name keep="config"}}
|
||||
|
||||
{{* vérifier s'il est possible de supprimer l'entrée *}}
|
||||
{{:assign dispo=0}}
|
||||
@ -34,10 +34,10 @@
|
||||
|
||||
{{if $key != $_GET.key}}
|
||||
{{* ce n'est pas le mouvement à supprimer : cumuler les entrées/sorties *}}
|
||||
{{if $movement.direction == 'input'}}
|
||||
{{if $movement.direction == 'entrée'}}
|
||||
{{* chercher le type d'entrée parmi les types de la config *}}
|
||||
{{#foreach from=$config.input_nature item="elem"}}
|
||||
{{if $movement.input_nature == $elem.label}}
|
||||
{{#foreach from=$config.inputNature item="elem"}}
|
||||
{{if $movement.inputNature == $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 == 'output'}}
|
||||
{{elseif $movement.direction == 'sortie'}}
|
||||
{{* chercher le type de sortie parmi les types de la config *}}
|
||||
{{#foreach from=$config.output_nature item="elem"}}
|
||||
{{if $movement.output_nature == $elem.label}}
|
||||
{{#foreach from=$config.outputNature item="elem"}}
|
||||
{{if $movement.outputNature == $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=suppression"}}
|
||||
{{: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}}
|
||||
{{/if}}
|
||||
|
||||
{{/if}}
|
||||
@ -68,14 +68,14 @@
|
||||
|
||||
{{* vérification réussie : supprimer l'entrée *}}
|
||||
{{:delete key=$_GET.key}}
|
||||
{{:assign var="msg" value="suppression"}}
|
||||
{{: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}}
|
||||
|
||||
{{* 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"|args:$msg}}
|
||||
{{:assign var="msg" value="%s - Matériel « %s » supprimé"|args:$msg:$eqpmt_suppr.designation}}
|
||||
{{/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.input_nature:$eqpmt_suppr.designation:$amount_suppr:$date_suppr
|
||||
warning="Supprimer l'entrée « %s %s (%d) en date du %s » ?"|args:$mvt_suppr.inputNature:$eqpmt_suppr.designation:$amount_suppr:$date_suppr
|
||||
info="S'il ne reste aucun mouvement pour ce matériel, le matériel sera supprimé"
|
||||
}}
|
||||
|
||||
|
@ -2,34 +2,20 @@
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="../../_nav.html" current="entrees"}}
|
||||
{{:include file="/%s/_nav.html"|args:$module.name current="entrees"}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
{{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>
|
||||
<p class="block confirm">{{$_GET.msg}}</p>
|
||||
{{elseif $_GET.err}}
|
||||
{{if $_GET.msg == "suppression"}}
|
||||
<p class="block error">Impossible de supprimer l'entrée</p>
|
||||
{{/if}}
|
||||
<p class="block error">{{$_GET.msg}}</p>
|
||||
{{/if}}
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset class="entree">
|
||||
<legend>Ajouter une entrée</legend>
|
||||
<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>
|
||||
{{: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"}}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@ -40,20 +26,21 @@
|
||||
{{#list
|
||||
select="
|
||||
$$.date AS 'Date' ;
|
||||
$$.input_nature AS 'Type' ;
|
||||
$$.inputNature AS 'Type' ;
|
||||
$$.amount AS 'Nombre' ;
|
||||
(SELECT $$.designation
|
||||
FROM @TABLE AS b
|
||||
WHERE b.key = @TABLE.$$.equipment) AS 'Matériel' ;
|
||||
WHERE b.key = @TABLE.$$.equipment)
|
||||
AS 'Matériel' ;
|
||||
$$.comment AS 'Remarques'"
|
||||
type="movement"
|
||||
direction="input"
|
||||
direction="entrée"
|
||||
order=1}}
|
||||
|
||||
{{:assign var='mvt_key' value=$key}}
|
||||
<tr>
|
||||
<td>{{$date|date_short}}</td>
|
||||
<td>{{$input_nature}}</td>
|
||||
<td>{{$inputNature}}</td>
|
||||
<td>{{$amount}}</td>
|
||||
<td>{{$col4}}</td>
|
||||
<td>{{$comment}}</td>
|
||||
@ -65,7 +52,7 @@
|
||||
target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Modifier"
|
||||
href="../modifier_mouvement.html?key=%s&direction=input"|args:$mvt_key
|
||||
href="../modifier_mouvement.html?key=%s&direction=entrée&caller=%s"|args:$mvt_key:$request_url
|
||||
shape="edit"
|
||||
target="_dialog"}}
|
||||
</td>
|
||||
|
@ -1,18 +1,22 @@
|
||||
{{#restrict section="accounting" level="write" block=true}}{{/restrict}}
|
||||
{{:admin_header title="Entrée de matériel" current="module_equipment"}}
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="../../_nav.html" current="entrees"}}
|
||||
{{if $_GET.dialog === null}}
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="/%s/_nav.html"|args:$module.name 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"}}
|
||||
{{:include file="/%s/_get_config.html"|args:$module.name keep="config"}}
|
||||
|
||||
{{* types d'entrées *}}
|
||||
{{#foreach from=$config.input_nature item="elem"}}
|
||||
{{#foreach from=$config.inputNature item="elem"}}
|
||||
{{if $elem.type != 'retour'}}
|
||||
{{:assign var='input_types.' value="%s"|args:$elem.label}}
|
||||
{{:assign var='types_entrees.' value="%s"|args:$elem.label}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
@ -34,7 +38,7 @@
|
||||
{{* enregistrer un nouveau matériel *}}
|
||||
{{:save
|
||||
key=$equipment_key
|
||||
validate_schema="../../equipment.schema.json"
|
||||
validate_schema="/%s/equipment.schema.json"|args:$module.name
|
||||
type="equipment"
|
||||
category=$category.key
|
||||
designation=$_POST.designation|trim
|
||||
@ -43,21 +47,21 @@
|
||||
|
||||
{{* Enregistrer le mouvement *}}
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:assign var="operation" from="input_types.%d"|args:$_POST.type_operation}}
|
||||
{{:assign var="operation" from="types_entrees.%d|args:$_POST.type_operation}}
|
||||
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="../movement.schema.json"
|
||||
validate_schema="/%s/mouvements/movement.schema.json"|args:$module.name
|
||||
type="movement"
|
||||
direction="input"
|
||||
input_nature=$operation
|
||||
direction="entrée"
|
||||
inputNature=$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"}}
|
||||
{{:redirect force="index.html?ok=1&msg=Entrée de « %s » enregistrée"|args:$_POST.designation}}
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
{{/form}}
|
||||
@ -73,20 +77,16 @@
|
||||
|
||||
<fieldset class="entree">
|
||||
<legend>Ajouter une entrée d'un matériel non répertorié</legend>
|
||||
<dl>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$input_types}}
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$types_entrees}}
|
||||
{{: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}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
|
@ -1,18 +1,22 @@
|
||||
{{#restrict section="accounting" level="write" block=true}}{{/restrict}}
|
||||
{{:admin_header title="Entrée de matériel" current="module_equipment"}}
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="../../_nav.html" current="entrees"}}
|
||||
{{if $_GET.dialog === null}}
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="/%s/_nav.html"|args:$module.name 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"}}
|
||||
{{:include file="/%s/_get_config.html"|args:$module.name keep="config"}}
|
||||
|
||||
{{* types d'entrées *}}
|
||||
{{#foreach from=$config.input_nature item="elem"}}
|
||||
{{#foreach from=$config.inputNature item="elem"}}
|
||||
{{if $elem.type != 'retour'}}
|
||||
{{:assign var='input_types.' value="%s"|args:$elem.label}}
|
||||
{{:assign var='types_entrees.' value="%s"|args:$elem.label}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
@ -24,21 +28,21 @@
|
||||
|
||||
{{* Enregistrer le mouvement *}}
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:assign var="operation" from="input_types.%d|args:$_POST.type_operation}}
|
||||
{{:assign var="operation" from="types_entrees.%d|args:$_POST.type_operation}}
|
||||
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="../movement.schema.json"
|
||||
validate_schema="/%s/mouvements/movement.schema.json"|args:$module.name
|
||||
type="movement"
|
||||
direction="input"
|
||||
input_nature=$operation
|
||||
direction="entrée"
|
||||
inputNature=$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"}}
|
||||
{{:redirect force="index.html?ok=1&msg=Entrée de « %s » enregistrée"|args:$equipment.designation}}
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
{{/form}}
|
||||
@ -57,24 +61,24 @@
|
||||
{{* formulaire d'entrée de matériel *}}
|
||||
|
||||
<form method="post" action="">
|
||||
|
||||
<fieldset class="entree">
|
||||
<legend>Ajouter une entrée d'un matériel répertorié</legend>
|
||||
<dl>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$input_types}}
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$types_entrees}}
|
||||
{{: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}}
|
||||
</dl>
|
||||
{{:input type="textarea" name="remarques" label="Remarques" cols="40", rows="3" required=false}}
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
||||
</p>
|
||||
|
||||
</form>
|
||||
{{else}}
|
||||
<p class="block error">Il n'y a aucun matériel</p>
|
||||
|
@ -1,18 +1,22 @@
|
||||
{{#restrict section="accounting" level="write" block=true}}{{/restrict}}
|
||||
{{:admin_header title="Entrée de matériel" current="module_equipment"}}
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="../../_nav.html" current="entrees"}}
|
||||
{{if $_GET.dialog === null}}
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="/%s/_nav.html"|args:$module.name 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"}}
|
||||
{{:include file="/%s/_get_config.html"|args:$module.name keep="config"}}
|
||||
|
||||
{{* types d'entrées *}}
|
||||
{{#foreach from=$config.input_nature item="elem"}}
|
||||
{{#foreach from=$config.inputNature item="elem"}}
|
||||
{{if $elem.type == 'retour'}}
|
||||
{{:assign var='input_types.' value="%s"|args:$elem.label}}
|
||||
{{:assign var='types_entrees.' value="%s"|args:$elem.label}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
@ -26,7 +30,7 @@
|
||||
|
||||
{{* Extraire et compiler les infos de la base *}}
|
||||
{{:include
|
||||
file="../../_calcul_dispo.html"
|
||||
file="/%s/_calcul_dispo.html"|args:$module.name
|
||||
keep="equipments"
|
||||
date=$_POST.date|parse_date
|
||||
}}
|
||||
@ -40,27 +44,27 @@
|
||||
|
||||
{{* Enregistrer le mouvement *}}
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:assign var="operation" from="input_types.%d|args:$_POST.type_operation}}
|
||||
{{:assign var="operation" from="types_entrees.%d|args:$_POST.type_operation}}
|
||||
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="../movement.schema.json"
|
||||
validate_schema="/%s/mouvements/movement.schema.json"|args:$module.name
|
||||
type="movement"
|
||||
direction="input"
|
||||
input_nature=$operation
|
||||
direction="entrée"
|
||||
inputNature=$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"}}
|
||||
{{:redirect force="index.html?ok=1&msg=Entrée de « %s » enregistrée"|args:$equipment.designation}}
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
{{/form}}
|
||||
|
||||
{{* Extraire et compiler les infos de la base *}}
|
||||
{{:include file="../../_calcul_dispo.html" keep="equipments"}}
|
||||
{{:include file="/%s/_calcul_dispo.html"|args:$module.name keep="equipments"}}
|
||||
|
||||
{{if $equipments !== null}}
|
||||
|
||||
@ -81,24 +85,24 @@
|
||||
|
||||
{{* formulaire d'entrée de matériel *}}
|
||||
<form method="post" action="">
|
||||
|
||||
<fieldset class="entree">
|
||||
<legend>Ajouter une entrée pour un retour de matériel</legend>
|
||||
<dl>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$input_types}}
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$types_entrees}}
|
||||
{{: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}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
||||
</p>
|
||||
|
||||
</form>
|
||||
{{else}}
|
||||
<p class="block error">Il n'y a aucun matériel</p>
|
||||
|
@ -1,6 +1,13 @@
|
||||
{{#restrict section="config" level="admin" block=true}}{{/restrict}}
|
||||
{{:admin_header title="Modifier une %s"|args:$_GET.direction current="module_equipment"}}
|
||||
|
||||
{{* déterminer l'url de retour *}}
|
||||
{{:assign url=$_GET.caller}}
|
||||
{{:assign pos=$url|strpos:"?"}}
|
||||
{{if $pos|intval > 0}}
|
||||
{{:assign url=$url|truncate:$pos:"":true}}
|
||||
{{/if}}
|
||||
|
||||
{{:assign direction=$_GET.direction}}
|
||||
{{:assign key_mvt=$_GET.key}}
|
||||
|
||||
@ -9,12 +16,10 @@
|
||||
{{else}}
|
||||
{{:error message="Aucune %s avec la clé %s"|args:$_GET.direction:$key_mvt}}
|
||||
{{/load}}
|
||||
{{if $direction == "input"}}
|
||||
{{:assign input_init=$mvt_modif.input_nature}}
|
||||
{{:assign url="entrees/index.html"}}
|
||||
{{if $direction == "entrée"}}
|
||||
{{:assign input_init=$mvt_modif.inputNature}}
|
||||
{{else}}
|
||||
{{:assign output_init=$mvt_modif.output_nature}}
|
||||
{{:assign url="sorties/index.html"}}
|
||||
{{:assign output_init=$mvt_modif.outputNature}}
|
||||
{{/if}}
|
||||
{{:assign amount_init=$mvt_modif.amount}}
|
||||
{{:assign date_init=$mvt_modif.date|date_short}}
|
||||
@ -23,21 +28,21 @@
|
||||
{{#restrict section="accounting" level="write" block=true}}{{/restrict}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../_get_config.html" keep="config"}}
|
||||
{{:include file="/%s/_get_config.html"|args:$module.name keep="config"}}
|
||||
|
||||
{{if $direction == "input"}}
|
||||
{{if $direction == "entrée"}}
|
||||
{{* types d'entrées *}}
|
||||
{{#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}}
|
||||
{{#foreach from=$config.inputNature key="rang" item="elem"}}
|
||||
{{:assign var='types_entrees.' value="%s"|args:$elem.label}}
|
||||
{{if $elem.label == $mvt_modif.inputNature}}
|
||||
{{:assign type_defaut=$rang}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{else}}
|
||||
{{* types de sorties *}}
|
||||
{{#foreach from=$config.output_nature key="rang" item="elem"}}
|
||||
{{#foreach from=$config.outputNature key="rang" item="elem"}}
|
||||
{{:assign var='types_sorties.' value="%s"|args:$elem.label}}
|
||||
{{if $elem.label == $mvt_modif.output_nature}}
|
||||
{{if $elem.label == $mvt_modif.outputNature}}
|
||||
{{:assign type_defaut=$rang}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
@ -54,10 +59,10 @@
|
||||
*}}
|
||||
{{#form on="change"}}
|
||||
{{* préparer le mouvement modifié *}}
|
||||
{{if $direction == "input"}}
|
||||
{{:assign var="mvt_modif.input_nature" from="input_types.%d"|args:$_POST.type_operation}}
|
||||
{{if $direction == "entrée"}}
|
||||
{{:assign var="mvt_modif.inputNature" from="types_entrees.%d"|args:$_POST.type_operation}}
|
||||
{{else}}
|
||||
{{:assign var="mvt_modif.output_nature" from="types_sorties.%d"|args:$_POST.type_operation}}
|
||||
{{:assign var="mvt_modif.outputNature" 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}}
|
||||
@ -69,15 +74,26 @@
|
||||
en l'insérant à sa place par date croissante
|
||||
*}}
|
||||
{{:assign insere=false}}
|
||||
|
||||
{{#load
|
||||
where="
|
||||
$$.type = 'movement'
|
||||
{{#select
|
||||
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, '$.amount') as 'amount',
|
||||
json_extract(document, '$.equipment') as 'equipment',
|
||||
json_extract(document, '$.date') as 'date',
|
||||
json_extract(document, '$.comment') as 'comment'
|
||||
FROM module_data_equipment
|
||||
WHERE
|
||||
json_extract(document, '$.type') = 'movement'
|
||||
AND
|
||||
($$.equipment = :old_eqpmt_key OR $$.equipment = :new_eqpmt_key)"
|
||||
(json_extract(document, '$.equipment') = :old_eqpmt_key
|
||||
OR
|
||||
json_extract(document, '$.equipment') = :new_eqpmt_key)
|
||||
ORDER BY json_extract(document, '$.date');
|
||||
:old_eqpmt_key=$key_eqpmt_init
|
||||
:new_eqpmt_key=$_POST.equipment
|
||||
order="$$.date"
|
||||
assign="movement"
|
||||
}}
|
||||
{{if $key != $key_mvt}}
|
||||
@ -87,7 +103,7 @@
|
||||
{{/if}}
|
||||
{{:assign var=movements_modif." from=movement}}
|
||||
{{/if}}
|
||||
{{/load}}
|
||||
{{/select}}
|
||||
{{if ! $insere}}
|
||||
{{:assign var=movements_modif." from=mvt_modif}}
|
||||
{{/if}}
|
||||
@ -114,29 +130,30 @@
|
||||
{{if $erreur}}
|
||||
<p class="block error">
|
||||
Modification demandée impossible :
|
||||
{{if $direction == "input"}}
|
||||
{{if $direction == "entrée"}}
|
||||
« {{$input_init}} de {{$eqpmt_init.designation}} (qté : {{$amount_init}}) en date du {{$date_init}} » vers
|
||||
« {{$mvt_modif.input_nature}} de {{$eqpmt.designation}} (qté : {{$mvt_modif.amount}}) à la date du {{$mvt_modif.date|date_short}} »
|
||||
« {{$mvt_modif.inputNature}} 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.output_nature}} de {{$eqpmt.designation}} (qté : {{$mvt_modif.amount}}) à la date du {{$mvt_modif.date|date_short}} »
|
||||
« {{$mvt_modif.outputNature}} de {{$eqpmt.designation}} (qté : {{$mvt_modif.amount}}) à la date du {{$mvt_modif.date|date_short}} »
|
||||
{{/if}}
|
||||
</p>
|
||||
{{* :redirect force="./index.html?err=1&msg=Modification demandée impossible" *}}
|
||||
{{else}}
|
||||
{{* vérification réussie : modifier le mouvement *}}
|
||||
{{:save
|
||||
key=$key_mvt
|
||||
validate_schema="./movement.schema.json"
|
||||
validate_schema="/%s/mouvements/movement.schema.json"|args:$module.name
|
||||
type="movement"
|
||||
direction=$direction
|
||||
input_nature=$mvt_modif.input_nature
|
||||
output_nature=$mvt_modif.output_nature
|
||||
inputNature=$mvt_modif.inputNature
|
||||
outputNature=$mvt_modif.outputNature
|
||||
amount=$mvt_modif.amount|intval
|
||||
equipment=$mvt_modif.equipment
|
||||
date=$mvt_modif.date
|
||||
comment=$mvt_modif.comment
|
||||
}}
|
||||
{{:redirect force="%s?ok=1&msg=modification"|args:$url}}
|
||||
{{:redirect force="%s?ok=1&msg=Modification enregistrée"|args:$url}}
|
||||
{{/if}}
|
||||
|
||||
{{/form}}
|
||||
@ -157,26 +174,21 @@
|
||||
<form method="post" action="">
|
||||
|
||||
<fieldset class="entree">
|
||||
{{if $direction == "input"}}
|
||||
{{if $direction == "entrée"}}
|
||||
<legend>Modifier l'entrée « {{$input_init}} {{$eqpmt_init.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
||||
<dl>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$input_types default=$type_defaut}}
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$types_entrees 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}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
|
@ -9,13 +9,13 @@
|
||||
"direction" : {
|
||||
"description": "Entrée ou sortie",
|
||||
"type": "string",
|
||||
"enum": ["input", "output"]
|
||||
"enum": ["entrée", "sortie"]
|
||||
},
|
||||
"input_nature": {
|
||||
"inputNature": {
|
||||
"description": "Nature de l'entrée",
|
||||
"type": ["null", "string"]
|
||||
},
|
||||
"output_nature": {
|
||||
"outputNature": {
|
||||
"description": "Nature de la sortie",
|
||||
"type": ["null", "string"]
|
||||
},
|
||||
|
@ -19,12 +19,12 @@
|
||||
{{#form on="delete"}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../../_get_config.html" keep="config"}}
|
||||
{{:include file="/%s/_get_config.html"|args:$module.name keep="config"}}
|
||||
|
||||
{{* déterminer s'il s'agit d'une sortie temporaire *}}
|
||||
{{:assign temporaire=false}}
|
||||
{{#foreach from=$config.output_nature item="elem"}}
|
||||
{{if $mvt_suppr.output_nature == $elem.label && $elem.type == 'temporaire'}}
|
||||
{{#foreach from=$config.outputNature item="elem"}}
|
||||
{{if $mvt_suppr.outputNature == $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 == 'input'}}
|
||||
{{if $movement.direction == 'entrée'}}
|
||||
{{* chercher le type d'entrée parmi les types de la config *}}
|
||||
{{#foreach from=$config.input_nature item="elem"}}
|
||||
{{if $movement.input_nature == $elem.label && $elem.type == 'retour'}}
|
||||
{{#foreach from=$config.inputNature item="elem"}}
|
||||
{{if $movement.inputNature == $elem.label && $elem.type == 'retour'}}
|
||||
{{:assign exterieur="%d-%d"|math:$exterieur:$movement.amount}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{elseif $movement.direction == 'output'}}
|
||||
{{elseif $movement.direction == 'sortie'}}
|
||||
{{* chercher le type de sortie parmi les types de la config *}}
|
||||
{{#foreach from=$config.output_nature item="elem"}}
|
||||
{{if $movement.output_nature == $elem.label && $elem.type == 'temporaire'}}
|
||||
{{#foreach from=$config.outputNature item="elem"}}
|
||||
{{if $movement.outputNature == $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=suppression"}}
|
||||
{{: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}}
|
||||
{{/if}}
|
||||
|
||||
{{/if}}
|
||||
@ -68,14 +68,14 @@
|
||||
|
||||
{{* vérification réussie : supprimer la sortie *}}
|
||||
{{:delete key=$_GET.key}}
|
||||
{{:assign var="msg" value="suppression"}}
|
||||
{{: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}}
|
||||
|
||||
{{* 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"|args:$msg}}
|
||||
{{:assign var="msg" value="%s - Matériel « %s » supprimé"|args:$msg:$eqpmt_suppr.designation}}
|
||||
{{/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.output_nature:$eqpmt_suppr.designation:$amount_suppr:$date_suppr
|
||||
warning="Supprimer la sortie « %s %s (%d) en date du %s » ?"|args:$mvt_suppr.outputNature:$eqpmt_suppr.designation:$amount_suppr:$date_suppr
|
||||
info="S'il ne reste aucun mouvement pour ce matériel, le matériel sera supprimé"
|
||||
}}
|
||||
|
||||
|
@ -1,18 +1,22 @@
|
||||
{{#restrict section="accounting" level="read"}}{{/restrict}}
|
||||
{{:admin_header title="Sortie de matériel" current="module_equipment"}}
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
|
||||
{{if ! $dialog}}
|
||||
{{if $_GET.dialog === null}}
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="../../_nav.html" current="sorties"}}
|
||||
{{:include file="/%s/_nav.html"|args:$module.name 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"}}
|
||||
{{:include file="/%s/_get_config.html"|args:$module.name keep="config"}}
|
||||
|
||||
{{* types de sorties *}}
|
||||
{{#foreach from=$config.output_nature item="elem"}}
|
||||
{{#foreach from=$config.outputNature item="elem"}}
|
||||
{{if $elem.type == 'retour'}}
|
||||
{{:assign var='output_types.' value="%s"|args:$elem.label}}
|
||||
{{:assign var='types_sorties.' value="%s"|args:$elem.label}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
@ -26,7 +30,7 @@
|
||||
|
||||
{{* Extraire et compiler les infos de la base *}}
|
||||
{{:include
|
||||
file="../../_calcul_dispo.html"
|
||||
file="/%s/_calcul_dispo.html"|args:$module.name
|
||||
keep="equipments"
|
||||
date=$_POST.date|parse_date
|
||||
}}
|
||||
@ -41,25 +45,25 @@
|
||||
{{* Enregistrer le mouvement *}}
|
||||
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:assign var="operation" from="output_types.%d|args:$_POST.type_operation}}
|
||||
{{:assign var="operation" from="types_sorties.%d|args:$_POST.type_operation}}
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="../movement.schema.json"
|
||||
validate_schema="/%s/mouvements/movement.schema.json"|args:$module.name
|
||||
type="movement"
|
||||
direction="output"
|
||||
output_nature=$operation
|
||||
direction="sortie"
|
||||
outputNature=$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"}}
|
||||
{{:redirect force="index.html?ok=1&msg=Sortie de « %s » (%d) enregistrée"|args:$designation:$_POST.quantite}}
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
{{/form}}
|
||||
|
||||
{{* Extraire et compiler les infos de la base *}}
|
||||
{{:include file="../../_calcul_dispo.html" keep="equipments"}}
|
||||
{{:include file="/%s/_calcul_dispo.html"|args:$module.name keep="equipments"}}
|
||||
|
||||
{{if $equipments !== null}}
|
||||
{{* calculer les quantité de matériels dont l'asso n'est pas propriétaire *}}
|
||||
@ -78,22 +82,20 @@
|
||||
{{if $temporaire != null}}
|
||||
{{* formulaire de sortie de matériel *}}
|
||||
<form method="post" action="">
|
||||
|
||||
<fieldset class="sortie">
|
||||
<legend>Ajouter une sortie d'un matériel disponible en stock</legend>
|
||||
<dl>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$output_types}}
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$types_sorties}}
|
||||
{{: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}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
||||
</p>
|
||||
|
@ -2,33 +2,19 @@
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="../../_nav.html" current="sorties"}}
|
||||
{{:include file="/%s/_nav.html"|args:$module.name current="sorties"}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
{{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>
|
||||
<p class="block confirm">{{$_GET.msg}}</p>
|
||||
{{elseif $_GET.err}}
|
||||
{{if $_GET.msg == "suppression"}}
|
||||
<p class="block error">Impossible de supprimer la sortie</p>
|
||||
{{/if}}
|
||||
<p class="block error">{{$_GET.msg}}</p>
|
||||
{{/if}}
|
||||
|
||||
<form method="post" action="">
|
||||
<fieldset class="sortie">
|
||||
<legend>Ajouter une sortie </legend>
|
||||
<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>
|
||||
{{: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"}}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@ -39,20 +25,21 @@
|
||||
{{#list
|
||||
select="
|
||||
$$.date AS 'Date' ;
|
||||
$$.output_nature AS 'Type' ;
|
||||
$$.outputNature AS 'Type' ;
|
||||
$$.amount AS 'Nombre' ;
|
||||
(SELECT $$.designation
|
||||
FROM @TABLE AS b
|
||||
WHERE b.key = @TABLE.$$.equipment) AS 'Matériel' ;
|
||||
WHERE b.key = @TABLE.$$.equipment)
|
||||
AS 'Matériel' ;
|
||||
$$.comment AS 'Remarques'"
|
||||
type="movement"
|
||||
direction="output"
|
||||
direction="sortie"
|
||||
order=1}}
|
||||
|
||||
{{:assign var='mvt_key' value=$key}}
|
||||
<tr>
|
||||
<td>{{$date|date_short}}</td>
|
||||
<td>{{$output_nature}}</td>
|
||||
<td>{{$outputNature}}</td>
|
||||
<td>{{$amount}}</td>
|
||||
<td>{{$col4}}</td>
|
||||
<td>{{$comment}}</td>
|
||||
@ -64,7 +51,7 @@
|
||||
target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Modifier"
|
||||
href="../modifier_mouvement.html?key=%s&direction=output"|args:$mvt_key
|
||||
href="../modifier_mouvement.html?key=%s&direction=sortie&caller=%s"|args:$mvt_key:$request_url
|
||||
shape="edit"
|
||||
target="_dialog"}}
|
||||
</td>
|
||||
|
@ -1,18 +1,22 @@
|
||||
{{#restrict section="accounting" level="write" block=true}}{{/restrict}}
|
||||
{{:admin_header title="Sortie de matériel" current="module_equipment"}}
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
|
||||
{{if ! $dialog}}
|
||||
{{if $_GET.dialog === null}}
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="../../_nav.html" current="sorties"}}
|
||||
{{:include file="/%s/_nav.html"|args:$module.name 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"}}
|
||||
{{:include file="/%s/_get_config.html"|args:$module.name keep="config"}}
|
||||
|
||||
{{* types de sorties *}}
|
||||
{{#foreach from=$config.output_nature item="elem"}}
|
||||
{{#foreach from=$config.outputNature item="elem"}}
|
||||
{{if $elem.type != 'retour'}}
|
||||
{{:assign var='output_types.' value="%s"|args:$elem.label}}
|
||||
{{:assign var='types_sorties.' value="%s"|args:$elem.label}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
@ -26,7 +30,7 @@
|
||||
|
||||
{{* Extraire et compiler les infos de la base *}}
|
||||
{{:include
|
||||
file="../../_calcul_dispo.html"
|
||||
file="/%s/_calcul_dispo.html"|args:$module.name
|
||||
keep="equipments"
|
||||
date=$_POST.date|parse_date
|
||||
}}
|
||||
@ -43,25 +47,25 @@
|
||||
{{* Enregistrer le mouvement *}}
|
||||
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:assign var="operation" from="output_types.%d|args:$_POST.type_operation}}
|
||||
{{:assign var="operation" from="types_sorties.%d|args:$_POST.type_operation}}
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="../movement.schema.json"
|
||||
validate_schema="/%s/mouvements/movement.schema.json"|args:$module.name
|
||||
type="movement"
|
||||
direction="output"
|
||||
output_nature=$operation
|
||||
direction="sortie"
|
||||
outputNature=$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"}}
|
||||
{{:redirect force="index.html?ok=1&msg=Sortie de « %s » (%d) enregistrée"|args:$designation:$_POST.quantite}}
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
{{/form}}
|
||||
|
||||
{{* Extraire et compiler les infos de la base *}}
|
||||
{{:include file="../../_calcul_dispo.html" keep="equipments"}}
|
||||
{{:include file="/%s/_calcul_dispo.html"|args:$module.name keep="equipments"}}
|
||||
|
||||
{{if $equipments !== null}}
|
||||
{{* calculer les disponibilités *}}
|
||||
@ -80,25 +84,24 @@
|
||||
|
||||
{{* formulaire de sortie de matériel *}}
|
||||
<form method="post" action="">
|
||||
|
||||
<fieldset class="sortie">
|
||||
<legend>Ajouter une sortie d'un matériel disponible en stock</legend>
|
||||
<dl>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$output_types}}
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$types_sorties}}
|
||||
{{: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}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
||||
</p>
|
||||
|
||||
</form>
|
||||
{{else}}
|
||||
<p class="block error">Il n'y a aucun matériel</p>
|
||||
|
@ -6,7 +6,7 @@
|
||||
*}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../_get_config.html" keep="config"}}
|
||||
{{:include file="/%s/_get_config.html"|args:$module.name keep="config"}}
|
||||
|
||||
{{:assign erreur = false}}
|
||||
{{:assign stock=0}}
|
||||
@ -14,10 +14,10 @@
|
||||
{{:assign nonprop=0}}
|
||||
{{#foreach from=$movements item="movement"}}
|
||||
{{if $movement.equipment == $eqpmt_key}}
|
||||
{{if $movement.direction == 'input'}}
|
||||
{{if $movement.direction == 'entrée'}}
|
||||
{{* chercher le type d'entrée parmi les types de la config *}}
|
||||
{{#foreach from=$config.input_nature item="elem"}}
|
||||
{{if $movement.input_nature == $elem.label}}
|
||||
{{#foreach from=$config.inputNature item="elem"}}
|
||||
{{if $movement.inputNature == $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 == 'output'}}
|
||||
{{elseif $movement.direction == 'sortie'}}
|
||||
{{* chercher le type de sortie parmi les types de la config *}}
|
||||
{{#foreach from=$config.output_nature item="elem"}}
|
||||
{{if $movement.output_nature == $elem.label}}
|
||||
{{#foreach from=$config.outputNature item="elem"}}
|
||||
{{if $movement.outputNature == $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