templates/front/theme1/form/contact_form.html.twig line 1

Open in your IDE?
  1. {% import "front/"~ app.request.server.get('APP_THEME') ~"/form/macro_form.html.twig" as forms %}
    {% set parametre = ParametreSite() %}
    {{ render(controller('App\\Controller\\Front\\FunctionController::renderContacts')) }}
    
    <section class="contact_form text-center">
    <div class="container-fluid wrapper">
                {% if bloc.form %}
                    {% 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 %}
                {% endif %}
    
        {% set espace_client = 1 %} 
    
        {% if not espace_client and parametreProduits() and parametreProduits().actifpanier and app.session.get('panier') %}
            {{ render(controller('App\\Controller\\Front\\CartController::panierContact', {'panier': app.session.get('panier')})) }}
        {% endif %}
    
        <div class="row justify-content-center">  
    
            {% if bloc.form %}
            <div class="col-md-8">
                <form id="form-{{bloc.form.id}}" action="{{path('save_form')}}" method="post" class="needs-validation row  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 %}
    
                    {% if product_interesse is defined and product_interesse is not empty %}
                          <h2>Je suis intéressé par : {{product_interesse.titre}}</h2>
                          <input type="hidden" value="{{product_interesse.id}}" name="id_product">
                    {% endif %}
                    
                    
                    {% set message = 'validation_form'|trans([],'variable') %}
                    <input type="hidden" value="{{bloc.form.id}}" name="IdForm">
                    
                    <div class="contact-border">
                        <div class="icon-header"></div>
                        <div class="row">
                            {% 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="header-title">{{label|raw}}</{{item.subtype}}>
                                    </div>
    
                                {% elseif item.type == "text" %}
                                    <div {% if item.classGlobal is defined %} class="col-md-6 col-lg-4 {{item.classGlobal}} {{item.name == 'ctc_city'?'ctc_city':''}}" {% else %} class="col-md-6 col-lg-4 {{item.name == 'ctc_city'?'ctc_city':''}}" {% 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">
                                                {% if item.name == 'ctc_postcode' %}
                                                    {{'validation_code_postal'|trans([],'variable')}}
                                                {% else %}
                                                    {{item.ErrorMessage|default(message)}}
                                                {% endif %}
                                            </div>
                                        </div>
                                    </div>
        
                                {% elseif item.type == "number" %}
                                    <div {% if item.classGlobal is defined %} class="{{item.classGlobal}}" {% else %} class="col-md-6 col-lg-4" {% endif %}>
                                        <div class="form-group">
                                            {{ 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>
                                    </div>
    
                                {% elseif item.type == "select" %}
                                    <div {% if item.classGlobal is defined %} class="col-sm-12 {{item.classGlobal}}" {% else %} class="col-sm-12" {% endif %}>
                                        <div class="form-group">
                                            {{ 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>
                                    </div>
                                
                                {% elseif item.type == "radio-group" %}
                                    <div class="{% if item.classGlobal is defined %}{{item.classGlobal}}{% else %}col-sm-12{% endif %}">
                                        <div class="form-group {{ item.required == "true" ? 'required' : '' }} {% if item.inline is defined and item.inline == "true" %}d-flex{% endif %}">
                                            {% if item.label %}<label class="required">{{item.label}} : </label>{% endif %}
                                            <div class="radio-group">
                                                {% for key,value in item.values %}
                                                    <div class="radio-item">
                                                    <input type="radio" name="{{item.name}}" id="{{item.name}}-{{key}}" value="{{value.value}}" {% if value.selected is defined and value.selected %}checked{% endif %}><label for="{{item.name}}-{{value.value}}">{{value.label}}</label>
                                                    </div>
                                                {% endfor %}
                                            </div>
                                        </div>
                                    </div>
    
    
                                {% elseif item.type == 'date' %}
                                <div class="date-form col-md-12 {{ 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 == "textarea" %}
                                    <div {% if item.classGlobal is defined %} class="{{item.classGlobal}}" {% else %} class="col-sm-12" {% endif %}>
                                        <div class="form-group">
                                            {% if item.label is defined and item.label is not empty %}
                                                <label class="label-control">{{item.label}}</label>
                                            {% endif %}
                                            <textarea name="{{item.name}}" class="{{item.className|default('')}}" required="{{item.required|default('false')}}" rows="{{item.rows|default('6')}}" placeholder="{{item.placeholder|default('')}}"></textarea>
                                            <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 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 == "button" and item.subtype != "submit" %}
                                     {# <div {% if item.classGlobal is defined %} class="{{item.classGlobal}}" {% else %} class="col-sm-12" {% endif %}>
                                        <div class="form-group">
                                            {{ forms.button(item.name,item.type,item.subtype,item.className,item.label) }}
                                        </div>
                                    </div>  #}
                                {% elseif item.type == "checkbox-group" %}
                                    <div class="{% if item.classGlobal is defined %}{{item.classGlobal}}{% else %}col-sm-12 d-flex justify-content-center{% endif %}">
                                        {% if label %}<label>{{label}}</label>{% endif %}
                                        <div class="form-group  {% if item.inline is defined and item.inline == "true" %}d-flex{% endif %}">
                                            {{ forms.checkbox(item.required,item.name,item.values) }}
                                        </div>
                                    </div>
                                {% elseif item.type == "paragraph" %}
                                    <div class="{% if item.classGlobal is defined %}{{item.classGlobal}}{% else %}col-sm-12{% endif %}">
                                        <p>{{item.label|unescape|raw}}</p>
                                    </div>
                                {% 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 %}
                                {% if item.type == "button" and item.subtype == "submit" %}
                                    <div class="col-sm-12 d-flex justify-content-center">
                                        <div class="form-group button-submit">
                                            <button class="btn btn-cms" type="submit">{{item.label }}</button>
                                        </div>
                                    </div>
                                {% endif %}
                            {% endfor %}
    
                        </div>
                    </div>
    
                    {% if parametre.typerecaptcha == 1 %}
                        <input type="hidden" id="{{bloc.form.id}}_captcha" name="g-recaptcha-response" value="">
                    {% endif %}
    
                </form>
                </div>
                
            {% endif %}
       
            </div>
        </div>
    </section>
    <script>
    const filesInput = document.querySelectorAll('input[type="file"]');
    if(filesInput){
        filesInput.forEach(function(fileInput) {
            fileInput.setAttribute('accept', '.pdf,.doc,.docx,.txt,.jpg,.jpeg,.png');
        });
    }
    </script>
    
    {{ render(controller('App\\Controller\\Front\\FunctionController::renderHorairesPageContact')) }}
    {{ render(controller('App\\Controller\\Front\\FunctionController::renderMapContact')) }}