Commande + Rapport
This commit is contained in:
@@ -7,8 +7,12 @@ use Symfony\Component\Console\Command\Command;
|
|||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
use App\Repository\BroadcastRepository;
|
use App\Repository\BroadcastRepository;
|
||||||
|
|
||||||
|
use App\Entity\State;
|
||||||
|
|
||||||
#[AsCommand(
|
#[AsCommand(
|
||||||
name: 'investigation:broadcast',
|
name: 'investigation:broadcast',
|
||||||
description: 'Add a short description for your command',
|
description: 'Add a short description for your command',
|
||||||
@@ -16,25 +20,40 @@ use App\Repository\BroadcastRepository;
|
|||||||
class InvestigationBroadcastCommand extends Command
|
class InvestigationBroadcastCommand extends Command
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* @param EntityManagerInterface $em
|
||||||
* @param BroadcastRepository $broadcastRepository
|
* @param BroadcastRepository $broadcastRepository
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
private EntityManagerInterface $em,
|
||||||
private BroadcastRepository $broadcastRepository,
|
private BroadcastRepository $broadcastRepository,
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
$this->em = $em;
|
||||||
$this->broadcastRepository = $broadcastRepository;
|
$this->broadcastRepository = $broadcastRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
{
|
{
|
||||||
$output->writeln('Investigation Broadcast Command started');
|
|
||||||
|
|
||||||
$broadcasts = $this->broadcastRepository->findBroadcast();
|
$broadcasts = $this->broadcastRepository->findBroadcast();
|
||||||
|
|
||||||
foreach ($broadcasts as $broadcast) {
|
foreach ($broadcasts as $broadcast) {
|
||||||
|
$state = new State();
|
||||||
|
$state->setBroadcast($broadcast);
|
||||||
|
$state->setInvestigation($broadcast->getInvestigation());
|
||||||
|
$state->setProgress(2);
|
||||||
|
$state->setStep(3);
|
||||||
|
$this->em->persist($state);
|
||||||
|
$this->em->flush();
|
||||||
|
|
||||||
|
|
||||||
|
$broadcast->setLastState(32);
|
||||||
|
$this->em->persist($broadcast);
|
||||||
|
$this->em->flush();
|
||||||
|
|
||||||
|
$output->writeln('<info>'.$broadcast->getInvestigation()->getId().'</info> Investigation Broadcast');
|
||||||
}
|
}
|
||||||
|
|
||||||
$output->writeln('Investigation Broadcast Command finished');
|
|
||||||
return Command::SUCCESS;
|
return Command::SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,16 +3,50 @@
|
|||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
|
||||||
|
use App\Repository\BroadcastRepository;
|
||||||
|
|
||||||
#[Route('/rapport')]
|
#[Route('/rapport')]
|
||||||
final class RapportController extends AbstractController
|
final class RapportController extends AbstractController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @param BroadcastRepository $broadcastRepository
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
private BroadcastRepository $broadcastRepository,
|
||||||
|
) {
|
||||||
|
$this->broadcastRepository = $broadcastRepository;
|
||||||
|
}
|
||||||
|
|
||||||
#[Route('/index', name: 'app_rapport_index')]
|
#[Route('/index', name: 'app_rapport_index')]
|
||||||
public function index(): Response
|
public function index(Request $request): Response
|
||||||
{
|
{
|
||||||
return $this->render('rapport/index.html.twig', []);
|
$language = $request->getSession()->get('_locale');
|
||||||
|
|
||||||
|
$broadcasts = $this->broadcastRepository->findBroadcastByUser($this->getUser());
|
||||||
|
|
||||||
|
$listeInvestigations = [];
|
||||||
|
|
||||||
|
foreach($broadcasts as $broadcast)
|
||||||
|
{
|
||||||
|
$investigation = $broadcast->getInvestigation();
|
||||||
|
if($language == 'fr'){
|
||||||
|
$listeInvestigations[] = ['id'=>$investigation->getId(), 'name'=>$investigation->getNameFr()];
|
||||||
|
}elseif($language == 'en'){
|
||||||
|
$listeInvestigations[] = ['id'=>$investigation->getId(), 'name'=>$investigation->getNameEn()];
|
||||||
|
}elseif($language == 'ar'){
|
||||||
|
$listeInvestigations[] = ['id'=>$investigation->getId(), 'name'=>$investigation->getNameAr()];
|
||||||
|
}else{
|
||||||
|
$listeInvestigations[] = ['id'=>$investigation->getId(), 'name'=>$investigation->getNameFr()];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->render('rapport/index.html.twig', ["listeInvestigations"=>$listeInvestigations]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,4 +45,20 @@ class BroadcastRepository extends ServiceEntityRepository
|
|||||||
->getResult()
|
->getResult()
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Broadcast[] Returns an array of Broadcast objects
|
||||||
|
*/
|
||||||
|
public function findBroadcastByUser(User $user)
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('b')
|
||||||
|
->where('b.last_state = 32')
|
||||||
|
->where('b.create_by = :User')
|
||||||
|
->setParameter('User', $user)
|
||||||
|
->andWhere('b.date_start <= :DateNow')
|
||||||
|
->setParameter('DateNow', new \DateTime())
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,11 +64,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 mt-4">
|
<div class="col-md-6 mt-4">
|
||||||
<div class="iq-card-body">
|
<div class="form-group">
|
||||||
{% for child in formQtn.choice %}
|
{% for key,child in formQtn.choice %}
|
||||||
<div class="custom-control custom-radio custom-radio-color-checked custom-control-inline">
|
<div class="custom-control-inline">
|
||||||
{{ form_widget(child, {'attr': {'class': 'custom-control-input bg-success' }}) }}
|
{{ form_widget(child) }}
|
||||||
<label class="custom-control-label" for="{{ child.vars.id }}"> {{ form_label(child) }} </label>
|
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -14,21 +14,160 @@
|
|||||||
|
|
||||||
<div class="az-content-breadcrumb">
|
<div class="az-content-breadcrumb">
|
||||||
<span>Rapport</span>
|
<span>Rapport</span>
|
||||||
<span>List</span>
|
<span>Détail</span>
|
||||||
</div>
|
</div>
|
||||||
<h2 class="az-content-title">Enquête</h2>
|
<h2 class="az-content-title">Rapport</h2>
|
||||||
<div class="az-content-label mg-b-5"></div>
|
<div class="az-content-label mg-b-5"></div>
|
||||||
<p class="mg-b-20">Liste des enquêtes près a divuser</p>
|
|
||||||
|
<div class="wd-500 mg-b-20">
|
||||||
|
<select class="form-control">
|
||||||
|
{% for investigation in listeInvestigations %}
|
||||||
|
<option value="{{ investigation.id }}"> {{ investigation.name }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card card-dashboard-one">
|
||||||
|
<div class="card-header">
|
||||||
|
<div>
|
||||||
|
<label class="mg-b-0">Total des views</label>
|
||||||
|
<h2>13,956</h2>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="mg-b-0">Total des reponses</label>
|
||||||
|
<h2>33.50%</h2>
|
||||||
|
</div>
|
||||||
|
<div class="btn-group">
|
||||||
|
<button class="btn active">Excel</button>
|
||||||
|
<button class="btn">PDF</button>
|
||||||
|
<button class="btn">CSV</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- card-header -->
|
||||||
|
<div class="card-body">
|
||||||
|
<!-- card-body-top -->
|
||||||
|
<div class="flot-chart-wrapper">
|
||||||
|
<div id="flotChart" class="flot-chart"></div>
|
||||||
|
</div>
|
||||||
|
<!-- flot-chart-wrapper -->
|
||||||
|
</div>
|
||||||
|
<!-- card-body -->
|
||||||
|
</div>
|
||||||
|
<!-- card -->
|
||||||
|
|
||||||
|
|
||||||
|
<div class="card card-dashboard-five">
|
||||||
|
<div class="card-header">
|
||||||
|
<h6 class="card-title">Question 1</h6>
|
||||||
|
<span class="card-text">Tells you where your visitors originated from, such as search engines, social networks or website referrals.</span>
|
||||||
|
</div>
|
||||||
|
<!-- card-header -->
|
||||||
|
<div class="card-body row row-sm">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="az-traffic-detail-item">
|
||||||
|
<div>
|
||||||
|
<span>Organic Search</span>
|
||||||
|
<span>1,320 <span>(25%)</span></span>
|
||||||
|
</div>
|
||||||
|
<div class="progress">
|
||||||
|
<div class="progress-bar bg-purple wd-25p" role="progressbar" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
</div>
|
||||||
|
<!-- progress -->
|
||||||
|
</div>
|
||||||
|
<div class="az-traffic-detail-item">
|
||||||
|
<div>
|
||||||
|
<span>Email</span>
|
||||||
|
<span>987 <span>(20%)</span></span>
|
||||||
|
</div>
|
||||||
|
<div class="progress">
|
||||||
|
<div class="progress-bar bg-primary wd-20p" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
</div>
|
||||||
|
<!-- progress -->
|
||||||
|
</div>
|
||||||
|
<div class="az-traffic-detail-item">
|
||||||
|
<div>
|
||||||
|
<span>Referral</span>
|
||||||
|
<span>2,010 <span>(30%)</span></span>
|
||||||
|
</div>
|
||||||
|
<div class="progress">
|
||||||
|
<div class="progress-bar bg-info wd-30p" role="progressbar" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
</div>
|
||||||
|
<!-- progress -->
|
||||||
|
</div>
|
||||||
|
<div class="az-traffic-detail-item">
|
||||||
|
<div>
|
||||||
|
<span>Other</span>
|
||||||
|
<span>400 <span>(10%)</span></span>
|
||||||
|
</div>
|
||||||
|
<div class="progress">
|
||||||
|
<div class="progress-bar bg-gray-500 wd-10p" role="progressbar" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100"></div>
|
||||||
|
</div>
|
||||||
|
<!-- progress -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- card-body -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% block javascripts %}
|
||||||
|
<script src="{{ asset('assets/js/chart.flot.sampledata.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/js/dashboard.sampledata.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/lib/chart.js/Chart.bundle.min.js') }}"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
var plot = $.plot('#flotChart', [{
|
||||||
|
data: flotSampleData3,
|
||||||
|
color: '#007bff',
|
||||||
|
lines: {
|
||||||
|
fillColor: { colors: [{ opacity: 0 }, { opacity: 0.2 }]}
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
data: flotSampleData4,
|
||||||
|
color: '#560bd0',
|
||||||
|
lines: {
|
||||||
|
fillColor: { colors: [{ opacity: 0 }, { opacity: 0.2 }]}
|
||||||
|
}
|
||||||
|
}], {
|
||||||
|
series: {
|
||||||
|
shadowSize: 0,
|
||||||
|
lines: {
|
||||||
|
show: true,
|
||||||
|
lineWidth: 2,
|
||||||
|
fill: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
borderWidth: 0,
|
||||||
|
labelMargin: 8
|
||||||
|
},
|
||||||
|
yaxis: {
|
||||||
|
show: true,
|
||||||
|
min: 0,
|
||||||
|
max: 100,
|
||||||
|
ticks: [[0,''],[20,'20K'],[40,'40K'],[60,'60K'],[80,'80K']],
|
||||||
|
tickColor: '#eee'
|
||||||
|
},
|
||||||
|
xaxis: {
|
||||||
|
show: true,
|
||||||
|
color: '#fff',
|
||||||
|
ticks: [[25,'OCT 21'],[75,'OCT 22'],[100,'OCT 23'],[125,'OCT 24']],
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user