Commit a025bf64 authored by Chrystel Moreau's avatar Chrystel Moreau

debug pb inscription Agenda et Ajout formation ds agenda

parent c3338791
Pipeline #2776 passed with stages
in 5 minutes and 41 seconds
...@@ -103,7 +103,7 @@ $container[App\Action\DashboardParticipantSessionsRefreshAction::class] = functi ...@@ -103,7 +103,7 @@ $container[App\Action\DashboardParticipantSessionsRefreshAction::class] = functi
}; };
$container[App\Action\DashboardParticipantParcoursFormationAction::class] = function ($c) { $container[App\Action\DashboardParticipantParcoursFormationAction::class] = function ($c) {
return new App\Action\DashboardParticipantParcoursFormationAction($c->get('view'), $c->get('logger'), $c->get('em')); return new App\Action\DashboardParticipantParcoursFormationAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
}; };
$container[App\Action\DashboardParticipantAgendaAction::class] = function ($c) { $container[App\Action\DashboardParticipantAgendaAction::class] = function ($c) {
......
...@@ -46,6 +46,7 @@ final class DashboardAdminAgendaFormAction ...@@ -46,6 +46,7 @@ final class DashboardAdminAgendaFormAction
if ($request->isGet()) { if ($request->isGet()) {
$formations = $this->getFormations(); $formations = $this->getFormations();
$agenda=null;
$a = [ $a = [
'page' => 'dashboard', 'page' => 'dashboard',
...@@ -75,6 +76,7 @@ final class DashboardAdminAgendaFormAction ...@@ -75,6 +76,7 @@ final class DashboardAdminAgendaFormAction
} else { } else {
$salles = $this->getSalles($debut->format('Y-m-d H:i:s'), $fin->format('Y-m-d H:i:s'), $quota); $salles = $this->getSalles($debut->format('Y-m-d H:i:s'), $fin->format('Y-m-d H:i:s'), $quota);
} }
//$salle = $this->getSalleById($id_salle); //$salle = $this->getSalleById($id_salle);
//$salles = array_merge(array($salle), $this->getSalles($debut->format('Y-m-d H:i:s'), $fin->format('Y-m-d H:i:s'),$quota)); //$salles = array_merge(array($salle), $this->getSalles($debut->format('Y-m-d H:i:s'), $fin->format('Y-m-d H:i:s'),$quota));
$response = $response->write(json_encode($salles))->withHeader('Content-type', 'application/json'); $response = $response->write(json_encode($salles))->withHeader('Content-type', 'application/json');
...@@ -170,5 +172,6 @@ final class DashboardAdminAgendaFormAction ...@@ -170,5 +172,6 @@ final class DashboardAdminAgendaFormAction
$dql = "SELECT s FROM App\Entity\Salle s WHERE s.id = $id"; $dql = "SELECT s FROM App\Entity\Salle s WHERE s.id = $id";
$query = $this->em->createQuery($dql); $query = $this->em->createQuery($dql);
return $query->getArrayResult()[0]; return $query->getArrayResult()[0];
//return $query->getArrayResult();
} }
} }
...@@ -22,12 +22,14 @@ final class DashboardParticipantParcoursFormationAction ...@@ -22,12 +22,14 @@ final class DashboardParticipantParcoursFormationAction
private $view; private $view;
private $logger; private $logger;
private $em; private $em;
private $settings;
public function __construct(Twig $view, LoggerInterface $logger, EntityManagerInterface $em) public function __construct(Twig $view, LoggerInterface $logger, EntityManagerInterface $em, $settings)
{ {
$this->view = $view; $this->view = $view;
$this->logger = $logger; $this->logger = $logger;
$this->em = $em; $this->em = $em;
$this->settings = $settings;
} }
public function __invoke(Request $request, Response $response, $args) public function __invoke(Request $request, Response $response, $args)
...@@ -85,15 +87,7 @@ final class DashboardParticipantParcoursFormationAction ...@@ -85,15 +87,7 @@ final class DashboardParticipantParcoursFormationAction
'participant' => $participant, 'participant' => $participant,
]; ];
// $a['pa_4_am'] = $this->getParcours('2017-07-04', '08:00:00', '13:00:00', $participant->getId());
// $a['pa_4_pm'] = $this->getParcours('2017-07-04', '12:00:00', '19:00:00', $participant->getId());
// $a['pa_5_am'] = $this->getParcours('2017-07-05', '08:00:00', '13:00:00', $participant->getId());
// $a['pa_5_pm'] = $this->getParcours('2017-07-05', '12:00:00', '19:00:00', $participant->getId());
// $a['pa_6_am'] = $this->getParcours('2017-07-06', '08:00:00', '13:00:00', $participant->getId());
// $a['pa_6_pm'] = $this->getParcours('2017-07-06', '12:00:00', '19:00:00', $participant->getId());
// $a['pa_7_am'] = $this->getParcours('2017-07-07', '08:00:00', '13:00:00', $participant->getId());
// $a['pa_7_pm'] = $this->getParcours('2017-07-07', '12:00:00', '19:00:00', $participant->getId());
// Attention chgt 2020 !!!!
$a['pa_am'][0] = $this->getParcours($this->settings['jdev']['j1'], '08:00:00', '13:00:00', $participant->getId()); $a['pa_am'][0] = $this->getParcours($this->settings['jdev']['j1'], '08:00:00', '13:00:00', $participant->getId());
$a['pa_pm'][0] = $this->getParcours($this->settings['jdev']['j1'], '12:00:00', '19:00:00', $participant->getId()); $a['pa_pm'][0] = $this->getParcours($this->settings['jdev']['j1'], '12:00:00', '19:00:00', $participant->getId());
$a['pa_am'][1] = $this->getParcours($this->settings['jdev']['j2'], '08:00:00', '13:00:00', $participant->getId()); $a['pa_am'][1] = $this->getParcours($this->settings['jdev']['j2'], '08:00:00', '13:00:00', $participant->getId());
...@@ -108,6 +102,7 @@ final class DashboardParticipantParcoursFormationAction ...@@ -108,6 +102,7 @@ final class DashboardParticipantParcoursFormationAction
return $response; return $response;
} }
private function getParticipant($email) private function getParticipant($email)
{ {
$participant = $this->em->getRepository('App\Entity\Participant')->findOneBy(array('email' => $email)); $participant = $this->em->getRepository('App\Entity\Participant')->findOneBy(array('email' => $email));
...@@ -136,7 +131,8 @@ final class DashboardParticipantParcoursFormationAction ...@@ -136,7 +131,8 @@ final class DashboardParticipantParcoursFormationAction
{ {
$date_debut = $jour . " " . $debut; $date_debut = $jour . " " . $debut;
$date_fin = $jour . " " . $fin; $date_fin = $jour . " " . $fin;
//$date_debut = "2020-07-06 " . $debut;
//$date_fin = "2020-07-06 " . $fin;
$dql = "SELECT pa FROM App\Entity\ParticipantAgenda pa LEFT JOIN pa.agenda a "; $dql = "SELECT pa FROM App\Entity\ParticipantAgenda pa LEFT JOIN pa.agenda a ";
$dql .= "WHERE pa.participant=$id "; $dql .= "WHERE pa.participant=$id ";
$dql .= "AND a.dateDebut between '$date_debut' and '$date_fin' and a.dateFin between '$date_debut' and '$date_fin'"; $dql .= "AND a.dateDebut between '$date_debut' and '$date_fin' and a.dateFin between '$date_debut' and '$date_fin'";
...@@ -150,6 +146,9 @@ final class DashboardParticipantParcoursFormationAction ...@@ -150,6 +146,9 @@ final class DashboardParticipantParcoursFormationAction
$date_fin = $jour . " " . $fin; $date_fin = $jour . " " . $fin;
$date_gtsoir = $jour . " 17:00:00"; $date_gtsoir = $jour . " 17:00:00";
//$date_debut = "2020-07-06 " . $debut;
//$date_fin = "2020-07-06 " . $fin;
//$date_gtsoir = "2020-07-06 17:00:00";
$dql = "SELECT pa FROM App\Entity\ParticipantAgenda pa LEFT JOIN pa.agenda a "; $dql = "SELECT pa FROM App\Entity\ParticipantAgenda pa LEFT JOIN pa.agenda a ";
$dql .= "WHERE pa.participant=$id "; $dql .= "WHERE pa.participant=$id ";
$dql .= "AND a.dateDebut between '$date_debut' and '$date_fin' and a.dateFin between '$date_debut' and '$date_fin'"; $dql .= "AND a.dateDebut between '$date_debut' and '$date_fin' and a.dateFin between '$date_debut' and '$date_fin'";
......
...@@ -93,11 +93,12 @@ ...@@ -93,11 +93,12 @@
{% set prct = ((agenda.nb_inscrits / quota) * 100) | round %} {% set prct = ((agenda.nb_inscrits / quota) * 100) | round %}
<span class="badge badge-{% if prct <= 50 %}vert{% elseif prct > 50 and prct <= 75 %}orange{% else %}rouge{% endif %}">{{ prct }}%</span> <span class="badge badge-{% if prct <= 50 %}vert{% elseif prct > 50 and prct <= 75 %}orange{% else %}rouge{% endif %}">{{ prct }}%</span>
</td> </td>
<td class="text-center" id="action_{{ id_agenda }}"> <td class="text-center" id="action_{{ id_agenda }}">
{% if agenda.check == 0 %} {% if agenda.check == 0 %}
{% set gt_h_debut = agenda['agenda'].getDateDebut() | date("H") %} {% set gt_h_debut = agenda['agenda'].getDateDebut() | date("H") %}
{% if agenda['agenda'].getFormation().getType() == 'Groupe de Travail' and gt_h_debut >= 17 %} {% if agenda['agenda'].getFormation().getType() == 'Groupe de Travail' and gt_h_debut >= 17 %}
{% if nbgt17 < 1 %} {% if nbgt17 < 1 %}
<input type="hidden" id="vinscrit_{{ id_agenda }}" value="2"> <input type="hidden" id="vinscrit_{{ id_agenda }}" value="2">
{% if prct < 100 %} {% if prct < 100 %}
<a href="dashboard-participant-parcours-formation?token={{token}}&agenda={{id_agenda}}&valid=true&jour={{jour}}&debut={{debut}}&fin={{fin}}" <a href="dashboard-participant-parcours-formation?token={{token}}&agenda={{id_agenda}}&valid=true&jour={{jour}}&debut={{debut}}&fin={{fin}}"
......
...@@ -1388,7 +1388,7 @@ $(document).ready(function() { ...@@ -1388,7 +1388,7 @@ $(document).ready(function() {
}); });
$('#datepicker,#fin-timepicker,#debut-timepicker').on('change', function () { $('#datepicker,#fin-timepicker,#debut-timepicker').on('change', function () {
if ( ($('#debut-timepicker').val() !== '') && ($('#fin-timepicker').val() !== '') && ($('#datepicker').val() !== '')){ if ( ($('#debut-timepicker').val() !== '') && ($('#fin-timepicker').val() !== '') && ($('#datepicker').val() !== '')){
$.ajax({ $.ajax({
//url: "dashboard-admin-agenda-form?token="+$("#token").val()+"&agenda_id="+$('#agenda_id').val()+"&quota="+$('#quota').val()+"&jour="+$('#datepicker').val()+"&debut="+$('#debut-timepicker').val()+"&fin="+$('#fin-timepicker').val(), //url: "dashboard-admin-agenda-form?token="+$("#token").val()+"&agenda_id="+$('#agenda_id').val()+"&quota="+$('#quota').val()+"&jour="+$('#datepicker').val()+"&debut="+$('#debut-timepicker').val()+"&fin="+$('#fin-timepicker').val(),
url: "dashboard-admin-agenda-form?token="+$("#token").val()+"&quota="+$('#quota').val()+"&jour="+$('#datepicker').val()+"&debut="+$('#debut-timepicker').val()+"&fin="+$('#fin-timepicker').val(), url: "dashboard-admin-agenda-form?token="+$("#token").val()+"&quota="+$('#quota').val()+"&jour="+$('#datepicker').val()+"&debut="+$('#debut-timepicker').val()+"&fin="+$('#fin-timepicker').val(),
...@@ -1397,6 +1397,7 @@ $(document).ready(function() { ...@@ -1397,6 +1397,7 @@ $(document).ready(function() {
$('#salle option').remove(); $('#salle option').remove();
var val_proj=0; var val_proj=0;
//console.log(salles);
$.each(salles, function (key, val) { $.each(salles, function (key, val) {
val_proj=val['videoprojecteur']? 1 : 0; val_proj=val['videoprojecteur']? 1 : 0;
$('#salle').append($('<option></option>', { $('#salle').append($('<option></option>', {
...@@ -1405,7 +1406,8 @@ $(document).ready(function() { ...@@ -1405,7 +1406,8 @@ $(document).ready(function() {
})); }));
}); });
}, },
error: function() { error: function(xhr, ajaxOptions, thrownError) {
//console.log(xhr.responseText);
alert('PB recupérartion des salles'); alert('PB recupérartion des salles');
} }
}); });
......
...@@ -199,7 +199,8 @@ $(document).ready(function(){ ...@@ -199,7 +199,8 @@ $(document).ready(function(){
success: function(text) { success: function(text) {
location.reload(); location.reload();
}, },
error: function() { error: function(xhr, ajaxOptions, thrownError) {
console.log(xhr.responseText);
alert('PB inscription'); alert('PB inscription');
} }
}); });
......
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