Début réorganisation après consultation bohwaz

This commit is contained in:
Jean-Christophe Engel 2024-11-14 16:21:10 +01:00
parent a99f263196
commit ea0fd3b1a2
7 changed files with 221 additions and 182 deletions

View file

@ -1,6 +1,10 @@
{{* -*- brindille -*- *}}
{{* inventaire des entrées/sorties des matériels des catégories de la variable category_keys *}}
{{*
inventaire des entrées/sorties des matériels permanants de l'association
paramètres
- category_keys
*}}
{{* Extraire et compiler les infos de la base *}}
{{:include file="./_calcul_dispo.html" keep="cumul_mvt,category_keys,equipments"}}
@ -9,200 +13,115 @@
{{if $equipments === null}}
<p class="block alert">Aucun matériel.</p>
{{else}}
{{* Vérifier s'il y a au moins un matériel propriété ou non de l'asso *}}
{{* Vérifier s'il y a au moins un matériel propriété de l'asso *}}
{{:assign mat_prop=false}}
{{:assign mat_non_prop=false}}
{{#foreach from=$equipments key=key item=eqpmt}}
{{if $eqpmt|has_key:"stock"}}
{{:assign mat_prop=true}}
{{/if}}
{{if $eqpmt|has_key:"nonproprio"}}
{{:assign mat_non_prop=true}}
{{:break}}
{{/if}}
{{/foreach}}
{{* TODO Sélecteur catégories *}}
<fieldset class="shortFormRight">
<legend>Filtrer par catégorie</legend>
<nav class="dropdown">
<ul>
<li><a></a></li>
<li><a href=""><strong>Audiovisuel</strong></a></li>
<li><a href=""><strong>Informatique</strong></a></li>
<li><a href=""><strong>Mobilier</strong></a></li>
</ul>
</nav>
</fieldset>
{{if $mat_prop}}
<details class="inventaire" open="open">
<summary>
<h2>Matériels dont l'association est propriétaire</h2>
</summary>
<h2>Matériels dont l'association est propriétaire</h2>
<fieldset>
{{* itérer sur les catégories *}}
{{#foreach from=$cumul_mvt key="cat_key" item="cat_elem"}}
<fieldset>
{{* itérer sur les catégories *}}
{{#foreach from=$cumul_mvt key="cat_key" item="cat_elem"}}
{{* vérifier s'il y a des matériels dans cette catégorie *}}
{{:assign present=false}}
{{if $cat_elem|keys|has:"eqpmt"}}
{{#foreach from=$cat_elem.eqpmt key="eqpmt_key" item="eqpmt"}}
{{if $eqpmt.stock !== null && $eqpmt.stock !== 0}}
{{:assign present=true}}
{{:break}}
{{/if}}
{{/foreach}}
{{/if}}
{{* vérifier s'il y a des matériels dans cette catégorie *}}
{{:assign present=false}}
{{if $cat_elem|keys|has:"eqpmt"}}
{{#foreach from=$cat_elem.eqpmt key="eqpmt_key" item="eqpmt"}}
{{if $eqpmt.stock !== null && $eqpmt.stock !== 0}}
{{:assign present=true}}
{{:break}}
{{/if}}
{{/foreach}}
{{/if}}
{{if $present}}
<h3>{{$cat_elem.name}}</h3>
{{if $present}}
{{*if $print_cat_name*}}
<details class="inventaire" open="open">
<summary>
<h3>{{$cat_elem.name}}</h3>
{{*/if*}}
</summary>
<table class="list">
<thead>
<tr>
<th>Désignation</th>
<th>Stock</th>
<th>Sortie</th>
<th>Disponible</th>
<th class="actions"></th>
</tr>
</thead>
<tbody>
<table class="list">
<thead>
<tr>
<th>Désignation</th>
<th>Stock</th>
<th>Sortie</th>
<th>Disponible</th>
<th class="actions"></th>
</tr>
</thead>
<tbody>
{{* itérer sur les matériels de la catégorie *}}
{{#foreach from=$cat_elem.eqpmt key="eqpmt_key" item="eqpmt"}}
{{:assign keys=$eqpmt|keys}}
{{if "stock"|in:$keys}} {{* && $eqpmt.stock !== 0}}*}}
{{if "exterieur"|in:$keys}}
{{:assign dispo="%d-%d"|math:$eqpmt.stock:$eqpmt.exterieur}}
{{:assign exterieur=$eqpmt.exterieur}}
{{else}}
{{:assign dispo=$eqpmt.stock}}
{{:assign exterieur=0}}
{{/if}}
<tr>
<td>{{$eqpmt.designation}}</td>
<td>{{$eqpmt.stock}}</td>
<td>{{$exterieur}}</td>
<td>{{$dispo}}</td>
<td class="actions">
{{if $exterieur > 0}}
{{* itérer sur les matériels de la catégorie *}}
{{#foreach from=$cat_elem.eqpmt key="eqpmt_key" item="eqpmt"}}
{{:assign keys=$eqpmt|keys}}
{{if "stock"|in:$keys}} {{* && $eqpmt.stock !== 0}}*}}
{{if "exterieur"|in:$keys}}
{{:assign dispo="%d-%d"|math:$eqpmt.stock:$eqpmt.exterieur}}
{{:assign exterieur=$eqpmt.exterieur}}
{{else}}
{{:assign dispo=$eqpmt.stock}}
{{:assign exterieur=0}}
{{/if}}
<tr>
<td>{{$eqpmt.designation}}</td>
<td>{{$eqpmt.stock}}</td>
<td>{{$exterieur}}</td>
<td>{{$dispo}}</td>
<td class="actions">
{{if $exterieur > 0}}
{{:linkbutton
label="Retour"
href="mouvements/entrees/retour.html?key=%s&prop=1"|args:$eqpmt_key
shape="history"
target="_dialog"}}
{{/if}}
{{if $dispo > 0}}
{{:linkbutton
label="Sortie"
shape="plus"
href="mouvements/sorties/stock_disponible.html?key=%s&prop=1"|args:$eqpmt_key
target="_dialog"}}
{{/if}}
{{:linkbutton
label="Retour"
href="mouvements/entrees/retour.html?key=%s&prop=1"|args:$eqpmt_key
shape="history"
target="_dialog"}}
{{/if}}
{{if $dispo > 0}}
{{:linkbutton
label="Sortie"
shape="plus"
href="mouvements/sorties/stock_disponible.html?key=%s&prop=1"|args:$eqpmt_key
target="_dialog"}}
{{/if}}
{{:linkbutton
label="Entrée"
shape="plus"
href="mouvements/entrees/repertorie.html?key=%s&prop=1"|args:$eqpmt_key
target="_dialog"}}
{{:linkbutton
{{:linkbutton
label="Mouvements"
href="%shistorique.html?key=%s&prop=1"|args:$module.url:$eqpmt_key
shape="table"}}
{{:linkbutton
{{:linkbutton
label="Modifier"
href="%smodifier_materiel.html?key=%s&prop=1"|args:$module.url:$eqpmt_key
shape="edit"
target="_dialog"}}
</td>
</tr>
{{/if}}
{{else}}
<p class="block alert">Il n'y a aucun matériel dans cette catégorie.</p>
{{/foreach}}
</tbody>
</table>
</details>
{{/if}}
{{/foreach}}
</fieldset>
</details>
{{/if}}
{{if $mat_non_prop}}
<details class="inventaire" open="open">
<summary>
<h2>Matériels dont l'association n'est pas propriétaire</h2>
</summary>
<fieldset>
{{* itérer sur les catégories *}}
{{#foreach from=$cumul_mvt key="cat_key" item="cat_elem"}}
{{* vérifier s'il y a des matériels dans cette catégorie *}}
{{:assign present=false}}
{{if $cat_elem|keys|has:"eqpmt"}}
{{#foreach from=$cat_elem.eqpmt key="eqpmt_key" item="eqpmt"}}
{{if $eqpmt.nonproprio !== null && $eqpmt.nonproprio !== 0}}
{{:assign present=true}}
{{:break}}
{{/if}}
{{/foreach}}
{{/if}}
{{if $present}}
{{*if $print_cat_name*}}
<details class="inventaire" open="open">
<summary>
<h3>{{$cat_elem.name}}</h3>
{{*/if*}}
</summary>
<table class="list">
<thead>
<tr>
<th>Désignation</th>
<th>Quantité</th>
<th class="actions"></th>
</tr>
</thead>
<tbody>
{{* itérer sur les matériels de la catégorie *}}
{{#foreach from=$cat_elem.eqpmt key="eqpmt_key" item="eqpmt"}}
{{:assign keys=$eqpmt|keys}}
{{if "nonproprio"|in:$keys && $eqpmt.nonproprio !== 0}}
{{:assign dispo="%d-%d"|math:$eqpmt.stock:$eqpmt.exterieur}}
<tr>
<td>{{$eqpmt.designation}}</td>
<td>{{$eqpmt.nonproprio}}</td>
<td class="actions">
{{if $eqpmt.nonproprio > 0}}
{{:linkbutton
label="Retour"
href="mouvements/sorties/emprunte.html?key=%s&prop=0"|args:$eqpmt_key
shape="history"
target="_dialog"}}
{{/if}}
{{:linkbutton
label="Entrée"
shape="plus"
href="mouvements/entrees/repertorie.html?key=%s&prop=0"|args:$eqpmt_key
target="_dialog"}}
{{:linkbutton
label="Mouvements"
href="%shistorique.html?key=%s&prop=0"|args:$module.url:$eqpmt_key
shape="table"}}
{{:linkbutton
label="Modifier"
href="modifier_materiel.html?key=%s&prop=0"|args:$eqpmt_key
shape="edit"
target="_dialog"}}
</td>
</tr>
{{/if}}
{{else}}
<p class="block alert">Il n'y a aucun matériel dans cette catégorie.</p>
{{/foreach}}
</tbody>
</table>
</details>
{{/if}}
{{/foreach}}
</fieldset>
</details>
</td>
</tr>
{{/if}}
{{else}}
<p class="block alert">Il n'y a aucun matériel dans cette catégorie.</p>
{{/foreach}}
</tbody>
</table>
{{/if}}
{{/foreach}}
</fieldset>
{{/if}}
{{/if}}