4213-item.summary #1011
|
@ -1,4 +1,4 @@
|
||||||
FROM mariadb:10.4.13
|
FROM mariadb:10.7.3
|
||||||
|
|
||||||
ENV MYSQL_ROOT_PASSWORD root
|
ENV MYSQL_ROOT_PASSWORD root
|
||||||
ENV TZ Europe/Madrid
|
ENV TZ Europe/Madrid
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
|
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
|
||||||
VALUES
|
VALUES
|
||||||
|
('ClaimObservation','*','WRITE','ALLOW','ROLE','salesPerson'),
|
||||||
|
('ClaimObservation','*','READ','ALLOW','ROLE','salesPerson'),
|
||||||
('Client','setPassword','WRITE','ALLOW','ROLE','salesPerson'),
|
('Client','setPassword','WRITE','ALLOW','ROLE','salesPerson'),
|
||||||
('Client','updateUser','WRITE','ALLOW','ROLE','salesPerson');
|
('Client','updateUser','WRITE','ALLOW','ROLE','salesPerson');
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
DROP FUNCTION `account`.`userGetId`;
|
||||||
|
DROP FUNCTION `account`.`myUserGetName`;
|
||||||
|
DROP FUNCTION `account`.`myUserGetId`;
|
||||||
|
DROP FUNCTION `account`.`myUserHasRole`;
|
||||||
|
DROP FUNCTION `account`.`myUserHasRoleId`;
|
||||||
|
DROP FUNCTION `account`.`userGetName`;
|
||||||
|
DROP FUNCTION `account`.`userHasRole`;
|
||||||
|
DROP FUNCTION `account`.`userHasRoleId`;
|
||||||
|
DROP PROCEDURE `account`.`myUserLogout`;
|
||||||
|
DROP PROCEDURE `account`.`userLogin`;
|
||||||
|
DROP PROCEDURE `account`.`userLoginWithKey`;
|
||||||
|
DROP PROCEDURE `account`.`userLoginWithName`;
|
||||||
|
DROP PROCEDURE `account`.`userSetPassword`;
|
|
@ -0,0 +1,13 @@
|
||||||
|
CREATE TABLE `vn`.`claimObservation` (
|
||||||
|
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`claimFk` int(10) unsigned NOT NULL,
|
||||||
|
`workerFk` int(10) unsigned DEFAULT NULL,
|
||||||
|
`text` text COLLATE utf8_unicode_ci NOT NULL,
|
||||||
|
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `worker_key` (`workerFk`),
|
||||||
|
KEY `claim_key` (`claimFk`),
|
||||||
|
KEY `claimObservation_created_IDX` (`created`) USING BTREE,
|
||||||
|
CONSTRAINT `claimObservation_ibfk_1` FOREIGN KEY (`claimFk`) REFERENCES `vn`.`claim` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT `claimObservation_ibfk_2` FOREIGN KEY (`workerFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE
|
||||||
|
) COMMENT='Todas las observaciones referentes a una reclamación'
|
|
@ -0,0 +1,2 @@
|
||||||
|
INSERT INTO `vn`.`claimObservation` (`claimFk`, `text`, `created`)
|
||||||
|
SELECT `id`, `observation`, `created` FROM `vn`.`claim`
|
File diff suppressed because one or more lines are too long
|
@ -122,17 +122,17 @@ INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`)
|
||||||
(3, 'GBP', 'Libra', 1),
|
(3, 'GBP', 'Libra', 1),
|
||||||
(4, 'JPY', 'Yen Japones', 1);
|
(4, 'JPY', 'Yen Japones', 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`)
|
INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `politicalCountryFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'España', 1, 'ES', 1, 24, 4, 0, 1),
|
(1, 'España', 1, 'ES', 1, 1, 24, 4, 0, 1),
|
||||||
(2, 'Italia', 1, 'IT', 1, 27, 4, 0, 1),
|
(2, 'Italia', 1, 'IT', 1, 2, 27, 4, 0, 1),
|
||||||
(3, 'Alemania', 1, 'DE', 1, 22, 4, 0, 1),
|
(3, 'Alemania', 1, 'DE', 1, 3, 22, 4, 0, 1),
|
||||||
(4, 'Rumania', 1, 'RO', 1, 24, 4, 0, 1),
|
(4, 'Rumania', 1, 'RO', 1, 4, 24, 4, 0, 1),
|
||||||
(5, 'Holanda', 1, 'NL', 1, 18, 4, 0, 1),
|
(5, 'Holanda', 1, 'NL', 1, 5, 18, 4, 0, 1),
|
||||||
(8, 'Portugal', 1, 'PT', 1, 27, 4, 0, 1),
|
(8, 'Portugal', 1, 'PT', 1, 8, 27, 4, 0, 1),
|
||||||
(13,'Ecuador', 0, 'EC', 1, 24, 2, 1, 2),
|
(13,'Ecuador', 0, 'EC', 1, 13, 24, 2, 1, 2),
|
||||||
(19,'Francia', 1, 'FR', 1, 27, 4, 0, 1),
|
(19,'Francia', 1, 'FR', 1, 19, 27, 4, 0, 1),
|
||||||
(30,'Canarias', 1, 'IC', 1, 24, 4, 1, 2);
|
(30,'Canarias', 1, 'IC', 1, 1, 24, 4, 1, 2);
|
||||||
|
|
||||||
INSERT INTO `vn`.`warehouseAlias`(`id`, `name`)
|
INSERT INTO `vn`.`warehouseAlias`(`id`, `name`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -148,10 +148,10 @@ INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory
|
||||||
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 0, 2, 1, 1),
|
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 0, 2, 1, 1),
|
||||||
(13, 'Inventory', NULL, 1, 1, 1, 0, 0, 0, 0, 2, 1, 0);
|
(13, 'Inventory', NULL, 1, 1, 1, 0, 0, 0, 0, 2, 1, 0);
|
||||||
|
|
||||||
INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `isPreviousPreparedByPacking`, `code`, `pickingPlacement`, `path`)
|
INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `isPreviousPreparedByPacking`, `code`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'First sector', 1, 1, 'FIRST', 999, 999),
|
(1, 'First sector', 1, 1, 'FIRST'),
|
||||||
(2, 'Second sector', 2, 0, 'SECOND', 100, 150);
|
(2, 'Second sector', 2, 0, 'SECOND');
|
||||||
|
|
||||||
INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingOrder`)
|
INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingOrder`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -175,14 +175,18 @@ INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`cod
|
||||||
(7, 'Leasing', NULL, NULL, NULL, 0),
|
(7, 'Leasing', NULL, NULL, NULL, 0),
|
||||||
(8, 'Compensations', 'Compensations', 'compensation', NULL, 0);
|
(8, 'Compensations', 'Compensations', 'compensation', NULL, 0);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`bankEntity`(`id`, `countryFk`, `name`, `bic`)
|
||||||
|
VALUES
|
||||||
|
(128, 1, 'The Best Bank', 'BBKKESMMMMMM'),
|
||||||
|
(2100, 1, 'Caixa Bank', 'CAIXESBB');
|
||||||
|
|
||||||
INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, `currencyFk`)
|
INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, `currencyFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Pay on receipt', '5720000001', 3, 0, 1, 1),
|
(1, 'Pay on receipt', '5720000001', 3, 128, 1, 1),
|
||||||
(2, 'Cash', '5700000001', 2, 0, 1, 1),
|
(2, 'Cash', '5700000001', 2, 128, 1, 1),
|
||||||
(3, 'Compensation', '4000000000', 8, 0, 1, 1),
|
(3, 'Compensation', '4000000000', 8, 128, 1, 1),
|
||||||
(4, 'Transfers', '4000000001', 1, 0, 1, 1),
|
(4, 'Transfers', '4000000001', 1, 128, 1, 1),
|
||||||
(3117, 'Caixa Rural d''Algemesi', '5720000000', 8, 3117, 1, 1);
|
(3117, 'Caixa Rural d''Algemesi', '5720000000', 8, 2100, 1, 1);
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
|
INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -191,18 +195,18 @@ INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
|
||||||
(3, 'PICKUP', 'Recogida'),
|
(3, 'PICKUP', 'Recogida'),
|
||||||
(4, 'OTHER', 'Otros');
|
(4, 'OTHER', 'Otros');
|
||||||
|
|
||||||
INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `isVolumetric`, `bankFk`, `warehouseAliasFk`)
|
INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `bankFk__`, `warehouseAliasFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'inhouse pickup' , 1, 0, 1, 1),
|
(1, 'inhouse pickup' , 1, 1, 1),
|
||||||
(2, 'Super-Man delivery' , 1, 0, 1, 1),
|
(2, 'Super-Man delivery' , 1, 1, 1),
|
||||||
(3, 'Teleportation device' , 1, 0, 1, 1),
|
(3, 'Teleportation device' , 1, 1, 1),
|
||||||
(4, 'Entanglement' , 1, 0, 1, 1),
|
(4, 'Entanglement' , 1, 1, 1),
|
||||||
(5, 'Quantum break device' , 1, 0, 1, 1),
|
(5, 'Quantum break device' , 1, 1, 1),
|
||||||
(6, 'Walking' , 1, 0, 1, 1),
|
(6, 'Walking' , 1, 1, 1),
|
||||||
(7, 'Gotham247' , 1, 0, 1, 1),
|
(7, 'Gotham247' , 1, 1, 1),
|
||||||
(8, 'Gotham247Expensive' , 1, 0, 1, 1),
|
(8, 'Gotham247Expensive' , 1, 1, 1),
|
||||||
(9, 'Refund' , 1, 0, 1, 1),
|
(9, 'Refund' , 1, 1, 1),
|
||||||
(10, 'Other agency' , 1, 0, 1, 1);
|
(10, 'Other agency' , 1, 1, 1);
|
||||||
|
|
||||||
UPDATE `vn`.`agencyMode` SET `id` = 1 WHERE `name` = 'inhouse pickup';
|
UPDATE `vn`.`agencyMode` SET `id` = 1 WHERE `name` = 'inhouse pickup';
|
||||||
UPDATE `vn`.`agencyMode` SET `id` = 2 WHERE `name` = 'Super-Man delivery';
|
UPDATE `vn`.`agencyMode` SET `id` = 2 WHERE `name` = 'Super-Man delivery';
|
||||||
|
@ -471,10 +475,18 @@ INSERT INTO `vn`.`companyGroup`(`id`, `code`)
|
||||||
(1, 'wayneIndustries'),
|
(1, 'wayneIndustries'),
|
||||||
(2, 'verdnatura');
|
(2, 'verdnatura');
|
||||||
|
|
||||||
INSERT INTO `vn`.`bankEntity`(`id`, `countryFk`, `name`, `bic`)
|
INSERT INTO `vn`.`supplierActivity`(`code`, `name`)
|
||||||
VALUES
|
VALUES
|
||||||
(128, 1, 'The Best Bank', 'BBKKESMMMMMM'),
|
('animals', 'Food and complements for pets'),
|
||||||
(2100, 1, 'Caixa Bank', 'CAIXESBB');
|
('complements', 'Other complements'),
|
||||||
|
('flowerPlants', 'Wholesale of flowers and plants'),
|
||||||
|
('vegetablesFruits', 'Fruit and vegetable trade');
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`)
|
||||||
|
VALUES
|
||||||
|
(1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
|
||||||
|
(2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
|
||||||
|
(442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V');
|
||||||
|
|
||||||
INSERT INTO `vn`.`supplierAccount`(`id`, `supplierFk`, `iban`, `bankEntityFk`)
|
INSERT INTO `vn`.`supplierAccount`(`id`, `supplierFk`, `iban`, `bankEntityFk`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -875,18 +887,18 @@ INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`)
|
||||||
(3, 'Perdida', 'LOST');
|
(3, 'Perdida', 'LOST');
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `checked`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`)
|
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 15, 1, 1, 18, 'UR9000006041', 94, 1),
|
(1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 15, 1, 18, 'UR9000006041', 94, 1),
|
||||||
(2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 16, 2, 1, 18, 'UR9000006041', 94, 1),
|
(2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 16, 2, 18, 'UR9000006041', 94, 1),
|
||||||
(3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 3, 1, 18, 'UR9000006041', 94, 2),
|
(3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 3, 18, 'UR9000006041', 94, 2),
|
||||||
(4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 4, 1, 18, 'UR9000006041', 94, 2),
|
(4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 4, 18, 'UR9000006041', 94, 2),
|
||||||
(5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 1, 18, NULL, 94, 3),
|
(5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 18, NULL, 94, 3),
|
||||||
(6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 1, 1, 18, NULL, 94, 3),
|
(6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 1, 18, NULL, 94, 3),
|
||||||
(7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, 1, 1, 18, NULL, 94, NULL),
|
(7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, 1, 18, NULL, 94, NULL),
|
||||||
(8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, 1, 1, 18, NULL, 94, 1),
|
(8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, 1, 18, NULL, 94, 1),
|
||||||
(9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 1, 18, NULL, 94, 2),
|
(9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 18, NULL, 94, 2),
|
||||||
(10, 7, 7, 71, NOW(), NULL, 1, 1, 18, NULL, 94, 3);
|
(10, 7, 7, 71, NOW(), NULL, 1, 18, NULL, 94, 3);
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`)
|
INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`)
|
||||||
|
@ -1112,13 +1124,6 @@ INSERT INTO `vn`.`itemBarcode`(`id`, `itemFk`, `code`)
|
||||||
(3, 1, 3333333333),
|
(3, 1, 3333333333),
|
||||||
(4, 2, 4444444444);
|
(4, 2, 4444444444);
|
||||||
|
|
||||||
INSERT INTO `vn`.`itemPlacement`(`id`, `itemFk`, `warehouseFk`, `code`)
|
|
||||||
VALUES
|
|
||||||
(1, 1, 1, 'A11'),
|
|
||||||
(2, 1, 2, 'A22'),
|
|
||||||
(3, 1, 3, 'A33'),
|
|
||||||
(4, 2, 1, 'A44');
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`train`(`id`, `name`)
|
INSERT INTO `vn`.`train`(`id`, `name`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Train1'),
|
(1, 'Train1'),
|
||||||
|
@ -1284,9 +1289,9 @@ INSERT INTO `vn`.`itemTypeTag`(`id`, `itemTypeFk`, `tagFk`, `priority`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 1, 0),
|
(1, 1, 1, 0),
|
||||||
(2, 2, 2, 0),
|
(2, 2, 2, 0),
|
||||||
(3, 3, 3, 1),
|
(3, 3, 3, 0),
|
||||||
(4, 1, 4, 1),
|
(4, 1, 4, 4),
|
||||||
(5, 1, 5, 1);
|
(5, 1, 5, 5);
|
||||||
|
|
||||||
CALL `vn`.`itemRefreshTags`(NULL);
|
CALL `vn`.`itemRefreshTags`(NULL);
|
||||||
|
|
||||||
|
@ -1309,13 +1314,6 @@ INSERT INTO `vn`.`annualAverageInvoiced`(`clientFk`, `invoiced`)
|
||||||
(1104, 500),
|
(1104, 500),
|
||||||
(1105, 5000);
|
(1105, 5000);
|
||||||
|
|
||||||
INSERT INTO `vn`.`supplierActivity`(`code`, `name`)
|
|
||||||
VALUES
|
|
||||||
('animals', 'Food and complements for pets'),
|
|
||||||
('complements', 'Other complements'),
|
|
||||||
('flowerPlants', 'Wholesale of flowers and plants'),
|
|
||||||
('vegetablesFruits', 'Fruit and vegetable trade');
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `provinceFk`, `postalCode`, `city`, `phone`, `mobile`)
|
INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `provinceFk`, `postalCode`, `city`, `phone`, `mobile`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 'Ace Chemicals', 'The Midtown', 1, '46000', 'Gotham', '111111111', '222222222'),
|
(1, 1, 'Ace Chemicals', 'The Midtown', 1, '46000', 'Gotham', '111111111', '222222222'),
|
||||||
|
@ -1325,12 +1323,6 @@ INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `pr
|
||||||
(5, 442, 'GCR building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222'),
|
(5, 442, 'GCR building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222'),
|
||||||
(6, 442, 'The Gotham Tonight building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222');
|
(6, 442, 'The Gotham Tonight building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222');
|
||||||
|
|
||||||
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`)
|
|
||||||
VALUES
|
|
||||||
(1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
|
|
||||||
(2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
|
|
||||||
(442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V');
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email`, `observation`, `name`)
|
INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email`, `observation`, `name`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 123121212, 654789123, 'supplier1@email.es', 'observation1', 'the boss'),
|
(1, 1, 123121212, 654789123, 'supplier1@email.es', 'observation1', 'the boss'),
|
||||||
|
@ -1737,12 +1729,19 @@ INSERT INTO `vn`.`claimState`(`id`, `code`, `description`, `roleFk`, `priority`,
|
||||||
( 6, 'mana', 'Mana', 1, 4, 0),
|
( 6, 'mana', 'Mana', 1, 4, 0),
|
||||||
( 7, 'lack', 'Faltas', 1, 2, 0);
|
( 7, 'lack', 'Faltas', 1, 2, 0);
|
||||||
|
|
||||||
INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `observation`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`)
|
INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, util.VN_CURDATE(), 1, 'Cu nam labores lobortis definiebas, ei aliquyam salutatus persequeris quo, cum eu nemore fierent dissentiunt. Per vero dolor id, vide democritum scribentur eu vim, pri erroribus temporibus ex.', 1101, 18, 3, 0, util.VN_CURDATE(), 0),
|
(1, util.VN_CURDATE(), 1, 1101, 18, 3, 0, util.VN_CURDATE(), 0),
|
||||||
(2, util.VN_CURDATE(), 2, 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.', 1101, 18, 3, 0, util.VN_CURDATE(), 1),
|
(2, util.VN_CURDATE(), 2, 1101, 18, 3, 0, util.VN_CURDATE(), 1),
|
||||||
(3, util.VN_CURDATE(), 3, 'An vim commodo dolorem volutpat, cu expetendis voluptatum usu, et mutat consul adversarium his. His natum numquam legimus an, diam fabulas mei ut. Melius fabellas sadipscing vel id. Partem diceret mandamus mea ne, has te tempor nostrud. Aeque nostro eum no.', 1101, 18, 1, 1, util.VN_CURDATE(), 5),
|
(3, util.VN_CURDATE(), 3, 1101, 18, 1, 1, util.VN_CURDATE(), 5),
|
||||||
(4, util.VN_CURDATE(), 3, 'Wisi forensibus mnesarchum in cum. Per id impetus abhorreant, his no magna definiebas, inani rationibus in quo. Ut vidisse dolores est, ut quis nominavi mel. Ad pri quod apeirian concludaturque.', 1104, 18, 5, 0, util.VN_CURDATE(), 10);
|
(4, util.VN_CURDATE(), 3, 1104, 18, 5, 0, util.VN_CURDATE(), 10);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`claimObservation` (`claimFk`, `workerFk`, `text`, `created`)
|
||||||
|
VALUES
|
||||||
|
(1, 18, 'Cu nam labores lobortis definiebas, ei aliquyam salutatus persequeris quo, cum eu nemore fierent dissentiunt. Per vero dolor id, vide democritum scribentur eu vim, pri erroribus temporibus ex.', util.VN_CURDATE()),
|
||||||
|
(2, 18, 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.', util.VN_CURDATE()),
|
||||||
|
(3, 18, 'An vim commodo dolorem volutpat, cu expetendis voluptatum usu, et mutat consul adversarium his. His natum numquam legimus an, diam fabulas mei ut. Melius fabellas sadipscing vel id. Partem diceret mandamus mea ne, has te tempor nostrud. Aeque nostro eum no.', util.VN_CURDATE()),
|
||||||
|
(4, 18, 'Wisi forensibus mnesarchum in cum. Per id impetus abhorreant, his no magna definiebas, inani rationibus in quo. Ut vidisse dolores est, ut quis nominavi mel. Ad pri quod apeirian concludaturque.', util.VN_CURDATE());
|
||||||
|
|
||||||
INSERT INTO `vn`.`claimBeginning`(`id`, `claimFk`, `saleFk`, `quantity`)
|
INSERT INTO `vn`.`claimBeginning`(`id`, `claimFk`, `saleFk`, `quantity`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -1921,11 +1920,6 @@ INSERT INTO `postgresql`.`profile_media`(`profile_media_id`, `profile_id`, `medi
|
||||||
(1, 1106, 1),
|
(1, 1106, 1),
|
||||||
(2, 1107, 2);
|
(2, 1107, 2);
|
||||||
|
|
||||||
INSERT INTO `vn`.`workCenter` (`id`, `name`, `warehouseFk`)
|
|
||||||
VALUES
|
|
||||||
('1', 'Gotham', '1'),
|
|
||||||
('5', 'Madrid', '5');
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`workCenterHoliday` (`workCenterFk`, `days`, `year`)
|
INSERT INTO `vn`.`workCenterHoliday` (`workCenterFk`, `days`, `year`)
|
||||||
VALUES
|
VALUES
|
||||||
('1', '27.5', YEAR(util.VN_CURDATE())),
|
('1', '27.5', YEAR(util.VN_CURDATE())),
|
||||||
|
@ -1933,7 +1927,7 @@ INSERT INTO `vn`.`workCenterHoliday` (`workCenterFk`, `days`, `year`)
|
||||||
('1', '24.5', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR))),
|
('1', '24.5', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR))),
|
||||||
('5', '23', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)));
|
('5', '23', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)));
|
||||||
|
|
||||||
INSERT INTO `postgresql`.`calendar_state` (`calendar_state_id`, `type`, `rgb`, `code`, `holidayEntitlementRate`, `discountRate`)
|
INSERT INTO `vn`.`absenceType` (`id`, `name`, `rgb`, `code`, `holidayEntitlementRate`, `discountRate`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Holidays', '#FF4444', 'holiday', 0, 0),
|
(1, 'Holidays', '#FF4444', 'holiday', 0, 0),
|
||||||
(2, 'Leave of absence', '#C71585', 'absence', 0, 1),
|
(2, 'Leave of absence', '#C71585', 'absence', 0, 1),
|
||||||
|
@ -1973,7 +1967,8 @@ INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`
|
||||||
(1107, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -20 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 20 DAY))),
|
(1107, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -20 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 20 DAY))),
|
||||||
(1107, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -13 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 8 DAY))),
|
(1107, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -13 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 8 DAY))),
|
||||||
(1107, 1, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -14 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 9 DAY))),
|
(1107, 1, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -14 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 9 DAY))),
|
||||||
(1107, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 7 DAY)));
|
(1107, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 7 DAY))),
|
||||||
|
(1107, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL - 16 DAY));
|
||||||
|
|
||||||
INSERT INTO `vn`.`smsConfig` (`id`, `uri`, `title`, `apiKey`)
|
INSERT INTO `vn`.`smsConfig` (`id`, `uri`, `title`, `apiKey`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -2243,8 +2238,8 @@ INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`)
|
||||||
VALUES
|
VALUES
|
||||||
(1106, CONCAT(util.VN_CURDATE(), ' 07:00'), TRUE, 'in'),
|
(1106, CONCAT(util.VN_CURDATE(), ' 07:00'), TRUE, 'in'),
|
||||||
(1106, CONCAT(util.VN_CURDATE(), ' 10:00'), TRUE, 'middle'),
|
(1106, CONCAT(util.VN_CURDATE(), ' 10:00'), TRUE, 'middle'),
|
||||||
(1106, CONCAT(util.VN_CURDATE(), ' 10:10'), TRUE, 'middle'),
|
(1106, CONCAT(util.VN_CURDATE(), ' 10:20'), TRUE, 'middle'),
|
||||||
(1106, CONCAT(util.VN_CURDATE(), ' 15:00'), TRUE, 'out');
|
(1106, CONCAT(util.VN_CURDATE(), ' 14:50'), TRUE, 'out');
|
||||||
|
|
||||||
INSERT INTO `vn`.`dmsType`(`id`, `name`, `path`, `readRoleFk`, `writeRoleFk`, `code`)
|
INSERT INTO `vn`.`dmsType`(`id`, `name`, `path`, `readRoleFk`, `writeRoleFk`, `code`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -2612,3 +2607,7 @@ INSERT INTO `vn`.`sectorCollection` (`userFk`, `sectorFk`)
|
||||||
INSERT INTO `vn`.`sectorCollectionSaleGroup` (`sectorCollectionFk`, `saleGroupFk`)
|
INSERT INTO `vn`.`sectorCollectionSaleGroup` (`sectorCollectionFk`, `saleGroupFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1);
|
(1, 1);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`workerTimeControlConfig` (`id`, `dayBreak`, `dayBreakDriver`, `shortWeekBreak`, `longWeekBreak`, `weekScope`, `mailPass`, `mailHost`, `mailSuccessFolder`, `mailErrorFolder`, `mailUser`, `minHoursToBreak`, `breakHours`, `hoursCompleteWeek`, `startNightlyHours`, `endNightlyHours`, `maxTimePerDay`, `breakTime`, `timeToBreakTime`, `dayMaxTime`, `shortWeekDays`, `longWeekDays`)
|
||||||
|
VALUES
|
||||||
|
(1, 43200, 32400, 129600, 259200, 604800, '', '', 'Leidos.exito', 'Leidos.error', 'timeControl', 5.33, 0.33, 40, '22:00:00', '06:00:00', 57600, 1200, 18000, 57600, 6, 13);
|
27244
db/dump/structure.sql
27244
db/dump/structure.sql
File diff suppressed because it is too large
Load Diff
|
@ -65,6 +65,7 @@ TABLES=(
|
||||||
ticketUpdateAction
|
ticketUpdateAction
|
||||||
time
|
time
|
||||||
volumeConfig
|
volumeConfig
|
||||||
|
workCenter
|
||||||
)
|
)
|
||||||
dump_tables ${TABLES[@]}
|
dump_tables ${TABLES[@]}
|
||||||
|
|
||||||
|
@ -101,7 +102,6 @@ TABLES=(
|
||||||
media_type
|
media_type
|
||||||
professional_category
|
professional_category
|
||||||
profile_type
|
profile_type
|
||||||
workcenter
|
|
||||||
)
|
)
|
||||||
dump_tables ${TABLES[@]}
|
dump_tables ${TABLES[@]}
|
||||||
|
|
||||||
|
|
|
@ -96,12 +96,12 @@ mysqldump \
|
||||||
--databases \
|
--databases \
|
||||||
${SCHEMAS[@]} \
|
${SCHEMAS[@]} \
|
||||||
${IGNORETABLES[@]} \
|
${IGNORETABLES[@]} \
|
||||||
| sed 's/\bCURDATE\b/vn.VN_CURDATE/ig'\
|
| sed 's/\bCURDATE\b/util.VN_CURDATE/ig'\
|
||||||
| sed 's/\bCURTIME\b/vn.VN_CURTIME/ig' \
|
| sed 's/\bCURTIME\b/util.VN_CURTIME/ig' \
|
||||||
| sed 's/\bNOW\b/vn.VN_NOW/ig' \
|
| sed 's/\bNOW\b/util.VN_NOW/ig' \
|
||||||
| sed 's/\bCURRENT_DATE\b/vn.VN_CURDATE/ig' \
|
| sed 's/\bCURRENT_DATE\b/util.VN_CURDATE/ig' \
|
||||||
| sed 's/\bCURRENT_TIME\b/vn.VN_CURTIME/ig' \
|
| sed 's/\bCURRENT_TIME\b/util.VN_CURTIME/ig' \
|
||||||
| sed 's/\bLOCALTIME\b/vn.VN_NOW/ig' \
|
| sed 's/\bLOCALTIME\b/util.VN_NOW/ig' \
|
||||||
| sed 's/\bLOCALTIMESTAMP\b/vn.VN_NOW/ig' \
|
| sed 's/\bLOCALTIMESTAMP\b/util.VN_NOW/ig' \
|
||||||
| sed 's/ AUTO_INCREMENT=[0-9]* //g' \
|
| sed 's/ AUTO_INCREMENT=[0-9]* //g' \
|
||||||
> dump/structure.sql
|
> dump/structure.sql
|
|
@ -598,7 +598,7 @@ export default {
|
||||||
submitNotesButton: 'button[type=submit]'
|
submitNotesButton: 'button[type=submit]'
|
||||||
},
|
},
|
||||||
ticketExpedition: {
|
ticketExpedition: {
|
||||||
secondExpeditionRemoveButton: 'vn-ticket-expedition vn-table div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(1) > vn-icon-button[icon="delete"]',
|
thirdExpeditionRemoveButton: 'vn-ticket-expedition vn-table div > vn-tbody > vn-tr:nth-child(3) > vn-td:nth-child(1) > vn-icon-button[icon="delete"]',
|
||||||
expeditionRow: 'vn-ticket-expedition vn-table vn-tbody > vn-tr'
|
expeditionRow: 'vn-ticket-expedition vn-table vn-tbody > vn-tr'
|
||||||
},
|
},
|
||||||
ticketPackages: {
|
ticketPackages: {
|
||||||
|
@ -730,7 +730,7 @@ export default {
|
||||||
claimSummary: {
|
claimSummary: {
|
||||||
header: 'vn-claim-summary > vn-card > h5',
|
header: 'vn-claim-summary > vn-card > h5',
|
||||||
state: 'vn-claim-summary vn-label-value[label="State"] > section > span',
|
state: 'vn-claim-summary vn-label-value[label="State"] > section > span',
|
||||||
observation: 'vn-claim-summary vn-textarea[ng-model="$ctrl.summary.claim.observation"]',
|
observation: 'vn-claim-summary vn-horizontal.text',
|
||||||
firstSaleItemId: 'vn-claim-summary vn-horizontal > vn-auto:nth-child(5) vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(1) > span',
|
firstSaleItemId: 'vn-claim-summary vn-horizontal > vn-auto:nth-child(5) vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(1) > span',
|
||||||
firstSaleDescriptorImage: '.vn-popover.shown vn-item-descriptor img',
|
firstSaleDescriptorImage: '.vn-popover.shown vn-item-descriptor img',
|
||||||
itemDescriptorPopover: '.vn-popover.shown vn-item-descriptor',
|
itemDescriptorPopover: '.vn-popover.shown vn-item-descriptor',
|
||||||
|
@ -742,7 +742,6 @@ export default {
|
||||||
},
|
},
|
||||||
claimBasicData: {
|
claimBasicData: {
|
||||||
claimState: 'vn-claim-basic-data vn-autocomplete[ng-model="$ctrl.claim.claimStateFk"]',
|
claimState: 'vn-claim-basic-data vn-autocomplete[ng-model="$ctrl.claim.claimStateFk"]',
|
||||||
observation: 'vn-textarea[ng-model="$ctrl.claim.observation"]',
|
|
||||||
packages: 'vn-input-number[ng-model="$ctrl.claim.packages"]',
|
packages: 'vn-input-number[ng-model="$ctrl.claim.packages"]',
|
||||||
hasToPickUpCheckbox: 'vn-claim-basic-data vn-check[ng-model="$ctrl.claim.hasToPickUp"]',
|
hasToPickUpCheckbox: 'vn-claim-basic-data vn-check[ng-model="$ctrl.claim.hasToPickUp"]',
|
||||||
saveButton: `button[type=submit]`
|
saveButton: `button[type=submit]`
|
||||||
|
@ -772,6 +771,12 @@ export default {
|
||||||
secondClaimRedelivery: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimRedeliveryFk"]',
|
secondClaimRedelivery: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimRedeliveryFk"]',
|
||||||
saveDevelopmentButton: 'button[type=submit]'
|
saveDevelopmentButton: 'button[type=submit]'
|
||||||
},
|
},
|
||||||
|
claimNote: {
|
||||||
|
addNoteFloatButton: 'vn-float-button',
|
||||||
|
note: 'vn-textarea[ng-model="$ctrl.note.text"]',
|
||||||
|
saveButton: 'button[type=submit]',
|
||||||
|
firstNoteText: 'vn-claim-note .text'
|
||||||
|
},
|
||||||
claimAction: {
|
claimAction: {
|
||||||
importClaimButton: 'vn-claim-action vn-button[label="Import claim"]',
|
importClaimButton: 'vn-claim-action vn-button[label="Import claim"]',
|
||||||
anyLine: 'vn-claim-action vn-tbody > vn-tr',
|
anyLine: 'vn-claim-action vn-tbody > vn-tr',
|
||||||
|
@ -906,52 +911,16 @@ export default {
|
||||||
dialogTimeInput: '.vn-dialog.shown vn-input-time[ng-model="$ctrl.newTimeEntry.timed"]',
|
dialogTimeInput: '.vn-dialog.shown vn-input-time[ng-model="$ctrl.newTimeEntry.timed"]',
|
||||||
dialogTimeDirection: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.newTimeEntry.direction"]',
|
dialogTimeDirection: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.newTimeEntry.direction"]',
|
||||||
mondayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(1) > vn-icon-button',
|
mondayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(1) > vn-icon-button',
|
||||||
tuesdayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(2) > vn-icon-button',
|
|
||||||
wednesdayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(3) > vn-icon-button',
|
|
||||||
thursdayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-icon-button',
|
|
||||||
fridayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(5) > vn-icon-button',
|
|
||||||
saturdayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(6) > vn-icon-button',
|
|
||||||
sundayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(7) > vn-icon-button',
|
|
||||||
firstEntryOfMonday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(1) > vn-chip > div:nth-child(2)',
|
firstEntryOfMonday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(1) > vn-chip > div:nth-child(2)',
|
||||||
firstEntryOfTuesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > section:nth-child(1) > vn-chip > div:nth-child(2)',
|
firstEntryOfMondayDelete: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(1) > vn-chip > vn-icon[icon="cancel"]',
|
||||||
firstEntryOfWednesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3) > section:nth-child(1) > vn-chip > div:nth-child(2)',
|
|
||||||
firstEntryOfThursday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(4) > section:nth-child(1) > vn-chip > div:nth-child(2)',
|
|
||||||
firstEntryOfFriday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(5) > section:nth-child(1) > vn-chip > div:nth-child(2)',
|
|
||||||
firstEntryOfSaturday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6) > section:nth-child(1) > vn-chip > div:nth-child(2)',
|
|
||||||
firstEntryOfSunday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(7) > section:nth-child(1) > vn-chip > div:nth-child(2)',
|
|
||||||
secondEntryOfMonday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(2) > vn-chip > div:nth-child(2)',
|
secondEntryOfMonday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(2) > vn-chip > div:nth-child(2)',
|
||||||
secondEntryOfTuesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > section:nth-child(2) > vn-chip > div:nth-child(2)',
|
|
||||||
secondEntryOfWednesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3) > section:nth-child(2) > vn-chip > div:nth-child(2)',
|
|
||||||
secondEntryOfThursday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(4) > section:nth-child(2) > vn-chip > div:nth-child(2)',
|
|
||||||
secondEntryOfFriday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(5) > section:nth-child(2) > vn-chip > div:nth-child(2)',
|
|
||||||
secondEntryOfSaturday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6) > section:nth-child(2) > vn-chip > div:nth-child(2)',
|
|
||||||
secondEntryOfSunday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(7) > section:nth-child(2) > vn-chip > div:nth-child(2)',
|
|
||||||
thirdEntryOfMonday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(3) > vn-chip > div:nth-child(2)',
|
|
||||||
thirdEntryOfMondayDelete: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(3) > vn-chip > vn-icon[icon="cancel"]',
|
|
||||||
thirdEntryOfTuesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > section:nth-child(3) > vn-chip > div:nth-child(2)',
|
|
||||||
thirdEntryOfWednesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3) > section:nth-child(3) > vn-chip > div:nth-child(2)',
|
|
||||||
thirdEntryOfThursday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(4) > section:nth-child(3) > vn-chip > div:nth-child(2)',
|
|
||||||
thirdEntryOfFriday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(5) > section:nth-child(3) > vn-chip > div:nth-child(2)',
|
|
||||||
thirdEntryOfSaturday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6) > section:nth-child(3) > vn-chip > div:nth-child(2)',
|
|
||||||
thirdEntryOfSunday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(7) > section:nth-child(3) > vn-chip > div:nth-child(2)',
|
|
||||||
fourthEntryOfMonday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(4) > vn-chip > div:nth-child(2)',
|
|
||||||
fourthEntryOfTuesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > section:nth-child(4) > vn-chip > div:nth-child(2)',
|
|
||||||
fourthEntryOfWednesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3) > section:nth-child(4) > vn-chip > div:nth-child(2)',
|
|
||||||
fourthEntryOfThursday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(4) > section:nth-child(4) > vn-chip > div:nth-child(2)',
|
|
||||||
fourthEntryOfFriday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(5) > section:nth-child(4) > vn-chip > div:nth-child(2)',
|
|
||||||
fourthEntryOfSaturday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6) > section:nth-child(4) > vn-chip > div:nth-child(2)',
|
|
||||||
fourthEntryOfSunday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(7) > section:nth-child(4) > vn-chip > div:nth-child(2)',
|
|
||||||
mondayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(1)',
|
mondayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(1)',
|
||||||
tuesdayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(2)',
|
|
||||||
wednesdayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(3)',
|
|
||||||
thursdayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(4)',
|
|
||||||
fridayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(5)',
|
|
||||||
saturdayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(6)',
|
|
||||||
sundayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(7)',
|
|
||||||
weekWorkedHours: 'vn-worker-time-control vn-side-menu vn-label-value > section > span',
|
weekWorkedHours: 'vn-worker-time-control vn-side-menu vn-label-value > section > span',
|
||||||
nextMonthButton: 'vn-worker-time-control vn-side-menu vn-calendar vn-button[icon=keyboard_arrow_right]',
|
nextMonthButton: 'vn-worker-time-control vn-side-menu vn-calendar vn-button[icon=keyboard_arrow_right]',
|
||||||
previousMonthButton: 'vn-worker-time-control vn-side-menu vn-calendar vn-button[icon=keyboard_arrow_left]',
|
previousMonthButton: 'vn-worker-time-control vn-side-menu vn-calendar vn-button[icon=keyboard_arrow_left]',
|
||||||
|
monthName: 'vn-worker-time-control vn-side-menu vn-calendar div > .title',
|
||||||
secondWeekDay: 'vn-worker-time-control vn-side-menu vn-calendar .day:nth-child(8) > .day-number',
|
secondWeekDay: 'vn-worker-time-control vn-side-menu vn-calendar .day:nth-child(8) > .day-number',
|
||||||
|
thrirdWeekDay: 'vn-worker-time-control vn-side-menu vn-calendar .day:nth-child(15) > .day-number',
|
||||||
navigateBackToIndex: 'vn-worker-descriptor [name="goToModuleIndex"]'
|
navigateBackToIndex: 'vn-worker-descriptor [name="goToModuleIndex"]'
|
||||||
},
|
},
|
||||||
workerCalendar: {
|
workerCalendar: {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint max-len: ["error", { "code": 150 }]*/
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
|
@ -10,414 +11,105 @@ describe('Worker time control path', () => {
|
||||||
await page.loginAndModule('salesBoss', 'worker');
|
await page.loginAndModule('salesBoss', 'worker');
|
||||||
await page.accessToSearchResult('HankPym');
|
await page.accessToSearchResult('HankPym');
|
||||||
await page.accessToSection('worker.card.timeControl');
|
await page.accessToSection('worker.card.timeControl');
|
||||||
await page.waitToClick(selectors.workerTimeControl.previousMonthButton);
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async() => {
|
afterAll(async() => {
|
||||||
await browser.close();
|
await browser.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('as salesBoss', () => {
|
const eightAm = '08:00';
|
||||||
describe('on Monday', () => {
|
const fourPm = '16:00';
|
||||||
it('should scan in Hank Pym', async() => {
|
const hankPymId = 1107;
|
||||||
const scanTime = '07:00';
|
|
||||||
|
|
||||||
|
it('should go to the next month', async() => {
|
||||||
|
const date = new Date();
|
||||||
|
date.setMonth(date.getMonth() + 1);
|
||||||
|
const month = date.toLocaleString('default', {month: 'long'});
|
||||||
|
|
||||||
|
await page.waitToClick(selectors.workerTimeControl.nextMonthButton);
|
||||||
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.monthName, 'innerText');
|
||||||
|
|
||||||
|
expect(result).toContain(month);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should go to current month', async() => {
|
||||||
|
const date = new Date();
|
||||||
|
const month = date.toLocaleString('default', {month: 'long'});
|
||||||
|
|
||||||
|
await page.waitToClick(selectors.workerTimeControl.previousMonthButton);
|
||||||
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.monthName, 'innerText');
|
||||||
|
|
||||||
|
expect(result).toContain(month);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should go 1 month in the past', async() => {
|
||||||
|
const date = new Date();
|
||||||
|
date.setMonth(date.getMonth() - 1);
|
||||||
|
const timestamp = Math.round(date.getTime() / 1000);
|
||||||
|
const month = date.toLocaleString('default', {month: 'long'});
|
||||||
|
|
||||||
|
await page.loginAndModule('salesBoss', 'worker');
|
||||||
|
await page.goto(`http://localhost:5000/#!/worker/${hankPymId}/time-control?timestamp=${timestamp}`);
|
||||||
|
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
|
||||||
|
|
||||||
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.monthName, 'innerText');
|
||||||
|
|
||||||
|
expect(result).toContain(month);
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should return error when insert 'out' of first entry`, async() => {
|
||||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm);
|
||||||
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
||||||
|
await page.respondToDialog('accept');
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.text).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should insert 'in' monday`, async() => {
|
||||||
|
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||||
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm);
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
|
||||||
await page.respondToDialog('accept');
|
await page.respondToDialog('accept');
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(eightAm);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should scan out Hank Pym for break`, async() => {
|
it(`should insert 'out' monday`, async() => {
|
||||||
const scanTime = '10:00';
|
|
||||||
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, fourPm);
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
||||||
await page.respondToDialog('accept');
|
await page.respondToDialog('accept');
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
expect(result).toEqual(fourPm);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should scan in Hank Pym for a wrong hour and forget to scan in from the break`, async() => {
|
it(`should check Hank Pym worked 8:20 hours`, async() => {
|
||||||
const scanTime = '18:00';
|
await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '08:20 h.');
|
||||||
|
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '08:20 h.');
|
||||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should delete the wrong entry for Hank Pym`, async() => {
|
it('should remove first entry of monday', async() => {
|
||||||
const wrongScanTime = '18:00';
|
await page.waitForTextInElement(selectors.workerTimeControl.firstEntryOfMonday, eightAm);
|
||||||
|
await page.waitForTextInElement(selectors.workerTimeControl.secondEntryOfMonday, fourPm);
|
||||||
await page.waitForTextInElement(selectors.workerTimeControl.thirdEntryOfMonday, wrongScanTime);
|
await page.waitToClick(selectors.workerTimeControl.firstEntryOfMondayDelete);
|
||||||
await page.waitToClick(selectors.workerTimeControl.thirdEntryOfMondayDelete);
|
|
||||||
await page.respondToDialog('accept');
|
await page.respondToDialog('accept');
|
||||||
const message = await page.waitForSnackbar();
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
expect(message.text).toContain('Entry removed');
|
expect(message.text).toContain('Entry removed');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should scan out Hank Pym to leave early`, async() => {
|
it(`should be the 'out' the first entry of monday`, async() => {
|
||||||
const scanTime = '14:00';
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
|
||||||
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
expect(result).toEqual(fourPm);
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should add the break's scan in for Hank Pym and be in the right order`, async() => {
|
it('should change week of month', async() => {
|
||||||
const scanTime = '10:20';
|
await page.waitToClick(selectors.workerTimeControl.thrirdWeekDay);
|
||||||
|
await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '00:00 h.');
|
||||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual('14:00');
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should the third entry be the scan in from break`, async() => {
|
|
||||||
const scanTime = '10:20';
|
|
||||||
|
|
||||||
const result = await page
|
|
||||||
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should check Hank Pym worked 6:40 hours`, async() => {
|
|
||||||
await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '06:40 h.');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('on Tuesday', () => {
|
|
||||||
it('should happily scan in Hank Pym', async() => {
|
|
||||||
const scanTime = '08:00';
|
|
||||||
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should happily scan out Hank Pym for break`, async() => {
|
|
||||||
const scanTime = '10:00';
|
|
||||||
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should happily scan in Hank Pym from the break`, async() => {
|
|
||||||
const scanTime = '10:20';
|
|
||||||
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should happily scan out Hank Pym for the day`, async() => {
|
|
||||||
const scanTime = '16:00';
|
|
||||||
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should check Hank Pym worked 7:40 hours`, async() => {
|
|
||||||
await page.waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '07:40 h.');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('on Wednesday', () => {
|
|
||||||
it('should cheerfully scan in Hank Pym', async() => {
|
|
||||||
const scanTime = '09:00';
|
|
||||||
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should cheerfully scan out Hank Pym for break`, async() => {
|
|
||||||
const scanTime = '10:00';
|
|
||||||
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should cheerfully scan in Hank Pym from the break`, async() => {
|
|
||||||
const scanTime = '10:20';
|
|
||||||
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should cheerfully scan out Hank Pym for the day`, async() => {
|
|
||||||
const scanTime = '17:00';
|
|
||||||
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should check Hank Pym worked 7:40 cheerfull hours`, async() => {
|
|
||||||
await page.waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '07:40 h.');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('on Thursday', () => {
|
|
||||||
it('should joyfully scan in Hank Pym', async() => {
|
|
||||||
const scanTime = '09:59';
|
|
||||||
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should joyfully scan out Hank Pym for break`, async() => {
|
|
||||||
const scanTime = '10:00';
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should joyfully scan in Hank Pym from the break`, async() => {
|
|
||||||
const scanTime = '10:20';
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should joyfully scan out Hank Pym for the day`, async() => {
|
|
||||||
const scanTime = '17:59';
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should check Hank Pym worked 7:40 joyfull hours`, async() => {
|
|
||||||
await page.waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '07:40 h.');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('on Friday', () => {
|
|
||||||
it('should smilingly scan in Hank Pym', async() => {
|
|
||||||
const scanTime = '07:30';
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should smilingly scan out Hank Pym for break`, async() => {
|
|
||||||
const scanTime = '10:00';
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should smilingly scan in Hank Pym from the break`, async() => {
|
|
||||||
const scanTime = '10:20';
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should smilingly scan out Hank Pym for the day`, async() => {
|
|
||||||
const scanTime = '15:30';
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should check Hank Pym worked 7:40 hours with a smile on his face`, async() => {
|
|
||||||
await page.waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '07:40 h.');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('as HHRR', () => {
|
|
||||||
describe('on Saturday', () => {
|
|
||||||
it('should log in as hr and pick the worker module', async() => {
|
|
||||||
await page.loginAndModule('hr', 'worker');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should search for a worker and access to its summary', async() => {
|
|
||||||
await page.accessToSearchResult('HankPym');
|
|
||||||
await page.waitForState('worker.card.summary');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should access to the time control section', async() => {
|
|
||||||
await page.accessToSection('worker.card.timeControl');
|
|
||||||
await page.waitForState('worker.card.timeControl');
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.previousMonthButton);
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should lovingly scan in Hank Pym', async() => {
|
|
||||||
const scanTime = '06:00';
|
|
||||||
await page.waitForTimeout(1000); // without this timeout the dialog doesn't pop up
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should lovingly scan out Hank Pym for the day with no break to leave a bit early`, async() => {
|
|
||||||
const scanTime = '13:40';
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should check Hank Pym worked 7:40 hours with all his will`, async() => {
|
|
||||||
await page.waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '07:40 h.');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('on Sunday', () => {
|
|
||||||
it('should gladly scan in Hank Pym', async() => {
|
|
||||||
const scanTime = '05:00';
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should gladly scan out Hank Pym for the day with no break to leave a bit early`, async() => {
|
|
||||||
const scanTime = '12:40';
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(scanTime);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should check Hank Pym worked 7:40 glad hours`, async() => {
|
|
||||||
await page.waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '07:40 h.');
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should check Hank Pym doesn't have hours set on the next months second week`, async() => {
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.nextMonthButton);
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
|
|
||||||
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 h.');
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should check he didn't scan in this week yet`, async() => {
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.navigateBackToIndex);
|
|
||||||
await page.accessToSearchResult('salesBoss');
|
|
||||||
await page.accessToSection('worker.card.timeControl');
|
|
||||||
|
|
||||||
const wholeWeekHours = await page
|
|
||||||
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
|
||||||
|
|
||||||
expect(wholeWeekHours).toEqual('00:00 h.');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('after all this amazing week', () => {
|
|
||||||
it('should log in Hank', async() => {
|
|
||||||
await page.loginAndModule('HankPym', 'worker');
|
|
||||||
await page.accessToSearchResult('HankPym');
|
|
||||||
await page.accessToSection('worker.card.timeControl');
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.previousMonthButton);
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should check his weekly hours are alright', async() => {
|
|
||||||
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '52:40 h.');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,7 +18,7 @@ describe('Ticket expeditions and log path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should delete a former expedition and confirm the remaining expedition are the expected ones`, async() => {
|
it(`should delete a former expedition and confirm the remaining expedition are the expected ones`, async() => {
|
||||||
await page.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton);
|
await page.waitToClick(selectors.ticketExpedition.thirdExpeditionRemoveButton);
|
||||||
await page.waitToClick(selectors.globalItems.acceptButton);
|
await page.waitToClick(selectors.globalItems.acceptButton);
|
||||||
await page.reloadSection('ticket.card.expedition');
|
await page.reloadSection('ticket.card.expedition');
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,6 @@ describe('Claim edit basic data path', () => {
|
||||||
|
|
||||||
it(`should edit claim state and observation fields`, async() => {
|
it(`should edit claim state and observation fields`, async() => {
|
||||||
await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Gestionado');
|
await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Gestionado');
|
||||||
await page.clearTextarea(selectors.claimBasicData.observation);
|
|
||||||
await page.write(selectors.claimBasicData.observation, 'edited observation');
|
|
||||||
await page.clearInput(selectors.claimBasicData.packages);
|
await page.clearInput(selectors.claimBasicData.packages);
|
||||||
await page.write(selectors.claimBasicData.packages, '2');
|
await page.write(selectors.claimBasicData.packages, '2');
|
||||||
await page.waitToClick(selectors.claimBasicData.saveButton);
|
await page.waitToClick(selectors.claimBasicData.saveButton);
|
||||||
|
@ -59,13 +57,6 @@ describe('Claim edit basic data path', () => {
|
||||||
expect(hasToPickUpCheckbox).toBe('checked');
|
expect(hasToPickUpCheckbox).toBe('checked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the claim observation was edited', async() => {
|
|
||||||
const result = await page
|
|
||||||
.waitToGetProperty(selectors.claimBasicData.observation, 'value');
|
|
||||||
|
|
||||||
expect(result).toEqual('edited observation');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should confirm the claim packages was edited', async() => {
|
it('should confirm the claim packages was edited', async() => {
|
||||||
const result = await page
|
const result = await page
|
||||||
.waitToGetProperty(selectors.claimBasicData.packages, 'value');
|
.waitToGetProperty(selectors.claimBasicData.packages, 'value');
|
||||||
|
@ -75,8 +66,6 @@ describe('Claim edit basic data path', () => {
|
||||||
|
|
||||||
it(`should edit the claim to leave it untainted`, async() => {
|
it(`should edit the claim to leave it untainted`, async() => {
|
||||||
await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Pendiente');
|
await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Pendiente');
|
||||||
await page.clearTextarea(selectors.claimBasicData.observation);
|
|
||||||
await page.write(selectors.claimBasicData.observation, 'Observation one');
|
|
||||||
await page.clearInput(selectors.claimBasicData.packages);
|
await page.clearInput(selectors.claimBasicData.packages);
|
||||||
await page.write(selectors.claimBasicData.packages, '0');
|
await page.write(selectors.claimBasicData.packages, '0');
|
||||||
await page.waitToClick(selectors.claimBasicData.saveButton);
|
await page.waitToClick(selectors.claimBasicData.saveButton);
|
||||||
|
|
|
@ -37,7 +37,7 @@ describe('Claim summary path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should display the observation', async() => {
|
it('should display the observation', async() => {
|
||||||
const result = await page.waitToGetProperty(selectors.claimSummary.observation, 'value');
|
const result = await page.waitToGetProperty(selectors.claimSummary.observation, 'innerText');
|
||||||
|
|
||||||
expect(result).toContain('Wisi forensibus mnesarchum in cum. Per id impetus abhorreant');
|
expect(result).toContain('Wisi forensibus mnesarchum in cum. Per id impetus abhorreant');
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
import selectors from '../../helpers/selectors';
|
||||||
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
|
describe('Claim Add note path', () => {
|
||||||
|
let browser;
|
||||||
|
let page;
|
||||||
|
beforeAll(async() => {
|
||||||
|
browser = await getBrowser();
|
||||||
|
page = browser.page;
|
||||||
|
await page.loginAndModule('salesPerson', 'claim');
|
||||||
|
await page.accessToSearchResult('2');
|
||||||
|
await page.accessToSection('claim.card.note.index');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async() => {
|
||||||
|
await browser.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should reach the claim note index`, async() => {
|
||||||
|
await page.waitForState('claim.card.note.index');
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should click on the add new note button`, async() => {
|
||||||
|
await page.waitToClick(selectors.claimNote.addNoteFloatButton);
|
||||||
|
await page.waitForState('claim.card.note.create');
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should create a new note`, async() => {
|
||||||
|
await page.waitForSelector(selectors.claimNote.note);
|
||||||
|
await page.type(`${selectors.claimNote.note} textarea`, 'The delivery was unsuccessful');
|
||||||
|
await page.waitToClick(selectors.claimNote.saveButton);
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.text).toContain('Data saved!');
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should redirect back to the claim notes page`, async() => {
|
||||||
|
await page.waitForState('claim.card.note.index');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should confirm the note was created', async() => {
|
||||||
|
const result = await page.waitToGetProperty(selectors.claimNote.firstNoteText, 'innerText');
|
||||||
|
|
||||||
|
expect(result).toEqual('The delivery was unsuccessful');
|
||||||
|
});
|
||||||
|
});
|
|
@ -9,7 +9,7 @@ describe('Route summary path', () => {
|
||||||
browser = await getBrowser();
|
browser = await getBrowser();
|
||||||
page = browser.page;
|
page = browser.page;
|
||||||
await page.loginAndModule('employee', 'route');
|
await page.loginAndModule('employee', 'route');
|
||||||
await page.waitToClick('vn-route-index vn-tbody > a:nth-child(1)');
|
await page.waitToClick('vn-route-index vn-tbody > a:nth-child(7)');
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async() => {
|
afterAll(async() => {
|
||||||
|
|
|
@ -124,5 +124,13 @@
|
||||||
"isWithoutNegatives": "isWithoutNegatives",
|
"isWithoutNegatives": "isWithoutNegatives",
|
||||||
"routeFk": "routeFk",
|
"routeFk": "routeFk",
|
||||||
"Not enough privileges to edit a client with verified data": "Not enough privileges to edit a client with verified data",
|
"Not enough privileges to edit a client with verified data": "Not enough privileges to edit a client with verified data",
|
||||||
"Can't change the password of another worker": "Can't change the password of another worker"
|
"Can't change the password of another worker": "Can't change the password of another worker",
|
||||||
|
"No hay un contrato en vigor": "There is no existing contract",
|
||||||
|
"No está permitido trabajar": "Not allowed to work",
|
||||||
|
"Dirección incorrecta": "Wrong direction",
|
||||||
|
"No se permite fichar a futuro": "It is not allowed to sign in the future",
|
||||||
|
"Descanso diario 12h.": "Daily rest 12h.",
|
||||||
|
"Fichadas impares": "Odd signs",
|
||||||
|
"Descanso diario 9h.": "Daily rest 9h.",
|
||||||
|
"Descanso semanal 36h. / 72h.": "Weekly rest 36h. / 72h."
|
||||||
}
|
}
|
|
@ -227,5 +227,12 @@
|
||||||
"This ticket is already a refund": "Este ticket ya es un abono",
|
"This ticket is already a refund": "Este ticket ya es un abono",
|
||||||
"isWithoutNegatives": "isWithoutNegatives",
|
"isWithoutNegatives": "isWithoutNegatives",
|
||||||
"routeFk": "routeFk",
|
"routeFk": "routeFk",
|
||||||
"Can't change the password of another worker": "No se puede cambiar la contraseña de otro trabajador"
|
"Can't change the password of another worker": "No se puede cambiar la contraseña de otro trabajador",
|
||||||
|
"No hay un contrato en vigor": "No hay un contrato en vigor",
|
||||||
|
"No se permite fichar a futuro": "No se permite fichar a futuro",
|
||||||
|
"No está permitido trabajar": "No está permitido trabajar",
|
||||||
|
"Fichadas impares": "Fichadas impares",
|
||||||
|
"Descanso diario 12h.": "Descanso diario 12h.",
|
||||||
|
"Descanso semanal 36h. / 72h.": "Descanso semanal 36h. / 72h.",
|
||||||
|
"Dirección incorrecta": "Dirección incorrecta"
|
||||||
}
|
}
|
|
@ -84,6 +84,20 @@ module.exports = Self => {
|
||||||
};
|
};
|
||||||
promises.push(Self.app.models.ClaimBeginning.find(filter, myOptions));
|
promises.push(Self.app.models.ClaimBeginning.find(filter, myOptions));
|
||||||
|
|
||||||
|
// Claim observations
|
||||||
|
filter = {
|
||||||
|
where: {claimFk: id},
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'worker',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'firstName', 'lastName']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
promises.push(Self.app.models.ClaimObservation.find(filter, myOptions));
|
||||||
|
|
||||||
// Claim developments
|
// Claim developments
|
||||||
filter = {
|
filter = {
|
||||||
where: {claimFk: id},
|
where: {claimFk: id},
|
||||||
|
@ -138,8 +152,9 @@ module.exports = Self => {
|
||||||
summary.isEditable = await Self.isEditable(ctx, id, myOptions);
|
summary.isEditable = await Self.isEditable(ctx, id, myOptions);
|
||||||
[summary.claim] = res[0];
|
[summary.claim] = res[0];
|
||||||
summary.salesClaimed = res[1];
|
summary.salesClaimed = res[1];
|
||||||
summary.developments = res[2];
|
summary.observations = res[2];
|
||||||
summary.actions = res[3];
|
summary.developments = res[3];
|
||||||
|
summary.actions = res[4];
|
||||||
|
|
||||||
return summary;
|
return summary;
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,6 +19,7 @@ describe('claim getSummary()', () => {
|
||||||
expect(keys).toContain('claim');
|
expect(keys).toContain('claim');
|
||||||
expect(keys).toContain('salesClaimed');
|
expect(keys).toContain('salesClaimed');
|
||||||
expect(keys).toContain('developments');
|
expect(keys).toContain('developments');
|
||||||
|
expect(keys).toContain('observations');
|
||||||
expect(keys).toContain('actions');
|
expect(keys).toContain('actions');
|
||||||
expect(keys).toContain('isEditable');
|
expect(keys).toContain('isEditable');
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,9 @@
|
||||||
"ClaimLog": {
|
"ClaimLog": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"ClaimObservation": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"ClaimContainer": {
|
"ClaimContainer": {
|
||||||
"dataSource": "claimStorage"
|
"dataSource": "claimStorage"
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
{
|
||||||
|
"name": "ClaimObservation",
|
||||||
|
"base": "Loggable",
|
||||||
|
"log": {
|
||||||
|
"model": "ClaimLog",
|
||||||
|
"relation": "claim"
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "claimObservation"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"claimFk": {
|
||||||
|
"type": "number",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"text": {
|
||||||
|
"type": "string",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"created": {
|
||||||
|
"type": "date"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"worker": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Worker",
|
||||||
|
"foreignKey": "workerFk"
|
||||||
|
},
|
||||||
|
"claim": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Claim",
|
||||||
|
"foreignKey": "claimFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -51,15 +51,6 @@
|
||||||
label="Packages received"
|
label="Packages received"
|
||||||
ng-model="$ctrl.claim.packages">
|
ng-model="$ctrl.claim.packages">
|
||||||
</vn-input-number>
|
</vn-input-number>
|
||||||
</vn-horizontal>
|
|
||||||
<vn-horizontal>
|
|
||||||
<vn-textarea
|
|
||||||
label="Observation"
|
|
||||||
ng-model="$ctrl.claim.observation"
|
|
||||||
rule>
|
|
||||||
</vn-textarea>
|
|
||||||
</vn-horizontal>
|
|
||||||
<vn-horizontal>
|
|
||||||
<vn-check
|
<vn-check
|
||||||
class="vn-mr-md"
|
class="vn-mr-md"
|
||||||
label="Pick up"
|
label="Pick up"
|
||||||
|
|
|
@ -12,3 +12,5 @@ import './search-panel';
|
||||||
import './summary';
|
import './summary';
|
||||||
import './photos';
|
import './photos';
|
||||||
import './log';
|
import './log';
|
||||||
|
import './note/index';
|
||||||
|
import './note/create';
|
||||||
|
|
|
@ -6,6 +6,7 @@ Client Id: Id cliente
|
||||||
Claimed ticket: Ticket reclamado
|
Claimed ticket: Ticket reclamado
|
||||||
Delete claim: Eliminar reclamación
|
Delete claim: Eliminar reclamación
|
||||||
Observation: Observación
|
Observation: Observación
|
||||||
|
Observations: Observaciones
|
||||||
Responsible: Responsable
|
Responsible: Responsable
|
||||||
Remove sale: Eliminar linea
|
Remove sale: Eliminar linea
|
||||||
Claim Id: Id reclamación
|
Claim Id: Id reclamación
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
<vn-watcher
|
||||||
|
vn-id="watcher"
|
||||||
|
url="claimObservations"
|
||||||
|
id-field="id"
|
||||||
|
data="$ctrl.note"
|
||||||
|
insert-mode="true"
|
||||||
|
form="form">
|
||||||
|
</vn-watcher>
|
||||||
|
<form name="form" ng-submit="watcher.submitGo('claim.card.note.index')" class="vn-w-md">
|
||||||
|
<vn-card class="vn-pa-lg">
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-textarea
|
||||||
|
vn-one
|
||||||
|
label="Note"
|
||||||
|
ng-model="$ctrl.note.text"
|
||||||
|
vn-focus>
|
||||||
|
</vn-textarea>
|
||||||
|
</vn-horizontal>
|
||||||
|
</vn-card>
|
||||||
|
<vn-button-bar>
|
||||||
|
<vn-submit
|
||||||
|
ng-if="watcher.dataChanged()"
|
||||||
|
label="Save">
|
||||||
|
</vn-submit>
|
||||||
|
<vn-button
|
||||||
|
ng-click="$ctrl.cancel()"
|
||||||
|
label="Cancel">
|
||||||
|
</vn-button>
|
||||||
|
</vn-button-bar>
|
||||||
|
</form>
|
|
@ -0,0 +1,22 @@
|
||||||
|
import ngModule from '../../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
|
export default class Controller extends Section {
|
||||||
|
constructor($element, $) {
|
||||||
|
super($element, $);
|
||||||
|
this.note = {
|
||||||
|
claimFk: parseInt(this.$params.id),
|
||||||
|
workerFk: window.localStorage.currentUserWorkerId,
|
||||||
|
text: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
cancel() {
|
||||||
|
this.$state.go('claim.card.note.index', {id: this.$params.id});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnClaimNoteCreate', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: Controller
|
||||||
|
});
|
|
@ -0,0 +1,32 @@
|
||||||
|
<vn-crud-model
|
||||||
|
vn-id="model"
|
||||||
|
url="ClaimObservations"
|
||||||
|
filter="$ctrl.filter"
|
||||||
|
where="{claimFk: $ctrl.$params.id}"
|
||||||
|
include="$ctrl.include"
|
||||||
|
data="notes"
|
||||||
|
auto-load="true">
|
||||||
|
</vn-crud-model>
|
||||||
|
<vn-data-viewer
|
||||||
|
model="model"
|
||||||
|
class="vn-w-md">
|
||||||
|
<vn-card class="vn-pa-md">
|
||||||
|
<div
|
||||||
|
ng-repeat="note in notes"
|
||||||
|
class="note vn-pa-sm border-solid border-radius vn-mb-md">
|
||||||
|
<vn-horizontal class="vn-mb-sm" style="color: #666">
|
||||||
|
<vn-one>{{::note.worker.firstName}} {{::note.worker.lastName}}</vn-one>
|
||||||
|
<vn-auto>{{::note.created | date:'dd/MM/yyyy HH:mm'}}</vn-auto>
|
||||||
|
</vn-horizontal>
|
||||||
|
<vn-horizontal class="text">
|
||||||
|
{{::note.text}}
|
||||||
|
</vn-horizontal>
|
||||||
|
</div>
|
||||||
|
</vn-card>
|
||||||
|
</vn-data-viewer>
|
||||||
|
<a vn-tooltip="New note"
|
||||||
|
ui-sref="claim.card.note.create({id: $ctrl.$params.id})"
|
||||||
|
vn-bind="+"
|
||||||
|
fixed-bottom-right>
|
||||||
|
<vn-float-button icon="add"></vn-float-button>
|
||||||
|
</a>
|
|
@ -0,0 +1,25 @@
|
||||||
|
import ngModule from '../../module';
|
||||||
|
import Section from 'salix/components/section';
|
||||||
|
import './style.scss';
|
||||||
|
|
||||||
|
export default class Controller extends Section {
|
||||||
|
constructor($element, $) {
|
||||||
|
super($element, $);
|
||||||
|
this.filter = {
|
||||||
|
order: 'created DESC',
|
||||||
|
};
|
||||||
|
this.include = {
|
||||||
|
relation: 'worker',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'firstName', 'lastName']
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Controller.$inject = ['$element', '$scope'];
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnClaimNote', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: Controller,
|
||||||
|
});
|
|
@ -0,0 +1,5 @@
|
||||||
|
vn-client-note {
|
||||||
|
.note:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,6 +12,7 @@
|
||||||
{"state": "claim.card.basicData", "icon": "settings"},
|
{"state": "claim.card.basicData", "icon": "settings"},
|
||||||
{"state": "claim.card.detail", "icon": "icon-details"},
|
{"state": "claim.card.detail", "icon": "icon-details"},
|
||||||
{"state": "claim.card.photos", "icon": "image"},
|
{"state": "claim.card.photos", "icon": "image"},
|
||||||
|
{"state": "claim.card.note.index", "icon": "insert_drive_file"},
|
||||||
{"state": "claim.card.development", "icon": "icon-traceability"},
|
{"state": "claim.card.development", "icon": "icon-traceability"},
|
||||||
{"state": "claim.card.action", "icon": "icon-actions"},
|
{"state": "claim.card.action", "icon": "icon-actions"},
|
||||||
{"state": "claim.card.log", "icon": "history"}
|
{"state": "claim.card.log", "icon": "history"}
|
||||||
|
@ -27,17 +28,20 @@
|
||||||
"abstract": true,
|
"abstract": true,
|
||||||
"component": "vn-claim",
|
"component": "vn-claim",
|
||||||
"description": "Claims"
|
"description": "Claims"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/index?q",
|
"url": "/index?q",
|
||||||
"state": "claim.index",
|
"state": "claim.index",
|
||||||
"component": "vn-claim-index",
|
"component": "vn-claim-index",
|
||||||
"description": "Claims"
|
"description": "Claims"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/:id",
|
"url": "/:id",
|
||||||
"state": "claim.card",
|
"state": "claim.card",
|
||||||
"abstract": true,
|
"abstract": true,
|
||||||
"component": "vn-claim-card"
|
"component": "vn-claim-card"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/summary",
|
"url": "/summary",
|
||||||
"state": "claim.card.summary",
|
"state": "claim.card.summary",
|
||||||
"component": "vn-claim-summary",
|
"component": "vn-claim-summary",
|
||||||
|
@ -45,7 +49,8 @@
|
||||||
"params": {
|
"params": {
|
||||||
"claim": "$ctrl.claim"
|
"claim": "$ctrl.claim"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/basic-data",
|
"url": "/basic-data",
|
||||||
"state": "claim.card.basicData",
|
"state": "claim.card.basicData",
|
||||||
"component": "vn-claim-basic-data",
|
"component": "vn-claim-basic-data",
|
||||||
|
@ -54,7 +59,8 @@
|
||||||
"claim": "$ctrl.claim"
|
"claim": "$ctrl.claim"
|
||||||
},
|
},
|
||||||
"acl": ["salesPerson"]
|
"acl": ["salesPerson"]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/detail",
|
"url": "/detail",
|
||||||
"state": "claim.card.detail",
|
"state": "claim.card.detail",
|
||||||
"component": "vn-claim-detail",
|
"component": "vn-claim-detail",
|
||||||
|
@ -63,7 +69,32 @@
|
||||||
"claim": "$ctrl.claim"
|
"claim": "$ctrl.claim"
|
||||||
},
|
},
|
||||||
"acl": ["salesPerson"]
|
"acl": ["salesPerson"]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
|
"url": "/note",
|
||||||
|
"state": "claim.card.note",
|
||||||
|
"component": "ui-view",
|
||||||
|
"abstract": true,
|
||||||
|
"acl": ["salesPerson"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "/index",
|
||||||
|
"state": "claim.card.note.index",
|
||||||
|
"component": "vn-claim-note",
|
||||||
|
"description": "Notes",
|
||||||
|
"params": {
|
||||||
|
"claim": "$ctrl.claim"
|
||||||
|
},
|
||||||
|
"acl": ["salesPerson"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "/create",
|
||||||
|
"state": "claim.card.note.create",
|
||||||
|
"component": "vn-claim-note-create",
|
||||||
|
"description": "New note",
|
||||||
|
"acl": ["salesPerson"]
|
||||||
|
},
|
||||||
|
{
|
||||||
"url": "/development",
|
"url": "/development",
|
||||||
"state": "claim.card.development",
|
"state": "claim.card.development",
|
||||||
"component": "vn-claim-development",
|
"component": "vn-claim-development",
|
||||||
|
@ -72,7 +103,8 @@
|
||||||
"claim": "$ctrl.claim"
|
"claim": "$ctrl.claim"
|
||||||
},
|
},
|
||||||
"acl": ["claimManager"]
|
"acl": ["claimManager"]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/action",
|
"url": "/action",
|
||||||
"state": "claim.card.action",
|
"state": "claim.card.action",
|
||||||
"component": "vn-claim-action",
|
"component": "vn-claim-action",
|
||||||
|
@ -81,7 +113,8 @@
|
||||||
"claim": "$ctrl.claim"
|
"claim": "$ctrl.claim"
|
||||||
},
|
},
|
||||||
"acl": ["claimManager"]
|
"acl": ["claimManager"]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/photos",
|
"url": "/photos",
|
||||||
"state": "claim.card.photos",
|
"state": "claim.card.photos",
|
||||||
"component": "vn-claim-photos",
|
"component": "vn-claim-photos",
|
||||||
|
@ -89,7 +122,8 @@
|
||||||
"params": {
|
"params": {
|
||||||
"claim": "$ctrl.claim"
|
"claim": "$ctrl.claim"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url" : "/log",
|
"url" : "/log",
|
||||||
"state": "claim.card.log",
|
"state": "claim.card.log",
|
||||||
"component": "vn-claim-log",
|
"component": "vn-claim-log",
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<vn-crud-model vn-id="model"
|
<vn-crud-model
|
||||||
|
vn-id="model"
|
||||||
url="ClaimDms"
|
url="ClaimDms"
|
||||||
filter="::$ctrl.filter"
|
filter="::$ctrl.filter"
|
||||||
data="photos">
|
data="photos">
|
||||||
|
@ -42,14 +43,31 @@
|
||||||
value="{{$ctrl.summary.claim.worker.user.nickname}}">
|
value="{{$ctrl.summary.claim.worker.user.nickname}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
</vn-one>
|
</vn-one>
|
||||||
<vn-two>
|
<vn-auto>
|
||||||
<vn-textarea
|
<h4 ng-show="$ctrl.isSalesPerson && $ctrl.summary.observations.length">
|
||||||
vn-three
|
<a
|
||||||
disabled="true"
|
ui-sref="claim.card.note.index({id:$ctrl.claim.id})"
|
||||||
label="Observation"
|
target="_self">
|
||||||
ng-model="$ctrl.summary.claim.observation">
|
<span translate vn-tooltip="Go to">Observations</span>
|
||||||
</vn-textarea>
|
</a>
|
||||||
</vn-two>
|
</h4>
|
||||||
|
<h4
|
||||||
|
ng-show="!$ctrl.isSalesPerson && $ctrl.summary.observations.length"
|
||||||
|
translate>
|
||||||
|
Observations
|
||||||
|
</h4>
|
||||||
|
<div
|
||||||
|
ng-repeat="note in $ctrl.summary.observations"
|
||||||
|
class="note vn-pa-sm border-solid border-radius vn-mb-md">
|
||||||
|
<vn-horizontal class="vn-mb-sm" style="color: #666">
|
||||||
|
<vn-one>{{::note.worker.firstName}} {{::note.worker.lastName}}</vn-one>
|
||||||
|
<vn-auto>{{::note.created | date:'dd/MM/yyyy HH:mm'}}</vn-auto>
|
||||||
|
</vn-horizontal>
|
||||||
|
<vn-horizontal class="text">
|
||||||
|
{{::note.text}}
|
||||||
|
</vn-horizontal>
|
||||||
|
</div>
|
||||||
|
</vn-auto>
|
||||||
<vn-auto>
|
<vn-auto>
|
||||||
<h4 ng-show="$ctrl.isSalesPerson">
|
<h4 ng-show="$ctrl.isSalesPerson">
|
||||||
<a
|
<a
|
||||||
|
|
|
@ -50,22 +50,26 @@
|
||||||
"component": "vn-client",
|
"component": "vn-client",
|
||||||
"description": "Clients",
|
"description": "Clients",
|
||||||
"acl": ["employee"]
|
"acl": ["employee"]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/index?q",
|
"url": "/index?q",
|
||||||
"state": "client.index",
|
"state": "client.index",
|
||||||
"component": "vn-client-index",
|
"component": "vn-client-index",
|
||||||
"description": "Clients"
|
"description": "Clients"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/create",
|
"url": "/create",
|
||||||
"state": "client.create",
|
"state": "client.create",
|
||||||
"component": "vn-client-create",
|
"component": "vn-client-create",
|
||||||
"description": "New client"
|
"description": "New client"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/:id?sendSMS&phone&message",
|
"url": "/:id?sendSMS&phone&message",
|
||||||
"state": "client.card",
|
"state": "client.card",
|
||||||
"abstract": true,
|
"abstract": true,
|
||||||
"component": "vn-client-card"
|
"component": "vn-client-card"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/summary",
|
"url": "/summary",
|
||||||
"state": "client.card.summary",
|
"state": "client.card.summary",
|
||||||
"component": "vn-client-summary",
|
"component": "vn-client-summary",
|
||||||
|
@ -73,7 +77,8 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/basic-data",
|
"url": "/basic-data",
|
||||||
"state": "client.card.basicData",
|
"state": "client.card.basicData",
|
||||||
"component": "vn-client-basic-data",
|
"component": "vn-client-basic-data",
|
||||||
|
@ -81,7 +86,8 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/fiscal-data",
|
"url": "/fiscal-data",
|
||||||
"state": "client.card.fiscalData",
|
"state": "client.card.fiscalData",
|
||||||
"component": "vn-client-fiscal-data",
|
"component": "vn-client-fiscal-data",
|
||||||
|
@ -89,7 +95,8 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/billing-data",
|
"url": "/billing-data",
|
||||||
"state": "client.card.billingData",
|
"state": "client.card.billingData",
|
||||||
"component": "vn-client-billing-data",
|
"component": "vn-client-billing-data",
|
||||||
|
@ -97,12 +104,14 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/address",
|
"url": "/address",
|
||||||
"state": "client.card.address",
|
"state": "client.card.address",
|
||||||
"component": "ui-view",
|
"component": "ui-view",
|
||||||
"abstract": true
|
"abstract": true
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/index?q",
|
"url": "/index?q",
|
||||||
"state": "client.card.address.index",
|
"state": "client.card.address.index",
|
||||||
"component": "vn-client-address-index",
|
"component": "vn-client-address-index",
|
||||||
|
@ -110,7 +119,8 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/create",
|
"url": "/create",
|
||||||
"state": "client.card.address.create",
|
"state": "client.card.address.create",
|
||||||
"component": "vn-client-address-create",
|
"component": "vn-client-address-create",
|
||||||
|
@ -118,12 +128,14 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/:addressId/edit",
|
"url": "/:addressId/edit",
|
||||||
"state": "client.card.address.edit",
|
"state": "client.card.address.edit",
|
||||||
"component": "vn-client-address-edit",
|
"component": "vn-client-address-edit",
|
||||||
"description": "Edit address"
|
"description": "Edit address"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/web-access",
|
"url": "/web-access",
|
||||||
"state": "client.card.webAccess",
|
"state": "client.card.webAccess",
|
||||||
"component": "vn-client-web-access",
|
"component": "vn-client-web-access",
|
||||||
|
@ -131,12 +143,14 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/note",
|
"url": "/note",
|
||||||
"state": "client.card.note",
|
"state": "client.card.note",
|
||||||
"component": "ui-view",
|
"component": "ui-view",
|
||||||
"abstract": true
|
"abstract": true
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/index",
|
"url": "/index",
|
||||||
"state": "client.card.note.index",
|
"state": "client.card.note.index",
|
||||||
"component": "vn-client-note",
|
"component": "vn-client-note",
|
||||||
|
@ -144,17 +158,20 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/create",
|
"url": "/create",
|
||||||
"state": "client.card.note.create",
|
"state": "client.card.note.create",
|
||||||
"component": "vn-note-create",
|
"component": "vn-note-create",
|
||||||
"description": "New note"
|
"description": "New note"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/credit",
|
"url": "/credit",
|
||||||
"abstract": true,
|
"abstract": true,
|
||||||
"state": "client.card.credit",
|
"state": "client.card.credit",
|
||||||
"component": "ui-view"
|
"component": "ui-view"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/index",
|
"url": "/index",
|
||||||
"state": "client.card.credit.index",
|
"state": "client.card.credit.index",
|
||||||
"component": "vn-client-credit-index",
|
"component": "vn-client-credit-index",
|
||||||
|
@ -162,7 +179,8 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/create",
|
"url": "/create",
|
||||||
"state": "client.card.credit.create",
|
"state": "client.card.credit.create",
|
||||||
"component": "vn-client-credit-create",
|
"component": "vn-client-credit-create",
|
||||||
|
@ -171,12 +189,14 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/greuge",
|
"url": "/greuge",
|
||||||
"abstract": true,
|
"abstract": true,
|
||||||
"state": "client.card.greuge",
|
"state": "client.card.greuge",
|
||||||
"component": "ui-view"
|
"component": "ui-view"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/index",
|
"url": "/index",
|
||||||
"state": "client.card.greuge.index",
|
"state": "client.card.greuge.index",
|
||||||
"component": "vn-client-greuge-index",
|
"component": "vn-client-greuge-index",
|
||||||
|
@ -184,7 +204,8 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/create",
|
"url": "/create",
|
||||||
"state": "client.card.greuge.create",
|
"state": "client.card.greuge.create",
|
||||||
"component": "vn-client-greuge-create",
|
"component": "vn-client-greuge-create",
|
||||||
|
@ -193,17 +214,20 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/mandate",
|
"url": "/mandate",
|
||||||
"state": "client.card.mandate",
|
"state": "client.card.mandate",
|
||||||
"component": "vn-client-mandate",
|
"component": "vn-client-mandate",
|
||||||
"description": "Mandates"
|
"description": "Mandates"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/balance",
|
"url": "/balance",
|
||||||
"abstract": true,
|
"abstract": true,
|
||||||
"state": "client.card.balance",
|
"state": "client.card.balance",
|
||||||
"component": "ui-view"
|
"component": "ui-view"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/index",
|
"url": "/index",
|
||||||
"state": "client.card.balance.index",
|
"state": "client.card.balance.index",
|
||||||
"component": "vn-client-balance-index",
|
"component": "vn-client-balance-index",
|
||||||
|
@ -211,7 +235,8 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/create?payed&companyFk&bankFk&payedAmount",
|
"url": "/create?payed&companyFk&bankFk&payedAmount",
|
||||||
"state": "client.card.balance.create",
|
"state": "client.card.balance.create",
|
||||||
"component": "vn-client-balance-create",
|
"component": "vn-client-balance-create",
|
||||||
|
@ -219,12 +244,14 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/recovery",
|
"url": "/recovery",
|
||||||
"abstract": true,
|
"abstract": true,
|
||||||
"state": "client.card.recovery",
|
"state": "client.card.recovery",
|
||||||
"component": "ui-view"
|
"component": "ui-view"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/index",
|
"url": "/index",
|
||||||
"state": "client.card.recovery.index",
|
"state": "client.card.recovery.index",
|
||||||
"component": "vn-client-recovery-index",
|
"component": "vn-client-recovery-index",
|
||||||
|
@ -232,7 +259,8 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/create",
|
"url": "/create",
|
||||||
"state": "client.card.recovery.create",
|
"state": "client.card.recovery.create",
|
||||||
"component": "vn-client-recovery-create",
|
"component": "vn-client-recovery-create",
|
||||||
|
@ -240,12 +268,14 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/credit-insurance",
|
"url": "/credit-insurance",
|
||||||
"abstract": true,
|
"abstract": true,
|
||||||
"state": "client.card.creditInsurance",
|
"state": "client.card.creditInsurance",
|
||||||
"component": "ui-view"
|
"component": "ui-view"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/index",
|
"url": "/index",
|
||||||
"state": "client.card.creditInsurance.index",
|
"state": "client.card.creditInsurance.index",
|
||||||
"component": "vn-client-credit-insurance-index",
|
"component": "vn-client-credit-insurance-index",
|
||||||
|
@ -253,7 +283,8 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/create",
|
"url": "/create",
|
||||||
"state": "client.card.creditInsurance.create",
|
"state": "client.card.creditInsurance.create",
|
||||||
"component": "vn-client-credit-insurance-create",
|
"component": "vn-client-credit-insurance-create",
|
||||||
|
@ -262,13 +293,15 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/insurance",
|
"url": "/insurance",
|
||||||
"abstract": true,
|
"abstract": true,
|
||||||
"state": "client.card.creditInsurance.insurance",
|
"state": "client.card.creditInsurance.insurance",
|
||||||
"component": "ui-view",
|
"component": "ui-view",
|
||||||
"acl": ["insurance"]
|
"acl": ["insurance"]
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/:classificationId/index",
|
"url": "/:classificationId/index",
|
||||||
"state": "client.card.creditInsurance.insurance.index",
|
"state": "client.card.creditInsurance.insurance.index",
|
||||||
"component": "vn-client-credit-insurance-insurance-index",
|
"component": "vn-client-credit-insurance-insurance-index",
|
||||||
|
@ -277,7 +310,8 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/:classificationId/create",
|
"url": "/:classificationId/create",
|
||||||
"state": "client.card.creditInsurance.insurance.create",
|
"state": "client.card.creditInsurance.insurance.create",
|
||||||
"component": "vn-client-credit-insurance-insurance-create",
|
"component": "vn-client-credit-insurance-insurance-create",
|
||||||
|
@ -286,7 +320,8 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/contact",
|
"url": "/contact",
|
||||||
"state": "client.card.contact",
|
"state": "client.card.contact",
|
||||||
"component": "vn-client-contact",
|
"component": "vn-client-contact",
|
||||||
|
@ -294,12 +329,14 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/sample",
|
"url": "/sample",
|
||||||
"abstract": true,
|
"abstract": true,
|
||||||
"state": "client.card.sample",
|
"state": "client.card.sample",
|
||||||
"component": "ui-view"
|
"component": "ui-view"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/index",
|
"url": "/index",
|
||||||
"state": "client.card.sample.index",
|
"state": "client.card.sample.index",
|
||||||
"component": "vn-client-sample-index",
|
"component": "vn-client-sample-index",
|
||||||
|
@ -307,7 +344,8 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/create",
|
"url": "/create",
|
||||||
"state": "client.card.sample.create",
|
"state": "client.card.sample.create",
|
||||||
"component": "vn-client-sample-create",
|
"component": "vn-client-sample-create",
|
||||||
|
@ -315,12 +353,14 @@
|
||||||
"params": {
|
"params": {
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url": "/web-payment",
|
"url": "/web-payment",
|
||||||
"state": "client.card.webPayment",
|
"state": "client.card.webPayment",
|
||||||
"component": "vn-client-web-payment",
|
"component": "vn-client-web-payment",
|
||||||
"description": "Web Payment"
|
"description": "Web Payment"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
"url" : "/log",
|
"url" : "/log",
|
||||||
"state": "client.card.log",
|
"state": "client.card.log",
|
||||||
"component": "vn-client-log",
|
"component": "vn-client-log",
|
||||||
|
|
|
@ -32,9 +32,6 @@
|
||||||
"ItemPackingType": {
|
"ItemPackingType": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"ItemPlacement": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"ItemTag": {
|
"ItemTag": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
{
|
|
||||||
"name": "ItemPlacement",
|
|
||||||
"base": "VnModel",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "itemPlacement"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "number",
|
|
||||||
"id": true
|
|
||||||
},
|
|
||||||
"code": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"itemFk": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"warehouseFk": {
|
|
||||||
"type": "number"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"relations": {
|
|
||||||
"item": {
|
|
||||||
"type": "belongsTo",
|
|
||||||
"model": "Item",
|
|
||||||
"foreignKey": "itemFk"
|
|
||||||
},
|
|
||||||
"warehouse": {
|
|
||||||
"type": "belongsTo",
|
|
||||||
"model": "Warehouse",
|
|
||||||
"foreignKey": "warehouseFk"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -200,22 +200,7 @@ module.exports = Self => {
|
||||||
return {'t.routeFk': {neq: null}};
|
return {'t.routeFk': {neq: null}};
|
||||||
return {'t.routeFk': null};
|
return {'t.routeFk': null};
|
||||||
case 'pending':
|
case 'pending':
|
||||||
if (value) {
|
return {'st.isNotValidated': value};
|
||||||
return {and: [
|
|
||||||
{'st.alertLevel': 0},
|
|
||||||
{'st.code': {nin: [
|
|
||||||
'OK',
|
|
||||||
'BOARDING',
|
|
||||||
'PRINTED',
|
|
||||||
'PRINTED_AUTO',
|
|
||||||
'PICKER_DESIGNED'
|
|
||||||
]}}
|
|
||||||
]};
|
|
||||||
} else {
|
|
||||||
return {and: [
|
|
||||||
{'st.alertLevel': {gt: 0}}
|
|
||||||
]};
|
|
||||||
}
|
|
||||||
case 'id':
|
case 'id':
|
||||||
case 'clientFk':
|
case 'clientFk':
|
||||||
case 'agencyModeFk':
|
case 'agencyModeFk':
|
||||||
|
|
|
@ -153,7 +153,7 @@ describe('ticket filter()', () => {
|
||||||
const secondRow = result[1];
|
const secondRow = result[1];
|
||||||
const thirdRow = result[2];
|
const thirdRow = result[2];
|
||||||
|
|
||||||
expect(result.length).toEqual(12);
|
expect(result.length).toEqual(17);
|
||||||
expect(firstRow.state).toEqual('Entregado');
|
expect(firstRow.state).toEqual('Entregado');
|
||||||
expect(secondRow.state).toEqual('Entregado');
|
expect(secondRow.state).toEqual('Entregado');
|
||||||
expect(thirdRow.state).toEqual('Entregado');
|
expect(thirdRow.state).toEqual('Entregado');
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe('department removeChild()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should remove a child department', async() => {
|
it('should remove a child department', async() => {
|
||||||
const childId = 1;
|
const childId = 130;
|
||||||
|
|
||||||
removedChild = await app.models.Department.findById(childId);
|
removedChild = await app.models.Department.findById(childId);
|
||||||
const result = await app.models.Department.removeChild(childId);
|
const result = await app.models.Department.removeChild(childId);
|
||||||
|
|
|
@ -46,30 +46,11 @@ module.exports = Self => {
|
||||||
if (isSubordinate === false || (isSubordinate && isHimself && !isTeamBoss))
|
if (isSubordinate === false || (isSubordinate && isHimself && !isTeamBoss))
|
||||||
throw new UserError(`You don't have enough privileges`);
|
throw new UserError(`You don't have enough privileges`);
|
||||||
|
|
||||||
const minTime = new Date(args.timed);
|
query = `CALL vn.workerTimeControl_clockIn(?,?,?)`;
|
||||||
minTime.setHours(0, 0, 0, 0);
|
const [response] = await Self.rawSql(query, [workerId, args.timed, args.direction], myOptions);
|
||||||
|
if (response[0] && response[0].error)
|
||||||
|
throw new UserError(response[0].error);
|
||||||
|
|
||||||
query = `SELECT * FROM vn.workerLabour WHERE workerFk = ? AND (ended >= ? OR ended IS NULL);`;
|
return response;
|
||||||
const [workerLabour] = await Self.rawSql(query, [workerId, minTime]);
|
|
||||||
const absence = await models.Calendar.findOne({
|
|
||||||
where: {
|
|
||||||
businessFk: workerLabour.businessFk,
|
|
||||||
dated: minTime
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (absence) {
|
|
||||||
const absenceType = await models.AbsenceType.findById(absence.dayOffTypeFk, null, myOptions);
|
|
||||||
const isNotHalfAbsence = absenceType.code != 'halfHoliday'
|
|
||||||
&& absenceType.code != 'halfPaidLeave'
|
|
||||||
&& absenceType.code != 'halfFurlough';
|
|
||||||
if (isNotHalfAbsence)
|
|
||||||
throw new UserError(`The worker has a marked absence that day`);
|
|
||||||
}
|
|
||||||
return models.WorkerTimeControl.create({
|
|
||||||
userFk: workerId,
|
|
||||||
direction: args.direction,
|
|
||||||
timed: args.timed,
|
|
||||||
manual: true
|
|
||||||
}, myOptions);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const app = require('vn-loopback/server/server');
|
/* eslint max-len: ["error", { "code": 150 }]*/
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
const LoopBackContext = require('loopback-context');
|
const LoopBackContext = require('loopback-context');
|
||||||
const models = app.models;
|
|
||||||
|
|
||||||
describe('workerTimeControl add/delete timeEntry()', () => {
|
describe('workerTimeControl add/delete timeEntry()', () => {
|
||||||
const HHRRId = 37;
|
const HHRRId = 37;
|
||||||
|
@ -8,6 +8,14 @@ describe('workerTimeControl add/delete timeEntry()', () => {
|
||||||
const employeeId = 1;
|
const employeeId = 1;
|
||||||
const salesPersonId = 1106;
|
const salesPersonId = 1106;
|
||||||
const salesBossId = 19;
|
const salesBossId = 19;
|
||||||
|
const hankPymId = 1107;
|
||||||
|
const jessicaJonesId = 1110;
|
||||||
|
const monday = 1;
|
||||||
|
const tuesday = 2;
|
||||||
|
const thursday = 4;
|
||||||
|
const friday = 5;
|
||||||
|
const saturday = 6;
|
||||||
|
const sunday = 7;
|
||||||
const activeCtx = {
|
const activeCtx = {
|
||||||
accessToken: {userId: 50},
|
accessToken: {userId: 50},
|
||||||
};
|
};
|
||||||
|
@ -19,6 +27,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('as Role errors', () => {
|
||||||
it('should fail to add a time entry if the target user is not a subordinate', async() => {
|
it('should fail to add a time entry if the target user is not a subordinate', async() => {
|
||||||
activeCtx.accessToken.userId = employeeId;
|
activeCtx.accessToken.userId = employeeId;
|
||||||
const workerId = 2;
|
const workerId = 2;
|
||||||
|
@ -54,7 +63,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
|
||||||
expect(error.message).toBe(`You don't have enough privileges`);
|
expect(error.message).toBe(`You don't have enough privileges`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add if the current user is team boss and the target user is a himself', async() => {
|
it('should add if the current user is team boss and the target user is himself', async() => {
|
||||||
activeCtx.accessToken.userId = teamBossId;
|
activeCtx.accessToken.userId = teamBossId;
|
||||||
const workerId = teamBossId;
|
const workerId = teamBossId;
|
||||||
|
|
||||||
|
@ -62,11 +71,11 @@ describe('workerTimeControl add/delete timeEntry()', () => {
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const todayAtSix = new Date();
|
const todayAtOne = new Date();
|
||||||
todayAtSix.setHours(18, 30, 0, 0);
|
todayAtOne.setHours(1, 0, 0, 0);
|
||||||
|
|
||||||
ctx.args = {timed: todayAtSix, direction: 'in'};
|
ctx.args = {timed: todayAtOne, direction: 'in'};
|
||||||
const createdTimeEntry = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
const [createdTimeEntry] = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
expect(createdTimeEntry.id).toBeDefined();
|
expect(createdTimeEntry.id).toBeDefined();
|
||||||
|
|
||||||
|
@ -77,23 +86,6 @@ describe('workerTimeControl add/delete timeEntry()', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fail to add a time entry if the target user has absent that day', async() => {
|
|
||||||
activeCtx.accessToken.userId = salesBossId;
|
|
||||||
const workerId = salesPersonId;
|
|
||||||
let error;
|
|
||||||
|
|
||||||
const calendar = await app.models.Calendar.findById(3);
|
|
||||||
|
|
||||||
try {
|
|
||||||
ctx.args = {timed: new Date(calendar.dated), direction: 'in'};
|
|
||||||
await models.WorkerTimeControl.addTimeEntry(ctx, workerId);
|
|
||||||
} catch (e) {
|
|
||||||
error = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(error.message).toBe(`The worker has a marked absence that day`);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should try but fail to delete his own time entry', async() => {
|
it('should try but fail to delete his own time entry', async() => {
|
||||||
activeCtx.accessToken.userId = salesBossId;
|
activeCtx.accessToken.userId = salesBossId;
|
||||||
const workerId = salesBossId;
|
const workerId = salesBossId;
|
||||||
|
@ -103,11 +95,11 @@ describe('workerTimeControl add/delete timeEntry()', () => {
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const todayAtSeven = new Date();
|
const todayAtOne = new Date();
|
||||||
todayAtSeven.setHours(19, 30, 0, 0);
|
todayAtOne.setHours(1, 0, 0, 0);
|
||||||
|
|
||||||
ctx.args = {timed: todayAtSeven, direction: 'in'};
|
ctx.args = {timed: todayAtOne, direction: 'in'};
|
||||||
const createdTimeEntry = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
const [createdTimeEntry] = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
activeCtx.accessToken.userId = salesPersonId;
|
activeCtx.accessToken.userId = salesPersonId;
|
||||||
await models.WorkerTimeControl.deleteTimeEntry(ctx, createdTimeEntry.id, options);
|
await models.WorkerTimeControl.deleteTimeEntry(ctx, createdTimeEntry.id, options);
|
||||||
|
@ -131,11 +123,11 @@ describe('workerTimeControl add/delete timeEntry()', () => {
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const todayAtFive = new Date();
|
const todayAtOne = new Date();
|
||||||
todayAtFive.setHours(17, 30, 0, 0);
|
todayAtOne.setHours(1, 0, 0, 0);
|
||||||
|
|
||||||
ctx.args = {timed: todayAtFive, direction: 'in'};
|
ctx.args = {timed: todayAtOne, direction: 'in'};
|
||||||
const createdTimeEntry = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
const [createdTimeEntry] = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
expect(createdTimeEntry.id).toBeDefined();
|
expect(createdTimeEntry.id).toBeDefined();
|
||||||
|
|
||||||
|
@ -159,11 +151,11 @@ describe('workerTimeControl add/delete timeEntry()', () => {
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const todayAtFive = new Date();
|
const todayAtOne = new Date();
|
||||||
todayAtFive.setHours(17, 30, 0, 0);
|
todayAtOne.setHours(1, 0, 0, 0);
|
||||||
|
|
||||||
ctx.args = {timed: todayAtFive, direction: 'in'};
|
ctx.args = {timed: todayAtOne, direction: 'in'};
|
||||||
const createdTimeEntry = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
const [createdTimeEntry] = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
expect(createdTimeEntry.id).toBeDefined();
|
expect(createdTimeEntry.id).toBeDefined();
|
||||||
|
|
||||||
|
@ -187,11 +179,11 @@ describe('workerTimeControl add/delete timeEntry()', () => {
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const todayAtFive = new Date();
|
const todayAtOne = new Date();
|
||||||
todayAtFive.setHours(17, 30, 0, 0);
|
todayAtOne.setHours(1, 0, 0, 0);
|
||||||
|
|
||||||
ctx.args = {timed: todayAtFive, direction: 'in'};
|
ctx.args = {timed: todayAtOne, direction: 'in'};
|
||||||
const createdTimeEntry = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
const [createdTimeEntry] = await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
expect(createdTimeEntry.id).toBeDefined();
|
expect(createdTimeEntry.id).toBeDefined();
|
||||||
|
|
||||||
|
@ -206,3 +198,504 @@ describe('workerTimeControl add/delete timeEntry()', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('WorkerTimeControl_clockIn calls', () => {
|
||||||
|
it('should fail to add a time entry if the target user has an absence that day', async() => {
|
||||||
|
activeCtx.accessToken.userId = salesBossId;
|
||||||
|
const workerId = hankPymId;
|
||||||
|
const date = new Date();
|
||||||
|
date.setDate(date.getDate() - 16);
|
||||||
|
date.setHours(8, 0, 0);
|
||||||
|
let error;
|
||||||
|
|
||||||
|
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
try {
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toBe(`No está permitido trabajar`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should fail to add a time entry for a worker without an existing contract', async() => {
|
||||||
|
activeCtx.accessToken.userId = salesBossId;
|
||||||
|
const workerId = hankPymId;
|
||||||
|
const date = new Date();
|
||||||
|
date.setFullYear(date.getFullYear() - 2);
|
||||||
|
let error;
|
||||||
|
|
||||||
|
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toBe(`No hay un contrato en vigor`);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('direction errors', () => {
|
||||||
|
it('should throw an error when trying "in" direction twice', async() => {
|
||||||
|
activeCtx.accessToken.userId = salesBossId;
|
||||||
|
const workerId = hankPymId;
|
||||||
|
|
||||||
|
let date = new Date();
|
||||||
|
date.setDate(date.getDate() - 21);
|
||||||
|
date = weekDay(date, monday);
|
||||||
|
let error;
|
||||||
|
|
||||||
|
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
date.setHours(8, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
try {
|
||||||
|
date.setHours(10, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toBe(`Dirección incorrecta`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should throw an error when trying "in" direction after insert "in" and "middle"', async() => {
|
||||||
|
activeCtx.accessToken.userId = salesBossId;
|
||||||
|
const workerId = hankPymId;
|
||||||
|
|
||||||
|
let date = new Date();
|
||||||
|
date.setDate(date.getDate() - 21);
|
||||||
|
date = weekDay(date, monday);
|
||||||
|
let error;
|
||||||
|
|
||||||
|
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
date.setHours(8, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
date.setHours(9, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'middle'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
try {
|
||||||
|
date.setHours(10, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toBe(`Dirección incorrecta`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should throw an error when trying "out" before closing a "middle" couple', async() => {
|
||||||
|
activeCtx.accessToken.userId = salesBossId;
|
||||||
|
const workerId = hankPymId;
|
||||||
|
|
||||||
|
let date = new Date();
|
||||||
|
date.setDate(date.getDate() - 21);
|
||||||
|
date = weekDay(date, monday);
|
||||||
|
let error;
|
||||||
|
|
||||||
|
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
date.setHours(8, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
date.setHours(9, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'middle'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
try {
|
||||||
|
date.setHours(10, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'out'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toBe(`Dirección incorrecta`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should throw an error when trying "middle" after "out"', async() => {
|
||||||
|
activeCtx.accessToken.userId = salesBossId;
|
||||||
|
const workerId = hankPymId;
|
||||||
|
|
||||||
|
let date = new Date();
|
||||||
|
date.setDate(date.getDate() - 21);
|
||||||
|
date = weekDay(date, monday);
|
||||||
|
let error;
|
||||||
|
|
||||||
|
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
date.setHours(8, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
date.setHours(9, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'out'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
try {
|
||||||
|
date.setHours(10, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'middle'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toBe(`Dirección incorrecta`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should throw an error when trying "out" direction twice', async() => {
|
||||||
|
activeCtx.accessToken.userId = salesBossId;
|
||||||
|
const workerId = hankPymId;
|
||||||
|
|
||||||
|
let date = new Date();
|
||||||
|
date.setDate(date.getDate() - 21);
|
||||||
|
date = weekDay(date, monday);
|
||||||
|
let error;
|
||||||
|
|
||||||
|
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
date.setHours(8, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
date.setHours(9, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'out'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
try {
|
||||||
|
date.setHours(10, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'out'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toBe(`Dirección incorrecta`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('12h rest', () => {
|
||||||
|
it('should throw an error when the 12h rest is not fulfilled yet', async() => {
|
||||||
|
activeCtx.accessToken.userId = salesBossId;
|
||||||
|
const workerId = hankPymId;
|
||||||
|
|
||||||
|
let date = new Date();
|
||||||
|
date.setDate(date.getDate() - 21);
|
||||||
|
date = weekDay(date, monday);
|
||||||
|
let error;
|
||||||
|
|
||||||
|
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
date.setHours(8, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
date.setHours(16, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'out'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
try {
|
||||||
|
date = weekDay(date, tuesday);
|
||||||
|
date.setHours(4, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toBe(`Descanso diario 12h.`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not fail as the 12h rest is fulfilled', async() => {
|
||||||
|
activeCtx.accessToken.userId = salesBossId;
|
||||||
|
const workerId = hankPymId;
|
||||||
|
|
||||||
|
let date = new Date();
|
||||||
|
date.setDate(date.getDate() - 21);
|
||||||
|
date = weekDay(date, monday);
|
||||||
|
let error;
|
||||||
|
|
||||||
|
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
date.setHours(8, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
date.setHours(16, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'out'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
try {
|
||||||
|
date = weekDay(date, tuesday);
|
||||||
|
date.setHours(4, 1, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error).not.toBeDefined;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('for 3500kg drivers with enforced 9h rest', () => {
|
||||||
|
it('should throw an error when the 9h enforced rest is not fulfilled', async() => {
|
||||||
|
activeCtx.accessToken.userId = salesBossId;
|
||||||
|
const workerId = jessicaJonesId;
|
||||||
|
|
||||||
|
let date = new Date();
|
||||||
|
date.setDate(date.getDate() - 21);
|
||||||
|
date = weekDay(date, monday);
|
||||||
|
let error;
|
||||||
|
|
||||||
|
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
date.setHours(8, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
date.setHours(16, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'out'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
try {
|
||||||
|
date = weekDay(date, tuesday);
|
||||||
|
date.setHours(1, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toBe(`Descanso diario 9h.`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not fail when the 9h enforced rest is fulfilled', async() => {
|
||||||
|
activeCtx.accessToken.userId = salesBossId;
|
||||||
|
const workerId = jessicaJonesId;
|
||||||
|
|
||||||
|
let date = new Date();
|
||||||
|
date.setDate(date.getDate() - 21);
|
||||||
|
date = weekDay(date, monday);
|
||||||
|
let error;
|
||||||
|
|
||||||
|
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
date.setHours(8, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
date.setHours(16, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'out'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
try {
|
||||||
|
date = weekDay(date, tuesday);
|
||||||
|
date.setHours(1, 1, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error).not.toBeDefined;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('for 36h weekly rest', () => {
|
||||||
|
it('should throw an error when the 36h weekly rest is not fulfilled', async() => {
|
||||||
|
activeCtx.accessToken.userId = salesBossId;
|
||||||
|
const workerId = hankPymId;
|
||||||
|
|
||||||
|
let date = new Date();
|
||||||
|
date.setMonth(date.getMonth() - 2);
|
||||||
|
date.setDate(1);
|
||||||
|
let error;
|
||||||
|
|
||||||
|
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
await populateWeek(date, monday, sunday, ctx, workerId, options);
|
||||||
|
date = nextWeek(date);
|
||||||
|
await populateWeek(date, monday, thursday, ctx, workerId, options);
|
||||||
|
date = weekDay(date, friday);
|
||||||
|
date.setHours(6, 59, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
try {
|
||||||
|
date.setHours(7, 1, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'out'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toBe(`Descanso semanal 36h. / 72h.`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should throw an error when the 36h weekly rest is not fulfilled again', async() => {
|
||||||
|
activeCtx.accessToken.userId = salesBossId;
|
||||||
|
const workerId = hankPymId;
|
||||||
|
|
||||||
|
let date = new Date();
|
||||||
|
date.setMonth(date.getMonth() - 2);
|
||||||
|
date.setDate(1);
|
||||||
|
let error;
|
||||||
|
|
||||||
|
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
await populateWeek(date, monday, sunday, ctx, workerId, options);
|
||||||
|
date = nextWeek(date);
|
||||||
|
await populateWeek(date, monday, thursday, ctx, workerId, options);
|
||||||
|
|
||||||
|
try {
|
||||||
|
date = weekDay(date, saturday);
|
||||||
|
date.setHours(3, 59, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toBe(`Descanso semanal 36h. / 72h.`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('for 72h weekly rest', () => {
|
||||||
|
it('should throw when the 72h weekly rest is not fulfilled yet', async() => {
|
||||||
|
activeCtx.accessToken.userId = salesBossId;
|
||||||
|
const workerId = hankPymId;
|
||||||
|
|
||||||
|
let date = new Date();
|
||||||
|
date.setMonth(date.getMonth() - 2);
|
||||||
|
date.setDate(1);
|
||||||
|
let error;
|
||||||
|
|
||||||
|
const tx = await models.WorkerTimeControl.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
await populateWeek(date, monday, sunday, ctx, workerId, options);
|
||||||
|
date = nextWeek(date);
|
||||||
|
await populateWeek(date, monday, thursday, ctx, workerId, options);
|
||||||
|
date = nextWeek(date);
|
||||||
|
await populateWeek(date, monday, friday, ctx, workerId, options);
|
||||||
|
date = nextWeek(date);
|
||||||
|
await populateWeek(date, monday, saturday, ctx, workerId, options);
|
||||||
|
date = nextWeek(date);
|
||||||
|
await populateWeek(date, monday, saturday, ctx, workerId, options);
|
||||||
|
date = lastWeek(date);
|
||||||
|
|
||||||
|
try {
|
||||||
|
date = weekDay(date, sunday);
|
||||||
|
date.setHours(8, 0, 0);
|
||||||
|
ctx.args = {timed: date, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toBe(`Descanso semanal 36h. / 72h.`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function weekDay(date, dayToSet) {
|
||||||
|
const currentDay = date.getDay();
|
||||||
|
const distance = dayToSet - currentDay;
|
||||||
|
|
||||||
|
date.setDate(date.getDate() + distance);
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
function nextWeek(date) {
|
||||||
|
const sunday = 7;
|
||||||
|
const currentDay = date.getDay();
|
||||||
|
let newDate = date;
|
||||||
|
if (currentDay != 0)
|
||||||
|
newDate = weekDay(date, sunday);
|
||||||
|
|
||||||
|
newDate.setDate(newDate.getDate() + 1);
|
||||||
|
return newDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
function lastWeek(date) {
|
||||||
|
const monday = 1;
|
||||||
|
newDate = weekDay(date, monday);
|
||||||
|
|
||||||
|
newDate.setDate(newDate.getDate() - 1);
|
||||||
|
return newDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function populateWeek(date, dayStart, dayEnd, ctx, workerId, options) {
|
||||||
|
const dateStart = new Date(weekDay(date, dayStart));
|
||||||
|
const dateEnd = new Date(dateStart);
|
||||||
|
dateEnd.setDate(dateStart.getDate() + dayEnd);
|
||||||
|
|
||||||
|
for (let i = dayStart; i <= dayEnd; i++) {
|
||||||
|
dateStart.setHours(8, 0, 0);
|
||||||
|
ctx.args = {timed: dateStart, direction: 'in'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
dateStart.setHours(16, 0, 0);
|
||||||
|
ctx.args = {timed: dateStart, direction: 'out'};
|
||||||
|
await models.WorkerTimeControl.addTimeEntry(ctx, workerId, options);
|
||||||
|
dateStart.setDate(dateStart.getDate() + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -149,8 +149,9 @@ module.exports = {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
};
|
||||||
|
|
||||||
async invalidEmail(ticket) {
|
async function invalidEmail(ticket) {
|
||||||
await db.rawSql(`UPDATE client SET email = NULL WHERE id = ?`, [
|
await db.rawSql(`UPDATE client SET email = NULL WHERE id = ?`, [
|
||||||
ticket.clientFk
|
ticket.clientFk
|
||||||
]);
|
]);
|
||||||
|
@ -178,4 +179,3 @@ module.exports = {
|
||||||
html: body
|
html: body
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
Loading…
Reference in New Issue