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

convocation

parent 96054a32
Loading
Loading
Loading
Loading
+3 −2
Changes for module/Application/src/Application/Service/Agent/AgentService.php: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -730,8 +730,8 @@ class AgentService {
    /** ATTENTION PEUT-ÊTRE REDONDANT !!! */

    /**
     * @param array $structures
     * @param DateTime|null $dateTime
     * @param Structure[] $structures
     * @param DateTime|null $date
     * @return array
     */
    public function getAgentsByStructuresAndDate(array $structures, ?DateTime $date = null) : array
@@ -754,6 +754,7 @@ class AgentService {

        $qb = $this->getEntityManager()->getRepository(Agent::class)->createQueryBuilder('agent')
            ->join('agent.affectations', 'affectation')->addSelect('affectation')
            ->join('affectation.structure', 'affstructure')->addSelect('affstructure')
            ->join('agent.grades', 'grade')->addSelect('grade')
            ->join('agent.statuts', 'statut')->addSelect('statut')
            ->andWhere('agent.id in (:ids)')->setParameter('ids',$ids)
+2 −1
Changes for module/EntretienProfessionnel/config/merged/entretien.config.php: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -193,8 +193,9 @@ return [
                        'type'  => Segment::class,
                        'may_terminate' => true,
                        'options' => [
                            'route'    => '/find-responsable-pour-entretien[/:structure/:campagne]',
                            'route'    => '/find-responsable-pour-entretien/:campagne/:agent',
                            'defaults' => [
                                /** @see EntretienProfessionnelController::findResponsablePourEntretienAction() */
                                'controller' => EntretienProfessionnelController::class,
                                'action'     => 'find-responsable-pour-entretien',
                            ],
+6 −15
Changes for module/EntretienProfessionnel/src/EntretienProfessionnel/Controller/EntretienProfessionnelController.php: 6 added lines, 15 removed lines.
Original line number Diff line number Diff line
@@ -101,7 +101,8 @@ class EntretienProfessionnelController extends AbstractActionController

    public function findResponsablePourEntretienAction() : JsonModel
    {
        $structure = $this->getStructureService()->getRequestedStructure($this);
        $agent = $this->getAgentService()->getRequestedAgent($this);
        $campagne = $this->getCampagneService()->getRequestedCampagne($this);

        $agentId = $this->params()->fromQuery('agent');
        $agent = $this->getAgentService()->getAgent($agentId);
@@ -152,8 +153,6 @@ class EntretienProfessionnelController extends AbstractActionController
        // From Query
        $agentId = $this->params()->fromQuery('agent');
        $agent = ($agentId) ? $this->getAgentService()->getAgent($agentId) : null;
        $structureId = $this->params()->fromQuery('structure');
        $structure = ($structureId) ? $this->getStructureService()->getStructure($structureId) : null;

        // ne pas dupliquer les entretiens (si il existe alors on l'affiche)
        $entretien = null;
@@ -163,26 +162,18 @@ class EntretienProfessionnelController extends AbstractActionController
            return $this->redirect()->toRoute('entretien-professionnel/acceder', ["entretien-professionnel" => $entretien->getId()], [], true);
        }

        $superieurs = $this->getAgentService()->computeSuperieures($agent);
        $entretien = new EntretienProfessionnel();
        $entretien->setCampagne($campagne);
        if ($agent !== null) $entretien->setAgent($agent);
        if (count($superieurs) === 1) $entretien->setResponsable(current($superieurs));

        $form = $this->getEntretienProfessionnelForm();
        $form->setAttribute('action', $this->url()->fromRoute('entretien-professionnel/creer', ["campagne" => $campagne->getId()], ["query" => ["agent" => $agentId, "structure" => $structureId]], true));
        $form->setSuperieurs($superieurs);
        $form->init();
        $form->bind($entretien);

        if ($structure !== null) {
            /** @var SearchAndSelect $element */
            $element = $form->get('responsable');
            /** @see EntretienProfessionnelController::findResponsablePourEntretienAction() */
            $element->setAutocompleteSource($this->url()->fromRoute('entretien-professionnel/find-responsable-pour-entretien', ['agent' => $agent->getId(), 'structure' => $structure->getId(), 'campagne' => $campagne->getId()], ['query' => ['agent' => $agentId]], true));
        } else {
            /** @var SearchAndSelect $element */
            $element = $form->get('responsable');
            /** @see EntretienProfessionnelController::findResponsablePourEntretienAction() */
            $element->setAutocompleteSource($this->url()->fromRoute('entretien-professionnel/find-responsable-pour-entretien', [], ['query' => ['agent' => $agentId]], true));
        }

        /** @var Request $request */
        $request = $this->getRequest();
        if ($request->isPost()) {
+8 −0
Changes for module/EntretienProfessionnel/src/EntretienProfessionnel/Controller/EntretienProfessionnelControllerFactory.php: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -11,6 +11,8 @@ use EntretienProfessionnel\Service\Evenement\RappelEntretienProfessionnelService
use EntretienProfessionnel\Service\Evenement\RappelPasObservationService;
use EntretienProfessionnel\Service\Notification\NotificationService;
use Interop\Container\ContainerInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Structure\Service\Structure\StructureService;
use UnicaenEtat\Service\Etat\EtatService;
use UnicaenMail\Service\Mail\MailService;
@@ -21,6 +23,12 @@ use UnicaenValidation\Service\ValidationInstance\ValidationInstanceService;

class EntretienProfessionnelControllerFactory {

    /**
     * @param ContainerInterface $container
     * @return EntretienProfessionnelController
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function __invoke(ContainerInterface $container) : EntretienProfessionnelController
    {
        /**
+35 −8
Changes for module/EntretienProfessionnel/src/EntretienProfessionnel/Form/EntretienProfessionnel/EntretienProfessionnelForm.php: 35 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -21,6 +21,16 @@ class EntretienProfessionnelForm extends Form {
    private $urlAgent;
    private $urlResponsable;

    private array $superieurs = [];
    public function setSuperieurs(array $superieurs) { $this->superieurs = $superieurs; }
    public function superieursAsOptions() : array
    {
        $options = [];
        foreach ($this->superieurs as $superieur) $options[$superieur->getId()] = $superieur->getDenomination();
        return $options;
    }


    /**
     * @param mixed $urlAgent
     * @return EntretienProfessionnelForm
@@ -44,16 +54,33 @@ class EntretienProfessionnelForm extends Form {
    public function init()
    {
        //Responsable
        $responsable = new SearchAndSelect('responsable', ['label' => "Responsable de l'entretien professionnel <span class='icon icon-information text-info' title='Saisissez quelques lettres pour peupler la liste.'></span> <span class='icon obligatoire text-danger' title='Champ obligatoire'></span> :"]);
        $responsable
            ->setAutocompleteSource($this->urlResponsable)
            ->setSelectionRequired(true)
            ->setLabelOption('disable_html_escape',true)
            ->setAttributes([
//        $responsable = new SearchAndSelect('responsable', ['label' => "Responsable de l'entretien professionnel <span class='icon icon-information text-info' title='Saisissez quelques lettres pour peupler la liste.'></span> <span class='icon obligatoire text-danger' title='Champ obligatoire'></span> :"]);
//        $responsable
//            ->setAutocompleteSource($this->urlResponsable)
//            ->setSelectionRequired(true)
//            ->setLabelOption('disable_html_escape',true)
//            ->setAttributes([
//                'id' => 'responsable',
//                'placeholder' => "Nom du responsable de l'entretien professionnel ...",
//            ]);
//        $this->add($responsable);

        $this->add([
            'type' => Select::class,
            'name' => 'responsable',
            'options' => [
                'label' => "Responsable de l'entretien <span class='icon icon-obligatoire' title='Champ obligatoire' ></span> :",
                'label_options' => [ 'disable_html_escape' => true, ],
                'empty_option' => "Sélectionner un·e responsable pour l'entretien",
                'value_options' => $this->superieursAsOptions(),
            ],
            'attributes' => [
                'id' => 'responsable',
                'placeholder' => "Nom du responsable de l'entretien professionnel ...",
                'class'             => 'bootstrap-selectpicker show-tick',
                'data-live-search'  => 'true',
            ],
        ]);
        $this->add($responsable);

        //Agent
        $agent = new SearchAndSelect('agent', ['label' => "Agent <span class='icon obligatoire text-danger' title='Champ obligatoire'></span> :"]);
        $agent
Loading