Commit c9ace2ea authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Vue de synthèse dans l'écran Feuille de temps

parent fd2601c8
Loading
Loading
Loading
Loading
Loading
+94 −19
Changes for front/src/TimesheetActivitySynthesis.vue: 94 added lines, 19 removed lines.
Original line number Diff line number Diff line
@@ -18,27 +18,90 @@
            </div>
        </transition>

      <section v-for="entry in synthesis.by_persons">
        <strong>{{ entry.label }}</strong>

        <section class="projet">
          <div v-for="wp in entry.datas.current.workpackages">
            {{ wp }}
      <section class="synthesis heading">
        <div class="label-line">
          <span @click="state = (state == 'period' ? 'person' : 'period')" style="cursor: pointer">
            <i class="icon-angle-left" :class="{'disabled': state == 'period' }"></i>
            <span v-if="state == 'person'">Par Période</span>
            <span v-if="state == 'period'">Par Période</span>
            <i class="icon-angle-right" :class="{'disabled': state == 'person' }"></i>
          </span>
        </div>

        <div v-for="wp in synthesis.headings.current.workpackages" class="main research">
          <span class="value hours">{{ wp.label }}</span>
        </div>

        <div class="main research total">
          <span class="value hours">Total</span>
        </div>
        </section>

        <strong class="total">
        <div v-for="prj in synthesis.headings.prjs.prjs" :title="prj.label"  class="research">
          <span class="value hours">{{ prj.label }}</span>
        </div>

        <div v-for="other in synthesis.headings.others" :title="other.label" :class="other.group">
          <span class="value hours">{{ other.label }}</span>
        </div>

        <div class="total">
          <span class="value">
            {{ entry.total | duration }}
            Total
          </span>
          heure(s)
        </strong>
        <hr>
        {{ entry }}
        </div>
      </section>

      <section v-for="entry in facet" class="synthesis">
        <div class="label-line">{{ entry.label }}</div>

        <div v-for="wp in entry.datas.current.workpackages" :title="wp.code +' - ' +wp.label" class="main research">
          <span class="value hours">{{ wp.total | duration }}</span>
        </div>

        <div class="main research total">
          <span class="value hours">{{ entry.datas.current.total | duration }}</span>
        </div>

        <div v-for="prj in entry.datas.prjs" :title="prj.label"  class="research">
          <span class="value hours">{{ prj.total | duration }}</span>
        </div>

        <div v-for="other in entry.datas.others" :title="other.label" :class="other.group">
          <span class="value hours">{{ other.total | duration }}</span>
        </div>

        <div class="total">
          {{ entry.total | duration }}
        </div>

      </section>

      <section class="synthesis heading">
        <div class="label-line"> Total </div>

        <div v-for="wp in synthesis.headings.current.workpackages" class="main research">
          <span class="value hours">{{ wp.total | duration }}</span>
        </div>

        <div class="main research total">
          <span class="value hours">{{ synthesis.headings.current.total | duration }}</span>
        </div>

        <div v-for="prj in synthesis.headings.prjs.prjs" :title="prj.label"  class="research">
          <span class="value hours">{{ prj.total | duration }}</span>
        </div>

        <div v-for="other in synthesis.headings.others" :title="other.label" :class="other.group">
          <span class="value hours">{{ other.total | duration }}</span>
        </div>

       <pre>{{ synthesis }}</pre>
        <div class="total">
          <span class="value">
            {{ synthesis.headings.total | duration }}
          </span>
        </div>
      </section>

    </section>
