diff --git a/back/methods/dms/uploadFile.js b/back/methods/dms/uploadFile.js
index 41d551f2b..e077eea30 100644
--- a/back/methods/dms/uploadFile.js
+++ b/back/methods/dms/uploadFile.js
@@ -9,25 +9,31 @@ module.exports = Self => {
{
arg: 'warehouseId',
type: 'Number',
- description: 'The warehouse id'
+ description: 'The warehouse id',
+ required: true
}, {
arg: 'companyId',
type: 'Number',
- description: 'The company id'
+ description: 'The company id',
+ required: true
}, {
arg: 'dmsTypeId',
type: 'Number',
- description: 'The dms type id'
+ description: 'The dms type id',
+ required: true
}, {
arg: 'reference',
- type: 'String'
+ type: 'String',
+ required: true
}, {
arg: 'description',
- type: 'String'
+ type: 'String',
+ required: true
}, {
arg: 'hasFile',
type: 'Boolean',
- description: 'True if has an attached file'
+ description: 'True if has an attached file',
+ required: true
}],
returns: {
type: 'Object',
diff --git a/back/model-config.json b/back/model-config.json
index b24226507..89f517812 100644
--- a/back/model-config.json
+++ b/back/model-config.json
@@ -52,6 +52,15 @@
},
"Postcode": {
"dataSource": "vn"
+ },
+ "UserPhoneType": {
+ "dataSource": "vn"
+ },
+ "UserPhone": {
+ "dataSource": "vn"
+ },
+ "UserLog": {
+ "dataSource": "vn"
}
}
diff --git a/modules/worker/back/models/user-log.json b/back/models/user-log.json
similarity index 100%
rename from modules/worker/back/models/user-log.json
rename to back/models/user-log.json
diff --git a/modules/worker/back/models/user-phone-type.json b/back/models/user-phone-type.json
similarity index 100%
rename from modules/worker/back/models/user-phone-type.json
rename to back/models/user-phone-type.json
diff --git a/back/models/user-phone.js b/back/models/user-phone.js
new file mode 100644
index 000000000..6f6c20049
--- /dev/null
+++ b/back/models/user-phone.js
@@ -0,0 +1,9 @@
+let UserError = require('vn-loopback/util/user-error');
+
+module.exports = Self => {
+ Self.rewriteDbError(function(err) {
+ if (err.code === 'ER_DUP_ENTRY')
+ return new UserError(`This phone already exists`);
+ return err;
+ });
+};
diff --git a/modules/worker/back/models/user-phone.json b/back/models/user-phone.json
similarity index 75%
rename from modules/worker/back/models/user-phone.json
rename to back/models/user-phone.json
index c869a808d..f264ff28f 100644
--- a/modules/worker/back/models/user-phone.json
+++ b/back/models/user-phone.json
@@ -2,7 +2,8 @@
"name": "UserPhone",
"base": "Loggable",
"log": {
- "model":"UserLog"
+ "model":"UserLog",
+ "relation": "user"
},
"options": {
"mysql": {
@@ -12,11 +13,15 @@
"properties": {
"id": {
"id": true,
- "type": "String"
+ "type": "Number"
},
"phone": {
"type": "Number",
"required": true
+ },
+ "typeFk": {
+ "type": "String",
+ "required": true
}
},
"relations": {
diff --git a/db/changes/10100-AllSaints/00-userLog.sql b/db/changes/10100-AllSaints/00-userLog.sql
index 2e541eaf4..f6972796d 100644
--- a/db/changes/10100-AllSaints/00-userLog.sql
+++ b/db/changes/10100-AllSaints/00-userLog.sql
@@ -1,6 +1,6 @@
CREATE TABLE `vn`.`userLog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `originFk` int(11) NOT NULL,
+ `originFk` int(10) unsigned NOT NULL,
`userFk` int(10) unsigned DEFAULT NULL,
`action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL,
`creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
@@ -13,6 +13,6 @@ CREATE TABLE `vn`.`userLog` (
PRIMARY KEY (`id`),
KEY `originFk` (`originFk`),
KEY `userFk` (`userFk`),
- CONSTRAINT `userLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `userLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `userLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
\ No newline at end of file
diff --git a/db/changes/10100-AllSaints/01-userPhone.sql b/db/changes/10100-AllSaints/01-userPhone.sql
index 488bbb112..e82b48000 100644
--- a/db/changes/10100-AllSaints/01-userPhone.sql
+++ b/db/changes/10100-AllSaints/01-userPhone.sql
@@ -2,7 +2,7 @@ CREATE TABLE `vn`.`userPhone` (
`id` INT NOT NULL AUTO_INCREMENT,
`userFk` INT(10) UNSIGNED NOT NULL,
`typeFk` VARCHAR(45) NOT NULL,
- `phone` INT(15) NOT NULL,
+ `phone` VARCHAR(15) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `UserFK_Phone` (`userFk` ASC, `phone` ASC));
@@ -22,7 +22,7 @@ ADD CONSTRAINT `fgnUserFk`
ON UPDATE CASCADE;
insert into vn.userPhone(userFk,typeFk,phone)
- select id,'PersonalPhone', phone
+ select id,'personalPhone', phone
from vn.client
where phone is not null;
diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql
index 2624f1768..2d3353f15 100644
--- a/db/dump/fixtures.sql
+++ b/db/dump/fixtures.sql
@@ -351,16 +351,6 @@ INSERT INTO `vn`.`creditInsurance`(`id`, `creditClassification`, `credit`, `crea
(2, 2, 6000, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), NULL),
(3, 3, 10000, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), NULL);
-INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`)
- VALUES
- (1, '1899-12-30 12:15:00', 56, CURDATE(), 1, 7, 'first route', 2.7, 10, CURDATE(), CURDATE()),
- (2, '1899-12-30 13:20:00', 56, CURDATE(), 1, 7, 'second route', 0.9, 20, CURDATE(), CURDATE()),
- (3, '1899-12-30 14:30:00', 56, CURDATE(), 2, 7, 'third route', 1.1, 30, CURDATE(), CURDATE()),
- (4, '1899-12-30 15:45:00', 56, CURDATE(), 3, 7, 'fourth route', 0.1, 40, CURDATE(), CURDATE()),
- (5, '1899-12-30 16:00:00', 56, CURDATE(), 4, 8, 'fifth route', NULL, 50, CURDATE(), CURDATE()),
- (6, NULL, 57, CURDATE(), 5, 8, 'sixth route', NULL, 60, CURDATE(), CURDATE()),
- (7, NULL, 57, CURDATE(), 6, NULL, 'seventh route', NULL, 70, CURDATE(), CURDATE());
-
INSERT INTO `vn2008`.`empresa_grupo`(`empresa_grupo_id`, `grupo`)
VALUES
(1, 'Wayne Industries');
@@ -456,32 +446,42 @@ INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `warehouseFk`, `agencyModeFk`, `t
(12, 'Zone entanglement', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 4, 4, 0, 0, 0),
(13, 'Zone quantum break', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 5, 5, 0, 0, 0);
+INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`, `zoneFk`)
+ VALUES
+ (1, '1899-12-30 12:15:00', 56, CURDATE(), 1, 1, 'first route', 1.8, 10, CURDATE(), CURDATE(), 1),
+ (2, '1899-12-30 13:20:00', 56, CURDATE(), 1, 2, 'second route', 0.2, 20, CURDATE(), CURDATE(), 9),
+ (3, '1899-12-30 14:30:00', 56, CURDATE(), 2, 3, 'third route', 0.5, 30, CURDATE(), CURDATE(), 10),
+ (4, '1899-12-30 15:45:00', 56, CURDATE(), 3, 4, 'fourth route', 0, 40, CURDATE(), CURDATE(), 12),
+ (5, '1899-12-30 16:00:00', 56, CURDATE(), 4, 5, 'fifth route', 0.1, 50, CURDATE(), CURDATE(), 13),
+ (6, NULL, 57, CURDATE(), 5, 7, 'sixth route', 1.7, 60, CURDATE(), CURDATE(), 3),
+ (7, NULL, 57, CURDATE(), 6, 8, 'seventh route', 0, 70, CURDATE(), CURDATE(), 5);
+
INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `created`)
VALUES
- (1 , 3, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 'Bat cave', 121, 'T1111111', 0, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
- (2 , 1, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T1111111', 0, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
- (3 , 1, 7, 1, 1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T2222222', 0, 3, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
- (4 , 3, 2, 1, 1, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T3333333', 0, 9, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
- (5 , 3, 3, 3, 1, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T4444444', 0, 10, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)),
- (6 , 1, 3, 3, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 'Mountain Drive Gotham', 1, 'A1111111', 0, 10, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
- (7 , NULL, 7, 1, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'Mountain Drive Gotham', 1, NULL, 0, 3, CURDATE()),
- (8 , NULL, 7, 1, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'Bat cave', 121, NULL, 0, 3, CURDATE()),
- (9 , NULL, 7, 1, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 'Stark tower', 124, NULL, 0, 3, CURDATE()),
- (10, 1, 1, 5, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 'Ingram Street', 2, NULL, 0, 11, CURDATE()),
- (11, 1, 7, 1, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 'NY roofs', 122, NULL, 0, 3, CURDATE()),
- (12, 1, 1, 1, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 1, CURDATE()),
- (13, 1, 7, 1, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 1, CURDATE()),
- (14, 1, 2, 1, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 'Malibu Point', 4, NULL, 0, 9, CURDATE()),
- (15, 1, 7, 1, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 'Plastic Cell', 125, NULL, 0, 3, CURDATE()),
- (16, 1, 7, 1, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()),
- (17, 1, 7, 2, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()),
- (18, 1, 4, 4, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 'Cerebro', 128, NULL, 0, 12, CURDATE()),
- (19, 1, 5, 5, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 'Somewhere in Thailand', 129, NULL, 1, 13, CURDATE()),
- (20, 1, 5, 5, 3, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Thailand', 129, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
- (21, NULL, 5, 5, NULL, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Holland', 102, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
- (22, NULL, 5, 5, NULL, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Japan', 103, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
- (23, NULL, 10, 1, NULL, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'address 21', 121, NULL, 0, 8, CURDATE()),
- (24 ,NULL, 10, 1, NULL, CURDATE(), CURDATE(), 101, 'Bruce Wayne', 1, NULL, 0, 8, CURDATE());
+ (1 , 3, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 'Bat cave', 121, 'T1111111', 0, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
+ (2 , 1, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T1111111', 0, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
+ (3 , 1, 7, 1, 6, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T2222222', 0, 3, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
+ (4 , 3, 2, 1, 2, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T3333333', 0, 9, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
+ (5 , 3, 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T4444444', 0, 10, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)),
+ (6 , 1, 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 'Mountain Drive Gotham', 1, 'A1111111', 0, 10, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
+ (7 , NULL, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'Mountain Drive Gotham', 1, NULL, 0, 3, CURDATE()),
+ (8 , NULL, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'Bat cave', 121, NULL, 0, 3, CURDATE()),
+ (9 , NULL, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 'Stark tower', 124, NULL, 0, 3, CURDATE()),
+ (10, 1, 1, 5, 1, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 'Ingram Street', 2, NULL, 0, 1, CURDATE()),
+ (11, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 'NY roofs', 122, NULL, 0, 3, CURDATE()),
+ (12, 1, 1, 1, 1, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 1, CURDATE()),
+ (13, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 3, CURDATE()),
+ (14, 1, 2, 1, NULL, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 'Malibu Point', 4, NULL, 0, 9, CURDATE()),
+ (15, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 'Plastic Cell', 125, NULL, 0, 3, CURDATE()),
+ (16, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()),
+ (17, 1, 7, 2, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()),
+ (18, 1, 4, 4, 4, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 'Cerebro', 128, NULL, 0, 12, CURDATE()),
+ (19, 1, 5, 5, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 'Somewhere in Thailand', 129, NULL, 1, 13, CURDATE()),
+ (20, 1, 5, 5, 3, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Thailand', 129, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
+ (21, NULL, 5, 5, 5, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Holland', 102, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
+ (22, NULL, 5, 5, 5, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Japan', 103, NULL, 0, 13, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
+ (23, NULL, 8, 1, 7, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'address 21', 121, NULL, 0, 5, CURDATE()),
+ (24 ,NULL, 8, 1, 7, CURDATE(), CURDATE(), 101, 'Bruce Wayne', 1, NULL, 0, 5, CURDATE());
INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
VALUES
@@ -1862,4 +1862,67 @@ INSERT INTO `vn`.`queuePriority`(`id`, `priority`)
VALUES
(1, 'Alta'),
(2, 'Normal'),
- (3, 'Baja');
\ No newline at end of file
+ (3, 'Baja');
+
+INSERT INTO `vn`.`userPhone`(`id`, `userFk`, `typeFk`, `phone`)
+ VALUES
+ (1, 101, 'personalPhone', 1111111111),
+ (2, 102, 'personalPhone', 1111111111),
+ (3, 103, 'personalPhone', 1111111111),
+ (4, 104, 'personalPhone', 1111111111),
+ (5, 105, 'personalPhone', 1111111111),
+ (6, 106, 'personalPhone', 1111111111),
+ (7, 107, 'personalPhone', 1111111111),
+ (8, 108, 'personalPhone', 1111111111),
+ (9, 109, 'personalPhone', 1111111111),
+ (10, 110, 'personalPhone', 1111111111),
+ (11, 111, 'personalPhone', 1111111111),
+ (12, 112, 'personalPhone', 1111111111),
+ (13, 1, 'personalPhone', 623111111),
+ (14, 2, 'personalPhone', 623111111),
+ (15, 3, 'personalPhone', 623111111),
+ (16, 5, 'personalPhone', 623111111),
+ (17, 6, 'personalPhone', 623111111),
+ (18, 9, 'personalPhone', 623111111),
+ (19, 13, 'personalPhone', 623111111),
+ (20, 15, 'personalPhone', 623111111),
+ (21, 16, 'personalPhone', 623111111),
+ (22, 17, 'personalPhone', 623111111),
+ (23, 18, 'personalPhone', 623111111),
+ (24, 19, 'personalPhone', 623111111),
+ (25, 20, 'personalPhone', 623111111),
+ (26, 21, 'personalPhone', 623111111),
+ (27, 22, 'personalPhone', 623111111),
+ (28, 30, 'personalPhone', 623111111),
+ (29, 31, 'personalPhone', 623111111),
+ (30, 32, 'personalPhone', 623111111),
+ (31, 34, 'personalPhone', 623111111),
+ (32, 35, 'personalPhone', 623111111),
+ (33, 36, 'personalPhone', 623111111),
+ (34, 37, 'personalPhone', 623111111),
+ (35, 38, 'personalPhone', 623111111),
+ (36, 39, 'personalPhone', 623111111),
+ (37, 40, 'personalPhone', 623111111),
+ (38, 41, 'personalPhone', 623111111),
+ (39, 42, 'personalPhone', 623111111),
+ (40, 43, 'personalPhone', 623111111),
+ (41, 44, 'personalPhone', 623111111),
+ (42, 45, 'personalPhone', 623111111),
+ (43, 47, 'personalPhone', 623111111),
+ (44, 48, 'personalPhone', 623111111),
+ (45, 50, 'personalPhone', 623111111),
+ (46, 51, 'personalPhone', 623111111),
+ (47, 52, 'personalPhone', 623111111),
+ (48, 54, 'personalPhone', 623111111),
+ (49, 55, 'personalPhone', 623111111),
+ (50, 56, 'personalPhone', 623111111),
+ (51, 57, 'personalPhone', 623111111),
+ (52, 58, 'personalPhone', 623111111),
+ (53, 59, 'personalPhone', 623111111),
+ (54, 60, 'personalPhone', 623111111),
+ (55, 61, 'personalPhone', 623111111),
+ (56, 65, 'personalPhone', 623111111),
+ (57, 66, 'personalPhone', 623111111),
+ (65, 107, 'businessPhone', 700987987),
+ (67, 106, 'businessPhone', 1111111112),
+ (68, 106, 'personalPhone', 1111111113);
diff --git a/e2e/helpers/components_selectors.js b/e2e/helpers/components_selectors.js
deleted file mode 100644
index 3e2715ba2..000000000
--- a/e2e/helpers/components_selectors.js
+++ /dev/null
@@ -1,6 +0,0 @@
-export default {
- vnTextfield: 'vn-textfield input',
- vnInputNumber: 'vn-input-number input',
- vnSubmit: 'vn-submit > input',
- vnFloatButton: 'vn-float-button > button'
-};
diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js
index fb36e3279..4148a4a05 100644
--- a/e2e/helpers/extensions.js
+++ b/e2e/helpers/extensions.js
@@ -6,6 +6,121 @@ import config from './config.js';
let currentUser;
+let asyncActions = {
+ // Generic extensions
+
+ clickIfExists: async function(selector) {
+ let exists = await this.exists(selector);
+ if (exists) await this.click(selector);
+ return exists;
+ },
+
+ hasClass: async function(selector, className) {
+ return await this.evaluate((selector, className) => {
+ document.querySelector(selector).classList.contains(className);
+ }, selector, className);
+ },
+
+ parsedUrl: async function() {
+ return new URL(await this.url());
+ },
+
+ // Salix specific extensions
+
+ changeLanguageToEnglish: async function() {
+ let langSelector = '.user-popover vn-autocomplete[ng-model="$ctrl.lang"]';
+
+ let lang = await this.waitToClick('#user')
+ .wait(langSelector)
+ .waitToGetProperty(`${langSelector} input`, 'value');
+
+ if (lang !== 'English')
+ await this.autocompleteSearch(langSelector, 'English');
+ },
+
+ doLogin: async function(userName, password) {
+ if (password == null) password = 'nightmare';
+ await this.wait(`vn-login [name=user]`)
+ .clearInput(`vn-login [name=user]`)
+ .write(`vn-login [name=user]`, userName)
+ .write(`vn-login [name=password]`, password)
+ .click(`vn-login button[type=submit]`);
+ },
+
+ login: async function(userName) {
+ if (currentUser !== userName) {
+ let logoutClicked = await this.clickIfExists('#logout');
+
+ if (logoutClicked) {
+ let buttonSelector = '.vn-dialog.shown button[response=ACCEPT]';
+ this.wait(buttonSelector => {
+ return document.querySelector(buttonSelector) != null
+ || location.hash == '#!/login';
+ }, buttonSelector);
+ await this.clickIfExists(buttonSelector);
+ }
+
+ try {
+ await this.waitForURL('#!/login');
+ } catch (e) {
+ this.goto(`${config.url}/#!/login`);
+ }
+
+ await this.doLogin(userName, null)
+ .waitForURL('#!/')
+ .changeLanguageToEnglish();
+
+ currentUser = userName;
+ } else
+ await this.waitToClick('vn-topbar a[ui-sref="home"]');
+ },
+
+ waitForLogin: async function(userName) {
+ await this.login(userName);
+ },
+
+ selectModule: async function(moduleName) {
+ let snakeName = moduleName.replace(/[\w]([A-Z])/g, m => {
+ return m[0] + '-' + m[1];
+ }).toLowerCase();
+
+ await this.waitToClick(`vn-home a[ui-sref="${moduleName}.index"]`)
+ .waitForURL(snakeName);
+ },
+
+ loginAndModule: async function(userName, moduleName) {
+ await this.login(userName)
+ .selectModule(moduleName);
+ },
+
+ datePicker: async function(selector, changeMonth, day) {
+ let date = new Date();
+ if (changeMonth) date.setMonth(date.getMonth() + changeMonth);
+ date.setDate(day ? day : 16);
+ date = date.toISOString().substr(0, 10);
+
+ await this.wait(selector)
+ .evaluate((selector, date) => {
+ let input = document.querySelector(selector).$ctrl.input;
+ input.value = date;
+ input.dispatchEvent(new Event('change'));
+ }, selector, date);
+ },
+
+ pickTime: async function(selector, time) {
+ await this.wait(selector)
+ .evaluate((selector, time) => {
+ let input = document.querySelector(selector).$ctrl.input;
+ input.value = time;
+ input.dispatchEvent(new Event('change'));
+ }, selector, time);
+ },
+
+ isDisabled: async function(selector) {
+ return await this.hasClass(selector, 'disabled');
+ }
+};
+
let actions = {
clearTextarea: function(selector, done) {
this.wait(selector)
@@ -28,98 +143,6 @@ let actions = {
.catch(done);
},
- login: function(userName, done) {
- if (currentUser)
- this.waitToClick('#logout');
-
- let doLogin = () => {
- this.wait(`vn-login input[name=user]`)
- .clearInput(`vn-login input[name=user]`)
- .write(`vn-login input[name=user]`, userName)
- .write(`vn-login input[name=password]`, 'nightmare')
- .click(`vn-login input[type=submit]`)
- .then(() => {
- currentUser = userName;
- done();
- })
- .catch(done);
- };
-
- this.waitForURL('#!/login')
- .then(doLogin)
- .catch(() => {
- this.goto(`${config.url}/#!/login`)
- .then(doLogin)
- .catch(done);
- });
- },
-
- waitForLogin: function(userName, done) {
- if (currentUser === userName) {
- return this.waitToClick('vn-topbar a[ui-sref="home"]')
- .waitForURL('#!/')
- .changeLanguageToEnglish()
- .then(done)
- .catch(done);
- }
- return this.login(userName)
- .waitForURL('#!/')
- .url()
- .changeLanguageToEnglish()
- .then(done)
- .catch(done);
- },
-
- resetLogin: function(done) {
- this.then(() => {
- currentUser = undefined;
- done();
- })
- .catch(done);
- },
-
- changeLanguageToEnglish: function(done) {
- let langSelector = '.user-popover vn-autocomplete[ng-model="$ctrl.lang"]';
-
- this.waitToClick('#user')
- .wait(langSelector)
- .waitToGetProperty(`${langSelector} input`, 'value')
- .then(lang => {
- if (lang === 'English') {
- this.then(done)
- .catch(done);
- } else {
- this.autocompleteSearch(langSelector, 'English')
- .then(done)
- .catch(done);
- }
- });
- },
-
- selectModule: function(moduleName, done) {
- let snakeName = moduleName.replace(/[\w]([A-Z])/g, m => {
- return m[0] + '-' + m[1];
- }).toLowerCase();
- this.waitToClick(`vn-home a[ui-sref="${moduleName}.index"]`)
- .waitForURL(snakeName)
- .then(done)
- .catch(done);
- },
-
- loginAndModule: function(userName, moduleName, done) {
- this.waitForLogin(userName)
- .selectModule(moduleName)
- .then(done)
- .catch(done);
- },
-
- parsedUrl: function(done) {
- this.url()
- .then(url => {
- done(null, new URL(url));
- }).catch(done);
- },
-
getProperty: function(selector, property, done) {
this.evaluate_now((selector, property) => {
return document.querySelector(selector)[property].replace(/\s+/g, ' ').trim();
@@ -419,51 +442,6 @@ let actions = {
});
},
- pickTime: function(selector, time, done) {
- this.wait(selector)
- .evaluate((selector, time) => {
- let input = document.querySelector(selector);
- input.value = time;
- input.dispatchEvent(new Event('change'));
- }, selector, time)
- .then(done)
- .catch(done);
- },
-
- datePicker: function(selector, changeMonth, day, done) {
- this.wait(selector)
- .mousedown(`${selector} input`)
- .wait('.flatpickr-calendar.open');
-
- if (changeMonth > 0)
- this.mousedown(`.flatpickr-calendar.open .flatpickr-next-month`);
- if (changeMonth < 0)
- this.mousedown(`.flatpickr-calendar.open .flatpickr-prev-month`);
-
- let daySelector;
-
- if (!day)
- daySelector = `.flatpickr-calendar.open .flatpickr-day:nth-child(16)`;
- if (day)
- daySelector = `.flatpickr-calendar.open .flatpickr-day[aria-label~="${day},"]:not(.prevMonthDay):not(.nextMonthDay)`;
-
- this.wait(selector => {
- return document.querySelector(selector);
- }, daySelector)
- .evaluate(selector => {
- let event = new MouseEvent('mousedown', {
- bubbles: true,
- cancelable: true,
- view: window
- });
- document.querySelector(selector).dispatchEvent(event);
- }, daySelector)
- .then(done)
- .catch(() => {
- done(new Error(`.datePicker(), for ${daySelector} timed out`));
- });
- },
-
reloadSection: function(sectionRoute, done) {
this.waitToClick('vn-icon[icon="desktop_windows"]')
.wait('vn-card.summary')
@@ -516,6 +494,16 @@ let actions = {
},
};
+for (let name in asyncActions) {
+ let fn = asyncActions[name];
+
+ Nightmare.action(name, function(...args) {
+ let done = args[args.length - 1];
+ fn.apply(this, args)
+ .then(res => done(null, res), done);
+ });
+}
+
Object.keys(actions).forEach(function(name) {
let fn = actions[name];
Nightmare.action(name, fn);
diff --git a/e2e/helpers/nightmare.js b/e2e/helpers/nightmare.js
index 75794c28d..6706b6dc4 100644
--- a/e2e/helpers/nightmare.js
+++ b/e2e/helpers/nightmare.js
@@ -1,4 +1,6 @@
const Nightmare = require('nightmare');
+const config = require('./config.js');
+
let nightmare;
module.exports = function createNightmare(width = 1280, height = 720) {
@@ -25,5 +27,5 @@ module.exports = function createNightmare(width = 1280, height = 720) {
});
nightmare.header('Accept-Language', 'en');
- return nightmare;
+ return nightmare.goto(config.url);
};
diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js
index 5d8fd487c..a9a66c616 100644
--- a/e2e/helpers/selectors.js
+++ b/e2e/helpers/selectors.js
@@ -1,4 +1,3 @@
-import components from './components_selectors.js';
export default {
globalItems: {
@@ -22,29 +21,29 @@ export default {
acceptButton: 'vn-confirm button[response=ACCEPT]'
},
clientsIndex: {
- searchClientInput: `${components.vnTextfield}`,
+ searchClientInput: `vn-textfield input`,
searchButton: 'vn-searchbar vn-icon[icon="search"]',
searchResult: 'vn-client-index .vn-list-item',
- createClientButton: `${components.vnFloatButton}`,
+ createClientButton: `vn-float-button`,
othersButton: 'vn-left-menu li[name="Others"] > a'
},
createClientView: {
- name: `${components.vnTextfield}[name="name"]`,
- taxNumber: `${components.vnTextfield}[name="fi"]`,
- socialName: `${components.vnTextfield}[name="socialName"]`,
- street: `${components.vnTextfield}[name="street"]`,
- postcode: `${components.vnTextfield}[name="postcode"]`,
- city: `${components.vnTextfield}[name="city"]`,
+ name: `vn-textfield input[name="name"]`,
+ taxNumber: `vn-textfield input[name="fi"]`,
+ socialName: `vn-textfield input[name="socialName"]`,
+ street: `vn-textfield input[name="street"]`,
+ postcode: `vn-textfield input[name="postcode"]`,
+ city: `vn-textfield input[name="city"]`,
province: `vn-autocomplete[ng-model="$ctrl.client.provinceFk"]`,
country: `vn-autocomplete[ng-model="$ctrl.client.countryFk"]`,
- userName: `${components.vnTextfield}[name="userName"]`,
- email: `${components.vnTextfield}[name="email"]`,
+ userName: `vn-textfield input[name="userName"]`,
+ email: `vn-textfield input[name="email"]`,
salesPersonAutocomplete: `vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]`,
- createButton: `${components.vnSubmit}`,
+ createButton: `button[type=submit]`,
cancelButton: 'vn-button[href="#!/client/index"]'
},
clientDescriptor: {
- moreMenu: 'vn-client-descriptor vn-icon-menu > div > vn-icon',
+ moreMenu: 'vn-client-descriptor vn-icon-menu[icon=more_vert]',
simpleTicketButton: '.vn-popover.shown .vn-drop-down li'
},
clientBasicData: {
@@ -56,17 +55,17 @@ export default {
emailInput: 'vn-textfield[ng-model="$ctrl.client.email"] input',
salesPersonAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.salesPersonFk"]',
channelAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.contactChannelFk"]',
- saveButton: `${components.vnSubmit}`
+ saveButton: `button[type=submit]`
},
clientFiscalData: {
fiscalDataButton: 'vn-left-menu a[ui-sref="client.card.fiscalData"]',
- socialNameInput: `${components.vnTextfield}[name="socialName"]`,
- fiscalIdInput: `${components.vnTextfield}[name="fi"]`,
- equalizationTaxCheckbox: 'vn-check[label="Is equalizated"]',
+ socialNameInput: `vn-textfield input[name="socialName"]`,
+ fiscalIdInput: `vn-textfield input[name="fi"]`,
+ equalizationTaxCheckbox: 'vn-check[ng-model="$ctrl.client.isEqualizated"]',
acceptPropagationButton: 'vn-client-fiscal-data > vn-confirm button[response=ACCEPT]',
- addressInput: `${components.vnTextfield}[name="street"]`,
- postcodeInput: `${components.vnTextfield}[name="postcode"]`,
- cityInput: `${components.vnTextfield}[name="city"]`,
+ addressInput: `vn-textfield input[name="street"]`,
+ postcodeInput: `vn-textfield input[name="postcode"]`,
+ cityInput: `vn-textfield input[name="city"]`,
provinceAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.provinceFk"]',
countryAutocomplete: 'vn-autocomplete[ng-model="$ctrl.client.countryFk"]',
activeCheckbox: 'vn-check[label="Active"]',
@@ -76,12 +75,12 @@ export default {
hasToInvoiceCheckbox: 'vn-check[label="Has to invoice"]',
invoiceByMailCheckbox: 'vn-check[label="Invoice by mail"]',
viesCheckbox: 'vn-check[label="Vies"]',
- saveButton: `${components.vnSubmit}`
+ saveButton: `button[type=submit]`
},
clientBillingData: {
payMethodAutocomplete: 'vn-client-billing-data vn-autocomplete[ng-model="$ctrl.client.payMethodFk"]',
- IBANInput: `vn-client-billing-data ${components.vnTextfield}[name="iban"]`,
- dueDayInput: `vn-client-billing-data ${components.vnInputNumber}[name="dueDay"]`,
+ IBANInput: `vn-client-billing-data vn-textfield input[name="iban"]`,
+ dueDayInput: `vn-client-billing-data vn-input-number input[name="dueDay"]`,
receivedCoreLCRCheckbox: 'vn-client-billing-data vn-check[label="Received LCR"]',
receivedCoreVNLCheckbox: 'vn-client-billing-data vn-check[label="Received core VNL"]',
receivedB2BVNLCheckbox: 'vn-client-billing-data vn-check[label="Received B2B VNL"]',
@@ -92,20 +91,20 @@ export default {
newBankEntityBIC: 'vn-client-billing-data > vn-dialog vn-textfield[label="Swift / BIC"] input',
newBankEntityCode: 'vn-client-billing-data > vn-dialog vn-textfield[label="Entity Code"] input',
acceptBankEntityButton: 'vn-client-billing-data > vn-dialog button[response="ACCEPT"]',
- saveButton: `${components.vnSubmit}`
+ saveButton: `button[type=submit]`
},
clientAddresses: {
addressesButton: 'vn-left-menu a[ui-sref="client.card.address.index"]',
- createAddress: `vn-client-address-index ${components.vnFloatButton}`,
+ createAddress: `vn-client-address-index vn-float-button`,
defaultCheckboxInput: 'vn-check[label="Default"]',
- consigneeInput: `${components.vnTextfield}[name="nickname"]`,
- streetAddressInput: `${components.vnTextfield}[name="street"]`,
- postcodeInput: `${components.vnTextfield}[name="postalCode"]`,
- cityInput: `${components.vnTextfield}[name="city"]`,
+ consigneeInput: `vn-textfield input[name="nickname"]`,
+ streetAddressInput: `vn-textfield input[name="street"]`,
+ postcodeInput: `vn-textfield input[name="postalCode"]`,
+ cityInput: `vn-textfield input[name="city"]`,
provinceAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.provinceFk"]',
agencyAutocomplete: 'vn-autocomplete[ng-model="$ctrl.address.agencyModeFk"]',
- phoneInput: `${components.vnTextfield}[name="phone"]`,
- mobileInput: `${components.vnTextfield}[name="mobile"]`,
+ phoneInput: `vn-textfield input[name="phone"]`,
+ mobileInput: `vn-textfield input[name="mobile"]`,
defaultAddress: 'vn-client-address-index div:nth-child(1) div[name="street"]',
secondMakeDefaultStar: 'vn-client-address-index vn-card div:nth-child(2) vn-icon-button[icon="star_border"]',
firstEditAddress: 'vn-client-address-index div:nth-child(1) > a',
@@ -117,34 +116,34 @@ export default {
secondObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] :nth-child(2) [ng-model="observation.observationTypeFk"]',
secondObservationDescriptionInput: 'vn-client-address-edit [name=observations] :nth-child(2) [ng-model="observation.description"] input',
addObservationButton: 'vn-client-address-edit div[name="observations"] vn-icon-button[icon="add_circle"]',
- saveButton: `${components.vnSubmit}`,
+ saveButton: `button[type=submit]`,
cancelCreateAddressButton: 'button[ui-sref="client.card.address.index"]',
cancelEditAddressButton: 'vn-client-address-edit > form > vn-button-bar > vn-button > button'
},
clientWebAccess: {
webAccessButton: 'vn-left-menu a[ui-sref="client.card.webAccess"]',
enableWebAccessCheckbox: 'vn-check[label="Enable web access"]',
- userNameInput: `${components.vnTextfield}[name="name"]`,
- saveButton: `${components.vnSubmit}`
+ userNameInput: `vn-textfield input[name="name"]`,
+ saveButton: `button[type=submit]`
},
clientNotes: {
- addNoteFloatButton: `${components.vnFloatButton}`,
+ addNoteFloatButton: `vn-float-button`,
noteInput: 'vn-textarea[label="Note"]',
- saveButton: `${components.vnSubmit}`,
+ saveButton: `button[type=submit]`,
firstNoteText: 'vn-client-note .text'
},
clientCredit: {
- addCreditFloatButton: `${components.vnFloatButton}`,
- creditInput: `${components.vnInputNumber}[name="credit"]`,
- saveButton: `${components.vnSubmit}`,
+ addCreditFloatButton: `vn-float-button`,
+ creditInput: `vn-input-number input[name="credit"]`,
+ saveButton: `button[type=submit]`,
firstCreditText: 'vn-client-credit-index vn-card > div vn-table vn-tbody > vn-tr'
},
clientGreuge: {
- addGreugeFloatButton: `${components.vnFloatButton}`,
- amountInput: `${components.vnInputNumber}[name="amount"]`,
- descriptionInput: `${components.vnTextfield}[name="description"]`,
+ addGreugeFloatButton: `vn-float-button`,
+ amountInput: `vn-input-number input[name="amount"]`,
+ descriptionInput: `vn-textfield input[name="description"]`,
typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.greuge.greugeTypeFk"]',
- saveButton: `${components.vnSubmit}`,
+ saveButton: `button[type=submit]`,
firstGreugeText: 'vn-client-greuge-index vn-card > div vn-table vn-tbody > vn-tr'
},
clientMandate: {
@@ -163,7 +162,7 @@ export default {
clientBalance: {
balanceButton: 'vn-left-menu a[ui-sref="client.card.balance.index"]',
companyAutocomplete: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyFk"]',
- newPaymentButton: `${components.vnFloatButton}`,
+ newPaymentButton: `vn-float-button`,
newPaymentBank: 'vn-client-balance-create vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]',
newPaymentAmountInput: 'vn-client-balance-create vn-input-number[ng-model="$ctrl.receipt.amountPaid"] input',
saveButton: 'vn-client-balance-create vn-button[label="Save"]',
@@ -182,7 +181,7 @@ export default {
},
itemsIndex: {
searchIcon: 'vn-item-index vn-searchbar vn-icon[icon="search"]',
- createItemButton: `${components.vnFloatButton}`,
+ createItemButton: `vn-float-button`,
searchResult: 'vn-item-index a.vn-tr',
searchResultPreviewButton: 'vn-item-index .buttons > [icon="desktop_windows"]',
searchResultCloneButton: 'vn-item-index .buttons > [icon="icon-clone"]',
@@ -208,16 +207,16 @@ export default {
saveFieldsButton: 'vn-item-index vn-dialog vn-horizontal:nth-child(16) > vn-button > button'
},
itemCreateView: {
- temporalName: `${components.vnTextfield}[name="provisionalName"]`,
+ temporalName: `vn-textfield input[name="provisionalName"]`,
typeAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.typeFk"]',
intrastatAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.intrastatFk"]',
originAutocomplete: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]',
- createButton: `${components.vnSubmit}`,
- cancelButton: 'button[ui-sref="item.index"]'
+ createButton: `button[type=submit]`,
+ cancelButton: 'vn-button[ui-sref="item.index"]'
},
itemDescriptor: {
goBackToModuleIndexButton: 'vn-item-descriptor a[href="#!/item/index"]',
- moreMenu: 'vn-item-descriptor vn-icon-menu > div > vn-icon',
+ moreMenu: 'vn-item-descriptor vn-icon-menu[icon=more_vert]',
moreMenuRegularizeButton: '.vn-popover.shown .vn-drop-down li[name="Regularize stock"]',
regularizeQuantityInput: 'vn-item-descriptor vn-dialog tpl-body > div > vn-textfield input',
regularizeWarehouseAutocomplete: 'vn-item-descriptor vn-dialog vn-autocomplete[ng-model="$ctrl.warehouseFk"]',
@@ -238,7 +237,7 @@ export default {
longNameInput: 'vn-textfield[ng-model="$ctrl.item.longName"] input',
isActiveCheckbox: 'vn-check[label="Active"]',
priceInKgCheckbox: 'vn-check[label="Price in kg"]',
- submitBasicDataButton: `${components.vnSubmit}`
+ submitBasicDataButton: `button[type=submit]`
},
itemTags: {
goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]',
@@ -257,19 +256,19 @@ export default {
seventhValueInput: 'vn-item-tags vn-horizontal:nth-child(7) > vn-textfield[label="Value"] input',
seventhRelevancyInput: 'vn-item-tags vn-horizontal:nth-child(7) > vn-textfield[label="Relevancy"] input',
addItemTagButton: 'vn-item-tags vn-icon-button[icon="add_circle"]',
- submitItemTagsButton: `vn-item-tags ${components.vnSubmit}`
+ submitItemTagsButton: `vn-item-tags button[type=submit]`
},
itemTax: {
undoChangesButton: 'vn-item-tax vn-button-bar > vn-button[label="Undo changes"]',
firstClassAutocomplete: 'vn-item-tax vn-horizontal:nth-child(1) > vn-autocomplete[ng-model="tax.taxClassFk"]',
secondClassAutocomplete: 'vn-item-tax vn-horizontal:nth-child(2) > vn-autocomplete[ng-model="tax.taxClassFk"]',
thirdClassAutocomplete: 'vn-item-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="tax.taxClassFk"]',
- submitTaxButton: `vn-item-tax ${components.vnSubmit}`
+ submitTaxButton: `vn-item-tax button[type=submit]`
},
itemBarcodes: {
addBarcodeButton: 'vn-item-barcode vn-icon[icon="add_circle"]',
- thirdCodeInput: `vn-item-barcode vn-horizontal:nth-child(3) > ${components.vnTextfield}`,
- submitBarcodesButton: `vn-item-barcode ${components.vnSubmit}`,
+ thirdCodeInput: `vn-item-barcode vn-horizontal:nth-child(3) > vn-textfield input`,
+ submitBarcodesButton: `vn-item-barcode button[type=submit]`,
firstCodeRemoveButton: 'vn-item-barcode vn-horizontal vn-none vn-icon[icon="delete"]'
},
itemNiches: {
@@ -281,13 +280,13 @@ export default {
secondNicheRemoveButton: 'vn-item-niche vn-horizontal:nth-child(2) > vn-none > vn-icon-button[icon="delete"]',
thirdWarehouseAutocomplete: 'vn-item-niche vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="niche.warehouseFk"]',
thirdCodeInput: 'vn-item-niche vn-horizontal:nth-child(3) > vn-textfield[label="Code"] input',
- submitNichesButton: `vn-item-niche ${components.vnSubmit}`
+ submitNichesButton: `vn-item-niche button[type=submit]`
},
itemBotanical: {
- botanicalInput: `vn-item-botanical vn-horizontal:nth-child(1) > ${components.vnTextfield}`,
+ botanicalInput: `vn-item-botanical vn-horizontal:nth-child(1) > vn-textfield input`,
genusAutocomplete: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.genusFk"]',
speciesAutocomplete: 'vn-item-botanical vn-autocomplete[ng-model="$ctrl.botanical.specieFk"]',
- submitBotanicalButton: `vn-item-botanical ${components.vnSubmit}`
+ submitBotanicalButton: `vn-item-botanical button[type=submit]`
},
itemSummary: {
basicData: 'vn-item-summary [name="basicData"]',
@@ -330,13 +329,13 @@ export default {
searchResult: 'vn-ticket-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr',
searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr',
searchResultDate: 'vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(5)',
- searchTicketInput: `vn-ticket-index ${components.vnTextfield}`,
- searchWeeklyTicketInput: `vn-ticket-weekly-index ${components.vnTextfield}`,
+ searchTicketInput: `vn-ticket-index vn-textfield input`,
+ searchWeeklyTicketInput: `vn-ticket-weekly-index vn-textfield input`,
searchWeeklyClearInput: 'vn-ticket-weekly-index vn-searchbar vn-icon[icon=clear]',
- advancedSearchButton: 'vn-ticket-search-panel vn-submit[label="Search"] input',
+ advancedSearchButton: 'vn-ticket-search-panel button[type=submit]',
searchButton: 'vn-ticket-index vn-searchbar vn-icon[icon="search"]',
searchWeeklyButton: 'vn-ticket-weekly-index vn-searchbar vn-icon[icon="search"]',
- moreMenu: 'vn-ticket-index vn-icon-menu[vn-id="more-button"] > div > vn-icon',
+ moreMenu: 'vn-ticket-index vn-icon-menu[icon=more_vert]',
moreMenuWeeklyTickets: '.vn-popover.shown .vn-drop-down li:nth-child(2)',
sixthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(6) vn-autocomplete[ng-model="weekly.weekDay"] input',
weeklyTicket: 'vn-ticket-weekly-index vn-table > div > vn-tbody > vn-tr',
@@ -349,13 +348,13 @@ export default {
deliveryDateInput: 'vn-ticket-create vn-date-picker[ng-model="$ctrl.landed"]',
warehouseAutocomplete: 'vn-ticket-create vn-autocomplete[ng-model="$ctrl.warehouseFk"]',
agencyAutocomplete: 'vn-ticket-create vn-autocomplete[ng-model="$ctrl.ticket.agencyModeFk"]',
- createButton: `${components.vnSubmit}`
+ createButton: `button[type=submit]`
},
ticketDescriptor: {
idLabelValue: 'vn-ticket-descriptor vn-label-value[label="Id"]',
stateLabelValue: 'vn-ticket-descriptor vn-label-value[label="State"]',
goBackToModuleIndexButton: 'vn-ticket-descriptor a[ui-sref="ticket.index"]',
- moreMenu: 'vn-ticket-descriptor vn-icon-menu > div > vn-icon',
+ moreMenu: 'vn-ticket-descriptor vn-icon-menu[icon=more_vert]',
moreMenuAddStowaway: '.vn-popover.shown .vn-drop-down li[name="Add stowaway"]',
moreMenuDeleteStowawayButton: '.vn-popover.shown .vn-drop-down li[name="Remove stowaway"]',
moreMenuAddToTurn: '.vn-popover.shown .vn-drop-down li[name="Add turn"]',
@@ -363,9 +362,9 @@ export default {
moreMenuMakeInvoice: '.vn-popover.shown .vn-drop-down li[name="Make invoice"]',
moreMenuChangeShippedHour: '.vn-popover.shown .vn-drop-down li[name="Change shipped hour"]',
changeShippedHourDialog: 'vn-ticket-descriptor vn-dialog[vn-id="changeShippedDialog"]',
- changeShippedHourInput: 'vn-ticket-descriptor vn-dialog[vn-id="changeShippedDialog"] vn-input-time[vn-id="newShipped"]',
+ changeShippedHourInput: 'vn-dialog[vn-id="changeShippedDialog"] [ng-model="$ctrl.newShipped"]',
addStowawayDialogFirstTicket: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog vn-table vn-tbody vn-tr',
- shipButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks vn-icon[icon="icon-stowaway"]',
+ shipButton: 'vn-ticket-descriptor vn-icon[icon="icon-stowaway"]',
thursdayButton: 'vn-ticket-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-tool-bar > vn-button:nth-child(4)',
saturdayButton: 'vn-ticket-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-tool-bar > vn-button:nth-child(6)',
closeStowawayDialog: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog > div > button[class="close"]',
@@ -380,7 +379,7 @@ export default {
addNoteButton: 'vn-icon[icon="add_circle"]',
firstNoteTypeAutocomplete: 'vn-autocomplete[ng-model="observation.observationTypeFk"]',
firstDescriptionInput: 'vn-textfield[label="Description"] input',
- submitNotesButton: `${components.vnSubmit}`
+ submitNotesButton: `button[type=submit]`
},
ticketExpedition: {
expeditionButton: 'vn-left-menu a[ui-sref="ticket.card.expedition"]',
@@ -395,7 +394,7 @@ export default {
firstRemovePackageButton: 'vn-icon-button[vn-tooltip="Remove package"]',
addPackageButton: 'vn-icon-button[vn-tooltip="Add package"]',
clearPackageAutocompleteButton: 'vn-autocomplete[label="Package"] .icons > vn-icon[icon=clear]',
- savePackagesButton: `${components.vnSubmit}`
+ savePackagesButton: `button[type=submit]`
},
ticketSales: {
saleButton: 'vn-left-menu a[ui-sref="ticket.card.sale"]',
@@ -421,7 +420,6 @@ export default {
firstSaleQuantity: 'vn-input-number[ng-model="sale.quantity"]:nth-child(1) input',
firstSaleQuantityCell: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td-editable:nth-child(5)',
firstSaleQuantityClearInput: 'vn-textfield[ng-model="sale.quantity"] div.suffix > i',
- firstSaleIdInput: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > vn-autocomplete input',
firstSaleIdAutocomplete: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > vn-autocomplete',
idAutocompleteFirstResult: '.vn-popover.shown .vn-drop-down li',
firstSalePrice: 'vn-ticket-sale vn-table vn-tr:nth-child(1) > vn-td:nth-child(7) > span',
@@ -461,9 +459,9 @@ export default {
},
ticketTracking: {
trackingButton: 'vn-left-menu a[ui-sref="ticket.card.tracking.index"]',
- createStateButton: `${components.vnFloatButton}`,
+ createStateButton: `vn-float-button`,
stateAutocomplete: 'vn-ticket-tracking-edit vn-autocomplete[ng-model="$ctrl.stateFk"]',
- saveButton: `${components.vnSubmit}`,
+ saveButton: `button[type=submit]`,
cancelButton: 'vn-ticket-tracking-edit vn-button[ui-sref="ticket.card.tracking.index"]'
},
ticketBasicData: {
@@ -472,8 +470,8 @@ export default {
addressAutocomplete: 'vn-autocomplete[ng-model="$ctrl.ticket.addressFk"]',
agencyAutocomplete: 'vn-autocomplete[ng-model="$ctrl.agencyModeId"]',
zoneAutocomplete: 'vn-autocomplete[ng-model="$ctrl.zoneId"]',
- nextStepButton: 'vn-step-control > section > section.buttons > section:nth-child(2) > vn-button',
- finalizeButton: 'vn-step-control > section > section.buttons > section:nth-child(2) > vn-submit',
+ nextStepButton: 'vn-step-control .buttons > section:last-child vn-button',
+ finalizeButton: 'vn-step-control .buttons > section:last-child button[type=submit]',
stepTwoTotalPriceDif: 'vn-ticket-basic-data-step-two > form > vn-card > div > vn-horizontal > table > tfoot > tr > td:nth-child(4)',
chargesReasonAutocomplete: 'vn-autocomplete[ng-model="$ctrl.ticket.option"]',
},
@@ -484,11 +482,11 @@ export default {
addRequestButton: 'vn-ticket-request-index > a > vn-float-button > button',
request: 'vn-ticket-request-index vn-table vn-tr',
descriptionInput: 'vn-ticket-request-create > form > div > vn-card > div > vn-horizontal:nth-child(1) > vn-textfield input',
- atenderAutocomplete: 'vn-ticket-request-create vn-autocomplete[ng-model="$ctrl.ticketRequest.atenderFk"]',
+ atenderAutocomplete: 'vn-ticket-request-create vn-autocomplete[ng-model="$ctrl.ticketRequest.attenderFk"]',
quantityInput: 'vn-ticket-request-create vn-input-number input[name=quantity]',
priceInput: 'vn-ticket-request-create vn-input-number input[name=price]',
firstRemoveRequestButton: 'vn-ticket-request-index vn-icon[icon="delete"]:nth-child(1)',
- saveButton: 'vn-ticket-request-create > form > div > vn-button-bar > vn-submit[label="Create"] input',
+ saveButton: 'vn-ticket-request-create button[type=submit]',
firstDescription: 'vn-ticket-request-index vn-table vn-tr:nth-child(1) > vn-td:nth-child(2)',
},
@@ -500,7 +498,7 @@ export default {
},
ticketService: {
addServiceButton: 'vn-ticket-service vn-icon-button[vn-tooltip="Add service"] > button',
- firstAddDescriptionButton: 'vn-ticket-service vn-icon-button[vn-tooltip="New service type"] > button',
+ firstAddDescriptionButton: 'vn-ticket-service vn-icon-button[vn-tooltip="New service type"]',
firstDescriptionAutocomplete: 'vn-ticket-service vn-autocomplete[ng-model="service.description"]',
firstQuantityInput: 'vn-ticket-service vn-input-number[label="Quantity"] input',
firstPriceInput: 'vn-ticket-service vn-input-number[label="Price"] input',
@@ -508,22 +506,22 @@ export default {
fistDeleteServiceButton: 'vn-ticket-service form vn-horizontal:nth-child(1) vn-icon-button[icon="delete"]',
newDescriptionInput: 'vn-ticket-service > vn-dialog vn-textfield[ng-model="$ctrl.newServiceType.name"] input',
serviceLine: 'vn-ticket-service > form > vn-card > div > vn-one:nth-child(2) > vn-horizontal',
- saveServiceButton: `${components.vnSubmit}`,
+ saveServiceButton: `button[type=submit]`,
saveDescriptionButton: 'vn-ticket-service > vn-dialog[vn-id="createServiceTypeDialog"] > div > form > div.buttons > tpl-buttons > button'
},
createStateView: {
stateAutocomplete: 'vn-autocomplete[ng-model="$ctrl.stateFk"]',
workerAutocomplete: 'vn-autocomplete[ng-model="$ctrl.workerFk"]',
clearStateInputButton: 'vn-autocomplete[ng-model="$ctrl.stateFk"] .icons > vn-icon[icon=clear]',
- saveStateButton: `${components.vnSubmit}`
+ saveStateButton: `button[type=submit]`
},
claimsIndex: {
- searchClaimInput: `vn-claim-index ${components.vnTextfield}`,
+ searchClaimInput: `vn-claim-index vn-textfield input`,
searchResult: 'vn-claim-index vn-card > div > vn-table > div > vn-tbody > a',
searchButton: 'vn-claim-index vn-searchbar vn-icon[icon="search"]'
},
claimDescriptor: {
- moreMenu: 'vn-claim-descriptor vn-icon-menu[vn-id="more-button"]',
+ moreMenu: 'vn-claim-descriptor vn-icon-menu[icon=more_vert]',
moreMenuDeleteClaim: '.vn-popover.shown .vn-drop-down li[name="Delete claim"]',
acceptDeleteClaim: 'vn-claim-descriptor > vn-confirm[vn-id="confirm-delete-claim"] button[response="ACCEPT"]'
},
@@ -531,20 +529,20 @@ export default {
header: 'vn-claim-summary > vn-card > div > h5',
state: 'vn-claim-summary vn-label-value[label="State"] > section > span',
observation: 'vn-claim-summary vn-textarea[ng-model="$ctrl.summary.claim.observation"] textarea',
- firstSaleItemId: 'vn-claim-summary vn-horizontal > vn-auto:nth-child(4) > 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(4) vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(1) > span',
firstSaleDescriptorImage: '.vn-popover.shown vn-item-descriptor img',
itemDescriptorPopover: '.vn-popover.shown vn-item-descriptor',
itemDescriptorPopoverItemDiaryButton: '.vn-popover.shown vn-item-descriptor a[href="#!/item/2/diary"]',
- firstDevelopmentWorker: 'vn-claim-summary vn-horizontal > vn-auto:nth-child(5) > vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > span',
- firstDevelopmentWorkerGoToClientButton: '.vn-popover.shown vn-worker-descriptor div.quicklinks > a[href="#!/client/21/summary"]',
- firstActionTicketId: 'vn-claim-summary > vn-card > div > vn-horizontal > vn-auto:nth-child(6) > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span',
+ firstDevelopmentWorker: 'vn-claim-summary vn-horizontal > vn-auto:nth-child(5) vn-table > div > vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(4) > span',
+ firstDevelopmentWorkerGoToClientButton: '.vn-popover.shown vn-worker-descriptor vn-quick-links > a[href="#!/client/21/summary"]',
+ firstActionTicketId: 'vn-claim-summary > vn-card > div > vn-horizontal > vn-auto:nth-child(6) vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span',
firstActionTicketDescriptor: '.vn-popover.shown vn-ticket-descriptor'
},
claimBasicData: {
claimStateAutocomplete: 'vn-claim-basic-data vn-autocomplete[ng-model="$ctrl.claim.claimStateFk"]',
- responsabilityInputRange: 'vn-input-range',
+ responsabilityInputRange: 'vn-range',
observationInput: 'vn-textarea[ng-model="$ctrl.claim.observation"] textarea',
- saveButton: `${components.vnSubmit}`
+ saveButton: `button[type=submit]`
},
claimDetail: {
secondItemDiscount: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(6) > span',
@@ -570,7 +568,7 @@ export default {
secondClaimResponsibleAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimResponsibleFk"]',
secondClaimWorkerAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.workerFk"]',
secondClaimRedeliveryAutocomplete: 'vn-claim-development vn-horizontal:nth-child(2) vn-autocomplete[ng-model="claimDevelopment.claimRedeliveryFk"]',
- saveDevelopmentButton: `${components.vnSubmit}`
+ saveDevelopmentButton: `button[type=submit]`
},
claimAction: {
importClaimButton: 'vn-claim-action vn-button[label="Import claim"]',
@@ -585,9 +583,9 @@ export default {
searchResult: 'vn-order-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr',
searchResultDate: 'vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(4)',
searchResultAddress: 'vn-order-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(6)',
- searchOrderInput: `vn-order-index ${components.vnTextfield}`,
+ searchOrderInput: `vn-order-index vn-textfield input`,
searchButton: 'vn-order-index vn-searchbar vn-icon[icon="search"]',
- createOrderButton: `${components.vnFloatButton}`,
+ createOrderButton: `vn-float-button`,
},
orderDescriptor: {
returnToModuleIndexButton: 'vn-order-descriptor a[ui-sref="order.index"]',
@@ -598,7 +596,7 @@ export default {
addressAutocomplete: 'vn-autocomplete[label="Address"]',
agencyAutocomplete: 'vn-autocomplete[label="Agency"]',
landedDatePicker: 'vn-date-picker[label="Landed"]',
- createButton: `${components.vnSubmit}`,
+ createButton: `button[type=submit]`,
cancelButton: 'vn-button[href="#!/client/index"]'
},
orderCatalog: {
@@ -610,16 +608,16 @@ export default {
openTagSearch: 'vn-catalog-filter > div > vn-vertical > vn-textfield[ng-model="$ctrl.value"] .append i',
tagAutocomplete: 'vn-order-catalog-search-panel vn-autocomplete[ng-model="filter.tagFk"]',
tagValueInput: 'vn-order-catalog-search-panel vn-textfield[ng-model="filter.value"] input',
- searchTagButton: 'vn-order-catalog-search-panel > div > form > vn-horizontal:nth-child(3) > vn-submit > input',
- thirdFilterRemoveButton: 'vn-catalog-filter > div > vn-horizontal.chips > vn-chip:nth-child(3) button',
- fourthFilterRemoveButton: 'vn-catalog-filter > div > vn-horizontal.chips > vn-chip:nth-child(4) button',
+ searchTagButton: 'vn-order-catalog-search-panel button[type=submit]',
+ thirdFilterRemoveButton: 'vn-catalog-filter .chips > vn-chip:nth-child(3) vn-icon[icon=cancel]',
+ fourthFilterRemoveButton: 'vn-catalog-filter .chips > vn-chip:nth-child(4) vn-icon[icon=cancel]',
},
orderBasicData: {
clientAutocomplete: 'vn-autocomplete[label="Client"]',
addressAutocomplete: 'vn-autocomplete[label="Address"]',
agencyAutocomplete: 'vn-autocomplete[label="Agency"]',
observationInput: 'vn-textarea[label="Observation"] textarea',
- saveButton: `${components.vnSubmit}`,
+ saveButton: `button[type=submit]`,
acceptButton: 'vn-order-basic-data vn-confirm[vn-id="confirm"] button[response="ACCEPT"]'
},
orderLine: {
@@ -637,7 +635,7 @@ export default {
vehicleAutoComplete: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]',
agencyAutoComplete: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]',
descriptionInput: 'vn-route-create vn-textfield[ng-model="$ctrl.route.description"] input',
- submitButton: 'vn-route-create vn-submit > input[type="submit"]'
+ submitButton: 'vn-route-create button[type=submit]'
},
routeDescriptor: {
volume: 'vn-route-descriptor vn-label-value[label="Volume"] > section > span'
@@ -654,7 +652,7 @@ export default {
createdDateInput: 'vn-route-basic-data vn-date-picker[ng-model="$ctrl.route.created"]',
startedHourInput: 'vn-route-basic-data vn-input-time[ng-model="$ctrl.route.started"] input',
finishedHourInput: 'vn-route-basic-data vn-input-time[ng-model="$ctrl.route.finished"] input',
- saveButton: 'vn-route-basic-data vn-submit[label="Save"] input'
+ saveButton: 'vn-route-basic-data button[type=submit]'
},
routeTickets: {
firstTicketPriority: 'vn-route-tickets vn-tr:nth-child(1) vn-textfield[ng-model="ticket.priority"] input',
@@ -669,10 +667,10 @@ export default {
},
workerPbx: {
extensionInput: 'vn-worker-pbx vn-textfield[ng-model="$ctrl.worker.sip.extension"] input',
- saveButton: 'vn-worker-pbx vn-submit[label="Save"] input'
+ saveButton: 'vn-worker-pbx button[type=submit]'
},
workerTimeControl: {
- timeDialogInput: 'vn-worker-time-control > vn-dialog input',
+ timeDialogInput: '.vn-dialog.shown [ng-model="$ctrl.newTime"]',
mondayAddTimeButton: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(1) > vn-icon-button > button > vn-icon',
tuesdayAddTimeButton: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(2) > vn-icon-button > button > vn-icon',
wednesdayAddTimeButton: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(3) > vn-icon-button > button > vn-icon',
@@ -721,12 +719,12 @@ export default {
navigateBackToIndex: 'vn-worker-descriptor vn-icon[icon="chevron_left"]'
},
invoiceOutIndex: {
- searchInvoiceOutInput: `vn-invoice-out-index ${components.vnTextfield}`,
+ searchInvoiceOutInput: `vn-invoice-out-index vn-textfield input`,
searchButton: 'vn-invoice-out-index vn-searchbar vn-icon[icon="search"]',
searchResult: 'vn-invoice-out-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr',
},
invoiceOutDescriptor: {
- moreMenu: 'vn-invoice-out-descriptor vn-icon-menu[vn-id="more-button"]',
+ moreMenu: 'vn-invoice-out-descriptor vn-icon-menu[icon=more_vert]',
moreMenuDeleteInvoiceOut: '.vn-popover.shown .vn-drop-down li[name="Delete Invoice"]',
moreMenuBookInvoiceOut: '.vn-popover.shown .vn-drop-down li[name="Book invoice"]',
moreMenuShowInvoiceOutPdf: '.vn-popover.shown .vn-drop-down li[name="Show invoice PDF"]',
diff --git a/e2e/paths/01-login/01_login.spec.js b/e2e/paths/01-login/01_login.spec.js
index a33be0c25..03acc98a8 100644
--- a/e2e/paths/01-login/01_login.spec.js
+++ b/e2e/paths/01-login/01_login.spec.js
@@ -1,58 +1,35 @@
import createNightmare from '../../helpers/nightmare';
-import config from '../../helpers/config.js';
-
describe('Login path', () => {
const nightmare = createNightmare();
it('should receive an error when the username is incorrect', async() => {
- const username = 'nobody';
- const password = 'nightmare';
-
const result = await nightmare
- .goto(`${config.url}/#!/login`)
- .wait(`vn-login input[name=user]`)
- .write(`vn-login input[name=user]`, username)
- .write(`vn-login input[name=password]`, password)
- .click(`vn-login input[type=submit]`)
+ .doLogin('badUser', null)
.waitForLastSnackbar();
expect(result.length).toBeGreaterThan(0);
});
it('should receive an error when the username is blank', async() => {
- const password = 'nightmare';
-
const result = await nightmare
- .clearInput(`vn-login input[name=user]`)
- .write(`vn-login input[name=password]`, password)
- .click(`vn-login input[type=submit]`)
+ .doLogin('', null)
.waitForLastSnackbar();
expect(result.length).toBeGreaterThan(0);
});
it('should receive an error when the password is incorrect', async() => {
- const username = 'employee';
- const password = 'badpassword';
-
const result = await nightmare
- .write(`vn-login input[name=user]`, username)
- .write(`vn-login input[name=password]`, password)
- .click(`vn-login input[type=submit]`)
+ .doLogin('employee', 'badPassword')
.waitForLastSnackbar();
expect(result.length).toBeGreaterThan(0);
});
it('should log in', async() => {
- const username = 'employee';
- const password = 'nightmare';
-
const url = await nightmare
- .write(`vn-login input[name=user]`, username)
- .write(`vn-login input[name=password]`, password)
- .click(`vn-login input[type=submit]`)
+ .doLogin('employee', null)
.wait('#logout')
.parsedUrl();
diff --git a/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js b/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js
index ae3020d2a..cbe3722de 100644
--- a/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js
+++ b/e2e/paths/02-client-module/03_edit_fiscal_data.spec.js
@@ -42,9 +42,7 @@ describe('Client Edit fiscalData path', () => {
it('should not be able to edit the verified data checkbox', async() => {
const result = await nightmare
.wait(selectors.clientFiscalData.verifiedDataCheckbox)
- .evaluate(selector => {
- return document.querySelector(selector).getAttribute('disabled');
- }, selectors.clientFiscalData.verifiedDataCheckbox);
+ .isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
expect(result).toBeTruthy();
});
diff --git a/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js b/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js
index 52e2db237..398185ba5 100644
--- a/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js
+++ b/e2e/paths/02-client-module/12_lock_of_verified_data.spec.js
@@ -16,9 +16,7 @@ describe('Client lock verified data path', () => {
const result = await nightmare
.wait(200)
.wait(selectors.clientFiscalData.verifiedDataCheckbox)
- .evaluate(selector => {
- return document.querySelector(selector).getAttribute('disabled');
- }, selectors.clientFiscalData.verifiedDataCheckbox);
+ .isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
expect(result).toBeTruthy();
});
diff --git a/e2e/paths/03-worker-module/02_time_control.spec.js b/e2e/paths/03-worker-module/02_time_control.spec.js
index 42be3e9e0..be48b13dd 100644
--- a/e2e/paths/03-worker-module/02_time_control.spec.js
+++ b/e2e/paths/03-worker-module/02_time_control.spec.js
@@ -358,7 +358,7 @@ describe('Worker time control path', () => {
it(`should check Hank Pym doesn't have hours set on the next months first week`, async() => {
const wholeWeekHours = await nightmare
.waitToClick(selectors.workerTimeControl.nextMonthButton)
- .waitToClick(selectors.workerTimeControl.nextMonthButton)
+ .waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 Hours')
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
expect(wholeWeekHours).toEqual('00:00 Hours');
diff --git a/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js b/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js
index 0f02c6af7..3dcac0765 100644
--- a/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js
+++ b/e2e/paths/05-ticket-module/06_basic_data_steps.spec.js
@@ -30,6 +30,7 @@ describe('Ticket Edit basic data path', () => {
it(`should confirm the zone autocomplete is enabled for the role productionBoss`, async() => {
const disabled = await nightmare
+ .waitForSpinnerLoad()
.wait(selectors.ticketBasicData.zoneAutocomplete)
.evaluate(selector => {
return document.querySelector(selector).disabled;
diff --git a/e2e/paths/05-ticket-module/12_descriptor.spec.js b/e2e/paths/05-ticket-module/12_descriptor.spec.js
index 5c80bbfe8..b9c6c7c87 100644
--- a/e2e/paths/05-ticket-module/12_descriptor.spec.js
+++ b/e2e/paths/05-ticket-module/12_descriptor.spec.js
@@ -34,7 +34,7 @@ describe('Ticket descriptor path', () => {
const result = await nightmare
.waitToClick(selectors.ticketDescriptor.moreMenu)
.waitToClick(selectors.ticketDescriptor.moreMenuChangeShippedHour)
- .write(selectors.ticketDescriptor.changeShippedHourInput, '08:15')
+ .pickTime(selectors.ticketDescriptor.changeShippedHourInput, '08:15')
.waitToClick(selectors.ticketDescriptor.acceptChangeHourButton)
.waitForLastSnackbar();
diff --git a/e2e/paths/05-ticket-module/13_services.spec.js b/e2e/paths/05-ticket-module/13_services.spec.js
index 31d262778..7172ab5a6 100644
--- a/e2e/paths/05-ticket-module/13_services.spec.js
+++ b/e2e/paths/05-ticket-module/13_services.spec.js
@@ -17,9 +17,7 @@ describe('Ticket services path', () => {
const result = await nightmare
.waitToClick(selectors.ticketService.addServiceButton)
.wait(selectors.ticketService.firstAddDescriptionButton)
- .evaluate(selector => {
- return document.querySelector(selector).disabled;
- }, selectors.ticketService.firstAddDescriptionButton);
+ .isDisabled(selectors.ticketService.firstAddDescriptionButton);
expect(result).toBeTruthy();
});
diff --git a/e2e/paths/07-order-module/02_catalog.spec.js b/e2e/paths/07-order-module/02_catalog.spec.js
index d2a862958..cad95741e 100644
--- a/e2e/paths/07-order-module/02_catalog.spec.js
+++ b/e2e/paths/07-order-module/02_catalog.spec.js
@@ -66,7 +66,7 @@ describe('Order catalog', () => {
const result = await nightmare
.waitToClick(selectors.orderCatalog.fourthFilterRemoveButton)
.waitToClick(selectors.orderCatalog.thirdFilterRemoveButton)
- .waitForNumberOfElements('section.product', 4)
+ .waitForNumberOfElements('.product', 4)
.countElement('section.product');
expect(result).toEqual(4);
diff --git a/front/core/components/autocomplete/index.html b/front/core/components/autocomplete/index.html
index 2e5cc39f6..c0caf061b 100755
--- a/front/core/components/autocomplete/index.html
+++ b/front/core/components/autocomplete/index.html
@@ -1,6 +1,6 @@
+ on-close-start="$ctrl.focus()">
\ No newline at end of file
diff --git a/front/core/components/autocomplete/index.js b/front/core/components/autocomplete/index.js
index 69114d028..49dd14b07 100755
--- a/front/core/components/autocomplete/index.js
+++ b/front/core/components/autocomplete/index.js
@@ -228,7 +228,7 @@ export default class Autocomplete extends Field {
event.preventDefault();
}
- onContainerMouseDown(event) {
+ onContainerClick(event) {
if (event.defaultPrevented) return;
event.preventDefault();
this.showDropDown();
@@ -260,6 +260,7 @@ export default class Autocomplete extends Field {
}
showDropDown(search) {
+ if (this.readonly) return;
this.assignDropdownProps();
this.$.dropDown.show(this.container, search);
}
diff --git a/front/core/components/autocomplete/style.scss b/front/core/components/autocomplete/style.scss
index af45902cc..6be42c3bc 100755
--- a/front/core/components/autocomplete/style.scss
+++ b/front/core/components/autocomplete/style.scss
@@ -20,4 +20,7 @@ vn-autocomplete.vn-field {
}
}
}
+ &.readonly > .container > .icons.post {
+ display: none;
+ }
}
diff --git a/front/core/components/button-menu/button-menu.html b/front/core/components/button-menu/button-menu.html
deleted file mode 100644
index 5beeb12fb..000000000
--- a/front/core/components/button-menu/button-menu.html
+++ /dev/null
@@ -1,13 +0,0 @@
-
\ No newline at end of file
diff --git a/front/core/components/button-menu/index.html b/front/core/components/button-menu/index.html
new file mode 100644
index 000000000..b0977bb93
--- /dev/null
+++ b/front/core/components/button-menu/index.html
@@ -0,0 +1,20 @@
+
+
+
\ No newline at end of file
diff --git a/front/core/components/button-menu/button-menu.js b/front/core/components/button-menu/index.js
similarity index 83%
rename from front/core/components/button-menu/button-menu.js
rename to front/core/components/button-menu/index.js
index 99f3879ee..d31094d36 100644
--- a/front/core/components/button-menu/button-menu.js
+++ b/front/core/components/button-menu/index.js
@@ -1,17 +1,13 @@
import ngModule from '../../module';
-import Input from '../../lib/input';
+import Button from '../button';
import assignProps from '../../lib/assign-props';
import './style.scss';
-export default class ButtonMenu extends Input {
+export default class ButtonMenu extends Button {
constructor($element, $scope, $transclude) {
super($element, $scope);
this.$transclude = $transclude;
- this.input = this.element.querySelector('.mdl-button');
- $element.on('click', e => {
- if (!this.disabled)
- this.onClick(e);
- });
+ $element.on('click', e => this.onClick(e));
}
get model() {
@@ -46,6 +42,7 @@ export default class ButtonMenu extends Input {
}
onClick(event) {
+ if (this.disabled) return;
if (event.defaultPrevented) return;
event.preventDefault();
this.emit('open');
@@ -85,15 +82,14 @@ export default class ButtonMenu extends Input {
}
ButtonMenu.$inject = ['$element', '$scope', '$transclude'];
-ngModule.component('vnButtonMenu', {
- template: require('./button-menu.html'),
+ngModule.vnComponent('vnButtonMenu', {
+ template: require('./index.html'),
+ controller: ButtonMenu,
bindings: {
- label: '@',
showField: '@?',
selection: '',
valueField: '@?',
selectFields: '',
- disabled: '',
initialData: '',
showFilter: '',
field: '=?',
@@ -104,12 +100,10 @@ ngModule.component('vnButtonMenu', {
limit: '',
multiple: '',
onChange: '&?',
- icon: '@?',
translateFields: '',
onOpen: '&?'
},
transclude: {
tplItem: '?tplItem'
- },
- controller: ButtonMenu
+ }
});
diff --git a/front/core/components/button-menu/button-menu.spec.js b/front/core/components/button-menu/index.spec.js
similarity index 100%
rename from front/core/components/button-menu/button-menu.spec.js
rename to front/core/components/button-menu/index.spec.js
diff --git a/front/core/components/button-menu/style.scss b/front/core/components/button-menu/style.scss
index 53dbb963a..1cd995b15 100644
--- a/front/core/components/button-menu/style.scss
+++ b/front/core/components/button-menu/style.scss
@@ -1,19 +1,3 @@
vn-button-menu {
position: relative;
- cursor: pointer;
-
- .button-menu__button {
- padding: 0 10px;
- }
- vn-label {
- float: left;
- margin-top: 1px;
- }
- vn-icon {
- float: left;
- margin-top: 3px;
- }
- vn-icon.button-menu__arrow_down {
- margin: 6px 0 0 5px;
- }
}
\ No newline at end of file
diff --git a/front/core/components/button/button.html b/front/core/components/button/button.html
deleted file mode 100644
index 1087bbee2..000000000
--- a/front/core/components/button/button.html
+++ /dev/null
@@ -1,6 +0,0 @@
-
\ No newline at end of file
diff --git a/front/core/components/button/button.js b/front/core/components/button/button.js
deleted file mode 100644
index 4e5cf50a2..000000000
--- a/front/core/components/button/button.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import ngModule from '../../module';
-import Input from '../../lib/input';
-import './style.scss';
-
-export default class Button extends Input {
- constructor($element) {
- super($element);
- this.$element = $element;
- this.input = this.element.querySelector('.mdl-button');
-
- $element[0].addEventListener('click', event => {
- if (this.disabled)
- event.stopImmediatePropagation();
- });
- }
-
- $onInit() {
- if (!this.type)
- this.type = 'button';
- }
-}
-Button.$inject = ['$element'];
-
-ngModule.component('vnButton', {
- controller: Button,
- template: require('./button.html'),
- bindings: {
- label: '@?',
- disabled: '',
- icon: '@?',
- type: '@?'
- }
-});
-
diff --git a/front/core/components/button/index.html b/front/core/components/button/index.html
new file mode 100644
index 000000000..e8c3f6bc5
--- /dev/null
+++ b/front/core/components/button/index.html
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/front/core/components/button/index.js b/front/core/components/button/index.js
new file mode 100644
index 000000000..e1a86eb5d
--- /dev/null
+++ b/front/core/components/button/index.js
@@ -0,0 +1,46 @@
+import ngModule from '../../module';
+import FormInput from '../form-input';
+import './style.scss';
+
+export default class Button extends FormInput {
+ constructor($element, $scope) {
+ super($element, $scope);
+ this.design = 'colored';
+ this.input = this.element.querySelector('button');
+
+ let element = this.element;
+ element.tabIndex = 0;
+ element.classList.add('vn-button');
+ this.element.addEventListener('keyup', e => this.onKeyup(e));
+ this.element.addEventListener('click', e => this.onClick(e));
+ }
+
+ $onInit() {
+ this.element.classList.add(this.design);
+ if (!this.type) this.type = 'button';
+ }
+
+ onKeyup(event) {
+ if (event.code == 'Space')
+ this.onClick(event);
+ }
+
+ onClick(event) {
+ if (event.defaultPrevented) return;
+ // event.preventDefault();
+
+ // FIXME: Don't stop event propagation
+ if (this.disabled) event.stopImmediatePropagation();
+ }
+}
+Button.$inject = ['$element', '$scope'];
+
+ngModule.vnComponent('vnButton', {
+ controller: Button,
+ template: require('./index.html'),
+ bindings: {
+ icon: '@?',
+ type: '@?'
+ }
+});
+
diff --git a/front/core/components/button/style.scss b/front/core/components/button/style.scss
index 84bd8659a..74dcbcf9b 100644
--- a/front/core/components/button/style.scss
+++ b/front/core/components/button/style.scss
@@ -1,5 +1,83 @@
-vn-button {
- & > button > vn-icon {
- vertical-align: middle;
+@import "variables";
+
+.vn-button {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ height: 36px;
+ border: none;
+ border-radius: .1em;
+ font-family: vn-font-bold;
+ text-transform: uppercase;
+ font-size: 14px;
+ cursor: pointer;
+ box-sizing: border-box;
+ outline: none;
+
+ & > button {
+ width: 100%;
+ padding: 0 12px;
+ box-sizing: border-box;
+ background-color: transparent;
+ border: none;
+ height: inherit;
+ color: inherit;
+ font: inherit;
+ display: block;
+ text-transform: inherit;
+ cursor: inherit;
+ outline: none;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+
+ & > vn-icon {
+ vertical-align: middle;
+ color: inherit;
+ font-size: 1.7em;
+ }
}
-}
\ No newline at end of file
+ &.colored {
+ color: white;
+ background-color: $color-main;
+ box-shadow: 0 .15em .15em 0 rgba(0, 0, 0, .3);
+ transition: background 200ms ease-in-out;
+
+ &:not(.disabled) {
+ &:hover,
+ &:focus {
+ background-color: lighten($color-main, 10%);
+ }
+ }
+ }
+ &.flat {
+ color: $color-main;
+ background-color: transparent;
+ box-shadow: none;
+ transition: background 200ms ease-in-out;
+
+ &:not(.disabled) {
+ &:hover,
+ &:focus {
+ background-color: $color-hover-cd;
+ }
+ }
+ }
+ &:hover,
+ &:focus {
+ outline: none;
+ }
+ &.round {
+ border-radius: 50%;
+ height: 3.8em;
+ width: 3.8em;
+
+ & > button > span {
+ display: none;
+ }
+ }
+ &.disabled {
+ opacity: .7;
+ cursor: initial;
+ }
+}
diff --git a/front/core/components/card/card.js b/front/core/components/card/card.js
index b812ccf61..a37835995 100644
--- a/front/core/components/card/card.js
+++ b/front/core/components/card/card.js
@@ -7,7 +7,7 @@ export default function directive() {
transclude: true,
template: require('./card.html'),
link: function($scope, $element, $attrs, $ctrl, $transclude) {
- $element.addClass('demo-card-wide mdl-shadow--2dp bg-panel');
+ $element.addClass('demo-card-wide vn-shadow bg-panel');
$transclude($scope, function(clone) {
angular.element($element[0].querySelector('div')).append(clone);
diff --git a/front/core/components/card/style.scss b/front/core/components/card/style.scss
index c2fe4e1ea..a459879df 100644
--- a/front/core/components/card/style.scss
+++ b/front/core/components/card/style.scss
@@ -1,3 +1,4 @@
vn-card {
display: block;
+ box-sizing: border-box;
}
\ No newline at end of file
diff --git a/front/core/components/chip/index.html b/front/core/components/chip/index.html
index 8696fd8bb..38a56923d 100644
--- a/front/core/components/chip/index.html
+++ b/front/core/components/chip/index.html
@@ -1,8 +1,7 @@
-
-
-
-
-
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/front/core/components/chip/index.js b/front/core/components/chip/index.js
index b35c00cbf..6a945559b 100644
--- a/front/core/components/chip/index.js
+++ b/front/core/components/chip/index.js
@@ -1,17 +1,12 @@
import ngModule from '../../module';
+import Component from '../../lib/component';
import './style.scss';
-export default class Chip {
-
-/**
- * Remove chip event
- */
- remove() {
- if (this.onRemove)
- this.onRemove();
+export default class Chip extends Component {
+ onRemove() {
+ if (!this.disabled) this.emit('remove');
}
}
-
Chip.$inject = ['$element', '$scope', '$transclude'];
ngModule.component('vnChip', {
@@ -20,6 +15,6 @@ ngModule.component('vnChip', {
transclude: true,
bindings: {
disabled: '',
- onRemove: '&?'
+ removable: ''
}
});
diff --git a/front/core/components/chip/index.spec.js b/front/core/components/chip/index.spec.js
index 88faa759a..eaf6ff8c5 100644
--- a/front/core/components/chip/index.spec.js
+++ b/front/core/components/chip/index.spec.js
@@ -16,13 +16,13 @@ describe('Component vnChip', () => {
controller = $componentController('vnChip', {$element, $scope, $transclude: () => {}});
}));
- describe('remove()', () => {
- it(`should call onRemove()`, () => {
- controller.onRemove = () => {};
- spyOn(controller, 'onRemove');
- controller.remove();
+ describe('onRemove()', () => {
+ it(`should emit remove event`, () => {
+ controller.emit = () => {};
+ spyOn(controller, 'emit');
+ controller.onRemove();
- expect(controller.onRemove).toHaveBeenCalledWith();
+ expect(controller.emit).toHaveBeenCalledWith('remove');
});
});
});
diff --git a/front/core/components/chip/style.scss b/front/core/components/chip/style.scss
index 81e81589c..ee7f46848 100644
--- a/front/core/components/chip/style.scss
+++ b/front/core/components/chip/style.scss
@@ -1,18 +1,53 @@
@import "variables";
vn-chip {
+ border-radius: 16px;
+ background-color: $color-bg;
margin: 0 0.5em 0.5em 0;
+ color: $color-font;
+ font-size: 14px;
+ margin: .25em;
+ display: inline-flex;
+ align-items: center;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ height: 28px;
+ padding: 0 .7em;
+ overflow: hidden;
- .mdl-chip {
- background-color: rgba($color-main, 0.9);
- color: #FFF
+ &.colored {
+ background-color: $color-main;
+ color: $color-font-dark;
}
-
- .mdl-chip:active {
- background-color: $color-main
- }
-
- & > vn-one > span > span {
+ & > div {
+ display: flex;
+ align-items: center;
max-width: 100%;
+ height: 100%;
+
+ & > vn-avatar {
+ margin-left: -0.7em;
+ margin-right: .4em;
+ }
}
+ & > vn-icon {
+ margin-left: .2em;
+ margin-right: -0.3em;
+ vertical-align: middle;
+ opacity: .6;
+ cursor: pointer;
+ transition: opacity 250ms ease-out;
+
+ &:hover,
+ &:focus {
+ opacity: 1;
+ }
+ }
+}
+
+vn-avatar {
+ display: inline-block;
+ height: 28px;
+ width: 28px;
+ border-radius: 50%;
}
\ No newline at end of file
diff --git a/front/core/components/color-legend/index.html b/front/core/components/color-legend/index.html
deleted file mode 100644
index 613fb2347..000000000
--- a/front/core/components/color-legend/index.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- {{legend.name}}
-
\ No newline at end of file
diff --git a/front/core/components/color-legend/index.js b/front/core/components/color-legend/index.js
deleted file mode 100644
index f72a501a7..000000000
--- a/front/core/components/color-legend/index.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import ngModule from '../../module';
-import Component from '../../lib/component';
-import './style.scss';
-
-export default class Controller extends Component {
- constructor($element, $scope, $attrs) {
- super($element, $scope);
- this.$attrs = $attrs;
- }
-
- onClick(legend) {
- this.emit('click', {legend});
- }
-}
-
-Controller.$inject = ['$element', '$scope', '$attrs'];
-
-ngModule.component('vnColorLegend', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- data: ''
- }
-});
diff --git a/front/core/components/color-legend/style.scss b/front/core/components/color-legend/style.scss
deleted file mode 100644
index 615887c6d..000000000
--- a/front/core/components/color-legend/style.scss
+++ /dev/null
@@ -1,13 +0,0 @@
-@import "variables";
-
-.mdl-chip--contact {
- margin-left: 5px;
- height: 20px;
- line-height: 5px;
- float: left
-}
-
-.mdl-chip--contact .mdl-chip__contact {
- height: 20px;
- width: 20px
-}
\ No newline at end of file
diff --git a/front/core/components/date-picker/index.js b/front/core/components/date-picker/index.js
index e46cde17e..b667674fa 100644
--- a/front/core/components/date-picker/index.js
+++ b/front/core/components/date-picker/index.js
@@ -1,15 +1,40 @@
import ngModule from '../../module';
import Field from '../field';
-import {Flatpickr} from '../../vendor';
import './style.scss';
class DatePicker extends Field {
- constructor($element, $scope, $compile, $translate) {
+ constructor($element, $scope, $compile, $translate, $filter) {
super($element, $scope, $compile);
this.$translate = $translate;
+ this.$filter = $filter;
- this.input = $compile(`
`)($scope)[0];
- this.initPicker();
+ this.input = $compile(`
`)($scope)[0];
+ this.input.addEventListener('change', () => this.onValueUpdate());
+ }
+
+ onValueUpdate() {
+ let date = null;
+ let value = this.input.value;
+
+ if (value) {
+ date = new Date(value);
+
+ if (this.field) {
+ let orgDate = this.field instanceof Date
+ ? this.field
+ : new Date(this.field);
+
+ date.setHours(
+ orgDate.getHours(),
+ orgDate.getMinutes(),
+ orgDate.getSeconds(),
+ orgDate.getMilliseconds()
+ );
+ }
+ }
+
+ super.field = date;
+ this.$.$applyAsync();
}
get field() {
@@ -18,69 +43,10 @@ class DatePicker extends Field {
set field(value) {
super.field = value;
-
- let date = value;
- if (date && !(date instanceof Date))
- date = new Date(date);
-
- this.picker.setDate(fixDate(date));
- }
-
- set options(value) {
- let selectedDates = this.picker.selectedDates || [];
- this._options = value;
- this.initPicker();
- this.picker.setDate(selectedDates[0]);
- }
-
- get options() {
- return this._options;
- }
-
- initPicker() {
- let locale = this.$translate.use();
- let format = locale == 'es' ? 'd-m-Y' : 'Y-m-d';
-
- let options = this.options || {};
- let defaultOptions = {
- locale: locale,
- dateFormat: format,
- enableTime: false,
- disableMobile: true,
- onValueUpdate: () => this.onValueUpdate()
- };
-
- if (options.enableTime) {
- Object.assign(defaultOptions, {
- dateFormat: `${format} h:i`,
- time_24hr: true
- });
- }
-
- let mergedOptions = Object.assign({},
- defaultOptions,
- options
- );
-
- if (this.picker) this.picker.destroy();
- this.picker = new Flatpickr(this.input, mergedOptions);
- }
-
- onValueUpdate() {
- let date = null;
-
- if (this.picker.selectedDates.length)
- date = this.picker.selectedDates[0];
-
- super.field = fixDate(date, -1);
- this.$.$applyAsync();
- }
-
- $onDestroy() {
- this.picker.destroy();
+ this.input.value = this.$filter('date')(value, 'yyyy-MM-dd');
}
}
-DatePicker.$inject = ['$element', '$scope', '$compile', '$translate'];
+DatePicker.$inject = ['$element', '$scope', '$compile', '$translate', '$filter'];
ngModule.vnComponent('vnDatePicker', {
controller: DatePicker,
@@ -88,12 +54,3 @@ ngModule.vnComponent('vnDatePicker', {
options: ''
}
});
-
-function fixDate(date, mult = 1) {
- if (date) {
- let offset = date.getTimezoneOffset() * 60000;
- date.setTime(date.getTime() + (offset * mult));
- }
-
- return date;
-}
diff --git a/front/core/components/date-picker/index.spec.js b/front/core/components/date-picker/index.spec.js
index 9e76bceb2..38d344fc9 100644
--- a/front/core/components/date-picker/index.spec.js
+++ b/front/core/components/date-picker/index.spec.js
@@ -2,7 +2,6 @@ describe('Component vnDatePicker', () => {
let $filter;
let $element;
let $ctrl;
- let today;
beforeEach(angular.mock.module('vnCore', $translateProvider => {
$translateProvider.translations('en', {});
@@ -13,9 +12,6 @@ describe('Component vnDatePicker', () => {
$element = $compile(`
`)($rootScope);
$ctrl = $element.controller('vnDatePicker');
-
- today = new Date();
- today.setUTCHours(0, 0, 0, 0);
}));
afterEach(() => {
@@ -24,20 +20,12 @@ describe('Component vnDatePicker', () => {
describe('field() setter', () => {
it(`should display the formated the date`, () => {
+ let today;
+ today = new Date();
+ today.setHours(0, 0, 0, 0);
+
$ctrl.field = today;
-
- let displayed = $filter('dateTime')(today, 'yyyy-MM-dd');
-
- expect($ctrl.value).toEqual(displayed);
- });
- });
-
- describe('options() setter', () => {
- it(`should display the date with the new format`, () => {
- $ctrl.options = {dateFormat: 'Y-m'};
- $ctrl.field = today;
-
- let displayed = $filter('dateTime')(today, 'yyyy-MM');
+ let displayed = $filter('date')(today, 'yyyy-MM-dd');
expect($ctrl.value).toEqual(displayed);
});
diff --git a/front/core/components/drop-down/drop-down.html b/front/core/components/drop-down/drop-down.html
index e9a37a675..2e4db921d 100755
--- a/front/core/components/drop-down/drop-down.html
+++ b/front/core/components/drop-down/drop-down.html
@@ -1,7 +1,8 @@
+ on-close="$ctrl.onClose()"
+ on-close-start="$ctrl.emit('closeStart')">
this.$.input.focus());
this.emit('open');
}
diff --git a/front/core/components/field/index.js b/front/core/components/field/index.js
index bc60af0d3..ed99d1f5c 100644
--- a/front/core/components/field/index.js
+++ b/front/core/components/field/index.js
@@ -11,7 +11,6 @@ export default class Field extends FormInput {
this.suffix = null;
this.control = this.element.querySelector('.control');
- this.classList = this.element.classList;
this.classList.add('vn-field');
this.element.addEventListener('click', e => this.onClick(e));
@@ -43,9 +42,11 @@ export default class Field extends FormInput {
}
set input(value) {
- if (this.input) this.control.removeChild(this.input);
+ if (this.input)
+ this.control.removeChild(this.input);
this._input = value;
- this.control.appendChild(value);
+ if (value)
+ this.control.appendChild(value);
}
get input() {
@@ -84,36 +85,8 @@ export default class Field extends FormInput {
return this.input.placeholder;
}
- set tabIndex(value) {
- this.input.tabIndex = value;
- }
-
- get tabIndex() {
- return this.input.tabIndex;
- }
-
- set disabled(value) {
- this._disabled = boolTag(value);
- this.input.disabled = this._disabled;
- this.classList.toggle('disabled', this._disabled);
- }
-
- get disabled() {
- return this._disabled;
- }
-
- set readonly(value) {
- this._readonly = boolTag(value);
- this.input.readOnly = this._readonly;
- this.classList.toggle('readonly', this._readonly);
- }
-
- get readonly() {
- return this._readonly;
- }
-
set required(value) {
- this._required = boolTag(value);
+ this._required = value;
let required = this.element.querySelector('.required');
display(required, this._required);
}
@@ -180,9 +153,13 @@ export default class Field extends FormInput {
fix.innerText = text || '';
}
+ refreshTabIndex() {
+ this.input.tabIndex = this.disabled ? -1 : this.tabIndex;
+ }
+
onClick() {
- if (event.defaultPrevented) return;
- event.preventDefault();
+ // if (event.defaultPrevented) return;
+ // event.preventDefault();
if (this.input !== document.activeElement)
this.focus();
@@ -250,15 +227,10 @@ ngModule.vnComponent('vnField', {
suffix: '@?',
hint: '@?',
error: '',
- tabIndex: '',
rule: '@?'
}
});
-function boolTag(value) {
- return Boolean(value || value === '');
-}
-
function display(element, display) {
element.style.display = display ? 'initial' : 'none';
}
diff --git a/front/core/components/field/style.scss b/front/core/components/field/style.scss
index 30b33a5df..e57b27912 100644
--- a/front/core/components/field/style.scss
+++ b/front/core/components/field/style.scss
@@ -35,7 +35,7 @@
& > .fix {
padding-top: 24px;
line-height: 24px;
- font-size: $input-font-size;
+ font-size: $font-size;
opacity: 0;
transition: opacity 200ms ease-in-out;
@@ -58,18 +58,39 @@
border: none;
font-family: Arial, sans-serif;
display: block;
- font-size: $input-font-size;
+ font-size: $font-size;
width: 100%;
background: 0;
color: inherit;
box-sizing: border-box;
min-height: 56px;
-
+ }
+ & > input {
+ position: relative;
+
+ &[type=time],
+ &[type=date],
+ &[type=password] {
+ opacity: 0;
+ transition: opacity 200ms ease-in-out;
+ cursor: pointer;
+ }
&[type=time],
&[type=date] {
clip-path: inset(0 20px 0 0);
- opacity: 0;
- transition: opacity 200ms ease-in-out;
+
+ &::-webkit-inner-spin-button,
+ &::-webkit-clear-button {
+ display: none;
+ -webkit-appearance: none;
+ }
+ &::-webkit-calendar-picker-indicator {
+ position: absolute;
+ height: 100%;
+ width: 100%;
+ opacity: 0;
+ cursor: pointer;
+ }
}
&[type=number] {
-moz-appearance: textfield;
@@ -83,6 +104,15 @@
&:invalid {
box-shadow: none;
}
+ &:-internal-autofill-selected {
+ &,
+ &:hover,
+ &:focus,
+ &:active,
+ &:valid {
+ box-shadow: 0 0 0 40px $color-bg-panel inset;
+ }
+ }
}
}
}
@@ -172,7 +202,8 @@
}
& > .control > * {
&[type=time],
- &[type=date] {
+ &[type=date],
+ &[type=password] {
opacity: 1;
}
}
@@ -214,7 +245,6 @@
}
}
& > .hint {
- z-index: -1;
padding: 4px 0;
height: 12px;
color: rgba(0, 0, 0, .4);
@@ -224,11 +254,12 @@
transition-duration: 200ms;
transition-timing-function: ease-in-out;
opacity: 0;
+ visibility: hidden;
&.filled {
- z-index: 0;
opacity: 1;
transform: translateY(0);
+ visibility: visible;
}
}
&.invalid {
diff --git a/front/core/components/float-button/float-button.html b/front/core/components/float-button/float-button.html
deleted file mode 100644
index e74a1fce7..000000000
--- a/front/core/components/float-button/float-button.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
\ No newline at end of file
diff --git a/front/core/components/float-button/float-button.js b/front/core/components/float-button/float-button.js
deleted file mode 100644
index beb3dd13b..000000000
--- a/front/core/components/float-button/float-button.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import ngModule from '../../module';
-
-ngModule.component('vnFloatButton', {
- template: require('./float-button.html'),
- bindings: {
- icon: '@'
- }
-});
diff --git a/front/core/components/float-button/index.js b/front/core/components/float-button/index.js
new file mode 100644
index 000000000..32ada7437
--- /dev/null
+++ b/front/core/components/float-button/index.js
@@ -0,0 +1,13 @@
+import ngModule from '../../module';
+import Button from '../button';
+
+export default class FloatButton extends Button {
+ constructor($element, $scope) {
+ super($element, $scope);
+ this.element.classList.add('round');
+ }
+}
+
+ngModule.vnComponent('vnFloatButton', {
+ controller: FloatButton
+});
diff --git a/front/core/components/form-input/index.js b/front/core/components/form-input/index.js
index 74d98079c..0a1297788 100644
--- a/front/core/components/form-input/index.js
+++ b/front/core/components/form-input/index.js
@@ -9,6 +9,11 @@ import Component from '../../lib/component';
* @property {Boolean} disabled Put component in disabled mode
*/
export default class FormInput extends Component {
+ constructor($element, $scope) {
+ super($element, $scope);
+ this.classList = this.element.classList;
+ }
+
$onInit() {
// XXX: Compatibility with old inputs
let attrs = this.$element[0].attributes;
@@ -41,6 +46,48 @@ export default class FormInput extends Component {
get name() {
return this.element.getAttribute('name');
}
+
+ set disabled(value) {
+ this._disabled = boolTag(value);
+ this.input.disabled = this._disabled;
+ this.classList.toggle('disabled', this._disabled);
+ this.refreshTabIndex();
+ }
+
+ get disabled() {
+ return this._disabled;
+ }
+
+ set readonly(value) {
+ this._readonly = boolTag(value);
+ this.input.readOnly = this._readonly;
+ this.classList.toggle('readonly', this._readonly);
+ }
+
+ get readonly() {
+ return this._readonly;
+ }
+
+ set tabIndex(value) {
+ this._tabIndex = value;
+ this.refreshTabIndex();
+ }
+
+ get tabIndex() {
+ return this._tabIndex;
+ }
+
+ select() {
+ this.input.select();
+ }
+
+ focus() {
+ this.input.focus();
+ }
+
+ refreshTabIndex() {
+ this.element.tabIndex = this.disabled ? -1 : this.tabIndex;
+ }
}
ngModule.vnComponent('vnFormInput', {
@@ -50,9 +97,14 @@ ngModule.vnComponent('vnFormInput', {
field: '=?',
name: '@?',
disabled: '',
- readonly: ''
+ readonly: '',
+ tabIndex: ''
},
require: {
ngModel: '?ngModel'
}
});
+
+function boolTag(value) {
+ return Boolean(value || value === '');
+}
diff --git a/front/core/components/icon-button/icon-button.html b/front/core/components/icon-button/icon-button.html
deleted file mode 100644
index a3c30ed84..000000000
--- a/front/core/components/icon-button/icon-button.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
\ No newline at end of file
diff --git a/front/core/components/icon-button/icon-button.js b/front/core/components/icon-button/icon-button.js
deleted file mode 100644
index ba3ccae3e..000000000
--- a/front/core/components/icon-button/icon-button.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import ngModule from '../../module';
-import './style.scss';
-
-export default class IconButton {
- constructor($element) {
- this.element = $element[0];
-
- if (this.element.getAttribute('tabindex') == null)
- this.element.tabIndex = 0;
-
- this.element.addEventListener('keyup', e => this.onKeyup(e));
- this.element.addEventListener('click', e => this.onClick(e));
- }
-
- onKeyup(event) {
- if (event.code == 'Space')
- this.onClick(event);
- }
-
- onClick(event) {
- if (event.defaultPrevented) return;
- event.preventDefault();
-
- // FIXME: Don't use Event.stopPropagation()
- let button = this.element.querySelector('button');
- if (this.disabled || button.disabled)
- event.stopImmediatePropagation();
- }
-}
-
-IconButton.$inject = ['$element'];
-ngModule.component('vnIconButton', {
- controller: IconButton,
- template: require('./icon-button.html'),
- bindings: {
- icon: '@',
- disabled: ''
- }
-});
diff --git a/front/core/components/icon-button/index.js b/front/core/components/icon-button/index.js
new file mode 100644
index 000000000..6becdc038
--- /dev/null
+++ b/front/core/components/icon-button/index.js
@@ -0,0 +1,14 @@
+import ngModule from '../../module';
+import Button from '../button';
+import './style.scss';
+
+export default class IconButton extends Button {
+ constructor($element, $scope) {
+ super($element, $scope);
+ this.design = null;
+ }
+}
+
+ngModule.vnComponent('vnIconButton', {
+ controller: IconButton
+});
diff --git a/front/core/components/icon-button/style.scss b/front/core/components/icon-button/style.scss
index 898e9fea0..c73580ad9 100644
--- a/front/core/components/icon-button/style.scss
+++ b/front/core/components/icon-button/style.scss
@@ -2,27 +2,12 @@
vn-icon-button {
@extend %clickable-light;
- outline: 0;
color: $color-main;
- display: inline-flex;
- align-items: center;
- font-size: 18pt;
- padding: .25em;
-
- & > button {
- background-color: transparent;
- display: block;
- color: inherit;
- border: 0;
- padding: 0;
- font-size: inherit;
- &:hover {
- background-color: initial;
- }
- & > vn-icon {
- display: block;
- font-size: inherit;
- }
+ & > button {
+ padding: .2em !important;
+ }
+ &:focus {
+ opacity: .6;
}
}
diff --git a/front/core/components/icon-focusable/icon-focusable.html b/front/core/components/icon-focusable/icon-focusable.html
deleted file mode 100644
index 4bd8ad78a..000000000
--- a/front/core/components/icon-focusable/icon-focusable.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/front/core/components/icon-focusable/icon-focusable.js b/front/core/components/icon-focusable/icon-focusable.js
deleted file mode 100644
index 691ee570f..000000000
--- a/front/core/components/icon-focusable/icon-focusable.js
+++ /dev/null
@@ -1,29 +0,0 @@
-import ngModule from '../../module';
-import './style.scss';
-
-export default class IconFocusable {
- constructor($element) {
- $element[0].tabIndex = 0;
- $element.on("keyup", event => this.onKeyDown(event, $element));
- }
-
- onKeyDown(event, $element) {
- if (event.defaultPrevented) return;
- if (event.keyCode == 32 || event.keyCode == 13) {
- event.preventDefault();
- $element.triggerHandler('click');
- }
- }
-}
-
-IconFocusable.$inject = ['$element'];
-ngModule.component('vnIconFocusable', {
- controller: IconFocusable,
- template: require('./icon-focusable.html'),
- bindings: {
- icon: '@',
- className: '@?',
- enabled: '',
- label: '@?'
- }
-});
diff --git a/front/core/components/icon-focusable/style.scss b/front/core/components/icon-focusable/style.scss
deleted file mode 100644
index bd32c52f1..000000000
--- a/front/core/components/icon-focusable/style.scss
+++ /dev/null
@@ -1,10 +0,0 @@
-vn-icon-focusable {
- display: inline-block;
- text-align: center;
-
- & > i,
- & > i.material-icons {
- display: block;
- font-size: inherit;
- }
-}
\ No newline at end of file
diff --git a/front/core/components/icon-menu/icon-menu.html b/front/core/components/icon-menu/icon-menu.html
deleted file mode 100644
index 93de718ff..000000000
--- a/front/core/components/icon-menu/icon-menu.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
\ No newline at end of file
diff --git a/front/core/components/icon-menu/icon-menu.js b/front/core/components/icon-menu/icon-menu.js
deleted file mode 100644
index abc94504e..000000000
--- a/front/core/components/icon-menu/icon-menu.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import ngModule from '../../module';
-import ButtonMenu from '../button-menu/button-menu';
-import './style.scss';
-
-export default class IconMenu extends ButtonMenu {
- constructor($element, $scope, $transclude) {
- super($element, $scope);
- this.$transclude = $transclude;
- this.input = this.element.querySelector('.button');
- }
-}
-IconMenu.$inject = ['$element', '$scope', '$transclude'];
-
-ngModule.component('vnIconMenu', {
- template: require('./icon-menu.html'),
- bindings: {
- label: '@',
- showField: '@?',
- selection: '',
- valueField: '@?',
- selectFields: '',
- disabled: '',
- initialData: '',
- showFilter: '',
- field: '=?',
- url: '@?',
- data: '',
- where: '@?',
- order: '@?',
- limit: '',
- multiple: '',
- onChange: '&?',
- icon: '@?',
- translateFields: '',
- onOpen: '&?'
- },
- transclude: {
- tplItem: '?tplItem'
- },
- controller: IconMenu
-});
diff --git a/front/core/components/icon-menu/index.html b/front/core/components/icon-menu/index.html
new file mode 100644
index 000000000..0d59b3779
--- /dev/null
+++ b/front/core/components/icon-menu/index.html
@@ -0,0 +1,11 @@
+
+
+
\ No newline at end of file
diff --git a/front/core/components/icon-menu/index.js b/front/core/components/icon-menu/index.js
new file mode 100644
index 000000000..0549149a8
--- /dev/null
+++ b/front/core/components/icon-menu/index.js
@@ -0,0 +1,14 @@
+import ngModule from '../../module';
+import ButtonMenu from '../button-menu';
+
+export default class IconMenu extends ButtonMenu {
+ constructor($element, $scope) {
+ super($element, $scope);
+ this.element.classList.add('flat');
+ }
+}
+
+ngModule.vnComponent('vnIconMenu', {
+ template: require('./index.html'),
+ controller: IconMenu
+});
diff --git a/front/core/components/icon-menu/style.scss b/front/core/components/icon-menu/style.scss
deleted file mode 100644
index df7a5e331..000000000
--- a/front/core/components/icon-menu/style.scss
+++ /dev/null
@@ -1,8 +0,0 @@
-vn-icon-menu {
- cursor: pointer;
-
- vn-drop-down {
- font-family: 'vn-font';
- outline: 0
- }
-}
\ No newline at end of file
diff --git a/front/core/components/index.js b/front/core/components/index.js
index 0433744f6..50c1a1bf8 100644
--- a/front/core/components/index.js
+++ b/front/core/components/index.js
@@ -10,36 +10,35 @@ import './subtitle/subtitle';
import './spinner/spinner';
import './snackbar/snackbar';
import './tooltip/tooltip';
-import './icon-menu/icon-menu';
-import './button-menu/button-menu';
import './popover/popover';
import './drop-down/drop-down';
import './menu/menu';
import './multi-check/multi-check';
-import './button/button';
-import './icon-button/icon-button';
-import './submit/submit';
import './card/card';
-import './float-button/float-button';
import './step-control/step-control';
import './label-value/label-value';
import './pagination/pagination';
import './searchbar/searchbar';
import './scroll-up/scroll-up';
import './autocomplete';
+import './button';
+import './button-menu';
import './calendar';
import './check';
import './chip';
-import './color-legend';
import './data-viewer';
import './date-picker';
import './field';
+import './float-button';
+import './icon-menu';
+import './icon-button';
import './input-number';
-import './input-range';
+import './range';
import './input-time';
import './input-file';
import './list';
import './radio';
+import './submit';
import './table';
import './td-editable';
import './textarea';
diff --git a/front/core/components/input-file/index.html b/front/core/components/input-file/index.html
index 4e9c48631..58a2bea0c 100644
--- a/front/core/components/input-file/index.html
+++ b/front/core/components/input-file/index.html
@@ -1,42 +1,53 @@
-
-
-
-
-
+
+
+
+
+
+
+
-
+ type="file"
+ ng-model="$ctrl.files"
+ accept="{{$ctrl.accept}}">
+
-
-
-
-
- info_outline
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/front/core/components/input-file/index.js b/front/core/components/input-file/index.js
index d0f93e4f8..3a0066e75 100644
--- a/front/core/components/input-file/index.js
+++ b/front/core/components/input-file/index.js
@@ -1,15 +1,13 @@
import ngModule from '../../module';
-import Input from '../../lib/input';
+import FormInput from '../form-input';
import './style.scss';
-export default class InputFile extends Input {
+export default class InputFile extends FormInput {
constructor($element, $scope) {
super($element, $scope);
- this.element = $element[0];
- this.hasFocus = false;
this._multiple = false;
this._value = 'Select a file';
-
+ this.input = this.element.querySelector('input');
this.registerEvents();
}
@@ -106,26 +104,12 @@ export default class InputFile extends Input {
}
}
-InputFile.$inject = ['$element', '$scope'];
-
-ngModule.component('vnInputFile', {
+ngModule.vnComponent('vnInputFile', {
template: require('./index.html'),
controller: InputFile,
- transclude: {
- leftIcons: '?tLeftIcons',
- rightIcons: '?tRightIcons'
- },
bindings: {
- label: '@?',
- name: '@?',
- disabled: '',
multiple: '',
- required: '@?',
accept: '@?',
- rule: '@?',
- files: '=model',
- validate: '&',
- onChange: '&',
- onClear: '&'
+ files: '=model'
}
});
diff --git a/front/core/components/input-file/style.scss b/front/core/components/input-file/style.scss
index c5dd8922b..b0d5d50ca 100644
--- a/front/core/components/input-file/style.scss
+++ b/front/core/components/input-file/style.scss
@@ -7,159 +7,7 @@ vn-input-file {
padding: 4px 0;
outline: 0
}
- input {
- display: none !important
- }
- margin: 20px 0;
- display: inline-block;
- width: 100%;
-
- & > .container {
- width: 100%;
- position: relative;
- padding-bottom: 2px;
- display: flex;
-
- & > .textField {
- width: 100%;
- display: flex;
- align-items: center;
- position: relative;
- padding-top: 4px;
- }
- }
-
- .leftIcons, .rightIcons, .suffix {
- display: flex;
- color: $color-font-secondary;
-
- .material-icons {
- font-size: 20px !important
- }
- }
-
- .suffix vn-icon-button {
- padding: 0
- }
-
- t-left-icons {
- padding-right: 0.5em
- }
-
- t-right-icons {
- padding-left: 0.5em
- }
-
- .infix {
- position: relative;
- display: block;
- flex: auto;
- width: 100%;
- min-width: 0;
- }
- i.clear {
- visibility: hidden;
- cursor: pointer;
- outline: 0;
-
- &:hover {
- color: #222;
- }
- }
- &:hover i.clear {
- visibility: visible;
- }
- i.visible {
- visibility: visible;
- }
- label {
- position: absolute;
- bottom: 0;
- left: 0;
- padding: 4px 0!important;
- pointer-events: none;
- color: $color-font-secondary;
- transition-duration: .2s;
- transition-timing-function: cubic-bezier(.4,0,.2,1);
- }
- &.not-empty label{
- bottom: 24px;
- color: $color-main;
- padding: 0;
- font-size: 12px;
- }
- input {
- outline: none;
- border: none;
- font-family: "Helvetica", "Arial", sans-serif;
- display: block;
- font-size: 16px;
- width: 100%;
- background: 0 0;
- color: inherit;
- padding: 4px;
- box-sizing: border-box;
- border-bottom: 0!important;
-
- &[type=number] {
- -moz-appearance: textfield;
- &::-webkit-outer-spin-button,
- &::-webkit-inner-spin-button {
- -webkit-appearance: none;
- margin: 0;
- }
- }
- &:invalid {
- box-shadow: none;
- }
- }
- .underline {
- position: absolute;
- bottom: 0;
- height: 1px;
- content: ' ';
- pointer-events: none;
- width: 100%;
- background-color: $color-input-underline;
- }
- .selected.underline {
- background-color: $color-main;
- height: 2px;
- left: 50%;
- width: 0px !important;
- transition-duration: 0.2s;
- transition-timing-function: cubic-bezier(.4,0,.2,1);
- }
-
- div.selected {
- &.container{
- border-bottom: 0px;
- }
- label {
- bottom: 24px;
- color: $color-main;
- font-size: 12px;
- }
- .selected.underline{
- left: 0;
- width: 100%!important;
- }
- }
- & > div.container > div.textField > div.infix.invalid {
- @extend div.selected;
-
- & > span.mdl-textfield__error {
- visibility: visible;
- }
- & > label {
- color: #d50000;
- }
- }
- .infix.invalid + .underline {
- background-color: #d50000;
- }
-
- label span:nth-child(2) {
- color: $color-alert
+ input[type=file] {
+ display: none;
}
}
\ No newline at end of file
diff --git a/front/core/components/input-range/index.html b/front/core/components/input-range/index.html
deleted file mode 100644
index 649e4de9f..000000000
--- a/front/core/components/input-range/index.html
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/front/core/components/input-range/index.js b/front/core/components/input-range/index.js
deleted file mode 100644
index 8cfd898c7..000000000
--- a/front/core/components/input-range/index.js
+++ /dev/null
@@ -1,79 +0,0 @@
-import ngModule from '../../module';
-import Input from '../../lib/input';
-import './style.scss';
-
-export default class inputRange extends Input {
- constructor($element, $scope) {
- super($element, $scope);
- this.mdlElement = this.element.querySelector('.mdl-slider');
- componentHandler.upgradeElement(this.mdlElement);
- this.mdlElement.addEventListener('change', () => {
- this._value = this.input.value;
- this.$.$applyAsync();
- if (this._value && this.onChange)
- this.emit('change', {value: this._value});
- });
- }
-
- get value() {
- return this._value;
- }
-
- set value(value) {
- this._value = value;
- this.mdlElement.MaterialSlider.change(value);
- }
-
- get max() {
- return this.input.max;
- }
-
- set max(value) {
- this.input.max = value;
- }
-
- get min() {
- return this.input.min;
- }
-
- set min(value) {
- this.input.min = value;
- }
-
- get step() {
- return this.input.step;
- }
-
- set step(value) {
- this.input.step = value;
- }
-
- get() {
- return this._model;
- }
-
- set model(value) {
- this._model = value;
- }
-
- set disabled(value) {
- this.input.disabled = value;
- }
-}
-
-inputRange.$inject = ['$element', '$scope'];
-
-ngModule.component('vnInputRange', {
- template: require('./index.html'),
- controller: inputRange,
- bindings: {
- label: '@?',
- disabled: '',
- min: '',
- max: '',
- step: '',
- value: '=',
- model: '=',
- onChange: '&'
- }
-});
diff --git a/front/core/components/input-range/style.scss b/front/core/components/input-range/style.scss
deleted file mode 100644
index fc6943e70..000000000
--- a/front/core/components/input-range/style.scss
+++ /dev/null
@@ -1,14 +0,0 @@
-@import "variables";
-vn-input-range {
- label {
- color: $color-main;
- font-size: 12px;
- padding: 0 25px;
- }
- label.min-label, label.max-label {
- color: $color-font;
- }
- label.max-label {
- float: right;
- }
-}
\ No newline at end of file
diff --git a/front/core/components/input-time/index.js b/front/core/components/input-time/index.js
index 9c6ae0e4a..d77ccbec2 100644
--- a/front/core/components/input-time/index.js
+++ b/front/core/components/input-time/index.js
@@ -15,7 +15,7 @@ export default class InputTime extends Field {
}
set field(value) {
- this.input.value = this.$filter('dateTime')(value, 'HH:mm');
+ this.input.value = this.$filter('date')(value, 'HH:mm');
super.field = value;
}
@@ -25,7 +25,10 @@ export default class InputTime extends Field {
if (value) {
let split = value.split(':').map(i => parseInt(i) || null);
- date = new Date(this.field || null);
+
+ date = this.field instanceof Date
+ ? this.field
+ : new Date(this.field || null);
date.setHours(split[0], split[1], 0, 0);
}
diff --git a/front/core/components/input-time/index.spec.js b/front/core/components/input-time/index.spec.js
index f1ab14b50..0ab0fc762 100644
--- a/front/core/components/input-time/index.spec.js
+++ b/front/core/components/input-time/index.spec.js
@@ -24,7 +24,7 @@ describe('Component vnInputTime', () => {
it(`should display the formated the date`, () => {
let date = new Date();
$ctrl.field = date;
- let displayed = $filter('dateTime')(date, 'HH:mm');
+ let displayed = $filter('date')(date, 'HH:mm');
expect($ctrl.value).toEqual(displayed);
});
diff --git a/front/core/components/list/style.scss b/front/core/components/list/style.scss
index 7560d3288..0786cacf8 100644
--- a/front/core/components/list/style.scss
+++ b/front/core/components/list/style.scss
@@ -24,11 +24,10 @@
vn-icon-button {
opacity: .4;
- color: $color-main;
margin-left: .5em;
transition: opacity 250ms ease-out;
padding: 0;
- font-size: 2em;
+ font-size: 1.2em;
&:hover {
opacity: 1;
diff --git a/front/core/components/multi-check/multi-check.js b/front/core/components/multi-check/multi-check.js
index 63f89f84e..d354c9eef 100644
--- a/front/core/components/multi-check/multi-check.js
+++ b/front/core/components/multi-check/multi-check.js
@@ -1,5 +1,5 @@
import ngModule from '../../module';
-import Input from '../../lib/input';
+import FormInput from '../form-input';
import './style.scss';
/**
@@ -8,7 +8,7 @@ import './style.scss';
* @param {Array} data List of options shown in drop-down
* @param {Array} models Elements to check / unCheck
*/
-export default class MultiCheck extends Input {
+export default class MultiCheck extends FormInput {
constructor($element, $scope) {
super($element, $scope);
this._checked = false;
diff --git a/front/core/components/popover/popover.js b/front/core/components/popover/popover.js
index af6edb79a..39b44e206 100644
--- a/front/core/components/popover/popover.js
+++ b/front/core/components/popover/popover.js
@@ -109,6 +109,7 @@ export default class Popover extends Component {
this.showTimeout = null;
this.element.style.display = 'none';
this.document.body.removeChild(this.element);
+ this.emit('close');
}, 250);
this.document.removeEventListener('keydown', this.docKeyDownHandler);
@@ -118,7 +119,7 @@ export default class Popover extends Component {
this.bgMouseDownHandler = null;
if (this.deregisterCallback) this.deregisterCallback();
- this.emit('close');
+ this.emit('closeStart');
}
/**
diff --git a/front/core/components/range/index.html b/front/core/components/range/index.html
new file mode 100644
index 000000000..ea35db58a
--- /dev/null
+++ b/front/core/components/range/index.html
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/front/core/components/range/index.js b/front/core/components/range/index.js
new file mode 100644
index 000000000..80410875a
--- /dev/null
+++ b/front/core/components/range/index.js
@@ -0,0 +1,50 @@
+import ngModule from '../../module';
+import FormInput from '../form-input';
+import './style.scss';
+
+export default class Range extends FormInput {
+ constructor($element, $scope) {
+ super($element, $scope);
+ this.input = this.element.querySelector('input');
+ }
+
+ get max() {
+ return this.input.max;
+ }
+
+ set max(value) {
+ this.input.max = value;
+ }
+
+ get min() {
+ return this.input.min;
+ }
+
+ set min(value) {
+ this.input.min = value;
+ }
+
+ get step() {
+ return this.input.step;
+ }
+
+ set step(value) {
+ this.input.step = value;
+ }
+
+ refreshTabIndex() {
+ this.input.tabIndex = this.disabled ? -1 : this.tabIndex;
+ }
+}
+
+ngModule.vnComponent('vnRange', {
+ template: require('./index.html'),
+ controller: Range,
+ bindings: {
+ min: '',
+ max: '',
+ step: '',
+ minLabel: '@?',
+ maxLabel: '@?'
+ }
+});
diff --git a/front/core/components/range/style.scss b/front/core/components/range/style.scss
new file mode 100644
index 000000000..878035f3a
--- /dev/null
+++ b/front/core/components/range/style.scss
@@ -0,0 +1,84 @@
+@import "variables";
+
+@mixin range($thumb-selector, $track-selector) {
+ &::#{$thumb-selector} {
+ -webkit-appearance: none;
+ margin-top: -5px;
+ border-radius: 50%;
+ background: $color-main;
+ border: none;
+ height: 12px;
+ width: 12px;
+ border-radius: 50%;
+ transition-property: transform, box-shadow;
+ transition-duration: 250ms;
+ transition-timing-function: ease-out;
+ }
+ &:focus::#{$thumb-selector} {
+ box-shadow: 0 0 0 10px rgba($color-main, .2);
+ }
+ &:active::#{$thumb-selector} {
+ transform: scale(1.5);
+ box-shadow: none;
+ }
+ &:disabled::#{$thumb-selector} {
+ transform: none;
+ cursor: initial;
+ }
+ &::#{$track-selector} {
+ width: 100%;
+ height: 3px;
+ cursor: inherit;
+ background: $color-secondary;
+ border-radius: 2px;
+ border: none;
+ }
+}
+
+vn-range {
+ & > label {
+ font-size: 12px;
+
+ &.main {
+ color: $color-main;
+ }
+ &.min-label {
+ float: left;
+ }
+ &.max-label {
+ float: right;
+ }
+ }
+ & > input {
+ cursor: pointer;
+ height: 30px;
+ display: block;
+ width: 100%;
+ background: transparent;
+ border-color: transparent;
+ -webkit-appearance: none;
+ margin: .2em 0;
+
+ &:focus {
+ outline: none;
+ }
+ &::-moz-focus-outer {
+ border: 0;
+ }
+ @include range(
+ "-moz-range-thumb",
+ "-moz-range-track"
+ );
+ @include range(
+ "-webkit-slider-thumb",
+ "-webkit-slider-runnable-track"
+ );
+ @include range(
+ "-ms-thumb",
+ "-ms-track"
+ );
+ &:disabled {
+ cursor: initial;
+ }
+ }
+}
diff --git a/front/core/components/scroll-up/scroll-up.html b/front/core/components/scroll-up/scroll-up.html
index 3f3b309d5..a3748acc6 100644
--- a/front/core/components/scroll-up/scroll-up.html
+++ b/front/core/components/scroll-up/scroll-up.html
@@ -1,5 +1,6 @@
-
\ No newline at end of file
+ vn-tooltip="Go up"
+ class="round">
+
\ No newline at end of file
diff --git a/front/core/components/scroll-up/style.scss b/front/core/components/scroll-up/style.scss
index 0d5cd6c58..1bf7ea982 100644
--- a/front/core/components/scroll-up/style.scss
+++ b/front/core/components/scroll-up/style.scss
@@ -1,6 +1,6 @@
vn-scroll-up {
- top: 5em;
- right: 2.5em;
+ top: 5.5em;
+ right: 2em;
display: none;
position: fixed;
}
\ No newline at end of file
diff --git a/front/core/components/searchbar/searchbar.html b/front/core/components/searchbar/searchbar.html
index c231b9752..069a9411c 100644
--- a/front/core/components/searchbar/searchbar.html
+++ b/front/core/components/searchbar/searchbar.html
@@ -1,6 +1,6 @@
\ No newline at end of file
diff --git a/modules/client/front/descriptor/index.js b/modules/client/front/descriptor/index.js
index 1eecdc15a..04d619f50 100644
--- a/modules/client/front/descriptor/index.js
+++ b/modules/client/front/descriptor/index.js
@@ -13,6 +13,10 @@ class Controller {
callback.call(this);
}
+ get client() {
+ return this._client;
+ }
+
set client(value) {
this._client = value;
@@ -32,10 +36,6 @@ class Controller {
};
}
- get client() {
- return this._client;
- }
-
set quicklinks(value = {}) {
this._quicklinks = Object.assign(value, this._quicklinks);
}
diff --git a/modules/client/front/dms/index/index.html b/modules/client/front/dms/index/index.html
index 0c936234c..1f306dc88 100644
--- a/modules/client/front/dms/index/index.html
+++ b/modules/client/front/dms/index/index.html
@@ -70,7 +70,7 @@
{{::document.dms.worker.user.nickname | dashIfEmpty}}
- {{::document.dms.created | dateTime:'dd/MM/yyyy HH:mm'}}
+ {{::document.dms.created | date:'dd/MM/yyyy HH:mm'}}
-
+ label="Country"
+ rule>
-
+ label="Province"
+ rule>
diff --git a/modules/client/front/greuge/index/index.html b/modules/client/front/greuge/index/index.html
index 5932a66a9..51f31338f 100644
--- a/modules/client/front/greuge/index/index.html
+++ b/modules/client/front/greuge/index/index.html
@@ -36,7 +36,7 @@
- {{::greuge.shipped | dateTime:'dd/MM/yyyy HH:mm' }}
+ {{::greuge.shipped | date:'dd/MM/yyyy HH:mm' }}
{{::greuge.description}}
{{::greuge.greugeType.name}}
{{::greuge.amount | currency: 'EUR': 2}}
diff --git a/modules/client/front/index/index.html b/modules/client/front/index/index.html
index 602ef8600..64be81a29 100644
--- a/modules/client/front/index/index.html
+++ b/modules/client/front/index/index.html
@@ -6,7 +6,7 @@
data="clients">
-
+
{{::mandate.id}}
{{::mandate.company.code}}
{{::mandate.mandateType.name}}
- {{::mandate.created | dateTime:'dd/MM/yyyy HH:mm' }}
- {{::mandate.finished | dateTime:'dd/MM/yyyy HH:mm' || '-'}}
+ {{::mandate.created | date:'dd/MM/yyyy HH:mm' }}
+ {{::mandate.finished | date:'dd/MM/yyyy HH:mm' || '-'}}
diff --git a/modules/client/front/note/index/index.html b/modules/client/front/note/index/index.html
index db9ba0818..04bd7d28e 100644
--- a/modules/client/front/note/index/index.html
+++ b/modules/client/front/note/index/index.html
@@ -15,7 +15,7 @@
class="note vn-pa-sm border-solid border-radius vn-mb-md">
{{::note.worker.user.nickname}}
- {{::note.created | dateTime:'dd/MM/yyyy HH:mm'}}
+ {{::note.created | date:'dd/MM/yyyy HH:mm'}}
{{::note.text}}
diff --git a/modules/client/front/recovery/index/index.html b/modules/client/front/recovery/index/index.html
index 9e4345025..755556f37 100644
--- a/modules/client/front/recovery/index/index.html
+++ b/modules/client/front/recovery/index/index.html
@@ -33,8 +33,8 @@
ng-click="$ctrl.setFinished(recovery)">
- {{::recovery.started | dateTime:'dd/MM/yyyy' }}
- {{recovery.finished | dateTime:'dd/MM/yyyy' }}
+ {{::recovery.started | date:'dd/MM/yyyy' }}
+ {{recovery.finished | date:'dd/MM/yyyy' }}
{{::recovery.amount | currency: 'EUR': 0}}
{{::recovery.period}}
diff --git a/modules/client/front/sample/index/index.html b/modules/client/front/sample/index/index.html
index 2d7f63ba7..49be184f3 100644
--- a/modules/client/front/sample/index/index.html
+++ b/modules/client/front/sample/index/index.html
@@ -23,7 +23,7 @@
- {{::sample.created | dateTime:'dd/MM/yyyy HH:mm' }}
+ {{::sample.created | date:'dd/MM/yyyy HH:mm' }}
{{::sample.type.description}}
diff --git a/modules/client/front/summary/index.html b/modules/client/front/summary/index.html
index 2fae69572..eccf45873 100644
--- a/modules/client/front/summary/index.html
+++ b/modules/client/front/summary/index.html
@@ -192,7 +192,7 @@
+ value="{{$ctrl.summary.recovery.started | date:'dd/MM/yyyy'}}">
diff --git a/modules/client/front/web-payment/index.html b/modules/client/front/web-payment/index.html
index 326945c21..7f6042759 100644
--- a/modules/client/front/web-payment/index.html
+++ b/modules/client/front/web-payment/index.html
@@ -36,7 +36,7 @@
{{::transaction.id}}
- {{::transaction.created | dateTime:'dd/MM/yyyy HH:mm'}}
+ {{::transaction.created | date:'dd/MM/yyyy HH:mm'}}
{{::transaction.amount | currency: 'EUR':2}}
{
case 'companyFk':
case 'issued':
case 'dued':
+ param = `i.${param}`;
return {[param]: value};
}
});
diff --git a/modules/invoiceOut/front/descriptor/index.html b/modules/invoiceOut/front/descriptor/index.html
index 211560d28..f84b90d41 100644
--- a/modules/invoiceOut/front/descriptor/index.html
+++ b/modules/invoiceOut/front/descriptor/index.html
@@ -21,7 +21,7 @@
{{$ctrl.invoiceOut.ref}}
+ value="{{$ctrl.invoiceOut.issued | date: 'dd/MM/yyyy'}}">
@@ -33,24 +33,9 @@
value="{{$ctrl.invoiceOut.company.code}}">
-
+
+
-
-
-
-
-
-
+
+
+
+
@@ -39,7 +37,7 @@
class="clickable vn-tr searchResult"
ui-sref="invoiceOut.card.summary({id: {{::invoiceOut.id}}})">
{{::invoiceOut.ref | dashIfEmpty}}
- {{::invoiceOut.issued | dateTime:'dd/MM/yyyy' | dashIfEmpty}}
+ {{::invoiceOut.issued | date:'dd/MM/yyyy' | dashIfEmpty}}
{{::invoiceOut.amount | currency: 'EUR': 2 | dashIfEmpty}}
- {{::invoiceOut.created | dateTime:'dd/MM/yyyy' | dashIfEmpty}}
+ {{::invoiceOut.created | date:'dd/MM/yyyy' | dashIfEmpty}}
{{::invoiceOut.companyCode | dashIfEmpty}}
- {{::invoiceOut.dued | dateTime:'dd/MM/yyyy' | dashIfEmpty}}
+ {{::invoiceOut.dued | date:'dd/MM/yyyy' | dashIfEmpty}}
+ value="{{$ctrl.summary.invoiceOut.issued | date: 'dd/MM/yyyy'}}">
+ value="{{$ctrl.summary.invoiceOut.dued | date: 'dd/MM/yyyy'}}">
+ value="{{$ctrl.summary.invoiceOut.created | date: 'dd/MM/yyyy'}}">
+ value="{{$ctrl.summary.invoiceOut.booked | date: 'dd/MM/yyyy'}}">
@@ -66,7 +66,7 @@
{{ticket.nickname}}
- {{ticket.shipped | dateTime: 'dd/MM/yyyy'}}
+ {{ticket.shipped | date: 'dd/MM/yyyy'}}
{{ticket.total | currency: 'EUR': 2}}
diff --git a/modules/item/back/methods/item/regularize.js b/modules/item/back/methods/item/regularize.js
index 17f1dbe1e..b9aa0d85f 100644
--- a/modules/item/back/methods/item/regularize.js
+++ b/modules/item/back/methods/item/regularize.js
@@ -105,15 +105,18 @@ module.exports = Self => {
async function getTicketId(params, options) {
- const currentDate = new Date();
- currentDate.setHours(null, null, null);
+ const minDate = new Date();
+ minDate.setHours(0, 0, 0, 0);
+
+ const maxDate = new Date();
+ maxDate.setHours(23, 59, 59, 59);
let ticket = await Self.app.models.Ticket.findOne({
where: {
addressFk: params.addressFk,
warehouseFk: params.warehouseFk,
- shipped: currentDate,
- landed: currentDate
+ shipped: {between: [minDate, maxDate]},
+ landed: {between: [minDate, maxDate]}
}
}, options);
diff --git a/modules/item/front/create/index.html b/modules/item/front/create/index.html
index d852faab7..557ccdf77 100644
--- a/modules/item/front/create/index.html
+++ b/modules/item/front/create/index.html
@@ -53,13 +53,13 @@
-
-
+
+
+
+
diff --git a/modules/item/front/descriptor/index.html b/modules/item/front/descriptor/index.html
index cd12c253f..e273b02e4 100644
--- a/modules/item/front/descriptor/index.html
+++ b/modules/item/front/descriptor/index.html
@@ -64,32 +64,9 @@
ng-class="{bright: $ctrl.item.isActive == false}">
-
+
+
- {{::sale.date | dateTime:'dd/MM/yyyy' }}
+ {{::sale.date | date:'dd/MM/yyyy' }}
diff --git a/modules/item/front/diary/index.js b/modules/item/front/diary/index.js
index a15c32644..e128369a2 100644
--- a/modules/item/front/diary/index.js
+++ b/modules/item/front/diary/index.js
@@ -52,24 +52,31 @@ class Controller {
get freeLineIndex() {
let lines = this.$scope.model.data;
- let currentDate = new Date();
- currentDate.setHours(0, 0, 0);
+ let minDate = new Date();
+ minDate.setHours(0, 0, 0, 0);
+
+ let maxDate = new Date();
+ maxDate.setHours(23, 59, 59, 59);
+
for (let i = 0; i < lines.length; i++) {
- let isFutureDate = new Date(lines[i].date) >= currentDate;
+ const dated = new Date(lines[i].date);
- if (isFutureDate)
+ let isForFuture = dated > maxDate;
+ let isForToday = (dated >= minDate && dated <= maxDate);
+
+ if (isForFuture || isForToday)
return i;
}
}
get onPreparationLineIndex() {
let lines = this.$scope.model.data;
-
for (let i = this.freeLineIndex; i >= 0; i--) {
let line = lines[i];
+
let currentDate = new Date();
- currentDate.setHours(0, 0, 0);
+ currentDate.setHours(0, 0, 0, 0);
let isPastDate = new Date(lines[i].date) < currentDate;
let isPicked = line.alertLevel == 1 && line.isPicked;
@@ -95,6 +102,7 @@ class Controller {
let selectedTicketLineIndex = this.givenTicketIndex;
let lineIndex = this.onPreparationLineIndex;
+
let lines = body.querySelector('vn-tbody').children;
if (lineIndex == undefined || !lines.length) return;
@@ -120,7 +128,6 @@ class Controller {
offsetTop = onPreparationLine.offsetTop - headerHeight;
this.$window.scrollTo(0, offsetTop);
-
this.ticketFk = null;
}
diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html
index aae3b0660..2f53c9c08 100644
--- a/modules/item/front/index/index.html
+++ b/modules/item/front/index/index.html
@@ -6,15 +6,13 @@
data="items">
-
-
-
+
+
+ suggested-filter="{isActive: true}">
{{entry.warehouse| dashIfEmpty}}
- {{entry.landed | dateTime:'dd/MM/yyyy HH:mm'}}
+ {{entry.landed | date:'dd/MM/yyyy HH:mm'}}
{{entry.entryFk | dashIfEmpty}}
{{entry.price2 | dashIfEmpty}}
{{entry.price3 | dashIfEmpty}}
diff --git a/modules/item/front/last-entries/style.scss b/modules/item/front/last-entries/style.scss
index 63ffcb35b..6188daabc 100644
--- a/modules/item/front/last-entries/style.scss
+++ b/modules/item/front/last-entries/style.scss
@@ -15,10 +15,6 @@ vn-item-last-entries {
}
vn-date-picker {
flex: none !important;
-
- .mdl-textfield{
- width: 400px !important;
- }
}
@media screen and (max-width: 1440px) {
.expendable {
diff --git a/modules/item/front/request-search-panel/index.html b/modules/item/front/request-search-panel/index.html
index 8e15be8fb..999bfd500 100644
--- a/modules/item/front/request-search-panel/index.html
+++ b/modules/item/front/request-search-panel/index.html
@@ -16,7 +16,7 @@
+ order="shipped DESC, isOk ASC">
+ on-response="$ctrl.denyRequest(response)">
-
+ Specify the reasons to deny this request
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/modules/item/front/request/index.js b/modules/item/front/request/index.js
index f887be9a8..c18800001 100644
--- a/modules/item/front/request/index.js
+++ b/modules/item/front/request/index.js
@@ -9,8 +9,23 @@ export default class Controller {
this.$ = $;
this.vnApp = vnApp;
this._ = $translate;
- if (!$stateParams.q)
- this.filter = {isOk: false, mine: true};
+ if (!$stateParams.q) {
+ const today = new Date();
+ today.setHours(23, 59, 59, 59);
+
+ const lastWeek = new Date();
+ lastWeek.setHours(0, 0, 0, 0);
+ lastWeek.setDate(lastWeek.getDate() - 7);
+
+ this.filter = {
+ where: {
+ isOk: false,
+ mine: true,
+ from: lastWeek,
+ to: today
+ }
+ };
+ }
}
$postLink() {
@@ -21,7 +36,7 @@ export default class Controller {
getState(isOk) {
if (isOk === null)
return 'Nueva';
- else if (isOk === -1 || isOk === 1)
+ else if (isOk === -1 || isOk)
return 'Aceptada';
else
return 'Denegada';
@@ -34,14 +49,12 @@ export default class Controller {
quantity: request.saleQuantity
};
- let endpoint = `/api/TicketRequests/${request.id}/confirm`;
+ let query = `/api/TicketRequests/${request.id}/confirm`;
+ this.$http.post(query, params).then(res => {
+ request.itemDescription = res.data.concept;
+ request.isOk = true;
- this.$http.post(endpoint, params).then(() => {
this.vnApp.showSuccess(this._.instant('Data saved!'));
- this.$.model.refresh();
- }).catch( e => {
- this.$.model.refresh();
- throw e;
});
}
}
@@ -56,10 +69,7 @@ export default class Controller {
this.$http.patch(endpoint, params).then(() => {
this.vnApp.showSuccess(this._.instant('Data saved!'));
- }).catch( e => {
- this.$.model.refresh();
- throw e;
- });
+ }).then(() => this.confirmRequest(request));
} else
this.confirmRequest(request);
}
@@ -86,7 +96,7 @@ export default class Controller {
}
showDenyReason(event, requestId) {
- this.denyRequestId = requestId;
+ this.selectedRequest = requestId;
this.$.denyReason.parent = event.target;
this.$.denyReason.show();
document.querySelector('vn-item-request vn-textarea textArea').focus();
@@ -96,17 +106,21 @@ export default class Controller {
delete this.denyRequestId;
}
- denyRequest() {
+ denyRequest(response) {
+ if (response !== 'ACCEPT') return;
+
let params = {
observation: this.denyObservation
};
- let endpoint = `/api/TicketRequests/${this.denyRequestId}/deny`;
+ let query = `/api/TicketRequests/${this.selectedRequest.id}/deny`;
+ this.$http.post(query, params).then(res => {
+ const request = res.data;
+ this.selectedRequest.isOk = request.isOk;
+ this.selectedRequest.attenderFk = request.attenderFk;
+ this.selectedRequest.response = request.response;
- this.$http.post(endpoint, params).then(() => {
this.vnApp.showSuccess(this._.instant('Data saved!'));
- this.$.model.refresh();
- this.$.denyReason.hide();
this.denyObservation = null;
});
}
diff --git a/modules/item/front/request/index.spec.js b/modules/item/front/request/index.spec.js
index e27bc3879..1704c61a1 100644
--- a/modules/item/front/request/index.spec.js
+++ b/modules/item/front/request/index.spec.js
@@ -53,15 +53,15 @@ describe('Item', () => {
let model = controller.$.model;
spyOn(model, 'refresh');
+ const expectedResult = {concept: 'Melee Weapon'};
let request = {itemFk: 1, saleQuantity: 1, id: 1};
- $httpBackend.when('POST', `/api/TicketRequests/${request.id}/confirm`).respond();
- $httpBackend.expect('POST', `/api/TicketRequests/${request.id}/confirm`).respond();
+ $httpBackend.when('POST', `/api/TicketRequests/${request.id}/confirm`).respond(expectedResult);
+ $httpBackend.expect('POST', `/api/TicketRequests/${request.id}/confirm`).respond(expectedResult);
controller.confirmRequest(request);
$httpBackend.flush();
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
- expect($scope.model.refresh).toHaveBeenCalledWith();
});
});
@@ -110,20 +110,17 @@ describe('Item', () => {
describe('denyRequest()', () => {
it(`should perform a query and call vnApp.showSuccess(), refresh(), hide() and set denyObservation to null in the controller`, () => {
spyOn(controller.vnApp, 'showSuccess');
- let model = controller.$.model;
- spyOn(model, 'refresh');
- spyOn(controller.$.denyReason, 'hide');
- controller.denyRequestId = 1;
+ const request = {id: 1};
+ const expectedResult = {isOk: false, attenderFk: 106, response: 'Denied!'};
+ controller.selectedRequest = request;
- $httpBackend.when('POST', `/api/TicketRequests/${controller.denyRequestId}/deny`).respond();
- $httpBackend.expect('POST', `/api/TicketRequests/${controller.denyRequestId}/deny`).respond();
- controller.denyRequest();
+ $httpBackend.when('POST', `/api/TicketRequests/${request.id}/deny`).respond(expectedResult);
+ $httpBackend.expect('POST', `/api/TicketRequests/${request.id}/deny`).respond(expectedResult);
+ controller.denyRequest('ACCEPT');
$httpBackend.flush();
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
- expect($scope.model.refresh).toHaveBeenCalledWith();
- expect($scope.denyReason.hide).toHaveBeenCalledWith();
});
});
});
diff --git a/modules/item/front/request/locale/es.yml b/modules/item/front/request/locale/es.yml
index 760f30bd3..33710a327 100644
--- a/modules/item/front/request/locale/es.yml
+++ b/modules/item/front/request/locale/es.yml
@@ -1,5 +1,6 @@
Discard: Descartar
-Indicate the reasons to deny this request: Indique las razones para descartar esta peticion
+Specify the reasons to deny this request: Especifica las razones para descartar la petición
Buy requests: Peticiones de compra
Search request by id or alias: Buscar peticiones por identificador o alias
-Sale quantity: C. conseguida
\ No newline at end of file
+Requested: Solicitado
+Achieved: Conseguido
\ No newline at end of file
diff --git a/modules/item/front/search-panel/index.js b/modules/item/front/search-panel/index.js
index 458382a99..a722fb1fc 100644
--- a/modules/item/front/search-panel/index.js
+++ b/modules/item/front/search-panel/index.js
@@ -2,8 +2,8 @@ import ngModule from '../module';
import SearchPanel from 'core/components/searchbar/search-panel';
class Controller extends SearchPanel {
- constructor($scope) {
- super();
+ constructor($scope, $element) {
+ super($scope, $element);
this.$ = $scope;
this.moreFields = [
{field: 'id'},
@@ -58,8 +58,6 @@ class Controller extends SearchPanel {
}
}
-Controller.$inject = ['$scope'];
-
ngModule.component('vnItemSearchPanel', {
template: require('./index.html'),
controller: Controller
diff --git a/modules/item/front/summary/index.html b/modules/item/front/summary/index.html
index 4a1e4fb56..a3ab3d8ae 100644
--- a/modules/item/front/summary/index.html
+++ b/modules/item/front/summary/index.html
@@ -2,11 +2,9 @@
{{$ctrl.item.id}} - {{$ctrl.summary.item.name}}
-
-
-
+
Visible
diff --git a/modules/item/front/tags/index.js b/modules/item/front/tags/index.js
index b187e5baf..c5e120d82 100644
--- a/modules/item/front/tags/index.js
+++ b/modules/item/front/tags/index.js
@@ -66,7 +66,7 @@ class Controller {
this.$scope.watcher.check();
this.$scope.model.save().then(() => {
this.$scope.watcher.notifySaved();
- this.$scope.model.refresh();
+ this.$scope.watcher.updateOriginalData();
this.card.reload();
});
}
diff --git a/modules/order/front/descriptor/index.html b/modules/order/front/descriptor/index.html
index dcc9b16de..fd83d5c71 100644
--- a/modules/order/front/descriptor/index.html
+++ b/modules/order/front/descriptor/index.html
@@ -31,7 +31,7 @@
value="{{$ctrl.order.client.salesPerson.user.nickname}}">
+ value="{{$ctrl.order.landed | date: 'dd/MM/yyyy' }}">
@@ -46,32 +46,9 @@
value="{{$ctrl.order.total | currency: 'EUR': 2}}">
-
+
+
-
+
+ class="colored">
{{$ctrl.category.value}}
+ class="colored">
{{$ctrl.type.value}}
+ class="colored">
{{::tag.value}}
-
+
\ No newline at end of file
diff --git a/modules/order/front/filter/index.js b/modules/order/front/filter/index.js
index 4305f2506..780bf798b 100644
--- a/modules/order/front/filter/index.js
+++ b/modules/order/front/filter/index.js
@@ -151,7 +151,7 @@ class Controller {
this.$panelScope = this.$scope.$new();
this.$panel = this.$compile(``)(this.$panelScope);
- const panel = this.$panel.isolateScope().$ctrl;
+ const panel = this.$panel[0].$ctrl;
panel.filter = this.filter;
panel.onSubmit = filter => this.onPanelSubmit(filter);
diff --git a/modules/order/front/filter/style.scss b/modules/order/front/filter/style.scss
index 52125ace6..0cac5765f 100644
--- a/modules/order/front/filter/style.scss
+++ b/modules/order/front/filter/style.scss
@@ -39,10 +39,12 @@ vn-catalog-filter > div {
}
}
.chips {
+ display: flex;
flex-wrap: wrap;
padding: $spacing-md;
+ overflow: hidden;
+ max-width: 100%;
}
-
vn-autocomplete[vn-id="type"] .list {
max-height: 20em
}
diff --git a/modules/order/front/index/index.html b/modules/order/front/index/index.html
index 5a01182b9..c6a817742 100644
--- a/modules/order/front/index/index.html
+++ b/modules/order/front/index/index.html
@@ -6,7 +6,7 @@
order="landed DESC, clientFk">
-
+
{{::order.sourceApp}}
- {{::order.created | dateTime: 'dd/MM/yyyy HH:mm'}}
+ {{::order.created | date: 'dd/MM/yyyy HH:mm'}}
{{::order.landed | date:'dd/MM/yyyy'}}
{{::order.companyCode}}
{{::order.total | currency: 'EUR': 2 | dashIfEmpty}}
diff --git a/modules/order/front/line/index.html b/modules/order/front/line/index.html
index cbf492dbf..cdff9b35c 100644
--- a/modules/order/front/line/index.html
+++ b/modules/order/front/line/index.html
@@ -48,7 +48,7 @@
{{::row.warehouse.name}}
- {{::row.shipped | dateTime: 'dd/MM/yyyy'}}
+ {{::row.shipped | date: 'dd/MM/yyyy'}}
{{::row.quantity}}
{{::row.price | currency: 'EUR':2}}
diff --git a/modules/order/front/prices-popover/index.html b/modules/order/front/prices-popover/index.html
index 3a7f34462..a88e027ac 100644
--- a/modules/order/front/prices-popover/index.html
+++ b/modules/order/front/prices-popover/index.html
@@ -1,13 +1,11 @@
@@ -74,32 +72,9 @@
-
+
+
+ value="{{$ctrl.summary.created | date: 'dd/MM/yyyy HH:mm'}}">
+ value="{{$ctrl.summary.confirmed | date: 'dd/MM/yyyy HH:mm'}}">
diff --git a/modules/route/back/methods/route/filter.js b/modules/route/back/methods/route/filter.js
index 1ea962bed..eeeef1dac 100644
--- a/modules/route/back/methods/route/filter.js
+++ b/modules/route/back/methods/route/filter.js
@@ -85,10 +85,13 @@ module.exports = Self => {
return {'r.m3': value};
case 'description':
return {'r.description': {like: `%${value}%`}};
- case 'workerFk':
case 'warehouseFk':
+ param = `v.${param}`;
+ return {[param]: value};
+ case 'workerFk':
case 'vehicleFk':
case 'agencyModeFk':
+ param = `r.${param}`;
return {[param]: value};
}
});
diff --git a/modules/route/back/methods/route/specs/filter.spec.js b/modules/route/back/methods/route/specs/filter.spec.js
index ba32c956c..a4742c128 100644
--- a/modules/route/back/methods/route/specs/filter.spec.js
+++ b/modules/route/back/methods/route/specs/filter.spec.js
@@ -117,6 +117,6 @@ describe('Route filter()', () => {
let result = await app.models.Route.filter(ctx);
- expect(result.length).toEqual(4);
+ expect(result.length).toEqual(1);
});
});
diff --git a/modules/route/back/methods/route/specs/getTickets.spec.js b/modules/route/back/methods/route/specs/getTickets.spec.js
index 3888156b6..15028309f 100644
--- a/modules/route/back/methods/route/specs/getTickets.spec.js
+++ b/modules/route/back/methods/route/specs/getTickets.spec.js
@@ -4,6 +4,6 @@ describe('route getTickets()', () => {
it('should return the tickets for a given route', async() => {
let result = await app.models.Route.getTickets(2);
- expect(result.length).toEqual(4);
+ expect(result.length).toEqual(1);
});
});
diff --git a/modules/route/back/methods/route/specs/guessPriority.spec.js b/modules/route/back/methods/route/specs/guessPriority.spec.js
index cc536787a..075ea05c8 100644
--- a/modules/route/back/methods/route/specs/guessPriority.spec.js
+++ b/modules/route/back/methods/route/specs/guessPriority.spec.js
@@ -1,7 +1,7 @@
const app = require('vn-loopback/server/server');
describe('route guessPriority()', () => {
- const targetRouteId = 2;
+ const targetRouteId = 7;
let routeTicketsToRestore;
afterAll(async done => {
@@ -17,25 +17,23 @@ describe('route guessPriority()', () => {
it('should confirm the tickets in the target route have no priority yet', async() => {
routeTicketsToRestore = await app.models.Ticket.find({where: {routeFk: targetRouteId}});
- expect(routeTicketsToRestore.length).toEqual(4);
+ expect(routeTicketsToRestore.length).toEqual(2);
+
+ expect(routeTicketsToRestore[0].id).toEqual(23);
expect(routeTicketsToRestore[0].priority).toBeNull();
- expect(routeTicketsToRestore[0].id).toEqual(7);
+ expect(routeTicketsToRestore[1].id).toEqual(24);
expect(routeTicketsToRestore[1].priority).toBeNull();
- expect(routeTicketsToRestore[1].id).toEqual(8);
- expect(routeTicketsToRestore[2].priority).toBeNull();
- expect(routeTicketsToRestore[2].id).toEqual(9);
});
it('should call guessPriority() and then check the tickets in the target route now have their priorities defined', async() => {
await app.models.Route.guessPriority(targetRouteId);
let routeTickets = await app.models.Ticket.find({where: {routeFk: targetRouteId}, fields: ['id', 'priority']});
- expect(routeTickets.length).toEqual(4);
- expect(routeTickets[0].priority).toEqual(1);
- expect(routeTickets[0].id).toEqual(7);
- expect(routeTickets[1].priority).toEqual(3);
- expect(routeTickets[1].id).toEqual(8);
- expect(routeTickets[2].priority).toEqual(2);
- expect(routeTickets[2].id).toEqual(9);
+ expect(routeTickets.length).toEqual(2);
+
+ expect(routeTickets[0].id).toEqual(23);
+ expect(routeTickets[0].priority).toEqual(3);
+ expect(routeTickets[1].id).toEqual(24);
+ expect(routeTickets[1].priority).toEqual(1);
});
});
diff --git a/modules/route/back/methods/route/specs/summary.spec.js b/modules/route/back/methods/route/specs/summary.spec.js
index 5b31ff19f..ba976ae94 100644
--- a/modules/route/back/methods/route/specs/summary.spec.js
+++ b/modules/route/back/methods/route/specs/summary.spec.js
@@ -11,7 +11,7 @@ describe('route summary()', () => {
const result = await app.models.Route.summary(1);
const agency = result.route.agencyMode();
- expect(agency.name).toEqual('Silla247');
+ expect(agency.name).toEqual('inhouse pickup');
});
it(`should return a summary object containing it's vehicle`, async() => {
@@ -31,6 +31,6 @@ describe('route summary()', () => {
it(`should return a summary object containing data from the tickets`, async() => {
const result = await app.models.Route.summary(2);
- expect(result.tickets.length).toEqual(4);
+ expect(result.tickets.length).toEqual(1);
});
});
diff --git a/modules/route/back/methods/route/specs/updateVolume.spec.js b/modules/route/back/methods/route/specs/updateVolume.spec.js
index 75ee3c139..a1ff67acc 100644
--- a/modules/route/back/methods/route/specs/updateVolume.spec.js
+++ b/modules/route/back/methods/route/specs/updateVolume.spec.js
@@ -10,8 +10,8 @@ describe('route updateVolume()', () => {
afterAll(async done => {
- await originalRoute.updateAttributes({m3: 2.7});
- await ticketToRestore.updateAttributes({routeFk: 2});
+ await originalRoute.updateAttributes({m3: 1.8});
+ await ticketToRestore.updateAttributes({routeFk: null});
await app.models.RouteLog.destroyById(logIdToDestroy);
done();
});
@@ -19,12 +19,12 @@ describe('route updateVolume()', () => {
it('should confirm the original volume of the route is the expected', async() => {
originalRoute = await app.models.Route.findById(routeId);
- expect(originalRoute.m3).toEqual(2.7);
+ expect(originalRoute.m3).toEqual(1.8);
});
it('should confirm the route volume is updated when a ticket is added', async() => {
- ticketToRestore = await app.models.Ticket.findById(8);
- let updatedTicket = await app.models.Ticket.findById(8);
+ ticketToRestore = await app.models.Ticket.findById(14);
+ let updatedTicket = await app.models.Ticket.findById(14);
await updatedTicket.updateAttributes({routeFk: routeId});
await app.models.Route.updateVolume(ctx, routeId);
@@ -36,8 +36,9 @@ describe('route updateVolume()', () => {
it('should confirm the change is logged', async() => {
let logs = await app.models.RouteLog.find({fields: ['id', 'newInstance']});
+
let m3Log = logs.filter(log => {
- return log.newInstance.m3 === 3.1;
+ return log.newInstance.m3 === 1.9;
});
logIdToDestroy = m3Log[0].id;
diff --git a/modules/route/front/descriptor/index.html b/modules/route/front/descriptor/index.html
index 2e141e52e..312985cb4 100644
--- a/modules/route/front/descriptor/index.html
+++ b/modules/route/front/descriptor/index.html
@@ -24,7 +24,7 @@
value="{{$ctrl.route.id}}">
+ value="{{$ctrl.route.created | date: 'dd/MM/yyyy'}}">
@@ -46,32 +46,9 @@
ng-class="{bright: $ctrl.route.m3 > $ctrl.route.vehicle.m3 && $ctrl.route.vehicle.m3 != NULL}">
-
+
+
-
+
{{::route.agencyName | dashIfEmpty}}
{{::route.vehiclePlateNumber | dashIfEmpty}}
- {{::route.created | dateTime:'dd/MM/yyyy' | dashIfEmpty}}
+ {{::route.created | date:'dd/MM/yyyy' | dashIfEmpty}}
{{::route.m3 | dashIfEmpty}}
{{::route.description | dashIfEmpty}}
diff --git a/modules/route/front/summary/index.html b/modules/route/front/summary/index.html
index 85a045106..0ec6c47fe 100644
--- a/modules/route/front/summary/index.html
+++ b/modules/route/front/summary/index.html
@@ -6,7 +6,7 @@
value="{{$ctrl.summary.route.id}}">
+ value="{{$ctrl.summary.route.created | date: 'dd/MM/yyyy'}}">
@@ -23,10 +23,10 @@
+ value="{{$ctrl.summary.route.time | date: 'HH:MM'}}">
+ value="{{$ctrl.summary.route.finished | date: 'HH:MM'}}">
diff --git a/modules/ticket/back/methods/ticket-request/confirm.js b/modules/ticket/back/methods/ticket-request/confirm.js
index 92dd06dae..53fb2527c 100644
--- a/modules/ticket/back/methods/ticket-request/confirm.js
+++ b/modules/ticket/back/methods/ticket-request/confirm.js
@@ -38,27 +38,27 @@ module.exports = Self => {
try {
let options = {transaction: tx};
- let item = await models.Item.findById(ctx.args.itemFk);
+ let item = await models.Item.findById(ctx.args.itemFk, null, options);
if (!item)
throw new UserError(`That item doesn't exists`);
let request = await models.TicketRequest.findById(ctx.args.id, {
include: {relation: 'ticket'}
- });
+ }, options);
let [[stock]] = await Self.rawSql(`CALL vn.getItemVisibleAvailable(?,?,?,?)`, [
ctx.args.itemFk,
request.ticket().shipped,
request.ticket().warehouseFk,
false
- ]);
+ ], options);
if (stock.available < 0)
throw new UserError(`This item is not available`);
if (request.saleFk) {
- sale = await models.Sale.findById(request.saleFk);
+ sale = await models.Sale.findById(request.saleFk, null, options);
sale.updateAttributes({
itemFk: ctx.args.itemFk,
quantity: ctx.args.quantity,
@@ -71,7 +71,11 @@ module.exports = Self => {
quantity: ctx.args.quantity,
concept: item.name
}, options);
- request.updateAttributes({saleFk: sale.id, itemFk: sale.itemFk, isOk: true}, options);
+ request.updateAttributes({
+ saleFk: sale.id,
+ itemFk: sale.itemFk,
+ isOk: true
+ }, options);
}
query = `CALL vn.ticketCalculateSale(?)`;
@@ -86,6 +90,8 @@ module.exports = Self => {
}, options);
await tx.commit();
+
+ return sale;
} catch (error) {
await tx.rollback();
throw error;
diff --git a/modules/ticket/back/methods/ticket-request/deny.js b/modules/ticket/back/methods/ticket-request/deny.js
index 817c90782..e663ef1bc 100644
--- a/modules/ticket/back/methods/ticket-request/deny.js
+++ b/modules/ticket/back/methods/ticket-request/deny.js
@@ -29,7 +29,7 @@ module.exports = Self => {
let params = {
isOk: false,
- atenderFk: worker.id,
+ attenderFk: worker.id,
response: ctx.args.observation,
};
diff --git a/modules/ticket/back/methods/ticket-request/filter.js b/modules/ticket/back/methods/ticket-request/filter.js
index 40c1f7652..82e1ee8e0 100644
--- a/modules/ticket/back/methods/ticket-request/filter.js
+++ b/modules/ticket/back/methods/ticket-request/filter.js
@@ -28,7 +28,7 @@ module.exports = Self => {
type: 'Number',
description: `Search by warehouse`
}, {
- arg: 'atenderFk',
+ arg: 'attenderFk',
type: 'Number',
description: `Search requests atended by the given worker`
}, {
@@ -65,7 +65,7 @@ module.exports = Self => {
let worker = await Self.app.models.Worker.findOne({where: {userFk: userId}});
if (ctx.args.mine)
- ctx.args.atenderFk = worker.id;
+ ctx.args.attenderFk = worker.id;
let where = buildFilter(ctx.args, (param, value) => {
switch (param) {
@@ -75,7 +75,7 @@ module.exports = Self => {
: {'t.nickname': {like: `%${value}%`}};
case 'ticketFk':
return {'t.id': value};
- case 'atenderFk':
+ case 'attenderFk':
return {'tr.atenderFk': value};
case 'isOk':
return {'tr.isOk': value};
@@ -106,13 +106,13 @@ module.exports = Self => {
tr.ticketFk,
tr.quantity,
tr.price,
- tr.atenderFk,
+ tr.atenderFk attenderFk,
tr.description,
tr.response,
tr.saleFk,
tr.isOk,
s.quantity AS saleQuantity,
- s.itemFK,
+ s.itemFk,
i.name AS itemDescription,
t.shipped,
t.nickname,
diff --git a/modules/ticket/back/methods/ticket-request/specs/confirm.spec.js b/modules/ticket/back/methods/ticket-request/specs/confirm.spec.js
index 574469d86..2383fe560 100644
--- a/modules/ticket/back/methods/ticket-request/specs/confirm.spec.js
+++ b/modules/ticket/back/methods/ticket-request/specs/confirm.spec.js
@@ -1,27 +1,14 @@
const app = require('vn-loopback/server/server');
describe('ticket-request confirm()', () => {
- let request;
- let sale;
+ let originalRequest;
+ let originalSale;
let createdSaleId;
afterAll(async done => {
- const paramsForRequest = {
- saleFk: request.saleFk,
- isOk: request.isOk,
- itemFk: request.itemFk,
- ticketFk: request.ticketFk
- };
-
- const paramsForSale = {
- itemFk: sale.itemFk,
- quantity: sale.quantity,
- concept: sale.concept,
- };
-
- await request.updateAttributes(paramsForRequest);
- await sale.updateAttributes(paramsForSale);
- app.models.Sale.destroyById(createdSaleId);
+ await originalRequest.updateAttributes(originalRequest);
+ await originalSale.updateAttributes(originalSale);
+ await app.models.Sale.destroyById(createdSaleId);
done();
});
@@ -65,10 +52,11 @@ describe('ticket-request confirm()', () => {
const itemId = 1;
const quantity = 10;
- request = await app.models.TicketRequest.findById(requestId);
- sale = await app.models.Sale.findById(saleId);
+ originalRequest = await app.models.TicketRequest.findById(requestId);
+ originalSale = await app.models.Sale.findById(saleId);
- request.updateAttributes({saleFk: saleId});
+ const request = await app.models.TicketRequest.findById(requestId);
+ await request.updateAttributes({saleFk: saleId});
let ctx = {req: {accessToken: {userId: 9}}, args: {
itemFk: itemId,
@@ -89,7 +77,8 @@ describe('ticket-request confirm()', () => {
const itemId = 1;
const quantity = 10;
- request.updateAttributes({saleFk: null});
+ const request = await app.models.TicketRequest.findById(requestId);
+ await request.updateAttributes({saleFk: null});
let ctx = {req: {accessToken: {userId: 9}}, args: {
itemFk: itemId,
diff --git a/modules/ticket/back/methods/ticket-request/specs/deny.spec.js b/modules/ticket/back/methods/ticket-request/specs/deny.spec.js
index cac63586e..04152fa21 100644
--- a/modules/ticket/back/methods/ticket-request/specs/deny.spec.js
+++ b/modules/ticket/back/methods/ticket-request/specs/deny.spec.js
@@ -5,7 +5,7 @@ describe('ticket-request deny()', () => {
afterAll(async done => {
let params = {
isOk: null,
- atenderFk: request.atenderFk,
+ attenderFk: request.attenderFk,
response: null,
};
diff --git a/modules/ticket/back/methods/ticket-request/specs/filter.spec.js b/modules/ticket/back/methods/ticket-request/specs/filter.spec.js
index 24e74e4df..329688866 100644
--- a/modules/ticket/back/methods/ticket-request/specs/filter.spec.js
+++ b/modules/ticket/back/methods/ticket-request/specs/filter.spec.js
@@ -37,7 +37,7 @@ describe('ticket-request filter()', () => {
});
it('should return the ticket request matching the atender ID', async() => {
- let ctx = {req: {accessToken: {userId: 9}}, args: {atenderFk: 35}};
+ let ctx = {req: {accessToken: {userId: 9}}, args: {attenderFk: 35}};
let result = await app.models.TicketRequest.filter(ctx);
let requestId = result[0].id;
diff --git a/modules/ticket/back/methods/ticket/isEmpty.js b/modules/ticket/back/methods/ticket/isEmpty.js
index 7f9de98b1..0465589e6 100644
--- a/modules/ticket/back/methods/ticket/isEmpty.js
+++ b/modules/ticket/back/methods/ticket/isEmpty.js
@@ -40,7 +40,8 @@ module.exports = function(Self) {
}, options);
const hasPurchaseRequests = await models.TicketRequest.count({
- ticketFk: id
+ ticketFk: id,
+ isOk: true
}, options);
const isEmpty = !hasSales && !hasPackages &&
diff --git a/modules/ticket/back/methods/ticket/uploadFile.js b/modules/ticket/back/methods/ticket/uploadFile.js
index 7c968f5c9..e5ea465cb 100644
--- a/modules/ticket/back/methods/ticket/uploadFile.js
+++ b/modules/ticket/back/methods/ticket/uploadFile.js
@@ -7,36 +7,34 @@ module.exports = Self => {
type: 'Number',
description: 'The ticket id',
http: {source: 'path'}
- },
- {
+ }, {
arg: 'warehouseId',
type: 'Number',
- description: ''
- },
- {
+ description: 'The warehouse id',
+ required: true
+ }, {
arg: 'companyId',
type: 'Number',
- description: ''
- },
- {
+ description: 'The company id',
+ required: true
+ }, {
arg: 'dmsTypeId',
type: 'Number',
- description: ''
- },
- {
+ description: 'The dms type id',
+ required: true
+ }, {
arg: 'reference',
type: 'String',
- description: ''
- },
- {
+ required: true
+ }, {
arg: 'description',
type: 'String',
- description: ''
- },
- {
+ required: true
+ }, {
arg: 'hasFile',
type: 'Boolean',
- description: ''
+ description: 'True if has an attached file',
+ required: true
}],
returns: {
type: 'Object',
diff --git a/modules/ticket/back/models/ticket-request.json b/modules/ticket/back/models/ticket-request.json
index dfb609e3c..7f1cb4b02 100644
--- a/modules/ticket/back/models/ticket-request.json
+++ b/modules/ticket/back/models/ticket-request.json
@@ -33,9 +33,12 @@
"isOk": {
"type": "Boolean"
},
- "atenderFk": {
+ "attenderFk": {
"type": "Number",
- "required": true
+ "required": true,
+ "mysql": {
+ "columnName": "atenderFk"
+ }
},
"response": {
"type": "String"
@@ -55,7 +58,7 @@
"atender": {
"type": "belongsTo",
"model": "Worker",
- "foreignKey": "atenderFk"
+ "foreignKey": "attenderFk"
},
"requester": {
"type": "belongsTo",
diff --git a/modules/ticket/front/basic-data/step-one/index.html b/modules/ticket/front/basic-data/step-one/index.html
index f545e7131..cd3ef442e 100644
--- a/modules/ticket/front/basic-data/step-one/index.html
+++ b/modules/ticket/front/basic-data/step-one/index.html
@@ -26,9 +26,12 @@
value-field="id"
ng-model="$ctrl.addressId"
order="isActive DESC">
-
- {{::isActive ? '' : 'INACTIVE'}} {{::nickname}}
- - {{::street}} - {{::city}} - {{::province.name}} - {{::agencyMode.name}}
+
+ {{::!isActive ? '(Inactive)' : ''}}
+ {{::nickname}}
+
+ , {{::street}}, {{::city}}, {{::province.name}} - {{::agencyMode.name}}
+
+ ng-model="$ctrl.shipped">
+
+
-
+
+
-
-
-
-
- {{::name}} - {{::warehouse.name}} - Max. {{::hour | dateTime: 'HH:mm'}} h.
+ {{::name}} - {{::warehouse.name}} - Max. {{::hour | date: 'HH:mm'}} h.
diff --git a/modules/ticket/front/basic-data/step-one/style.scss b/modules/ticket/front/basic-data/step-one/style.scss
index fff383a52..756d662fd 100644
--- a/modules/ticket/front/basic-data/step-one/style.scss
+++ b/modules/ticket/front/basic-data/step-one/style.scss
@@ -1,13 +1,8 @@
@import "variables";
-tpl-item{
- &.notActive {
- background-color: $color-bg;
+.vn-popover {
+ .address.inactive {
color: $color-font-secondary;
width: 100%;
}
-
- & > .inactive {
- text-transform: uppercase;
- }
}
diff --git a/modules/ticket/front/descriptor/addStowaway.html b/modules/ticket/front/descriptor/addStowaway.html
index 963c9b6c1..e46292714 100644
--- a/modules/ticket/front/descriptor/addStowaway.html
+++ b/modules/ticket/front/descriptor/addStowaway.html
@@ -25,7 +25,7 @@
{{ticket.id}}
- {{ticket.landed | dateTime: 'dd/MM/yyyy'}}
+ {{ticket.landed | date: 'dd/MM/yyyy'}}
{{ticket.agencyMode.name}}
{{ticket.warehouse.name}}
{{ticket.state.state.name}}
diff --git a/modules/ticket/front/descriptor/index.html b/modules/ticket/front/descriptor/index.html
index d830f09d9..9b981f27a 100644
--- a/modules/ticket/front/descriptor/index.html
+++ b/modules/ticket/front/descriptor/index.html
@@ -33,7 +33,7 @@
value="{{$ctrl.ticket.client.salesPerson.user.nickname}}">
+ value="{{$ctrl.ticket.shipped | date: 'dd/MM/yyyy HH:mm' }}">
@@ -72,31 +72,10 @@
ng-class="{bright: $ctrl.ticket.isDeleted == true}">
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
+
{{stowaway.id}}
- {{stowaway.ticket.landed | dateTime: 'dd/MM/yyyy'}}
+ {{stowaway.ticket.landed | date: 'dd/MM/yyyy'}}
{{stowaway.ticket.agencyMode.name}}
{{stowaway.ticket.warehouse.name}}
{{stowaway.ticket.state.state.name}}
diff --git a/modules/ticket/front/dms/index/index.html b/modules/ticket/front/dms/index/index.html
index 73607f246..1cc6d3b38 100644
--- a/modules/ticket/front/dms/index/index.html
+++ b/modules/ticket/front/dms/index/index.html
@@ -69,7 +69,7 @@
{{::document.dms.worker.user.nickname | dashIfEmpty}}
- {{::document.dms.created | dateTime:'dd/MM/yyyy HH:mm'}}
+ {{::document.dms.created | date:'dd/MM/yyyy HH:mm'}}
- {{::expedition.created | dateTime:'dd/MM/yyyy HH:mm'}}
+ {{::expedition.created | date:'dd/MM/yyyy HH:mm'}}
diff --git a/modules/ticket/front/index/index.html b/modules/ticket/front/index/index.html
index 63c43f8a7..e6c27f988 100644
--- a/modules/ticket/front/index/index.html
+++ b/modules/ticket/front/index/index.html
@@ -7,8 +7,8 @@
order="shipped DESC, zoneHour ASC, zoneMinute ASC, clientFk">
-
-
+
+
- {{::ticket.shipped | dateTime: 'dd/MM/yyyy'}}
+ {{::ticket.shipped | date: 'dd/MM/yyyy'}}
- {{::ticket.shipped | dateTime: 'HH:mm'}}
+ {{::ticket.shipped | date: 'HH:mm'}}
{{::ticket.agencyMode}}
{{::ticket.warehouse}}
{{::ticket.refFk | dashIfEmpty}}
- {{::ticket.zoneLanding | dateTime: 'HH:mm'}}
+ {{::ticket.zoneLanding | date: 'HH:mm'}}
{{::ticket.total | currency: 'EUR': 2}}
diff --git a/modules/ticket/front/index/style.scss b/modules/ticket/front/index/style.scss
index 7fed21006..30d7c11ca 100644
--- a/modules/ticket/front/index/style.scss
+++ b/modules/ticket/front/index/style.scss
@@ -1,19 +1,6 @@
@import "variables";
vn-ticket-index {
- vn-icon-menu {
- padding-top: 30px;
- padding-left: 10px;
- color: $color-main;
-
- li {
- color: initial;
- }
- }
- vn-searchbar {
- width: 100%
- }
-
@media screen and (max-width: 1440px) {
.expendable {
display: none;
diff --git a/modules/ticket/front/request/create/index.html b/modules/ticket/front/request/create/index.html
index 1b7044c20..dd10d8afe 100644
--- a/modules/ticket/front/request/create/index.html
+++ b/modules/ticket/front/request/create/index.html
@@ -18,7 +18,7 @@
{{::request.id}}
{{::request.description}}
- {{::request.created | dateTime: 'dd/MM/yyyy'}}
+ {{::request.created | date: 'dd/MM/yyyy'}}
+ ng-click="$ctrl.showWorkerDescriptor($event, request.attenderFk)">
{{::request.atender.user.nickname | dashIfEmpty}}
diff --git a/modules/ticket/front/routes.json b/modules/ticket/front/routes.json
index cda0b7536..55922fdde 100644
--- a/modules/ticket/front/routes.json
+++ b/modules/ticket/front/routes.json
@@ -216,7 +216,7 @@
"url" : "/create",
"state": "ticket.card.request.create",
"component": "vn-ticket-request-create",
- "description": "Purchase request",
+ "description": "New purchase request",
"acl": ["salesPerson"]
}, {
"url": "/create?clientFk",
diff --git a/modules/ticket/front/sale-tracking/index.html b/modules/ticket/front/sale-tracking/index.html
index f1ab0500d..950e6d7ef 100644
--- a/modules/ticket/front/sale-tracking/index.html
+++ b/modules/ticket/front/sale-tracking/index.html
@@ -57,7 +57,7 @@
{{::sale.state}}
- {{::sale.created | dateTime: 'dd/MM/yyyy HH:mm'}}
+ {{::sale.created | date: 'dd/MM/yyyy HH:mm'}}
diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html
index 6e54a6d66..b818d86e0 100644
--- a/modules/ticket/front/sale/index.html
+++ b/modules/ticket/front/sale/index.html
@@ -39,14 +39,12 @@
disabled="!$ctrl.isChecked || !$ctrl.isEditable"
ng-click="$ctrl.showRemoveLinesDialog()"
vn-tooltip="Remove lines"
- tooltip-position="up"
icon="delete">
@@ -129,7 +127,7 @@
{{sale.quantity}}
-
@@ -322,7 +320,7 @@
ng-repeat="ticket in $ctrl.transfer.lastActiveTickets track by ticket.id"
ng-click="$ctrl.transferSales(ticket.id)">
{{::ticket.id}} |
- {{::ticket.shipped | dateTime: 'dd/MM/yyyy'}} |
+ {{::ticket.shipped | date: 'dd/MM/yyyy'}} |
{{::ticket.agencyName}} |
{{::ticket.warehouseName}} |
diff --git a/modules/ticket/front/sale/style.scss b/modules/ticket/front/sale/style.scss
index fb70f0844..2a18e0920 100644
--- a/modules/ticket/front/sale/style.scss
+++ b/modules/ticket/front/sale/style.scss
@@ -5,13 +5,6 @@ vn-ticket-sale {
justify-content: space-between !important;
align-items: center;
}
-
- vn-ticket-sale {
- tr .mdl-textfield{
- width: inherit;
- max-width: 100%;
- }
- }
vn-table {
img {
border-radius: 50%;
diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html
index b1ce19f83..de8145ef1 100644
--- a/modules/ticket/front/services/index.html
+++ b/modules/ticket/front/services/index.html
@@ -20,15 +20,16 @@
show-field="name"
value-field="name"
ng-model="service.description">
+
+
+
+
-
-
{
+describe('Ticket component vnTicketService', () => {
let controller;
let $httpBackend;
let $httpParamSerializer;
diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html
index 584360121..83cdd8e40 100644
--- a/modules/ticket/front/summary/index.html
+++ b/modules/ticket/front/summary/index.html
@@ -6,6 +6,8 @@
@@ -34,10 +36,10 @@
+ value="{{$ctrl.summary.shipped | date: 'dd/MM/yyyy HH:mm'}}">
+ value="{{$ctrl.summary.landed | date: 'dd/MM/yyyy'}}">
- {{package.created | dateTime: 'dd/MM/yyyy'}}
+ {{package.created | date: 'dd/MM/yyyy'}}
{{package.packaging.item.name}}
{{package.quantity}}
@@ -178,7 +180,7 @@
{{::request.description}}
- {{::request.created | dateTime: 'dd/MM/yyyy'}}
+ {{::request.created | date: 'dd/MM/yyyy'}}
{{::request.requester.user.name}}
{{::request.atender.user.name}}
{{::request.quantity}}
diff --git a/modules/ticket/front/tracking/index/index.html b/modules/ticket/front/tracking/index/index.html
index f919a636b..a5120a064 100644
--- a/modules/ticket/front/tracking/index/index.html
+++ b/modules/ticket/front/tracking/index/index.html
@@ -28,7 +28,7 @@
{{::tracking.worker.user.nickname | dashIfEmpty}}
- {{::tracking.created | dateTime:'dd/MM/yyyy HH:mm'}}
+ {{::tracking.created | date:'dd/MM/yyyy HH:mm'}}
diff --git a/modules/ticket/front/weekly/index/index.html b/modules/ticket/front/weekly/index/index.html
index 3a251e37a..e25d115ba 100644
--- a/modules/ticket/front/weekly/index/index.html
+++ b/modules/ticket/front/weekly/index/index.html
@@ -9,7 +9,7 @@
auto-load="true">
-
+
-
+
{{::travel.ref}}
{{::travel.agency.name}}
{{::travel.warehouseOut.name}}
- {{::travel.shipped | dateTime:'dd/MM/yyyy'}}
+ {{::travel.shipped | date:'dd/MM/yyyy'}}
{{::travel.warehouseIn.name}}
- {{::travel.landed | dateTime:'dd/MM/yyyy'}}
+ {{::travel.landed | date:'dd/MM/yyyy'}}
diff --git a/modules/worker/back/methods/department/moveChild.js b/modules/worker/back/methods/department/moveChild.js
new file mode 100644
index 000000000..97206f198
--- /dev/null
+++ b/modules/worker/back/methods/department/moveChild.js
@@ -0,0 +1,42 @@
+const UserError = require('vn-loopback/util/user-error');
+
+module.exports = Self => {
+ Self.remoteMethod('moveChild', {
+ description: 'Changes the parent of a child department',
+ accessType: 'WRITE',
+ accepts: [{
+ arg: 'id',
+ type: 'Number',
+ description: 'The department id',
+ http: {source: 'path'}
+ }, {
+ arg: 'parentId',
+ type: 'Number',
+ description: 'New parent id',
+ }],
+ returns: {
+ type: 'Object',
+ root: true
+ },
+ http: {
+ path: `/:id/moveChild`,
+ verb: 'POST'
+ }
+ });
+
+ Self.moveChild = async(id, parentId = null) => {
+ const models = Self.app.models;
+ const child = await models.Department.findById(id);
+
+ if (id == parentId) return;
+
+ if (parentId) {
+ const parent = await models.Department.findById(parentId);
+
+ if (child.lft < parent.lft && child.rgt > parent.rgt)
+ throw new UserError('You cannot move a parent to its own sons');
+ }
+
+ return child.updateAttribute('parentFk', parentId);
+ };
+};
diff --git a/modules/worker/back/methods/department/specs/createChild.spec.js b/modules/worker/back/methods/department/specs/createChild.spec.js
new file mode 100644
index 000000000..305732f58
--- /dev/null
+++ b/modules/worker/back/methods/department/specs/createChild.spec.js
@@ -0,0 +1,18 @@
+const app = require('vn-loopback/server/server');
+
+describe('department createChild()', () => {
+ let createdChild;
+
+ afterAll(async done => {
+ await createdChild.destroy();
+ done();
+ });
+
+ it('should create a new child', async() => {
+ const parentId = null;
+ createdChild = await app.models.Department.createChild(parentId, 'My new department');
+
+ expect(createdChild.name).toEqual('My new department');
+ expect(createdChild.parentFk).toBeNull();
+ });
+});
diff --git a/modules/worker/back/methods/department/specs/moveChild.spec.js b/modules/worker/back/methods/department/specs/moveChild.spec.js
new file mode 100644
index 000000000..3358ebf77
--- /dev/null
+++ b/modules/worker/back/methods/department/specs/moveChild.spec.js
@@ -0,0 +1,23 @@
+const app = require('vn-loopback/server/server');
+
+describe('department moveChild()', () => {
+ let updatedChild;
+
+ afterAll(async done => {
+ const child = await app.models.Department.findById(updatedChild.id);
+ await child.updateAttribute('parentFk', null);
+ done();
+ });
+
+ it('should move a child department to a new parent', async() => {
+ const childId = 22;
+ const parentId = 1;
+
+ const child = await app.models.Department.findById(childId);
+
+ expect(child.parentFk).toBeNull();
+ updatedChild = await app.models.Department.moveChild(childId, parentId);
+
+ expect(updatedChild.parentFk).toEqual(1);
+ });
+});
diff --git a/modules/worker/back/methods/department/specs/removeChild.spec.js b/modules/worker/back/methods/department/specs/removeChild.spec.js
new file mode 100644
index 000000000..1fe3d10ef
--- /dev/null
+++ b/modules/worker/back/methods/department/specs/removeChild.spec.js
@@ -0,0 +1,21 @@
+const app = require('vn-loopback/server/server');
+
+describe('department removeChild()', () => {
+ let removedChild;
+
+ afterAll(async done => {
+ await app.models.Department.create(removedChild);
+ done();
+ });
+
+ it('should remove a child department', async() => {
+ const childId = 1;
+
+ removedChild = await app.models.Department.findById(childId);
+ const result = await app.models.Department.removeChild(childId);
+ const existsChild = await app.models.Department.findById(childId);
+
+ expect(result.count).toEqual(1);
+ expect(existsChild).toBeNull();
+ });
+});
diff --git a/modules/worker/back/methods/worker-time-control/addAutoTime.js b/modules/worker/back/methods/worker-time-control/addAutoTime.js
deleted file mode 100644
index 7d58d2c22..000000000
--- a/modules/worker/back/methods/worker-time-control/addAutoTime.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-Author : Enrique Blasco BLanquer
-Date: 27 de mayo de 2019
-*/
-module.exports = Self => {
- Self.remoteMethodCtx('addAutoTime', {
- description: 'Adds a new hour registry by app in manual 0',
- accessType: 'WRITE',
- accepts: [{
- arg: 'data',
- type: 'object',
- required: true,
- description: 'timed',
- http: {source: 'body'}
- }],
- returns: [{
- type: 'Object',
- root: true
- }],
- http: {
- path: `/addAutoTime`,
- verb: 'POST'
- }
- });
-
- Self.addAutoTime = async(ctx, data) => {
- const myUserId = ctx.req.accessToken.userId;
-
- // get all worked time control, needed to calculate order
- let hours = await Self.rawSql(`SELECT * FROM vn.workerTimeControl
- WHERE userFk = ?
- AND DATE(timed) = CURDATE()
- ORDER BY timed DESC LIMIT 1`, [myUserId]);
-
- // 1 get next order
- let order = 0;
- if (hours.length > 0)
- order = hours[hours.length - 1].order;
-
- // 2 create element in db
- return Self.create({
- userFk: myUserId,
- timed: data.timed,
- order: order + 1,
- manual: 0
- });
- };
-};
diff --git a/modules/worker/back/methods/worker-time-control/addTime.js b/modules/worker/back/methods/worker-time-control/addTime.js
index 5548654bc..8130a16fd 100644
--- a/modules/worker/back/methods/worker-time-control/addTime.js
+++ b/modules/worker/back/methods/worker-time-control/addTime.js
@@ -32,14 +32,9 @@ module.exports = Self => {
throw new UserError(`You don't have enough privileges`);
const subordinate = await Worker.findById(data.workerFk);
+ const timed = new Date(data.timed);
- return Self.create({
- userFk: subordinate.userFk,
- timed: data.timed,
- manual: 1
- });
-
- /* return Self.rawSql('CALL vn.workerTimeControl_add(?, ?, ?, ?)', [
- subordinate.userFk, null, data.timed, true]); */
+ return Self.rawSql('CALL vn.workerTimeControl_add(?, ?, ?, ?)', [
+ subordinate.userFk, null, timed, true]);
};
};
diff --git a/modules/worker/back/methods/worker-time-control/getHoursWorked.js b/modules/worker/back/methods/worker-time-control/getHoursWorked.js
deleted file mode 100644
index 315b68cd1..000000000
--- a/modules/worker/back/methods/worker-time-control/getHoursWorked.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-Author : Enrique Blasco BLanquer
-Date: 28 de mayo de 2019
-*/
-module.exports = Self => {
- Self.remoteMethodCtx('getHoursWorked', {
- description: 'Get worked hours in current week, month and year',
- accessType: 'WRITE',
- returns: [{
- type: 'Object',
- root: true
- }],
- http: {
- path: `/getHoursWorked`,
- verb: 'GET'
- }
- });
-
- Self.getHoursWorked = async(ctx, data) => {
- let totalHours = 0; // total hours worked in one year
- let totalMinutes = 0; // total minutes worked in one year
- let totalHoursMonth = 0; // total hours worked in one month
- let totalMinutesMonth = 0; // total minutes worked in one month
- let totalHoursWeek = 0; // total hours worked in one week
- let totalMinutesWeek = 0; // total minutes worked in one week
- const myUserId = ctx.req.accessToken.userId; // user id
- let today = new Date(); // needed to calculate total hours worked to current date
- let fromDate = today.getFullYear() + '-01-01'; // from date, current year
- let toDate = today.getFullYear() + '-12-31'; // to date, current year
-
-
- // 1 hours worked in a year
- let hoursYear = await Self.rawSql(`SELECT wtc.userFk, DATE(wtc.timed) dated,
- UNIX_TIMESTAMP(MIN(timed))timedStart,
- SEC_TO_TIME(SUM(if( mod(wtc.order,2)=1,
- UNIX_TIMESTAMP(timed) *-1,
- UNIX_TIMESTAMP(timed)))) timeWorkDay
- FROM vn.workerTimeControl wtc
- WHERE wtc.timed BETWEEN ? AND ? AND userFk = ?
- GROUP BY wtc.userFk,dated ORDER BY dated DESC`, [fromDate, toDate, myUserId]);
-
-
- // 2 Get days of week
- let week = [];
- // Starting Monday not Sunday
- let current = new Date();
- current.setDate((current.getDate() - current.getDay() + 1));
- for (let i = 0; i < 7; i++) {
- week.push(
- new Date(current)
- );
- current.setDate(current.getDate() + 1);
- }
-
- // 3 I have all timed control for one year... NOW I CALCULATE TOTAL HOURS IN YEAR, MONTH, WEEK, Let's GO!
- for (hour of hoursYear) {
- if (parseInt(hour.timeWorkDay.split(':')[0]) > 0) {
- // YEAR
- totalHours += parseInt(hour.timeWorkDay.split(':')[0]);
- totalMinutes += parseInt(hour.timeWorkDay.split(':')[1]);
- // If it exceeds 5 hours we add 20 minutes of breakfast.
- if (parseInt(hour.timeWorkDay.split(':')[0]) >= 5)
- totalMinutes += 20;
- // MONTH
-
- if ((new Date(hour.dated)).getMonth() == today.getMonth()) {
- totalHoursMonth += parseInt(hour.timeWorkDay.split(':')[0]);
- totalMinutesMonth += parseInt(hour.timeWorkDay.split(':')[1]);
- // If it exceeds 5 hours we add 20 minutes of breakfast.
- if (parseInt(hour.timeWorkDay.split(':')[0]) >= 5)
- totalMinutesMonth += 20;
- }
- // WEEK
- for (day of week) {
- let dayOfWeek = new Date(day);
- let dayOfCurrentWeek = new Date(hour.dated);
- if (dayOfWeek.getMonth() == dayOfCurrentWeek.getMonth() && dayOfWeek.getDate() == dayOfCurrentWeek.getDate()) {
- totalHoursWeek += parseInt(hour.timeWorkDay.split(':')[0]);
- totalMinutesWeek += parseInt(hour.timeWorkDay.split(':')[1]);
- // If it exceeds 5 hours we add 20 minutes of breakfast.
- if (parseInt(hour.timeWorkDay.split(':')[0]) >= 5)
- totalMinutesWeek += 20;
- break;
- }
- }
- }
- }
-
- // TOTAL WORKED HOURS IN THE YEAR
- totalHours += totalMinutes / 60;
- totalHours = decimalToHour(totalHours);
-
- // TOTAL WORKED HOURS IN THE MONTH
- totalHoursMonth += totalMinutesMonth / 60;
- totalHoursMonth = decimalToHour(totalHoursMonth);
-
- // TOTAL WORKED HOURS IN THE WEEK
- totalHoursWeek += totalMinutesWeek / 60;
- totalHoursWeek = decimalToHour(totalHoursWeek);
-
- return {
- 'totalWorekdYear': totalHours,
- 'totalWorekdMonth': totalHoursMonth,
- 'totalWorkedWeek': totalHoursWeek
- };
- };
-};
-
-/*
-function to calculate hours and minutes from decimal value
-*/
-function decimalToHour(value) {
- let decimalTime = parseFloat(value);
- decimalTime = decimalTime * 60 * 60;
- let hoursDay = Math.floor((decimalTime / (60 * 60)));
- decimalTime = decimalTime - (hoursDay * 60 * 60);
- let minutesDay = Math.floor((decimalTime / 60));
- return hoursDay + ':' + minutesDay;
-}
-
-
diff --git a/modules/worker/back/methods/worker-time-control/getWorkedWeek.js b/modules/worker/back/methods/worker-time-control/getWorkedWeek.js
deleted file mode 100644
index 67e864344..000000000
--- a/modules/worker/back/methods/worker-time-control/getWorkedWeek.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-Author : Enrique Blasco BLanquer
-Date: 29 de mayo de 2019
-*/
-module.exports = Self => {
- Self.remoteMethodCtx('getWorkedWeek', {
- description: 'get worked week info',
- accessType: 'WRITE',
- returns: [{
- type: 'Object',
- root: true
- }],
- http: {
- path: `/getWorkedWeek`,
- verb: 'GET'
- }
- });
-
- Self.getWorkedWeek = async(ctx, data) => {
- const myUserId = ctx.req.accessToken.userId; // user id
- let lastDate = new Date('1986-09-24'); // reference date
- let diff = 0; // difference of value between two dates
- let total = 0; // total hours
-
- // 1 Get days of week
- let week = [];
- // 2 Starting Monday not Sunday
- let current = new Date();
- current.setDate((current.getDate() - current.getDay() + 1));
- for (let i = 0; i < 7; i++) {
- week.push(
- new Date(current)
- );
- current.setDate(current.getDate() + 1);
- }
-
- let fromDate = week[0].getFullYear() + '-' + (week[0].getMonth() + 1) + '-' + week[0].getDate();
- let toDate = week[week.length - 1].getFullYear() + '-' + (week[week.length - 1].getMonth() + 1) + '-' + week[week.length - 1].getDate();
-
-
- // 3 hours worked in a current week
- let hoursWeek = await Self.rawSql(`SELECT wtc.timed ,wtc.order
- FROM vn.workerTimeControl wtc
- WHERE userFk = ?
- AND DATE(timed) BETWEEN ? AND ? ORDER BY timed DESC;`, [myUserId, fromDate, toDate]);
-
- // 4 treat data
- let isFirst = true;
- for (let i = hoursWeek.length - 1; i >= 0; i--) {
- let d = new Date(hoursWeek[i].timed);
- if (isFirst) {
- lastDate = d;
- isFirst = false;
- } else {
- if (lastDate.getDate() === d.getDate()) {
- diff += Math.abs(d.getTime() - lastDate.getTime());
- lastDate = d;
- } else {
- total += diff;
- diff = 0;
- lastDate = d;
- }
- }
- }
- total += diff;
-
- // 5 calculate hours and minutes
- let decimalTime = total / 1000 / 3600;
- decimalTime = decimalTime * 60 * 60;
- let hours = Math.floor((decimalTime / (60 * 60)));
- decimalTime = decimalTime - (hours * 60 * 60);
- let minutes = Math.floor((decimalTime / 60));
-
- return {'timeds': hoursWeek, 'totalWorked': hours + ':' + minutes};
- };
-};
-
-
diff --git a/modules/worker/back/methods/worker-time-control/specs/addAutoTime.spec.js b/modules/worker/back/methods/worker-time-control/specs/addAutoTime.spec.js
deleted file mode 100644
index bdc5d6ecb..000000000
--- a/modules/worker/back/methods/worker-time-control/specs/addAutoTime.spec.js
+++ /dev/null
@@ -1,11 +0,0 @@
-const app = require('vn-loopback/server/server');
-
-describe('workerTimeControl addAutoTime()', () => {
- it('should return an undefined value', async() => {
- let ctx = {req: {accessToken: {userId: 9}}};
- let data = {'timed': new Date()};
- let result = await app.models.WorkerTimeControl.addAutoTime(ctx, data);
-
- expect(result).toBeUndefined();
- });
-});
diff --git a/modules/worker/back/methods/worker-time-control/specs/getHoursWorked.spec.js b/modules/worker/back/methods/worker-time-control/specs/getHoursWorked.spec.js
deleted file mode 100644
index 2cfd28b77..000000000
--- a/modules/worker/back/methods/worker-time-control/specs/getHoursWorked.spec.js
+++ /dev/null
@@ -1,10 +0,0 @@
-const app = require('vn-loopback/server/server');
-
-describe('workerTimeControl getHoursWorked()', () => {
- it('should return an totalWorkedYear to be defined', async() => {
- let ctx = {req: {accessToken: {userId: 9}}};
- let result = await app.models.WorkerTimeControl.getHoursWorked(ctx, null);
-
- expect(result.totalWorekdYear).toBeDefined();
- });
-});
diff --git a/modules/worker/back/methods/worker-time-control/specs/getWorkedWeek.spec.js b/modules/worker/back/methods/worker-time-control/specs/getWorkedWeek.spec.js
deleted file mode 100644
index 4ea7bc727..000000000
--- a/modules/worker/back/methods/worker-time-control/specs/getWorkedWeek.spec.js
+++ /dev/null
@@ -1,10 +0,0 @@
-const app = require('vn-loopback/server/server');
-
-describe('workerTimeControl getWorkedWeek()', () => {
- it('should return an timeds to be defined', async() => {
- let ctx = {req: {accessToken: {userId: 9}}};
- let result = await app.models.WorkerTimeControl.getWorkedWeek(ctx, null);
-
- expect(result.timeds).toBeDefined();
- });
-});
diff --git a/modules/worker/back/model-config.json b/modules/worker/back/model-config.json
index df2b776fb..35a039d3c 100644
--- a/modules/worker/back/model-config.json
+++ b/modules/worker/back/model-config.json
@@ -49,14 +49,5 @@
},
"Device": {
"dataSource": "vn"
- },
- "UserPhoneType": {
- "dataSource": "vn"
- },
- "UserPhone": {
- "dataSource": "vn"
- },
- "UserLog": {
- "dataSource": "vn"
}
}
diff --git a/modules/worker/back/models/department.js b/modules/worker/back/models/department.js
index e6905d273..5a927fc64 100644
--- a/modules/worker/back/models/department.js
+++ b/modules/worker/back/models/department.js
@@ -2,4 +2,5 @@ module.exports = Self => {
require('../methods/department/getLeaves')(Self);
require('../methods/department/createChild')(Self);
require('../methods/department/removeChild')(Self);
+ require('../methods/department/moveChild')(Self);
};
diff --git a/modules/worker/back/models/department.json b/modules/worker/back/models/department.json
index bb5d5e943..7de76e039 100644
--- a/modules/worker/back/models/department.json
+++ b/modules/worker/back/models/department.json
@@ -16,6 +16,15 @@
},
"parentFk": {
"type": "Number"
+ },
+ "lft": {
+ "type": "Number"
+ },
+ "rgt": {
+ "type": "Number"
+ },
+ "sons": {
+ "type": "Number"
}
}
}
diff --git a/modules/worker/back/models/worker-time-control.js b/modules/worker/back/models/worker-time-control.js
index 4ec5bf8dd..4a065f430 100644
--- a/modules/worker/back/models/worker-time-control.js
+++ b/modules/worker/back/models/worker-time-control.js
@@ -3,9 +3,6 @@ const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
require('../methods/worker-time-control/filter')(Self);
require('../methods/worker-time-control/addTime')(Self);
- require('../methods/worker-time-control/addAutoTime')(Self);
- require('../methods/worker-time-control/getHoursWorked')(Self);
- require('../methods/worker-time-control/getWorkedWeek')(Self);
Self.rewriteDbError(function(err) {
if (err.code === 'ER_DUP_ENTRY')
diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json
index 7456a3caa..c5c770fcd 100644
--- a/modules/worker/back/models/worker.json
+++ b/modules/worker/back/models/worker.json
@@ -54,6 +54,12 @@
"type": "hasMany",
"model": "WorkerTeamCollegues",
"foreignKey": "workerFk"
+ },
+ "phones": {
+ "type": "hasMany",
+ "model": "UserPhone",
+ "foreignKey": "userFk",
+ "primaryKey": "userFk"
}
}
}
\ No newline at end of file
diff --git a/modules/worker/front/basic-data/index.html b/modules/worker/front/basic-data/index.html
index 7303bccc1..0ba32eff9 100644
--- a/modules/worker/front/basic-data/index.html
+++ b/modules/worker/front/basic-data/index.html
@@ -23,14 +23,6 @@
rule>
-
-
-
-
diff --git a/modules/worker/front/calendar/index.html b/modules/worker/front/calendar/index.html
index d832fa960..a8225981f 100644
--- a/modules/worker/front/calendar/index.html
+++ b/modules/worker/front/calendar/index.html
@@ -23,7 +23,14 @@
{{'of' | translate}} {{$ctrl.calendar.totalHolidays}} {{'days' | translate}}
-
+
+
+
+
+ {{legend.name}}
+
+
\ No newline at end of file
diff --git a/modules/worker/front/card/index.js b/modules/worker/front/card/index.js
index 5e1e33510..eefa6360a 100644
--- a/modules/worker/front/card/index.js
+++ b/modules/worker/front/card/index.js
@@ -40,6 +40,12 @@ class Controller {
relation: 'department'
}
}
+ }, {
+ relation: 'phones',
+ scope: {
+ fields: ['phone'],
+ order: 'typeFk ASC'
+ }
}
]
};
diff --git a/modules/worker/front/department/index.html b/modules/worker/front/department/index.html
index 5093fe570..2abb81b04 100644
--- a/modules/worker/front/department/index.html
+++ b/modules/worker/front/department/index.html
@@ -10,7 +10,10 @@
fetch-func="$ctrl.onFetch($item)"
remove-func="$ctrl.onRemove($item)"
create-func="$ctrl.onCreate($parent)"
- sort-func="$ctrl.onSort($a, $b)">
+ sort-func="$ctrl.onSort($a, $b)"
+ on-drop="$ctrl.onDrop($dropped, $dragged)"
+ on-drag-start="$ctrl.onDragStart(item)"
+ on-drag-end="$ctrl.onDragEnd(item)">
{{::item.name}}
diff --git a/modules/worker/front/department/index.js b/modules/worker/front/department/index.js
index 1a72681bc..383fee74b 100644
--- a/modules/worker/front/department/index.js
+++ b/modules/worker/front/department/index.js
@@ -23,19 +23,13 @@ class Controller {
return a.name.localeCompare(b.name);
}
- /* onDrop(item, dragged, dropped) {
- if (dropped.scope.item) {
- const droppedItem = dropped.scope.item;
- const draggedItem = dragged.scope.item;
-
- if (droppedItem.childs)
- droppedItem.childs.push(Object.assign({}, draggedItem));
-
- dragged.element.remove();
-
- this.$scope.$apply();
- }
- } */
+ onDrop(dropped, dragged) {
+ const params = dropped ? {parentId: dropped.id} : null;
+ const query = `/api/departments/${dragged.id}/moveChild`;
+ this.$http.post(query, params).then(() => {
+ this.$.treeview.move(dragged, dropped);
+ });
+ }
onCreate(parent) {
this.newChild = {
@@ -62,12 +56,8 @@ class Controller {
if (parent && parent.id)
params.parentId = parent.id;
- if (!parent.active)
- this.$.treeview.unfold(parent);
-
const query = `/api/departments/createChild`;
this.$http.post(query, params).then(res => {
- const parent = this.newChild.parent;
const item = res.data;
item.parent = parent;
diff --git a/modules/worker/front/descriptor/index.html b/modules/worker/front/descriptor/index.html
index 5bb9b22e5..26c2f193e 100644
--- a/modules/worker/front/descriptor/index.html
+++ b/modules/worker/front/descriptor/index.html
@@ -26,22 +26,16 @@
-
+
-
+
+
\ No newline at end of file
diff --git a/modules/worker/front/descriptor/index.js b/modules/worker/front/descriptor/index.js
index c8c2cb5e6..82718a29e 100644
--- a/modules/worker/front/descriptor/index.js
+++ b/modules/worker/front/descriptor/index.js
@@ -1,7 +1,41 @@
import ngModule from '../module';
+class Controller {
+ constructor($http, $state) {
+ this.$state = $state;
+ this.$http = $http;
+ }
+
+ get worker() {
+ return this._worker;
+ }
+
+ set worker(value) {
+ this._worker = value;
+
+ if (!value) return;
+
+ this._quicklinks = {
+ btnOne: {
+ icon: 'person',
+ state: `client.card.summary({id: ${value.userFk}})`,
+ tooltip: 'Go to client'
+ }
+ };
+ }
+
+ set quicklinks(value = {}) {
+ this._quicklinks = Object.assign(value, this._quicklinks);
+ }
+
+ get quicklinks() {
+ return this._quicklinks;
+ }
+}
+
ngModule.component('vnWorkerDescriptor', {
template: require('./index.html'),
+ controller: Controller,
bindings: {
worker: '<'
}
diff --git a/modules/worker/front/index.js b/modules/worker/front/index.js
index 71c529ea8..6f4a7fe34 100644
--- a/modules/worker/front/index.js
+++ b/modules/worker/front/index.js
@@ -12,3 +12,4 @@ import './department';
import './calendar';
import './time-control';
import './log';
+import './phones';
diff --git a/modules/worker/front/index/index.html b/modules/worker/front/index/index.html
index c27f3aed4..759162250 100644
--- a/modules/worker/front/index/index.html
+++ b/modules/worker/front/index/index.html
@@ -6,10 +6,9 @@
data="workers">
-
-
+
+
- {{::log.creationDate | dateTime:'dd/MM/yyyy HH:mm'}}
+ {{::log.creationDate | date:'dd/MM/yyyy HH:mm'}}
Changed by:
@@ -88,7 +88,7 @@
ng-if="!log.newProperties"
id="description">
- {{log.description}}
+ {{::log.description}}
diff --git a/modules/worker/front/phones/index.html b/modules/worker/front/phones/index.html
new file mode 100644
index 000000000..2c172bc2f
--- /dev/null
+++ b/modules/worker/front/phones/index.html
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
diff --git a/modules/worker/front/phones/index.js b/modules/worker/front/phones/index.js
new file mode 100644
index 000000000..3810832d9
--- /dev/null
+++ b/modules/worker/front/phones/index.js
@@ -0,0 +1,48 @@
+import ngModule from '../module';
+
+class Controller {
+ constructor($scope) {
+ this.$scope = $scope;
+ }
+
+ get worker() {
+ return this._worker;
+ }
+
+ set worker(value) {
+ this._worker = value;
+ if (value)
+ this.setLink(value);
+ }
+
+ setLink(value) {
+ this.$scope.$applyAsync(()=> {
+ this.$scope.model.link = {userFk: value.userFk};
+ this.$scope.model.refresh();
+ });
+ }
+
+ onSubmit() {
+ this.$scope.watcher.check();
+ this.$scope.model.save().then(() => {
+ this.$scope.watcher.updateOriginalData();
+ this.$scope.watcher.notifySaved();
+ this.card.reload();
+ });
+ }
+
+ add() {
+ this.$scope.model.insert();
+ }
+}
+
+Controller.$inject = ['$scope'];
+
+ngModule.component('vnWorkerPhones', {
+ template: require('./index.html'),
+ controller: Controller,
+ require: {card: '^vnWorkerCard'},
+ bindings: {
+ worker: '<'
+ }
+});
diff --git a/modules/worker/front/phones/index.spec.js b/modules/worker/front/phones/index.spec.js
new file mode 100644
index 000000000..0b3e9dc11
--- /dev/null
+++ b/modules/worker/front/phones/index.spec.js
@@ -0,0 +1,26 @@
+import './index';
+
+describe('Component vnWorkerPhones', () => {
+ let controller;
+
+ beforeEach(angular.mock.module('worker', $translateProvider => {
+ $translateProvider.translations('en', {});
+ }));
+
+ beforeEach(angular.mock.inject(($componentController, $rootScope) => {
+ let $scope = $rootScope.$new();
+ controller = $componentController('vnWorkerPhones', $scope);
+ controller.$scope.model = {link: 1};
+ controller.$scope.$applyAsync = () => {};
+ }));
+
+ describe('setLink()', () => {
+ it('set the link in the model and refreshes it', () => {
+ spyOn(controller.$scope, '$applyAsync');
+ let value = {userFk: 106};
+ controller.setLink(value);
+
+ expect(controller.$scope.$applyAsync).toHaveBeenCalledWith(jasmine.any(Function));
+ });
+ });
+});
diff --git a/modules/worker/front/phones/locale/es.yml b/modules/worker/front/phones/locale/es.yml
new file mode 100644
index 000000000..8628f38ee
--- /dev/null
+++ b/modules/worker/front/phones/locale/es.yml
@@ -0,0 +1,4 @@
+Phones: Teléfonos
+Type: Tipo
+Remove phone: Eliminar teléfono
+Add phone: Añadir teléfono
\ No newline at end of file
diff --git a/modules/worker/front/routes.json b/modules/worker/front/routes.json
index 1b4f9ec2a..e2fa9c165 100644
--- a/modules/worker/front/routes.json
+++ b/modules/worker/front/routes.json
@@ -7,7 +7,8 @@
{"state": "worker.card.basicData", "icon": "settings"},
{"state": "worker.card.pbx", "icon": "icon-pbx"},
{"state": "worker.card.calendar", "icon": "icon-calendar"},
- {"state": "worker.card.timeControl", "icon": "access_time"}
+ {"state": "worker.card.timeControl", "icon": "access_time"},
+ {"state": "worker.card.phones", "icon": "contact_phone"}
],
"routes": [
{
@@ -79,6 +80,15 @@
"state": "worker.department",
"component": "vn-worker-department",
"description": "Departments"
+ },
+ {
+ "url": "/phones",
+ "state": "worker.card.phones",
+ "component": "vn-worker-phones",
+ "description": "Phones",
+ "params": {
+ "worker": "$ctrl.worker"
+ }
}
]
}
\ No newline at end of file
diff --git a/modules/worker/front/summary/index.html b/modules/worker/front/summary/index.html
index e2c93ea48..de86c1f84 100644
--- a/modules/worker/front/summary/index.html
+++ b/modules/worker/front/summary/index.html
@@ -12,8 +12,9 @@
-
+
diff --git a/modules/worker/front/summary/index.js b/modules/worker/front/summary/index.js
index 24656d601..f9f4e688b 100644
--- a/modules/worker/front/summary/index.js
+++ b/modules/worker/front/summary/index.js
@@ -50,6 +50,12 @@ class Controller {
relation: 'department'
}
}
+ }, {
+ relation: 'phones',
+ scope: {
+ fields: ['phone'],
+ order: 'typeFk ASC'
+ }
}
]
};
diff --git a/modules/worker/front/time-control/index.html b/modules/worker/front/time-control/index.html
index a00ebab45..7eaed4ec5 100644
--- a/modules/worker/front/time-control/index.html
+++ b/modules/worker/front/time-control/index.html
@@ -27,7 +27,7 @@
icon="arrow_{{($index % 2) == 0 ? 'forward' : 'back'}}"
title="{{(($index % 2) == 0 ? 'In' : 'Out') | translate}}">
- {{hour.timed | dateTime: 'HH:mm'}}
+ {{hour.timed | date: 'HH:mm'}}
diff --git a/print/config/print.json b/print/config/print.json
index cb98421fc..7ad2e1316 100755
--- a/print/config/print.json
+++ b/print/config/print.json
@@ -5,6 +5,13 @@
"senderMail": "nocontestar@verdnatura.es",
"senderName": "Verdnatura"
},
+ "pdf": {
+ "format": "A4",
+ "border": "1.5cm",
+ "footer": {
+ "height": "55px"
+ }
+ },
"mysql": {
"host": "localhost",
"port": 3306,
diff --git a/print/config/routes.json b/print/config/routes.json
index e658f4cc4..58d46193c 100644
--- a/print/config/routes.json
+++ b/print/config/routes.json
@@ -17,6 +17,7 @@
{"type": "report", "name": "rpt-zone"},
{"type": "report", "name": "rpt-route"},
{"type": "report", "name": "rpt-lcr"},
+ {"type": "report", "name": "rpt-item-label"},
{"type": "static", "name": "email-header"},
{"type": "static", "name": "email-footer"},
{"type": "static", "name": "report-header"},
diff --git a/print/lib/reportEngine.js b/print/lib/reportEngine.js
index c95779592..3e634ae54 100644
--- a/print/lib/reportEngine.js
+++ b/print/lib/reportEngine.js
@@ -4,6 +4,7 @@ const renderer = require('vue-server-renderer').createRenderer();
const fs = require('fs-extra');
const pdf = require('html-pdf');
const juice = require('juice');
+const config = require('./config');
Vue.use(VueI18n);
@@ -99,13 +100,11 @@ module.exports = {
async toPdf(name, ctx) {
const html = await this.render(name, ctx);
- const options = {
- format: 'A4',
- border: '1.5cm',
- footer: {
- height: '55px',
- }
- };
+ let options = config.pdf;
+
+ const optionsPath = `${this.path}/${name}/options.json`;
+ if (fs.existsSync(optionsPath))
+ options = Object.assign(options, require(optionsPath));
return new Promise(resolve => {
pdf.create(html, options).toStream((err, stream) => {
diff --git a/print/package.json b/print/package.json
index bb7c32a3e..0332817c2 100755
--- a/print/package.json
+++ b/print/package.json
@@ -18,6 +18,7 @@
"juice": "^5.0.1",
"mysql2": "^1.6.5",
"nodemailer": "^4.7.0",
+ "qrcode": "^1.4.2",
"strftime": "^0.10.0",
"vue": "^2.6.7",
"vue-i18n": "^8.8.2",
diff --git a/print/report/rpt-item-label/assets/css/index.js b/print/report/rpt-item-label/assets/css/index.js
new file mode 100644
index 000000000..515dea750
--- /dev/null
+++ b/print/report/rpt-item-label/assets/css/index.js
@@ -0,0 +1,8 @@
+const CssReader = require(`${appPath}/lib/cssReader`);
+
+module.exports = new CssReader([
+ `${appPath}/common/css/layout.css`,
+ `${appPath}/common/css/report.css`,
+ `${appPath}/common/css/misc.css`,
+ `${__dirname}/style.css`])
+ .mergeStyles();
diff --git a/print/report/rpt-item-label/assets/css/style.css b/print/report/rpt-item-label/assets/css/style.css
new file mode 100644
index 000000000..1101604b9
--- /dev/null
+++ b/print/report/rpt-item-label/assets/css/style.css
@@ -0,0 +1,88 @@
+* {
+ box-sizing: border-box;
+}
+.label {
+ font-size: 1.2em;
+}
+
+.barcode {
+ float: left;
+ width: 40%;
+}
+
+.barcode h1 {
+ text-align: center;
+ font-size: 1.8em;
+ margin: 0 0 10px 0
+}
+
+.barcode .image {
+ text-align: center
+}
+
+.barcode .image img {
+ width: 170px
+}
+
+.data {
+ float: left;
+ width: 60%;
+}
+
+.data .header {
+ background-color: #000;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ overflow: hidden;
+ margin-bottom: 25px;
+ text-align: right;
+ font-size: 1.2em;
+ padding: 0.2em;
+ color: #FFF
+}
+
+.data .color,
+.data .producer {
+ text-transform: uppercase;
+ text-align: right;
+ font-size: 1.5em;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ overflow: hidden;
+}
+
+.data .producer {
+ text-justify: inter-character;
+}
+
+.data .details {
+ border-top: 4px solid #000;
+ padding-top: 2px;
+}
+
+.data .details .package {
+ padding-right: 5px;
+ float: left;
+ width: 50%;
+}
+
+.package .packing,
+.package .dated,
+.package .labelNumber {
+ text-align: right
+}
+
+.package .packing {
+ font-size: 1.8em;
+ font-weight: 400
+}
+
+.data .details .size {
+ background-color: #000;
+ text-align: center;
+ font-size: 3em;
+ padding: 0.2em 0;
+ float: left;
+ width: 50%;
+ color: #FFF
+}
\ No newline at end of file
diff --git a/print/report/rpt-item-label/index.html b/print/report/rpt-item-label/index.html
new file mode 100644
index 000000000..0b46aee14
--- /dev/null
+++ b/print/report/rpt-item-label/index.html
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+ {{item.id}}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/print/report/rpt-item-label/index.js b/print/report/rpt-item-label/index.js
new file mode 100755
index 000000000..922965eb0
--- /dev/null
+++ b/print/report/rpt-item-label/index.js
@@ -0,0 +1,83 @@
+const database = require(`${appPath}/lib/database`);
+const UserException = require(`${appPath}/lib/exceptions/userException`);
+const strftime = require('strftime');
+const qrcode = require('qrcode');
+
+module.exports = {
+ name: 'rpt-item-label',
+ async asyncData(ctx, params) {
+ Object.assign(this, this.methods);
+
+ if (!params.itemId)
+ throw new UserException('No item id specified');
+
+ if (!params.warehouseId)
+ throw new UserException('No warehouse id specified');
+
+ const data = {
+ item: await this.fetchItem(params.itemId, params.warehouseId),
+ tags: await this.fetchItemTags(params.itemId),
+ barcode: await this.getBarcodeBase64(params.itemId),
+ labelNumber: params.labelNumber,
+ totalLabels: params.totalLabels
+ };
+
+ return data;
+ },
+ computed: {
+ dated() {
+ return strftime('%W/%d', new Date());
+ }
+ },
+ methods: {
+ fetchItem(id, warehouseId) {
+ return database.pool.query(
+ `SELECT
+ i.id,
+ i.name,
+ i.stems,
+ i.size,
+ b.packing
+ FROM vn.item i
+ JOIN cache.last_buy clb ON clb.item_id = i.id
+ JOIN vn.buy b ON b.id = clb.buy_id
+ JOIN vn.entry e ON e.id = b.entryFk
+ WHERE i.id = ? AND clb.warehouse_id = ?`, [id, warehouseId])
+ .then(([rows]) => {
+ if (rows.length == 0)
+ throw new UserException(`Item #${id} not found on warehouse #${warehouseId}`);
+ return rows[0];
+ });
+ },
+ fetchItemTags(itemId) {
+ return database.pool.query(
+ `SELECT t.code, t.name, it.value
+ FROM vn.itemTag it
+ JOIN vn.tag t ON t.id = it.tagFk
+ WHERE it.itemFk = ?`, [itemId])
+ .then(([rows]) => {
+ const tags = {};
+ rows.forEach(row => tags[row.code] = row.value);
+
+ return tags;
+ });
+ },
+ getBarcodeBase64(itemId) {
+ return qrcode.toDataURL(itemId, {margin: 0});
+ },
+ packing() {
+ const stems = this.item.stems ? this.item.stems : 1;
+ return `${this.item.packing}x${stems}`;
+ },
+ labelPage() {
+ const labelNumber = this.labelNumber ? this.labelNumber : 1;
+ const totalLabels = this.totalLabels ? this.totalLabels : 1;
+
+ return `${labelNumber}/${totalLabels}`;
+ }
+ },
+ components: {
+ 'report-header': require('../report-header'),
+ 'report-footer': require('../report-footer'),
+ },
+};
diff --git a/print/report/rpt-item-label/locale.js b/print/report/rpt-item-label/locale.js
new file mode 100644
index 000000000..b8d524274
--- /dev/null
+++ b/print/report/rpt-item-label/locale.js
@@ -0,0 +1,24 @@
+module.exports = {
+ messages: {
+ es: {
+ title: 'Recibo',
+ date: 'Fecha',
+ payed: 'En {0}, a {1} de {2} de {3}',
+ client: 'Cliente {0}',
+ months: [
+ 'Enero',
+ 'Febrero',
+ 'Marzo',
+ 'Abril',
+ 'Mayo',
+ 'Junio',
+ 'Julio',
+ 'Agosto',
+ 'Septiembre',
+ 'Octubre',
+ 'Noviembre',
+ 'Diciembre'
+ ]
+ },
+ },
+};
diff --git a/print/report/rpt-item-label/options.json b/print/report/rpt-item-label/options.json
new file mode 100644
index 000000000..6b00b0443
--- /dev/null
+++ b/print/report/rpt-item-label/options.json
@@ -0,0 +1,10 @@
+{
+ "format": "A4",
+ "orientation": "landscape",
+ "width": "10.4cm",
+ "height": "4.8cm",
+ "border": "0cm",
+ "footer": {
+ "height": "0"
+ }
+}
\ No newline at end of file
diff --git a/webpack.config.js b/webpack.config.js
index 74cf8d5c1..1efcf5f01 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -107,8 +107,8 @@ let baseConfig = {
],
devtool: 'source-map',
stats: {
- modules: false,
assets: false,
+ modules: false,
children: false,
entrypoints: false,
colors: true