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

Changement de l'edition des fiche de poste

parent b3c16140
Loading
Loading
Loading
Loading
+1 −1
Changes for module/Application/config/merged/menu.config.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -217,7 +217,7 @@ return [
//                        'order' => -10,
                        'label' => 'Fiches',
//                        'title' => "Fiche métier",
                        'route' => 'activite',
                        'route' => 'fiche-poste',
                        'resource' => FicheMetierPrivileges::getResourceId(FicheMetierPrivileges::AFFICHER),
                        'pages' => [
                            [
+1 −1
Changes for module/Application/config/merged/mes-structures.config.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ return [
                ],
                'may_terminate' => true,
                'child_routes' => [
                    'mes-structures' => [
                    'ajouter-fiche-poste' => [
                        'type'  => Segment::class,
                        'options' => [
                            'route'    => '/ajouter-fiche-poste',
+21 −1
Changes for module/Application/src/Application/Controller/FichePosteController.php: 21 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ use Application\Entity\Db\SpecificitePoste;
use Application\Form\AjouterFicheMetier\AjouterFicheMetierFormAwareTrait;
use Application\Form\AssocierAgent\AssocierAgentForm;
use Application\Form\AssocierAgent\AssocierAgentFormAwareTrait;
use Application\Form\AssocierPoste\AssocierPosteForm;
use Application\Form\AssocierPoste\AssocierPosteFormAwareTrait;
use Application\Form\FichePosteCreation\FichePosteCreationFormAwareTrait;
use Application\Form\SpecificitePoste\SpecificitePosteForm;
@@ -16,6 +17,7 @@ use Application\Form\SpecificitePoste\SpecificitePosteFormAwareTrait;
use Application\Service\Agent\AgentServiceAwareTrait;
use Application\Service\Export\FichePoste\FichePostePdfExporter;
use Application\Service\FichePoste\FichePosteServiceAwareTrait;
use Application\Service\Structure\StructureServiceAwareTrait;
use Zend\Http\Request;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
@@ -25,6 +27,7 @@ class FichePosteController extends AbstractActionController {
    /** Service **/
    use AgentServiceAwareTrait;
    use FichePosteServiceAwareTrait;
    use StructureServiceAwareTrait;
    /** Form **/
    use AjouterFicheMetierFormAwareTrait;
    use AssocierAgentFormAwareTrait;
@@ -80,10 +83,14 @@ class FichePosteController extends AbstractActionController {

    public function editerAction()
    {
        $structureId = $this->params()->fromQuery('structure');
        $structure = $this->getStructureService()->getStructure($structureId);

        $fiche = $this->getFichePosteService()->getRequestedFichePoste($this, 'fiche-poste', false);
        if ($fiche === null) $fiche = $this->getFichePosteService()->getLastFichePoste();
        return new ViewModel([
            'fiche' => $fiche,
            'structure' => $structure,
        ]);
    }

@@ -112,11 +119,18 @@ class FichePosteController extends AbstractActionController {

    public function associerAgentAction()
    {
        $structureId = $this->params()->fromQuery('structure');
        $structure = $this->getStructureService()->getStructure($structureId);

        $fiche = $this->getFichePosteService()->getRequestedFichePoste($this, 'fiche-poste');

        /** @var AssocierAgentForm $form */
        $form = $this->getAssocierAgentForm();
        $form->setAttribute('action', $this->url()->fromRoute('fiche-poste/associer-agent', ['fiche-poste' => $fiche->getId()], [], true));

        if ($structure !== null) {
            $form = $form->reinitWithStructure($structure);
        }
        $form->bind($fiche);

        /**@var Request $request */
@@ -143,11 +157,17 @@ class FichePosteController extends AbstractActionController {

    public function associerPosteAction()
    {
        $structureId = $this->params()->fromQuery('structure');
        $structure = $this->getStructureService()->getStructure($structureId);
        $fiche = $this->getFichePosteService()->getRequestedFichePoste($this, 'fiche-poste');

        /** @var AssocierAgentForm $form */
        /** @var AssocierPosteForm $form */
        $form = $this->getAssocierPosteForm();
        $form->setAttribute('action', $this->url()->fromRoute('fiche-poste/associer-poste', ['fiche-poste' => $fiche->getId()], [], true));

        if ($structure !== null) {
            $form = $form->reinitWithStructure($structure);
        }
        $form->bind($fiche);

        /**@var Request $request */
+3
Changes for module/Application/src/Application/Controller/FichePosteControllerFactory.php: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ use Application\Form\FichePosteCreation\FichePosteCreationForm;
use Application\Form\SpecificitePoste\SpecificitePosteForm;
use Application\Service\Agent\AgentService;
use Application\Service\FichePoste\FichePosteService;
use Application\Service\Structure\StructureService;
use Interop\Container\ContainerInterface;

class FichePosteControllerFactory {
@@ -21,6 +22,7 @@ class FichePosteControllerFactory {
         */
        $agentService = $container->get(AgentService::class);
        $fichePosteService = $container->get(FichePosteService::class);
        $structureService = $container->get(StructureService::class);

        /**
         * @var AjouterFicheMetierForm $ajouterFicheMetierForm
@@ -40,6 +42,7 @@ class FichePosteControllerFactory {

        $controller->setAgentService($agentService);
        $controller->setFichePosteService($fichePosteService);
        $controller->setStructureService($structureService);

        $controller->setAjouterFicheTypeForm($ajouterFicheMetierForm);
        $controller->setAssocierAgentForm($associerAgentForm);
+5 −7
Changes for module/Application/src/Application/Controller/MesStructuresController.php: 5 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ class MesStructuresController extends AbstractActionController {
        $missionsSpecifiques = null;
        $fichesPostes = null;
        if ($structure != null) {
            //TODO sans fiche de poste
            $fichesPostes = $this->getFichePosteService()->getFichesPostesByStructure($structure);
            $agentsSansFiche = $this->getAgentService()->getAgentsSansFichePosteByStructure($structure);
            $missionsSpecifiques = $this->getMissionSpecifiqueService()->getMissionsSpecifiquesByStructure($structure);
@@ -65,12 +66,9 @@ class MesStructuresController extends AbstractActionController {
            throw new RuntimeException("L'ajout de fiche ne peut être fait d'avec une structure donnée !");
        }

        $agentsSansFiche = $this->getAgentService()->getAgentsSansFichePosteByStructure($structure);
        $postes = $this->getPosteService()->getPostesByStructure($structure);
        return new ViewModel([
            'structure' => $structure,
            'agentsSansFiche' => $agentsSansFiche,
            'postes' => $postes,
        ]);
        $fiche = new FichePoste();
        $fiche->setLibelle("Fiche de poste sans titre");
        $this->getFichePosteService()->create($fiche);
        return $this->redirect()->toRoute('fiche-poste/editer', ['fiche-poste' => $fiche->getId()], ["query" => ["structure" => $structure->getId()]], true);
    }
}
 No newline at end of file
Loading