ajout entrée sur page inventaire

This commit is contained in:
Jean-Christophe Engel 2024-11-08 19:49:23 +01:00
parent 34f3328f12
commit 528120d3a0
2 changed files with 94 additions and 4 deletions

View File

@ -43,11 +43,11 @@
{{/if}}
{{if $present}}
{{if $print_cat_name}}
{{*if $print_cat_name*}}
<details class="inventaire" open="open">
<summary>
<h3>{{$cat_elem.name}}</h3>
{{/if}}
{{*/if*}}
</summary>
<table class="list">
@ -79,6 +79,11 @@
<td>{{$exterieur}}</td>
<td>{{$dispo}}</td>
<td class="actions">
{{:linkbutton
label="Ajouter entrée"
shape="plus"
href="mouvements/entrees/repertorie.html?key=%s"|args:$eqpmt_key
target="_dialog"}}
{{:linkbutton
label="Mouvements"
href="%shistorique.html?key=%s&prop=1"|args:$module.url:$eqpmt_key
@ -125,11 +130,11 @@
{{/if}}
{{if $present}}
{{if $print_cat_name}}
{{*if $print_cat_name*}}
<details class="inventaire" open="open">
<summary>
<h3>{{$cat_elem.name}}</h3>
{{/if}}
{{*/if*}}
</summary>
<table class="list">
@ -151,6 +156,11 @@
<td>{{$eqpmt.designation}}</td>
<td>{{$eqpmt.nonproprio}}</td>
<td class="actions">
{{:linkbutton
label="Ajouter entrée"
shape="plus"
href="mouvements/entrees/repertorie.html?key=%s"|args:$eqpmt_key
target="_dialog"}}
{{:linkbutton
label="Mouvements"
href="historique.html?key=%s"|args:$eqpmt_key

View File

@ -0,0 +1,80 @@
{{* -*- brindille -*- *}}
{{*
Ajouter une entrée de matériel
paramètres :
- key : clé du matériel à ajouter
*}}
{{:admin_header title="Entrée de matériel" current="module_equipment"}}
{{* barre de navigation *}}
{{if ! $dialog}}
{{:include file="../../_nav.html" current="entrees"}}
{{/if}}
{{* récupérer la config des entrées/sorties *}}
{{:include file="../../_get_config.html" keep="config"}}
{{* types d'entrées *}}
{{#foreach from=$config.input_nature key="label" item="type"}}
{{if $type != 'retour'}}
{{:assign var='input_labels.' value="%s"|args:$label}}
{{/if}}
{{/foreach}}
{{* récupérer les informations du matériel et de sa catégorie *}}
{{#load key=$_GET.key assign="equipment"}}
{{/load}}
{{#load where="key = :key" :key=$equipment.category assign="category"}}
{{/load}}
{{*:debug equipment=$equipment category=$category*}}
{{* Traiter l'envoi du formulaire *}}
{{#form on="save"}}
{{* Enregistrer le mouvement *}}
{{:assign mvt_key=""|uuid}}
{{:assign var="operation" from="input_labels.%d|args:$_POST.type_operation}}
{{:save
key=$mvt_key
validate_schema="../movement.schema.json"
type="movement"
direction="input"
input_nature=$operation
amount=$_POST.quantite|intval
equipment=$equipment.key
date=$_POST.date|parse_date
comment=$_POST.remarques|trim
}}
{{:redirect force="%sindex.html?ok=1&msg=entrée"|args:$module.url}}
{{else}}
{{:form_errors}}
{{/form}}
{{* formulaire de saisie d'une entrée de matériel *}}
<form method="post" action="">
<fieldset class="entree">
<legend>Ajouter une entrée d'un matériel</legend>
<dl>
{{:input type="select" name="type_operation" label="Type" required=true options=$input_labels}}
{{:input type="date" name="date" label="Date" required=true default=$now|date_short}}
{{:input type="number" name="quantite" label="Quantité" required=true default=1}}
</dl>
</fieldset>
<fieldset>
<legend>Matériel</legend>
<dl>
{{:input type="text" name="category" label="Catégorie" required=true disabled=true default=$category.name}}
{{:input type="text" name="equipment" label="Matériel" required=true disabled=true default=$equipment.designation}}
{{:input type="textarea" name="remarques" label="Remarques" cols="40" rows="3" required=false}}
</dl>
</fieldset>
<p class="submit">
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
</p>
</form>
{{:admin_footer}}