Ajout onglets prêts/locations aux membres

This commit is contained in:
Jean-Christophe Engel 2026-02-11 17:53:47 +01:00
parent 7f60e6aa04
commit 2a181e4929
3 changed files with 107 additions and 0 deletions

View file

@ -30,11 +30,13 @@
<ul class="sub">
<li {{if $subcurrent == 'encours'}} class="current"{{/if}}><a href="{{$module.url}}loan_history.html?output_type=loan">En cours</a></li>
<li {{if $subcurrent == 'historique'}} class="current"{{/if}}><a href="{{$module.url}}loan_movements.html?output_type=loan">Historique</a></li>
<li {{if $subcurrent == 'membres'}} class="current"{{/if}}><a href="{{$module.url}}member_loan.html?output_type=loan">Membres</a></li>
</ul>
{{elseif $current == 'location'}}
<ul class="sub">
<li {{if $subcurrent == 'encours'}} class="current"{{/if}}><a href="{{$module.url}}loan_history.html?output_type=rent">En cours</a></li>
<li {{if $subcurrent == 'historique'}} class="current"{{/if}}><a href="{{$module.url}}loan_movements.html?output_type=rent">Historique</a></li>
<li {{if $subcurrent == 'membres'}} class="current"{{/if}}><a href="{{$module.url}}member_loan.html?output_type=rent">Membres</a></li>
</ul>
{{elseif $current == 'archives'}}
{{if $subsubcurrent == 'historique'}}

101
member_loan.html Normal file
View file

@ -0,0 +1,101 @@
{{* -*- brindille -*- *}}
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
{{*
paramètres :
- id : id membre
*}}
{{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 aux membres"|args:$label|ucfirst custom_css="./style.css" current="module_equipment"}}
{{:include file="./_nav.html" current="%s"|args:$label subcurrent="membres"}}
{{* vérifier l'existence de la table du module *}}
{{#load limit="1"}}
{{:assign table_presente=true}}
{{else}}
{{:assign table_presente=false}}
{{/load}}
{{if $table_presente}}
{{:include file="./_get_config.html" keep="config"}}
{{* déterminer les types de mouvements *}}
{{#foreach from=$config.output_nature key="key"}}
{{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}}
{{:assign out_keys=$out_keys|implode:","}}
{{:assign out_keys="("|cat:$out_keys|cat:")"}}
<div class="shortFormLeft">
<p class="help">{{$label|ucfirst}}s aux membres</p>
</div>
{{:assign premier=true}}
{{#select
nom, user, GROUP_CONCAT(mat_name) AS materiel, SUM(remain) AS quantite
FROM
(SELECT users.nom AS nom,
users.id AS user,
json_extract(mat.document, '$.name') AS mat_name,
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(retour.document, '$.amount')), 0) AS remain
FROM !table AS mvt
INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id
LEFT JOIN !table AS links ON mvt.key = json_extract(links.document, '$.temp_key')
LEFT JOIN !table AS retour ON retour.key = json_extract(links.document, '$.return')
INNER JOIN !table AS mat ON mat.key = json_extract(mvt.document, '$.equipment')
WHERE json_extract(mvt.document, '$.type') = 'movement'
AND json_extract(mvt.document, '$.operation') IN !op
GROUP BY mvt.key
HAVING remain != 0
)
GROUP BY user
ORDER BY nom
;
!table=$module.table
!op = $out_keys
}}
{{if $premier}}
<table class="list">
<thead>
<tr>
<td>Membre</td>
<td class="nombre">Quantité</td>
<td>Matériels</td>
</tr>
</thead>
<tbody>
{{:assign premier=false}}
{{/if}}
<tr>
<td>{{:link href="/admin/users/details.php?id=%s"|args:$user label="%s"|args:$nom}}</td>
<td class="nombre">{{$quantite}}</td>
<td>{{$materiel}}</td>
</tr>
{{else}}
<p class="block alert">Aucun mouvement.</p>
{{/select}}
</tbody>
</table>
{{else}}
<p class="block alert">Aucun mouvement.</p>
{{/if}}
{{:admin_footer}}

View file

@ -24,3 +24,7 @@
table.list > thead th[class~=nosort] a:hover {
background-color : rgba(var(--gSecondColor), 0.);
}
.nombre {
text-align: right !important;
}