From c9b150c0cc1b71d444ffddf91d9c1cbc06ffa171 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Fri, 20 Oct 2023 16:21:21 +0200 Subject: [PATCH] Poursuite inventaire --- index.html | 52 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index f8a36c4..2af861a 100644 --- a/index.html +++ b/index.html @@ -7,14 +7,52 @@ {{:include file="/%s/_nav.html"|args:$module.name current="index"}}
- {{#list select="$$.designation AS 'Matériel'; $$.key AS 'Clé'" where="$$.type = 'equipment'"}} - - {{$designation}} - {{$key}} - + + {{* itérer sur les catégories *}} + {{#load type="category" assign="category" order="$$.name"}} + {{:assign nom_cat=$category.name}} + {{:assign key_cat=$key}} + +

{{$nom_cat}}

+ + {{* itérer sur les matériels de la catégorie courante *}} + {{#list + select="$$.designation AS 'Désignation'; '' AS 'Stock' ; '' AS 'Sortie' ; '' AS 'Disponible'" + type="equipment" + category=$key_cat + order=1 + }} + + {{:assign equipment_key=$key}} + {{:assign var="stock" value=0}} + {{:assign var="sortie" value=0}} + + {{* itérer sur les mouvements du matériel courant *}} + {{#load type="movement" equipment=$equipment_key assign="movement"}} + {{if $movement.direction === 'entrée'}} + {{:assign stock="%d+%d"|math:$stock:$movement.amount}} + {{else}} + {{:assign sortie="%d+%d"|math:$sortie:$movement.amount}} + {{/if}} + {{/load}} + {{:assign dispo="%d-%d"|math:$stock:$sortie}} + + + {{$designation}} + {{$stock}} + {{$sortie}} + {{$dispo}} + + + {{else}} +

Il n'y a aucun matériel dans cette catégorie.

+ {{/list}} + {{else}} -

Il n'y a aucun matériel.

- {{/list}} +

Il n'y a aucune catégorie => il faut en créer au moins une.

+ {{/load}} + +
{{:admin_footer}}