Poursuite inventaire
This commit is contained in:
parent
8e8f308671
commit
c9b150c0cc
52
index.html
52
index.html
@ -7,14 +7,52 @@
|
||||
{{:include file="/%s/_nav.html"|args:$module.name current="index"}}
|
||||
|
||||
<section class="inventaire">
|
||||
{{#list select="$$.designation AS 'Matériel'; $$.key AS 'Clé'" where="$$.type = 'equipment'"}}
|
||||
<tr>
|
||||
<th>{{$designation}}</th>
|
||||
<td>{{$key}}</td>
|
||||
</tr>
|
||||
|
||||
{{* itérer sur les catégories *}}
|
||||
{{#load type="category" assign="category" order="$$.name"}}
|
||||
{{:assign nom_cat=$category.name}}
|
||||
{{:assign key_cat=$key}}
|
||||
|
||||
<h3>{{$nom_cat}}</h3>
|
||||
|
||||
{{* 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}}
|
||||
|
||||
<tr>
|
||||
<th>{{$designation}}</th>
|
||||
<td>{{$stock}}</td>
|
||||
<td>{{$sortie}}</td>
|
||||
<td>{{$dispo}}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{{else}}
|
||||
<p class="block alert">Il n'y a aucun matériel dans cette catégorie.</p>
|
||||
{{/list}}
|
||||
|
||||
{{else}}
|
||||
<p class="block alert">Il n'y a aucun matériel.</p>
|
||||
{{/list}}
|
||||
<p class="block alert">Il n'y a aucune catégorie => il faut en créer au moins une.</p>
|
||||
{{/load}}
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
{{:admin_footer}}
|
||||
|
Loading…
Reference in New Issue
Block a user