Début réorganisation navigation ; inventaire : ajout filtre selon appartenance

This commit is contained in:
Jean-Christophe Engel 2026-01-16 12:14:09 +01:00
parent feef51361e
commit e2c8ac2d84
3 changed files with 84 additions and 38 deletions

View file

@ -1,18 +1,59 @@
{{* -*- brindille -*- *}}
{{*
inventaire des entrées/sorties des matériels permanents
Inventaire des matériels en stock dans l'association
*}}
{{* Sélecteur catégories *}}
{{:assign var="options." value="" label="Toutes les catégories" href="?prop=1"}}
{{* filtrer selon la catégorie *}}
{{if $_GET.cat_key == null}}
{{:assign selected_category=$module.config.stock_cat_key}}
{{if $module.config.stock_cat_key != null}}
{{:assign cat_key=$selected_category|quote_sql}}
{{/if}}
{{elseif $_GET.cat_key == -1}}
{{:assign selected_category=null}}
{{:save key="config" stock_cat_key=null}}
{{else}}
{{:assign selected_category=$_GET.cat_key}}
{{:assign cat_key=$selected_category|quote_sql}}
{{:save key="config" stock_cat_key=$selected_category}}
{{/if}}
{{* condition de filtrage *}}
{{if $selected_category != null}}
{{:assign cat_condition="$$.category = %s"|args:$cat_key}}
{{else}}
{{:assign cat_condition="1"}}
{{/if}}
{{* filtrer selon appartenance *}}
{{if $_GET.prop == null}}
{{:assign selected_prop=$module.config.stock_prop}}
{{elseif $_GET.prop == -1}}
{{:assign selected_prop=null}}
{{:save key="config" stock_prop=null}}
{{else}}
{{:assign selected_prop=$_GET.prop}}
{{:save key="config" stock_prop=$_GET.prop}}
{{/if}}
{{if $selected_prop == null}}
{{:assign prop_condition="1"}}
{{elseif $selected_prop == 1}}
{{:assign prop_condition="$$.stock NOT NULL"}}
{{else}}
{{:assign prop_condition="$$.notowned != 0"}}
{{/if}}
{{* sélecteurs de catégorie et d'appartenance *}}
{{:assign var="cat_options." value="" label="Toutes les catégories" href="?cat_key=-1"}}
{{#load type="category" order="$$.name"}}
{{:assign var="categories.%s"|args:$key value=$name}}
{{:assign
var="options."
var="cat_options."
value=$key
label=$name
href="?cat_key=%s&prop=1"|args:$key
href="?cat_key=%s"|args:$key
}}
{{/load}}
@ -20,23 +61,28 @@
<legend>Filtrer par catégorie</legend>
{{:dropdown
title="Filtrer par catégorie"
options=$options
value="%s"|args:$_GET.cat_key
options=$cat_options
value="%s"|args:$selected_category
}}
</fieldset>
{{:assign var="prop_options." value="" label="Tous les matériels" href="?prop=-1"}}
{{:assign var="prop_options." value="1" label="Matériels propriété de l'association" href="?prop=1"}}
{{:assign var="prop_options." value="0" label="Matériels NON propriété de l'association" href="?prop=0"}}
<fieldset class="shortFormRight">
<legend>Filtrer par appartenance</legend>
{{:dropdown
title="Filtrer par appartenance"
options=$prop_options
value="%s"|args:$selected_prop
}}
</fieldset>
<div class="shortFormLeft">
<p class="help">Inventaire des matériels propriété de l'association</p>
<p class="help">Inventaire des matériels présents dans l'association</p>
</div>
{{* filtrer selon la catégorie *}}
{{if $_GET.cat_key == null}}
{{:assign condition="1"}}
{{else}}
{{:assign cat_key=$_GET.cat_key|quote_sql}}
{{:assign condition="$$.category = %s"|args:$cat_key}}
{{/if}}
{{#list
select="
$$.name AS 'Matériel' ;
@ -44,22 +90,32 @@
FROM @TABLE as cat
WHERE cat.key = @TABLE.$$.category) AS 'Catégorie' ;
$$.stock AS 'Stock' ;
(SELECT COALESCE($$.notowned, 0)) AS 'Temp' ;
(SELECT $$.stock + COALESCE($$.notowned, 0)) AS 'Total' ;
$$.out AS 'Sorti' ;
(SELECT $$.stock - $$.out) AS 'Disponible'
"
type="equipment"
where="$$.status <> 'archived' AND $$.stock NOT NULL AND %s"|args:$condition
where="$$.status <> 'archived' AND %s AND %s"|args:$cat_condition:$prop_condition
order=1
}}
{{:assign var=cat_name from=categories.%s|args:$category}}
<tr>
<td>{{:link href="equipment_history.html?key=%s&prop=1"|args:$key" label=$name}}</td>
{{if $selected_prop == null}}
{{:assign prop=""}}
{{else}}
{{:assign prop="&prop=%s"|args:$selected_prop}}
{{/if}}
<td>{{:link href="equipment_history.html?key=%s&prop=%s"|args:$key:$selected_prop" label=$name}}</td>
<td>{{$cat_name}}</td>
<td class="num">{{$stock}}</td>
<td class="num">{{$col4}}</td>
<td class="num">{{$col5}}
<td class="num">{{$out}}</td>
<td class="num">{{$col5}}</td>
<td class="num">{{$col7}}</td>
<td class="actions">
{{if $col5 > 0}}
{{*
{{if $col7 > 0}}
{{:linkbutton
label="Sortie"
shape="minus"
@ -71,6 +127,7 @@
shape="plus"
href="movements/input_equipment.html?key=%s"|args:$key
target="_dialog"}}
*}}
{{:linkbutton
label="Historique"
href="equipment_history.html?key=%s&prop=1"|args:$key

View file

@ -12,16 +12,15 @@
{{/if}}
<ul>
<li {{if $current == 'inventaire'}} class="current"{{/if}}><a href="{{$module.url}}index.html?prop=1">Inventaire</a></li>
<li {{if $current == 'historique'}} class="current"{{/if}}><a href="{{$module.url}}global_history.html">Historique</a></li>
<li {{if $current == 'inventaire'}} class="current"{{/if}}><a href="{{$module.url}}index.html">Inventaire</a></li>
<li {{if $current == 'archives'}} class="current"{{/if}}><a href="{{$module.url}}archives.html">Archives</a></li>
<li {{if $current == 'config'}} class="current"{{/if}}><a href="{{$module.url}}categories/index.html">Configuration</a></li>
</ul>
{{if $current == 'inventaire'}}
<ul class="sub">
<li {{if $subcurrent == 'proprio'}} class="current"{{/if}}><a href="{{$module.url}}index.html?prop=1">Matériels permanents</a></li>
<li {{if $subcurrent == 'nonproprio'}} class="current"{{/if}}><a href="{{$module.url}}index.html?prop=0">Matériels temporaires</a></li>
<li {{if $subcurrent == 'stock'}} class="current"{{/if}}><a href="{{$module.url}}index.html">Stock</a></li>
<li {{if $subcurrent == 'historique'}} class="current"{{/if}}><a href="{{$module.url}}global_history.html">Historique</a></li>
</ul>
{{if $subsubcurrent == 'historique'}}

View file

@ -14,15 +14,6 @@
{{else}}
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
{{if $_GET.prop == null || $_GET.prop}}
{{:assign proprio="proprio"}}
{{else}}
{{:assign proprio="nonproprio"}}
{{/if}}
{{#load type="category" count=true assign="result"}}{{/load}}
{{:include file="_nav.html" current="inventaire" cat="%d"|args:$result.count subcurrent="%s"|args:$proprio}}
{{if $_GET.ok}}
{{if $_GET.msg == "ajout" }}
<p class="block confirm">Ajout effectué</p>
@ -37,14 +28,13 @@
<p class="block error">Modification refusée</p>
{{/if}}
{{#load type="category" count=true limit=1 assign="result"}}{{/load}}
{{:include file="_nav.html" current="inventaire" cat="%d"|args:$result.count subcurrent="stock"}}
{{if $result.count == 0}}
<p class="block alert">Il n'y a aucune catégorie : vous devez en ajouter.</p>
{{else}}
{{if $_GET.prop == null || $_GET.prop == "1"}}
{{:include file="./_inventory.html"}}
{{else}}
{{:include file="./_temp_inventory.html"}}
{{/if}}
{{:include file="./_inventory.html"}}
{{/if}}
{{:admin_footer}}