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

Ajout des fiches de poste pdf dans le listing des structures

parent fd54dc98
Loading
Loading
Loading
Loading
+10 −0
Changes for module/Application/src/Application/Entity/Db/Agent.php: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -743,4 +743,14 @@ class Agent implements
        }
        return $best;
    }

    public function getFichiersByCode(string $code) : array
    {
        $result = [];
        /** @var Fichier $fichier */
        foreach ($this->getFichiers() as $fichier) {
            if ($fichier->getNature()->getCode() === $code) $result[] = $fichier;
        }
        return $result;
    }
}
 No newline at end of file
+6 −0
Changes for module/Structure/src/Structure/Controller/StructureController.php: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -116,6 +116,11 @@ class StructureController extends AbstractActionController {
        $inscriptions = $this->getFormationInstanceInscritService()->getInscriptionsByStructure($structure, true, true);
        $profils = $this->getFicheProfilService()->getFichesPostesByStructure($structure);

        $fichespostes_pdf = [];
        foreach ($allAgents as $agent) {
            $fichespostes_pdf[$agent->getId()] = $agent->getFichiersByCode("FICHE_POSTE");
        }

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

@@ -126,6 +131,7 @@ class StructureController extends AbstractActionController {

            'missions' => $missionsSpecifiques,
            'fichespostes' => $this->getFichePosteService()->getFichesPostesbyAgents($allAgents),
            'fichespostes_pdf' => $fichespostes_pdf,
            'fichesRecrutements' => $fichesRecrutements,
            'profils' => $profils,
            'inscriptions' => $inscriptions,
+2 −4
Changes for module/Structure/view/structure/structure/afficher.phtml: 2 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
 * @var Structure[] $filles
 * @var AgentMissionSpecifique[] $missions
 * @var FichePoste[] $fichespostes
 * @var FichePoste[] $fichespostes_pdf
 * @var FichePoste[] $fichesCompletes
 * @var FichePoste[] $fichesIncompletes
 * @var FichePoste[] $fichesRecrutements
@@ -182,10 +183,7 @@ $canAfficherStructure = $this->isAllowed($structure, StructurePrivileges::STRU

                <!-- Informations ------------------------------------------------------------------------------------->
                <div id="informations" class="tab-pane " role="tabpanel">

                    <?php echo $this->partial('partial/fiches-postes', ['agents' => $agentsAll, 'structure' => $structure, 'fichespostes' => $fichespostes, 'fichesCompletes' => $fichesCompletes, 'fichesIncompletes' => $fichesIncompletes]); ?>


                    <?php echo $this->partial('partial/fiches-postes', ['agents' => $agentsAll, 'structure' => $structure, 'fichespostes' => $fichespostes, 'fichespostes_pdf' => $fichespostes_pdf]); ?>
                </div>

                <!-- Missions spécifique ------------------------------------------------------------------------------------->
+47 −1
Changes for module/Structure/view/structure/structure/partial/fiches-postes.phtml: 47 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -4,11 +4,14 @@
 * @see \Structure\Controller\StructureController::afficherAction()
 * @var Agent[] $agents
 * @var Structure $structure
 * @var array $fichespostes_pdf
 */

use Application\Entity\Db\Agent;
use Application\Entity\Db\FichePoste;
use Application\Provider\Privilege\AgentPrivileges;
use Application\Provider\Privilege\FichePostePrivileges;
use Fichier\Entity\Db\Fichier;
use Structure\Entity\Db\Structure;

$canVoirFichePoste          = $this->isAllowed(FichePostePrivileges::getResourceId(FichePostePrivileges::FICHEPOSTE_AFFICHER));
@@ -64,6 +67,49 @@ $date = new DateTime();
                    <span class="icon cloner nope"></span>
                <?php endif; ?>

                <?php if (!empty($fichespostes_pdf[$agent->getId()]) ) : ?>
                <?php
                    $canVoirFichier         = $this->isAllowed($agent, AgentPrivileges::AGENT_AFFICHER);
                    $canDetruireFichier      = $this->isAllowed($agent, AgentPrivileges::AGENT_ELEMENT_HISTORISER);
                ?>
                <table class="fichespostes">
                    <?php /** @var Fichier $fichier */ ?>
                    <?php foreach ($fichespostes_pdf[$agent->getId()] as $fichier) : ?>
                    <tr class="
                        <?php if ($fichier->estHistorise()) echo " historise " ?>
                    ">
                        <td class="libelle"> <?php echo $fichier->getNomOriginal(); ?> </td>
                        <td class="encours"></td>
                        <td class="etat"><span class="text-danger">PDF</span></td>
                        <td class="action">
                            <span class="icon voir nope"></span>
                            <?php if ($canVoirFichier) : ?>
                                <a
                                    <?php /** @see  \Fichier\Controller\FichierController::downloadAction()*/ ?>
                                        href="<?php echo $this->url('download-fichier', ['fichier' => $fichier->getId()], [], true); ?>">
                                    <span class="icon pdf" title="voir le fichier"></span>
                                </a>
                            <?php else : ?>
                                <span class="icon pdf nope"></span>
                            <?php endif; ?>
                            <span class="icon editer nope"></span>
                            <span class="icon historiser nope"></span>
                            <?php if ($canDetruireFichier) : ?>
                                <a
                                    <?php /** @see \Fichier\Controller\FichierController::deleteAction() */?>
                                        href="<?php echo $this->url('delete-fichier', ['fichier' => $fichier->getId()], ['query' => ['retour' => $this->url('structure/afficher', ['structure' => $structure->getId()], true)]], true); ?>"
                                >
                                    <span class="icon detruire" title="supprimer le fichier"></span></a>
                            <?php else : ?>
                            ..
                            <?php endif; ?>
                        </td>
                        <td></td>
                    </tr>
                    <?php endforeach; ?>
                </table>
                <?php endif; ?>

                <?php if (!empty($fichespostes[$agent->getId()]) ) : ?>
                <table class="fichespostes">
                <?php foreach ($fichespostes[$agent->getId()] as $ficheposte) : ?>
@@ -72,7 +118,7 @@ $date = new DateTime();
                    ">
                    <?php //var_dump($ficheposte); ?>
<!--                    <td class="structure">--><?php //echo $ficheposte['structure']; ?><!-- </td>-->
                    <td class="libelle">
                    <td >
                        [<?php echo $ficheposte['structure']; ?>]
                        <?php echo ($ficheposte['fiche_principale'])?:"<span style='color:darkred;'>Aucun métier principal</span>"; ?>
                        <?php if ($ficheposte['fiche_libelle']) : ?>