Commit 959d6408 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

UP/FIX : Vue Déclarant, les créneaux mal qualifiés sont maintenant affichés en...

UP/FIX : Vue Déclarant, les créneaux mal qualifiés sont maintenant affichés en rouge, et le déclarant ne peut plus soumettre sa feuille de temps en cas d'erreur.
parent f873c19f
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -292,7 +292,7 @@
    </section>
</template>
<script>
    // nodejs node_modules/.bin/poi watch --format umd --moduleName  TimesheetDeclarationsList --filename.css TimesheetDeclarationsList.css --filename.js TimesheetDeclarationsList.js --dist public/js/oscar/dist public/js/oscar/src/TimesheetDeclarationsList.vue
// node node_modules/.bin/vue-cli-service build --name TimesheetDeclarationsList --dest ../public/js/oscar/dist/ --no-clean --formats umd,umd-min --target lib src/TimesheetDeclarationsList.vue

    import PersonAutoCompleter from "./components/PersonAutoCompleter";
    import PersonSchedule from "./components/PersonSchedule";
+1 −1
Original line number Diff line number Diff line
@@ -692,7 +692,7 @@
                        <span v-else>Soumettre mes déclarations</span>
                    </button>

                    <span v-else>
                    <span v-else :class="'alert-' +ts.submitableClass" class="alert">
                        Vous ne pouvez pas soumettre cette période<br>
                        <small>{{ ts.submitableInfos }}</small>
                    </span>
+42 −1
Original line number Diff line number Diff line
@@ -4288,6 +4288,9 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        $timesheets = $this->getTimesheetsPersonPeriod($person, $from, $to);
        $hasErrorWorkpackage = [];


        /** @var TimeSheet $t */
        foreach ($timesheets as $t) {
            $dayInt = (int)$t->getDateFrom()->format('d');
@@ -4296,8 +4299,37 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
            if ($icsUid != null && !array_key_exists($icsUid, $icsUidList)) {
                $icsUidList[$icsUid] = $t->getIcsFileName();
            }
            //throw new OscarException("Problème ICI $dayInt $t");

            if (!$t->getActivity() || !$t->getWorkpackage()) {
            if( ($t->getActivity() && !$t->getWorkpackage()) || (!$t->getActivity() && $t->getWorkpackage()) ){
                $hasErrorWorkpackage[] = "Un créneau le " . $t->getDateFrom()->format('d/M') . " n'a pas de lot de travail";
                $otherInfo = $this->getOthersWPByCode($t->getLabel());
                $label = $otherInfo['label'];
                $code = $otherInfo['code'];
                $group = $otherInfo['group'];

                $datas = [
                    'id' => $t->getId(),
                    'int' => $dayInt,
                    'label' => $label,
                    'code' => $code,
                    'group' => $group,
                    'description' => $t->getComment(),
                    'duration' => $t->getDuration(),
                    'status_id' => $t->getValidationPeriod() ? $t->getValidationPeriod()->getStatus() : 'draft',
                    'validations' => $t->getValidationPeriod() ? $t->getValidationPeriod()->json() : null
                ];

                $duree = (float)$t->getDuration();
                $daysInfos[$dayInt]['othersWP'][] = $datas;
                $daysInfos[$dayInt]['duration'] += $duree;
                $daysInfos[$dayInt]['total'] += $duree;
                $periodTotal += $duree;
                $others[$code]['total'] += $duree;
                continue;
            }

            elseif (!$t->getActivity() || !$t->getWorkpackage()) {
                $otherInfo = $this->getOthersWPByCode($t->getLabel());
                $label = $otherInfo['label'];
                $code = $otherInfo['code'];
@@ -4368,6 +4400,14 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
            ];
        }

        $submitableClass = 'info';
        if ( count($hasErrorWorkpackage) ){
            $submitable = false;
            $submitableClass = 'danger';
            $submitableInfos = sprintf('Un ou plusieurs créneaux sont invalides : %s',
                                       implode(', ', $hasErrorWorkpackage));
        }


        $output = [
            'icsUidList' => $icsUidList,
@@ -4393,6 +4433,7 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
            'to' => $periodLastDay->format('Y-m-d'),
            'submitable' => $submitable,
            'submitableInfos' => $submitableInfos,
            'submitableClass' => $submitableClass,
            'editable' => $editable,
            'editableInfos' => $editableInfos,
            'period_total_days' => $totalDays,
+1 −0
Original line number Diff line number Diff line
@@ -6242,6 +6242,7 @@ $onColor: saturate($baseColor, 25%);
  &.sickleave { background-color: #808000; }
  &.wp { background-color: #6a5999; }
  &.conflict { background: #AA0000; }
  &.invalid { background: #AA0000; }
}

.loading-message {
+3 −0
Original line number Diff line number Diff line
@@ -12372,6 +12372,9 @@ pre.alert-danger, pre.alert-info {
.month .cartouche.conflict {
  background: #AA0000;
}
.month .cartouche.invalid {
  background: #AA0000;
}

.loading-message {
  background: white;
Loading