Commit a26bc768 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Ajustement affichage camapgne

parent dec9b18f
Loading
Loading
Loading
Loading
+3 −3
Changes for module/Application/src/Application/Service/Agent/AgentService.php: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -296,9 +296,9 @@ EOS;
     * @param Structure[] $structures
     * @return Agent[]
     */
    public function getAgentsByStructures(array $structures) : array
    public function getAgentsByStructures(array $structures, ?DateTime $date = null) : array
    {
        $today = new DateTime();
        if ($date === null) $date = new DateTime();

        $qb = $this->getEntityManager()->getRepository(Agent::class)->createQueryBuilder('agent')
            //AFFECTATION
@@ -327,7 +327,7 @@ EOS;
            //FICHE DE POSTE
            ->addSelect('ficheposte')->leftJoin('agent.fiches', 'ficheposte')

            ->setParameter('today', $today)
            ->setParameter('today', $date)
            ->setParameter('true', 'O')
            ->setParameter('false', 'N')
            ->andWhere('agent.deleted_on IS NULL')
+6
Changes for module/Structure/src/Structure/Controller/StructureController.php: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -113,6 +113,11 @@ class StructureController extends AbstractActionController {

        /** Campagne */
        $last =  $this->getCampagneService()->getLastCampagne();
        /** Récupération des agents et postes liés aux structures */
        $agentsLast = $this->getAgentService()->getAgentsByStructures($structures, $last->getDateDebut());
        $agentsForcesLast = array_map(function (StructureAgentForce $a) { return $a->getAgent(); }, $structure->getAgentsForces());
        $allAgentsLast = array_merge($agentsLast, $agentsForcesLast);

        $campagnes =  $this->getCampagneService()->getCampagnesActives();
        $entretiens = [];

@@ -140,6 +145,7 @@ class StructureController extends AbstractActionController {
            'postes' => $postes,

            'last' => $last,
            'agentsLast' => $allAgentsLast,
            'campagnes' => $campagnes,
            'entretiens' => $entretiens,
            'delegues' => $delegues,
+1
Changes for module/Structure/view/structure/structure/afficher.phtml: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
 * @var FormationInstanceInscrit[] $inscriptions
 *
 * @var Campagne $last
 * @var Agent[] $agentsLast
 * @var Campagne[] $campagnes
 * @var Delegue[] $delegues
 */
+5
Changes for module/Structure/view/structure/structure/partial/campagne.phtml: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -139,7 +139,11 @@ foreach ($encours as $epro) {
            $nbEncours = count($encours);
            $nbSans = count($sans);
            $nbTotal =  $nbComplete + $nbEncours + $nbSans;
        ?>

        <?php if ($nbTotal !== 0) : ?>

            <?php
                $ratioComplete =  $nbComplete / $nbTotal * 100;
                $ratioPlanifie = count($planifie) / $nbTotal * 100;
                $ratioFait = count($fait) / $nbTotal * 100;
@@ -160,6 +164,7 @@ foreach ($encours as $epro) {
                     title="Entretiens non planifiés <?php echo $nbSans; ?>/<?php echo $nbTotal; ?>">
                <?php echo round($ratioSans); ?>%</div>
            </div>
        <?php endif; ?>
        
    </div>
</div>