Mutualisation onglets prêt et location

This commit is contained in:
Jean-Christophe Engel 2026-01-29 13:48:48 +01:00
parent 974f87e5a4
commit 546a9ea677
10 changed files with 176 additions and 421 deletions

View file

@ -2,14 +2,21 @@
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
{{:admin_header title="Prêts en cours" custom_css="../style.css" current="module_equipment"}}
{{:include file="./_nav.html" current="prêts" subcurrent="encours"}}
{{if $_GET.output_type == "loan"}}
{{:assign label="prêt"}}
{{elseif $_GET.output_type == "rent"}}
{{:assign label="location"}}
{{else}}
{{:error message="Cette page n'existe pas !"}}
{{/if}}
{{:admin_header title="%ss en cours"|args:$label|ucfirst custom_css="../style.css" current="module_equipment"}}
{{:include file="./_nav.html" current="%s"|args:$label subcurrent="encours"}}
{{*
vérifier l'existence de la table du module
eh oui, il se peut qu'elle ne soit pas encore créée si aucune donnée n'a été ajoutée dedans
*}}
{{#load limit="1"}}
{{:assign table_presente=true}}
{{else}}
@ -36,13 +43,21 @@
{{* filtrer selon la catégorie *}}
{{if $_GET.cat_key == null}}
{{:assign selected_category=$module.config.loan_hist_cat_key}}
{{:assign var="selected_category" from="module.config.%s_hist_cat_key"|args:$_GET.output_type}}
{{elseif $_GET.cat_key == -1}}
{{:assign selected_category=null}}
{{:save key="config" loan_hist_cat_key=null}}
{{if $_GET.output_type == "loan"}}
{{:save key="config" loan_hist_cat_key=null}}
{{elseif $_GET.output_type == "rent"}}
{{:save key="config" rent_hist_cat_key=null}}
{{/if}}
{{else}}
{{:assign selected_category=$_GET.cat_key}}
{{:save key="config" loan_hist_cat_key=$selected_category}}
{{if $_GET.output_type == "loan"}}
{{:save key="config" loan_hist_cat_key=$selected_category}}
{{elseif $_GET.output_type == "rent"}}
{{:save key="config" rent_hist_cat_key=$selected_category}}
{{/if}}
{{/if}}
{{* condition de filtrage *}}
@ -54,7 +69,12 @@
{{/if}}
{{#foreach from=$config.output_nature key="key"}}
{{if $type == 'temporaire' && $fee != 'payant'}}
{{if $type != 'temporaire'}}
{{:continue}}
{{/if}}
{{if $_GET.output_type == "loan" && $fee != 'payant'}}
{{:assign var="out_keys." value=$key|quote_sql}}
{{elseif $_GET.output_type == "rent" && $fee == 'payant'}}
{{:assign var="out_keys." value=$key|quote_sql}}
{{/if}}
{{/foreach}}
@ -62,13 +82,13 @@
{{:assign out_keys="("|cat:$out_keys|cat:")"}}
{{* sélecteur de catégorie *}}
{{:assign var="cat_options." value="" label="Toutes les catégories" href="?cat_key=-1"}}
{{:assign var="cat_options." value="" label="Toutes les catégories" href="?output_type=%s&cat_key=-1"|args:$_GET.output_type}}
{{#load type="category" order="$$.name"}}
{{:assign
var="cat_options."
value=$key
label=$name
href="?cat_key=%s"|args:$key
href="?output_type=%s&cat_key=%s"|args:$_GET.output_type:$key
}}
{{/load}}
@ -82,7 +102,7 @@
</fieldset>
<div class="shortFormLeft">
<p class="help">Location de matériel en cours</p>
<p class="help">{{$label|ucfirst}} de matériel en cours</p>
</div>
{{:assign premier=true}}
@ -105,7 +125,7 @@
AND !cat_condition
GROUP BY mvt.key
HAVING remain != 0
ORDER BY out_date, nom
ORDER BY out_date DESC, nom
;
!table=$module.table
!op = $out_keys
@ -161,9 +181,14 @@
href="movements/output_return.html?key=%s&prop=1"|args:$mvt_key
shape="reset"
target="_dialog"}}
{{if $_GET.output_type == "loan"}}
{{:assign from="lh"}}
{{elseif $_GET.output_type == "rent"}}
{{:assign from="rh"}}
{{/if}}
{{:linkbutton
label="Détails"
href="movements/movement_details.html?key=%s&prop=1&from=lh"|args:$mvt_key
href="movements/movement_details.html?key=%s&prop=1&from=%s"|args:$mvt_key:$from
shape="eye"
}}
</td>