Commit 3026dff1 authored by François Agneray's avatar François Agneray

Merge branch 'develop' into 'master'

Develop

See merge request !42
parents e552dda8 a4c79b9c
......@@ -103,7 +103,7 @@ $container[App\Action\DashboardParticipantSessionsRefreshAction::class] = functi
};
$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) {
......
......@@ -46,6 +46,7 @@ final class DashboardAdminAgendaFormAction
if ($request->isGet()) {
$formations = $this->getFormations();
$agenda=null;
$a = [
'page' => 'dashboard',
......@@ -75,6 +76,7 @@ final class DashboardAdminAgendaFormAction
} else {
$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);
//$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');
......@@ -170,5 +172,6 @@ final class DashboardAdminAgendaFormAction
$dql = "SELECT s FROM App\Entity\Salle s WHERE s.id = $id";
$query = $this->em->createQuery($dql);
return $query->getArrayResult()[0];
//return $query->getArrayResult();
}
}
......@@ -22,12 +22,14 @@ final class DashboardParticipantParcoursFormationAction
private $view;
private $logger;
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->logger = $logger;
$this->em = $em;
$this->settings = $settings;
}
public function __invoke(Request $request, Response $response, $args)
......@@ -65,7 +67,7 @@ final class DashboardParticipantParcoursFormationAction
// verification du nb inscrits par rapport au quota
if ($nb_inscrits != $quota) {
// verification du nb d'inscription par 1/2 journée
if (count($allParticipantAgenda) < 1 || $agenda[0]->getFormation()->getType() == 'Groupe de Travail') {
//if (count($allParticipantAgenda) < 1 || $agenda[0]->getFormation()->getType() == 'Groupe de Travail') {
$inscription = new \App\Entity\ParticipantAgenda();
$inscription->setParticipant($participant);
$inscription->setAgenda($agenda[0]);
......@@ -75,7 +77,7 @@ final class DashboardParticipantParcoursFormationAction
$this->em->persist($inscription);
$this->em->flush();
}
//}
}
}
......@@ -85,15 +87,7 @@ final class DashboardParticipantParcoursFormationAction
'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_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());
......@@ -136,7 +130,8 @@ final class DashboardParticipantParcoursFormationAction
{
$date_debut = $jour . " " . $debut;
$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 .= "WHERE pa.participant=$id ";
$dql .= "AND a.dateDebut between '$date_debut' and '$date_fin' and a.dateFin between '$date_debut' and '$date_fin'";
......@@ -150,6 +145,9 @@ final class DashboardParticipantParcoursFormationAction
$date_fin = $jour . " " . $fin;
$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 .= "WHERE pa.participant=$id ";
$dql .= "AND a.dateDebut between '$date_debut' and '$date_fin' and a.dateFin between '$date_debut' and '$date_fin'";
......
......@@ -87,41 +87,17 @@
</td>
<td class="text-center" id="action_{{ id_agenda }}">
{% if agenda.check == 0 %}
{% set gt_h_debut = agenda['agenda'].getDateDebut() | date("H") %}
{% if agenda['agenda'].getFormation().getType() == 'Groupe de Travail' and gt_h_debut >= 17 %}
{% if nbgt17 < 1 %}
<input type="hidden" id="vinscrit_{{ id_agenda }}" value="2">
{% if prct < 100 %}
<a href="dashboard-participant-parcours-formation?token={{token}}&agenda={{id_agenda}}&valid=true&jour={{jour}}&debut={{debut}}&fin={{fin}}"
class="btn btn-success btn-inscription-formation"
data-toggle="tooltip" title="S'inscrire à cette formation">S'inscrire
</a>
{% else %}
<a style="display:none" href="dashboard-participant-parcours-formation?token={{token}}&agenda={{id_agenda}}&valid=true&jour={{jour}}&debut={{debut}}&fin={{fin}}"
class="btn btn-success btn-inscription-formation"
data-toggle="tooltip" title="S'inscrire à cette formation">S'inscrire
</a>
{% endif %}
{% endif %}
{% elseif nb_inscriptions > 1 %}
{% elseif inscription and inscription.getAgenda().getFormation().getType() != 'Groupe de Travail' %}
{% elseif inscription
and (agenda['agenda'].getFormation().getType() != 'Groupe de Travail'
or (agenda['agenda'].getDateDebut() == inscription.getAgenda().getDateDebut() and agenda['agenda'].getDateFin() == inscription.getAgenda().getDateFin()))
%}
{% else %}
<input type="hidden" id="vinscrit_{{ id_agenda }}" value="2">
{% if prct < 100 %}
<input type="hidden" id="vinscrit_{{ id_agenda }}" value="2">
{% if prct < 100 %}
<a href="dashboard-participant-parcours-formation?token={{token}}&agenda={{id_agenda}}&valid=true&jour={{jour}}&debut={{debut}}&fin={{fin}}"
class="btn btn-success btn-inscription-formation"
data-toggle="tooltip" title="S'inscrire à cette formation">S'inscrire
</a>
{% else %}
{% else %}
<a style="display:none" href="dashboard-participant-parcours-formation?token={{token}}&agenda={{id_agenda}}&valid=true&jour={{jour}}&debut={{debut}}&fin={{fin}}"
class="btn btn-success btn-inscription-formation"
data-toggle="tooltip" title="S'inscrire à cette formation">S'inscrire
</a>
{% endif %}
{% endif %}
{% else %}
Inscrit &nbsp;
......
......@@ -93,45 +93,20 @@
{% 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>
</td>
<td class="text-center" id="action_{{ id_agenda }}">
<td class="text-center" id="action_{{ id_agenda }}">
{% if agenda.check == 0 %}
{% set gt_h_debut = agenda['agenda'].getDateDebut() | date("H") %}
{% if agenda['agenda'].getFormation().getType() == 'Groupe de Travail' and gt_h_debut >= 17 %}
{% if nbgt17 < 1 %}
<input type="hidden" id="vinscrit_{{ id_agenda }}" value="2">
{% if prct < 100 %}
<a href="dashboard-participant-parcours-formation?token={{token}}&agenda={{id_agenda}}&valid=true&jour={{jour}}&debut={{debut}}&fin={{fin}}"
class="btn btn-success btn-inscription-formation"
data-toggle="tooltip" title="S'inscrire à cette formation">S'inscrire
</a>
{% else %}
<a style="display:none" href="dashboard-participant-parcours-formation?token={{token}}&agenda={{id_agenda}}&valid=true&jour={{jour}}&debut={{debut}}&fin={{fin}}"
class="btn btn-success btn-inscription-formation"
data-toggle="tooltip" title="S'inscrire à cette formation">S'inscrire
</a>
{% endif %}
{% endif %}
{% elseif nb_inscriptions > 1 %}
{% elseif inscription and inscription.getAgenda().getFormation().getType() != 'Groupe de Travail' %}
{% elseif inscription
and (agenda['agenda'].getFormation().getType() != 'Groupe de Travail'
or (agenda['agenda'].getDateDebut() == inscription.getAgenda().getDateDebut() and agenda['agenda'].getDateFin() == inscription.getAgenda().getDateFin()))
%}
{% else %}
<input type="hidden" id="vinscrit_{{ id_agenda }}" value="2">
{% if prct < 100 %}
<input type="hidden" id="vinscrit_{{ id_agenda }}" value="2">
{% if prct < 100 %}
<a href="dashboard-participant-parcours-formation?token={{token}}&agenda={{id_agenda}}&valid=true&jour={{jour}}&debut={{debut}}&fin={{fin}}"
class="btn btn-success btn-inscription-formation"
data-toggle="tooltip" title="S'inscrire à cette formation">S'inscrire
</a>
{% else %}
{% else %}
<a style="display:none" href="dashboard-participant-parcours-formation?token={{token}}&agenda={{id_agenda}}&valid=true&jour={{jour}}&debut={{debut}}&fin={{fin}}"
class="btn btn-success btn-inscription-formation"
data-toggle="tooltip" title="S'inscrire à cette formation">S'inscrire
</a>
{% endif %}
</a>
{% endif %}
{% else %}
Inscrit &nbsp;
......
......@@ -1388,7 +1388,7 @@ $(document).ready(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({
//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(),
......@@ -1397,6 +1397,7 @@ $(document).ready(function() {
$('#salle option').remove();
var val_proj=0;
//console.log(salles);
$.each(salles, function (key, val) {
val_proj=val['videoprojecteur']? 1 : 0;
$('#salle').append($('<option></option>', {
......@@ -1405,7 +1406,8 @@ $(document).ready(function() {
}));
});
},
error: function() {
error: function(xhr, ajaxOptions, thrownError) {
//console.log(xhr.responseText);
alert('PB recupérartion des salles');
}
});
......
......@@ -199,7 +199,8 @@ $(document).ready(function(){
success: function(text) {
location.reload();
},
error: function() {
error: function(xhr, ajaxOptions, thrownError) {
console.log(xhr.responseText);
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