{{* -*- brindille -*- *}} {{:admin_header title="Gestion des matériels" current="module_equipment"}} {{* barre de navigation *}} {{if ! $dialog}} {{:include file="../_nav.html" current="config" subcurrent="typesES"}} {{/if}} {{* Traiter l'envoi du formulaire *}} {{* lecture config (défaut ou enregistrée) *}} {{:include file="../_get_config.html" keep="config"}} {{#form on="save"}} {{* vérifier l'existence d'une entrée de même nom et générer le résultat *}} {{#foreach from=$config.input_nature key="label" item="type"}} {{if $label|trim|tolower == $_POST.input_fields.label|trim|tolower}} {{:error message="Ce libellé d'entrée est déjà présent"}} {{/if}} {{:assign var="input_nature.label" value=$label}} {{:assign var="input_nature.type" value=$type}} {{:assign var="input_natures." from=input_nature}} {{/foreach}} {{* ajouter la nouvelle entrée *}} {{if $_GET.dir == 'input'}} {{:assign input_label=$_POST.input_fields.label|trim|tolower|ucfirst}} {{:assign var="input_nature.label" value=$_POST.input_fields.label|trim|tolower|ucfirst}} {{:assign var="input_nature.type" value=$_POST.input_fields.type}} {{:assign var="input_natures." from=input_nature}} {{/if}} {{* vérifier l'existence d'une sortie de même nom et générer le résultat *}} {{#foreach from=$config.output_nature key="label" item="type"}} {{if $label|trim|tolower == $_POST.output_fields.label|trim|tolower}} {{:error message="Ce libellé de sortie est déjà présent"}} {{/if}} {{:assign var="output_nature.label" value=$label}} {{:assign var="output_nature.type" value=$type}} {{:assign var="output_natures." from=output_nature}} {{/foreach}} {{* ajouter la nouvelle sortie *}} {{if $_GET.dir == 'output'}} {{:assign output_label=$_POST.output_fields.label|trim|tolower|ucfirst}} {{:assign var="output_nature.label" value=$_POST.output_fields.label|trim|tolower|ucfirst}} {{:assign var="output_nature.type" value=$_POST.output_fields.type}} {{:assign var="output_natures." from=output_nature}} {{/if}} {{:save key="config" validate_schema="../config.schema.json" input_nature=$input_natures output_nature=$output_natures }} {{:redirect to="./config.html?ok=1"}} {{else}} {{:form_errors}} {{/form}} {{if $_GET.dir == 'input'}} {{* types d'entrées *}} {{#foreach from=$config.input_nature key="label" item="type"}} {{:assign var='input_types.%s'|args:$type value=$type}} {{/foreach}}
{{else}} {{* types de sorties *}} {{#foreach from=$config.output_nature key="label" item="type"}} {{:assign var='output_types.%s'|args:$type value=$type}} {{/foreach}} {{/if}}