{% set parametre = ParametreSite() %}
{% import "front/"~ app.request.server.get('APP_THEME') ~"/form/macro_form.html.twig" as forms %}
<section class="contact-footer text-center text-md-left">
<div class="container-fluid wrapper">
{% if bloc.form %}
{% if parametre.actiftitre == true %}
<div class="titre_site text-center">{{parametre.titre}}</div>
{% endif %}
{% if bloc.form.titre != '' or bloc.form.texte != '' %}
<div class="titre-content-contact">
{% if bloc.form.titre != '' %}
<h2>{{bloc.form.titre}}</h2>
{% endif %}
{% if bloc.form.texte != '' %}
<div class="texte-in-contact">{{bloc.form.texte|raw}}</div>
{% endif %}
</div>
{% endif %}
<form id="form-{{bloc.form.id}}" action="{{path('save_form')}}" method="post" class="needs-validation row gx-5 form-recap {{bloc.form.identifier}}" enctype="multipart/form-data" novalidate>
{% for message in app.flashes('success-form-' ~ bloc.form.id) %}
<div class="alert alert-success alert-form mx-auto">
{{ message|raw }}
</div>
{% endfor %}
{% for message in app.flashes('error-form-' ~ bloc.form.id) %}
<div class="alert alert-danger alert-form mx-auto">
{{ message|raw }}
</div>
{% endfor %}
{% set message = 'validation_form'|trans([],'variable') %}
<input type="hidden" value="{{bloc.form.id}}" name="IdForm">
<div class="row flex-column flex-md-row justify-content-center">
{% for item in bloc.form.data %}
{% set label = item.label|default(null)%}
{% set placeholder = item.placeholder|default(null) %}
{% if item.type == "header" %}
<div class="col-md-12">
<{{item.subtype}} class="{{item.className}}">{{item.label|replace({'<span>':'<span>','</span>':'</span>'})|raw}}</{{item.subtype}}>
</div>
{% elseif item.type == "text" or item.type == "textarea" %}
<div {% if item.classGlobal is defined %} class="pl-r {{item.classGlobal}} {{item.name == 'ctc_city'?'ctc_city':''}}" {% else %} class="col-form-item form-group {{ item.required == "true" ? 'required' : '' }} {{item.name == 'ctc_city'?'ctc_city':''}} " {% endif %}>
{{ forms.input(item.name,item.type,item.className,item.required,item.subtype,label,placeholder,item.maxlength|default(null)) }}
<div class="invalid-feedback">
{% if item.name == 'ctc_postcode' %}
{{'validation_code_postal'|trans([],'variable')}}
{% else %}
{{item.ErrorMessage|default(message)}}
{% endif %}
</div>
</div>
{% elseif item.type == "number" %}
<div {% if item.classGlobal is defined %} class="col-form-item form-group {{ item.classGlobal is defined ? item.classGlobal : '' }}" {% endif %}>
{{ forms.number(item.name,item.type,item.className,item.required,"number",label,placeholder,item.maxlength|default(null)) }}
<div class="invalid-feedback">
{{item.ErrorMessage|default(message)}}
</div>
</div>
{% elseif item.type == 'date' %}
<div class="col-form-item form-group {{ item.classGlobal is defined ? item.classGlobal : '' }}" >
{{ forms.input(item.name,placeholder,item.className,item.required,item.type,label) }}
<div class="invalid-feedback">
{{item.ErrorMessage|default(message)}}
</div>
</div>
{% elseif item.type == "select" %}
<div {% if item.classGlobal is defined %} class="col-form-item form-group {{item.classGlobal}}" {% else %} class="col-form-item form-group {{ item.required == "true" ? 'required' : '' }}" {% endif %}>
{{ forms.select(item.type,item.name,item.className,item.required,item.multiple,item.values,label,placeholder) }}
<div class="invalid-feedback">
{{item.ErrorMessage|default(message)}}
</div>
</div>
{# {% elseif item.type == "textarea" %}
<div {% if item.classGlobal is defined %} class="pl-r {{item.classGlobal}}" {% else %} class="col-sm-12" {% endif %}>
<div class="form-group {{ item.required == "true" ? 'required' : '' }}">
{{ forms.textarea(item.name,item.type,item.className,item.required,item.subtype,label,placeholder,item.rows) }}
<div class="invalid-feedback">
{{item.ErrorMessage|default(message)}}
</div>
</div>
</div> #}
{% elseif item.type == "file" %}
<div {% if item.classGlobal is defined %} class="col-md-6 col-lg-4 input-file {{item.classGlobal}}" {% else %} class="col-md-6 col-lg-4 text-left" {% endif %}>
<div class="form-group">
{{ forms.input(item.name,item.type,item.className,item.required,item.subtype,label,placeholder,item.maxlength|default(null)) }}
<div class="invalid-feedback">
{{item.ErrorMessage|default(message)}}
</div>
</div>
</div>
{% elseif item.type == "paragraph" %}
<div class="{% if item.classGlobal is defined %}{{item.classGlobal}}{% else %}col-md-12{% endif %}">
<p>{{item.label|unescape|raw}}</p>
</div>
{% endif %}
{% if parametre.typerecaptcha == 2 and parametre.clekey != null %}
{% if item.type == "checkbox-group" %}
<div class="{% if item.classGlobal is defined %}pl-r {{item.classGlobal}}{% else %}col-md-12{% endif %}">
{% if label %}<label>{{label}}</label>{% endif %}
<div class="form-group {{ item.required == "true" ? 'required' : '' }} {% if item.inline is defined and item.inline == "true" %}d-flex{% endif %}">
{{ forms.checkbox(item.required,item.name,item.values) }}
</div>
</div>
{% endif %}
{% endif %}
{% endfor %}
{% if parametre.typerecaptcha == 2 and parametre.clekey != null %}
<div class="col-md-12 form-group text-center">
<div class="g-recaptcha" id="{{bloc.form.id}}_captcha" data-sitekey="{{parametre.clekey}}"></div>
</div>
{% endif %}
{% for item in bloc.form.data %}
{% set label = item.label|default(null)%}
{% set placeholder = item.placeholder|default(null) %}
{% if item.type == "button" %}
<div {% if item.classGlobal is defined %} class="pl-r {{item.classGlobal}}" {% else %} class="col-form-item form-group button-submit" {% endif %}>
<button class="{{item.className}}" type="{{item.subtype}}">{{item.label}}</button>
</div>
{% endif %}
{% if parametre.typerecaptcha == 1 and parametre.clekey != null %}
{% if item.type == "checkbox-group" %}
<div class="{% if item.classGlobal is defined %}pl-r {{item.classGlobal}}{% else %}col-md-12{% endif %}">
{% if label %}<label>{{label}}</label>{% endif %}
<div class="form-group {{ item.required == "true" ? 'required' : '' }} {% if item.inline is defined and item.inline == "true" %}d-flex{% endif %}">
{{ forms.checkbox(item.required,item.name,item.values) }}
</div>
</div>
{% endif %}
{% endif %}
{% endfor %}
</div>
{% if parametre.typerecaptcha == 1 %}
<input type="hidden" id="{{bloc.form.id}}_captcha" name="g-recaptcha-response" value="">
{% endif %}
</form>
{% endif %}
</div>
</section>