2023-10-12 14:55:05 +02:00
|
|
|
{{#restrict section="config" level="admin" block=true}}{{/restrict}}
|
2023-10-10 10:59:46 +02:00
|
|
|
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
|
|
|
|
|
|
|
{{* barre de navigation *}}
|
2023-10-12 14:55:05 +02:00
|
|
|
{{:include file="/%s/_nav.html"|args:$module.name current="categories"}}
|
|
|
|
|
|
|
|
{{if $_GET.ok}}
|
|
|
|
<p class="block confirm">Catégorie enregistrée.</p>
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
{{* afficher les catégories déjà enregistrées *}}
|
|
|
|
<section class="categories">
|
|
|
|
{{#list select="$$.name AS 'Catégorie'; $$.id AS 'Id'; $$.type AS 'Type'; $$.key AS 'Clé'" order="1" where="$$.type = 'category'"}}
|
|
|
|
<tr>
|
|
|
|
<th>{{$name}}</th>
|
|
|
|
<td>{{$id}}</td>
|
|
|
|
<td>{{$type}}
|
|
|
|
<td>{{$key}}</td>
|
|
|
|
<td class="actions">
|
2023-10-16 11:54:00 +02:00
|
|
|
{{:linkbutton label="Supprimer" href="delete_category.html?id=%s"|args:$key shape="delete" target="_dialog"}}
|
2023-10-12 14:55:05 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{{else}}
|
|
|
|
<p class="block alert">Il n'y a aucune catégorie : vous devez en ajouter.</p>
|
|
|
|
{{/list}}
|
|
|
|
</section>
|
|
|
|
|
|
|
|
{{* Traiter l'envoi du formulaire *}}
|
|
|
|
{{#form on="save"}}
|
|
|
|
{{:assign key=""|uuid}}
|
|
|
|
{{:save
|
|
|
|
key=$key
|
|
|
|
validate_schema="./category.schema.json"
|
|
|
|
type="category"
|
|
|
|
name=$_POST.name|trim
|
|
|
|
}}
|
|
|
|
{{:redirect to="./index.html?ok=1"}}
|
|
|
|
{{/form}}
|
|
|
|
|
|
|
|
{{:form_errors}}
|
|
|
|
|
|
|
|
{{* formulaire d'ajout de catégorie *}}
|
|
|
|
<form method="post" action="{{$self_url}}">
|
|
|
|
<fieldset class="ajout_categorie">
|
|
|
|
<legend>Ajouter une catégorie</legend>
|
|
|
|
<dl>
|
|
|
|
{{:input type="text" name="name" label="Nom" required=true maxlength="100"}}
|
|
|
|
</dl>
|
|
|
|
<p class="submit">
|
|
|
|
{{:button type="submit" name="save" label="Ajouter" shape="right" class="main"}}
|
|
|
|
</p>
|
|
|
|
</fieldset>
|
|
|
|
</form>
|
2023-10-10 10:59:46 +02:00
|
|
|
|
|
|
|
{{:admin_footer}}
|