Ajout détails mouvement et possibilité joindre fichier

This commit is contained in:
Jean-Christophe Engel 2025-10-15 14:30:26 +02:00
parent 2ba9c20037
commit 14cf1a520d
2 changed files with 125 additions and 42 deletions

View file

@ -28,6 +28,7 @@
{{else}}
{{:error message="Le matériel %s n'appartient à aucune catégorie"|args:$equipment.name}}
{{/load}}
{{:admin_header title="Gestion des matériels" custom_css="./style.css" current="module_equipment"}}
{{if $_GET.current != null}}
@ -176,7 +177,7 @@
THEN (SELECT $$.name FROM @TABLE as storage WHERE storage.key = @TABLE.$$.storage)
ELSE ''
END AS 'Stockage';
$$.comment AS 'Commentaire'
'' AS 'Doc'
"|args:$config.user_fields.name_sql
equipment=$equipment_key
order=1
@ -190,6 +191,12 @@
{{:assign var="stock" from="quantites.%s.stock"|args:$id}}
{{:assign var="exterieur" from="quantites.%s.exterieur"|args:$id}}
{{:assign var="dispo" from="quantites.%s.dispo"|args:$id}}
{{:assign file_path="%s/%s/"|args:$module.storage_root:$key}}
{{:assign file_path=$file_path|cat:"%"}}
{{#select count(*) AS nb FROM files WHERE path LIKE :file_path ; :file_path=$file_path}}
{{:assign nb_files=$nb}}
{{/select}}
<tr>
<td>{{$date|date_short}}</td>
<td>{{$col2}}</td>
@ -200,7 +207,7 @@
<td class="num nosort">{{$dispo}}</td>
<td>{{:link href="/admin/users/details.php?id=%s"|args:$user label="%s"|args:$col8}}</td>
<td>{{$col9}}</td>
<td>{{$comment}}</td>
<td class="num nosort">{{if $nb_files > 0}}{{:tag label="%s"|args:$nb_files}}{{:icon shape="attach"}}{{/if}}</td>
<td class="actions">
{{if $current != "archives"}}
{{if $direction == "output" && $type_mvt == "temporaire"}}
@ -214,25 +221,11 @@
target="_dialog"}}
{{/if}}
{{/if}}
{{if $direction == "input" && $type_mvt == "retour"}}
{{* interdire dupliquer *}}
{{else}}
{{:linkbutton
label="Dupliquer"
href="movements/copy_movement.html?key=%s&prop=%s"|args:$key:$_GET.prop
shape="plus"
target="_dialog"}}
{{/if}}
{{:linkbutton
label="Modifier"
href="movements/modify_movement.html?key=%s"|args:$key
shape="edit"
target="_dialog"}}
{{:linkbutton
label="Supprimer"
href="movements/delete_movement.html?key=%s&prop=%s"|args:$key:$_GET.prop
shape="delete"
target="_dialog"}}
label="Détails"
href="movements/movement_details.html?key=%s&prop=%s"|args:$key:$_GET.prop
shape="eye"
}}
{{/if}}
</td>
</tr>
@ -276,8 +269,8 @@
CASE WHEN $$.storage NOT NULL
THEN (SELECT $$.name FROM @TABLE as storage WHERE storage.key = @TABLE.$$.storage)
ELSE ''
END as 'Stockage';
$$.comment AS 'Commentaire'"
END as 'Stockage'
"
equipment=$equipment_key
order=1
}}
@ -295,7 +288,6 @@
<td class="num">{{$amount}}</td>
<td class="num nosort">{{$stock}}</td>
<td>{{$col6}}</td>
<td>{{$comment}}</td>
<td class="actions">
{{if $direction == "input" && $type_mvt == "temporaire"}}
{{:assign var="temp_in" from="present.%s"|args:$key}}
@ -308,25 +300,11 @@
target="_dialog"}}
{{/if}}
{{/if}}
{{if $direction == "output" && $type_mvt == "retour"}}
{{* interdire dupliquer *}}
{{else}}
{{:linkbutton
label="Dupliquer"
href="movements/copy_movement.html?key=%s&prop=%s"|args:$key:$_GET.prop
shape="plus"
target="_dialog"}}
{{/if}}
{{:linkbutton
label="Modifier"
href="movements/modify_movement.html?key=%s"|args:$key
shape="edit"
target="_dialog"}}
{{:linkbutton
label="Supprimer"
href="movements/delete_movement.html?key=%s&prop=%s"|args:$key:$_GET.prop
shape="delete"
target="_dialog"}}
label="Détails"
href="movements/movement_details.html?key=%s&prop=%s"|args:$key:$_GET.prop
shape="eye"
}}
</td>
</tr>
{{/if}}

