{% extends "Frontend/base-vacataire.html.twig" %}
{% block body %}
<div id="presentationCadre">
{% block title %}<title>Espace vacataire</title>{% endblock %}
<div class="row mt-4 justify-content-end">
<div class="col-2 pt-2">
<a href="{{ path('frontend_candidat') }}" class="btn btn-warning">
<i class="fa fa-home"></i>
Accueil
</a>
</div>
</div>
<div class="row">
<div class="col">
<p>Cet espace vous permet de <b> déposer votre dossier de vacataire.</b></p>
<p>Pour déposer votre dossier de vacataire, vous devez:
<ol>
<li>Créer un compte sur ce site si ce n'est pas déjà le cas.</li>
<li>Déposer les différentes pièces sur votre espace personnel en sélectionnant auparavant la campagne de vacation.</li>
</ol>
</p>
</div>
</div>
<div id="msg-success" class="row" {% if message==""%} style="display: none" {% endif %}>
<div class="col">
<div id="msg-success" class="alert alert-{{message_type}}"><i class="fa fa-info-circle"></i> {{ message }}</div>
</div>
</div>
<div class="row mt-4">
<div id="login" class="col-sm-6">
<div class="row">
<legend class="border-bottom"> Accéder à votre espace </legend>
<form class="form-horizontal" action="{{ path('frontend_vacataire_login_check') }}" method="post">
{% if error %}
<div id="msg-error" class="alert alert-danger">
<i class="fa fa-info-circle"></i>
{% if error.message=='Bad credentials.' %}Identifiant et/ou mot de passe éronné.
{% elseif error.message=='User account is disabled.' %} Vous n'avez pas activé votre compte via le premier email que vous avez reçu.
{% elseif error.message=='The presented password cannot be empty.'%}Le mot de passe ne peut être vide.
{% elseif error.message=='The presented password is invalid.'%}Le mot de passe est invalide.
{% else %}{{error.message}}{% endif %}
</div>
{% endif %}
<div class="row mb-2">
<label class="col-sm-5" for="username">Identifiant :</label>
<div class="col-sm-7">
<input type="text" class="form-control" id="username" name="_username" placeholder="adresse de messagerie" value="{{ last_username }}" />
</div>
</div>
<div class="row mb-2">
<label class="col-sm-5" for="password">Mot de passe :</label>
<div class="col-sm-7">
<input type="password" class="form-control" id="password" name="_password" />
</div>
</div>
<div class="row">
<div class="col-md-12 text-center">
<button type="submit" class="btn btn-success"> <span class="fa fa-sign-in-alt" aria-hidden="true"></span> Connexion</button>
</div>
</div>
</form>
<div class="passwordLink">
<a id="pwdLink" data-bs-toggle="modal" data-target="#msgPwdOublie"><i class="fa fa-user-circle"> </i> Mot de passe oublié ?</a><br>
<a id="activLink" data-bs-toggle="modal" data-target="#msgActivSend"><i class="fa fa-user-circle"> </i> Vous n'avez pas reçu le mail d'activation ?</a>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="row">
<legend>Créer votre compte</legend>
<form id="form_create" class="form-horizontal" action="{{ path('frontend_vacataire')}}" method="post">
{{ form_errors(form) }}
<div class="row mb-2">
<label class="form-label col-sm-4" for="{{ form.nom.vars.id }}">Nom :</label>
<div class="col-sm-8">
{{ form_widget(form.nom) }}
</div>
</div>
<div class="row mb-2">
<label class="form-label col-sm-4" for="{{ form.prenom.vars.id }}">Prénom :</label>
<div class="col-sm-8">
{{ form_widget(form.prenom) }}
</div>
</div>
<div class="row mb-2">
<label class="form-label col-sm-4" for="{{ form.genre.vars.id }}">Genre :</label>
<div class="col-sm-8">
{{ form_widget(form.genre) }}
</div>
</div>
<div class="row mb-2">
<label class="form-label col-sm-4" for="{{ form.date_naissance.vars.id }}">Date de naissance :</label>
<div class="col-sm-8">
{{ form_widget(form.date_naissance) }}
</div>
</div>
<div class="row mb-2">
<label class="form-label col-sm-4" for="{{ form.lieu_naissance.vars.id }}">Lieu de naissance :</label>
<div class="col-sm-8">
{{ form_widget(form.lieu_naissance) }}
</div>
</div>
<div class="row mb-2">
<label class="form-label col-sm-4" for="{{ form.tel.vars.id }}">Tel :</label>
<div class="col-sm-8">
{{ form_widget(form.tel) }}
</div>
</div>
<div class="row mb-2">
<label class="form-label col-sm-4" for="{{ form.email.vars.id }}">Courriel :</label>
<div class="col-sm-8">
{{ form_widget(form.email) }}
</div>
</div>
<div class="row mb-2">
<label class="form-label col-sm-4" for="{{ form.adresse.vars.id }}">Adresse :</label>
<div class="col-sm-8">
{{ form_widget(form.adresse) }}
</div>
</div>
<div class="row mb-2">
<label class="form-label col-sm-4" for="{{ form.cp.vars.id }}">CP :</label>
<div class="col-sm-8">
{{ form_widget(form.cp) }}
</div>
</div>
<div class="row mb-2">
<label class="form-label col-sm-4" for="{{ form.ville.vars.id }}">Ville :</label>
<div class="col-sm-8">
{{ form_widget(form.ville) }}
</div>
</div>
<div class="row mb-2">
<label class="form-label col-sm-4" for="{{ form.pays.vars.id }}">Pays :</label>
<div class="col-sm-8">
{{ form_widget(form.pays) }}
</div>
</div>
<div class="row mb-2">
<label class="form-label col-sm-4" for="{{ form.password.password.vars.id }}">Mot de passe :</label>
<div class="col-sm-8">
{{ form_widget(form.password.password) }}
</div>
</div>
<div class="row mb-2">
<label class="form-label col-sm-4" for="{{ form.password.confirmation.vars.id }}">Confirmation :</label>
<div class="col-sm-8">
{{ form_widget(form.password.confirmation) }}
</div>
</div>
<div class="row mb-2">
<label class="form-label col-sm-4" for="{{ form.terms.vars.id }}">Termes :</label>
<div class="col-sm-1 terms">
{{ form_widget(form.terms) }}
</div>
<div class="col-sm-offset-7">
</div>
</div>
{{ form_rest(form) }}
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-success"><span class="fa fa-check-circle" ></span> Valider</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="modal fade" id="msgPwdOublie" tabindex="-1" aria-labelledby="msgPwdOublieModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="msgPwdOublieModalLabel">Générer un nouveau mot de passe</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-3">
<label for="user_login">Identifiant : </label>
</div>
<div class="col-9">
<input id="user_login" placeholder="adresse de messagerie" class="form-control" type="text" value="" name="user_login">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><i class="fa fa-times-circle"></i> Fermer</button>
<button id="submitPwd" class="btn btn-primary"> <i class="fa fa-paper-plane"></i> Générer un mot de passe</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="msgActivSend" tabindex="-1" aria-labelledby="msgActivSendModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="msgActivSendModalLabel">Renvoyer le courriel d'activation</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-3">
<label for="user_login_activ">Identifiant : </label>
</div>
<div class="col-9">
<input id="user_login_activ" placeholder="adresse de messagerie" class="form-control" type="text" value="" name="user_login_activ">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><i class="fa fa-times-circle"></i> Fermer</button>
<button id="submitActivSend" class="btn btn-primary"> <i class="fa fa-paper-plane"></i> Envoyer le courriel</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="msgTermes" tabindex="-1" aria-labelledby="termesModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="termesModalLabel">Termes et conditions d'utilisation</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
{% include 'Frontend/Candidat/Termes/termes.html.twig' %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><i class="fa fa-times-circle"></i> Fermer</button>
<button id="validTermes" class="btn btn-primary"><i class="fa fa-user-check"></i> J'accepte</button>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
var msgTermes = new bootstrap.Modal(document.getElementById('msgTermes'));
var msgPwdOublie = new bootstrap.Modal(document.getElementById('msgPwdOublie'));
var msgActivSend= new bootstrap.Modal(document.getElementById('msgActivSend'));
$("#rec_candidat_terms").on('click', function (event){
if(this.checked)
msgTermes.show();
});
$("#activLink").on('click', function (event){
event.preventDefault();
msgActivSend.show();
});
$("#submitActivSend").on('click', function (event){
event.preventDefault();
msgActivSend.hide();
var objData = {};
var url = $(this.element).attr('data-url');
objData = { mail: $("#user_login_activ").val() };
if(validateEmail($("#user_login_activ").val()))
{
$.ajax({
url: '{{ path('frontend_vacataire_activate_account') }}',
dataType: "json",
data : objData,
type: 'POST',
success: function (data)
{
if(data.success==1)
{
$("#msg-success").show();
$("#msg-success").find(".alert").html(data.message);
$("#msg-success").find(".alert").removeClass('alert-');
$("#msg-success").find(".alert").addClass('alert-info');
}
else
{
$("#msg-error").show();
$("#msg-error").html(data.message);
}
}
});
}
});
$("#pwdLink").on('click', function (event){
event.preventDefault();
msgPwdOublie.show();
});
$("#submitPwd").on('click', function (event){
event.preventDefault();
msgPwdOublie.hide();
var objData = {};
var url = $(this.element).attr('data-url');
objData = { mail: $("#user_login").val() };
if(validateEmail($("#user_login").val()))
{
$.ajax({
url: '{{ path('frontend_vacataire_mdp') }}',
dataType: "json",
data : objData,
type: 'POST',
success: function (data)
{
if(data.success==1)
{
$("#msg-success").show();
$("#msg-success").find(".alert").html(data.message);
$("#msg-success").find(".alert").removeClass('alert-');
$("#msg-success").find(".alert").addClass('alert-info');
}
else
{
$("#msg-error").show();
$("#msg-error").html(data.message);
}
}
});
}
});
});
function validateEmail(sEmail) {
var filter = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
if (filter.test(sEmail)) {
return true;
}
else {
return false;
}
}
</script>
{% endblock %}
{% block contact %}
<p><a target="_blank" href="mailto:{{ mail_rh_vacataire }}">Contacter les ressources humaines</a></p>
{% endblock %}