contabilize worker.calenday holidays, updated styles
gitea/salix/dev This commit has test failures
Details
gitea/salix/dev This commit has test failures
Details
This commit is contained in:
parent
7571cd6e1b
commit
eccf381e56
|
@ -0,0 +1,5 @@
|
||||||
|
ALTER TABLE `postgresql`.`calendar_state`
|
||||||
|
ADD COLUMN `code` VARCHAR(45) NULL AFTER `permissionRate`;
|
||||||
|
|
||||||
|
UPDATE `postgresql`.`calendar_state` SET `code` = 'holiday' WHERE `calendar_state_id` = 1;
|
||||||
|
UPDATE `postgresql`.`calendar_state` SET `code` = 'halfHoliday' WHERE `calendar_state_id` = 6;
|
|
@ -0,0 +1,12 @@
|
||||||
|
CREATE
|
||||||
|
OR REPLACE ALGORITHM = UNDEFINED
|
||||||
|
DEFINER = `root`@`%`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn`.`absenceType` AS
|
||||||
|
SELECT
|
||||||
|
`cs`.`calendar_state_id` AS `id`,
|
||||||
|
`cs`.`type` AS `name`,
|
||||||
|
`cs`.`rgb` AS `rgb`,
|
||||||
|
`cs`.`code` AS `code`
|
||||||
|
FROM
|
||||||
|
`postgresql`.`calendar_state` `cs`;
|
|
@ -1513,10 +1513,11 @@ INSERT INTO `vn`.`workCenterHoliday` (`workCenterFk`, `days`, `year`)
|
||||||
('1', '24.5', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR))),
|
('1', '24.5', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR))),
|
||||||
('5', '23', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)));
|
('5', '23', YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)));
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`calendar_state` (`calendar_state_id`, `type`, `rgb`)
|
INSERT INTO `postgresql`.`calendar_state` (`calendar_state_id`, `type`, `rgb`, `code`)
|
||||||
VALUES
|
VALUES
|
||||||
('1', 'Holidays', '#FF4444'),
|
(1, 'Holidays', '#FF4444', 'holiday'),
|
||||||
('2', 'Leave of absence', '#C71585');
|
(2, 'Leave of absence', '#C71585', 'absence'),
|
||||||
|
(6, 'Half holiday', '#E65F00', 'halfHoliday');
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`)
|
INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
|
@ -60,8 +60,8 @@
|
||||||
ng-class="{'primary': day.events.length > 0}">
|
ng-class="{'primary': day.events.length > 0}">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="day-number"
|
<div class="day-number"
|
||||||
title="{{(day.events[0].description || day.events[0].name) | translate}}"
|
title="{{(day.eventName) | translate}}"
|
||||||
ng-style="$ctrl.renderStyle(day.style || day.events[0].style)"
|
ng-style="$ctrl.renderStyle(day.style)"
|
||||||
ng-click="$ctrl.select($index)">
|
ng-click="$ctrl.select($index)">
|
||||||
{{::day.dated | date: 'd'}}
|
{{::day.dated | date: 'd'}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -190,8 +190,7 @@ export default class Calendar extends Component {
|
||||||
return event.dated >= dated && event.dated <= dated;
|
return event.dated >= dated && event.dated <= dated;
|
||||||
});
|
});
|
||||||
|
|
||||||
const params = {dated, events};
|
const params = {dated: dated, events: events, style: {}};
|
||||||
|
|
||||||
const isSaturday = dated.getDay() === 6;
|
const isSaturday = dated.getDay() === 6;
|
||||||
const isSunday = dated.getDay() === 0;
|
const isSunday = dated.getDay() === 0;
|
||||||
const isCurrentMonth = dated.getMonth() === this.currentMonth.getMonth();
|
const isCurrentMonth = dated.getMonth() === this.currentMonth.getMonth();
|
||||||
|
@ -203,8 +202,17 @@ export default class Calendar extends Component {
|
||||||
if (isCurrentMonth && isSaturday && !hasEvents)
|
if (isCurrentMonth && isSaturday && !hasEvents)
|
||||||
params.style = {color: '#666666'};
|
params.style = {color: '#666666'};
|
||||||
|
|
||||||
if (!isCurrentMonth && !hasEvents)
|
if (!isCurrentMonth)
|
||||||
params.style = {color: '#9b9b9b'};
|
params.style = {opacity: '0.5'};
|
||||||
|
|
||||||
|
if (events.length > 0) {
|
||||||
|
const eventStyle = events[0].style;
|
||||||
|
const eventName = events[0].description || events[0].name;
|
||||||
|
if (eventStyle)
|
||||||
|
Object.assign(params.style, eventStyle);
|
||||||
|
if (eventName)
|
||||||
|
params.eventName = eventName;
|
||||||
|
}
|
||||||
|
|
||||||
this.days.push(params);
|
this.days.push(params);
|
||||||
}
|
}
|
||||||
|
@ -310,6 +318,7 @@ export default class Calendar extends Component {
|
||||||
return {
|
return {
|
||||||
'background-color': style.backgroundColor,
|
'background-color': style.backgroundColor,
|
||||||
'font-weight': style.fontWeight,
|
'font-weight': style.fontWeight,
|
||||||
|
'opacity': style.opacity,
|
||||||
'color': style.color
|
'color': style.color
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,8 +57,13 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
absences.forEach(absence => {
|
absences.forEach(absence => {
|
||||||
if (absence.absenceType().id === 1)
|
const isHoliday = absence.absenceType().code === 'holiday';
|
||||||
calendar.holidaysEnjoyed++;
|
const isHalfHoliday = absence.absenceType().code === 'halfHoliday';
|
||||||
|
|
||||||
|
if (isHoliday)
|
||||||
|
calendar.holidaysEnjoyed += 1;
|
||||||
|
if (isHalfHoliday)
|
||||||
|
calendar.holidaysEnjoyed += 0.5;
|
||||||
|
|
||||||
absence.dated = new Date(absence.dated);
|
absence.dated = new Date(absence.dated);
|
||||||
absence.dated.setHours(0, 0, 0, 0);
|
absence.dated.setHours(0, 0, 0, 0);
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
},
|
},
|
||||||
"rgb": {
|
"rgb": {
|
||||||
"type": "String"
|
"type": "String"
|
||||||
|
},
|
||||||
|
"code": {
|
||||||
|
"type": "String"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"acls": [
|
"acls": [
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
data="$ctrl.absenceTypes" auto-load="true">
|
data="$ctrl.absenceTypes" auto-load="true">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<div class="main-with-right-menu">
|
<div class="main-with-right-menu">
|
||||||
<vn-card pad-large>
|
<vn-card pad-small>
|
||||||
<vn-horizontal class="calendar-list">
|
<vn-horizontal class="calendar-list">
|
||||||
<section class="calendar" ng-repeat="month in $ctrl.months">
|
<section class="calendar" ng-repeat="month in $ctrl.months">
|
||||||
<vn-calendar
|
<vn-calendar
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
@import "variables";
|
@import "variables";
|
||||||
|
|
||||||
.calendar-list .calendar {
|
|
||||||
border-bottom:1px solid #ddd
|
|
||||||
}
|
|
||||||
|
|
||||||
.calendar-list .calendar:nth-child(2n + 1) {
|
/* .calendar-list .calendar:nth-child(2n + 1) {
|
||||||
border-right:1px solid #ddd
|
border-right:1px solid #ddd
|
||||||
}
|
} */
|
||||||
|
|
||||||
.calendar-list {
|
.calendar-list {
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
|
@ -17,7 +14,13 @@
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: $pad-medium;
|
padding: $pad-medium;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
width: 50%
|
min-width: 18em;
|
||||||
|
width: 25%;
|
||||||
|
|
||||||
|
vn-calendar {
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
padding: 0.5em
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue