feat: colorar numeros de semanas segun el registro de horas
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
1c1e4cc176
commit
c8c48ea175
|
@ -24,7 +24,7 @@
|
||||||
<div class="weekdays">
|
<div class="weekdays">
|
||||||
<section
|
<section
|
||||||
ng-repeat="day in ::$ctrl.weekDays"
|
ng-repeat="day in ::$ctrl.weekDays"
|
||||||
translate-attr="::{title: day.name}"
|
translate-attr="::{title: day.name}"
|
||||||
ng-click="$ctrl.selectWeekDay($event, day.index)">
|
ng-click="$ctrl.selectWeekDay($event, day.index)">
|
||||||
<span>{{::day.localeChar}}</span>
|
<span>{{::day.localeChar}}</span>
|
||||||
</section>
|
</section>
|
||||||
|
@ -57,4 +57,4 @@
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -207,14 +207,23 @@ export default class Calendar extends FormInput {
|
||||||
}
|
}
|
||||||
|
|
||||||
repeatLast() {
|
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');
|
if (this.formatWeek) {
|
||||||
for (let i = 0; i < days.length; i++) {
|
const weeks = this.element.querySelectorAll('.weeks > .day');
|
||||||
this.formatDay({
|
for (const week of weeks) {
|
||||||
$day: this.days[i],
|
this.formatWeek({
|
||||||
$element: days[i]
|
$element: week
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,6 +237,7 @@ ngModule.vnComponent('vnCalendar', {
|
||||||
hasEvents: '&?',
|
hasEvents: '&?',
|
||||||
getClass: '&?',
|
getClass: '&?',
|
||||||
formatDay: '&?',
|
formatDay: '&?',
|
||||||
|
formatWeek: '&?',
|
||||||
displayControls: '<?',
|
displayControls: '<?',
|
||||||
hideYear: '<?',
|
hideYear: '<?',
|
||||||
hideContiguous: '<?',
|
hideContiguous: '<?',
|
||||||
|
|
|
@ -25,11 +25,11 @@
|
||||||
<div class="totalBox vn-mb-sm" style="text-align: center;">
|
<div class="totalBox vn-mb-sm" style="text-align: center;">
|
||||||
<h6>{{'Contract' | translate}} #{{$ctrl.businessId}}</h6>
|
<h6>{{'Contract' | translate}} #{{$ctrl.businessId}}</h6>
|
||||||
<div>
|
<div>
|
||||||
{{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}}
|
{{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed || 0}}
|
||||||
{{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}}
|
{{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{'Spent' | translate}} {{$ctrl.contractHolidays.hoursEnjoyed || 0}}
|
{{'Spent' | translate}} {{$ctrl.contractHolidays.hoursEnjoyed || 0}}
|
||||||
{{'of' | translate}} {{$ctrl.contractHolidays.totalHours || 0}} {{'hours' | translate}}
|
{{'of' | translate}} {{$ctrl.contractHolidays.totalHours || 0}} {{'hours' | translate}}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -40,11 +40,11 @@
|
||||||
<div class="totalBox" style="text-align: center;">
|
<div class="totalBox" style="text-align: center;">
|
||||||
<h6>{{'Year' | translate}} {{$ctrl.year}}</h6>
|
<h6>{{'Year' | translate}} {{$ctrl.year}}</h6>
|
||||||
<div>
|
<div>
|
||||||
{{'Used' | translate}} {{$ctrl.yearHolidays.holidaysEnjoyed || 0}}
|
{{'Used' | translate}} {{$ctrl.yearHolidays.holidaysEnjoyed || 0}}
|
||||||
{{'of' | translate}} {{$ctrl.yearHolidays.totalHolidays || 0}} {{'days' | translate}}
|
{{'of' | translate}} {{$ctrl.yearHolidays.totalHolidays || 0}} {{'days' | translate}}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{'Spent' | translate}} {{$ctrl.yearHolidays.hoursEnjoyed || 0}}
|
{{'Spent' | translate}} {{$ctrl.yearHolidays.hoursEnjoyed || 0}}
|
||||||
{{'of' | translate}} {{$ctrl.yearHolidays.totalHours || 0}} {{'hours' | translate}}
|
{{'of' | translate}} {{$ctrl.yearHolidays.totalHours || 0}} {{'hours' | translate}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
order="businessFk DESC"
|
order="businessFk DESC"
|
||||||
limit="5">
|
limit="5">
|
||||||
<tpl-item>
|
<tpl-item>
|
||||||
<div>#{{businessFk}}</div>
|
<div>#{{businessFk}}</div>
|
||||||
<div class="text-caption text-secondary">
|
<div class="text-caption text-secondary">
|
||||||
{{started | date: 'dd/MM/yyyy'}} - {{ended ? (ended | date: 'dd/MM/yyyy') : 'Indef.'}}
|
{{started | date: 'dd/MM/yyyy'}} - {{ended ? (ended | date: 'dd/MM/yyyy') : 'Indef.'}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -87,17 +87,17 @@
|
||||||
<vn-chip>
|
<vn-chip>
|
||||||
<vn-avatar class="festive">
|
<vn-avatar class="festive">
|
||||||
</vn-avatar>
|
</vn-avatar>
|
||||||
<span translate>Festive</span>
|
<span translate>Festive</span>
|
||||||
</vn-chip>
|
</vn-chip>
|
||||||
<vn-chip>
|
<vn-chip>
|
||||||
<vn-avatar class="today">
|
<vn-avatar class="today">
|
||||||
</vn-avatar>
|
</vn-avatar>
|
||||||
<span translate>Current day</span>
|
<span translate>Current day</span>
|
||||||
</vn-chip>
|
</vn-chip>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</vn-side-menu>
|
</vn-side-menu>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="confirm"
|
vn-id="confirm"
|
||||||
message="This item will be deleted"
|
message="This item will be deleted"
|
||||||
question="Are you sure you want to continue?">
|
question="Are you sure you want to continue?">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="WorkerTimeControls/filter"
|
url="WorkerTimeControls/filter"
|
||||||
filter="::$ctrl.filter"
|
filter="::$ctrl.filter"
|
||||||
data="$ctrl.hours">
|
data="$ctrl.hours">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<vn-card class="vn-pa-lg vn-w-lg">
|
<vn-card class="vn-pa-lg vn-w-lg">
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
{{::weekday.dated | date: 'MMMM'}}
|
{{::weekday.dated | date: 'MMMM'}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<vn-chip
|
<vn-chip
|
||||||
title="{{::weekday.event.name}}"
|
title="{{::weekday.event.name}}"
|
||||||
ng-class="{invisible: !weekday.event}">
|
ng-class="{invisible: !weekday.event}">
|
||||||
<vn-avatar
|
<vn-avatar
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
</vn-td>
|
</vn-td>
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
<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
|
<vn-icon-button
|
||||||
icon="add_circle"
|
icon="add_circle"
|
||||||
vn-tooltip="Add time"
|
vn-tooltip="Add time"
|
||||||
|
@ -78,27 +78,27 @@
|
||||||
</vn-table>
|
</vn-table>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
|
|
||||||
<vn-button-bar class="vn-pa-xs vn-w-lg">
|
<vn-button-bar class="vn-pa-xs vn-w-lg">
|
||||||
<vn-button
|
<vn-button
|
||||||
label="Satisfied"
|
label="Satisfied"
|
||||||
ng-click="$ctrl.isSatisfied()">
|
ng-click="$ctrl.isSatisfied()">
|
||||||
</vn-button>
|
</vn-button>
|
||||||
<vn-button
|
<vn-button
|
||||||
label="Not satisfied"
|
label="Not satisfied"
|
||||||
ng-click="reason.show()">
|
ng-click="reason.show()">
|
||||||
</vn-button>
|
</vn-button>
|
||||||
</vn-button-bar>
|
</vn-button-bar>
|
||||||
|
|
||||||
<vn-side-menu side="right">
|
<vn-side-menu side="right">
|
||||||
<div class="vn-pa-md">
|
<div class="vn-pa-md">
|
||||||
<div class="totalBox" style="text-align: center;">
|
<div class="totalBox" style="text-align: center;">
|
||||||
<h6 translate>Hours</h6>
|
<h6 translate>Hours</h6>
|
||||||
<vn-label-value
|
<vn-label-value
|
||||||
label="Week total"
|
label="Week total"
|
||||||
value="{{$ctrl.weekTotalHours}} h.">
|
value="{{$ctrl.weekTotalHours}} h.">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value
|
<vn-label-value
|
||||||
label="Finish at"
|
label="Finish at"
|
||||||
value="{{$ctrl.getFinishTime()}}">
|
value="{{$ctrl.getFinishTime()}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
</div>
|
</div>
|
||||||
|
@ -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>
|
||||||
|
@ -177,4 +178,4 @@
|
||||||
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
||||||
<button response="accept" translate>Save</button>
|
<button response="accept" translate>Save</button>
|
||||||
</tpl-buttons>
|
</tpl-buttons>
|
||||||
</vn-dialog>
|
</vn-dialog>
|
||||||
|
|
|
@ -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'];
|
||||||
|
|
Loading…
Reference in New Issue