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

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

View File

@ -106,6 +106,7 @@
vn-id="calendar" vn-id="calendar"
class="vn-pt-md" class="vn-pt-md"
ng-model="$ctrl.date" ng-model="$ctrl.date"
format-week="$ctrl.formatWeek($element)"
has-events="$ctrl.hasEvents($day)"> has-events="$ctrl.hasEvents($day)">
</vn-calendar> </vn-calendar>
</div> </div>

View File

@ -345,6 +345,39 @@ class Controller extends Section {
this.vnApp.showError(this.$t(e.message)); 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']; Controller.$inject = ['$element', '$scope', 'vnWeekDays'];