diff --git a/README.md b/README.md
index e69de29..53f0db6 100644
--- a/README.md
+++ b/README.md
@@ -0,0 +1,2 @@
+--------------------Rapport-------------------
+
diff --git a/src/Command/InvestigationBroadcastCommand.php b/src/Command/InvestigationBroadcastCommand.php
index 0a79b9f..3f42c84 100644
--- a/src/Command/InvestigationBroadcastCommand.php
+++ b/src/Command/InvestigationBroadcastCommand.php
@@ -7,8 +7,12 @@ use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Doctrine\ORM\EntityManagerInterface;
+
use App\Repository\BroadcastRepository;
+use App\Entity\State;
+
#[AsCommand(
name: 'investigation:broadcast',
description: 'Add a short description for your command',
@@ -16,25 +20,40 @@ use App\Repository\BroadcastRepository;
class InvestigationBroadcastCommand extends Command
{
/**
+ * @param EntityManagerInterface $em
* @param BroadcastRepository $broadcastRepository
*/
public function __construct(
+ private EntityManagerInterface $em,
private BroadcastRepository $broadcastRepository,
) {
parent::__construct();
+ $this->em = $em;
$this->broadcastRepository = $broadcastRepository;
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
- $output->writeln('Investigation Broadcast Command started');
-
$broadcasts = $this->broadcastRepository->findBroadcast();
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(''.$broadcast->getInvestigation()->getId().' Investigation Broadcast');
}
- $output->writeln('Investigation Broadcast Command finished');
+
return Command::SUCCESS;
}
}
diff --git a/src/Controller/RapportController.php b/src/Controller/RapportController.php
index 91d0480..feb3173 100644
--- a/src/Controller/RapportController.php
+++ b/src/Controller/RapportController.php
@@ -3,16 +3,50 @@
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+
+use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
+
use Symfony\Component\Routing\Attribute\Route;
+use App\Repository\BroadcastRepository;
+
#[Route('/rapport')]
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')]
- 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]);
}
diff --git a/src/Repository/BroadcastRepository.php b/src/Repository/BroadcastRepository.php
index 3366e75..c924abd 100644
--- a/src/Repository/BroadcastRepository.php
+++ b/src/Repository/BroadcastRepository.php
@@ -45,4 +45,20 @@ class BroadcastRepository extends ServiceEntityRepository
->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()
+ ;
+ }
}
diff --git a/templates/investigation/form-question.html.twig b/templates/investigation/form-question.html.twig
index 62540e1..e0a0b0a 100644
--- a/templates/investigation/form-question.html.twig
+++ b/templates/investigation/form-question.html.twig
@@ -64,13 +64,12 @@
-
- {% for child in formQtn.choice %}
-
- {{ form_widget(child, {'attr': {'class': 'custom-control-input bg-success' }}) }}
-
-
- {% endfor %}
+
diff --git a/templates/rapport/index.html.twig b/templates/rapport/index.html.twig
index 27e64f5..547cd59 100644
--- a/templates/rapport/index.html.twig
+++ b/templates/rapport/index.html.twig
@@ -14,21 +14,160 @@
Rapport
- List
+ Détail
- Enquête
+ Rapport
- Liste des enquêtes près a divuser
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Organic Search
+ 1,320 (25%)
+
+
+
+
+
+
+ Email
+ 987 (20%)
+
+
+
+
+
+
+ Referral
+ 2,010 (30%)
+
+
+
+
+
+
+ Other
+ 400 (10%)
+
+
+
+
+
+
+
+
-
+{% block javascripts %}
+
+
+
+
+ {% endblock %}
{% endblock %}
\ No newline at end of file