From a0293c3e921e4a409308f575c795a13937433bd2 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Wed, 8 Oct 2025 14:41:31 +0200 Subject: [PATCH] =?UTF-8?q?Simplification=20op=C3=A9rations=20cat=C3=A9gor?= =?UTF-8?q?ies?= 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}}