From 7b7c3c652d55eac9b958f06476f66a7dd59395d9 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Wed, 8 Oct 2025 10:34:41 +0200 Subject: [PATCH 01/33] Correction script disableColumSort --- scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts.js b/scripts.js index 9a97993..299b7e4 100644 --- a/scripts.js +++ b/scripts.js @@ -8,7 +8,7 @@ function disableColumSort(liste) { let columns = liste.querySelectorAll("tbody > tr > td"); // chercher la ligne de titres - let titles = liste.querySelectorAll("thead > tr > td"); + let titles = liste.querySelectorAll("thead > tr > th"); // désactiver le tri for (let i = 0; i < titles.length; ++i) { From a0293c3e921e4a409308f575c795a13937433bd2 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Wed, 8 Oct 2025 14:41:31 +0200 Subject: [PATCH 02/33] =?UTF-8?q?Simplification=20op=C3=A9rations=20cat?= =?UTF-8?q?=C3=A9gories?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- categories/delete_category.html | 2 +- categories/index.html | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/categories/delete_category.html b/categories/delete_category.html index 203bb60..7430344 100644 --- a/categories/delete_category.html +++ b/categories/delete_category.html @@ -7,7 +7,7 @@ {{#form on="delete"}} {{* Vérifier s'il reste des matériels dans cette catégorie *}} - {{#load type="equipment" category=$_GET.key assign="equipment"}} + {{#load type="equipment" category=$_GET.key limit="1"}} {{:redirect force="./index.html?err=1&msg=suppression"}} {{else}} {{* supprimer la catégorie sélectionnée*}} diff --git a/categories/index.html b/categories/index.html index aac2a00..0eb43d0 100644 --- a/categories/index.html +++ b/categories/index.html @@ -27,15 +27,17 @@ {{:assign category_key=$key}} {{* voir s'il y a des matériels dans cette catégorie *}} {{:assign materiel_present=true}} - {{#load type="equipment" where="$$.category = :category_key" :category_key=$category_key}} + {{#load type="equipment" where="$$.category = :category_key" :category_key=$category_key limit=1}} {{else}} {{:assign materiel_present=false}} {{/load}} {{$name}} + {{if ! $materiel_present}} + {{:linkbutton label="Supprimer" href="delete_category.html?key=%s"|args:$key shape="delete" target="_dialog"}} + {{/if}} {{:linkbutton label="Modifier" href="modify_category.html?key=%s"|args:$key shape="edit" target="_dialog"}} - {{:linkbutton label="Supprimer" href="delete_category.html?key=%s"|args:$key shape="delete" target="_dialog"}} {{else}} From a56ab4b4ed44d4a75e8da09f213d02f27673ea08 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Wed, 8 Oct 2025 14:46:48 +0200 Subject: [PATCH 03/33] Correction style colonne non triable --- style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/style.css b/style.css index 2193b11..39ae075 100644 --- a/style.css +++ b/style.css @@ -21,6 +21,6 @@ } /* désactiver rétroaction pour colonnes non triables */ -table.list > thead td[class~=nosort] a:hover { +table.list > thead th[class~=nosort] a:hover { background-color : rgba(var(--gSecondColor), 0.); } From 8c81d07efc5e8e6b3fc792ab0b28fcd2b9348158 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Wed, 8 Oct 2025 14:47:20 +0200 Subject: [PATCH 04/33] Inhiber tri colonne operation --- equipment_history.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/equipment_history.html b/equipment_history.html index ecf5a97..3ce6424 100644 --- a/equipment_history.html +++ b/equipment_history.html @@ -193,7 +193,7 @@ {{$date|date_short}} {{$col2}} - {{$op_label}} + {{$op_label}} {{$amount}} {{$stock}} {{$exterieur}} @@ -291,7 +291,7 @@ {{$date|date_short}} {{$col2}} - {{$op_label}} + {{$op_label}} {{$amount}} {{$stock}} {{$col6}} From ec16163b53afd5a532e05b4ccd18f955a06b4518 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Thu, 9 Oct 2025 14:22:43 +0200 Subject: [PATCH 05/33] =?UTF-8?q?Mise-=C3=A0-jour=20module.ini?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module.ini b/module.ini index b1374a7..28ffd9e 100644 --- a/module.ini +++ b/module.ini @@ -1,5 +1,5 @@ name="Gestion des matériels" -description="Permet de gérer un inventaire de matériels, ainsi que de suivre les prêts (en test)." +description="Permet de gérer un inventaire de matériels, ainsi que de suivre les prêts." author="Jean-Christophe Engel" author_url="https://gitea.zaclys.com/lesanges" home_button=true From 2ba9c2003760436abf5241d4cef84f775d966b81 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Tue, 14 Oct 2025 10:01:00 +0200 Subject: [PATCH 06/33] =?UTF-8?q?Am=C3=A9lioration=20pr=C3=A9sentation=20d?= =?UTF-8?q?=C3=A9tails=20membre?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snippets/user_details.html | 195 ++++++++++++++++++++++++------------- 1 file changed, 129 insertions(+), 66 deletions(-) diff --git a/snippets/user_details.html b/snippets/user_details.html index b288eb2..ae4b346 100644 --- a/snippets/user_details.html +++ b/snippets/user_details.html @@ -30,83 +30,126 @@ {{/load}} {{if $table_presente}} + {{* Matériels attribués temporairement *}} {{* 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"}} + + {{* + Calculer les quantités de matériel en prêt, retourné et restant + *}} + {{:assign premier=true}} {{#select - eqpmt.key as eqpmt_key, - 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 + json_extract(mvt.document, '$.date') AS out_date, + json_extract(eqpmt.document, '$.name') AS eqpmt_name, + json_extract(mvt.document, '$.amount') AS qte, + IFNULL(SUM(json_extract(retour.document, '$.amount')), 0) AS return_amount, + json_extract(mvt.document, '$.operation') AS operation 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 + LEFT JOIN module_data_equipment AS links ON mvt.key = json_extract(links.document, '$.temp_key') + LEFT JOIN module_data_equipment AS retour ON retour.key = json_extract(links.document, '$.return') + INNER JOIN module_data_equipment AS eqpmt ON json_extract(mvt.document, '$.equipment') = eqpmt.key + WHERE + users.id = :user + 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 !output_types=$output_types.temporaire - !input_types=$input_types.retour - assign="temp_mat." }} - {{/select}} - {{/if}} + {{:assign reste="%d-%d"|math:$qte:$return_amount}} + {{if $reste > 0}} + {{:assign class=""}} + {{else}} + {{:assign class="r0"}} + {{/if}} + {{:assign var="op_label" from="config.output_nature.%s.label"|args:$operation}} + {{:assign total=$qte}} + {{if $premier}} + {{:assign premier=false}} +

Matériels attribués temporairement

+
+
+ {{:input type="checkbox" value=1 name="no_return" label="Masquer les matériels rendus en totalité"}} +
+
+ + + + + + + + + + + + + {{/if}} + {{* Sortie temporaire *}} + + + + + + + @@ -200,7 +207,7 @@ - + @@ -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 @@ - {{/if}} diff --git a/movements/movement_details.html b/movements/movement_details.html new file mode 100644 index 0000000..c83528f --- /dev/null +++ b/movements/movement_details.html @@ -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}} + + + +
+
Opération
+
{{$op_label}}
+
Matériel
+
{{$equipment.name}}
+
Catégorie
+
{{$category.name}}
+
Date
+
{{$mvt.date|date_short}}
+
Quantité
+
{{$mvt.amount}}
+
Membre destinataire
+
+ {{if $mvt.user != null}} + {{$user_name}} + {{else}}— + {{/if}} +
+
Lieu de stockage
+
+ {{if $storage != null}} + {{$storage.name}} + {{else}}— + {{/if}} +
+
Écritures liées
+
+ {{#foreach from=$mvt.transactions item="trans"}} + {{:link class="num" href="!acc/transactions/details.php?id=%d"|args:$trans label=$trans}} + {{else}}— + {{/foreach}} +
+
Remarques
+
{{if $mvt.comment != null}} + {{$mvt.comment}} + {{else}}— + {{/if}} +
+
+ + + {{:admin_files path=$_GET.key upload=true edit=true use_trash=false}} + +{{:admin_footer}} From 36f840b3c6b5296056aa6d1607d1feefe6f9ded4 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Thu, 16 Oct 2025 09:23:33 +0200 Subject: [PATCH 08/33] Correction oubli inhiber tri colonne --- _inventory.html | 9 ++++++--- equipment_history.html | 9 ++++++--- global_history.html | 9 ++++++--- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/_inventory.html b/_inventory.html index 326070c..d48a72f 100644 --- a/_inventory.html +++ b/_inventory.html @@ -84,7 +84,10 @@ diff --git a/equipment_history.html b/equipment_history.html index 48d5039..9685b1b 100644 --- a/equipment_history.html +++ b/equipment_history.html @@ -315,7 +315,10 @@ diff --git a/global_history.html b/global_history.html index 726075e..8f98f16 100644 --- a/global_history.html +++ b/global_history.html @@ -88,7 +88,10 @@ From 5848d73196c5b812d5b91fa79fa498e27f109117 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Thu, 16 Oct 2025 12:12:16 +0200 Subject: [PATCH 09/33] =?UTF-8?q?Am=C3=A9lioration=20coh=C3=A9rence=20info?= =?UTF-8?q?s=20formulaires?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- movements/copy_movement.html | 11 +++++++---- movements/modify_movement.html | 15 ++++++++------- movements/movement_details.html | 32 ++++++++++++++++++-------------- 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/movements/copy_movement.html b/movements/copy_movement.html index 17f2fa1..459cde5 100644 --- a/movements/copy_movement.html +++ b/movements/copy_movement.html @@ -202,7 +202,12 @@ {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=copie"|args:$eqpmt_key:$prop}} {{/form}} -{{:admin_header title="Dupliquer un mouvement" custom_css="./../style.css" current="module_equipment"}} +{{if $mvt_new.direction == "input"}} + {{:assign mvt_label="entrée"}} +{{else}} + {{:assign mvt_label="sortie"}} +{{/if}} +{{:admin_header title="Dupliquer une %s"|args:$mvt_label custom_css="./../style.css" current="module_equipment"}} {{:form_errors}} {{* @@ -261,9 +266,7 @@ }} {{/if}} {{if $mvt_new.direction == "input"}} - {{if $storage != null}} - {{:input type="select" name="storage" label="Lieu de stockage" default_empty="— Aucun —" options=$storage required=false}} - {{/if}} + {{:input type="select" name="storage" default=$mvt_new.storage label="Lieu de stockage" default_empty="— Aucun —" options=$storage required=false}} {{if $type_mvt != "retour"}} {{:input type="list" name="transactions" label="Écritures liées" target="!acc/transactions/selector.php" multiple=true help="par exemple écriture avec facture"}} {{/if}} diff --git a/movements/modify_movement.html b/movements/modify_movement.html index bc50aa8..e737d9d 100644 --- a/movements/modify_movement.html +++ b/movements/modify_movement.html @@ -219,7 +219,12 @@ {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=modification"|args:$eqpmt_key:$prop}} {{/form}} -{{:admin_header title="Modifier un mouvement" custom_css="./../style.css" current="module_equipment"}} +{{if $mvt_new.direction == "input"}} + {{:assign mvt_label="entrée"}} +{{else}} + {{:assign mvt_label="sortie"}} +{{/if}} +{{:admin_header title="Modifier une %s"|args:$mvt_label custom_css="./../style.css" current="module_equipment"}} {{:form_errors}} {{* @@ -232,11 +237,6 @@ {{#select id, !name as nom FROM users WHERE id=:id; !name=$config.user_fields.name_sql :id=$mvt_new.user}} {{:assign var="user.%s"|args:$id value=$nom}} {{/select}} - {{#load type="link" where="$$.direction="output" AND $$.temp_key = :mvt_key" :mvt_key=$mvt_new.key limit=1}} - {{:assign retour=true}} - {{else}} - {{:assign retour=false}} - {{/load}} {{/if}} {{#load type="storage" order="$$.name"}} @@ -274,10 +274,11 @@ {{:input type="number" name="amount" label="Quantité" min=1 required=true default=$mvt_new.amount}} +
Informations facultatives
- {{if $prop == 1 && $mvt_new.direction == "output" && ! $retour}} + {{if $prop == 1 && $mvt_new.direction == "output"}} {{:input type="list" name="user" diff --git a/movements/movement_details.html b/movements/movement_details.html index c83528f..16a170f 100644 --- a/movements/movement_details.html +++ b/movements/movement_details.html @@ -70,20 +70,24 @@
{{$mvt.date|date_short}}
Quantité
{{$mvt.amount}}
-
Membre destinataire
-
- {{if $mvt.user != null}} - {{$user_name}} - {{else}}— - {{/if}} -
-
Lieu de stockage
-
- {{if $storage != null}} - {{$storage.name}} - {{else}}— - {{/if}} -
+ {{if $mvt.direction == "output" && $type_mvt != "retour"}} +
Membre destinataire
+
+ {{if $mvt.user != null}} + {{$user_name}} + {{else}}— + {{/if}} +
+ {{/if}} + {{if $mvt.direction == "input"}} +
Lieu de stockage
+
+ {{if $storage != null}} + {{$storage.name}} + {{else}}— + {{/if}} +
+ {{/if}}
Écritures liées
{{#foreach from=$mvt.transactions item="trans"}} From 56d4f729e30d40a2ed734a7484af74589e9cd4dc Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Wed, 22 Oct 2025 17:26:18 +0200 Subject: [PATCH 10/33] =?UTF-8?q?Correction=20d=C3=A9tection=20libell?= =?UTF-8?q?=C3=A9=20entr=C3=A9e/sortie=20d=C3=A9j=C3=A0=20pr=C3=A9sent=20d?= =?UTF-8?q?ans=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _get_config.html | 7 +++---- config/add_movement_type.html | 13 ++++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/_get_config.html b/_get_config.html index 8f36df8..095dff9 100644 --- a/_get_config.html +++ b/_get_config.html @@ -1,9 +1,8 @@ {{* -*- brindille -*- *}} {{* - Récupérer soit la config enregistrée, soit la config par défaut - @param : default = true si config par défaut - résultat : config.input_nature et config.output_nature + Récupérer la config + résultat : config_defaut, directions, config.input_nature et config.output_nature *}} {{* config par défaut *}} @@ -15,7 +14,7 @@ {{#foreach from=$directions key="direction"}} {{:assign var="nature" from="module.config.%s_nature"|args:$direction}} - {{if $nature != null && ! $default}} + {{if $nature != null}} {{#foreach from=$nature item="elem"}} {{:assign var="item" label=$label type=$type}} {{:assign var="config.%s_nature.%s"|args:$direction:$key value=$item}} diff --git a/config/add_movement_type.html b/config/add_movement_type.html index bb7d64b..226311f 100644 --- a/config/add_movement_type.html +++ b/config/add_movement_type.html @@ -12,16 +12,16 @@ {{* Traiter l'envoi du formulaire *}} -{{* lecture config par défaut *}} -{{:include file="../_get_config.html" keep="config, directions" default=true}} +{{* lecture config *}} +{{:include file="../_get_config.html" keep="config, directions, config_defaut"}} {{#form on="save"}} - {{* vérifier s'il existe un type de mouvement de même nom *}} + {{* vérifier s'il existe un libellé de même nom dans la même direction *}} {{#foreach from=$directions key="direction"}} {{:assign var="nature" from="config.%s_nature"|args:$direction}} {{#foreach from=$nature key="key"}} {{:assign var="fields" from="_POST.%s_fields"|args:$_GET.dir}} - {{if $label|trim|tolower == $fields.label|trim|tolower}} + {{if $_GET.dir == $direction && $label|trim|tolower == $fields.label|trim|tolower}} {{:error message="Ce libellé est déjà présent"}} {{/if}} {{:assign var="%s_nature.key"|args:$direction value=$key}} @@ -39,7 +39,6 @@ {{:assign var="%s_nature.type"|args:$direction from="_POST.%s_fields.type"|args:$direction}} {{:assign var="%s_natures."|args:$direction from="%s_nature"|args:$direction}} {{/if}} - {{/foreach}} {{:save @@ -56,7 +55,7 @@ {{if $_GET.dir == 'input'}} {{* types d'entrées *}} - {{#foreach from=$config.input_nature}} + {{#foreach from=$config_defaut.inputs}} {{:assign var='input_types.%s'|args:$type value=$type}} {{/foreach}}
@@ -95,7 +94,7 @@ {{else}} {{* types de sorties *}} - {{#foreach from=$config.output_nature}} + {{#foreach from=$config_defaut.outputs}} {{:assign var='output_types.%s'|args:$type value=$type}} {{/foreach}} From 2285c44a3254a14ca36c8c24c963e7d222c1362f Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Wed, 22 Oct 2025 17:28:35 +0200 Subject: [PATCH 11/33] Rajout bouton historique dans inventaire --- _inventory.html | 4 ++++ _temp_inventory.html | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/_inventory.html b/_inventory.html index d48a72f..b74bdbb 100644 --- a/_inventory.html +++ b/_inventory.html @@ -71,6 +71,10 @@ shape="plus" href="movements/input_equipment.html?key=%s"|args:$key target="_dialog"}} + {{:linkbutton + label="Historique" + href="equipment_history.html?key=%s&prop=1"|args:$key + shape="table"}} {{:linkbutton label="Modifier" href="modify_equipment.html?key=%s&prop=1"|args:$key diff --git a/_temp_inventory.html b/_temp_inventory.html index f1fd997..df4f8aa 100644 --- a/_temp_inventory.html +++ b/_temp_inventory.html @@ -60,6 +60,10 @@ shape="plus" href="movements/input_equipment.html?key=%s"|args:$key target="_dialog"}} + {{:linkbutton + label="Historique" + href="equipment_history.html?key=%s&prop=0"|args:$key + shape="table"}} {{:linkbutton label="Modifier" href="modify_equipment.html?key=%s&prop=0"|args:$key From 18d9ad9699a20722c8ff0568a1a2715a108fae3c Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Wed, 22 Oct 2025 17:31:13 +0200 Subject: [PATCH 12/33] =?UTF-8?q?Am=C3=A9lioration=20pr=C3=A9sentation=20i?= =?UTF-8?q?nventaire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- equipment_history.html | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/equipment_history.html b/equipment_history.html index 9685b1b..7f5c096 100644 --- a/equipment_history.html +++ b/equipment_history.html @@ -113,20 +113,20 @@ {{:assign nonproprio="%d-%d"|math:$nonproprio:$amount}} {{/if}} {{/if}} - {{:assign dispo="%d-%d"|math:$stock:$exterieur}} + {{:assign dispo_final="%d-%d"|math:$stock:$exterieur}} {{:assign var="quantites.%s.stock"|args:$id value=$stock}} {{:assign var="quantites.%s.exterieur"|args:$id value=$exterieur}} - {{:assign var="quantites.%s.dispo"|args:$id value=$dispo}} + {{:assign var="quantites.%s.dispo"|args:$id value=$dispo_final}} {{:assign var="quantites.%s.nonproprio"|args:$id value=$nonproprio}} {{/load}} {{if $current != "archives"}} {{/if}} @@ -177,7 +177,8 @@ THEN (SELECT $$.name FROM @TABLE as storage WHERE storage.key = @TABLE.$$.storage) ELSE '' END AS 'Stockage'; - '' AS 'Doc' + '' AS 'Documents'; + $$.transactions AS 'Écritures' "|args:$config.user_fields.name_sql equipment=$equipment_key order=1 @@ -207,7 +208,8 @@
- + + {{/if}} {{/list}} - + {{if $dispo_final === 0}} + Il n'y a aucun matériel disponible, il n'est donc pas possible d'effectuer une sortie + {{/if}} {{else}} {{* calculer la quantité présente temporairement de chaque matériel *}} {{#foreach from=$config.input_nature key=key}} @@ -269,7 +272,9 @@ CASE WHEN $$.storage NOT NULL THEN (SELECT $$.name FROM @TABLE as storage WHERE storage.key = @TABLE.$$.storage) ELSE '' - END as 'Stockage' + END as 'Stockage'; + '' AS 'Documents'; + $$.transactions AS 'Écritures' " equipment=$equipment_key order=1 @@ -281,6 +286,12 @@ $direction === "output"&& $op_label|in:$output_types }} {{:assign var="stock" from="quantites.%s.nonproprio"|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}} @@ -288,13 +299,14 @@ + +
DateMatérielOpérationQuantitéTotal
{{$out_date|date_short}}{{$eqpmt_name}}{{$op_label}}{{$qte}}{{$total}} + {{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}} - {{if $temp_mat|count != 0}} -

Matériels attribués temporairement

- - - - - - - - + {{:linkbutton + label="Retour" + href="%smovements/output_return.html?key=%s&prop=0&user=%s"|args:$module.url:$mvt_key:$user.id + shape="history" + title=$msg_reste + target="_dialog"}} + {{/if}} + + + + {{* 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 *}} + + + + + + - - - {{#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 $direction == 'input' && $type_mvt == 'retour'}} - {{:assign var="reste.%s"|args:$eqpmt_key value="%d-%d"|math:$total:$amount}} - {{elseif $direction == 'output' && $type_mvt == 'temporaire'}} - {{:assign var="reste.%s"|args:$eqpmt_key value="%d+%d"|math:$total:$amount}} - {{/if}} - {{:assign var="total" from="reste.%s"|args:$eqpmt_key}} - - - - - - - - - {{/foreach}} + {{/select}} + {{/select}}
DateOpérationMatérielQuantitéTotal
{{$return_date|date_short}}{{$eqpmt_name}}{{$op_label}}{{$return_amount}}{{$total}}
{{$date|date_short}}{{$op_label}}{{$eqpmt_name}}{{$amount}}{{$total}} - {{if $direction == "output" && $type_mvt == "temporaire"}} - {{:linkbutton - label="Retour" - href="%smovements/output_return.html?key=%s&prop=0&user=%s"|args:$module.url:$mvt_key:$user.id - shape="history" - target="_dialog"}} - {{/if}} -
{{/if}} - {{* vérifier la présence des types d'entrées et de sorties requis *}} - {{ if $output_types|has_key:"définitif"}} + {{* Matériels attribués définitivement *}} + {{* vérifier la présence des types de sorties requis *}} + {{if $output_types|has_key:"définitif"}} {{#select eqpmt.key as eqpmt_key, json_extract(eqpmt.document, '$.name') as eqpmt_name, @@ -134,11 +177,11 @@ - - - - - + + + + + @@ -155,8 +198,8 @@ {{:assign var="total" from="reste.%s"|args:$eqpmt_key}} - + @@ -165,3 +208,23 @@
DateOpérationMatérielQuantitéTotalDateMatérielOpérationQuantitéTotal
{{$date|date_short}}{{$op_label}} {{$eqpmt_name}}{{$op_label}} {{$amount}} {{$total}}
{{/if}} {{/if}} + + From 14cf1a520d8454167f7f34a53fd68649df2f02f9 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Wed, 15 Oct 2025 14:30:26 +0200 Subject: [PATCH 07/33] =?UTF-8?q?Ajout=20d=C3=A9tails=20mouvement=20et=20p?= =?UTF-8?q?ossibilit=C3=A9=20joindre=20fichier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- equipment_history.html | 62 ++++++------------- movements/movement_details.html | 105 ++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+), 42 deletions(-) create mode 100644 movements/movement_details.html diff --git a/equipment_history.html b/equipment_history.html index 3ce6424..48d5039 100644 --- a/equipment_history.html +++ b/equipment_history.html @@ -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,11 +177,11 @@ 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 - }} + }} {{: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}} @@ -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}}
{{$date|date_short}} {{$col2}}{{$dispo}} {{:link href="/admin/users/details.php?id=%s"|args:$user label="%s"|args:$col8}} {{$col9}}{{$comment}}{{if $nb_files > 0}}{{:tag label="%s"|args:$nb_files}}{{:icon shape="attach"}}{{/if}} {{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}}
{{$amount}} {{$stock}} {{$col6}}{{$comment}} {{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" + }}
{{$dispo}} {{:link href="/admin/users/details.php?id=%s"|args:$user label="%s"|args:$col8}} {{$col9}}{{if $nb_files > 0}}{{:tag label="%s"|args:$nb_files}}{{:icon shape="attach"}}{{/if}}{{if $nb_files > 0}}{{:icon shape="attach"}}{{/if}}{{if $transactions|count > 0}}{{:icon shape="money"}}{{/if}} {{if $current != "archives"}} {{if $direction == "output" && $type_mvt == "temporaire"}} @@ -215,7 +217,6 @@ {{if $temp_ext != null && $temp_ext > 0}} {{:linkbutton label="Retour" - title="Enregistrer un retour de sortie temporaire" href="movements/output_return.html?key=%s&prop=%s"|args:$key:$_GET.prop shape="reset" target="_dialog"}} @@ -231,7 +232,9 @@
{{$date|date_short}} {{$col2}}{{$amount}} {{$stock}} {{$col6}}{{if $nb_files > 0}}{{:icon shape="attach"}}{{/if}}{{if $transactions|count > 0}}{{:icon shape="money"}}{{/if}} {{if $direction == "input" && $type_mvt == "temporaire"}} {{:assign var="temp_in" from="present.%s"|args:$key}} {{if $temp_in != null && $temp_in > 0}} {{:linkbutton label="Retour" - title="Enregistrer un retour d'entrée temporaire" href="movements/input_return.html?key=%s&prop=%s"|args:$key:$_GET.prop shape="reset" target="_dialog"}} From 1d5d54e59e8ff6898f8446722ac8bc82a221db79 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Wed, 22 Oct 2025 17:40:45 +0200 Subject: [PATCH 13/33] Remplacement nom table explicite --- equipment_history.html | 12 ++++++------ movements/input_return.html | 6 +++--- movements/output_return.html | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/equipment_history.html b/equipment_history.html index 7f5c096..9bb584d 100644 --- a/equipment_history.html +++ b/equipment_history.html @@ -145,9 +145,9 @@ {{#select mvt.key AS mvt_key, json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS reste - FROM module_data_equipment AS mvt - LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.temp_key') - LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') + FROM {!$module.table} AS mvt + LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key') + LEFT JOIN {!$module.table} AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') WHERE json_extract(mvt.document, '$.operation') IN !op AND json_extract(mvt.document, '$.equipment') = :eqpmt_key @@ -248,9 +248,9 @@ {{#select mvt.key AS mvt_key, json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS present - FROM module_data_equipment AS mvt - LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.temp_key') - LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') + FROM {!$module.table} AS mvt + LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key') + LEFT JOIN {!$module.table} AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') WHERE json_extract(mvt.document, '$.operation') IN !op AND json_extract(mvt.document, '$.equipment') = :eqpmt_key diff --git a/movements/input_return.html b/movements/input_return.html index 03e567b..4683205 100644 --- a/movements/input_return.html +++ b/movements/input_return.html @@ -32,9 +32,9 @@ {{#select json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS present - FROM module_data_equipment AS mvt - LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.temp_key') - LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') + FROM {!$module.table} AS mvt + LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key') + LEFT JOIN {!$module.table} AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') WHERE json_extract(mvt.document, '$.operation') IN !op AND mvt.key = :mvt_key diff --git a/movements/output_return.html b/movements/output_return.html index 679de12..7f5b0af 100644 --- a/movements/output_return.html +++ b/movements/output_return.html @@ -32,9 +32,9 @@ {{#select json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS exterieur - FROM module_data_equipment AS mvt - LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.temp_key') - LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') + FROM {!$module.table} AS mvt + LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key') + LEFT JOIN {!$module.table} AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') WHERE json_extract(mvt.document, '$.operation') IN !op AND mvt.key = :mvt_key From b6743ad3b395cf74dd4c0b83b38fa54e8a2d6c08 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Thu, 23 Oct 2025 10:39:01 +0200 Subject: [PATCH 14/33] =?UTF-8?q?Simplification=20d=C3=A9tails=20membre?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snippets/user_details.html | 176 +++++++++++++------------------------ 1 file changed, 63 insertions(+), 113 deletions(-) diff --git a/snippets/user_details.html b/snippets/user_details.html index ae4b346..3268dec 100644 --- a/snippets/user_details.html +++ b/snippets/user_details.html @@ -35,116 +35,85 @@ {{if $output_types|has_key:"temporaire" && $input_types|has_key:"retour"}} {{* - Calculer les quantités de matériel en prêt, retourné et restant + Calculer les quantités de matériel en prêt *}} {{:assign premier=true}} {{#select - mvt.key AS mvt_key, - json_extract(mvt.document, '$.date') AS out_date, + json_extract(mvt.document, '$.direction') AS direction, + json_extract(mvt.document, '$.date') AS date, + eqpmt.key as eqpmt_key, json_extract(eqpmt.document, '$.name') AS eqpmt_name, json_extract(mvt.document, '$.amount') AS qte, - 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.table} AS mvt INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id - LEFT JOIN module_data_equipment AS links ON mvt.key = json_extract(links.document, '$.temp_key') - LEFT JOIN module_data_equipment AS retour ON retour.key = json_extract(links.document, '$.return') - INNER JOIN module_data_equipment AS eqpmt ON json_extract(mvt.document, '$.equipment') = eqpmt.key + INNER JOIN {!$module.table} AS eqpmt ON json_extract(mvt.document, '$.equipment') = eqpmt.key WHERE users.id = :user 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') + (json_extract(mvt.document, '$.operation') IN !output_types + OR + json_extract(mvt.document, '$.operation') IN !input_types) + ORDER BY eqpmt_name, date ; :user = $user.id !output_types=$output_types.temporaire + !input_types=$input_types.retour }} - {{:assign reste="%d-%d"|math:$qte:$return_amount}} - {{if $reste > 0}} - {{:assign class=""}} - {{else}} - {{:assign class="r0"}} - {{/if}} - {{:assign var="op_label" from="config.output_nature.%s.label"|args:$operation}} - {{:assign total=$qte}} {{if $premier}} {{:assign premier=false}} -

Matériels attribués temporairement

-
-
- {{:input type="checkbox" value=1 name="no_return" label="Masquer les matériels rendus en totalité"}} -
-
- - - - - - - - - - - - + {{:assign total=0}} + {{:assign old_eqpmt_key=$eqpmt_key}} + {{:assign var="ligne.date" value=$date}} + {{:assign var="ligne.materiel" value=$eqpmt_name}} {{/if}} - {{* Sortie temporaire *}} - - - - - - - - + {{if $eqpmt_key != $old_eqpmt_key}} + {{if $total > 0}} + {{:assign var="ligne.qte" value=$total}} + {{:assign var="lignes." value=$ligne}} + {{/if}} + {{:assign total=0}} + {{:assign old_eqpmt_key=$eqpmt_key}} + {{:assign var="ligne.date" value=$date}} + {{:assign var="ligne.materiel" value=$eqpmt_name}} + {{/if}} - {{* 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 *}} - - - - - - - - - {{/select}} + {{if $direction == "output"}} + {{:assign total="%d+%d"|math:$total:$qte}} + {{else}} + {{:assign total="%d-%d"|math:$total:$qte}} + {{/if}} {{/select}} - -
DateMatérielOpérationQuantitéTotal
{{$out_date|date_short}}{{$eqpmt_name}}{{$op_label}}{{$qte}}{{$total}} - {{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 - label="Retour" - href="%smovements/output_return.html?key=%s&prop=0&user=%s"|args:$module.url:$mvt_key:$user.id - shape="history" - title=$msg_reste - target="_dialog"}} - {{/if}} -
{{$return_date|date_short}}{{$eqpmt_name}}{{$op_label}}{{$return_amount}}{{$total}}
+ + {{if $total > 0}} + {{:assign var="ligne.qte" value=$total}} + {{:assign var="lignes." value=$ligne}} + {{/if}} + + {{if $lignes|count > 0}} +

Matériels attribués temporairement

+ + + + + + + + + + {{#foreach from=$lignes}} + + + + + + {{/foreach}} + +
DateMatérielQuantité
{{$date|date_short}}{{$materiel}}{{$qte}}
+ {{/if}} {{/if}} {{* Matériels attribués définitivement *}} @@ -155,15 +124,16 @@ 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 + MIN(json_extract(mvt.document, '$.date')) as date, + SUM(json_extract(mvt.document, '$.amount')) as amount + FROM {!$module.table} AS mvt INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id - INNER JOIN module_data_equipment AS eqpmt + INNER JOIN {!$module.table} 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 + GROUP BY eqpmt_key, operation + ORDER BY eqpmt_name, date ; :user = $user.id !output_types=$output_types.définitif @@ -208,23 +178,3 @@
{{/if}} {{/if}} - - From 8266ab8aeb93211b14ca7780e70c882f1df8ac0b Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Thu, 23 Oct 2025 10:41:22 +0200 Subject: [PATCH 15/33] =?UTF-8?q?Mise-=C3=A0-jour=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d6e356b..16a0479 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,12 @@ Ce module permet de gérer les matériels de l'association: stock, entrées, sorties, classés par catégorie. -Un matériel peut entrer temporairement (location, emprunt, ...) ou -définitivement dans l'association (achat, ...). +Un matériel peut entrer dans l'association : +- temporairement (location, emprunt, ...) +- définitivement (achat, ...) + +Dans les deux cas, il est possible de lui associer une écriture de la +compta ou un fichier. Un matériel appartenant à l'association peut sortir : - temporairement (prêt, ...) : il est possible de lui associer un lieu From fc526918f9724a42f16fecf3976ac919a729711a Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Fri, 24 Oct 2025 10:50:57 +0200 Subject: [PATCH 16/33] Sortie temporaire : ajout date retour --- _get_config.html | 6 +++++ default.json | 3 ++- movements/copy_movement.html | 35 +++++++++++++++++++++++++- movements/modify_movement.html | 44 ++++++++++++++++++++++++++++++++- movements/movement.schema.json | 5 ++++ movements/movement_details.html | 4 +++ movements/output_equipment.html | 39 ++++++++++++++++++++++++++++- scripts.js | 27 ++++++++++++++++++++ 8 files changed, 159 insertions(+), 4 deletions(-) diff --git a/_get_config.html b/_get_config.html index 095dff9..119a20b 100644 --- a/_get_config.html +++ b/_get_config.html @@ -28,3 +28,9 @@ {{/foreach}} {{/if}} {{/foreach}} + +{{if $module.config.loan_duration != null}} + {{:assign loan_duration=$module.config.loan_duration}} +{{else}} + {{:assign loan_duration=$config_defaut.loan_duration}} +{{/if}} diff --git a/default.json b/default.json index 07a9c10..b9906b7 100644 --- a/default.json +++ b/default.json @@ -33,5 +33,6 @@ "label" : "Retour de Location/Emprunt", "type" : "retour" } - ] + ], + "loan_duration" : "30" } diff --git a/movements/copy_movement.html b/movements/copy_movement.html index 459cde5..29539ea 100644 --- a/movements/copy_movement.html +++ b/movements/copy_movement.html @@ -14,7 +14,7 @@ {{/load}} {{* récupérer la config des entrées/sorties *}} -{{:include file="../_get_config.html" keep="config, directions"}} +{{:include file="../_get_config.html" keep="config, directions, loan_duration"}} {{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$mvt_new.direction:$mvt_new.operation}} {{* interdire de dupliquer un retour => utiliser le bouton « Retour » *}} @@ -93,6 +93,11 @@ {{:assign var="mvt_new.amount" value=$_POST.amount}} {{:assign var="mvt_new.date" value=$_POST.date|parse_date}} {{:assign var="mvt_new.comment" value=$_POST.comment}} + {{if $_POST.set_return_date != null}} + {{:assign return_date=$_POST.return_date}} + {{else}} + {{:assign return_date=null}} + {{/if}} {{* lister les mouvements @@ -198,6 +203,7 @@ user=$user.id storage=$_POST.storage transactions=$transactions + return_date=$return_date|parse_date }} {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=copie"|args:$eqpmt_key:$prop}} {{/form}} @@ -272,6 +278,22 @@ {{/if}} {{/if}} {{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false default=$mvt_new.comment}} + {{if $mvt_new.direction == "output" && $type_mvt == "temporaire"}} + {{if $mvt_new.return_date != null}} + {{:assign checked="checked"}} + {{:assign visibility="visible"}} + {{:assign return_date=$mvt_new.return_date}} + {{else}} + {{:assign visibility="hidden"}} + {{:assign ts_sortie=$mvt_new.date|strtotime}} + {{:assign ts_retour="%d+%d*(60*60*24)"|math:$ts_sortie:$loan_duration}} + {{:assign return_date=$ts_retour|date_short}} + {{/if}} + {{:input id="set_return_date" type="checkbox" value=1 name="set_return_date" label="Fixer une date de retour" help="Cocher pour fixer une date de retour" checked="%s"|args:$checked}} +
+ {{:input type="date" name="return_date" label="Date de retour" default=$return_date}} +
+ {{/if}} @@ -282,3 +304,14 @@ {{:admin_footer}} + + + diff --git a/movements/modify_movement.html b/movements/modify_movement.html index e737d9d..2139e4d 100644 --- a/movements/modify_movement.html +++ b/movements/modify_movement.html @@ -13,7 +13,7 @@ {{/load}} {{* récupérer la config des entrées/sorties *}} -{{:include file="../_get_config.html" keep="config, directions"}} +{{:include file="../_get_config.html" keep="config, directions, loan_duration"}} {{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$mvt_new.direction:$mvt_new.operation}} {{if $mvt_new.direction == "input"}} @@ -84,6 +84,11 @@ {{:assign var="mvt_new.amount" value=$_POST.amount}} {{:assign var="mvt_new.date" value=$_POST.date|parse_date}} {{:assign var="mvt_new.comment" value=$_POST.comment}} + {{if $_POST.set_return_date != null}} + {{:assign return_date=$_POST.return_date}} + {{else}} + {{:assign return_date=null}} + {{/if}} {{* lister les mouvements @@ -215,6 +220,7 @@ user=$user_id storage=$_POST.storage transactions=$transactions + return_date=$return_date|parse_date }} {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=modification"|args:$eqpmt_key:$prop}} {{/form}} @@ -298,6 +304,23 @@ {{/if}} {{/if}} {{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false default=$mvt_new.comment}} + {{if $mvt_new.direction == "output" && $type_mvt == "temporaire"}} + {{if $mvt_new.return_date != null}} + {{:assign checked="checked"}} + {{:assign visibility="visible"}} + {{:assign return_date=$mvt_new.return_date}} + {{else}} + {{:assign visibility="hidden"}} + {{:assign ts_sortie=$mvt_new.date|strtotime}} + {{:assign ts_retour="%d+%d*(60*60*24)"|math:$ts_sortie:$loan_duration}} + {{:assign return_date=$ts_retour|date_short}} + {{/if}} + {{:input id="set_return_date" type="checkbox" value=1 name="set_return_date" label="Fixer une date de retour" help="Cocher pour fixer une date de retour" checked="%s"|args:$checked}} +
+ {{:input type="date" name="return_date" label="Date de retour" default=$return_date}} + +
+ {{/if}} @@ -308,3 +331,22 @@ {{:admin_footer}} + + + diff --git a/movements/movement.schema.json b/movements/movement.schema.json index bd27c1c..eaebdb3 100644 --- a/movements/movement.schema.json +++ b/movements/movement.schema.json @@ -46,6 +46,11 @@ "items": { "type": "integer" } + }, + "return_date" : { + "description": "Date de retour du matériel", + "type" : ["null", "string"], + "format" : "date" } }, "required": ["type", "direction", "operation", "amount", "equipment", "date", "comment"] diff --git a/movements/movement_details.html b/movements/movement_details.html index 16a170f..f25fca7 100644 --- a/movements/movement_details.html +++ b/movements/movement_details.html @@ -101,6 +101,10 @@ {{else}}— {{/if}} + {{if $mvt.return_date != null}} +
Date de retour
+
{{$mvt.return_date|date_short}}
+ {{/if}}
diff --git a/movements/output_equipment.html b/movements/output_equipment.html index 9993f78..d211cb3 100644 --- a/movements/output_equipment.html +++ b/movements/output_equipment.html @@ -6,7 +6,7 @@ *}} {{* récupérer la config des entrées/sorties *}} -{{:include file="../_get_config.html" keep="config"}} +{{:include file="../_get_config.html" keep="config, loan_duration"}} {{* types de sorties *}} {{#foreach from=$config.output_nature key=key}} @@ -31,6 +31,15 @@ {{/if}} {{:assign var="type_mvt" from="config.output_nature.%s.type"|args:$_POST.operation}} + {{if $type_mvt != "temporaire" && $_POST.set_return_date != null}} + {{:error message="On ne peut associer une date de retour qu'à une sortie temporaire"}} + {{/if}} + {{if $_POST.set_return_date != null}} + {{:assign return_date=$_POST.return_date}} + {{else}} + {{:assign return_date=null}} + {{/if}} + {{if $_POST.user|count > 1}} {{:error message="Un membre au plus peut être associé à une sortie"}} {{/if}} @@ -142,6 +151,7 @@ date=$_POST.date|parse_date comment=$_POST.remarques|trim user=$user.id + return_date=$return_date|parse_date }} {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=1&msg=sortie"|args:$_GET.key}} {{/form}} @@ -156,6 +166,8 @@ {{:assign dispo="%d-%d"|math:$equipment.stock:$equipment.out}} {{if $dispo > 0}} + {{:assign ts_retour="%d+%d*(60*60*24)"|math:$now:$loan_duration}} + {{:assign date_retour=$ts_retour|date_short}} {{* formulaire de sortie de matériel *}} @@ -194,6 +206,11 @@ max=1 }} {{:input type="textarea" name="remarques" label="Remarques" cols="40" rows="3" required=false}} + {{:input id="set_return_date" type="checkbox" value=1 name="set_return_date" label="Fixer une date de retour" help="Cocher pour fixer une date de retour"}} +

@@ -206,3 +223,23 @@ {{:form_errors}} {{:admin_footer}} + + + diff --git a/scripts.js b/scripts.js index 299b7e4..fe36b24 100644 --- a/scripts.js +++ b/scripts.js @@ -25,3 +25,30 @@ function disableColumSort(liste) { } } } + +function toggleVisibility(idcheck, fields) { + const elem = document.getElementById(idcheck); + for (let id of fields) { + const field = document.getElementById(id); + if (elem.checked) { + field.style.visibility = "visible"; + } else { + field.style.visibility = "hidden"; + } + } +} + +/** + * renvoyer la valeur en secondes d'une date au format j/m/a + * @param {string} date + */ +function str2sec(date) { + const jma = date.split('/'); + const dd = new Date(jma[2], jma[1]-1, jma[0]); + return dd.getTime()/1000; +} + +// renvoyer la valeur en secondes d'un champ date +function getDate(idelem) { + return str2sec(document.getElementById(idelem).value); +} From ec29f26176004261dafdc9d1cb56423b3c6d88ee Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Mon, 27 Oct 2025 12:11:29 +0100 Subject: [PATCH 17/33] =?UTF-8?q?Simplification=20d=C3=A9tails=20membre=20?= =?UTF-8?q?(suite)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snippets/user_details.html | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/snippets/user_details.html b/snippets/user_details.html index 3268dec..ad0bf2d 100644 --- a/snippets/user_details.html +++ b/snippets/user_details.html @@ -151,27 +151,16 @@ Matériel Opération Quantité - Total {{#foreach from=$def_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 $direction == 'output' && $type_mvt == 'définitif'}} - {{:assign var="reste.%s"|args:$eqpmt_key value="%d+%d"|math:$total:$amount}} - {{/if}} - {{:assign var="total" from="reste.%s"|args:$eqpmt_key}} {{$date|date_short}} {{$eqpmt_name}} {{$op_label}} {{$amount}} - {{$total}} {{/foreach}} From ada11151929f4c5c94936c5e130de726810e2241 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Tue, 28 Oct 2025 15:33:55 +0100 Subject: [PATCH 18/33] =?UTF-8?q?Ajout=20historique=20pr=C3=AAts=20avec=20?= =?UTF-8?q?date=20retour?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _nav.html | 6 +++ global_history.html | 2 +- loan_history.html | 90 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 loan_history.html diff --git a/_nav.html b/_nav.html index 4e69986..8ea688e 100644 --- a/_nav.html +++ b/_nav.html @@ -29,6 +29,11 @@

  • Historique — {{$eqpmt}} ({{$category}})
  • {{/if}} + {{elseif $current == 'historique'}} + {{elseif $current == 'archives'}} {{if $subsubcurrent == 'historique'}} {{/if}} diff --git a/global_history.html b/global_history.html index 8f98f16..5eb69c1 100644 --- a/global_history.html +++ b/global_history.html @@ -6,7 +6,7 @@ {{:admin_header title="Historique des mouvements" custom_css="./style.css" current="module_equipment"}} -{{:include file="./_nav.html" current="historique"}} +{{:include file="./_nav.html" current="historique" subcurrent="tous"}} {{* récupérer la config des entrées/sorties *}} {{:include file="./_get_config.html" keep="config"}} diff --git a/loan_history.html b/loan_history.html new file mode 100644 index 0000000..8d5ab82 --- /dev/null +++ b/loan_history.html @@ -0,0 +1,90 @@ +{{* -*- brindille -*- *}} + +{{:admin_header title="Matériels hors de l'asso" custom_css="../style.css" current="module_equipment"}} +{{:include file="./_nav.html" current="historique" subcurrent="prêts"}} + +{{* lecture config (défaut ou enregistrée) *}} +{{:include file="./_get_config.html" keep="config"}} + +{{#foreach from=$config.output_nature key="key"}} + {{if $type == 'temporaire'}} + {{:assign var="output_types." value=$key|quote_sql}} + {{/if}} +{{/foreach}} +{{:assign output_ops=$output_types|implode:","}} +{{:assign output_ops="("|cat:$output_ops|cat:")"}} + +{{:assign premier=true}} +{{#select + users.nom AS nom, + users.id AS user, + json_extract(mat.document, '$.name') AS mat_name, + json_extract(mvt.document, '$.date') AS out_date, + json_extract(mvt.document, '$.amount') AS out_amount, + json_extract(mvt.document, '$.return_date') AS return_date, + json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(retour.document, '$.amount')), 0) AS remain + FROM module_data_equipment AS mvt + INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id + LEFT JOIN module_data_equipment AS links ON mvt.key = json_extract(links.document, '$.temp_key') + LEFT JOIN module_data_equipment AS retour ON retour.key = json_extract(links.document, '$.return') + INNER JOIN module_data_equipment AS mat ON mat.key = json_extract(mvt.document, '$.equipment') + WHERE + json_extract(mvt.document, '$.type') = 'movement' + AND + json_extract(mvt.document, '$.operation') IN !op + GROUP BY mvt.key + HAVING remain != 0 + ORDER BY out_date, nom + ; + !op = $output_ops +}} + {{if $premier}} + + + + + + + + + + + + + + + {{:assign premier=false}} + {{/if}} + + {{if $return_date != null}} + {{:assign ts_retour=$return_date|strtotime}} + {{:assign nb_jours="floor((%d-%d)/(60*60*24))"|math:$now:$ts_retour}} + {{/if}} + + + + + + + + + + +{{else}} +

    Aucun mouvement.

    +{{/select}} + +
    MatérielDate sortieQuantitéMembreDate retourReste à rendreRemarque
    {{$mat_name}}{{$out_date|date_short}}{{$out_amount}}{{:link href="/admin/users/details.php?id=%s"|args:$user label="%s"|args:$nom}}{{$return_date|date_short}}{{$remain}} + {{if $return_date != null}} + {{if $nb_jours > 0}} + {{:tag color="darkred" label="Retard %s jours"|args:$nb_jours}} + {{elseif $nb_jours < 0}} + {{:assign delai="abs(%d)"|math:$nb_jours}} + {{"Reste %s jours"|args:$delai}} + {{else}} + {{:tag color="darkgreen" label="À rendre aujourdh'ui"}} + {{/if}} + {{/if}} +
    + +{{:admin_footer}} From aee34623f4bdb9e02416d2bc5c4059248ed9813f Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Tue, 28 Oct 2025 15:35:04 +0100 Subject: [PATCH 19/33] =?UTF-8?q?Ajout=20date=20retour=20fiche=20membre=20?= =?UTF-8?q?et=20simplification=20affichage=20mat=C3=A9riels=20permanents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snippets/user_details.html | 41 ++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/snippets/user_details.html b/snippets/user_details.html index 3268dec..0908759 100644 --- a/snippets/user_details.html +++ b/snippets/user_details.html @@ -44,6 +44,7 @@ eqpmt.key as eqpmt_key, json_extract(eqpmt.document, '$.name') AS eqpmt_name, json_extract(mvt.document, '$.amount') AS qte, + json_extract(mvt.document, '$.return_date') AS return_date, json_extract(mvt.document, '$.operation') AS operation FROM {!$module.table} AS mvt INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id @@ -65,9 +66,17 @@ {{if $premier}} {{:assign premier=false}} {{:assign total=0}} + {{:assign nb_jours=0}} {{:assign old_eqpmt_key=$eqpmt_key}} {{:assign var="ligne.date" value=$date}} {{:assign var="ligne.materiel" value=$eqpmt_name}} + {{:assign var="ligne.return_date" value=$return_date}} + {{:assign var="ligne.retard" value="0"}} + {{if $return_date != null}} + {{:assign ts_retour=$return_date|strtotime}} + {{:assign nb_jours="floor((%d-%d)/(60*60*24))"|math:$now:$ts_retour}} + {{:assign var="ligne.retard" value=$nb_jours}} + {{/if}} {{/if}} {{if $eqpmt_key != $old_eqpmt_key}} @@ -76,9 +85,17 @@ {{:assign var="lignes." value=$ligne}} {{/if}} {{:assign total=0}} + {{:assign nb_jours=0}} {{:assign old_eqpmt_key=$eqpmt_key}} {{:assign var="ligne.date" value=$date}} {{:assign var="ligne.materiel" value=$eqpmt_name}} + {{:assign var="ligne.return_date" value=$return_date}} + {{:assign var="ligne.retard" value="0"}} + {{if $return_date != null}} + {{:assign ts_retour=$return_date|strtotime}} + {{:assign nb_jours="floor((%d-%d)/(60*60*24))"|math:$now:$ts_retour}} + {{:assign var="ligne.retard" value=$nb_jours}} + {{/if}} {{/if}} {{if $direction == "output"}} @@ -101,6 +118,8 @@ Date Matériel Quantité + Date de retour + Remarque @@ -109,6 +128,17 @@ {{$date|date_short}} {{$materiel}} {{$qte}} + {{$return_date|date_short}} + + {{if $retard < 0}} + {{:assign delai="abs(%d)"|math:$retard}} + {{"Reste %s jours"|args:$delai}} + {{elseif $retard >0 }} + {{:tag color="darkred" label="Retard %s jours"|args:$retard}} + {{else}} + {{:tag color="darkgreen" label="À rendre aujourdh'ui"}} + {{/if}} + {{/foreach}} @@ -151,27 +181,16 @@ Matériel Opération Quantité - Total {{#foreach from=$def_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 $direction == 'output' && $type_mvt == 'définitif'}} - {{:assign var="reste.%s"|args:$eqpmt_key value="%d+%d"|math:$total:$amount}} - {{/if}} - {{:assign var="total" from="reste.%s"|args:$eqpmt_key}} {{$date|date_short}} {{$eqpmt_name}} {{$op_label}} {{$amount}} - {{$total}} {{/foreach}} From c9345fd67f59ba72d7410fd1eba6c3efd2e30f7e Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Tue, 28 Oct 2025 16:11:44 +0100 Subject: [PATCH 20/33] =?UTF-8?q?Historique=20pr=C3=AAts=20:=20ajout=20bou?= =?UTF-8?q?ton=20retour?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- loan_history.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/loan_history.html b/loan_history.html index 8d5ab82..28a246c 100644 --- a/loan_history.html +++ b/loan_history.html @@ -18,6 +18,7 @@ {{#select users.nom AS nom, users.id AS user, + mvt.key AS mvt_key, json_extract(mat.document, '$.name') AS mat_name, json_extract(mvt.document, '$.date') AS out_date, json_extract(mvt.document, '$.amount') AS out_amount, @@ -79,7 +80,13 @@ {{/if}} {{/if}} - + + {{:linkbutton + label="Retour" + href="movements/output_return.html?key=%s&prop=1"|args:$mvt_key + shape="reset" + target="_dialog"}} + {{else}}

    Aucun mouvement.

    From 572dfc172a8c71079ac214d6eebd63da68f570c3 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Wed, 29 Oct 2025 14:20:58 +0100 Subject: [PATCH 21/33] =?UTF-8?q?Histo=20pr=C3=AAts=20:=20ajout=20bouton?= =?UTF-8?q?=20d=C3=A9tails=20+=20navigation=20+=20mutualisation=20js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- equipment_history.html | 4 +-- loan_history.html | 47 ++++++++++++++++++++++++--------- movements/copy_movement.html | 14 +++++++++- movements/delete_movement.html | 13 ++++++--- movements/modify_movement.html | 17 +++++++----- movements/movement_details.html | 6 ++--- movements/output_equipment.html | 8 +++--- scripts.js | 11 ++++++++ 8 files changed, 86 insertions(+), 34 deletions(-) diff --git a/equipment_history.html b/equipment_history.html index 9bb584d..f96010d 100644 --- a/equipment_history.html +++ b/equipment_history.html @@ -224,7 +224,7 @@ {{/if}} {{:linkbutton label="Détails" - href="movements/movement_details.html?key=%s&prop=%s"|args:$key:$_GET.prop + href="movements/movement_details.html?key=%s&prop=%s&from=eh"|args:$key:$_GET.prop shape="eye" }} {{/if}} @@ -314,7 +314,7 @@ {{/if}} {{:linkbutton label="Détails" - href="movements/movement_details.html?key=%s&prop=%s"|args:$key:$_GET.prop + href="movements/movement_details.html?key=%s&prop=%s&from=eh"|args:$key:$_GET.prop shape="eye" }} diff --git a/loan_history.html b/loan_history.html index 28a246c..42006aa 100644 --- a/loan_history.html +++ b/loan_history.html @@ -1,6 +1,21 @@ {{* -*- brindille -*- *}} {{:admin_header title="Matériels hors de l'asso" custom_css="../style.css" current="module_equipment"}} + +{{if $_GET.ok}} + {{if $_GET.msg == "modification"}} +

    Modification enregistrée

    + {{elseif $_GET.msg == "copie"}} +

    Mouvement copié

    + {{elseif $_GET.msg == "suppression"}} +

    Mouvement supprimé

    + {{/if}} +{{elseif $_GET.err}} + {{if $_GET.msg == "suppression"}} +

    Ce mouvement ne peut être supprimé

    + {{/if}} +{{/if}} + {{:include file="./_nav.html" current="historique" subcurrent="prêts"}} {{* lecture config (défaut ou enregistrée) *}} @@ -24,11 +39,11 @@ json_extract(mvt.document, '$.amount') AS out_amount, json_extract(mvt.document, '$.return_date') AS return_date, json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(retour.document, '$.amount')), 0) AS remain - FROM module_data_equipment AS mvt + FROM {!$module.table} AS mvt INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id - LEFT JOIN module_data_equipment AS links ON mvt.key = json_extract(links.document, '$.temp_key') - LEFT JOIN module_data_equipment AS retour ON retour.key = json_extract(links.document, '$.return') - INNER JOIN module_data_equipment AS mat ON mat.key = json_extract(mvt.document, '$.equipment') + LEFT JOIN {!$module.table} AS links ON mvt.key = json_extract(links.document, '$.temp_key') + LEFT JOIN {!$module.table} AS retour ON retour.key = json_extract(links.document, '$.return') + INNER JOIN {!$module.table} AS mat ON mat.key = json_extract(mvt.document, '$.equipment') WHERE json_extract(mvt.document, '$.type') = 'movement' AND @@ -70,14 +85,17 @@ {{$remain}} {{if $return_date != null}} - {{if $nb_jours > 0}} - {{:tag color="darkred" label="Retard %s jours"|args:$nb_jours}} - {{elseif $nb_jours < 0}} - {{:assign delai="abs(%d)"|math:$nb_jours}} - {{"Reste %s jours"|args:$delai}} - {{else}} - {{:tag color="darkgreen" label="À rendre aujourdh'ui"}} - {{/if}} + {{:assign jour="jour}} + {{if $nb_jours > 0}} + {{if $nb_jours > 1}}{{:assign jour="jours"}}{{/if}} + {{:tag color="darkred" label="Retard %s %s"|args:$nb_jours:$jour}} + {{elseif $nb_jours < 0}} + {{:assign delai="abs(%d)"|math:$nb_jours}} + {{if $nb_jours < -1}}{{:assign jour="jours"}}{{/if}} + {{"Reste %s %s"|args:$delai:$jour}} + {{else}} + {{:tag color="darkgreen" label="À rendre aujourdh'ui"}} + {{/if}} {{/if}} @@ -86,6 +104,11 @@ href="movements/output_return.html?key=%s&prop=1"|args:$mvt_key shape="reset" target="_dialog"}} + {{:linkbutton + label="Détails" + href="movements/movement_details.html?key=%s&prop=1&from=lh"|args:$mvt_key + shape="eye" + }} {{else}} diff --git a/movements/copy_movement.html b/movements/copy_movement.html index 29539ea..880b774 100644 --- a/movements/copy_movement.html +++ b/movements/copy_movement.html @@ -205,7 +205,12 @@ transactions=$transactions return_date=$return_date|parse_date }} - {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=copie"|args:$eqpmt_key:$prop}} + {{if $_GET.from == "lh"}} + {{:assign from="../loan_history.html"}} + {{else}} + {{:assign from="../equipment_history.html"}} + {{/if}} + {{:redirect force="%s?ok=1&key=%s&prop=%s&msg=copie"|args:$from:$eqpmt_key:$prop}} {{/form}} {{if $mvt_new.direction == "input"}} @@ -292,6 +297,7 @@ {{:input id="set_return_date" type="checkbox" value=1 name="set_return_date" label="Fixer une date de retour" help="Cocher pour fixer une date de retour" checked="%s"|args:$checked}}
    {{:input type="date" name="return_date" label="Date de retour" default=$return_date}} +
    {{/if}} @@ -311,7 +317,13 @@ function changeVisibility(evt, idcheck = 'f_set_return_date_1', fields = ['div_r toggleVisibility(idcheck, fields); } +function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration') +{ + setReturnDate(id_date, id_return_date, id_loan_duration); +} + (function () { document.getElementById('f_set_return_date_1').onclick = changeVisibility; + document.getElementById('f_date').onchange = changeReturnDate; })(); diff --git a/movements/delete_movement.html b/movements/delete_movement.html index aea6243..0561692 100644 --- a/movements/delete_movement.html +++ b/movements/delete_movement.html @@ -21,6 +21,11 @@ {{:include file="../_get_config.html" keep="config"}} {{#form on="delete"}} + {{if $_GET.from == "lh"}} + {{:assign from="../loan_history.html"}} + {{else}} + {{:assign from="../equipment_history.html"}} + {{/if}} {{* vérifier s'il est possible de supprimer le mouvement *}} {{if $mvt_suppr.direction == 'input'}} {{:assign var="type_operation" from="config.input_nature.%s.type"|args:$mvt_suppr.operation}} @@ -29,7 +34,7 @@ {{:assign link_key=$key}} {{/load}} {{if $link_key != null}} - {{:redirect force="../equipment_history.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}} + {{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}} {{/if}} {{else}} {{:assign dispo=0}} @@ -62,7 +67,7 @@ {{* problème ? *}} {{if $dispo < 0 || $nonprop < 0}} - {{:redirect force="../equipment_history.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}} + {{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}} {{/if}} {{/if}} {{/load}} @@ -83,7 +88,7 @@ {{:assign link_key=$key}} {{/load}} {{if $link_key != null}} - {{:redirect force="../equipment_history.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}} + {{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}} {{/if}} {{elseif $type_operation == 'retour'}} {{#load type="link" where="$$.return = :key" :key=$_GET.key}} @@ -148,7 +153,7 @@ out=$curr_eqpmt.out notowned=$curr_eqpmt.notowned }} - {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}} + {{:redirect force="%s?ok=1&key=%s&prop=%s&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}} {{else}} {{* supprimer le matériel *}} {{:delete key=$curr_eqpmt.key}} diff --git a/movements/modify_movement.html b/movements/modify_movement.html index 2139e4d..4f32141 100644 --- a/movements/modify_movement.html +++ b/movements/modify_movement.html @@ -222,7 +222,12 @@ transactions=$transactions return_date=$return_date|parse_date }} - {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=modification"|args:$eqpmt_key:$prop}} + {{if $_GET.from == "lh"}} + {{:assign from="../loan_history.html"}} + {{else}} + {{:assign from="../equipment_history.html"}} + {{/if}} + {{:redirect force="%s?ok=1&key=%s&prop=%s&msg=modification"|args:$from:$eqpmt_key:$prop}} {{/form}} {{if $mvt_new.direction == "input"}} @@ -231,8 +236,8 @@ {{:assign mvt_label="sortie"}} {{/if}} {{:admin_header title="Modifier une %s"|args:$mvt_label custom_css="./../style.css" current="module_equipment"}} -{{:form_errors}} +{{:form_errors}} {{* -------------------- Préparer la saisie -------------------- *}} @@ -338,11 +343,9 @@ function changeVisibility(evt, idcheck = 'f_set_return_date_1', fields = ['div_r toggleVisibility(idcheck, fields); } -function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration') { - const loan_duration = document.getElementById(id_loan_duration).value; - let nbsec = getDate(id_date) + loan_duration*24*60*60; - const date_retour = new Date(nbsec * 1000); - document.getElementById(id_return_date).value = date_retour.toLocaleDateString(); +function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration') +{ + setReturnDate(id_date, id_return_date, id_loan_duration); } (function () { diff --git a/movements/movement_details.html b/movements/movement_details.html index f25fca7..55eeb5a 100644 --- a/movements/movement_details.html +++ b/movements/movement_details.html @@ -42,18 +42,18 @@