Gestion ajout matériel non répertorié
This commit is contained in:
parent
41dad67b1b
commit
dd25ba702f
@ -11,35 +11,57 @@
|
||||
{{:assign var='types_entrees.' value='Récupération'}}
|
||||
{{:assign var='types_entrees.' value='Location / Prêt'}}
|
||||
|
||||
{{:assign maintenant=$now|date_short}}
|
||||
|
||||
{{* lister les catégories disponibles *}}
|
||||
{{#load type="category" assign="category"}} {{* order="$$.name" debug *}}
|
||||
{{:assign var="categories." value=$category.name}}
|
||||
{{* Traiter l'envoi du formulaire *}}
|
||||
{{#form on="save"}}
|
||||
{{* récupérer les infos de la catégorie *}}
|
||||
{{#load type="category" key=$_POST.category assign="category"}}
|
||||
{{/load}}
|
||||
|
||||
{{* TODO Traiter l'envoi du formulaire *}}
|
||||
{{#form on="save"}}
|
||||
{{:assign key=""|uuid}}
|
||||
{{* enregistrer un nouveau matériel *}}
|
||||
{{:assign equipment_key=""|uuid}}
|
||||
{{:save
|
||||
key=$key
|
||||
validate_schema="./category.schema.json"
|
||||
type="category"
|
||||
name=$_POST.name|trim
|
||||
key=$equipment_key
|
||||
validate_schema="/%s/equipment.schema.json"|args:$module.name
|
||||
type="equipment"
|
||||
category=$category.key
|
||||
designation=$_POST.designation|trim
|
||||
}}
|
||||
{{:redirect to="./index.html?ok=1"}}
|
||||
{{/form}}
|
||||
{{* /TODO *}}
|
||||
|
||||
{{* 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 disponibles *}}
|
||||
{{#load type="category" assign="category" order="$$.name"}}
|
||||
{{* :assign var="categories.%d"|args:$category.id value=$category.name *}}
|
||||
{{:assign var="categories.%s"|args:$category.key value=$category.name}}
|
||||
{{/load}}
|
||||
|
||||
{{* formulaire d'ajout de matériel *}}
|
||||
<form method="post" action="{{$_GET.caller}}">
|
||||
|
||||
<form method="post" action=""> {{* action="{{$_GET.caller}}">*}}
|
||||
|
||||
<fieldset class="entree">
|
||||
<legend>Ajouter une entrée d'un matériel non répertorié</legend>
|
||||
{{:input type="select" name="type_materiel" label="Type" required=true options=$types_entrees}}
|
||||
{{:input type="date" name="date" label="Date" required=true default=$maintenant}}
|
||||
{{: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>
|
||||
|
@ -13,31 +13,31 @@
|
||||
},
|
||||
"inputNature": {
|
||||
"description": "Nature de l'entrée",
|
||||
"type": "string",
|
||||
"type": ["null", "string"],
|
||||
"enum": ["Achat", "Don", "Récupération", "Location / Prêt"]
|
||||
},
|
||||
"outputNature": {
|
||||
"description": "Nature de la sortie",
|
||||
"type": "string",
|
||||
"type": ["null", "string"],
|
||||
"enum": ["Vente", "Don", "Besoin", "Autre (perte, vol, ...)", "Location / Prêt"]
|
||||
},
|
||||
"amount": {
|
||||
"description": "Quantité ajoutée ou retirée",
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
}
|
||||
},
|
||||
"equipment": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"date" : {
|
||||
"description": "Date de l'opération",
|
||||
"type": "string",
|
||||
"format": "datetime"
|
||||
}
|
||||
"format": "date"
|
||||
},
|
||||
"comment": {
|
||||
"description": "Commentaire additionnel",
|
||||
"type": "string"
|
||||
"type": ["null", "string"]
|
||||
}
|
||||
},
|
||||
"required": ["type", "direction", "inputNature", "outputNature", "amount", "equipment", "date", "comment"]
|
||||
"required": ["type", "direction", "amount", "equipment", "date", "comment"]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user