{% extends 'base.html.twig' %}
{% set extendClass = 'offer-page' %}
{% block page_contents %}
<section class="section section-page-title bg-gradient py-xl-5 py-4" data-aos='fade-down'>
<div class="container">
<div class="row">
<div class="col-12 text-center text-white">
<h1 class="page-name font-weight-bold my-2">
{% trans %}Offres d’emploi{% endtrans %}<br/>
{% trans %}Alternances et stages{% endtrans %}
</h1>
<div class='font-weight-bold'>{{ totalJob }} {% trans %}offres{% endtrans %}</div>
</div>
</div>
</div>
</section>
<section class="section section-form section-form-2 mb-2 mt-4">
<div class="container">
<div class="row">
<div class="col-12 mx-auto mb-4" data-aos='fade-up'>
<div class="offres-search-box py-3 px-xl-5 px-lg-4 px-3">
<div class="font-20 font-weight-bold mb-3 text-black text-uppercase text-center line-height-normal">{% trans %}RECHERCHEZ UNE OFFRE QUI CORRESPOND AVEC VOTRE PROFIL{% endtrans %}</div>
<form id="filter-form" data-aos='fade-up'>
<div class="d-flex align-items-lg-start align-items-end">
<div class="mr-4 flex-grow-1">
<div class="row">
<div class="col-lg-4">
<div class="form-group">
<select data-none-selected-text="{% trans %}Type de contrat{% endtrans %}" class="select-multiple form-control submit-change" name="contract[]" multiple="multiple">
{% for contract in contracts %}
<option value="{{ contract.id }}">{{ contract.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<select data-none-selected-text="{% trans %}Domaine/Expertise{% endtrans %}" class="select-multiple form-control submit-change" name="expertise[]" multiple="multiple">
{% for expertise in expertises %}
<option value="{{ expertise.id }}">{{ expertise.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<select data-none-selected-text="{% trans %}À proximité du campus{% endtrans %}" class="select-multiple form-control submit-change" name="campuses[]" multiple="multiple">
{% for campus in campuses %}
<option value="{{ campus.id }}">{{ campus.name }}</option>
{% endfor %}
</select>
</div>
</div>
</div>
</div>
<div class="ml-auto">
<div class="font-30 cursor mb-lg-0 mb-3" id="clear-filter" title="{% trans %}Annuler toutes les recherches{% endtrans %}" data-toggle="tooltip" data-placement="top"><i class="fa-solid fa-arrows-rotate"></i></div>
</div>
</div>
<div class="text-dark-purple mb-2">{% trans %}Recherche par compétences{% endtrans %}</div>
<div class="list-offre-checkbox submit-checkbox">
{% for i,skill in skills %}
<label class="switch">
<input type="checkbox" name="skill[{{ i }}]" value="{{ skill.id }}">
<span class="slider">{{ skill.name }}</span>
</label>
{% endfor %}
</div>
<div class="show-all text-center mt-2">
<a id="show-all"><i class="fal fa-angles-down bounce"></i></a>
<a id="hide-all" style="display: none;"><i class="fal fa-angles-up bounce"></i></a>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
<section class="section section-offer mb-4">
<div class="container">
<div class="row">
<div class="col-12 mb-4">
<div class="text-dark-purple" data-aos='fade-up'>(<span id="total-job">{{ totalJob }}</span>) {% trans %}résultat(s) trouvé(s){% endtrans %}</div>
</div>
</div>
<div class="row" id="result-data">
{% for job in jobs %}
{% include 'job_board/_item_job.html.twig' %}
{% endfor %}
</div>
</div>
</section>
{% endblock %}
{% block custom_javascripts %}
<script src="{{ asset('assets/js/multiselect.js') }}"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.select-multiple').each(function(){
var none_text = $(this).attr('data-none-selected-text');
$(this).multiselect({
afterSelect: function(values){
alert("Select value: "+values);
},
buttonTextAlignment: 'left',
nonSelectedText: none_text,
nSelectedText: '{% trans %}sélectionné(s){% endtrans %}'
});
});
$('.submit-change,.submit-checkbox input').change(function(){
filterData();
});
function filterData(){
let data = $('#filter-form').serialize(); console.log(data);
$.ajax({
url: "{{ path('job.filter') }}",
type: "POST",
dataType: 'json',
data : data,
success: function(result) {
$('#result-data').html(result.data);
$('#total-job').text(result.total);
}
}).always(function () {});
}
$('#clear-filter').click(function(){
$('.select-multiple').val('').multiselect('refresh');
$('.submit-checkbox input').prop('checked', false);
filterData();
});
});
</script>
{% endblock %}