feat: colorar numeros de semanas segun el registro de horas
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2023-02-21 15:16:28 +01:00
parent 1c1e4cc176
commit c8c48ea175
5 changed files with 75 additions and 31 deletions

View File

@ -24,7 +24,7 @@
<div class="weekdays">
<section
ng-repeat="day in ::$ctrl.weekDays"
translate-attr="::{title: day.name}"
translate-attr="::{title: day.name}"
ng-click="$ctrl.selectWeekDay($event, day.index)">
<span>{{::day.localeChar}}</span>
</section>
@ -57,4 +57,4 @@
</section>
</div>
</div>
</div>
</div>

View File

@ -207,14 +207,23 @@ export default class Calendar extends FormInput {
}
repeatLast() {
if (!this.formatDay) return;
if (this.formatDay) {
const days = this.element.querySelectorAll('.days > .day');
for (let i = 0; i < days.length; i++) {
this.formatDay({
$day: this.days[i],
$element: days[i]
});
}
}
let days = this.element.querySelectorAll('.days > .day');
for (let i = 0; i < days.length; i++) {
this.formatDay({
$day: this.days[i],
$element: days[i]
});
if (this.formatWeek) {
const weeks = this.element.querySelectorAll('.weeks > .day');
for (const week of weeks) {
this.formatWeek({
$element: week
});
}
}
}
}
@ -228,6 +237,7 @@ ngModule.vnComponent('vnCalendar', {
hasEvents: '&?',
getClass: '&?',
formatDay: '&?',
formatWeek: '&?',
displayControls: '<?',
hideYear: '<?',
hideContiguous: '<?',

View File

@ -25,11 +25,11 @@
<div class="totalBox vn-mb-sm" style="text-align: center;">
<h6>{{'Contract' | translate}} #{{$ctrl.businessId}}</h6>
<div>
{{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}}
{{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}}
{{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}}
</div>
<div>
{{'Spent' | translate}} {{$ctrl.contractHolidays.hoursEnjoyed || 0}}
{{'Spent' | translate}} {{$ctrl.contractHolidays.hoursEnjoyed || 0}}
{{'of' | translate}} {{$ctrl.contractHolidays.totalHours || 0}} {{'hours' | translate}}
</div>
<div>
@ -40,11 +40,11 @@
<div class="totalBox" style="text-align: center;">
<h6>{{'Year' | translate}} {{$ctrl.year}}</h6>
<div>
{{'Used' | translate}} {{$ctrl.yearHolidays.holidaysEnjoyed || 0}}
{{'Used' | translate}} {{$ctrl.yearHolidays.holidaysEnjoyed || 0}}
{{'of' | translate}} {{$ctrl.yearHolidays.totalHolidays || 0}} {{'days' | translate}}
</div>
<div>
{{'Spent' | translate}} {{$ctrl.yearHolidays.hoursEnjoyed || 0}}
{{'Spent' | translate}} {{$ctrl.yearHolidays.hoursEnjoyed || 0}}
{{'of' | translate}} {{$ctrl.yearHolidays.totalHours || 0}} {{'hours' | translate}}
</div>
</div>
@ -66,7 +66,7 @@
order="businessFk DESC"
limit="5">
<tpl-item>
<div>#{{businessFk}}</div>
<div>#{{businessFk}}</div>
<div class="text-caption text-secondary">
{{started | date: 'dd/MM/yyyy'}} - {{ended ? (ended | date: 'dd/MM/yyyy') : 'Indef.'}}
</div>
@ -87,17 +87,17 @@
<vn-chip>
<vn-avatar class="festive">
</vn-avatar>
<span translate>Festive</span>
<span translate>Festive</span>
</vn-chip>
<vn-chip>
<vn-avatar class="today">
</vn-avatar>
<span translate>Current day</span>
<span translate>Current day</span>
</vn-chip>
</div>
</div>
</vn-side-menu>
<vn-confirm
<vn-confirm
vn-id="confirm"
message="This item will be deleted"
question="Are you sure you want to continue?">

View File

@ -1,7 +1,7 @@
<vn-crud-model
vn-id="model"
url="WorkerTimeControls/filter"
filter="::$ctrl.filter"
filter="::$ctrl.filter"
data="$ctrl.hours">
</vn-crud-model>
<vn-card class="vn-pa-lg vn-w-lg">
@ -16,7 +16,7 @@
{{::weekday.dated | date: 'MMMM'}}
</span>
</div>
<vn-chip
<vn-chip
title="{{::weekday.event.name}}"
ng-class="{invisible: !weekday.event}">
<vn-avatar
@ -66,7 +66,7 @@
</vn-td>
</vn-tr>
<vn-tr>
<vn-td center ng-repeat="weekday in $ctrl.weekDays">
<vn-td center ng-repeat="weekday in $ctrl.weekDays">
<vn-icon-button
icon="add_circle"
vn-tooltip="Add time"
@ -78,27 +78,27 @@
</vn-table>
</vn-card>
<vn-button-bar class="vn-pa-xs vn-w-lg">
<vn-button
label="Satisfied"
<vn-button-bar class="vn-pa-xs vn-w-lg">
<vn-button
label="Satisfied"
ng-click="$ctrl.isSatisfied()">
</vn-button>
<vn-button
label="Not satisfied"
<vn-button
label="Not satisfied"
ng-click="reason.show()">
</vn-button>
</vn-button-bar>
<vn-side-menu side="right">
<div class="vn-pa-md">
<div class="totalBox" style="text-align: center;">
<h6 translate>Hours</h6>
<vn-label-value
label="Week total"
<vn-label-value
label="Week total"
value="{{$ctrl.weekTotalHours}} h.">
</vn-label-value>
<vn-label-value
label="Finish at"
<vn-label-value
label="Finish at"
value="{{$ctrl.getFinishTime()}}">
</vn-label-value>
</div>
@ -106,6 +106,7 @@
vn-id="calendar"
class="vn-pt-md"
ng-model="$ctrl.date"
format-week="$ctrl.formatWeek($element)"
has-events="$ctrl.hasEvents($day)">
</vn-calendar>
</div>
@ -177,4 +178,4 @@
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
<button response="accept" translate>Save</button>
</tpl-buttons>
</vn-dialog>
</vn-dialog>

View File

@ -345,6 +345,39 @@ class Controller extends Section {
this.vnApp.showError(this.$t(e.message));
}
}
formatWeek($element) {
let weekNumber = $element.firstElementChild;
let weekNumberValue = $element.firstElementChild.innerHTML;
console.log(weekNumberValue);
const filter = {
where: {
workerFk: 9,
// year: this.date.getFullYear(),
// week: weekNumberValue - 1
}
};
// const filter = {
// where: {
// and: [
// {workerFk: parseInt(this.$params.id)},
// {year: this.date.getFullYear()},
// {week: weekNumberValue - 1}
// ]
// }
// };
console.log(filter);
this.$http.get('WorkerTimeControlMails', {filter})
.then(res => {
console.log(res.data.state);
const state = res.data.state;
if (state == 'CONFIRMED') weekNumber.style.color = '#97B92F';
else if (state == 'REVISE') weekNumber.style.color = '#FF4444';
else weekNumber.style.color = '#5151c0';
// weekNumber.title = event.name;
// weekNumber.style.backgroundColor = event.color;
});
}
}
Controller.$inject = ['$element', '$scope', 'vnWeekDays'];