View file

@ -0,0 +1,105 @@
{{* -*- brindille -*- *}}
{{*
Afficher les détails d'un mouvement et donner la possibilité :
- d'associer des fichiers
- de modifier, supprimer ou dupliquer le mouvement
paramètres :
- key : clé du mouvement
- prop = 1 si matériel appartient à l'asso
*}}
{{:admin_header title="Détails du mouvement" custom_css="../style.css" current="module_equipment"}}
{{:form_errors}}
{{* récupérer les infos du mouvement *}}
{{#load key=$_GET.key assign="mvt"}}
{{else}}
{{:error message="Aucun mouvement avec la clé %s"|args:$_GET.key}}
{{/load}}
{{* récupérer la config des entrées/sorties *}}
{{:include file="../_get_config.html" keep="config, directions"}}
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$mvt.direction:$mvt.operation}}
{{* récupérer les infos du matériel associé *}}
{{#load key=$mvt.equipment assign="equipment"}}
{{else}}
{{:error message="Aucun matériel avec la clé « %s »"|args:$mvt.equipment}}
{{/load}}
{{*
-------------------- Afficher les informations du mouvement --------------------
*}}
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$mvt.direction:$mvt.operation}}
{{#load key=$equipment.category assign="category"}}{{/load}}
{{#load key=$mvt.storage assign="storage"}}{{/load}}
{{#select !name as nom FROM users WHERE id=:id; !name=$config.user_fields.name_sql :id=$mvt.user}}
{{:assign user_name=$nom}}
{{/select}}
<nav class="tabs">
{{:linkbutton
label="Modifier ce mouvement"
href="modify_movement.html?key=%s"|args:$_GET.key
shape="edit"
target="_dialog"}}
{{:linkbutton
label="Supprimer ce mouvement"
href="delete_movement.html?key=%s&prop=%s"|args:$_GET.key:$_GET.prop
shape="delete"
target="_dialog"}}
{{if $type_mvt != "retour"}}
{{:linkbutton
label="Dupliquer ce mouvement"
href="copy_movement.html?key=%s&prop=%s"|args:$_GET.key:$_GET.prop
shape="plus"
target="_dialog"}}
{{/if}}
</nav>
<dl class="describe">
<dt>Opération</dt>
<dd>{{$op_label}}</dd>
<dt>Matériel</dt>
<dd>{{$equipment.name}}</dd>
<dt>Catégorie</dt>
<dd>{{$category.name}}</dd>
<dt>Date</dt>
<dd>{{$mvt.date|date_short}}</dd>
<dt>Quantité</dt>
<dd>{{$mvt.amount}}</dd>
<dt>Membre destinataire</dt>
<dd>
{{if $mvt.user != null}}
{{$user_name}}
{{else}}—
{{/if}}
</dd>
<dt>Lieu de stockage</dt>
<dd>
{{if $storage != null}}
{{$storage.name}}
{{else}}—
{{/if}}
</dd>
<dt>Écritures liées</dt>
<dd>
{{#foreach from=$mvt.transactions item="trans"}}
{{:link class="num" href="!acc/transactions/details.php?id=%d"|args:$trans label=$trans}}
{{else}}—
{{/foreach}}
</dd>
<dt>Remarques</dt>
<dd>{{if $mvt.comment != null}}
{{$mvt.comment}}
{{else}}—
{{/if}}
</dd>
</dl>
<form method="post" action="">
{{:admin_files path=$_GET.key upload=true edit=true use_trash=false}}
</form>
{{:admin_footer}}