{% extends 'base.html.twig' %}
{% block title %}Editer session{% endblock %}
{% block body %}
<body id="kt_app_body" data-kt-app-layout="dark-sidebar" data-kt-app-header-fixed="true" data-kt-app-sidebar-enabled="true" data-kt-app-sidebar-fixed="true" data-kt-app-sidebar-hoverable="true" data-kt-app-sidebar-push-header="true" data-kt-app-sidebar-push-toolbar="true" data-kt-app-sidebar-push-footer="true" data-kt-app-toolbar-enabled="true" class="app-default">
<div class="d-flex flex-column flex-root app-root" id="kt_app_root">
<!--begin::Page-->
<div class="app-page flex-column flex-column-fluid" id="kt_app_page">
<div class="app-wrapper flex-column flex-row-fluid" id="kt_app_wrapper">
<div class="app-main flex-column flex-row-fluid" id="kt_app_main">
<div class="d-flex flex-column flex-column-fluid">
<!--begin::Toolbar-->
<div id="kt_app_toolbar" class="app-toolbar py-3 py-lg-6">
<!--begin::Toolbar container-->
<div id="kt_app_toolbar_container" class="app-container container-xxl d-flex flex-stack">
<!--begin::Page title-->
<div class="page-title d-flex flex-column justify-content-center flex-wrap me-3">
<!--begin::Title-->
<h1 class="page-heading d-flex text-dark fw-bold fs-3 flex-column justify-content-center my-0">Interface de gestion d'une session</h1>
</br>
<div class="card mb-5 mb-xxl-8">
<div class="card-body pt-9 pb-0">
<div class="d-flex flex-wrap flex-sm-nowrap "style="min-width: 980px;">
<div class="flex-grow-1">
<div class="d-flex justify-content-between align-items-start flex-wrap mb-2">
<div class="d-flex flex-column">
<div class="d-flex align-items-center mb-2">
<a href="#" class="text-gray-900 text-hover-primary fs-2 fw-bold me-1">{{session.nom}}</a>
</div>
<div class="d-flex flex-wrap fw-semibold fs-6 mb-4 pe-2">
<a href="#" class="d-flex align-items-center text-gray-600 text-hover-primary me-5 mb-2">
<span class="svg-icon svg-icon-4 me-1">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9 1.5C4.875 1.5 1.5 4.875 1.5 9C1.5 13.125 4.875 16.5 9 16.5C13.125 16.5 16.5 13.125 16.5 9C16.5 4.875 13.125 1.5 9 1.5ZM9 14.625C5.625 14.625 3 11.925 3 9C3 6.075 5.625 3.375 9 3.375C12.375 3.375 15 6.075 15 9C15 11.925 12.375 14.625 9 14.625Z" fill="currentColor"/>
<rect x="6" y="5.25" width="6" height="1.5" fill="currentColor"/>
<rect x="6" y="8.25" width="6" height="1.5" fill="currentColor"/>
<rect x="6" y="11.25" width="6" height="1.5" fill="currentColor"/>
</svg>
</span>
Session</a>
</div>
<div class="d-flex flex-wrap fw-semibold fs-6 mb-4 pe-2">
<a href="#" class="d-flex align-items-center text-gray-600 text-hover-primary me-5 mb-2">
<span class="svg-icon svg-icon-4 me-1">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="3" y="4" width="18" height="16" rx="2" stroke="currentColor" stroke-width="2" fill="none" />
<circle cx="8" cy="12" r="2" stroke="currentColor" stroke-width="2" fill="none" />
<circle cx="12" cy="12" r="2" stroke="currentColor" stroke-width="2" fill="none" />
<circle cx="16" cy="12" r="2" stroke="currentColor" stroke-width="2" fill="none" />
</svg>
</span> <span class="text-gray-900"> Nom du programme : </span> {{session.programme.nom}}</a>
</div>
<div class="d-flex flex-wrap fw-semibold fs-6 mb-4 pe-2">
<a href="#" class="d-flex align-items-center text-gray-600 text-hover-primary me-5 mb-2">
<span class="svg-icon svg-icon-4 me-1">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="3" y="4" width="18" height="16" rx="2" stroke="currentColor" stroke-width="2" fill="none" />
<circle cx="8" cy="12" r="2" stroke="currentColor" stroke-width="2" fill="none" />
<circle cx="12" cy="12" r="2" stroke="currentColor" stroke-width="2" fill="none" />
<circle cx="16" cy="12" r="2" stroke="currentColor" stroke-width="2" fill="none" />
</svg>
</span> <span class="text-gray-900"> Description : </span>{{session.description}}</a>
</div>
</div>
{% if is_granted('ROLE_ADMIN') %}
<div class="d-flex my-4">
<a href="#" class="btn btn-sm btn-light btn-danger me-2" data-bs-toggle="modal" data-bs-target="#kt_modal_1">
Supprimer
</a>
{# Code du modal pour le bouton supprimer #}
<div class="modal fade" tabindex="-1" id="kt_modal_1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title">Supprimer une session</h3>
<!--begin::Close-->
<div class="btn btn-icon btn-sm btn-active-light-primary ms-2" data-bs-dismiss="modal" aria-label="Close">
<i class="ki-duotone ki-cross fs-1"><span class="path1"></span><span class="path2"></span></i>
</div>
<!--end::Close-->
</div>
<div class="modal-body">
<p>Êtes-vous sûr(e) de vouloir supprimer la session: <strong> {{session.nom}} </strong></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light" data-bs-dismiss="modal">Annuler</button>
<a href="{{ path('delete-session', {id:session.id}) }}" class="btn btn-primary">Valider</a>
</div>
</div>
</div>
</div>
</div>
{% endif %}
</div>
</div>
<!--end::Info-->
</div>
</br>
<ul class="nav nav-custom nav-tabs nav-line-tabs nav-line-tabs-2x border-0 fs-4 fw-semibold mb-8">
<!--begin:::Tab item-->
<li class="nav-item">
<a class="nav-link text-active-primary pb-4 active" data-bs-toggle="tab" href="#session">Informations de la session</a>
</li>
<li class="nav-item">
<a class="nav-link text-active-primary pb-4 " data-kt-countup-tabs="true" data-bs-toggle="tab" href="#participants">Liste des participants</a>
</li>
<li class="nav-item">
<a class="nav-link text-active-primary pb-4" data-bs-toggle="tab" href="#seances">Liste des séances</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="kt_app_content" class="app-content flex-column-fluid">
<!--begin::Content container-->
<div id="kt_app_content_container" class="app-container container-xxl">
<!--begin::Layout-->
<div class="d-flex flex-column flex-lg-row">
<div class="flex-lg-row-fluid ms-lg-15">
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="session" role="tabpanel">
{{ form_start(form) }}
<div class="card card-flush mb-6 mb-xl-9">
<div class="card-header border-0">
<div class="modal-body py-10 px-lg-17">
<h3 class="fw-bold">Informations de la session</h3></br></br>
<div class="d-flex flex-column flex-md-row gap-5">
<div class="flex-row-fluid">
{{ form_row(form.nom) }}
</div>
<div class="flex-row-fluid">
{{ form_row(form.programme) }}
</div>
</div>
</br>
</br>
<div class="d-flex flex-column flex-md-row gap-5">
<div class="flex-row-fluid">
{{ form_row(form.datedebut) }}
</div>
<div class="flex-row-fluid">
{{ form_row(form.datefin) }}
</div>
<div class="flex-row-fluid">
{{ form_row(form.nbrmaxparticipants) }}
</div>
</div>
</br>
</br>
<div class="d-flex flex-column flex-md-row gap-5">
<div class="flex-row-fluid">
{{ form_row(form.description) }}
</div>
</div>
</br>
</br>
</div>
</div>
</br>
<div class="modal-footer flex-center">
{{ form_row(form.Enregistrer) }}
</div>
</br>
</form>
{{ form_end(form) }}
</div>
</div>
</div>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade" id="participants" role="tabpanel">
<div class="card pt-4 mb-6 mb-xl-9">
<div class="card-header border-0">
<div class="card-title">
<h2>Liste des participants</h2>
</div>
</div>
<div class="card-body pt-0 pb-5">
<div class="table-responsive">
<table class="table align-middle table-row-dashed gy-5" id="kt_table_users_login_session">
<!--begin::Table head-->
<thead class="border-bottom border-gray-200 fs-7 fw-bold">
<!--begin::Table row-->
<tr class="text-start text-muted text-uppercase gs-0">
<th class="min-w-100px">Nom et prénom</th>
<th>Sexe</th>
<th>Date de naissance</th>
<th>Type</th>
</tr>
</thead>
<tbody class="fs-6 fw-semibold text-gray-600">
{% for particpant in particpants %}
<tr>
<!--begin::Invoice=-->
<td>{{particpant.membre.nom}} {{particpant.membre.prenom}}</td>
<td>{{particpant.membre.sexe}}</td>
<td>{{particpant.membre.datenaissance.format('Y-m-d')}}</td>
<td>{{particpant.membre.type}}</td>
</tr>
{% endfor %}
</tbody>
<!--end::Table body-->
</table>
<!--end::Table-->
</div>
<!--end::Table wrapper-->
</div>
</div>
</div>
</div>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade" id="seances" role="tabpanel">
<div class="card pt-4 mb-6 mb-xl-9">
<div class="card-header border-0">
<div class="card-title">
<h2>Liste des séances</h2>
</div>
<div class="card-toolbar">
<a href="{{ path ('app_ajouter_seance')}}">
<button type="button" class="btn btn-primary" data-bs-toggle="modal">
<span class="svg-icon svg-icon-2">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect opacity="0.5" x="11.364" y="20.364" width="16" height="2" rx="1" transform="rotate(-90 11.364 20.364)" fill="currentColor" />
<rect x="4.36396" y="11.364" width="16" height="2" rx="1" fill="currentColor" />
</svg>
</span>
Ajouter une séance</button></a>
<!--end::Filter-->
</div>
</div>
<div class="card-body pt-0 pb-5">
<!--begin::Table wrapper-->
<div class="table-responsive">
<!--begin::Table-->
<table class="table align-middle table-row-dashed gy-5" id="kt_table_users_login_session">
<!--begin::Table head-->
<thead class="border-bottom border-gray-200 fs-7 fw-bold">
<!--begin::Table row-->
<tr class="text-start text-muted text-uppercase gs-0">
<th class="min-w-100px">Nom de la séance</th>
{% if session.programme.nom is same as('NDPS') %}
<th>Jours</th>
{% else %}
<th>Jour</th>
{% endif %}
<th>Heure de début</th>
<th>Heure de fin</th>
<th>Type</th>
<th>Actions</th>
</tr>
<!--end::Table row-->
</thead>
<!--end::Table head-->
<!--begin::Table body-->
<tbody class="fs-6 fw-semibold text-gray-600">
{% for seance in seances %}
<tr>
<td>{{seance.nom}}</td>
{% if session.programme.nom is same as('NDPS') %}
{% set jours = seance.semainendps %}
<td>{{ jours|join(', ') }}</td>
{% else %}
<td>{{seance.jour}}</td>
{% endif %}
<td>{{seance.heuredebut.format('H:i:s')}}</td>
<td>{{seance.heurefin.format('H:i:s')}}</td>
<td>{{seance.typeseance}}</td>
<td>
<a href="{{path('app_editer_seance',{id:seance.id})}}" class="bi bi-pencil-fill fs-5" data-kt-menu-trigger="click" data-kt-menu-placement="bottom-end">
</a>
</td>
</tr>
{% endfor %}
</tbody>
<!--end::Table body-->
</table>
<!--end::Table-->
</div>
<!--end::Table wrapper-->
</div>
<!--end::Card body-->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="kt_app_footer" class="app-footer">
<!--begin::Footer container-->
<div class="app-container container-fluid d-flex flex-column flex-md-row flex-center flex-md-stack py-3">
<!--begin::Copyright-->
<div class="text-dark order-2 order-md-1">
<span class="text-muted fw-semibold me-1">2023©</span>
<a href="https://smartegy.ca/" target="_blank" class="text-gray-800 text-hover-primary">Made with <3 by smartegy</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Sélectionne le formulaire par son nom ou autre méthode
const form = document.querySelector('form[name="session"]'); // Changez "programme" selon le nom de votre formulaire
const saveButton = document.getElementById('session_Enregistrer'); // Assurez-vous que l'ID correspond à votre bouton
// Vérifie si le bouton existe
if (!saveButton) {
console.error('Button with id "session_Enregistrer" not found.');
return;
}
// Sélectionne les champs requis
const requiredFields = form.querySelectorAll('input[required], select[required], textarea[required]');
// Fonction pour vérifier si tous les champs requis sont remplis
function validateForm() {
let allFilled = true;
requiredFields.forEach(field => {
if (!field.value.trim()) {
allFilled = false;
}
});
// Activer/désactiver le bouton en fonction des champs requis
saveButton.disabled = !allFilled;
}
// Ajouter des écouteurs d'événements pour chaque champ requis
requiredFields.forEach(field => {
field.addEventListener('input', validateForm);
});
// Initialiser l'état du bouton lors du chargement de la page
validateForm();
});
</script>
{% endblock %}