125 lines
3.7 KiB
HTML
125 lines
3.7 KiB
HTML
{{* -*- brindille -*- *}}
|
|
|
|
{{#restrict section="users" level="read"}}{{/restrict}}
|
|
|
|
{{* lecture config (défaut ou enregistrée) *}}
|
|
{{:include file="../_get_config.html" keep="config, directions"}}
|
|
|
|
{{#foreach from=$directions key="direction"}}
|
|
{{:assign var="nature" from="config.%s_nature"|args:$direction}}
|
|
{{#foreach from=$nature key=key}}
|
|
{{:assign var="types.%s.%s."|args:$direction:$type value=$key|quote_sql}}
|
|
{{/foreach}}
|
|
{{:assign var="io_types" from="types.%s"|args:$direction}}
|
|
{{#foreach from=$io_types key=key}}
|
|
{{:assign var=elem from="io_types.%s"|args:$key}}
|
|
{{:assign elem=$elem|implode:","}}
|
|
{{:assign elem="("|cat:$elem|cat:")"}}
|
|
{{:assign var="%s_types.%s"|args:$direction:$key value=$elem}}
|
|
{{/foreach}}
|
|
{{/foreach}}
|
|
|
|
{{#select
|
|
json_extract(eqpmt.document, '$.name') as eqpmt_name,
|
|
mvt.key AS mvt_key,
|
|
json_extract(mvt.document, '$.direction') as direction,
|
|
json_extract(mvt.document, '$.operation') as operation,
|
|
json_extract(mvt.document, '$.date') as date,
|
|
json_extract(mvt.document, '$.amount') as amount
|
|
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
|
|
OR json_extract(mvt.document, '$.operation') IN !input_types)
|
|
ORDER BY date
|
|
;
|
|
:user = $user.id
|
|
!output_types=$output_types.temporaire
|
|
!input_types=$input_types.retour
|
|
assign="temp_mat."
|
|
}}
|
|
{{/select}}
|
|
|
|
{{if $temp_mat|count != 0}}
|
|
<h3 class="ruler">Matériels attribués temporairement</h3>
|
|
<table class="list">
|
|
<thead>
|
|
<tr>
|
|
<td>Matériel</td>
|
|
<td>Date</td>
|
|
<td>Quantité</td>
|
|
<td>Opération</td>
|
|
<td class="actions"></td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{#foreach from=$temp_mat}}
|
|
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$direction:$operation}}
|
|
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}}
|
|
<tr>
|
|
<td>{{$eqpmt_name}}</td>
|
|
<td>{{$date|date_short}}</td>
|
|
<td>{{$amount}}</td>
|
|
<td>{{$op_label}}</td>
|
|
<td class="actions">
|
|
{{if $direction == "output" && $type_mvt == "temporaire"}}
|
|
{{:linkbutton
|
|
label="Retour"
|
|
href="%smouvements/output_return.html?key=%s&prop=0"|args:$module.url:$mvt_key
|
|
shape="history"
|
|
target="_dialog"}}
|
|
{{/if}}
|
|
</td>
|
|
</tr>
|
|
{{/foreach}}
|
|
</tbody>
|
|
</table>
|
|
{{/if}}
|
|
|
|
{{#select
|
|
json_extract(eqpmt.document, '$.name') as eqpmt_name,
|
|
json_extract(mvt.document, '$.direction') as direction,
|
|
json_extract(mvt.document, '$.operation') as operation,
|
|
json_extract(mvt.document, '$.date') as date,
|
|
json_extract(mvt.document, '$.amount') as amount
|
|
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>
|
|
<td>Opération</td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{#foreach from=$def_mat}}
|
|
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}}
|
|
<tr>
|
|
<td>{{$eqpmt_name}}</td>
|
|
<td>{{$date|date_short}}</td>
|
|
<td>{{$amount}}</td>
|
|
<td>{{$op_label}}</td>
|
|
</tr>
|
|
{{/foreach}}
|
|
</tbody>
|
|
</table>
|
|
{{/if}}
|