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

Amélioration de l'affichage

parent 672e6862
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@ namespace Application\Entity\Db;

use Application\Entity\HasAgentInterface;
use Autoform\Entity\Db\FormulaireInstance;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use UnicaenUtilisateur\Entity\HistoriqueAwareInterface;
use UnicaenUtilisateur\Entity\HistoriqueAwareTrait;

@@ -21,6 +23,8 @@ class FormationInstanceInscrit implements HistoriqueAwareInterface, HasAgentInte
    private $agent;
    /** @var string */
    private $liste;
    /** @var ArrayCollection (FormationInstancePresence) */
    private $presences;
    /** @var FormationInstanceFrais */
    private $frais;
    /** @var FormulaireInstance */
@@ -126,5 +130,37 @@ class FormationInstanceInscrit implements HistoriqueAwareInterface, HasAgentInte
    }


    public function getPresences()
    {
        return $this->presences->toArray();
    }

    public function wasPresent(FormationInstanceJournee $journee)
    {
        /** @var FormationInstancePresence $presence */
        foreach ($this->presences as $presence) {
            if ($presence->getJournee() === $journee) return $presence->isPresent();
        }
        return false;
    }

    public function getDureePresence()
    {
        $sum = DateTime::createFromFormat('d/m/Y H:i','01/01/1970 00:00');
        /** @var FormationInstancePresence[] $presences */
        $presences = array_filter($this->presences->toArray(), function (FormationInstancePresence $a) { return $a->estNonHistorise() AND $a->isPresent(); });
        foreach ($presences as $presence) {
            $journee = $presence->getJournee();
            $debut = DateTime::createFromFormat('d/m/Y H:i',$journee->getJour()." ".$journee->getDebut());
            $fin = DateTime::createFromFormat('d/m/Y H:i',$journee->getJour()." ".$journee->getFin());
            $duree = $fin->diff($debut);
            $sum->add($duree);
        }

        $result = $sum->diff(DateTime::createFromFormat('d/m/Y H:i','01/01/1970 00:00'));
        $heures = ($result->d * 24 + $result->h);
        $minutes = ($result->i);
        $text = $heures . " heures " . (($minutes !== 0)?($minutes." minutes"):"");
        return $text;
    }
}
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

        <field name="liste"             type="string" length="64"       column="liste"     nullable="true"/>
        <one-to-one field="frais" target-entity="Application\Entity\Db\FormationInstanceFrais" mapped-by="inscrit" />
        <one-to-many field="presences" target-entity="Application\Entity\Db\FormationInstancePresence" mapped-by="inscrit" />

        <one-to-one target-entity="Autoform\Entity\Db\FormulaireInstance"  field="questionnaire">
            <join-column name="questionnaire_id" referenced-column-name="id"/>
