{{#restrict section="config" level="admin" block=true}}{{/restrict}} {{:admin_header title="Configuration" current="module_equipment"}} {{* barre de navigation *}} {{:include file="/%s/_nav.html"|args:$module.name current="config"}} {{if $_GET.ok}}

Configuration enregistrée.

{{/if}} {{* Traiter l'envoi du formulaire *}} {{#form on="save"}} {{#foreach from=$_POST.input_fields|array_transpose item="field"}} {{:assign var="input_fields." label=$field.label|trim owner=$field.owner|boolval}} {{/foreach}} {{:save key="config" validate_schema="./config.schema.json" inputNature=$input_fields outputNature=$_POST.output_fields }} {{:redirect to="./config.html?ok=1"}} {{/form}} {{* types d'entrées par défaut *}} {{:assign var='types_entrees.Achat' value=1}} {{:assign var='types_entrees.Don' value=1}} {{:assign var='types_entrees.Récupération' value=1}} {{:assign var='types_entrees.Location' value=0}} {{:assign var='types_entrees.Emprunt' value=0}} {{* types de sorties par défaut *}} {{:assign var='types_sorties.' value='Vente'}} {{:assign var='types_sorties.' value='Don'}} {{:assign var='types_sorties.' value='Location'}} {{:assign var='types_sorties.' value='Prêt'}}
Entrées {{#foreach from=$module.config.inputNature item="input_field"}} {{else}} {{#foreach from=$types_entrees key="label" item="value"}} {{/foreach}} {{/foreach}}
Type d'entrée Propriétaire ?
Cocher si l'association devient propriétaire du matériel
Action
{{:input type="text" name="input_fields[label][]" default=$input_field.label}} {{:button label="Retirer" shape="minus" onclick="this.parentNode.parentNode.remove();"}}
{{:input type="text" name="input_fields[label][]" default=$label}} {{:button label="Retirer" shape="minus" onclick="this.parentNode.parentNode.remove();"}}

{{:button shape="plus" label="Ajouter un champ" onclick="addLine('#input_body')"}}

Sorties {{#foreach from=$module.config.outputNature item="output_field"}} {{else}} {{#foreach from=$types_sorties item="value"}} {{/foreach}} {{/foreach}}
Type de sortie Action
{{:input type="text" name="output_fields[]" default=$output_field.label}} {{:button label="Retirer" shape="minus" onclick="this.parentNode.parentNode.remove();"}}
{{:input type="text" name="output_fields[]" default=$value}} {{:button label="Retirer" shape="minus" onclick="this.parentNode.parentNode.remove();"}}

{{:button shape="plus" label="Ajouter un champ" onclick="addLine('#output_body')"}}

{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main" onclick="return desactiverCache('#input_body');" }}

{{:admin_footer}}