{% extends 'user/profile/profile_layout.html.twig' %}
{% use "user/profile/section_sidebar.html.twig" with javascript as javascript_sidebar, content as section_sidebar %}
{% from "form/inputs.twig.html" import text_field, date_picker, dropdownlist, radio_group, check_box, textarea %}
{% if app.user is not empty and
constant('App\\Entity\\Role::USER') in app.user.getSubRoleNames()
%}
{% set mode = 'EDIT' %}
{% else %}
{% set mode = 'NEW' %}
{% endif %}
{% block step %}
<form autocomplete="off"
name="form-apply" id="form-profile-step1"
action="{{ path('profile.step1_save') }}"
method="POST"
enctype="multipart/form-data"
class="form-outline {{ validated is defined ? 'was-validated' : '' }} row"
>
{% if mode == 'EDIT' %}
<input type='hidden' name='_method' value='PUT'>
{% endif %}
<div class="col-lg-3">
{{ block('section_sidebar') }}
</div>
<div class="col-lg-9 pl-lg-5">
<div class="d-flex flex-md-row flex-column mb-4">
<div class="section-title text-left d-flex align-items-center pt-5 pt-lg-0 mb-0">
<span class="mr-2">/</span> {% trans %}Vos informations personnelles{% endtrans %}
</div>
<div class="ml-auto">
<span class="required-note text-orange ml-4 mb-0 d-lg-inline d-block text-right">
<small>{% trans %}Champs obligatoires{% endtrans %} *</small>
</span>
</div>
</div>
{{ radio_group(
'user[gender]',
"Vous êtes" | trans,
[
{ value: 0, text: "Homme" | trans },
{ value: 1, text: "Femme" | trans },
],
formData,
{ required: true, inline: true }
)
}}
<div class="form-row">
<div class="col-lg-4">
{{ text_field('user[lastName]', "Nom de famille" | trans, formData, { required: true }) }}
</div>
<div class="col-lg-4">
{{ text_field('user[firstName]', "Prénom" | trans, formData, { required: true }) }}
</div>
<div class="col-lg-4">
{{ date_picker(
'user[birthDay]',
"Date de naissance" | trans,
formData,
{
attributes: {
"maxDate": "-16Y",
"minDate": "-100Y"
},
required: true
}
)
}}
</div>
</div>
<div class="form-row">
<div class="col-lg-4">
{{
dropdownlist(
'user[country]',
"Pays de naissance" | trans,
countries,
formData,
{ valueProperty: 'id', textProperty: 'name' }
)
}}
</div>
<div class="col-lg-4">
{{
dropdownlist(
'user[department]',
"Département de naissance" | trans,
departments,
formData,
{
attributes: {
disabled: formData.inputValues and
formData.inputValues.user.country and
(
formData.inputValues.user.country is object ?
formData.inputValues.user.country.id != 1 :
formData.inputValues.user.country != '1'
)
}
}
)
}}
</div>
<div class="col-lg-4">
{{ text_field('user[birthPlace]', "Ville de naissance" | trans, formData) }}
</div>
</div>
<div class="form-row">
<div class="col-lg-4">
{{
dropdownlist(
'user[nationality]',
"Nationalité" | trans,
countries,
formData,
{ valueProperty: 'id', textProperty: 'nationality' }
)
}}
</div>
<div class="col-lg-4">
{{ text_field('user[email]', "Email" | trans, formData, { required: true, attributes: { disabled: mode == 'EDIT' } }) }}
</div>
<div class="col-lg-4">
{{ text_field('user[phone]', "Téléphone" | trans, formData, { required: true }) }}
</div>
</div>
<div class="form-row">
<div class="col-lg-4">
{{ text_field('information[address]', "Adresse" | trans, formData) }}
</div>
<div class="col-lg-4">
{{ text_field('information[postalCode]', "Code postal" | trans, formData) }}
</div>
<div class="col-lg-4">
{{ text_field('information[city]', "Ville" | trans, formData) }}
</div>
</div>
<div class="form-row">
<div class="col-lg-4">
{{
dropdownlist(
'information[country]',
"Pays de résidence" | trans,
countries,
formData,
{ valueProperty: 'id', textProperty: 'name' }
)
}}
</div>
<div class="col-lg-4">
{{ text_field('information[socialSecutiryNumber]', "N° sécurité sociale" | trans, formData) }}
</div>
</div>
<div class="form-row">
<div class="col">
{{ check_box(
'isHandicap',
"Êtes-vous en situation de handicap ?" | trans,
1,
formData,
{
labelClass: '',
wrapperClass: 'mt-1',
showIfChecked: textarea('handicapInfo', "Préciser les aménagements nécessaires au bon suivi de votre scolarité" | trans ~ ' *', formData),
isBooleanCheck: true
}
)
}}
</div>
</div>
<div class="form-row">
<div class="col">
<div class="form-group agreefield">
<div class="custom-control custom-checkbox">
<input
type="checkbox" class="custom-control-input" id="accept" required
{{ validated is defined or mode == 'EDIT' ? 'checked' : '' }}
/>
<label class="custom-control-label text-dark-purple" for="accept">
<small>
<b>{% trans %}J'accepte qu' ÉSTIAM utilise mes données personnelles dans le cadre du traitement de ma candidature.{% endtrans %}</b>
<br/>
<i>{% trans %}ÉSTIAM s'engage à ne pas communiquer vos données personnelles.
Conformément à la loi RGPD du 25 Mai 2018 :
Vous bénéficiez d'un droit d'accès, de rectification, de portabilité, d'effacement de celles-ci ou une limitation du traitement.
Vous pouvez vous opposer au traitement des données vous concernant et disposez du droit de retirer votre consentement à tout moment.
Vous avez la possibilité d'introduire une réclamation auprès d'une autorité de contrôle.{% endtrans %}</i>
</small>
</label>
</div>
</div>
</div>
</div>
{% if mode == 'NEW' and captcha_enabled %}
<div class="captcha-row mb-4 d-flex justify-content-center">
<div class="g-recaptcha animate__animated" data-sitekey="{{ captcha_key }}"></div>
</div>
{% endif %}
{% if valid_programs is defined %}
<div class="captcha-row mb-4 d-flex justify-content-center">
<p class="error text-red font-italic">{{ valid_programs }}</p>
</div>
{% endif %}
<div class="text-right form-submit mt-4">
<button type="submit" id="btn-submit" class="link-gradient d-block d-lg-inline-block">
<span>SUIVANT</span><i class="far fa-arrow-right"></i>
</button>
</div>
</div>
</form>
{% endblock %}
{% block custom_javascripts %}
<script>
$(document).ready(function(){
{% if mode == 'EDIT' %}
$([document.documentElement, document.body]).animate({
scrollTop: $(".section-apply-tabs").offset().top - 60
}, 400);
{% else %}
$('#form-profile-step1').on('submit', function (e) {
{% if captcha_enabled %}
if (grecaptcha.getResponse().length == 0) {
e.preventDefault();
$('.g-recaptcha').css({"box-shadow": "0px 0px 4px #ff0000b3"});
$('.preloader').fadeOut();
return false;
}
{% endif %}
});
{% endif %}
$('[name="isHandicap"]').change(function() {
if ($(this).prop('checked')) {
$('[name="handicapInfo"]').prop('required', true)
} else {
$('[name="handicapInfo"]').prop('required', false)
}
})
$('[name="user[country]"]').change(function() {
console.log($(this).val())
if ($(this).val() === '1') {
console.log('france checked')
$('[name="user[department]"]').prop('disabled', false)
} else {
console.log('not france')
$('[name="user[department]"]').prop('disabled', true)
$('[name="user[department]"]').val('')
$('[name="user[department]"]').removeClass('active')
}
})
})
</script>
{{ block('javascript_sidebar') }}
{% endblock %}