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

Agent WIP

parent 27a9a714
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -6,6 +6,9 @@ use Application\Service\Agent\AgentServiceAwareTrait;
use Application\Service\AgentAffectation\AgentAffectationServiceAwareTrait;
use Application\Service\AgentGrade\AgentGradeServiceAwareTrait;
use Application\Service\AgentStatut\AgentStatutServiceAwareTrait;
use Formation\Entity\Db\DemandeExterne;
use Formation\Provider\Etat\DemandeExterneEtats;
use Formation\Service\DemandeExterne\DemandeExterneServiceAwareTrait;
use Formation\Service\FormationInstanceInscrit\FormationInstanceInscritServiceAwareTrait;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\ViewModel;
@@ -16,6 +19,7 @@ class AgentController extends AbstractActionController {
    use AgentAffectationServiceAwareTrait;
    use AgentGradeServiceAwareTrait;
    use AgentStatutServiceAwareTrait;
    use DemandeExterneServiceAwareTrait;
    use FormationInstanceInscritServiceAwareTrait;
    use UserServiceAwareTrait;

@@ -45,8 +49,8 @@ class AgentController extends AbstractActionController {
        $inscriptions = $this->getFormationInstanceInscritService()->getFormationsByInscrit($agent);

        $stages = [];
//        $demandes = $this->getDemandeExterneService()->getDemandesExternesByAgent($agent);
//        $demandes = array_filter($demandes, function (DemandeExterne $d) { return $d->estNonHistorise() AND $d->getEtat()->getCode() !== DemandeExterneEtats::ETAT_REJETEE AND $d->getEtat()->getCode() !== DemandeExterneEtats::ETAT_TERMINEE;});
        $demandes = $this->getDemandeExterneService()->getDemandesExternesByAgent($agent);
        $demandes = array_filter($demandes, function (DemandeExterne $d) { return $d->estNonHistorise() AND $d->getEtat()->getCode() !== DemandeExterneEtats::ETAT_REJETEE AND $d->getEtat()->getCode() !== DemandeExterneEtats::ETAT_TERMINEE;});
//        $demandesValidees    = array_filter($demandes, function (DemandeExterne $d) { return $d->getEtat()->getCode() !== DemandeExterneEtats::ETAT_CREATION_EN_COURS; });

        return new ViewModel([
@@ -56,7 +60,7 @@ class AgentController extends AbstractActionController {
            'agentStatuts' => $agentStatuts,

            'inscriptions' => $inscriptions,
            'stages' => $stages,
            'stages' => $demandes,
            'formations' => $formations,
        ]);
    }
+4 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ use Application\Service\Agent\AgentService;
use Application\Service\AgentAffectation\AgentAffectationService;
use Application\Service\AgentGrade\AgentGradeService;
use Application\Service\AgentStatut\AgentStatutService;
use Formation\Service\DemandeExterne\DemandeExterneService;
use Formation\Service\FormationInstanceInscrit\FormationInstanceInscritService;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
@@ -25,6 +26,7 @@ class AgentControllerFactory {
         * @var AgentAffectationService $affectationService
         * @var AgentGradeService $gradeService
         * @var AgentStatutService $statutService
         * @var DemandeExterneService $demandeExterneService
         * @var FormationInstanceInscritService $inscriptionService
         * @var UserService $userService
         */
@@ -32,6 +34,7 @@ class AgentControllerFactory {
        $affectationService = $container->get(AgentAffectationService::class);
        $gradeService = $container->get(AgentGradeService::class);
        $statutService = $container->get(AgentStatutService::class);
        $demandeExterneService = $container->get(DemandeExterneService::class);
        $inscriptionService = $container->get(FormationInstanceInscritService::class);
        $userService = $container->get(UserService::class);

@@ -40,6 +43,7 @@ class AgentControllerFactory {
        $controller->setAgentAffectationService($affectationService);
        $controller->setAgentGradeService($gradeService);
        $controller->setAgentStatutService($statutService);
        $controller->setDemandeExterneService($demandeExterneService);
        $controller->setFormationInstanceInscritService($inscriptionService);
        $controller->setUserService($userService);

+4 −3
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ use Formation\Provider\Privilege\DemandeexternePrivileges;use Formation\Provider
 */

$retour = $options['retour'] ?? null;
$action = $options['action'] ?? true;
?>

<?php $canModifierDemande = $this->isAllowed($demande, DemandeexternePrivileges::DEMANDEEXTERNE_MODIFIER); ?>
@@ -53,6 +54,7 @@ $retour = $options['retour'] ?? null;
    </div>
    <div class="col-md-5">

        <?php if ($action) : ?>
        <!-- ACTION ------------------------------------------------------------------------------------------------------->
        <div>
        <?php
@@ -86,8 +88,8 @@ $retour = $options['retour'] ?? null;
            <span class="icon icon-retirer"></span>
            J'annule mon inscription
        </a>

        <br/>
        </div>
        <?php endif; ?>

        <!-- VALIDATION  ------------------------------------------------------------------------------------------------------->
        <div>
@@ -111,4 +113,3 @@ $retour = $options['retour'] ?? null;
        </div>
    </div>
</div>
</div>
+42 −1
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
 */

use Application\Entity\Db\Agent;
use Application\Entity\Db\Interfaces\HasSourceInterface;
use Formation\Entity\Db\Formation;
use Formation\Provider\Privilege\FormationinstancedocumentPrivileges;

@@ -24,3 +25,43 @@ $canHistorique = $this->isAllowed(FormationinstancedocumentPrivileges::getResour
        Générer l'historique de formation
    </a>
<?php endif; ?>

<h2> Formations suivies</h2>


<?php if (empty($formations)) : ?>
    <em> Aucune formation </em>
<?php else : ?>
    <?php foreach ($formations as $inscription) : ?>
        <div class="row formation-inscription">
            <div class="col-md-7 description">
                <?php echo $this->formationInstanceInformations($inscription->getInstance(), 'bloc'); ?>
                <br/>
                <br/>
            </div>
            <div class="col-md-5">
                <?php if ($inscription->getSource()->getCode() !== HasSourceInterface::SOURCE_EMC2) : ?>
                    <div class="alert alert-info">
                        <span class="icon icon-information"></span>
                        Formation gérée par <?php echo $inscription->getSource()->getLibelle(); ?>
                    </div>
                <?php else : ?>
                    <?php if ($inscription->getInstance()->isEnqueteActive() AND $inscription->getValidationEnquete() === null) : ?>
                        <div class="alert alert-warning">
                            <span class="icon icon-information"></span>
                            Enquête non remplie
                        </div>
                    <?php else : ?>
                        <a
                            <?php /** @see \Formation\Controller\FormationInstanceDocumentController::genererAttestationAction() */?>
                                href="<?php echo $this->url('formation-instance/generer-attestation', ['inscrit' => $inscription->getId()], [], true); ?>"
                                class="btn btn-primary action"
                        >
                            <span class="icon icon-pdf"> Télécharge l'attestation</span>
                        </a>
                    <?php endif; ?>
                <?php endif; ?>
            </div>
        </div>
    <?php endforeach; ?>
<?php endif; ?>
+102 −1
Original line number Diff line number Diff line
aaaa
 No newline at end of file
<?php

/**
 * @var Agent $agent
 * @var FormationInstanceInscrit[] $inscriptions
 */


use Application\Entity\Db\Agent;
use Formation\Entity\Db\FormationInstanceInscrit;

$formationValidees = [];
foreach ($inscriptions as $inscription) {
    if ($inscription->getInstance()->estPrete() AND $inscription->getListe() === FormationInstanceInscrit::PRINCIPALE) $formationValidees[] = $inscription;
}

$formationsAttentes = [];
foreach ($inscriptions as $inscription) {
    if ($inscription->getInstance()->estPrete() AND $inscription->getListe() !== FormationInstanceInscrit::PRINCIPALE) $formationsAttentes[] = $inscription;
    if ($inscription->getInstance()->estPreparation()) $formationsAttentes[] = $inscription;
}

?>

<h2> Inscriptions validées </h2>


<?php if (empty($formationValidees)) : ?>
    <em> Aucune formation validée </em>
<?php else : ?>
<?php foreach ($formationValidees as $inscription) : ?>
    <?php
    $instance = $inscription->getInstance();
    $nbPlace = ($instance->getNbPlacePrincipale() + $instance->getNbPlaceComplementaire()) - (count($instance->getListePrincipale()) + count($instance->getListeComplementaire()));
    ?>
    <div class="row formation-inscription">
        <div class="col-md-8 description">
            <?php echo $this->formationInstanceInformations($instance, 'bloc'); ?>
            <br/>
            <strong> Inscrit en liste <?php echo $inscription->getListe(); ?></strong>
        </div>
<!--        <div class="col-md-4">-->
<!--            <a-->
<!--                --><?php ///** @see \Formation\Controller\FormationInstanceInscritController::desinscriptionAction() */?>
<!--                    href="--><?php //echo $this->url('formation-instance/desinscription', ['inscrit' => $inscription->getId()], [], true); ?><!--"-->
<!--                    class="btn btn-danger action ajax-modal" data-event="modification"-->
<!--            >-->
<!--                <span class="icon icon-retirer"> J'annule mon inscription </span>-->
<!--            </a>-->
<!--            --><?php //if ($instance->getEtat()->getCode() === SessionEtats::ETAT_FORMATION_CONVOCATION AND $inscription->getListe() === FormationInstanceInscrit::PRINCIPALE) : ?>
<!--                <br/>-->
<!--                <a-->
<!--                    --><?php ///** @see \Formation\Controller\FormationInstanceDocumentController::genererConvocationAction() */?>
<!--                        href="--><?php //echo $this->url('formation-instance/generer-convocation', ['inscrit' => $inscription->getId()], [], true); ?><!--" class="btn btn-primary action"-->
<!--                >-->
<!--                    <span class="icon icon-pdf"> Je télécharge ma convocation</span>-->
<!--                </a>-->
<!--            --><?php //endif; ?>
<!--        </div>-->
    </div>
    <br/>
<?php endforeach; ?>
<?php endif; ?>

<h2> Inscriptions en attentes </h2>


<?php if (empty($formationsAttentes)) : ?>
    <em> Aucune formation en attente de validation </em>
<?php else : ?>
    <?php foreach ($formationsAttentes as $inscription) : ?>
        <?php
        $instance = $inscription->getInstance();
        $nbPlace = ($instance->getNbPlacePrincipale() + $instance->getNbPlaceComplementaire()) - (count($instance->getListePrincipale()) + count($instance->getListeComplementaire()));
        ?>
        <div class="row formation-inscription">
            <div class="col-md-8 description">
                <?php echo $this->formationInstanceInformations($instance, 'bloc'); ?>
                <br/>
            </div>
<!--            <div class="col-md-4">-->
<!--                <a-->
<!--                    --><?php ///** @see \Formation\Controller\FormationInstanceInscritController::desinscriptionAction() */?>
<!--                        href="--><?php //echo $this->url('formation-instance/desinscription', ['inscrit' => $inscription->getId()], [], true); ?><!--"-->
<!--                        class="btn btn-danger action ajax-modal" data-event="modification"-->
<!--                >-->
<!--                    <span class="icon icon-retirer"> J'annule mon inscription </span>-->
<!--                </a>-->
<!--                --><?php //if ($instance->getEtat()->getCode() === SessionEtats::ETAT_FORMATION_CONVOCATION AND $inscription->getListe() === FormationInstanceInscrit::PRINCIPALE) : ?>
<!--                    <br/>-->
<!--                    <a-->
<!--                        --><?php ///** @see \Formation\Controller\FormationInstanceDocumentController::genererConvocationAction() */?>
<!--                            href="--><?php //echo $this->url('formation-instance/generer-convocation', ['inscrit' => $inscription->getId()], [], true); ?><!--" class="btn btn-primary action"-->
<!--                    >-->
<!--                        <span class="icon icon-pdf"> Je télécharge ma convocation</span>-->
<!--                    </a>-->
<!--                --><?php //endif; ?>
<!--            </div>-->
        </div>
        <br/>
    <?php endforeach; ?>
<?php endif; ?>
Loading