{% extends "Global/layout.html.twig" %}
{% block title %}Adherent show{% endblock %}
{% set pageTitle = 'Adherent: '~adherent.nom~' '~adherent.prenom %}
{% block navigation %}
{% set navigation = [{'current': pageTitle}] %}
{% include 'Global/navigation.html.twig' with {navigation: navigation} %}
{% endblock %}
{% block content %}
{% for label, messages in app.flashes %}
{% for message in messages %}
<div class="flash-{{ label }}">
{{ message }}
</div>
{% endfor %}
{% endfor %}
<div class="card">
<header class="card-header">
<div class="card-actions">
<a href="#" class="card-action card-action-toggle" data-card-toggle=""></a>
<a href="#" class="card-action card-action-dismiss" data-card-dismiss=""></a>
</div>
{% if is_granted('ROLE_ADMIN') %}
<a class="btn btn-primary" href="{{ path('app_adherent_edit', {'id': adherent.id}) }}">Modifier</a>
{% endif %}
</header>
<div class="card-body" >
<table class="table table-striped">
<tbody>
<tr>
<th>Id</th>
<td>{{ adherent.id }}</td>
</tr>
<tr>
<th>Nom</th>
<td>{{ adherent.nom }}</td>
</tr>
<tr>
<th>Prenom</th>
<td>{{ adherent.prenom }}</td>
</tr>
<tr>
<th>NumeroAdhesion</th>
<td>{{ adherent.numeroAdhesion }}</td>
</tr>
<tr>
<th>Email</th>
<td>{{ adherent.email }}</td>
</tr>
<tr>
<th>RIB</th>
<td>{{ adherent.rip }}</td>
</tr>
<tr>
<th>Forfait télécom</th>
<td>{{ adherent.forfaitTelecom }}</td>
</tr>
<tr>
<th>Salaire brute</th>
<td>{{ adherent.salaireBrute }}</td>
</tr>
<tr>
<th>Plafond Restant</th>
<td>{{ services.getPlafand({'id':adherent.id})|number_format(2,'.','') }}</td>
</tr>
</tbody>
</table>
</div>
</br>
<section class="card mb-3">
<header class="card-header">
<div class="card-actions">
<a href="#" class="card-action card-action-toggle" data-card-toggle=""></a>
<a href="#" class="card-action card-action-dismiss" data-card-dismiss=""></a>
</div>
<h2 class="card-title">Somme des prestations par type</h2>
<div class="card-body">
<table class="table table-striped" id="type">
<thead>
<tr>
<th>Type Prestation</th>
<th>Montant des prestations</th>
<th>Montant payé par l'adherent</th>
<th>montant pris en charge par l'amicale </th>
{# <th>Taux</th>#}
</tr>
</thead>
<tbody>
{% for p in type %}
<tr>
<th>{{ p['lib'] }}</th>
<td>{{ p['valeurTotal'] }}</td>
<td>{{ p['valeurAgeherent'] }}</td>
<td>{{ p['valeurPayerCga'] }}</td>
{# <td>{{ (p['valeurPayerCga']/ p['valeurTotal'])|format_number(style='percent') }}</td>#}
</tr>
{% endfor %}
</table>
</div>
</section>
</br>
<section class="card mb-3">
<header class="card-header">
<div class="card-actions">
<a href="#" class="card-action card-action-toggle" data-card-toggle=""></a>
<a href="#" class="card-action card-action-dismiss" data-card-dismiss=""></a>
</div> <h2 class="card-title">Liste des prestations</h2>
<a class="btn btn-primary btn-icon-split btn-sm no-print"" href="{{ path('app_prestation_new',{'id': adherent.id,'type' :'cc'}) }}">
<span class="icon text-white-50">
<i class="bx bx-plus"></i>
</span>
Ajouter une nouvelle prestation
</a>
</header>
<div class="card-body">
<table class="table table-striped" id="prestations">
<thead>
<tr>
<th>Id</th>
<th>Adhérent</th>
<th>Type Prestation</th>
<th>Annee</th>
<th>montant des prestations </th>
<th>Amicale</th>
<th>adhérent</th>
<th>Etat</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{% for prestation in adherent.typePrestation %}
{% if prestation.typePrestation.id !='7' %}
{% if is_granted('ROLE_ADMIN') %}
{% if prestation.etat !='Bloquer' %}
<tr>
<td>{{ prestation.id }}</td>
<td>{{ prestation.adherent.nom }} {{ prestation.adherent.prenom }}</td>
<td>{{ prestation.typePrestation.lib }}</td>
<td>{{ prestation.anneeExercice.annee }}</td>
<td>{{ prestation.valeur }}</td>
<td>{{ prestation.valeurPayer }}</td>
<td>{{ prestation.valeur -prestation.valeurPayer }}</td>
<td>{{ prestation.etat }}</td>
<td>
<a class="btn btn-success" href="{{ path('app_prestation_edit_etat', {'id': prestation.id,'etat':'Valider'}) }}">Valider</a>
<a class="btn btn-dark" href="{{ path('app_prestation_edit_etat', {'id': prestation.id,'etat':'Payer'}) }}">Payer</a>
<a class="btn btn-danger" href="{{ path('app_prestation_edit_etat', {'id': prestation.id,'etat':'Bloquer'}) }}">Bloquer</a>
<a class="btn btn-warning" href="{{ path('app_prestation_edit_etat', {'id': prestation.id,'etat':'Cour'}) }}">Cour</a>
<a class="btn btn-primary" href="{{ path('app_prestation_edit', {'id': prestation.id}) }}">Modifier</a>
<a class="btn btn-dark" href="{{ path('app_prestation_show', {'id': prestation.id}) }}">Detail</a>
</td>
</tr> {% endif %}
{% elseif prestation.anneeExercice.annee =='2024' %}
<tr>
<td>{{ prestation.id }}</td>
<td>{{ prestation.adherent.nom }} {{ prestation.adherent.prenom }}</td>
<td>{{ prestation.typePrestation.lib }}</td>
<td>{{ prestation.anneeExercice.annee }}</td>
<td>{{ prestation.valeur }}</td>
<td>{{ prestation.valeurPayer }}</td>
<td>{{ prestation.valeur -prestation.valeurPayer }}</td>
<td>{{ prestation.etat }}</td>
<td>
<a class="btn btn-danger" href="{{ path('app_prestation_edit_etat', {'id': prestation.id,'etat':'Bloquer'}) }}">Bloquer</a>
</td>
</tr>
{% endif %}
{% endif %}
{% endfor %}
</tbody>
<tfoot>
<tr>
<th colspan="8" style="text-align:right">Total:</th>
<th></th>
</tr>
</tfoot>
</table>
</div>
</section>
<section class="card mb-3">
<header class="card-header">
<div class="card-actions">
<a href="#" class="card-action card-action-toggle" data-card-toggle=""></a>
<a href="#" class="card-action card-action-dismiss" data-card-dismiss=""></a>
</div>
<h2 class="card-title">Liste des enfants</h2>
<a class="btn btn-primary btn-icon-split btn-sm no-print"" href="{{ path('app_enfant_new',{'idadr': adherent.id}) }}">
<span class="icon text-white-50">
<i class="bx bx-plus"></i>
</span>
Ajouter un enfant
</a>
<div class="card-body">
<table class="table table-striped" id="enfant">
<thead>
<tr>
<th>Id</th>
<th>Nom</th>
<th>Prenom</th>
<th>Date naissance</th>
<th>Classe</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{% for en in adherent.enfants %}
<tr>
<td>{{ en.id }}</td>
<td>{{ en.nom }}</td>
<td>{{ en.prenom }}</td>
<td>{{ en.dateNaissance|date("Y-m-d") }}</td>
{% if en.classEtude %}
<td>{{ en.classEtude.lib }}</td>
{% else %}
<td>-</td>
{% endif %}
<td><a class="btn btn-primary" href="{{ path('app_enfant_edit', {'id': en.id}) }}">Modifier</a>
<a class="btn btn-primary" href="{{ path('app_prestation_new', {'id': en.id,'type':'en'}) }}">Ajouter une prestation</a>
</tr>
{% endfor %}
</table>
</div>
</section>
<section class="card mb-3">
<header class="card-header">
<div class="card-actions">
<a href="#" class="card-action card-action-toggle" data-card-toggle=""></a>
<a href="#" class="card-action card-action-dismiss" data-card-dismiss=""></a>
</div> <h2 class="card-title">caractéristiques du véhicule</h2>
{% if is_granted('ROLE_ADMIN') %}
<a class="btn btn-primary btn-icon-split btn-sm no-print"" href="{{ path('app_vehicule_new',{'idadr': adherent.id}) }}">
<span class="icon text-white-50">
<i class="bx bx-plus"></i>
</span>
Ajouter un véhicule
</a>
{% endif %}
<div class="card-body">
<table class="table table-striped" id="vehicule">
<thead>
<tr>
<th>Id</th>
<th>Immatriculation</th>
<th>Marque</th>
<th>Modele</th>
<th>Couleur</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{% if adherent.vehicule %}
<tr>
<td>{{ adherent.vehicule.id }}</td>
<td>{{ adherent.vehicule.immatriculation }}</td>
<td>{{ adherent.vehicule.marque }}</td>
<td>{{ adherent.vehicule.modele }}</td>
<td>{{ adherent.vehicule.couleur }}</td>
{% if is_granted('ROLE_ADMIN') %}
<td><a class="btn btn-primary" href="{{ path('app_vehicule_edit', {'id': adherent.vehicule.id}) }}">Modifier</a></td>
{% else %}
<td>-</td>
{% endif %}
</tr>
{% endif %}
</tbody>
</table>
</div>
</section>
</div>
<section class="card">
<header class="card-header">
<div class="card-actions">
<a href="#" class="card-action card-action-toggle" data-card-toggle></a>
<a href="#" class="card-action card-action-dismiss" data-card-dismiss></a>
</div>
<h2 class="card-title">Liste des créances</h2>
{% if is_granted('ROLE_ADMIN') %}
<a class="btn btn-primary btn-icon-split btn-sm no-print"" href="{{ path('app_rempoursement_dette_new',{'id': adherent.id}) }}">
<span class="icon text-white-50">
<i class="bx bx-plus"></i>
</span>
Ajouter un Rempoursement
</a>
{% endif %}
</header>
<div class="card-body">
<table class="display" id="datatable-tabletools">
<thead>
<tr>
<th>Id</th>
<th>Date</th>
<th>Facture</th>
<th>Prestation</th>
<th>Montant</th>
<th>Valeur restante</th>
<th>Etat</th>
</tr>
</thead>
<tbody>
{% for dette in adherent.dettes %}
<tr>
<td>{{ dette.id }}</td>
<td>{{ dette.date ? dette.date|date('Y-m-d') : '' }}</td>
{% if dette.facture%}
<td>{{ dette.facture.lib }}</td>
{% else %}
<td>-</td>
{% endif %}
{% if dette.typePrestation%}
<td>{{ dette.typePrestation.lib }}</td>
{% else %}
<td>-</td>
{% endif %}
<td>{{ dette.valeur }}</td>
<td>{{ dette.valeurRestante }}</td>
<td>{{ dette.etat }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th colspan="6" style="text-align:right">Total:</th>
<th></th>
</tr>
</tfoot>
</table>
</div>
</section>
{% endblock %}
{% block script %}
<script>
function myFunction(id, etat) {
var url = "{{ path('app_prestation_edit_etat', {'id':'idPrestation','etat':'etatPrestation'}) }}";
url = url.replace("idPrestation", id);
url = url.replace("etatPrestation", etat);
$.ajax({
url: url,
}).done(function () {
// $('#prestations').DataTable().ajax.reload();
});
}
$(document).ready(function () {
$("#datatable-tabletools").DataTable({
language: {
url: '//cdn.datatables.net/plug-ins/1.13.7/i18n/fr-FR.json',
},
responsive: true,
footerCallback: function (row, data, start, end, display) {
let api = this.api();
// Remove the formatting to get integer data for summation
let intVal = function (i) {
return typeof i === 'string'
? i.replace(/[\$,]/g, '') * 1
: typeof i === 'number'
? i
: 0;
};
// Total over all pages
// Total over this page
pageTotal = api
.column(5, {page: 'current'})
.data()
.reduce((a, b) => intVal(a) + intVal(b), 0);
// Update footer
api.column(5).footer().innerHTML =
'Total: $' + pageTotal;
}
});
$("#vehicule").DataTable({
language: {
url: '//cdn.datatables.net/plug-ins/1.13.7/i18n/fr-FR.json',
},
responsive: true
});
$("#enfant").DataTable({
language: {
url: '//cdn.datatables.net/plug-ins/1.13.7/i18n/fr-FR.json',
},
responsive: true
});
$("#prestations").DataTable({
language: {
url: '//cdn.datatables.net/plug-ins/1.13.7/i18n/fr-FR.json',
},
responsive: true,
footerCallback: function (row, data, start, end, display) {
let api = this.api();
// Remove the formatting to get integer data for summation
let intVal = function (i) {
return typeof i === 'string'
? i.replace(/[\$,]/g, '') * 1
: typeof i === 'number'
? i
: 0;
};
// Total over all pages
// Total over this page
pageTotal = api
.column(5, {page: 'current'})
.data()
.reduce((a, b) => intVal(a) + intVal(b), 0);
// Update footer
api.column(5).footer().innerHTML =
'Total: $' + pageTotal;
}
});
});
</script>
{% endblock %}