{% extends 'base.html.twig' %}
{% block title %}Hello PagesController!{% endblock %}
{% block body %}
<div class="container p-30">
<div class="row">
<div class="col-md-12 main-datatable">
<div class="card_body">
<div class="row d-flex">
{% if is_granted('ROLE_ADMIN_STRUCTURE') or is_granted('ROLE_SUPER_ADMIN') %}
<div class="col-sm-4 createSegment">
<a class="btn dim_button create_new" href="{{ path('app_upload') }}"> <i
class="fa fa-plus"></i> Ajouter une nouvelle offre</a>
</div>
{% endif %}
<div class="col-sm-8 add_flex">
<div class="form-group searchInput">
<label for="email">Rechercher:</label>
<input type="search" class="form-control" id="filterbox" placeholder=" ">
</div>
</div>
</div>
<div class="overflow-x">
<table style="width:100%;" id="filtertable" class="table cust-datatable dataTable no-footer ">
<thead>
<th style="min-width:150px;">Consulter l'offre</th>
<th style="min-width:150px;">Titre de l'offre</th>
<th style="min-width:150px;">Nom de la structure</th>
<th style="min-width:150px;">Description de l'offre</th>
<th style="min-width:100px;">Catégorie de l'offre</th>
<th style="min-width:100px;">Date de publication</th>
<th style="min-width:150px;">Localisation</th>
{% if is_granted('ROLE_ADMIN_STRUCTURE') or is_granted('ROLE_SUPER_ADMIN') %}
<th style="min-width:150px;">Action</th>
{% endif %}
</thead>
<tbody>
{% for offer in offer %}
{% if offer.statut == 'Initial' %}
<tr>
<td>
<div class="btn-group consult">
<abbr title="Consulter"><a
href="{{ path ('app_candidature',{id : offer.id}) }}">
<button id="offerVue">Voir l'offre</button>
</a></abbr>
</div>
</td>
<td><b> {{ offer.titre }} </b></td>
<td> {{ offer.nomStructure }} </td>
<td> {{ offer.descriptionPoste }} </td>
<td> {{ offer.categorieContrat }}</td>
<td> {{ offer.datePublication|date("d/m/Y") }} </td>
<td> {{ offer.Localisation }} </td>
{% if is_granted('ROLE_SUPER_ADMIN') or is_granted('ROLE_ADMIN_STRUCTURE') %}
<td>
<div class="btn-group edit">
<a href="{{ path('app_modif', {id : offer.id}) }}"><i class="bi bi-pencil-fill"></i></a>
</div>
<div class="btn-group delete">
<a href="{{ path('app_delete', {id : offer.id}) }}"
onclick="return confirm('Etes-vous sur de vouloir supprimer cette offre ?')"><i
class="bi bi-trash-fill"></i></a>
</div>
</td>
</tr>
{% endif %}
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/1.10.14/js/jquery.dataTables.min.js"></script>
<script>
var dataTable = $('#filtertable').DataTable({
"pageLength": 5,
"scrollY": 400,
"scrollX": true,
"scrollCollapse": true,
"paging": false,
'aoColumnDefs': [{
'bSortable': true,
'aTargets': ['3'],
}],
columnDefs: [
{type: 'date-dd-mm-yyyy', aTargets: [5]}
],
"aoolumns": [
null,
null,
null,
null,
null,
null,
null
],
"order": false,
"bLengthChange": false,
"dom": '<"top">ct<"top"p><"clear">'
});
$("#filterbox").on('keyup change', function () {
dataTable.search(this.value).draw();
});
</script>
{% endblock %}