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

Retrait de codes morts

parent 7f7f396e
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@ return [
                [
                    'controller' => StructureController::class,
                    'action' => [
                        'afficher',
                        'description',
                        'agents',
                        'missions-specifiques',
@@ -160,18 +159,6 @@ return [
                        'may_terminate' => true,
                        'child_routes' => [],
                    ],
                    'afficher' => [
                        'type'  => Segment::class,
                        'options' => [
                            'route'    => '/afficher/:structure',
                            'defaults' => [
                                'controller' => StructureController::class,
                                'action'     => 'afficher',
                            ],
                        ],
                        'may_terminate' => true,
                        'child_routes' => [],
                    ],
                    'description' => [
                        'type'  => Segment::class,
                        'options' => [
+0 −75
Original line number Diff line number Diff line
@@ -73,81 +73,6 @@ class StructureController extends AbstractActionController {
        ]);
    }

    public function afficherAction() : ViewModel
    {
        $role = $this->getUserService()->getConnectedRole();
        $utilisateur = $this->getUserService()->getConnectedUser();
        $selecteur = $this->getStructureService()->getStructuresByCurrentRole($utilisateur, $role);

        /** Récupération des structures */
        $structure = $this->getStructureService()->getRequestedStructure($this);
        $structures = $this->getStructureService()->getStructuresFilles($structure);
        $structures[] =  $structure;

        /** Récupération des missions spécifiques liées aux structures */
        $missionsSpecifiques = $this->getAgentMissionSpecifiqueService()->getAgentMissionsSpecifiquesByStructures($structures, false);

        /** Récupération des agents et postes liés aux structures */
        $agents = $this->getAgentService()->getAgentsByStructures($structures);
        $agentsForces = $this->getStructureService()->getAgentsForces($structure);
        $agentsForces = array_map(function (StructureAgentForce $a) { return $a->getAgent(); }, $agentsForces);
        $allAgents = array_merge($agents, $agentsForces);

        usort($allAgents, function (Agent $a, Agent $b) { $aaa = $a->getNomUsuel() . " ". $a->getPrenom(); $bbb = $b->getNomUsuel() . " ". $b->getPrenom(); return $aaa > $bbb;});

        $fichespostes_pdf = $this->getAgentService()->getFichesPostesPdfByAgents($allAgents);

        /** Campagne d'entretien professionnel ************************************************************************/
        $last =  $this->getCampagneService()->getLastCampagne();
        $campagnes =  $this->getCampagneService()->getCampagnesActives();
        $campagnes[] = $last;
        usort($campagnes, function (Campagne $a, Campagne $b) { return $a->getDateDebut() > $b->getDateDebut();});

        $allAgents = [];
        $entretiensArray = []; $agentsArray = [];
        foreach ($campagnes as $campagne) {
            $agentsCampagne = $this->getCampagneService()->computeAgentByStructures($structures, $campagne);
            $agentsArray[$campagne->getId()] = $agentsCampagne;
            foreach ($agentsCampagne as $agent) { $allAgents[$agent->getId()] = $agent;}
            $entretiensArray[$campagne->getId()] = $this->getEntretienProfessionnelService()->getEntretienProfessionnelByCampagneAndAgents($campagne, $agentsArray[$campagne->getId()]);
        }
        $allAgentsAffectations = [];
        foreach ($allAgents as $id => $agent) {
            $allAgentsAffectations[$id] = $this->getAgentAffectationService()->getAgentAffectationsByAgent($agent, false, true);
        }

        return new ViewModel([
            'selecteur' => $selecteur,

            'structure' => $structure,
            'responsables' => $this->getStructureService()->getResponsables($structure, new DateTime()),
            'gestionnaires' => $this->getStructureService()->getGestionnaires($structure, new DateTime()),
            'filles' =>   $structure->getEnfants(),

            'missions' => $missionsSpecifiques,
            'fichespostes' => $this->getFichePosteService()->getFichesPostesbyAgents($allAgents),
            'fichespostes_pdf' => $fichespostes_pdf,
            'fichePosteEtats' => $this->getEtatService()->getEtatsByTypeCode(FichePosteEtats::TYPE),

            'agents' => $agents,
            'agentsForces' => $agentsForces,
            'agentsAll' => $allAgents,
            'allAgentsAffectations' => $allAgentsAffectations,

            // Partie -- Entretiens Professionnels --
            'campagnes' => $campagnes,
            'agentsArray' => $agentsArray,
            'entretiensArray' => $entretiensArray,


            'emailAssistance' => $this->getParametreService()->getValeurForParametre(GlobalParametres::TYPE, GlobalParametres::EMAIL_ASSISTANCE),

            // - Fiches de recrutement - //
//            'fichesRecrutements' => $fichesRecrutements,
//            'profils' => $profils,
        ]);
    }

    public function descriptionAction() : ViewModel
    {
        $role = $this->getUserService()->getConnectedRole();
+0 −266
Original line number Diff line number Diff line
<?php

/**
 * @see \Structure\Controller\StructureController::afficherAction()
 * @var Structure[] $selecteur
 * @var Structure $structure
 * @var StructureResponsable[] $responsables
 * @var StructureGestionnaire[] $gestionnaires
 * @var Structure[] $filles
 * @var AgentMissionSpecifique[] $missions
 * @var FichePoste[] $fichespostes
 * @var FichePoste[] $fichespostes_pdf
 * @var FichePoste[] $fichesCompletes
 * @var FichePoste[] $fichesIncompletes
 * @var EtatType[] $fichePosteEtats
// * @var FichePoste[] $fichesRecrutements
 * @var Agent[] $agents
 * @var Agent[] $agentsForces
 * @var Agent[] $agentsAll
// * @var FicheProfil[] $profils
 *
 * @var Agent[] $autorites;
 * @var Agent[] $superieurs;
 *
 * ------- ENTRETIENS PROFESSIONNELS -------
 * @var Campagne[] $campagnes
 * @var Agent[] $agentsArray
 * @var EntretienProfessionnel[] $entretiensArray
 *  $agentsArray = [
 *      (int) $campagneId => (array) Agent[]
 *  ]
 *  $entretiensArray = [
 *      (int) $campagneId => (array) entretiensCampagne [
 *          $agentId => (?EntretienProfessionnel) $entretien
 *      ]
 *  ]
 *
 * @var string $emailAssistance
 */

use Application\Entity\Db\Agent;
use Application\Entity\Db\AgentMissionSpecifique;
use Application\Entity\Db\FichePoste;
use EntretienProfessionnel\Entity\Db\Campagne;
use EntretienProfessionnel\Entity\Db\EntretienProfessionnel;
use Structure\Entity\Db\Structure;
use Structure\Entity\Db\StructureGestionnaire;
use Structure\Entity\Db\StructureResponsable;
use Structure\Provider\Privilege\StructurePrivileges;
use UnicaenEtat\Entity\Db\EtatType;

$this->headTitle($structure->getLibelleLong());

$canAfficherStructure   = $this->isAllowed($structure, StructurePrivileges::STRUCTURE_AFFICHER);

?>

<div class="row">
    <div class="col-md-8">
        <h1 class="page-header">
            <strong> <?php echo $structure->getLibelleLong(); ?> </strong> <br/>
            <?php echo $structure->getType(); ?>
        </h1>
    </div>
    <div class="col-md-4">
        <br/>
        <?php if (! empty($selecteur)) : ?>
            <label for="structure-selecteur">Structure à afficher : <br/></label>
            <select id="structure-selecteur" name="structure-selecteur" class="bootstrap-select">
                <option value="">Aucune sélection</option>
                <?php foreach ($selecteur as $s) : ?>
                    <option value="<?php echo $s->getId(); ?>" <?php if ($structure->getId() == $s->getId()) echo "selected"; ?>><?php echo $s->getLibelleCourt(); ?></option>
                <?php endforeach; ?>
            </select>
        <?php endif; ?>
    </div>
</div>



<?php if (! $canAfficherStructure) : ?>

    <div class="alert alert-danger col-md-8">
        <p class="lead">
            <span class="icon icon-attention"></span>
            Vous n'êtes pas habilité&middot;e à visualiser cette structure.
        </p>
    </div>

<?php else : ?>

    <?php echo $this->messenger()->addMessagesFromFlashMessenger(); ?>

    <div class="main">

        <?php echo $this->partial('partial/resume', ['structure' => $structure, 'filles' => $filles, 'responsables' => $responsables, 'gestionnaires' => $gestionnaires]); ?>

        <ul class="nav">
            <li class="nav-item">
                <a href="#agents" class="nav-link" aria-controls="agents">
                    Agents <br/> &nbsp;
                </a>
            </li>
            <li class="nav-item">
                <a href="#informations" class="nav-link" aria-controls="informations">
                    Fiches de  <br/> poste
                </a>
            </li>
            <li class="nav-item">
                <a href="#missions" class="nav-link" aria-controls="missions">
                    Missions <br/> spécifiques
                </a>
            </li>

            <?php foreach ($campagnes as $campagne) : ?>
                <li class="nav-item">
                    <a href="#campagne_<?php echo $campagne->getId(); ?>" class="nav-link" aria-controls="campagne_<?php echo $campagne->getId(); ?>">
                        Entretien professionnel <br/>
                        <strong><?php echo $campagne->getAnnee(); ?></strong>
                    </a>
                </li>
            <?php endforeach;?>

<!--            <li class="nav-item">-->
<!--                <a href="#profil" class="nav-link" aria-controls="profil">-->
<!--                    Profil de  <br/>-->
<!--                    recrutement-->
<!--                </a>-->
<!--            </li>-->

            <li class="nav-item">
                <a href="#extraction" class="nav-link" aria-controls="extraction">
                    Extractions  <br/> &nbsp;
                </a>
            </li>
        </ul>


        <div class="tab-content">

                <!-- Informations ------------------------------------------------------------------------------------->
                <div id="agents" class="tab-pane">
                    <div class="row">
                        <div class="col-md-4">
                            <h2>
                                Agents
                                <span class="badge"><?php echo count($agents); ?></span>
                            </h2>
                        </div>
                        <div class="col-md-8">
                            <div class="alert alert-info">
                                <span class="icon icon-information"></span>
                                En cas d'incohérence sur la chaîne hiérarchique d'un agent, veuillez remonter l'information à l'adresse
                                <a href="mailto:<?php echo $emailAssistance; ?>"><?php echo $emailAssistance; ?></a>
                            </div>
                        </div>
                    </div>

                    <?php echo $this->partial('partial/agents', ['structure' => $structure, 'agents' => $agents, 'superieurs' => $superieurs, 'autorites' => $autorites]); ?>

                    <div class="row">
                        <div class="col-md-8">
                            <h2>
                                Agents manuellement ajoutés
                                <span class="badge"><?php echo count($agentsForces); ?></span>
                            </h2>
                        </div>
                        <div class="pull-right">
                            <?php /** @see \Application\Controller\StructureController::ajouterManuellementAgentAction(); */ ?>
                            <a class="btn btn-primary action ajax-modal" data-event="modification"
                               href="<?php echo $this->url("structure/ajouter-manuellement-agent", ["structure" => $structure->getId()], [], true); ?>"
                            >
                                <span class="icon icon-utilisateur-ajouter"></span> Ajouter manuellement un agent
                            </a>
                        </div>
                    </div>
                    <?php echo $this->partial('partial/agents', ['structure' => $structure, 'agents' => $agentsForces, 'options' => ['force' => true]]); ?>

                </div>

                <!-- Informations ------------------------------------------------------------------------------------->
                <div id="informations" class="tab-pane">
                    <?php echo $this->partial('partial/fiches-postes', ['agents' => $agentsAll, 'structure' => $structure, 'fichespostes' => $fichespostes, 'fichespostes_pdf' => $fichespostes_pdf, 'etats' => $fichePosteEtats]); ?>
                </div>

                <!-- Missions spécifique ------------------------------------------------------------------------------------->
                <div id="missions" class="tab-pane">
                    <?php echo $this->partial('partial/missions-specifiques', ['structure' => $structure, 'missions' => $missions]); ?>
                </div>

                <!-- Campagne ------------------------------------------------------------------------------------->
                <?php foreach ($campagnes as $campagne) : ?>
                    <div id="campagne_<?php echo $campagne->getId(); ?>" class="tab-pane">
                        <?php
                            /**
                             * <!>  $agentsArray preserve que les affectations et grades au moment de la campagne hors l'affecctation est checké aussi à -12 mois
                             * <?> passer le tableau des agent qui préserve cela ?
                             */
                        ?>
                        <?php echo $this->partial('partial/campagne', ['campagne' => $campagne, 'structure' => $structure, 'allAgentsAffectations' => $allAgentsAffectations, 'agentsArray' => $agentsArray[$campagne->getId()], 'entretiens' => $entretiensArray[$campagne->getId()]]); ?>
                    </div>
                <?php endforeach; ?>

                <!-- Profil de recrutement ------------------------------->
<!--                <div id="profil" class="tab-pane">-->
<!--                    --><?php //echo $this->partial('partial/profil', ['structure' => $structure, 'profils' => $profils, 'fichesRecrutements' => $fichesRecrutements]); ?>
<!--                </div>-->

                <!-- Extraction ------------------------------------------------------------------------------------->
                <div id="extraction" class="tab-pane">
                    <?php echo $this->partial('partial/extraction', ['structure' => $structure]); ?>
                </div>
            </div>
    </div>
<?php endif; ?>

<script>
    // $("body").on("modification", function (event) {
    //     event.div.modal('hide');
    //     window.location.reload();
    // });

    $(function() {
        let hash = $(location).attr('hash');
        let name = hash.substr(1);
        if (name === undefined || name === "") name = "agents";

        $('a[aria-controls=' + name + ']').tab('show');

        $('.nav-tabs a').click(function (e) {
            // No e.preventDefault() here
            $(this).tab('show');
        });

    });

    $(function() {
        $('select#structure-selecteur').change(function() {
            let id = $('select#structure-selecteur option:selected').val();
            if (id !== "" && id !== "<?php echo $structure->getId(); ?>") {
                window.location.href = './' + id;
            }
        });
    });


    $(function() {
        let hash = $(location).attr('hash');
        let name = hash.substr(1);
        if (name === undefined || name === "") name = "formulaire";

        $('a[aria-controls=' + name + ']').tab('show');

        $('.nav a').click(function (e) {
            let anchor = $(this).attr('aria-controls');
            e.preventDefault(); // >> bloque le scrolling, mais aussi la ré-écriture de l'url "#info" ...
            history.replaceState(null, null, "#"+anchor);
            $(this).tab('show');
        });

        $("body").on("modification", function (event) {
            event.div.modal('hide');
            window.location.reload();
        });
    });
</script>
+0 −268

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −55
Original line number Diff line number Diff line
<?php

use Structure\Entity\Db\Structure;

/**
 * @var Structure $structure
 */

?>

<h2>Listing des fiches de postes</h2>

<a
        <?php /** @see \Application\Controller\StructureController::extractionListingFichePosteAction() */ ?>
        href="<?php echo $this->url('structure/extraction/listing-fiche-poste', ['structure' => $structure->getId()], [], true); ?>"
   class="btn btn-primary action"
>
    <span class="icon icon-csv"></span> Extraire au format CSV
</a>

<h2>Listing des missions spécifiques</h2>

<a
    <?php /** @see \Application\Controller\StructureController::extractionListingMissionSpecifiqueAction() */ ?>
        href="<?php echo $this->url('structure/extraction/listing-mission-specifique', ['structure' => $structure->getId()], [], true); ?>"
        class="btn btn-primary action"
>
    <span class="icon icon-csv"></span> Extraire au format CSV
</a>

<h2> Organigrammes </h2>

<div class="row">
    <div class="col-md-4">
        <h3> Organigramme structurel </h3>
    </div>
    <div class="col-md-4">
        <a
            <?php /** @see \Structure\Controller\StructureController::organigrammeAction() */ ?>
                href="<?php echo $this->url('structure/organigramme', ['structure' => $structure->getId()], [], true); ?>"
                class="btn btn-primary action"
        >
            <span class="icon icon-csv"></span> Version WEB
        </a>
    </div>
    <div class="col-md-4">
        <a
            <?php /** @see \Structure\Controller\StructureController::organigrammeAction() */ ?>
                href="<?php echo $this->url('structure/organigramme-pdf', ['structure' => $structure->getId()], [], true); ?>"
                class="btn btn-primary action" target="_blank"
        >
            <span class="icon icon-pdf"></span> Version PDF
        </a>
    </div>
</div>
 No newline at end of file
Loading