{{#restrict section="users" level=$module.config.manage_access|or:'admin'}} {{else}} {{#restrict section="config" level="admin" block=true}} {{/restrict}} {{/restrict}} {{:admin_header title="Configuration d'un événement" current="module_bookings"}} {{if $_GET.id}} {{#load key=$_GET.id type="event" assign="event"}} {{:assign key=$key}} {{else}} {{:error message="Événément introuvable"}} {{/load}} {{elseif $_GET.copy}} {{#load key=$_GET.copy type="event" assign="event"}} {{/load}} {{:assign key=""|uuid}} {{else}} {{:assign key=""|uuid}} {{/if}} {{:include file="../_nav.html" current="config" event=null}} {{:assign var="types" checkbox="Case à cocher" boolean="Sélecteur booléen (oui/non)" date="Date" datetime="Date et heure" number="Nombre" tel="Numéro de téléphone" text="Texte" textarea="Texte multi-lignes" }} {{#form on="save"}} {{#foreach from=$_POST.fields|array_transpose item="field"}} {{if !$field.label|trim || !$field.type}} {{:continue}} {{/if}} {{if !$types|keys|has:$field.type}} {{:error message="Type inconnu: %s"|args:$field.type}} {{/if}} {{:assign var="fields." required=$field.required|boolval type=$field.type label=$field.label help=$field.help|or:null}} {{/foreach}} {{if $_POST.notify_email|trim !== '' && !$_POST.notify_email|check_email}} {{:error message="Adresse e-mail de notification invalide : %s"|args:$_POST.notify_email}} {{/if}} {{:save key=$key validate_schema="../event.schema.json" type="event" label=$_POST.label|trim description=$_POST.description|trim|or:null max_weeks=$_POST.max_weeks|intval|or:1 use_closings=$_POST.use_closings|boolval use_openings=$_POST.use_openings|boolval openings_seats=$_POST.openings_seats|intval|or:null openings_slots=$_POST.openings_slots|intval|or:null openings_delay=$_POST.openings_delay|intval|or:null email=$_POST.email|boolval archived=$_POST.archived|boolval fields=$fields|arrayval notify_email=$_POST.notify_email|strval|or:null not_open_before=$_POST.not_open_before|parse_datetime:"LOCAL"|or:null not_open_after=$_POST.not_open_after|parse_datetime:"LOCAL"|or:null }} {{if $_GET.copy}} {{#load type="slot" event=$event.key}} {{:save key="uuid" validate_schema="../slot.schema.json" type="slot" event=$.key frequency=$frequency day=$day date=$date open=$open seats=$seats }} {{/load}} {{/if}} {{:redirect to="./?ok=1"}} } {{/form}} {{:form_errors}}
{{:admin_footer}}