+2 −2
Original line number Diff line number Diff line
@@ -312,9 +312,9 @@ $this->headTitle("Formation Instance: #".$instance->getInstanceCode() . " - " .
                            <span class="icon euro"></span></a>
                        <?php /** @see \Application\Controller\FormationInstanceController::renseignerQuestionnaireAction() */?>
                        <a href="<?php echo $this->url('formation-instance/renseigner-questionnaire', ['inscrit' => $inscrit->getId()], [], true); ?>"
                           data-toggle="tooltip" data-html="true" title="Saissir du formulaire de retour de formation pour <span class='highlight agent'><?php echo $inscrit->getAgent()->getDenomination(); ?></span><br/><?php echo ($inscrit->getFrais())?$inscrit->getFrais()->afficheFrais():"Aucun"; ?>"
                           data-toggle="tooltip" data-html="true" title="Saissir du formulaire de retour de formation pour <span class='highlight agent'><?php echo $inscrit->getAgent()->getDenomination(); ?></span>"
                        >
                            <span class="icon editer"></span></a>
                            <span class="icon paragraph"></span><span class="lettrine">?</span></a>
                        <?php if (! $complementaireComplete) : ?>
                            <?php /** @see \Application\Controller\FormationInstanceController::envoyerListeComplementaireAction() */?>
                        <a  href="<?php echo $this->url('formation-instance/envoyer-liste-complementaire', ['inscrit' => $inscrit->getId()], [], true); ?>"
+83 −4
Original line number Diff line number Diff line
<?php

use Application\Entity\Db\FormationInstanceInscrit;
use Application\Entity\Db\FormationInstanceJournee;

/**
 * @see \Application\Controller\FormationInstanceController::renseignerQuestionnaireAction()
@@ -10,6 +11,9 @@ use Application\Entity\Db\FormationInstanceInscrit;
$instanceLibelle = $inscrit->getInstance()->getInstanceCode() . " ".$inscrit->getInstance()->getFormation()->getLibelle();
$this->headTitle("Renseignement du formulaire de retour de formation : " . $instanceLibelle);

$agent = $inscrit->getAgent();
$instancef = $inscrit->getInstance();

$canRenseigner = true;
?>

@@ -22,20 +26,69 @@ $canRenseigner = true;
        <div class="col-md-6">
            <div class="panel panel-info">
                <div class="panel-heading">
                    Information sur l'agent
                    <h3>Information sur l'agent</h3>
                </div>
                <div class="panel-body">
                    ...
                    <dl class="dl-horizontal">
                        <dt> Dénomination </dt>
                        <dd> <?php echo $agent->getDenomination(); ?></dd>
                        <dt> Affectation principale </dt>
                        <dd> <?php echo ($agent->getAffectationPrincipale())?$agent->getAffectationPrincipale()->getStructure()->getLibelleLong():"Non renseigné"; ?> </dd>
                        <dt> Présence </dt>
                        <dd>

                    <table class="presence">
                    <tr>
                    <?php /** @var FormationInstanceJournee $journee */?>
                    <?php foreach ($instancef->getJournees() as $journee) : ?>
                        <td class="journee">
                        <?php echo $journee->getJour(); ?> <br/>
                        <?php echo $journee->getDebut(); ?> &rightarrow; <?php echo $journee->getFin(); ?>
                        </td>
                    <?php endforeach; ?>
                    </tr>
                    <tr>
                    <?php foreach ($instancef->getJournees() as $journee) : ?>
                        <td class="reponse">
                            <?php if ($inscrit->wasPresent($journee)) : ?>
                                <span class="icon ok" style="color:darkgreen;" ></span>
                            <?php else : ?>
                                <span class="icon ko" style="color:darkred;" ></span>
                            <?php endif; ?>
                        </td>
                    <?php endforeach;?>
                    </tr>
                    </table>

                        </dd>
                        <dt> Durée de présence </dt>
                        <dd> <?php echo $inscrit->getDureePresence(); ?> </dd>
                    </dl>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="panel panel-info">
                <div class="panel-heading">
                    Information sur la formation
                    <h3>Information sur la formation</h3>
                </div>
                <div class="panel-body">
                    ...
                    <dl class="dl-horizontal">
                        <dt> Action de formation </dt>
                        <dd> <?php echo $instanceLibelle; ?> </dd>
                        <dt> Période de formation</dt>
                        <dd> <?php echo $instancef->getDebut(); ?> &rightarrow; <?php echo $instancef->getFin(); ?></dd>
                        <dt> Durée de la formation</dt>
                        <dd> <?php echo $instancef->getDuree(); ?></dd>
                        <dt> Formateur(s)</dt>
                        <dd>
                            <ul>
                                <?php foreach ($instancef->getFormateurs() as $formateur) : ?>
                                <li><?php echo $formateur->getPrenom(); ?> <?php echo $formateur->getNom(); ?> (<?php echo $formateur->getAttachement()?:"Non renseigné";?>)</li>
                                <?php endforeach; ?>
                            </ul>
                        </dd>
                    </dl>
                </div>
            </div>
        </div>
@@ -69,3 +122,29 @@ foreach ($reponses as $reponse) {
    </div>
<?php endif; ?>

<style>
    table.presence {
        /*border : 1px solid black;*/
    }

    table.presence tr td {
        border : 1px solid black;
    }

    table.presence tr td.journee{
        writing-mode: vertical-rl;
        text-orientation: mixed;
        padding-top:.5rem;
        padding-bottom:1rem;
        background: #1b6d85;
        color:white;
        width: 5rem;
    }

    table.presence tr td.reponse {
        vertical-align: center;
        text-align: center;
        width: 5rem;
        height: 5rem;
    }
</style>
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
@@ -248,3 +248,7 @@ span.icon.fiche-poste:before {
span.icon.euro:before {
    content: "\f153";
}

span.icon.paragraph:before {
    content: "\f039";
}
 No newline at end of file