diff --git a/_get_config.html b/_get_config.html index 119a20b..671a20e 100644 --- a/_get_config.html +++ b/_get_config.html @@ -16,7 +16,7 @@ {{:assign var="nature" from="module.config.%s_nature"|args:$direction}} {{if $nature != null}} {{#foreach from=$nature item="elem"}} - {{:assign var="item" label=$label type=$type}} + {{:assign var="item" label=$label type=$type fee=$fee}} {{:assign var="config.%s_nature.%s"|args:$direction:$key value=$item}} {{/foreach}} {{else}} diff --git a/_inventory.html b/_inventory.html index 090a01d..53e9566 100644 --- a/_inventory.html +++ b/_inventory.html @@ -1,40 +1,56 @@ {{* -*- brindille -*- *}} {{* - inventaire des entrées/sorties des matériels permanents + Inventaire des matériels en stock dans l'association *}} {{* 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_key=$selected_category|quote_sql}} {{:assign cat_condition="$$.category = %s"|args:$cat_key}} {{else}} {{:assign cat_condition="1"}} {{/if}} -{{* Sélecteur catégories *}} -{{:assign var="cat_options." value="" label="Toutes les catégories" href="?cat_key=-1&prop=1"}} +{{* 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="cat_options." value=$key label=$name - href="?cat_key=%s&prop=1"|args:$key + href="?cat_key=%s"|args:$key }} {{/load}} @@ -47,8 +63,21 @@ }} +{{: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"}} + +
+Inventaire des matériels propriété de l'association
+Inventaire des matériels présents dans l'association
Inventaire des matériels empruntés ou loués
+{{* 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' ; @@ -60,7 +46,7 @@ $$.notowned AS 'Quantité' " type="equipment" - where="$$.status <> 'archived' AND $$.notowned != 0 AND %s"|args:$cat_condition + where="$$.status <> 'archived' AND $$.notowned != 0 AND %s"|args:$condition order=1 }} {{:assign var=cat_name from=categories.%s|args:$category}} diff --git a/archives.html b/archives.html index 261673c..efb1a22 100644 --- a/archives.html +++ b/archives.html @@ -9,11 +9,30 @@Matériel remis en service
{{/if}} +{{* filtrer selon la catégorie *}} +{{if $_GET.cat_key == null}} + {{:assign selected_category=$module.config.archive_cat_key}} +{{elseif $_GET.cat_key == -1}} + {{:assign selected_category=null}} + {{:save key="config" archive_cat_key=null}} +{{else}} + {{:assign selected_category=$_GET.cat_key}} + {{:save key="config" archive_cat_key=$selected_category}} +{{/if}} + +{{* condition de filtrage *}} +{{if $selected_category == null}} + {{:assign cat_condition="1"}} +{{else}} + {{:assign cat_key=$selected_category|quote_sql}} + {{:assign cat_condition="$$.category == %s"|args:$cat_key}} +{{/if}} + {{* Sélecteur catégories *}} -{{:assign var="options." value="" label="Toutes les catégories" href="?prop=1"}} +{{:assign var="cat_options." value="" label="Toutes les catégories" href="?cat_key=-1"}} {{#load type="category" order="$$.name"}} {{:assign - var="options." + var="cat_options." value=$key label=$name href="?cat_key=%s"|args:$key @@ -24,8 +43,8 @@ {{:dropdown title="Filtrer par catégorie" - options=$options - value="%s"|args:$_GET.cat_key + options=$cat_options + value="%s"|args:$selected_category }} @@ -33,14 +52,6 @@Matériels qui ne sont plus dans l'association
-{{* 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}} - {{* Liste des matériels archivés *}} {{#list select=" @@ -50,7 +61,7 @@ WHERE cat.key = @TABLE.$$.category) AS "Catégorie" " type="equipment" - where="$$.status='archived' AND %s"|args:$condition + where="$$.status='archived' AND %s"|args:$cat_condition order=1 }} diff --git a/config.html b/config.html index 9927c5e..f5bb3ec 100644 --- a/config.html +++ b/config.html @@ -12,14 +12,21 @@ {{/if}} {{* lecture config (défaut ou enregistrée) *}} -{{:include file="./_get_config.html" keep="config, directions"}} +{{:include file="./_get_config.html" keep="config_defaut, config, directions"}} + +{{* interdire la modification et la suppression des types de mouvement prédéfinis *}} +{{#foreach from=$directions key="direction"}} + {{:assign var="nature" from="config_defaut.%ss"|args:$direction}} + {{#foreach from=$nature item="elem"}} + {{:assign var="default_keys." value=$key}} + {{/foreach}} +{{/foreach}} {{#foreach from=$directions key="direction" item="item"}} {{* types de mouvements qui ne peuvent être supprimés *}} {{#load type="movement" where="$$.direction='%s'"|args:$direction group="$$.operation"}} - {{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}} - {{:assign var="locked_%ss."|args:$direction value=$op_label}} + {{:assign var="locked." value=$operation}} {{/load}}