2024-11-08 19:49:23 +01:00
|
|
|
{{* -*- 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">
|
2024-11-11 14:23:58 +01:00
|
|
|
<legend>Ajouter une entrée de matériel</legend>
|
2024-11-08 19:49:23 +01:00
|
|
|
<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="text" name="equipment" label="Matériel" required=true disabled=true default=$equipment.designation}}
|
2024-11-12 16:54:56 +01:00
|
|
|
{{:input type="text" name="category" label="Catégorie" required=true disabled=true default=$category.name}}
|
2024-11-11 14:23:58 +01:00
|
|
|
{{:input type="number" name="quantite" label="Quantité" required=true min=1 default=1}}
|
2024-11-08 19:49:23 +01:00
|
|
|
{{: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}}
|