Commit 683d3e68 authored by Stéphane Bouvry's avatar Stéphane Bouvry
Browse files

Synthèse des déclarations pour une activité (par Annèes, personne et période)

parent ea25bdef
Loading
Loading
Loading
Loading
+20 −0
Changes for module/Oscar/src/Oscar/Service/TimesheetService.php: 20 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1174,6 +1174,23 @@ class TimesheetService implements ServiceLocatorAwareInterface, EntityManagerAwa

        $declarersIds = [];

        $validations = $this->getEntityManager()->getRepository(ValidationPeriod::class)->createQueryBuilder('vp')
            ->where('vp.object_id = :activityId AND vp.object = :object')
            ->setParameters([
                'activityId' => $activity->getId(),
                'object' => ValidationPeriod::OBJECT_ACTIVITY
            ])
            ->getQuery()
            ->getResult();

        $validationsState = [];
        /** @var ValidationPeriod $validation */
        foreach ($validations as $validation) {
            $key = $validation->getDeclarer()->getId() . '-' . $validation->getPeriod();
            $validationsState[$key] = $validation->getStatus();
        }


        /** @var Person $person */
        foreach ($activity->getDeclarers() as $person) {
            $declarersIds[] = $person->getId();
@@ -1193,9 +1210,12 @@ class TimesheetService implements ServiceLocatorAwareInterface, EntityManagerAwa
                'persons' => []
            ];
            foreach ($persons as $person) {

                $personId = $person['id'];
                $validationKey = sprintf('%s-%s', $personId, $period);
                $periods[$period]['persons'][$personId] = [
                    'total' => 0.0,
                    'validation_state' => array_key_exists($validationKey, $validationsState) ? $validationsState[$validationKey] : 'none',
                    'displayname' => $person['displayname'],
                    'workpackages' => [],
                ];
+10 −30
Changes for module/Oscar/view/oscar/project-grant/show.phtml: 10 added lines, 30 removed lines.
Original line number Diff line number Diff line
@@ -469,7 +469,16 @@
            </div>
        </div>

        <h3>Visualiser les feuilles de temps</h3>
        <h3>Synthèse de déclarations</h3>
        <a href="<?= $this->url('timesheet/activity', ['id' => $entity->getId()]) ?>"
           class="btn btn-primary btn-large">
            <i class="icon-calendar"></i>
            Synthèse générale
        </a>



        <h3>Déclarants</h3>
        <?php foreach ($entity->getPersonsDeep() as $personActivity): ?>
            <?php if( $entity->hasDeclarant($personActivity->getPerson()) ):
                $hasDeclaration = $personActivity->getPerson()->hasDeclarationIn($entity);
@@ -485,19 +494,6 @@
                </a>
            <?php endif; ?>
        <?php endforeach; ?>

        <h3>Gérer les déclarations</h3>

        <a href="#" class="btn btn-primary">Validation</a>

        <?php if( $entity->hasDeclarant($this->grant()->getCurrentPerson())  ): ?>
            <?php if( $this->grant()->isDeclarer() && $this->grant()->getCurrentPerson() ): ?>
                <a class="btn btn-primary" href="<?= $this->url('timesheet/declarant') ?>">
                    <i class="icon-calendar"></i>
                    Déclarer vos heures
                </a>
            <?php endif; ?>
        <?php endif; ?>
    <?php endif; ?>

        <?php /*if( ($this->grant()->privilege(\Oscar\Provider\Privileges::ACTIVITY_TIMESHEET_VALIDATE_ADM, $entity) ||
@@ -541,22 +537,6 @@

    <?php endif;  */ ?>

<?php
    if(     $this->grant()->privilege(\Oscar\Provider\Privileges::ACTIVITY_TIMESHEET_VALIDATE_ACTIVITY, $entity) ||
        $this->grant()->privilege(\Oscar\Provider\Privileges::ACTIVITY_TIMESHEET_VALIDATE_SCI, $entity) ||
        $this->grant()->privilege(\Oscar\Provider\Privileges::ACTIVITY_TIMESHEET_VALIDATE_ADM, $entity )):?>
        <section>
            <h2>
                <i class="icon-calendar"></i> Déclarations
            </h2>
            <p>Il y'a <?= count($declarations) ?> déclaration(s) pour cette activité.</p>
            <a href="<?= $this->url('timesheet/validationactivity', ['idactivity' => $entity->getId()]) ?>">
                <i class="icon-pencil"></i>
                Voir les déclarations
            </a>
        </section>
    <?php endif; ?>

<?php
$manage = $this->grant()->privilege(\Oscar\Provider\Privileges::ACTIVITY_WORKPACKAGE_MANAGE, $entity);
if( $this->grant()->privilege(\Oscar\Provider\Privileges::ACTIVITY_WORKPACKAGE_SHOW, $entity) ): ?>
+1 −1
Changes for module/Oscar/view/oscar/public/index.phtml: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@
                            <?php if( count($validations) ): ?>
                                <h1>Validation (<?= count($validations) ?>)</h1>
                                <section>
                                    <a href="<?= $this->url('timesheet/validations') ?>">
                                    <a href="<?= $this->url('timesheet/validations') ?>" class="btn btn-primary">
                                        <i class="icon-pencil"></i>
                                        Valider les déclarations
                                    </a>
+1 −1
Changes for module/Oscar/view/oscar/timesheet/resume-activity.phtml: 1 added line, 1 removed line.
Original line number Diff line number Diff line
<div class="container">
    <h1>Activity Resume</h1>
    <div id="app"></div>
    <link rel="stylesheet" href="<?= $this->basePath().'/js/oscar/dist/ResumeActivity.css' ?>">
    <script>
        require(['vue', 'vue-resource', 'ResumeActivity', 'bootbox', 'mm'], function(Vue, VueResource, ResumeActivity, bootbox, moment){
            Vue.use(VueResource);
+2 −0
Changes for public/js/oscar/dist/ResumeActivity.css: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
.line-heading{font-size:1.2em;border-bottom:1px solid #999;text-align:right}.line-heading .line-label{font-size:1.2em;text-transform:capitalize;font-weight:100;text-align:left}.line-total{border-top:1px solid #ccc}.line-total>*{border-right:1px solid #ccc}.line{display:-webkit-box;display:-ms-flexbox;display:flex}.line>*{-webkit-box-flex:1;-ms-flex:1 0 0px;flex:1 0 0;padding:2px 4px}.line .duration{color:#0b58a2}.line .duration.nothing{color:#8f97a0}.line small{text-align:center;color:rgba(0,0,0,.25)}.line .line-label{-webkit-box-flex:3;-ms-flex:3 0 0px;flex:3 0 0}.line .empty-period{-webkit-box-flex:10;-ms-flex:10 1 0px;flex:10 1 0;text-align:center}.line .duration{text-align:right}.line-label{padding-left:1em}.line-datas:nth-child(2n){background:rgba(0,0,0,.05)}.line-datas:hover{background:rgba(11,88,162,.25)}.line-datas>*{border-right:1px solid #ccc}
/*# sourceMappingURL=ResumeActivity.css.map*/
 No newline at end of file
Loading