equipment/snippets/user_details.html

96 lines
2.4 KiB
HTML

{{* -*- brindille -*- *}}
{{#restrict section="users" level="read"}}{{/restrict}}
{{* lecture config (défaut ou enregistrée) *}}
{{:include file="../_get_config.html" keep="config"}}
{{#foreach from=$config.output_nature key=key}}
{{:assign var="types.output.%s."|args:$type value=$key}}
{{/foreach}}
{{#foreach from=$types.output key=key}}
{{:assign var=elem from="types.output.%s"|args:$key}}
{{:assign elem=$elem|quote_sql|implode:","}}
{{:assign elem="("|cat:$elem|cat:")"}}
{{:assign var="output_types.%s"|args:$key value=$elem}}
{{/foreach}}
{{#select
json_extract(eqpmt.document, '$.name') as mat,
json_extract(mvt.document, '$.date') as date,
json_extract(mvt.document, '$.amount') as qte
FROM module_data_equipment AS mvt
INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id
INNER JOIN module_data_equipment AS eqpmt
ON json_extract(mvt.document, '$.equipment') = eqpmt.key
WHERE users.id = :user AND json_extract(mvt.document, '$.operation') IN !output_types
ORDER BY date DESC
;
:user = $user.id
!output_types=$output_types.temporaire
assign="temp_mat."
}}
{{/select}}
{{if $temp_mat|count != 0}}
<h3 class="ruler">Matériels en prêt</h3>
<table class="list">
<thead>
<tr>
<td>Matériel</td>
<td>Date</td>
<td>Quantité</td>
</tr>
</thead>
<tbody>
{{#foreach from=$temp_mat}}
<tr>
<td>{{$mat}}</td>
<td>{{$date|date_short}}</td>
<td>{{$qte}}</td>
</tr>
{{/foreach}}
</tbody>
</table>
{{/if}}
{{#select
json_extract(eqpmt.document, '$.name') as mat,
json_extract(mvt.document, '$.date') as date,
json_extract(mvt.document, '$.amount') as qte
FROM module_data_equipment AS mvt
INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id
INNER JOIN module_data_equipment AS eqpmt
ON json_extract(mvt.document, '$.equipment') = eqpmt.key
WHERE users.id = :user AND json_extract(mvt.document, '$.operation') IN !output_types
ORDER BY date DESC
;
:user = $user.id
!output_types=$output_types.définitif
assign="def_mat."
}}
{{/select}}
{{if $def_mat|count != 0}}
<h3 class="ruler">Matériels attribués définitivement</h3>
<table class="list">
<thead>
<tr>
<td>Matériel</td>
<td>Date</td>
<td>Quantité</td>
</tr>
</thead>
<tbody>
{{#foreach from=$def_mat}}
<tr>
<td>{{$mat}}</td>
<td>{{$date|date_short}}</td>
<td>{{$qte}}</td>
</tr>
{{/foreach}}
</tbody>
</table>
{{/if}}