</template>
@@ -46,11 +109,8 @@

    // node node_modules/.bin/vue-cli-service build --name TimesheetActivitySynthesis --dest public/js/oscar/dist --no-clean --formats umd,umd-min --target lib src/TimesheetActivitySynthesis.vue

    import PersonAutoCompleter from "./components/PersonAutoCompleter";
    import PersonSchedule from "./components/PersonSchedule";
    import AjaxResolve from "./components/AjaxResolve";


    const STATE_PERIOD = "period";
    const STATE_PERSON = "person";

    export default {
        name: 'TimesheetActivitySynthesis',
@@ -68,13 +128,28 @@

        data() {
            return {
                loading: null
                loading: null,
                state: STATE_PERIOD
            }
        },

        computed: {
          synthesis(){
            return this.initialdata;
          },
          facet(){
            if( this.state == STATE_PERIOD )
              return this.synthesis.by_periods;
            else
              return this.synthesis.by_persons;
          }
        },

        filters: {
          duration(v){
            let h = Math.floor(v);
            let m = v - h;
            return h + "h" +m;
          }
        },

+58 −6
Changes for module/Oscar/src/Oscar/Service/TimesheetService.php: 58 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -1616,6 +1616,26 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
            'workpackages' => []
        ];

        $headings = [
            'total_current'     => 0.0,
            'total_prjs'        => 0.0,
            'total_others'      => 0.0,
            'total_active'      => 0.0,
            'total_off'      => 0.0,
            'total'         => 0.0,
            'current' => [
                'total' => 0.0,
                'workpackages' => []
            ],
            'prjs' => [
                'total' => 0.0,
                'prjs' => []
            ],
            'others' => [

            ],
        ];

        $activityInfos = [
            'total' => 0.0,
            'workpackages' => []
@@ -1633,6 +1653,11 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
                'code' => $workPackage->getCode(),
                'total' => 0.0
            ];
            $headings['current']['workpackages'][$workPackage->getId()] = [
                'label' => $workPackage->getLabel(),
                'code' => $workPackage->getCode(),
                'total' => 0.0
            ];
        }

        $othersInfos = [
@@ -1662,6 +1687,12 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
                'group' => $group,
                'total' => 0.0,
            ];

            $headings['others'][$item] = [
                'label' => $label,
                'group' => $group,
                'total' => 0.0,
            ];
        }

        $output = [
@@ -1680,8 +1711,8 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
                'label' => $periodInfos->getPeriodLabel(),
                'code' => $periodInfos->getPeriodCode(),
                'total' => 0.0,
                'details' => [
                    'activity' => $activityInfos,
                'datas' => [
                    'current' => $activityInfos,
                    'prjs' => [],
                    'others' => $othersModel
                ]
@@ -1730,8 +1761,11 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
                    $datasPersons[$personId]['datas']["current"]['total'] += $timesheetDuration;
                    $datasPersons[$personId]['datas']["current"]['workpackages'][$timesheetWorkpackageId]['total'] += $timesheetDuration;

                    $datasPeriods[$timesheetPeriod]['details']['activity']['total'] += $timesheetDuration;
                    $datasPeriods[$timesheetPeriod]['details']['activity']['workpackages'][$timesheetWorkpackageId]['total'] += $timesheetDuration;
                    $datasPeriods[$timesheetPeriod]['datas']['current']['total'] += $timesheetDuration;
                    $datasPeriods[$timesheetPeriod]['datas']['current']['workpackages'][$timesheetWorkpackageId]['total'] += $timesheetDuration;

                    $headings['current']['total'] += $timesheetDuration;
                    $headings['current']['workpackages'][$timesheetWorkpackageId]['total'] += $timesheetDuration;
                } // Autre projet avec Feuille de temps
                elseif ($timesheetActivityId != null) {
                    $infosProjects['total'] += $timesheetDuration;
@@ -1758,20 +1792,37 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
                        ];
                    }

                    if (!array_key_exists($timesheetActivityId, $headings['prjs']['prjs'])) {
                        $headings['prjs']['prjs'][$timesheetActivityId] = [
                            'label' => $t['acronym'],
                            'total' => 0.0
                        ];
                    }

                    $infosProjects['projects'][$timesheetActivityId]['total'] += $timesheetDuration;

                    $datasPersons[$personId]['datas']["prjs"][$timesheetActivityId]['total'] += $timesheetDuration;
                    $datasPeriods[$timesheetPeriod]['datas']["prjs"][$timesheetActivityId]['total'] += $timesheetDuration;

                    $headings['prjs']['total'] += $timesheetDuration;
                    $headings['prjs']['prjs'][$timesheetActivityId]['total'] += $timesheetDuration;

                } // Autre
                else {
                    $key = $t['itemkey'];
                    $datasPersons[$personId]['datas']["others"][$key]['total'] += $timesheetDuration;
                    $datasPeriods[$timesheetPeriod]['datas']["others"][$key]['total'] += $timesheetDuration;
                    $headings['others'][$key]['total'] += $timesheetDuration;
                }

                $headings['total'] += $timesheetDuration;
            }
        }

        foreach ($otherProjectsModel as $activityId => $dt) {
            foreach ($datasPeriods as $period => $periodDt) {
                if (!array_key_exists($activityId, $periodDt['details']['prjs'])) {
                    $datasPeriods[$period]['details']['prjs'][$activityId] = [
                if (!array_key_exists($activityId, $periodDt['datas']['prjs'])) {
                    $datasPeriods[$period]['datas']['prjs'][$activityId] = [
                        'label' => $dt['label'],
                        'total' => 0.0
                    ];
@@ -1787,6 +1838,7 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
            }
        }

        $output['headings'] = $headings;
        $output['by_persons'] = $datasPersons;
        $output['by_periods'] = $datasPeriods;

+60 −21
Changes for module/Oscar/view/oscar/project-grant/timesheet.phtml: 60 added lines, 21 removed lines.
Original line number Diff line number Diff line
@@ -40,12 +40,60 @@
        content: '';
    }

    .synthesis .project {
        background: #0b97c4;

    .synthesis {
        border-bottom: thin solid #333;
        display: flex;
        font-weight: 100;
    }
    .synthesis .project {
        background: #0b97c4;

    .synthesis > * {
        flex: 1;
        text-align: right;
        vertical-align: center;
    }

    .synthesis .label-line {
        flex: 2;
    }

    synthesis .group {
        display: flex;
    }
    synthesis .group > * {
        flex: 1;
    }

    .synthesis .research {
        background: #b5dae0;
    }

    .synthesis .abs {
        background: #d5e3b1;
    }

    .synthesis .other {
        background: #d6b4e4;
    }

    .synthesis .education {
        background: #a5e2c6;
    }

    .synthesis .total {
        font-weight: 500;
    }

    .synthesis.heading .total {
        font-weight: 500;
    }

    .synthesis .value {
        padding: .25em;
        display: block;
        border-left: thin solid rgba(255,255,255,.5);
    }

</style>
<div class="container">
    <h1>
@@ -56,6 +104,14 @@
            Revenir sur la fiche
        </a>
    </h1>

    <?php if($activity->isTimesheetAllowed()): ?>
    <section>
        <h2>
            <i class="icon-calendar"></i>
            Synthèse
        </h2>

        <div id="synthesis"></div>

        <script>
@@ -70,23 +126,6 @@
            })
        </script>

    <a href="<?= $this->url('timesheet/synthesisactivitybounds', ['id' => $activity->getId()]) ?>?year=2020">
        2020
    </a>

    <a href="<?= $this->url('timesheet/synthesisactivitybounds', ['id' => $activity->getId()]) ?>?year=2021">
        2021
    </a>

    <?php if($activity->isTimesheetAllowed()): ?>
    <section>
        <h2>
            <i class="icon-calendar"></i>
            Synthèse
        </h2>

        <?= $this->url('timesheet/synthesisactivitybounds', ['id' => $activity->getId()]) ?>

    </section>
    <section>
        <h2>
+2 −134

File changed.

Preview size limit exceeded, changes collapsed.

+2 −134

File changed.

Preview size limit exceeded, changes collapsed.