Gestion ajout matériels répertoriés
This commit is contained in:
parent
dd25ba702f
commit
f84753ca1e
|
@ -11,8 +11,8 @@
|
|||
<form method="post" action="">
|
||||
<fieldset class="entree">
|
||||
<legend>Ajouter une entrée pour du </legend>
|
||||
{{:linkbutton label="Matériel répertorié" shape="plus" href="repertorie.html?caller=%s"|args:$request_url"}}
|
||||
{{:linkbutton label="Matériel non répertorié" shape="plus" href="non_repertorie.html?caller=%s"|args:$request_url}}
|
||||
{{:linkbutton label="Matériel répertorié" shape="plus" href="repertorie.html"}}
|
||||
{{:linkbutton label="Matériel non répertorié" shape="plus" href="non_repertorie.html}}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
|
||||
{{* formulaire d'ajout de matériel *}}
|
||||
|
||||
<form method="post" action=""> {{* action="{{$_GET.caller}}">*}}
|
||||
<form method="post" action="">
|
||||
|
||||
<fieldset class="entree">
|
||||
<legend>Ajouter une entrée d'un matériel non répertorié</legend>
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
{{#restrict section="config" level="admin" block=true}}{{/restrict}}
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="/%s/_nav.html"|args:$module.name current="entrees"}}
|
||||
|
||||
{{* types d'entrées *}}
|
||||
{{* TODO : stocker dans la configuration du module *}}
|
||||
{{:assign var='types_entrees.' value='Achat'}}
|
||||
{{:assign var='types_entrees.' value='Don'}}
|
||||
{{:assign var='types_entrees.' value='Récupération'}}
|
||||
{{:assign var='types_entrees.' value='Location / Prêt'}}
|
||||
|
||||
{{* Traiter l'envoi du formulaire *}}
|
||||
{{#form on="save"}}
|
||||
{{* récupérer les infos du matériel *}}
|
||||
{{#load type="equipment" key=$_POST.equipment assign="equipment"}}
|
||||
{{/load}}
|
||||
|
||||
{{* Enregistrer le mouvement *}}
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:assign var="operation" from="types_entrees.%d|args:$_POST.type_operation}}
|
||||
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="/%s/mouvements/movement.schema.json"|args:$module.name
|
||||
type="movement"
|
||||
direction="entrée"
|
||||
inputNature=$operation
|
||||
amount=$_POST.quantite|intval
|
||||
equipment=$equipment.key
|
||||
date=$_POST.date|parse_date
|
||||
comment=$_POST.remarques|trim
|
||||
}}
|
||||
|
||||
{{:redirect to="index.html?ok=1"}}
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
{{/form}}
|
||||
|
||||
{{* lister les catégories et matériels associés *}}
|
||||
{{#load type="category" assign="category" order="$$.name"}}
|
||||
{{:assign nom_cat=$category.name}}
|
||||
{{#load type="equipment" where="$$.category = :key" :key=$category.key assign="equipment"}}
|
||||
{{:assign var="equipments.%s.%s"|args:$nom_cat:$equipment.key value=$equipment.designation}}
|
||||
{{/load}}
|
||||
{{/load}}
|
||||
|
||||
{{* formulaire d'ajout de matériel *}}
|
||||
|
||||
<form method="post" action="">
|
||||
|
||||
<fieldset class="entree">
|
||||
<legend>Ajouter une entrée d'un matériel répertorié</legend>
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$types_entrees}}
|
||||
{{:input type="date" name="date" label="Date" required=true default=$now|date_short}}
|
||||
{{:input type="number" name="quantite" label="Quantité" required=true default=1}}
|
||||
|
||||
<fieldset>
|
||||
<legend>Matériel</legend>
|
||||
{{:input type="select_groups" name="equipment" label="Matériel" required=true options=$equipments}}
|
||||
{{:input type="textarea" name="remarques" label="Remarques" cols="40", rows="3" required=false}}
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
||||
{{:button type="submit" name="cancel" label="Annuler" shape="delete" class="main"}}
|
||||
</p>
|
||||
|
||||
</form>
|
||||
{{:admin_footer}}
|
Loading…
Reference in New Issue