Amélioration présentation détails membre
This commit is contained in:
parent
ec16163b53
commit
2ba9c20037
1 changed files with 129 additions and 66 deletions
|
|
@ -30,83 +30,126 @@
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{if $table_presente}}
|
{{if $table_presente}}
|
||||||
|
{{* Matériels attribués temporairement *}}
|
||||||
{{* vérifier la présence des types d'entrées et de sorties requis *}}
|
{{* vérifier la présence des types d'entrées et de sorties requis *}}
|
||||||
{{if $output_types|has_key:"temporaire" && $input_types|has_key:"retour"}}
|
{{if $output_types|has_key:"temporaire" && $input_types|has_key:"retour"}}
|
||||||
|
|
||||||
|
{{*
|
||||||
|
Calculer les quantités de matériel en prêt, retourné et restant
|
||||||
|
*}}
|
||||||
|
{{:assign premier=true}}
|
||||||
{{#select
|
{{#select
|
||||||
eqpmt.key as eqpmt_key,
|
|
||||||
json_extract(eqpmt.document, '$.name') as eqpmt_name,
|
|
||||||
mvt.key AS mvt_key,
|
mvt.key AS mvt_key,
|
||||||
json_extract(mvt.document, '$.direction') as direction,
|
json_extract(mvt.document, '$.date') AS out_date,
|
||||||
json_extract(mvt.document, '$.operation') as operation,
|
json_extract(eqpmt.document, '$.name') AS eqpmt_name,
|
||||||
json_extract(mvt.document, '$.date') as date,
|
json_extract(mvt.document, '$.amount') AS qte,
|
||||||
json_extract(mvt.document, '$.amount') as amount
|
IFNULL(SUM(json_extract(retour.document, '$.amount')), 0) AS return_amount,
|
||||||
|
json_extract(mvt.document, '$.operation') AS operation
|
||||||
FROM module_data_equipment AS mvt
|
FROM module_data_equipment AS mvt
|
||||||
INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id
|
INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id
|
||||||
INNER JOIN module_data_equipment AS eqpmt
|
LEFT JOIN module_data_equipment AS links ON mvt.key = json_extract(links.document, '$.temp_key')
|
||||||
ON json_extract(mvt.document, '$.equipment') = eqpmt.key
|
LEFT JOIN module_data_equipment AS retour ON retour.key = json_extract(links.document, '$.return')
|
||||||
WHERE users.id = :user
|
INNER JOIN module_data_equipment AS eqpmt ON json_extract(mvt.document, '$.equipment') = eqpmt.key
|
||||||
AND (json_extract(mvt.document, '$.operation') IN !output_types
|
WHERE
|
||||||
OR json_extract(mvt.document, '$.operation') IN !input_types)
|
users.id = :user
|
||||||
ORDER BY date
|
AND
|
||||||
|
json_extract(mvt.document, '$.type') = 'movement'
|
||||||
|
AND
|
||||||
|
json_extract(mvt.document, '$.operation') IN !output_types
|
||||||
|
GROUP BY mvt.key
|
||||||
|
ORDER BY eqpmt_name, json_extract(mvt.document, '$.date')
|
||||||
;
|
;
|
||||||
:user = $user.id
|
:user = $user.id
|
||||||
!output_types=$output_types.temporaire
|
!output_types=$output_types.temporaire
|
||||||
!input_types=$input_types.retour
|
|
||||||
assign="temp_mat."
|
|
||||||
}}
|
}}
|
||||||
{{/select}}
|
{{:assign reste="%d-%d"|math:$qte:$return_amount}}
|
||||||
|
{{if $reste > 0}}
|
||||||
|
{{:assign class=""}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign class="r0"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{:assign var="op_label" from="config.output_nature.%s.label"|args:$operation}}
|
||||||
{{if $temp_mat|count != 0}}
|
{{:assign total=$qte}}
|
||||||
|
{{if $premier}}
|
||||||
|
{{:assign premier=false}}
|
||||||
<h3 class="ruler">Matériels attribués temporairement</h3>
|
<h3 class="ruler">Matériels attribués temporairement</h3>
|
||||||
<table class="list">
|
<form method="post" action="">
|
||||||
|
<fieldset class="shortFormLeft">
|
||||||
|
{{:input type="checkbox" value=1 name="no_return" label="Masquer les matériels rendus en totalité"}}
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
<table class="list" id="liste_temporaires">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Date</td>
|
<th>Date</th>
|
||||||
<td>Opération</td>
|
<th>Matériel</th>
|
||||||
<td>Matériel</td>
|
<th>Opération</th>
|
||||||
<td>Quantité</td>
|
<th>Quantité</th>
|
||||||
<td>Total</td>
|
<th>Total</th>
|
||||||
<td class="actions"></td>
|
<th class="actions"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<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}}
|
|
||||||
{{:assign var="total" from="reste.%s"|args:$eqpmt_key}}
|
|
||||||
{{if $total == null}}
|
|
||||||
{{:assign total=0}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $direction == 'input' && $type_mvt == 'retour'}}
|
{{* Sortie temporaire *}}
|
||||||
{{:assign var="reste.%s"|args:$eqpmt_key value="%d-%d"|math:$total:$amount}}
|
<tr class="{{$class}}">
|
||||||
{{elseif $direction == 'output' && $type_mvt == 'temporaire'}}
|
<td>{{$out_date|date_short}}</td>
|
||||||
{{:assign var="reste.%s"|args:$eqpmt_key value="%d+%d"|math:$total:$amount}}
|
|
||||||
{{/if}}
|
|
||||||
{{:assign var="total" from="reste.%s"|args:$eqpmt_key}}
|
|
||||||
<tr>
|
|
||||||
<td>{{$date|date_short}}</td>
|
|
||||||
<td>{{$op_label}}</td>
|
|
||||||
<td>{{$eqpmt_name}}</td>
|
<td>{{$eqpmt_name}}</td>
|
||||||
<td>{{$amount}}</td>
|
<td>{{$op_label}}</td>
|
||||||
|
<td>{{$qte}}</td>
|
||||||
<td>{{$total}}</td>
|
<td>{{$total}}</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{{if $direction == "output" && $type_mvt == "temporaire"}}
|
{{if $reste > 0}}
|
||||||
|
{{if $reste > 1}}
|
||||||
|
{{:assign msg_reste="Reste %s unités"|args:$reste}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign msg_reste="Reste %s unité"|args:$reste}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Retour"
|
label="Retour"
|
||||||
href="%smovements/output_return.html?key=%s&prop=0&user=%s"|args:$module.url:$mvt_key:$user.id
|
href="%smovements/output_return.html?key=%s&prop=0&user=%s"|args:$module.url:$mvt_key:$user.id
|
||||||
shape="history"
|
shape="history"
|
||||||
|
title=$msg_reste
|
||||||
target="_dialog"}}
|
target="_dialog"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
|
||||||
|
{{* chercher les retours *}}
|
||||||
|
{{#select
|
||||||
|
json_extract(links.document, '$.return') AS return_key,
|
||||||
|
json_extract(return_mvt.document, '$.amount') AS return_amount,
|
||||||
|
json_extract(return_mvt.document, '$.date') AS return_date,
|
||||||
|
json_extract(return_mvt.document, '$.operation') AS operation
|
||||||
|
FROM module_data_equipment AS links
|
||||||
|
INNER JOIN module_data_equipment AS return_mvt ON return_mvt.key = return_key
|
||||||
|
WHERE json_extract(links.document, '$.temp_key') = :mvt_key
|
||||||
|
ORDER BY return_date
|
||||||
|
;
|
||||||
|
:mvt_key=$mvt_key
|
||||||
|
}}
|
||||||
|
{{:assign var="op_label" from="config.input_nature.%s.label"|args:$operation}}
|
||||||
|
{{:assign total="%d-%d"|math:$total:$return_amount}}
|
||||||
|
|
||||||
|
{{* retour de sortie temporaire *}}
|
||||||
|
<tr class="{{$class}}">
|
||||||
|
<td>{{$return_date|date_short}}</td>
|
||||||
|
<td>{{$eqpmt_name}}</td>
|
||||||
|
<td>{{$op_label}}</td>
|
||||||
|
<td>{{$return_amount}}</td>
|
||||||
|
<td>{{$total}}</td>
|
||||||
|
<td class="actions"></td>
|
||||||
|
</tr>
|
||||||
|
{{/select}}
|
||||||
|
{{/select}}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* vérifier la présence des types d'entrées et de sorties requis *}}
|
{{* Matériels attribués définitivement *}}
|
||||||
{{ if $output_types|has_key:"définitif"}}
|
{{* vérifier la présence des types de sorties requis *}}
|
||||||
|
{{if $output_types|has_key:"définitif"}}
|
||||||
{{#select
|
{{#select
|
||||||
eqpmt.key as eqpmt_key,
|
eqpmt.key as eqpmt_key,
|
||||||
json_extract(eqpmt.document, '$.name') as eqpmt_name,
|
json_extract(eqpmt.document, '$.name') as eqpmt_name,
|
||||||
|
|
@ -134,11 +177,11 @@
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Date</td>
|
<th>Date</th>
|
||||||
<td>Opération</td>
|
<th>Matériel</th>
|
||||||
<td>Matériel</td>
|
<th>Opération</th>
|
||||||
<td>Quantité</td>
|
<th>Quantité</th>
|
||||||
<td>Total</td>
|
<th>Total</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
@ -155,8 +198,8 @@
|
||||||
{{:assign var="total" from="reste.%s"|args:$eqpmt_key}}
|
{{:assign var="total" from="reste.%s"|args:$eqpmt_key}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{$date|date_short}}</td>
|
<td>{{$date|date_short}}</td>
|
||||||
<td>{{$op_label}}</td>
|
|
||||||
<td>{{$eqpmt_name}}</td>
|
<td>{{$eqpmt_name}}</td>
|
||||||
|
<td>{{$op_label}}</td>
|
||||||
<td>{{$amount}}</td>
|
<td>{{$amount}}</td>
|
||||||
<td>{{$total}}</td>
|
<td>{{$total}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -165,3 +208,23 @@
|
||||||
</table>
|
</table>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
// afficher/masquer les sorties temporaires entièrement rendues
|
||||||
|
function showhide(cb, liste) {
|
||||||
|
let rows = liste.querySelectorAll("tr[class='r0']");
|
||||||
|
rows.forEach((elem) => {
|
||||||
|
if (cb.checked) {
|
||||||
|
elem.style.display = 'none';
|
||||||
|
} else {
|
||||||
|
elem.style.display = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let cb = $('#f_no_return_1');
|
||||||
|
cb.addEventListener("change", (evt) => {
|
||||||
|
showhide(cb, document.getElementById('liste_temporaires'));
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue