3621-fix(worker_calendar): absence in holiday day #911

Merged
carlosjr merged 6 commits from 3621-worker_calendar into dev 2022-03-29 08:27:26 +00:00
3 changed files with 33 additions and 13 deletions

View File

@ -2478,21 +2478,24 @@ INSERT INTO `bs`.`defaulter` (`clientFk`, `amount`, `created`, `defaulterSinced`
(1109, 500, CURDATE(), CURDATE()); (1109, 500, CURDATE(), CURDATE());
UPDATE `vn`.`agency` UPDATE `vn`.`agency`
SET `supplierFk`=1 SET `supplierFk`=1
WHERE `id`=1; WHERE `id`=1;
UPDATE `vn`.`agency` UPDATE `vn`.`agency`
SET `supplierFk`=1 SET `supplierFk`=1
WHERE `id`=2; WHERE `id`=2;
UPDATE `vn`.`agency` UPDATE `vn`.`agency`
SET `supplierFk`=2 SET `supplierFk`=2
WHERE `id`=3; WHERE `id`=3;
UPDATE `vn`.`route` UPDATE `vn`.`route`
SET `invoiceInFk`=1 SET `invoiceInFk`=1
WHERE `id`=1; WHERE `id`=1;
UPDATE `vn`.`route` UPDATE `vn`.`route`
SET `invoiceInFk`=2 SET `invoiceInFk`=2
WHERE `id`=2; WHERE `id`=2;
INSERT INTO `bs`.`salesPerson` (`workerFk`, `year`, `month`, `portfolioWeight`) INSERT INTO `bs`.`salesPerson` (`workerFk`, `year`, `month`, `portfolioWeight`)
VALUES VALUES
(18, YEAR(CURDATE()), MONTH(CURDATE()), 807.23), (18, YEAR(CURDATE()), MONTH(CURDATE()), 807.23),
@ -2505,6 +2508,7 @@ INSERT INTO `bs`.`sale` (`saleFk`, `amount`, `dated`, `typeFk`, `clientFk`)
(3, 200.78, CURDATE(), 2, 1101), (3, 200.78, CURDATE(), 2, 1101),
(4, 33.8, CURDATE(), 1, 1101), (4, 33.8, CURDATE(), 1, 1101),
(30, 34.4, CURDATE(), 1, 1108); (30, 34.4, CURDATE(), 1, 1108);
INSERT INTO `vn`.`docuware` (`code`, `fileCabinetName`, `dialogName` , `find`) INSERT INTO `vn`.`docuware` (`code`, `fileCabinetName`, `dialogName` , `find`)
VALUES VALUES
('deliveryClientTest', 'deliveryClientTest', 'findTest', 'word'); ('deliveryClientTest', 'deliveryClientTest', 'findTest', 'word');
@ -2513,6 +2517,18 @@ INSERT INTO `vn`.`docuwareConfig` (`url`)
VALUES VALUES
('https://verdnatura.docuware.cloud/docuware/platform'); ('https://verdnatura.docuware.cloud/docuware/platform');
INSERT INTO `vn`.`calendarHolidaysName` (`id`, `name`)
VALUES
(1, 'dayOfIT');
INSERT INTO `vn`.`calendarHolidaysType` (`id`, `name`, `hexColour`)
VALUES
(1, 'National', '#4169E1');
INSERT INTO `vn`.`calendarHolidays` (`id`, `calendarHolidaysTypeFk`, `dated`, `calendarHolidaysNameFk`, `workCenterFk`)
VALUES
(1, 1, CONCAT(YEAR(CURDATE()), '-12-09'), 1, 1);
INSERT INTO `vn`.`supplierAgencyTerm` (`agencyFk`, `supplierFk`, `minimumPackages`, `kmPrice`, `packagePrice`, `routePrice`, `minimumKm`, `minimumM3`, `m3Price`) INSERT INTO `vn`.`supplierAgencyTerm` (`agencyFk`, `supplierFk`, `minimumPackages`, `kmPrice`, `packagePrice`, `routePrice`, `minimumKm`, `minimumM3`, `m3Price`)
VALUES VALUES
(1, 1, 0, 0.00, 0.00, NULL, 0, 0.00, 23), (1, 1, 0, 0.00, 0.00, NULL, 0, 0.00, 23),

View File

@ -198,7 +198,7 @@ class Controller extends Section {
const event = this.events[stamp]; const event = this.events[stamp];
const calendar = $event.target.closest('vn-calendar').$ctrl; const calendar = $event.target.closest('vn-calendar').$ctrl;
if (event) { if (event && event.absenceId) {
if (event.type == this.absenceType.code) if (event.type == this.absenceType.code)
this.delete(calendar, day, event); this.delete(calendar, day, event);
else else
@ -230,6 +230,7 @@ class Controller extends Section {
.then(calendar.repaint()) .then(calendar.repaint())
.then(() => this.getContractHolidays()) .then(() => this.getContractHolidays())
.then(() => this.getYearHolidays()) .then(() => this.getYearHolidays())
.then(() => this.repaint())
); );
}); });
} }
@ -266,6 +267,7 @@ class Controller extends Section {
.then(calendar.repaint()) .then(calendar.repaint())
.then(() => this.getContractHolidays()) .then(() => this.getContractHolidays())
.then(() => this.getYearHolidays()) .then(() => this.getYearHolidays())
.then(() => this.repaint())
); );
}); });
} }

View File

@ -191,7 +191,8 @@ describe('Worker', () => {
const selectedDay = new Date(); const selectedDay = new Date();
const expectedEvent = { const expectedEvent = {
dated: selectedDay, dated: selectedDay,
type: 'holiday' type: 'holiday',
absenceId: 1
}; };
const $event = { const $event = {
target: { target: {
@ -214,7 +215,8 @@ describe('Worker', () => {
const selectedDay = new Date(); const selectedDay = new Date();
const expectedEvent = { const expectedEvent = {
dated: selectedDay, dated: selectedDay,
type: 'leaveOfAbsence' type: 'leaveOfAbsence',
absenceId: 1
}; };
const $event = { const $event = {
target: { target: {