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