Commit 5ec8059c authored by Chrystel Moreau's avatar Chrystel Moreau
Browse files

add Dashboard CLO-ADMIN + export Excel

parent dbd72560
......@@ -81,6 +81,7 @@ $container[App\Action\AdminValidRoleAction::class] = function ($c) {
return new App\Action\AdminValidRoleAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('mailer'));
};
$container[App\Action\DashboardAdminInscriptionAction::class] = function ($c) {
return new App\Action\DashboardAdminInscriptionAction($c->get('view'), $c->get('logger'), $c->get('em'));
};
......@@ -104,3 +105,15 @@ $container[App\Action\DashboardAdminSalleAction::class] = function ($c) {
$container[App\Action\DashboardAdminThematiqueAction::class] = function ($c) {
return new App\Action\DashboardAdminThematiqueAction($c->get('view'), $c->get('logger'), $c->get('em'));
};
// =============================================================
// Dashboard CLO-Admin
// =============================================================
$container[App\Action\DashboardCloAdminAction::class] = function ($c) {
return new App\Action\DashboardCloAdminAction($c->get('view'), $c->get('logger'), $c->get('em'));
};
$container[App\Action\AdminValidPaiementAction::class] = function ($c) {
return new App\Action\AdminValidPaiementAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('mailer'));
};
\ No newline at end of file
......@@ -64,6 +64,7 @@ $app->post('/admin-valid-role', App\Action\AdminValidRoleAction::class)
->add(App\Middleware\TokenMiddleware::class)
->setName('admin_valid_role');
$app->get('/dashboard-admin-inscription', App\Action\DashboardAdminInscriptionAction::class)
->add(App\Middleware\TokenMiddleware::class)
->setName('dashboard_admin_inscription');
......@@ -87,4 +88,16 @@ $app->get('/dashboard-admin-salle', App\Action\DashboardAdminSalleAction::class)
$app->get('/dashboard-admin-thematique', App\Action\DashboardAdminThematiqueAction::class)
->add(App\Middleware\TokenMiddleware::class)
->setName('dashboard_admin_thematique');
\ No newline at end of file
// =============================================================
// Dashboard CLO-ADMIN
// =============================================================
$app->get('/dashboard-clo-admin', App\Action\DashboardCloAdminAction::class)
->add(App\Middleware\TokenMiddleware::class)
->setName('dashboard_cloadmin_home');
$app->post('/admin-valid-paiement', App\Action\AdminValidPaiementAction::class)
->add(App\Middleware\TokenMiddleware::class)
->setName('admin_valid_paiement');
<?php
namespace App\Action;
use Slim\Views\Twig;
use Psr\Log\LoggerInterface;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
final class AdminValidPaiementAction
{
private $view;
private $logger;
private $em;
private $mailer;
public function __construct(Twig $view, LoggerInterface $logger, EntityManagerInterface $em, $mailer)
{
$this->view = $view;
$this->logger = $logger;
$this->em = $em;
$this->mailer = $mailer;
}
public function __invoke(Request $request, Response $response, $args)
{
$this->logger->info("admin valid paiement page action dispatched");
$params = $request->getQueryParams();
$token = $params['token'];
$valid = $params['valid'];
$roleSI = $request->getAttribute('roleSI');
if ( ($roleSI != 'admin') && ($roleSI != 'clo_admin') ) {
return $response->withStatus(401);
}
if (!array_key_exists('email', $params)) {
return $response->withStatus(400);
}
$participant = $this->getParticipant($params['email']);
if (!$participant) {
return $response->withStatus(400);
}
//$organisme = $this->getOrganisme($participant->getOrganisme()->getId());
$participant->setAccesValide($valid);
$participant->setPassPrepaye($valid);
//$organisme->setNbLibres($organisme->getNbLibres() + 1);
$this->em->flush();
$this->sendEmail($participant);
return $response;
}
private function getParticipant($email)
{
$participant = $this->em->getRepository('App\Entity\Participant')->findOneBy(array('email' => strtolower($email)));
if(isset($participant)) {
return $participant;
} else {
return true;
}
}
/*
private function getOrganisme($orga_id)
{
$dql = "SELECT o FROM App\Entity\Organisme o WHERE o.id = ".$orga_id;
$query = $this->em->createQuery($dql);
return $query->getResult();
}
*/
private function sendEmail($participant)
{
$body = 'Bonjour ' . $participant->getPrenom() . ' ' . $participant->getNom() . PHP_EOL;
$body .= PHP_EOL;
$body .= 'Votre prise en charge vient d\'être invalidé par votre organisme.' . PHP_EOL;
$body .= PHP_EOL;
$body .= 'Pour que votre inscription soit prise en compte, vous devez régler ';
$body .= 'les frais d\'inscription sur la plate-forme Azur-Colloque: https://www.azur-colloque.fr/DR12/ .' . PHP_EOL;
$body .= PHP_EOL;
$body .= 'Bien cordialement' . PHP_EOL;
$body .= 'Le comité d\'ogranisation des JDEV2017';
$message = \Swift_Message::newInstance('Validation inscription JDEV2017')
->setFrom(['noreply@jdev2017.fr' => 'jdev2017.fr'])
->setTo([$participant->getEmail()])
->setBody($body);
$this->mailer->send($message);
}
}
......@@ -69,7 +69,7 @@ final class ConnexionAction
$response = $response->write(implode(PHP_EOL, $messages))->withStatus($code);
} else {
$token = $this->generateToken($participant->getEmail(), $participant->getRoleSI());
$a = array('token' => (string) $token, 'roleSI' => $participant->getRoleSI());
$a = array('token' => (string) $token, 'roleSI' => $participant->getRoleSI(), 'orga' => $participant->getOrganisme()->getId());
$response = $response->write(json_encode($a))->withHeader('Content-type', 'application/json');;
}
}
......
<?php
namespace App\Action;
use Slim\Views\Twig;
use Psr\Log\LoggerInterface;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
final class DashboardCloAdminAction
{
private $view;
private $logger;
private $em;
public function __construct(Twig $view, LoggerInterface $logger, EntityManagerInterface $em)
{
$this->view = $view;
$this->logger = $logger;
$this->em = $em;
}
public function __invoke(Request $request, Response $response, $args)
{
$this->logger->info("dashboard admin page action dispatched");
$params = $request->getQueryParams();
$token = $params['token'];
$orga = $params['orga'];
$roleSI = $request->getAttribute('roleSI');
if ($roleSI != 'clo_admin') {
return $response->withStatus(401);
}
$participants = $this->getParticipants($orga);
$this->view->render($response, 'dashboard_cloadmin_home.twig', [
'page' => 'dashboard-clo-admin',
'token' => $token,
'participants' => $participants
]);
return $response;
}
private function getParticipants($orga)
{
$dql = "SELECT p FROM App\Entity\Participant p WHERE p.role = 'Participant' and p.organisme=".$orga." ORDER BY p.nom";
$query = $this->em->createQuery($dql);
return $query->getResult();
}
}
......@@ -94,7 +94,7 @@
<script src="bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
<script src="js/inscription.js"></script>
<script src="js/connexion.min.js"></script>
<script src="js/connexion.js"></script>
<script src="js/new_passwd.min.js"></script>
<script src="js/admin.min.js"></script>
</body>
......
......@@ -9,7 +9,9 @@
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="styles/style.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.2.4/css/buttons.dataTables.min.css">
<link rel="stylesheet" href="styles/style.css">
</head>
<body>
<header>
......@@ -67,10 +69,20 @@
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="bower_components/bootstrap-validator/dist/validator.min.js"></script>
<script src="bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.2.4/js/dataTables.buttons.min.js"></script>
<script src="http://cdn.datatables.net/buttons/1.2.4/js/buttons.html5.min.js"></script>
<script src="http:////cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script>
<script src="bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
<script src="js/inscription.js"></script>
<script src="js/connexion.min.js"></script>
<!--<script src="js/inscription.js"></script>-->
<script src="js/connexion.js"></script>
<script src="js/new_passwd.min.js"></script>
<script src="js/admin.min.js"></script>
<script src="js/admin.js"></script>
<script src="js/clo_admin.js"></script>
<!--
<script src="js/Chart.js"></script>
<script src="js/participant.js"></script>
-->
</body>
</html>
......@@ -3,7 +3,7 @@
{% block title %}Participant{% endblock %}
{% block content %}
<div class="container">
<!--
<nav class="hidden-xs hidden-sm navbar-dashboard">
<h3 class="navbar-dashboard-item-title">Dashboard Menu</h3>
<ul class="navbar-dashboard-item-list">
......@@ -18,6 +18,7 @@
</li>
</ul>
</nav>
-->
{% block content_dashboard %}{% endblock %}
......
......@@ -36,3 +36,4 @@
{% block content_dashboard_admin %}{% endblock %}
</div>
{% endblock %}
{% extends "base_backoffice.twig" %}
{% block title %}CloAdmin{% endblock %}
{% block content %}
<div class="container">
{% block content_dashboard_cloadmin %}{% endblock %}
</div>
{% endblock %}
......@@ -2,7 +2,7 @@
{% block title %}Admin{% endblock %}
{% block content_dashboard_admin %}
<div class="content-dashboard">
<div class="content-dashboard-admin">
<div class="title-main">
<div class="title-main-content">Dashboard Admin Formation</div>
</div>
......
......@@ -2,7 +2,7 @@
{% block title %}Admin{% endblock %}
{% block content_dashboard_admin %}
<div class="content-dashboard">
<div class="content-dashboard-admin">
<div class="title-main">
<div class="title-main-content">Dashboard Admin Home</div>
</div>
......
......@@ -2,7 +2,7 @@
{% block title %}Admin{% endblock %}
{% block content_dashboard_admin %}
<div class="content-dashboard">
<div class="content-dashboard-admin">
<div class="title-main">
<div class="title-main-content">Dashboard Admin Inscription</div>
</div>
......
......@@ -2,7 +2,7 @@
{% block title %}Admin{% endblock %}
{% block content_dashboard_admin %}
<div class="content-dashboard">
<div class="content-dashboard-admin">
<div class="title-main">
<div class="title-main-content">Gestion des Organismes</div>
</div>
......
......@@ -2,7 +2,7 @@
{% block title %}Admin{% endblock %}
{% block content_dashboard_admin %}
<div class="content-dashboard">
<div class="content-dashboard-admin">
<div class="title-main">
<div class="title-main-content">Gestion des Participants</div>
</div>
......@@ -12,23 +12,29 @@
<div class="table-responsive">
<table id="gparticipants" class="table table-striped table-bordered">
<thead>
<tr>
<td width="5%">Email</td>
<td width="25%">Participant</td>
<td width="30%">Organisme</td>
<td width="10%">Role</td>
<td width="5%">Statut</td>
<td>Paiement</td>
<tr>
<td>Participant</td>
<td>Email</td>
<td>Organisme</td>
<td>Region</td>
<td>Role</td>
<td>Unité</td>
<td>Emploi</td>
<td>Statut</td>
<td>Paiement</td>
</tr>
</thead>
<tbody>
{% for participant in participants %}
<tr>
<td><a href="mailto:{{ participant.getEmail() }}"><i class="fa fa-envelope-o"></i></a></td>
<td>{{ participant.getNom()|upper }} {{ participant.getPrenom() }}</td>
<td><a href="mailto:{{ participant.getEmail() }}">{{ participant.getEmail() }}</a></td>
<td>{{ participant.getOrganisme().getLabel() }}</td>
<td>{{ participant.getRegion() }}</td>
<td>{{ participant.getRole() }}</td>
<td>{{ participant.getUnite() }}</td>
<td>{{ participant.getEmploi() }}</td>
{% if participant.getRole() == 'Organisateur' %}
{% if participant.getAccesValide() == true %}
<td><i class="fa fa-check-circle-o"></i></td>
......@@ -52,7 +58,6 @@
{% endif %}
{% endif %}
</tr>
{% endfor %}
</tbody>
......
......@@ -2,7 +2,7 @@
{% block title %}Admin{% endblock %}
{% block content_dashboard_admin %}
<div class="content-dashboard">
<div class="content-dashboard-admin">
<div class="title-main">
<div class="title-main-content">Dashboard Admin Salle</div>
</div>
......
......@@ -2,7 +2,7 @@
{% block title %}Admin{% endblock %}
{% block content_dashboard_admin %}
<div class="content-dashboard">
<div class="content-dashboard-admin">
<div class="title-main">
<div class="title-main-content">Gestion des Thématiques</div>
</div>
......
{% extends "base_dashboard_cloadmin.twig" %}
{% block title %}CLOAdmin{% endblock %}
{% block content_dashboard_cloadmin %}
<div class="content-dashboard-clo-admin">
<div class="title-main">
<div class="title-main-content">Dashboard CLO-ADMIN</div>
</div>
<div>
{% if participants %}
<h4><i class="fa fa-check-square-o"></i> Gestion des Particpants</h4>
<div class="table-responsive">
<table id="tparticipants" class="table table-striped table-bordered">
<thead>
<tr>
<th>Participant</th>
<th>Email</th>
<th>Organisme</th>
<th>Region</th>
<th>Role</th>
<th>Unité</th>
<th>Emploi</th>
<th>Statut</th>
<th>Paiement</th>
<th>Validation</th>
</tr>
</thead>
<tbody>
{% for participant in participants %}
<tr>
<td>{{ participant.getNom()|upper }} {{ participant.getPrenom() }}</td>
<td><a href="mailto:{{ participant.getEmail() }}">{{ participant.getEmail() }}</a></td>
<td>{{ participant.getOrganisme().getLabel() }}</td>
<td>{{ participant.getRegion() }}</td>
<td>{{ participant.getRole() }}</td>
<td>{{ participant.getUnite() }}</td>
<td>{{ participant.getEmploi() }}</td>
{% if participant.getPassPrepaye() == true %}
<td><i class="fa fa-check-circle-o"></i></td>
<td>Place Pré-Payée</td>
{% else %}
{% if participant.getAccesValide() == true %}
<td><i class="fa fa-check-circle-o"></i></td>
<td>Azur-Colloque</td>
{% else %}
<td><i class="fa fa-credit-card"></i></td>
<td>Azur-Colloque</td>
{% endif %}
{% endif %}
<td>
{% if participant.getPassPrepaye() == true %}
<a class="btn btn-danger admin-invalid-btn" data-toggle="tooltip" data-placement="top" title="Invalider cette place Pré-Payée" href="admin-valid-paiement?email={{ participant.getEmail() }}&valid=false&token={{ token }}"><i class="fa fa-times-rectangle-o"></i></a>
{% else %}
-
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p>pas encore d'inscrits</p>
{% endif %}
</div>
</div>
{% endblock %}
......@@ -13,34 +13,43 @@
</p>
-->
<div>
<form id="form_filter" method="post" class="form-horizontal">
<div class="form-group">
<table width='100%'>
<tr>
<td>04 Juillet 2017</td>
<td>05 Juillet 2017</td>
<td>06 Juillet 2017</td>
<td>07 Juillet 2017</td>
</tr>
<tr>
<td><a id="seance04-am" href = "#" class="btn btn-info btn-sm btn-block" role ="button">Matin</a></td>
<td><a id="seance05-am" href = "#" class="btn btn-info btn-sm btn-block" role ="button">Matin</a></td>
<td><a id="seance06-am" href = "#" class="btn btn-info btn-sm btn-block" role ="button">Matin</a></td>
<td><a id="seance07-am" href = "#" class="btn btn-info btn-sm btn-block" role ="button">Matin</a></td>
</tr>
<tr>
<td><a id="seance04-pm" href = "#" class="btn btn-primary btn-sm btn-block" role ="button">Matin</a></td>
<td><a id="seance05-pm" href = "#" class="btn btn-primary btn-sm btn-block" role ="button">Matin</a></td>
<td><a id="seance06-pm" href = "#" class="btn btn-primary btn-sm btn-block" role ="button">Matin</a></td>
<td><a id="seance07-pm" href = "#" class="btn btn-primary btn-sm btn-block" role ="button">Matin</a></td>
</tr>
<div id="seances">
Pour vous inscrire, vous devez selectionner une demi-journée.<p>
<table width='100%'>
<tr>
<td>04 Juillet 2017</td>
<td>05 Juillet 2017</td>
<td>06 Juillet 2017</td>
<td>07 Juillet 2017</td>
</tr>
<tr>
<td><a id="seance04-am" href = "#" class="btn btn-info btn-sm btn-block" role ="button">Matin</a></td>
<td><a id="seance05-am" href = "#" class="btn btn-info btn-sm btn-block" role ="button">Matin</a></td>
<td><a id="seance06-am" href = "#" class="btn btn-info btn-sm btn-block" role ="button">Matin</a></td>
<td><a id="seance07-am" href = "#" class="btn btn-info btn-sm btn-block" role ="button">Matin</a></td>
</tr>
<tr>
<td><a id="seance04-pm" href = "#" class="btn btn-primary btn-sm btn-block" role ="button">Matin</a></td>
<td><a id="seance05-pm" href = "#" class="btn btn-primary btn-sm btn-block" role ="button">Matin</a></td>
<td><a id="seance06-pm" href = "#" class="btn btn-primary btn-sm btn-block" role ="button">Matin</a></td>
<td><a id="seance07-pm" href = "#" class="btn btn-primary btn-sm btn-block" role ="button">Matin</a></td>
</tr>
</table>
</div>
</table>
</div>
<hr>
<div class="panel panel-default">
<div class="panel-heading">Inscription /Atelier</div>
<div class="panel-body">
<div id="js-legend" class="chart-legend"></div>
<canvas id="pinscription" data-type="Line" width="500" height="350"></canvas>
</div>
</div>
<div id="participant_inscription" tabindex="-1" role="dialog" aria-labelledby="Login" aria-hidden="true">
<div class="modal" id="participant_inscription" tabindex="-1" role="dialog" aria-labelledby="Login" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
......
{% extends "base_dashboard.twig" %}
{% block content_dashboard %}
<div class="content-dashboard">
<div class="content-dashboard-admin">
<div class="title-main">
<div class="title-main-content">Votre parcours</div>
</div>
......
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