Commit 0679a28f authored by Chrystel Moreau's avatar Chrystel Moreau
Browse files

Gestion Inscription participant-agenda => DONE

parent 46272225
......@@ -44,8 +44,8 @@ final class DashboardInscriptionAction
$agendas = $this->getAgendas($params['jour'],$params['debut'],$params['fin'],$participant->getId());
$a['agendas'] = $agendas;
// ajouter la possibilité de s'inscrire QUE si pas d'inscription su la demi-journée
$inscription = $this->getInscriptionAgenda($params['jour'],$params['debut'],$params['fin'],$participant->getId());
$a['inscription'] = $inscription;
}
$this->view->render($response, 'dashboard_inscription.twig', $a);
......@@ -74,8 +74,7 @@ final class DashboardInscriptionAction
$dql = "SELECT a,";
$dql .= "(select count(pa) from App\Entity\ParticipantAgenda pa where pa.agenda=a.id) as nb_inscrits, ";
$dql .= "(select count(p2) from App\Entity\ParticipantAgenda p2 where p2.agenda=a.id and p2.participant=$id) as check, ";
$dql .= "(select count(p3) from App\Entity\ParticipantAgenda p3 where p3.participant=$id) as inscrit ";
$dql .= "(select count(p2) from App\Entity\ParticipantAgenda p2 where p2.agenda=a.id and p2.participant=$id) as check ";
$dql .= "FROM App\Entity\Agenda a ";
$dql .= "WHERE a.dateDebut between '$date_debut' and '$date_fin' and a.dateFin between '$date_debut' and '$date_fin'";
$query = $this->em->createQuery($dql);
......@@ -83,9 +82,13 @@ final class DashboardInscriptionAction
}
public function getInscriptionAgenda($id_participant) {
//$dql = "SELECT a FROM App\Entity\ParticipantAgenda a LEFT JOIN a.participants p WHERE a.agenda = $id_agenda";
$dql = "SELECT count(pa) FROM App\Entity\ParticipantAgenda pa WHERE pa.participant = $id_participant";
public function getInscriptionAgenda($jour,$debut,$fin,$id) {
$date_debut=$jour." ".$debut;
$date_fin=$jour." ".$fin;
$dql = "SELECT pa from App\Entity\ParticipantAgenda pa LEFT JOIN pa.agenda a ";
$dql .= "WHERE pa.participant=$id ";
$dql .= "AND a.dateDebut between '$date_debut' and '$date_fin' and a.dateFin between '$date_debut' and '$date_fin'";
$query = $this->em->createQuery($dql);
return $query->getResult();
}
......
......@@ -48,8 +48,7 @@ final class ParticipantInscriptionFormationAction
$inscription->setAgenda($agenda[0]);
$ladate=date_create_from_format('d/m/Y H:i', '04/07/17 14:00');
$inscription->setDateInscription($ladate);
//var_dump($agenda[0]);
//exit();
$this->em->persist($inscription);
$this->em->flush();
}
......
......@@ -7,43 +7,36 @@
</div>
<div>
<!--
<p style="text-align: center"><i class="fa fa-calendar"></i> <i>ouverture des inscriptions aux ateliers
à partir du 30 avril 2017</i>
</p>
-->
<div id="seances">
Pour vous inscrire, vous devez selectionner une demi-journée.<p>
<form id="form_inscription">
<input type="hidden" id="token" name="token" value="{{ token }}">
<table width='100%'>
<tr>
<td><a href="dashboard-inscription?token={{ token }}&jour=2017-07-04&debut=08:00:00&fin=13:00:00" id="2017-07-04_am" class="btn btn-info btn-sm btn-block btn-jour">04 Juillet 2017 - Matin</a></td>
<td><button id="2017-07-05_am" class="btn btn-info btn-sm btn-block">05 Juillet 2017 - Matin</button></td>
<td><button id="2017-07-06_am" class="btn btn-info btn-sm btn-block">07 Juillet 2017 - Matin</button></td>
<td><button id="2017-07-07_am" class="btn btn-info btn-sm btn-block">08 Juillet 2017 - Matin</button></td>
</tr>
<tr>
<td><button id="2017-07-04_pm" class="btn btn-primary btn-sm btn-block">04 Juillet 2017 - Après-midi</button></td>
<td><button id="2017-07-05_pm" class="btn btn-primary btn-sm btn-block">05 Juillet 2017 - Après-midi</button></td>
<td><button id="2017-07-06_pm" class="btn btn-primary btn-sm btn-block">06 Juillet 2017 - Après-midi</button></td>
<td><button id="2017-07-07_pm" class="btn btn-primary btn-sm btn-block">07 Juillet 2017 - Après-midi</button></td>
</tr>
</table>
</form>
</div>
<hr>
<div id="seances">
Pour vous inscrire, vous devez selectionner une demi-journée.<p>
<form id="form_inscription">
<input type="hidden" id="token" name="token" value="{{ token }}">
<table width='100%'>
<tr>
<td><a href="dashboard-inscription?token={{ token }}&jour=2017-07-04&debut=08:00:00&fin=13:00:00" class="btn btn-info btn-sm btn-block btn-jour">04 Juillet 2017 - Matin</a></td>
<td><a href="dashboard-inscription?token={{ token }}&jour=2017-07-05&debut=08:00:00&fin=13:00:00" class="btn btn-info btn-sm btn-block btn-jour">05 Juillet 2017 - Matin</a></td>
<td><a href="dashboard-inscription?token={{ token }}&jour=2017-07-06&debut=08:00:00&fin=13:00:00" class="btn btn-info btn-sm btn-block btn-jour">06 Juillet 2017 - Matin</a></td>
<td><a href="dashboard-inscription?token={{ token }}&jour=2017-07-07&debut=08:00:00&fin=13:00:00" class="btn btn-info btn-sm btn-block btn-jour">07 Juillet 2017 - Matin</a></td>
</tr>
<tr>
<td><a href="dashboard-inscription?token={{ token }}&jour=2017-07-04&debut=13:00:00&fin=19:00:00" class="btn btn-primary btn-sm btn-block btn-jour">04 Juillet 2017 - Après-Midi</a></td>
<td><a href="dashboard-inscription?token={{ token }}&jour=2017-07-05&debut=13:00:00&fin=19:00:00" class="btn btn-primary btn-sm btn-block btn-jour">05 Juillet 2017 - Après-Midi</a></td>
<td><a href="dashboard-inscription?token={{ token }}&jour=2017-07-06&debut=13:00:00&fin=19:00:00" class="btn btn-primary btn-sm btn-block btn-jour">06 Juillet 2017 - Après-Midi</a></td>
<td><a href="dashboard-inscription?token={{ token }}&jour=2017-07-07&debut=13:00:00&fin=19:00:00" class="btn btn-primary btn-sm btn-block btn-jour">07 Juillet 2017 - Après-Midi</a></td>
</tr>
</table>
</form>
</div>
<div class="panel panel-default">
<div class="panel-heading" id="panel-inscription">Inscription / Session : {{ jour }}</div>
<div class="panel-body">
<div id="inscription">
{% if agendas %}
<hr>
<div class="panel panel-default" id="inscription">
<div class="panel-heading" id="panel-inscription">Inscription / Session : {{ jour }}</div>
<div class="panel-body">
<div>
{% if agendas %}
<table id="tab_agenda" class="table table-striped table-bordered">
<thead>
<tr>
......@@ -76,17 +69,17 @@
<td>{{ ((agenda.nb_inscrits / quota) * 100) | round }}</td>
<td class="text-center">
{% if agenda.check == 0 %}
{% if agenda.inscrit == 1 %}
-
{% if inscription %}
{% else %}
<a href="dashboard-inscription-formation?token={{token}}&agenda={{id_agenda}}&valid=true"
class="btn fa fa-check-square-o btn-treehouse btn-inscription-formation"
data-toggle="tooltip" title="M'inscrire à cette formation">
class="btn btn-success btn-inscription-formation"
data-toggle="tooltip" title="M'inscrire à cette formation">M'inscrire
</a>
{% endif %}
{% else %}
Inscrit &nbsp;
<a href="dashboard-inscription-formation?token={{token}}&agenda={{id_agenda}}&valid=false"
class="btn fa fa-warning btn-danger btn-delete-inscription-formation"
class="btn fa fa-times btn-danger btn-delete-inscription-formation"
data-toggle="tooltip" title="Me désinscrire de cette formation">
</a>
{% endif %}
......@@ -96,12 +89,13 @@
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
<!--
<canvas id="plot" data-type="Line" width="500" height="350"></canvas>
-->
{% else %}
{% endif %}
</div>
<!--
<canvas id="plot" data-type="Line" width="500" height="350"></canvas>
-->
</div>
</div>
......
$(document).ready(function(){
$('.btn-jour').on('click', function(e) {
//$('#inscription').show("fast");
});
$('.btn-inscription-formation').on('click', function(e) {
e.preventDefault();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment