From 6551c9ec078797c78283046acfe6cd4b71254b54 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Fri, 20 Oct 2023 14:10:56 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20liste=20mat=C3=A9riel=20d'une=20cat?= =?UTF-8?q?=C3=A9gorie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- categories/index.html | 1 + categories/list_equipment.html | 56 ++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 categories/list_equipment.html diff --git a/categories/index.html b/categories/index.html index 6ab2103..224b826 100644 --- a/categories/index.html +++ b/categories/index.html @@ -17,6 +17,7 @@ {{$type}} {{$key}} + {{:linkbutton label="Liste des matériels" href="list_equipment.html?id=%s&dialog"|args:$key shape="search" target="_dialog"}} {{:linkbutton label="Supprimer" href="delete_category.html?id=%s"|args:$key shape="delete" target="_dialog"}} diff --git a/categories/list_equipment.html b/categories/list_equipment.html new file mode 100644 index 0000000..8490868 --- /dev/null +++ b/categories/list_equipment.html @@ -0,0 +1,56 @@ +{{#restrict section="config" level="admin" block=true}}{{/restrict}} + +{{#load key=$_GET.id}} + {{:assign cat_name=$name}} +{{/load}} + +{{:admin_header title="Matériels de la catégorie « %s »"|args:$cat_name current="module_equipment"}} + +{{if $_GET.dialog === null}} + {{* barre de navigation *}} + {{:include file="/%s/_nav.html"|args:$module.name current="categories"}} +{{else}} +
+

Matériels de la catégorie « {{$cat_name}} »

+
+{{/if}} + +{{* afficher les matériels de la catégorie sélectionnée avec le stock, les entrées et les sorties *}} +
+ + {{#list + select="$$.designation AS 'Désignation'; '' AS 'Stock' ; '' AS 'Sortie' ; '' AS 'Disponible'" + type="equipment" + category=$_GET.id + order=1}} + + {{:assign equipment_key=$key}} + {{:assign var="stock" value=0}} + {{:assign var="sortie" value=0}} + + {{* récupérer 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}} + + +{{/list}} + +
+ +{{:admin_footer}}