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

[EMC2] Ajout d'un filtre sur la partie gestion des statuts de mobilité des agent·es

parent 872f5d03
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -758,6 +758,32 @@ create table formation_formation_domaine
        primary key (formation_id, domaine_id)
);

create table agent_element_formation
(
    agent_id             varchar(40) not null
        constraint agent_formation_agent_c_individu_fk
            references public.agent
            on delete cascade,
    formation_element_id integer     not null
        constraint agent_formation_formation_element_id_fk
            references public.formation_element
            on delete cascade,
    constraint agent_formation_pk
        primary key (agent_id, formation_element_id)
);

create table lagaf_stagiaire
(
    id         serial
        constraint lagaf_stagiaire_pk
            primary key,
    nom        varchar(255),
    prenom     varchar(255),
    annee      integer,
    harp_id    varchar(255),
    octopus_id varchar(255),
    nstagiaire integer
);

-- IIIIIIIIIINNNNNNNN        NNNNNNNN   SSSSSSSSSSSSSSS EEEEEEEEEEEEEEEEEEEEEERRRRRRRRRRRRRRRRR   TTTTTTTTTTTTTTTTTTTTTTT
-- I::::::::IN:::::::N       N::::::N SS:::::::::::::::SE::::::::::::::::::::ER::::::::::::::::R  T:::::::::::::::::::::T
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ Version 4.2.0 (XX/11/2023)
- [Mes Formations] Couleur pour les axes + mise en forme dans les plans de formation
- [Mes Formations] Couleur pour les domaines + mise en forme dans les plans de formation
- [Mes Formations] Oublie de la valeur par defaut de la fonction (getFormationGroupeByLibelle)
- [EMC2] Ajout d'un filtre sur la partie gestion des statuts de mobilité des agent·es

Modification en BD
---
+0 −3
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ use Application\Service\ParcoursDeFormation\ParcoursDeFormationServiceAwareTrait
use Carriere\Service\Categorie\CategorieServiceAwareTrait;
use DateTime;
use Doctrine\ORM\Exception\ORMException;
use Element\Entity\Db\ApplicationElement;
use Element\Form\ApplicationElement\ApplicationElementFormAwareTrait;
use Element\Form\CompetenceElement\CompetenceElementFormAwareTrait;
use Element\Form\SelectionApplication\SelectionApplicationFormAwareTrait;
@@ -268,13 +267,11 @@ class AgentController extends AbstractActionController
            if ($data["reponse"] === "oui") {
                $validation = new ValidationInstance();
                $validation->setType($validationType);
                $validation->setEntity($entity);
                $this->getValidationInstanceService()->create($validation);
            }
            if ($data["reponse"] === "non") {
                $validation = new ValidationInstance();
                $validation->setType($validationType);
                $validation->setEntity($entity);
                $validation->setRefus(true);
                $this->getValidationInstanceService()->create($validation);
            }
+28 −0
Original line number Diff line number Diff line
@@ -4,20 +4,48 @@ namespace Application\Controller;

use Application\Entity\Db\AgentMobilite;
use Application\Form\AgentMobilite\AgentMobiliteFormAwareTrait;
use Application\Service\Agent\AgentServiceAwareTrait;
use Application\Service\AgentMobilite\AgentMobiliteServiceAwareTrait;
use Carriere\Service\Mobilite\MobiliteServiceAwareTrait;
use Laminas\Http\Response;
use Laminas\View\Model\ViewModel;
use Structure\Service\Structure\StructureServiceAwareTrait;

class AgentMobiliteController extends AgentController {
    use AgentServiceAwareTrait;
    use AgentMobiliteServiceAwareTrait;
    use MobiliteServiceAwareTrait;
    use StructureServiceAwareTrait;
    use AgentMobiliteFormAwareTrait;

    public function indexAction(): ViewModel
    {
        $mobilites = $this->getAgentMobiliteService()->getAgentsMobilites();
        $types = $this->getMobiliteService()->getMobilites();

        $agent = null;
        if ($agentArray = $this->params()->fromQuery('agent')) {
            $agent = $this->getAgentService()->getAgent($agentArray['id']);
        }
        $structure = null;
        if ($structureArray = $this->params()->fromQuery('structure')) {
            $structure = $this->getStructureService()->getStructure($structureArray['id']);
        }
        $mobilite = null;
        if ($mobiliteId = $this->params()->fromQuery('mobilite')) {
            $mobilite = $this->getMobiliteService()->getMobilite((int) $mobiliteId);
        }

        if ($agent) $mobilites = array_filter($mobilites, function (AgentMobilite $a) use ($agent) { return $a->getAgent() === $agent;});
        if ($structure) $mobilites = array_filter($mobilites, function (AgentMobilite $a) use ($structure) { return !empty($a->getAgent()->getAffectationsActifs(null, [$structure])); });
        if ($mobilite) $mobilites = array_filter($mobilites, function (AgentMobilite $a) use ($mobilite) { return $a->getMobilite() === $mobilite;});

        return new ViewModel([
            'mobilites' => $mobilites,
            'types' => $types,
            'agent' => $agent,
            'structure' => $structure,
            'mobilite' => $mobilite,
        ]);
    }

+8 −0
Original line number Diff line number Diff line
@@ -5,9 +5,11 @@ namespace Application\Controller;
use Application\Form\AgentMobilite\AgentMobiliteForm;
use Application\Service\Agent\AgentService;
use Application\Service\AgentMobilite\AgentMobiliteService;
use Carriere\Service\Mobilite\MobiliteService;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Structure\Service\Structure\StructureService;

class AgentMobiliteControllerFactory {

@@ -20,15 +22,21 @@ class AgentMobiliteControllerFactory {
        /**
         * @var AgentService $agentService
         * @var AgentMobiliteService $agentMobiliteService
         * @var MobiliteService $mobiliteService
         * @var StructureService $structureService
         * @var AgentMobiliteForm $agentMobiliteForm
         */
        $agentService = $container->get(AgentService::class);
        $agentMobiliteService = $container->get(AgentMobiliteService::class);
        $mobiliteService = $container->get(MobiliteService::class);
        $structureService = $container->get(StructureService::class);
        $agentMobiliteForm = $container->get('FormElementManager')->get(AgentMobiliteForm::class);

        $controller = new AgentMobiliteController();
        $controller->setAgentService($agentService);
        $controller->setAgentMobiliteService($agentMobiliteService);
        $controller->setMobiliteService($mobiliteService);
        $controller->setStructureService($structureService);
        $controller->setAgentMobiliteForm($agentMobiliteForm);
        return $controller;
    }
Loading