contabilize worker.calenday holidays, updated styles
gitea/salix/test This commit looks good
Details
gitea/salix/test This commit looks good
Details
This commit is contained in:
parent
5974f6e0c2
commit
77d8ac82a5
|
@ -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`;
|
|
@ -1514,10 +1514,11 @@ INSERT INTO `vn2008`.`workcenter_holiday` (`workcenter_id`, `day`, `year`)
|
|||
('1', '24.5', 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
|
||||
('1', 'Holidays', '#FF4444'),
|
||||
('2', 'Leave of absence', '#C71585');
|
||||
(1, 'Holidays', '#FF4444', 'holiday'),
|
||||
(2, 'Leave of absence', '#C71585', 'absence'),
|
||||
(6, 'Half holiday', '#E65F00', 'halfHoliday');
|
||||
|
||||
INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`)
|
||||
VALUES
|
||||
|
|
|
@ -60,8 +60,8 @@
|
|||
ng-class="{'primary': day.events.length > 0}">
|
||||
<div class="content">
|
||||
<div class="day-number"
|
||||
title="{{(day.events[0].description || day.events[0].name) | translate}}"
|
||||
ng-style="$ctrl.renderStyle(day.style || day.events[0].style)"
|
||||
title="{{(day.eventName) | translate}}"
|
||||
ng-style="$ctrl.renderStyle(day.style)"
|
||||
ng-click="$ctrl.select($index)">
|
||||
{{::day.dated | date: 'd'}}
|
||||
</div>
|
||||
|
|
|
@ -190,8 +190,7 @@ export default class Calendar extends Component {
|
|||
return event.dated >= dated && event.dated <= dated;
|
||||
});
|
||||
|
||||
const params = {dated, events};
|
||||
|
||||
const params = {dated: dated, events: events, style: {}};
|
||||
const isSaturday = dated.getDay() === 6;
|
||||
const isSunday = dated.getDay() === 0;
|
||||
const isCurrentMonth = dated.getMonth() === this.currentMonth.getMonth();
|
||||
|
@ -203,8 +202,17 @@ export default class Calendar extends Component {
|
|||
if (isCurrentMonth && isSaturday && !hasEvents)
|
||||
params.style = {color: '#666666'};
|
||||
|
||||
if (!isCurrentMonth && !hasEvents)
|
||||
params.style = {color: '#9b9b9b'};
|
||||
if (!isCurrentMonth)
|
||||
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);
|
||||
}
|
||||
|
@ -310,6 +318,7 @@ export default class Calendar extends Component {
|
|||
return {
|
||||
'background-color': style.backgroundColor,
|
||||
'font-weight': style.fontWeight,
|
||||
'opacity': style.opacity,
|
||||
'color': style.color
|
||||
};
|
||||
}
|
||||
|
|
|
@ -57,8 +57,13 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
absences.forEach(absence => {
|
||||
if (absence.absenceType().id === 1)
|
||||
calendar.holidaysEnjoyed++;
|
||||
const isHoliday = absence.absenceType().code === 'holiday';
|
||||
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.setHours(0, 0, 0, 0);
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
},
|
||||
"rgb": {
|
||||
"type": "String"
|
||||
},
|
||||
"code": {
|
||||
"type": "String"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
data="$ctrl.absenceTypes" auto-load="true">
|
||||
</vn-crud-model>
|
||||
<div class="main-with-right-menu">
|
||||
<vn-card pad-large>
|
||||
<vn-card pad-small>
|
||||
<vn-horizontal class="calendar-list">
|
||||
<section class="calendar" ng-repeat="month in $ctrl.months">
|
||||
<vn-calendar
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
@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
|
||||
}
|
||||
} */
|
||||
|
||||
.calendar-list {
|
||||
align-items: flex-start;
|
||||
|
@ -17,7 +14,13 @@
|
|||
box-sizing: border-box;
|
||||
padding: $pad-medium;
|
||||
overflow: hidden;
|
||||
width: 50%
|
||||
min-width: 18em;
|
||||
width: 25%;
|
||||
|
||||
vn-calendar {
|
||||
border: 1px solid #ddd;
|
||||
padding: 0.5em
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue