equipment/historique.html

130 lines
3.9 KiB
HTML
Raw Normal View History

2024-10-24 10:15:56 +02:00
{{* -*- brindille -*- *}}
{{:assign equipment_key=$_GET.key|trim}}
{{#load key=$_GET.key assign="equipment"}}
{{else}}
2023-12-06 09:59:11 +01:00
{{:error message="Pas de matériel avec la clé %s"|args:$equipment_key}}
{{/load}}
{{#load type="category" where="key = :cle" :cle=$equipment.category assign="category"}}
{{else}}
2023-12-06 09:59:11 +01:00
{{:error message="Le matériel %s n'appartient à aucune catégorie"|args:$equipment.designation}}
{{/load}}
2023-12-07 11:34:04 +01:00
{{:admin_header title="Historique des mouvements de %s (%s)"|args:$equipment.designation:$category.name current="module_equipment"}}
{{* récupérer la config des entrées/sorties *}}
{{:include file="./_get_config.html" keep="config"}}
{{* déterminer les type de mouvements selon l'affection du matériel *}}
{{#foreach from=$config.input_nature key=mvt item=type_mvt}}
{{if $_GET.prop}}
{{* matériel propriété de l'asso *}}
{{if $type_mvt != 'temporaire'}}
{{:assign var="input_types." value=$mvt}}
{{/if}}
{{else}}
{{* matériel non propriété de l'asso *}}
{{if $type_mvt == 'temporaire'}}
{{:assign var="input_types." value=$mvt}}
{{/if}}
{{/if}}
{{/foreach}}
{{#foreach from=$config.output_nature key=mvt item=type_mvt}}
{{if $_GET.prop}}
{{* matériel propriété de l'asso *}}
{{if $type_mvt != 'retour'}}
{{:assign var="output_types." value=$mvt}}
{{/if}}
{{else}}
{{* matériel non propriété de l'asso *}}
{{if $type_mvt == 'retour'}}
{{:assign var="output_types." value=$mvt}}
{{/if}}
{{/if}}
{{/foreach}}
{{* lister tous les mouvements du matériel passé en paramètre *}}
{{#list
2023-12-06 09:59:11 +01:00
type="movement"
select="$$.date AS 'Date';
CASE $$.direction WHEN 'input' THEN 'Entrée' WHEN 'output' THEN 'Sortie' END AS 'Mvt';
2024-10-24 10:15:56 +02:00
CASE $$.direction WHEN 'input' THEN $$.input_nature WHEN 'output' THEN $$.output_nature END AS 'operation';
2023-12-06 09:59:11 +01:00
$$.amount AS 'Nombre';
$$.comment AS 'Commentaire'"
equipment=$equipment_key
order=1
}}
2024-10-24 10:15:56 +02:00
{{:assign var="type_mvt" from="config.%s_nature.%s"|args:$direction:$col3}}
{{if $direction === "input" && $input_nature|in:$input_types ||
$direction === "output"&& $output_nature|in:$output_types
}}
<tr>
<td>{{$date|date_short}}</td>
<td>{{$col2}}</td>
<td>{{$col3}}</td>
<td>{{$amount}}</td>
<td>{{$comment}}</td>
2024-10-24 10:15:56 +02:00
<td class="actions">
{{if $direction === "input"}}
{{* entrée *}}
{{if $type_mvt == 'temporaire'}}
{{:linkbutton
label="Retour"
href="mouvements/sorties/emprunte.html?key=%s"|args:$key
shape="history"
target="_dialog"}}
{{elseif $type_mvt == 'définitif'}}
{{:linkbutton
label="Sortir"
href="mouvements/sorties/stock_disponible.html?key=%s"|args:$key
shape="minus"
target="_dialog"}}
{{/if}}
{{:linkbutton
label="Dupliquer"
href="mouvements/dupliquer_mouvement.html?mvt_key=%s&direction=input"|args:$key
shape="plus"
target="_dialog"}}
{{:linkbutton
label="Modifier"
href="mouvements/modifier_mouvement.html?key=%s&direction=input"|args:$key
shape="edit"
target="_dialog"}}
{{:linkbutton
label="Supprimer"
href="mouvements/entrees/delete_entree.html?key=%s"|args:$key
shape="delete"
target="_dialog"}}
{{else}}
{{* sortie *}}
{{if $type_mvt == 'temporaire'}}
{{:linkbutton
label="Retour"
href="mouvements/entrees/retour.html?key=%s"|args:key
shape="history"
target="_dialog"}}
{{/if}}
{{:linkbutton
label="Dupliquer"
href="mouvements/dupliquer_mouvement.html?mvt_key=%s&direction=output"|args:$key
shape="plus"
target="_dialog"}}
{{:linkbutton
label="Modifier"
href="mouvements/modifier_mouvement.html?key=%s&direction=output"|args:$key
shape="edit"
target="_dialog"}}
{{:linkbutton
label="Supprimer"
href="mouvements/sorties/delete_sortie.html?key=%s"|args:$key
shape="delete"
target="_dialog"}}
{{/if}}
</td>
</tr>
{{/if}}
{{/list}}
{{:admin_footer}}