Simplification opérations catégories

This commit is contained in:
Jean-Christophe Engel 2025-10-08 14:41:31 +02:00
parent b2d6254a0c
commit a0293c3e92
2 changed files with 5 additions and 3 deletions

View file

@ -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*}}

View file

@ -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}}
<tr>
<th>{{$name}}</th>
<td class="actions">
{{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"}}
</td>
</tr>
{{else}}