merge with dev
gitea/salix/test This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-07-15 09:04:11 +02:00
commit 88b698f3eb
271 changed files with 23051 additions and 7947 deletions

3
.gitignore vendored
View File

@ -1,6 +1,7 @@
node_modules
dist/*
e2e/dms/*
e2e/dms/*/
!e2e/dms/temp/
npm-debug.log
.eslintcache
datasources.*.json

View File

@ -1,5 +1,4 @@
const UserError = require('vn-loopback/util/user-error');
const fs = require('fs-extra');
module.exports = Self => {
Self.remoteMethodCtx('downloadFile', {
@ -8,7 +7,7 @@ module.exports = Self => {
accepts: [
{
arg: 'id',
type: 'String',
type: 'Number',
description: 'The document id',
http: {source: 'path'}
}

View File

@ -1,6 +1,5 @@
const UserError = require('vn-loopback/util/user-error');
const fs = require('fs-extra');
const md5 = require('md5');
module.exports = Self => {
Self.remoteMethodCtx('uploadFile', {

9
back/models/postcode.js Normal file
View File

@ -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 postcode already exists`);
return err;
});
};

View File

@ -41,16 +41,17 @@
"scopes": {
"location": {
"include": [{
"relation": "postcodes"
},
{
"relation": "province",
"scope": {
"include": {
"relation": "country"
}
}
},
{
"relation": "postcodes"
}]
}],
"fields": ["id", "name", "provinceFk"]
}
}
}

View File

@ -1,15 +0,0 @@
CREATE TABLE `vn`.`device` (
`id` INT NOT NULL,
`sn` VARCHAR(50) NULL,
`model` VARCHAR(50) NULL,
`userFk` INT(10) UNSIGNED NOT NULL,
PRIMARY KEY (`id`),
INDEX `device_fk1_idx` (`userFk` ASC),
CONSTRAINT `device_fk1`
FOREIGN KEY (`userFk`)
REFERENCES `account`.`user` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION);
ALTER TABLE `vn`.`device`
CHANGE COLUMN `id` `id` INT(11) NOT NULL AUTO_INCREMENT ;

View File

@ -1,74 +0,0 @@
USE `nst`;
DROP procedure IF EXISTS `nodeAdd`;
DELIMITER $$
USE `nst`$$
CREATE DEFINER=`root`@`%` PROCEDURE `nodeAdd`(IN `vScheme` VARCHAR(45), IN `vTable` VARCHAR(45), IN `vParentFk` INT, IN `vChild` VARCHAR(100))
BEGIN
DECLARE vSql TEXT;
DECLARE vTableClone VARCHAR(45);
SET vTableClone = CONCAT(vTable, 'Clone');
CALL util.exec(CONCAT('DROP TEMPORARY TABLE IF EXISTS tmp.', vTableClone));
CALL util.exec(CONCAT(
'CREATE TEMPORARY TABLE tmp.', vTableClone,
' ENGINE = MEMORY',
' SELECT * FROM ', vScheme, '.', vTable
));
CALL util.exec(CONCAT(
'SELECT COUNT(c.id) INTO @childs',
' FROM ', vScheme, '.', vTable, ' p',
' LEFT JOIN tmp.', vTableClone, ' c ON c.lft',
' BETWEEN p.lft AND p.rgt AND c.id != ', vParentFk,
' WHERE p.id = ', vParentFk
));
IF @childs = 0 THEN
CALL util.exec(CONCAT(
'SELECT lft INTO @vLeft',
' FROM ', vScheme, '.', vTable,
' WHERE id = ', vParentFk
));
ELSE
CALL util.exec(CONCAT(
'SELECT c.rgt INTO @vLeft',
' FROM ', vScheme, '.', vTable, ' p',
' JOIN tmp.', vTableClone, ' c ON c.depth = p.depth + 1'
' AND c.lft BETWEEN p.lft AND p.rgt',
' WHERE p.id = ', vParentFk,
' ORDER BY c.lft',
' DESC LIMIT 1'
));
END IF;
CALL util.exec(CONCAT(
'UPDATE ', vScheme, '.', vTable, ' SET rgt = rgt + 2',
' WHERE rgt > @vLeft',
' ORDER BY rgt DESC'
));
CALL util.exec(CONCAT(
'UPDATE ', vScheme, '.', vTable, ' SET lft = lft + 2',
' WHERE lft > @vLeft',
' ORDER BY lft DESC'
));
SET vChild = REPLACE(vChild, "'", "\\'");
CALL util.exec(CONCAT(
'INSERT INTO ', vScheme, '.', vTable, ' (name, lft, rgt)',
' VALUES ("', vChild, '", @vLeft + 1, @vLeft + 2)'
));
-- CALL util.exec(CONCAT(
-- 'SELECT id, name, lft, rgt, depth, sons',
-- ' FROM ', vScheme, '.', vTable,
-- ' WHERE id = LAST_INSERT_ID()'
-- ));
CALL util.exec(CONCAT('DROP TEMPORARY TABLE tmp.', vTableClone));
END$$
DELIMITER ;

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +0,0 @@
DROP procedure IF EXISTS `vn`.`zoneNest`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`zoneNest`()
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.zoneGeo;
CREATE TEMPORARY TABLE tmp.zoneGeo
(id INT AUTO_INCREMENT PRIMARY KEY)
ENGINE = MEMORY
SELECT * FROM vn.zoneGeo;
DROP TEMPORARY TABLE IF EXISTS tmp.country;
CREATE TEMPORARY TABLE tmp.country
SELECT id FROM country
WHERE country IN('España exento');
CALL vn.zoneNestCountry();
CALL vn.zoneNestProvince();
CALL vn.zoneNestTown();
CALL vn.zoneNestPostcode();
CALL vn.nestTree('tmp', 'zoneGeo', 'vn', 'zoneGeo');
DROP TEMPORARY TABLE
tmp.zoneGeo,
tmp.country;
END$$
DELIMITER ;

View File

@ -1,55 +0,0 @@
DROP procedure IF EXISTS `vn`.`zoneNestCountry`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`zoneNestCountry`()
BEGIN
DECLARE vDone BOOL;
DECLARE vParent INT DEFAULT 1;
DECLARE vGeoFk INT;
DECLARE vChildFk INT;
DECLARE vChildName VARCHAR(100);
DECLARE countryCur CURSOR FOR
SELECT 1, c.id, c.`country`
FROM vn.country c
JOIN tmp.country tc ON tc.id = c.id
ORDER BY c.`country`;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
-- Remove existing countries
DELETE zg FROM vn.country c
JOIN tmp.country tc ON tc.id = c.id
JOIN tmp.zoneGeo zg ON zg.id = c.geoFk;
-- Reset country geoFk
UPDATE vn.country c
JOIN tmp.country tc ON tc.id = c.id
SET c.geoFk = NULL
WHERE c.geoFk IS NOT NULL;
-- > Country cursor start
OPEN countryCur;
countryLoop: LOOP
SET vDone = FALSE;
FETCH countryCur INTO vParent, vChildFk, vChildName;
IF vDone THEN
LEAVE countryLoop;
END IF;
CALL nst.nodeAdd('tmp', 'zoneGeo', vParent, vChildName);
END LOOP;
CLOSE countryCur;
-- < Country cursor end
UPDATE country c
JOIN tmp.zoneGeo z ON z.name = c.country
SET c.geoFk = z.id
WHERE c.geoFk IS NULL;
END$$
DELIMITER ;

View File

@ -1,61 +0,0 @@
DROP procedure IF EXISTS `vn`.`zoneNestPostcode`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`zoneNestPostcode`()
BEGIN
DECLARE vDone BOOL;
DECLARE vParent INT DEFAULT 1;
DECLARE vGeoFk INT;
DECLARE vChildFk INT;
DECLARE vChildName VARCHAR(100);
DECLARE postcodeCur CURSOR FOR
SELECT t.geoFk, pc.`code`, pc.`code`
FROM vn.postCode pc
JOIN vn.town t ON t.id = pc.townFk
JOIN vn.province p ON p.id = t.provinceFk
JOIN tmp.country tc ON tc.id = p.countryFk
ORDER BY t.geoFk, pc.`code`;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
-- Remove existing postCodes from zoneGeo
DELETE zg FROM vn.postCode pc
JOIN vn.town t ON t.id = pc.townFk
JOIN vn.province p ON p.id = t.provinceFk
JOIN tmp.country tc ON tc.id = p.countryFk
JOIN tmp.zoneGeo zg ON zg.id = pc.geoFk;
-- Reset town geoFk
UPDATE vn.postCode pc
JOIN vn.town t ON t.id = pc.townFk
JOIN vn.province p ON p.id = t.provinceFk
JOIN tmp.country tc ON tc.id = p.countryFk
SET pc.geoFk = NULL
WHERE pc.geoFk IS NOT NULL;
-- > Postcode cursor start
OPEN postcodeCur;
postcodeLoop: LOOP
SET vDone = FALSE;
FETCH postcodeCur INTO vParent, vChildFk, vChildName;
IF vDone THEN
LEAVE postcodeLoop;
END IF;
CALL nst.nodeAdd('tmp', 'zoneGeo', vParent, vChildName);
END LOOP;
CLOSE postcodeCur;
-- < Postcode cursor end
UPDATE postCode p
JOIN tmp.zoneGeo z ON z.name = p.code
SET p.geoFk = z.id
WHERE p.geoFk IS NULL;
END$$
DELIMITER ;

View File

@ -1,56 +0,0 @@
DROP procedure IF EXISTS `vn`.`zoneNestProvince`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`zoneNestProvince`()
BEGIN
DECLARE vDone BOOL;
DECLARE vParent INT DEFAULT 1;
DECLARE vGeoFk INT;
DECLARE vChildFk INT;
DECLARE vChildName VARCHAR(100);
DECLARE provinceCur CURSOR FOR
SELECT c.geoFk, p.id, p.`name`
FROM province p
JOIN tmp.country tc ON tc.id = p.countryFk
JOIN vn.country c ON c.id = tc.id
ORDER BY c.geoFk, p.`name`;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
-- Remove existing provinces from zoneGeo
DELETE zg FROM vn.province p
JOIN tmp.country tc ON tc.id = p.countryFk
JOIN tmp.zoneGeo zg ON zg.id = p.geoFk;
-- Reset country geoFk
UPDATE vn.province p
JOIN tmp.country tc ON tc.id = p.countryFk
SET p.geoFk = NULL
WHERE p.geoFk IS NOT NULL;
-- > Province cursor start
OPEN provinceCur;
provinceLoop: LOOP
SET vDone = FALSE;
FETCH provinceCur INTO vParent, vChildFk, vChildName;
IF vDone THEN
LEAVE provinceLoop;
END IF;
CALL nst.nodeAdd('tmp', 'zoneGeo', vParent, vChildName);
END LOOP;
CLOSE provinceCur;
-- < Province cursor end
UPDATE province p
JOIN tmp.zoneGeo z ON z.name = p.name
SET p.geoFk = z.id
WHERE p.geoFk IS NULL;
END$$
DELIMITER ;

View File

@ -1,59 +0,0 @@
DROP procedure IF EXISTS `vn`.`zoneNestTown`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`zoneNestTown`()
BEGIN
DECLARE vDone BOOL;
DECLARE vParent INT DEFAULT 1;
DECLARE vGeoFk INT;
DECLARE vChildFk INT;
DECLARE vChildName VARCHAR(100);
DECLARE townCur CURSOR FOR
SELECT p.geoFk, t.id, t.`name`
FROM vn.town t
JOIN vn.province p ON p.id = t.provinceFk
JOIN tmp.country tc ON tc.id = p.countryFk
ORDER BY p.geoFk, t.`name`;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
-- Remove existing towns from zoneGeo
DELETE zg FROM vn.town t
JOIN vn.province p ON p.id = t.provinceFk
JOIN tmp.country tc ON tc.id = p.countryFk
JOIN tmp.zoneGeo zg ON zg.id = t.geoFk;
-- Reset town geoFk
UPDATE vn.town t
JOIN vn.province p ON p.id = t.provinceFk
JOIN tmp.country tc ON tc.id = p.countryFk
SET t.geoFk = NULL
WHERE t.geoFk IS NOT NULL;
-- > Town cursor start
OPEN townCur;
townLoop: LOOP
SET vDone = FALSE;
FETCH townCur INTO vParent, vChildFk, vChildName;
IF vDone THEN
LEAVE townLoop;
END IF;
CALL nst.nodeAdd('tmp', 'zoneGeo', vParent, vChildName);
END LOOP;
CLOSE townCur;
-- < Town cursor end
UPDATE town t
JOIN tmp.zoneGeo z ON z.name = t.name
LEFT JOIN province p ON p.geoFk = z.id
SET t.geoFk = z.id
WHERE p.geoFk IS NULL;
END$$
DELIMITER ;

View File

@ -1,19 +0,0 @@
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`ticketGetVolume` AS
SELECT
`s`.`ticketFk` AS `ticketFk`,
`t`.`routeFk` AS `routeFk`,
`s`.`id` AS `saleFk`,
`t`.`shipped` AS `Fecha`,
(((`s`.`quantity` * `r`.`cm3`) * `i`.`compression`) / 1000000) AS `volume`
FROM
(((`vn`.`sale` `s`
JOIN `vn`.`item` `i` ON ((`i`.`id` = `s`.`itemFk`)))
JOIN `vn`.`ticket` `t` ON ((`t`.`id` = `s`.`ticketFk`)))
JOIN `bi`.`rotacion` `r` ON (((`r`.`Id_Article` = `s`.`itemFk`)
AND (`r`.`warehouse_id` = `t`.`warehouseFk`))));

View File

@ -1,30 +0,0 @@
DROP function IF EXISTS `vn`.`ticketTotalVolume`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` FUNCTION `ticketTotalVolume`(vTicketId INT) RETURNS decimal(10,3)
READS SQL DATA
BEGIN
-- Devuelte el volumen total del ticket sumado
-- DECLARE vWarehouseId INTEGER;
-- DECLARE vShippedDate DATE;
DECLARE vVolume DECIMAL(10,3);
/*
SELECT warehouseFk, shipped INTO vWarehouseId,vShippedDate FROM vn.ticket WHERE id = vTicketId;
SELECT IFNULL(SUM(s.quantity * i.compression * r.cm3)/1000000,0) INTO vVolume
FROM sale s
JOIN vn.item i ON i.id = s.itemFk
JOIN bi.rotacion r on r.Id_Article = s.itemFk AND r.warehouse_id = vWarehouseId
WHERE s.ticketFk = vTicketId;
*/
SELECT sum(volume) INTO vVolume
FROM ticketGetVolume
WHERE ticketFk = vTicketId;
RETURN vVolume;
END$$
DELIMITER ;

View File

@ -1,61 +0,0 @@
DROP procedure IF EXISTS `vn`.`available_calc`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`available_calc`(
vDate DATE,
vAddress INT,
vAgencyMode INT)
BEGIN
/**
* Calculates the available for all available stores
* according to the given parameters.
*
* @param vDate The delivery date
* @param vAddress The delivery address id
* @param vAgencyMode The shipping agency
* @return tmp.availableCalc(calcFk) The available cache ids
*/
DECLARE vCalcFk INT;
DECLARE vShipment DATE;
DECLARE vWarehouse INT;
DECLARE vDone BOOL;
DECLARE cWarehouses CURSOR FOR
SELECT warehouseFk, shipped FROM tmp.zoneGetShipped;
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET vDone = TRUE;
-- Establecemos los almacenes y las fechas que van a entrar al disponible
CALL vn.zoneGetShippedWarehouse(vDate, vAddress, vAgencyMode);
DROP TEMPORARY TABLE IF EXISTS tmp.availableCalc;
CREATE TEMPORARY TABLE tmp.availableCalc(
calcFk INT UNSIGNED,
PRIMARY KEY (calcFk)
)
ENGINE = MEMORY;
OPEN cWarehouses;
l: LOOP
SET vDone = FALSE;
FETCH cWarehouses INTO vWarehouse, vShipment;
IF vDone THEN
LEAVE l;
END IF;
CALL `cache`.available_refresh(vCalcFk, FALSE, vWarehouse, vShipment);
INSERT IGNORE INTO tmp.availableCalc
SET calcFk = vCalcFk;
END LOOP;
CLOSE cWarehouses;
DROP TEMPORARY TABLE tmp.zoneGetShipped;
END$$
DELIMITER ;

View File

@ -1,28 +0,0 @@
DROP procedure IF EXISTS `vn`.`catalog_calcFromItem`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`catalog_calcFromItem`(
vLanded DATE,
vAddressFk INT,
vAgencyModeFk INT,
vItemFk INT)
BEGIN
/**
* Calculates available and price for a single item.
*
* @param vItemFk The item id
* @return tmp.ticketCalculateItem
* @return tmp.ticketComponentPrice
* @return tmp.ticketComponent
* @return tmp.ticketLot
* @return tmp.zoneGetShipped
*/
DROP TEMPORARY TABLE IF EXISTS tmp.item;
CREATE TEMPORARY TABLE tmp.item
ENGINE = MEMORY
SELECT vItemFk itemFk;
CALL ticketCalculate(vLanded, vAddressFk, vAgencyModeFk);
DROP TEMPORARY TABLE tmp.item;
END$$
DELIMITER ;

View File

@ -1,41 +0,0 @@
DROP procedure IF EXISTS `hedera`.`catalog_calcFromMyAddress`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `hedera`.`catalog_calcFromMyAddress`(vDelivery DATE, vAddress INT)
BEGIN
/**
* Gets the available items list.
*
* @param vDelivery Delivery date
* @param vAddress Address id
* @return tmp.ticketCalculateItem
* @return tmp.ticketComponentPrice
* @return tmp.ticketComponent
* @return tmp.ticketLot
* @return tmp.zoneGetShipped
*/
DECLARE vAgencyMode INT;
SELECT a.agencyModeFk
INTO vAgencyMode
FROM myClient c
JOIN vn.address a ON a.clientFk = c.id
WHERE a.id = vAddress;
CALL vn.available_calc(vDelivery, vAddress, vAgencyMode);
DROP TEMPORARY TABLE IF EXISTS tmp.item;
CREATE TEMPORARY TABLE tmp.item
(INDEX (itemFk))
ENGINE = MEMORY
SELECT c.item_id itemFk
FROM `cache`.available c
JOIN tmp.availableCalc a ON a.calcFk = c.calc_id
WHERE c.available > 0
GROUP BY c.item_id;
CALL vn.ticketCalculate(vDelivery, vAddress, vAgencyMode);
DROP TEMPORARY TABLE tmp.item;
END$$
DELIMITER ;

View File

@ -1,398 +0,0 @@
USE `vn2008`;
DROP procedure IF EXISTS `vn2008`.`bionic_available_`;
DELIMITER $$
USE `vn2008`$$
CREATE DEFINER=`root`@`%` PROCEDURE `__bionic_available_`(
vDate DATE,
vAddress INT,
vAgency INT)
BEGIN
/**
* Calcula el disponible para un conjunto de almacenes y fechas
* devueltos por el procedimiento agencyHourGetShipped()
*
* @deprecated Use vn.available_calc()
* @table t_bionic_available Tabla con los ids de cache
*/
DECLARE vAvailableCalc INT;
DECLARE vShipment DATE;
DECLARE vAgencyId INT;
DECLARE vWh INT;
DECLARE vDone BOOL;
DECLARE cTravelTree CURSOR FOR
SELECT warehouseFk, shipped FROM tmp.agencyHourGetShipped;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
-- Establecemos los almacenes y las fechas que van a entrar al disponible
SELECT agency_id INTO vAgencyId
FROM Agencias WHERE Id_Agencia = vAgency;
CALL vn.agencyHourGetShipped (vDate, vAddress, vAgencyId);
DROP TEMPORARY TABLE IF EXISTS t_bionic_available;
CREATE TEMPORARY TABLE t_bionic_available(
calc_id INT UNSIGNED,
PRIMARY KEY (calc_id)
)
ENGINE = MEMORY;
OPEN cTravelTree;
l: LOOP
SET vDone = FALSE;
FETCH cTravelTree INTO vWh, vShipment;
IF vDone THEN
LEAVE l;
END IF;
CALL `cache`.available_refresh (vAvailableCalc, FALSE, vWh, vShipment);
INSERT IGNORE INTO t_bionic_available
SET calc_id = vAvailableCalc;
END LOOP;
CLOSE cTravelTree;
DROP TEMPORARY TABLE tmp.agencyHourGetShipped;
END$$
DELIMITER ;
;
USE `hedera`;
DROP procedure IF EXISTS `hedera`.`bionic_from_item`;
DELIMITER $$
USE `hedera`$$
CREATE DEFINER=`root`@`%` PROCEDURE `__bionic_from_item`(vItem INT)
BEGIN
DECLARE vDate DATE;
DECLARE vAddress INT;
DECLARE vAgencyMode INT;
SELECT sent, addressFk, agencyModeFk
INTO vDate, vAddress, vAgencyMode
FROM myBasket;
CALL vn2008.bionic_from_item(vDate, vAddress, vAgencyMode, vItem);
END$$
DELIMITER ;
;
USE `vn2008`;
DROP procedure IF EXISTS `vn2008`.`bionic_from_order`;
DELIMITER $$
USE `vn2008`$$
CREATE DEFINER=`root`@`%` PROCEDURE `__bionic_from_order`(
v_date DATE, -- fecha de recepcion de mercancia
v_consigna INT,
v_agencia INT,
v_order INT)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmp.bionic_calc;
CREATE TEMPORARY TABLE tmp.bionic_calc
(PRIMARY KEY (item_id))
ENGINE = MEMORY
SELECT item_id FROM order_row
WHERE order_id = v_order GROUP BY item_id;
CALL bionic_calc (v_date, v_consigna, v_agencia);
DROP TEMPORARY TABLE tmp.bionic_calc;
END$$
DELIMITER ;
;
USE `hedera`;
DROP procedure IF EXISTS `hedera`.`bionicCalcWithDate`;
DELIMITER $$
USE `hedera`$$
CREATE DEFINER=`root`@`%` PROCEDURE `__bionicCalcWithDate`(vDate DATE)
BEGIN
DECLARE vMyAddressFk INTEGER;
DECLARE vMyAgencyModeFk INTEGER;
SELECT id, agencyModeFk INTO vMyAddressFk, vMyAgencyModeFk
FROM myAddress
WHERE isDefaultAddress;
CALL vn2008.bionic_calc(vDate, vMyAddressFk, vMyAgencyModeFk);
END$$
DELIMITER ;
;
USE `hedera`;
DROP procedure IF EXISTS `hedera`.`bionic_calc`;
DELIMITER $$
USE `hedera`$$
CREATE DEFINER=`root`@`%` PROCEDURE `__bionic_calc`()
BEGIN
DECLARE vDate DATE;
DECLARE vAddress INT;
DECLARE vAgencyMode INT;
SELECT sent, addressFk, agencyModeFk
INTO vDate, vAddress, vAgencyMode
FROM myBasket;
CALL vn2008.bionic_calc(vDate, vAddress, vAgencyMode);
IF account.myUserGetName() = 'visitor'
THEN
DROP TEMPORARY TABLE tmp.bionic_component;
UPDATE tmp.bionic_item SET price = NULL;
END IF;
END$$
DELIMITER ;
;
USE `hedera`;
DROP procedure IF EXISTS `hedera`.`itemGetAvailableOrder`;
DELIMITER $$
USE `hedera`$$
CREATE DEFINER=`root`@`%` PROCEDURE `__itemGetAvailableOrder`(vOrder INT)
BEGIN
/**
* Gets the available items list with an order params.
*
* @table tmp.itemAvailable
*/
DECLARE vDelivery DATE;
DECLARE vAddress INT;
DECLARE vAgency INT;
SELECT landed, addressFk, agencyModeFk
INTO vDelivery, vAddress, vAgency
FROM myOrder
WHERE id = vOrder;
CALL vn2008.bionic_available_ (vDelivery, vAddress, vAgency);
DROP TEMPORARY TABLE IF EXISTS tmp.itemAvailable;
CREATE TEMPORARY TABLE tmp.itemAvailable
(INDEX (id))
ENGINE = MEMORY
SELECT c.item_id id
FROM cache.available c
JOIN vn2008.t_bionic_available a ON c.calc_id = a.calc_id
WHERE c.available > 0
GROUP BY c.item_id;
DROP TEMPORARY TABLE vn2008.t_bionic_available;
END$$
DELIMITER ;
;
USE `hedera`;
DROP procedure IF EXISTS `hedera`.`itemGetAvailable`;
DELIMITER $$
USE `hedera`$$
CREATE DEFINER=`root`@`%` PROCEDURE `__itemGetAvailable`()
BEGIN
/**
* Gets the available items list.
*
* @table tmp.itemAvailable
*/
DECLARE vDelivery DATE;
DECLARE vAddress INT;
DECLARE vAgency INT;
SELECT sent, addressFk, agencyModeFk
INTO vDelivery, vAddress, vAgency
FROM myBasket;
CALL vn2008.bionic_available_ (vDelivery, vAddress, vAgency);
DROP TEMPORARY TABLE IF EXISTS tmp.itemAvailable;
CREATE TEMPORARY TABLE tmp.itemAvailable
(INDEX (id))
ENGINE = MEMORY
SELECT c.item_id id
FROM cache.available c
JOIN vn2008.t_bionic_available a ON c.calc_id = a.calc_id
WHERE c.available > 0
GROUP BY c.item_id;
DROP TEMPORARY TABLE vn2008.t_bionic_available;
END$$
DELIMITER ;
;
USE `hedera`;
DROP procedure IF EXISTS `hedera`.`myItemGetAvailableFromDate`;
DELIMITER $$
USE `hedera`$$
CREATE DEFINER=`root`@`%` PROCEDURE `__myItemGetAvailableFromDate`(vDelivery DATE)
BEGIN
/**
* Gets the available items list.
*
* @deprecated Use item_calcCatalogFromMyAddress()
* @param vDelivery Delivery date
*/
DECLARE vAddress INT;
DECLARE vAgencyMode INT;
SELECT a.agencyModeFk, a.id
INTO vAgencyMode, vAddress
FROM myClient c
JOIN vn.address a ON a.id = c.defaultAddressFk;
CALL vn2008.bionic_available_ (vDelivery, vAddress, vAgencyMode);
DROP TEMPORARY TABLE IF EXISTS tmp.item;
CREATE TEMPORARY TABLE tmp.item
(INDEX (itemFk))
ENGINE = MEMORY
SELECT c.item_id itemFk
FROM cache.available c
JOIN vn2008.t_bionic_available a ON c.calc_id = a.calc_id
WHERE c.available > 0
GROUP BY c.item_id;
CALL vn.ticketCalculate(vDelivery, vAddress, vAgencyMode);
-- -------------------
/*SELECT b.itemFk, b.item, b.available, b.price
FROM tmp.ticketCalculateItem b
JOIN vn.item i ON i.id = b.itemFk
WHERE b.available > 0
ORDER BY i.relevancy DESC, i.name, i.size;
select * from tmp.ticketComponentPrice;*/
-- -------------------
DROP TEMPORARY TABLE vn2008.t_bionic_available;
END$$
DELIMITER ;
;
USE `hedera`;
DROP procedure IF EXISTS `hedera`.`myItemGetAvailable`;
DELIMITER $$
USE `hedera`$$
CREATE DEFINER=`root`@`%` PROCEDURE `__myItemGetAvailable`(vDelivery DATE, vAddress INT)
BEGIN
/**
* Gets the available items list.
*
* @deprecated Use item_calcCatalogFromMyAddress()
* @param vDelivery Delivery date
* @param vAddress Id Address
*/
DECLARE vAgencyMode INT;
SELECT a.agencyModeFk
INTO vAgencyMode
FROM myClient c
JOIN vn.address a ON a.clientFk = c.id
WHERE a.id = vAddress;
CALL vn2008.bionic_available_ (vDelivery, vAddress, vAgencyMode);
DROP TEMPORARY TABLE IF EXISTS tmp.item;
CREATE TEMPORARY TABLE tmp.item
(INDEX (itemFk))
ENGINE = MEMORY
SELECT c.item_id itemFk
FROM cache.available c
JOIN vn2008.t_bionic_available a ON c.calc_id = a.calc_id
WHERE c.available > 0
GROUP BY c.item_id;
CALL vn.ticketCalculate(vDelivery, vAddress, vAgencyMode);
-- -------------------
/*SELECT b.itemFk, b.item, b.available, b.price
FROM tmp.ticketCalculateItem b
JOIN vn.item i ON i.id = b.itemFk
WHERE b.available > 0
ORDER BY i.relevancy DESC, i.name, i.size;
select * from tmp.ticketComponentPrice;*/
-- -------------------
DROP TEMPORARY TABLE vn2008.t_bionic_available;
END$$
DELIMITER ;
;
USE `hedera`;
DROP procedure IF EXISTS `hedera`.`myOrderAddItem`;
DELIMITER $$
USE `hedera`$$
CREATE DEFINER=`root`@`%` PROCEDURE `__myOrderAddItem`(
vSelf INT,
vWarehouse INT,
vItem INT,
vAmount INT)
BEGIN
/**
* @deprecated Use myOrder_addItem()
*/
CALL myOrder_addItem(vSelf, vWarehouse, vItem, vAmount);
END$$
DELIMITER ;
;
USE `hedera`;
DROP procedure IF EXISTS `hedera`.`myOrderConfirm`;
DELIMITER $$
USE `hedera`$$
CREATE DEFINER=`root`@`%` PROCEDURE `__myOrderConfirm`(vSelf INT)
BEGIN
/**
* @deprecated Use myOrder_confirm()
*/
CALL myOrder_confirm(vSelf);
END$$
DELIMITER ;
;
USE `hedera`;
DROP procedure IF EXISTS `hedera`.`myOrderNewFromDate`;
DELIMITER $$
USE `hedera`$$
CREATE DEFINER=`root`@`%` PROCEDURE `__myOrderNewFromDate`(
OUT vSelf INT,
vLandingDate DATE)
BEGIN
/**
* @deprecated Use myOrder_newWithDate()
*/
CALL myOrder_newWithDate(vSelf, vLandingDate);
END$$
DELIMITER ;
;

View File

@ -1,19 +0,0 @@
DROP procedure IF EXISTS `hedera`.`myBasket_calcCatalogFromItem`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `hedera`.`myBasket_calcCatalogFromItem`(vItem INT)
BEGIN
/**
* Gets the availability and prices for the given item
* using current user basket parameters.
*
* @table tmp.item(itemFk)
* @return tmp.ticketCalculateItem
* @return tmp.ticketComponentPrice
* @return tmp.ticketComponent
* @return tmp.ticketLot
* @return tmp.zoneGetShipped
*/
CALL order_calcCatalogFromItem(myBasket_getId(), vItem);
END$$
DELIMITER ;

View File

@ -1,19 +0,0 @@
DROP procedure IF EXISTS `hedera`.`myBasket_calcCatalogFull`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `hedera`.`myBasket_calcCatalogFull`()
BEGIN
/**
* Gets the availability and prices for the given items
* using current user basket parameters.
*
* @table tmp.item(itemFk)
* @return tmp.ticketCalculateItem
* @return tmp.ticketComponentPrice
* @return tmp.ticketComponent
* @return tmp.ticketLot
* @return tmp.zoneGetShipped
*/
CALL order_calcCatalogFull(myBasket_getId());
END$$
DELIMITER ;

View File

@ -1,14 +0,0 @@
DROP procedure IF EXISTS `hedera`.`myBasket_getAvailable`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `hedera`.`myBasket_getAvailable`()
BEGIN
/**
* Gets the available items list.
*
* @table tmp.itemAvailable
*/
CALL order_getAvailable(myBasket_getId());
END$$
DELIMITER ;

View File

@ -1,22 +0,0 @@
DROP procedure IF EXISTS `hedera`.`myOrder_getAvailable`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `hedera`.`myOrder_getAvailable`(vSelf INT)
BEGIN
/**
* Gets the available items list.
*
* @param vSelf The order id
* @table tmp.itemAvailable
*/
DECLARE isMine BOOL;
SELECT COUNT(*) INTO isMine
FROM myOrder
WHERE id = vSelf;
IF isMine THEN
CALL order_getAvailable(vSelf);
END IF;
END$$
DELIMITER ;

View File

@ -1,105 +0,0 @@
DROP procedure IF EXISTS `hedera`.`order_addItem`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `hedera`.`order_addItem`(
vSelf INT,
vWarehouse INT,
vItem INT,
vAmount INT)
BEGIN
/**
* Adds an item to the order, checking availability and grouping.
*
* @param vSelf The order id
* @param vWarehouse The warehouse id
* @param vItem The item id
* @param vAmount The amount to add
*/
DECLARE vRow INT;
DECLARE vAdd INT;
DECLARE vAvailable INT;
DECLARE vDone BOOL;
DECLARE vGrouping INT;
DECLARE vRate INT;
DECLARE vShipment DATE;
DECLARE vPrice DECIMAL(10,2);
DECLARE cur CURSOR FOR
SELECT `grouping`, price, rate
FROM tmp.ticketComponentPrice
WHERE warehouseFk = vWarehouse
AND itemFk = vItem
ORDER BY `grouping` DESC;
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET vDone = TRUE;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
RESIGNAL;
END;
CALL order_calcCatalogFromItem(vSelf, vItem);
START TRANSACTION;
SELECT shipped INTO vShipment
FROM tmp.zoneGetShipped
WHERE warehouseFk = vWarehouse;
SELECT available INTO vAvailable
FROM tmp.ticketLot
WHERE warehouseFk = vWarehouse
AND itemFk = vItem;
IF vAmount > IFNULL(vAvailable, 0) THEN
CALL util.throw ('ORDER_ROW_UNAVAILABLE');
END IF;
OPEN cur;
l: LOOP
SET vDone = FALSE;
FETCH cur INTO vGrouping, vPrice, vRate;
IF vDone THEN
LEAVE l;
END IF;
SET vAdd = vAmount - MOD(vAmount, vGrouping);
SET vAmount = vAmount - vAdd;
IF vAdd = 0 THEN
ITERATE l;
END IF;
INSERT INTO orderRow SET
orderFk = vSelf,
itemFk = vItem,
warehouseFk = vWarehouse,
shipment = vShipment,
rate = vRate,
amount = vAdd,
price = vPrice;
SET vRow = LAST_INSERT_ID();
INSERT INTO orderRowComponent (rowFk, componentFk, price)
SELECT vRow, c.componentFk, c.cost
FROM tmp.ticketComponent c
JOIN vn.component t
ON t.id = c.componentFk
AND (t.classRate IS NULL OR t.classRate = vRate)
WHERE c.warehouseFk = vWarehouse
AND c.itemFk = vItem;
END LOOP;
CLOSE cur;
IF vAmount > 0 THEN
CALL util.throw ('AMOUNT_NOT_MATCH_GROUPING');
END IF;
COMMIT;
CALL vn.ticketCalculatePurge;
END$$
DELIMITER ;

View File

@ -1,36 +0,0 @@
DROP procedure IF EXISTS `hedera`.`order_calcCatalog`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `hedera`.`order_calcCatalog`(vSelf INT)
BEGIN
/**
* Gets the availability and prices for order items.
*
* @param vSelf The order id
* @return tmp.ticketCalculateItem
* @return tmp.ticketComponentPrice
* @return tmp.ticketComponent
* @return tmp.ticketLot
*/
DECLARE vDate DATE;
DECLARE vAddress INT;
DECLARE vAgencyMode INT;
SELECT date_send, address_id, agency_id
INTO vDate, vAddress, vAgencyMode
FROM `order`
WHERE id = vSelf;
DROP TEMPORARY TABLE IF EXISTS tmp.item;
CREATE TEMPORARY TABLE tmp.item
(PRIMARY KEY (itemFk))
ENGINE = MEMORY
SELECT itemFk FROM orderRow
WHERE orderFk = vSelf
GROUP BY itemFk;
CALL vn.ticketCalculate(vDate, vAddress, vAgencyMode);
DROP TEMPORARY TABLE tmp.item;
END$$
DELIMITER ;

View File

@ -1,30 +0,0 @@
DROP procedure IF EXISTS `hedera`.`order_calcCatalogFromItem`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `hedera`.`order_calcCatalogFromItem`(vSelf INT, vItem INT)
BEGIN
/**
* Gets the availability and prices for the given item
* using the order parameters.
*
* @param vSelf The order id
* @table tmp.item(itemFk)
* @return tmp.ticketCalculateItem
* @return tmp.ticketComponentPrice
* @return tmp.ticketComponent
* @return tmp.ticketLot
* @return tmp.zoneGetShipped
*/
DECLARE vDate DATE;
DECLARE vAddress INT;
DECLARE vAgencyMode INT;
SELECT date_send, address_id, agency_id
INTO vDate, vAddress, vAgencyMode
FROM `order`
WHERE id = vSelf;
CALL vn.catalog_calcFromItem(vDate, vAddress, vAgencyMode, vItem);
END$$
DELIMITER ;

View File

@ -1,35 +0,0 @@
DROP procedure IF EXISTS `hedera`.`order_calcCatalogFull`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `hedera`.`order_calcCatalogFull`(vSelf INT)
BEGIN
/**
* Gets the availability and prices for the given items
* using the order parameters.
*
* @param vSelf The order id
* @table tmp.item(itemFk)
* @return tmp.ticketCalculateItem
* @return tmp.ticketComponentPrice
* @return tmp.ticketComponent
* @return tmp.ticketLot
* @return tmp.zoneGetShipped
*/
DECLARE vDate DATE;
DECLARE vAddress INT;
DECLARE vAgencyMode INT;
SELECT date_send, address_id, agency_id
INTO vDate, vAddress, vAgencyMode
FROM `order`
WHERE id = vSelf;
CALL vn.ticketCalculate(vDate, vAddress, vAgencyMode);
IF account.myUserGetName() = 'visitor'
THEN
DROP TEMPORARY TABLE tmp.ticketComponent;
UPDATE tmp.ticketCalculateItem SET price = NULL;
END IF;
END$$
DELIMITER ;

View File

@ -1,34 +0,0 @@
DROP procedure IF EXISTS `hedera`.`order_getAvailable`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `hedera`.`order_getAvailable`(vSelf INT)
BEGIN
/**
* Gets the available items list.
*
* @param vSelf The order id
* @table tmp.itemAvailable
*/
DECLARE vDelivery DATE;
DECLARE vAddress INT;
DECLARE vAgencyMode INT;
SELECT date_send, address_id, agency_id
INTO vDelivery, vAddress, vAgencyMode
FROM `order`
WHERE id = vSelf;
CALL vn.available_calc(vDelivery, vAddress, vAgencyMode);
DROP TEMPORARY TABLE IF EXISTS tmp.itemAvailable;
CREATE TEMPORARY TABLE tmp.itemAvailable
(INDEX (id))
ENGINE = MEMORY
SELECT DISTINCT a.item_id id
FROM `cache`.available a
JOIN tmp.availableCalc c ON c.calcFk = a.calc_id
WHERE a.available > 0;
DROP TEMPORARY TABLE tmp.availableCalc;
END$$
DELIMITER ;

View File

@ -1,71 +0,0 @@
DROP procedure IF EXISTS `hedera`.`order_update`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `hedera`.`order_update`(vSelf INT)
proc: BEGIN
/**
* Actualiza las líneas de un pedido.
*
* @param vSelf Id del pedido
*/
DECLARE vDate DATE;
DECLARE vAddress INT;
DECLARE vAgencyMode INT;
DECLARE vNRows INT;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
RESIGNAL;
END;
START TRANSACTION;
SELECT COUNT(*) INTO vNRows
FROM orderRow WHERE orderFk = vSelf;
IF vNRows > 0
THEN
CALL order_calcCatalog(vSelf);
DELETE c
FROM orderRow r
JOIN orderRowComponent c ON c.rowFk = r.id
WHERE r.orderFk = vSelf;
UPDATE orderRow r
LEFT JOIN tmp.ticketComponentPrice p
ON p.warehouseFk = r.warehouseFk
AND p.itemFk = r.itemFk
AND p.rate = r.rate
LEFT JOIN tmp.zoneGetShipped t
ON t.warehouseFk = r.warehouseFk
SET
r.price = p.price,
r.amount = IF(p.itemFk IS NOT NULL,
r.amount + IF(@m := MOD(r.amount, p.`grouping`), p.`grouping` - @m, 0), 0),
r.shipment = t.shipped
WHERE r.orderFk = vSelf;
INSERT INTO orderRowComponent(rowFk, componentFk, price)
SELECT r.id, c.componentFk, c.cost
FROM orderRow r
JOIN tmp.ticketComponent c
ON c.warehouseFk = r.warehouseFk
AND c.itemFk = r.itemFk
JOIN vn.component t
ON t.id = c.componentFk
AND (t.classRate IS NULL OR t.classRate = r.rate)
WHERE r.orderFk = vSelf;
CALL vn.ticketCalculatePurge;
END IF;
UPDATE `order` SET date_make = NOW()
WHERE id = vSelf;
COMMIT;
END$$
DELIMITER ;

View File

@ -1 +0,0 @@
RENAME TABLE hedera.myOrderMyTicket TO hedera.myOrderTicket;

View File

@ -1,10 +0,0 @@
GRANT EXECUTE ON PROCEDURE vn.zoneGetAgency TO `account`@`%`;
GRANT EXECUTE ON PROCEDURE hedera.myBasket_calcCatalogFromItem TO `guest`@`%`;
GRANT EXECUTE ON PROCEDURE hedera.myBasket_calcCatalogFull TO `guest`@`%`;
GRANT EXECUTE ON PROCEDURE hedera.myBasket_getAvailable TO `guest`@`%`;
GRANT EXECUTE ON PROCEDURE hedera.myOrder_getAvailable TO `guest`@`%`;
GRANT EXECUTE ON PROCEDURE hedera.catalog_calcFromMyAddress TO account@'%';
REVOKE SELECT ON TABLE hedera.myOrderMyTicket FROM account@'%';
GRANT SELECT ON TABLE hedera.myOrderTicket TO account@'%';
CALL account.privSync;

View File

@ -0,0 +1,5 @@
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES
('Zone', 'editPrices', 'WRITE', 'ALLOW', 'ROLE', 'deliveryBoss'),
('Postcode', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('Ticket', 'addSale', 'WRITE', 'ALLOW', 'ROLE', 'employee');

View File

@ -0,0 +1,3 @@
ALTER TABLE `vn`.`zoneCalendar`
ADD COLUMN `price` DOUBLE NOT NULL AFTER `delivered`,
ADD COLUMN `bonus` DOUBLE NOT NULL AFTER `price`;

View File

@ -0,0 +1,139 @@
DROP procedure IF EXISTS `vn`.`ticketGetProblems`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`ticketGetProblems`()
BEGIN
DECLARE vWarehouse INT;
DECLARE vDate DATE;
DECLARE vAvailableCache INT;
DECLARE vVisibleCache INT;
DECLARE vDone INT DEFAULT 0;
DECLARE vCursor CURSOR FOR
SELECT DISTINCT tt.warehouseFk, date(tt.shipped)
FROM tmp.ticketGetProblems tt
WHERE DATE(tt.shipped) BETWEEN CURDATE()
AND TIMESTAMPADD(DAY, 1.9, CURDATE());
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1;
DROP TEMPORARY TABLE IF EXISTS tmp.ticketProblems;
CREATE TEMPORARY TABLE tmp.ticketProblems (
ticketFk INT(11) PRIMARY KEY,
isFreezed INTEGER(1) DEFAULT 0,
risk DECIMAL(10,2) DEFAULT 0,
hasTicketRequest INTEGER(1) DEFAULT 0,
isAvailable INTEGER(1) DEFAULT 1
) ENGINE = MEMORY;
DROP TEMPORARY TABLE IF EXISTS tmp.ticketList;
CREATE TEMPORARY TABLE tmp.ticketList
(PRIMARY KEY (ticketFk))
ENGINE = MEMORY
SELECT tp.ticketFk, c.id clientFk
FROM tmp.ticketGetProblems tp
JOIN vn.client c ON c.id = tp.clientFk;
INSERT INTO tmp.ticketProblems(ticketFk, isFreezed)
SELECT DISTINCT tl.ticketFk, 1
FROM tmp.ticketList tl
JOIN vn.client c ON c.id = tl.clientFk
WHERE c.isFreezed;
DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt;
CREATE TEMPORARY TABLE tmp.clientGetDebt
(PRIMARY KEY (clientFk))
ENGINE = MEMORY
SELECT DISTINCT clientFk
FROM tmp.ticketList;
CALL clientGetDebt(CURDATE());
INSERT INTO tmp.ticketProblems(ticketFk, risk)
SELECT DISTINCT tl.ticketFk, r.risk
FROM tmp.ticketList tl
JOIN vn.ticket t ON t.id = tl.ticketFk
JOIN vn.agencyMode a ON t.agencyModeFk = a.id
JOIN tmp.risk r ON r.clientFk = t.clientFk
JOIN vn.client c ON c.id = t.clientFk
WHERE r.risk > c.credit + 10
AND a.deliveryMethodFk != 3
ON DUPLICATE KEY UPDATE
risk = r.risk;
INSERT INTO tmp.ticketProblems(ticketFk, hasTicketRequest)
SELECT DISTINCT tl.ticketFk, 1
FROM tmp.ticketList tl
JOIN vn.ticketRequest tr ON tr.ticketFk = tl.ticketFk
WHERE tr.isOK IS NULL
ON DUPLICATE KEY UPDATE
hasTicketRequest = 1;
OPEN vCursor;
WHILE NOT vDone
DO
FETCH vCursor INTO vWarehouse, vDate;
CALL cache.visible_refresh(vVisibleCache, FALSE, vWarehouse);
CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouse, vDate);
INSERT INTO tmp.ticketProblems(ticketFk, isAvailable)
SELECT tl.ticketFk, 0
FROM tmp.ticketList tl
JOIN vn.ticket t ON t.id = tl.ticketFk
LEFT JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.itemType it on it.id = i.typeFk
LEFT JOIN cache.available av ON av.item_id = i.id
AND av.calc_id = vAvailableCache
WHERE date(t.shipped) = vDate
AND categoryFk != 6
AND IFNULL(av.available, 0) < 0
AND s.isPicked = FALSE
AND NOT i.generic
AND vWarehouse = t.warehouseFk
GROUP BY tl.ticketFk
ON DUPLICATE KEY UPDATE
isAvailable = 0;
INSERT INTO tmp.ticketProblems(ticketFk, isAvailable)
SELECT tl.ticketFk, 0
FROM tmp.ticketList tl
JOIN vn.ticket t ON t.id = tl.ticketFk
LEFT JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.itemType it on it.id = i.typeFk
LEFT JOIN cache.visible v ON i.id = v.item_id AND v.calc_id = vVisibleCache
LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache
WHERE IFNULL(av.available, 0) >= 0
AND s.quantity > IFNULL(v.visible, 0)
AND s.isPicked = FALSE
AND s.reserved = FALSE
AND it.categoryFk != 6
AND date(t.shipped) = vDate
AND NOT i.generic
AND CURDATE() = vDate
AND t.warehouseFk = vWarehouse
GROUP BY tl.ticketFk
ON DUPLICATE KEY UPDATE
isAvailable = 0;
END WHILE;
CLOSE vCursor;
SELECT * FROM tmp.ticketProblems;
DROP TEMPORARY TABLE
tmp.clientGetDebt,
tmp.ticketList;
END$$
DELIMITER ;

File diff suppressed because one or more lines are too long

View File

@ -58,11 +58,11 @@ INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`,
INSERT INTO `vn`.`warehouse`(`id`, `name`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`)
VALUES
(1, 'Warehouse One', 0, 1, 1, 1),
(2, 'Warehouse Two', 0, 1, 1, 1),
(1, 'Warehouse One', 1, 1, 1, 1),
(2, 'Warehouse Two', 1, 1, 1, 1),
(3, 'Warehouse Three', 1, 1, 1, 1),
(4, 'Warehouse Four', 1, 1, 1, 1),
(5, 'Warehouse Five', 1, 0, 1, 0);
(5, 'Warehouse Five', 1, 1, 1, 1);
INSERT INTO `vn`.`warehouseAlias`(`id`, `name`)
VALUES
@ -186,16 +186,16 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`fax`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`cplusTerIdNifFk`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`)
VALUES
(101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1),
(102, 'Petter Parker', '87945234L', 'Spider-Man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 1, NULL, 0, 0, 18, 0, 1),
(101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(102, 'Petter Parker', '87945234L', 'Spider-Man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(103, 'Clark Kent', '06815934E', 'Super-Man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 0, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(104, 'Tony Stark', '06089160W', 'Iron-Man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1),
(105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, NULL, 0, 1),
(105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1),
(106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1),
(107, 'Hank Pym', '09854837G', 'Ant-Man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1),
(108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1),
(109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 1, NULL, 0, 0, 19, 0, 1),
(110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 1, NULL, 0, 0, NULL, 0, 1),
(109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1),
(110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1),
(200, 'Missing', NULL, 'Missing man', 'Anton', 'The space', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1),
(400, 'Trash', NULL, 'Garbage man', 'Unknown name', 'New York city', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1);
@ -332,9 +332,9 @@ INSERT INTO `vn`.`observationType`(`id`,`description`)
INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`description`)
VALUES
(1, 1, 1, 'under the floor'),
(2, 1, 2, 'wears leather and goes out at night'),
(3, 1, 3, 'care with the dog');
(1, 121, 1, 'under the floor'),
(2, 121, 2, 'wears leather and goes out at night'),
(3, 121, 3, 'care with the dog');
INSERT INTO `vn`.`creditClassification`(`id`, `client`, `dateStart`, `dateEnd`)
VALUES
@ -352,13 +352,13 @@ INSERT INTO `vn`.`creditInsurance`(`id`, `creditClassification`, `credit`, `crea
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, 1, 'first route', 0.2, 10, CURDATE(), CURDATE()),
(2, '1899-12-30 13:20:00', 56, CURDATE(), 1, 1, 'second route', null, 20, CURDATE(), CURDATE()),
(3, '1899-12-30 14:30:00', 56, CURDATE(), 2, 7, 'third route', null, 30, CURDATE(), CURDATE()),
(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());
(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
@ -383,11 +383,11 @@ INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`,
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `pdf`)
VALUES
(1, 'T', 156.09, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 101, CURDATE(), 442, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), CURDATE(), 1, 1),
(2, 'T', 208.35, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 102, CURDATE(), 442, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), CURDATE(), 1, 1),
(3, 'T', 20.02, CURDATE(), 103, CURDATE(), 442, CURDATE(), null, 1, 1),
(4, 'T', 20.02, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 103, CURDATE(), 442, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), null, 1, 1),
(5, 'A', 20.22, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 103, CURDATE(), 442, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), null, 1, 1);
(1, 'T', 1014.24, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 101, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1),
(2, 'T', 121.36, CURDATE(), 102, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
(3, 'T', 8.88, CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
(4, 'T', 8.88, CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
(5, 'A', 8.88, CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1);
UPDATE `vn`.`invoiceOut` SET ref = 'T1111111' WHERE id = 1;
UPDATE `vn`.`invoiceOut` SET ref = 'T2222222' WHERE id = 2;
@ -397,16 +397,22 @@ UPDATE `vn`.`invoiceOut` SET ref = 'A1111111' WHERE id = 5;
INSERT INTO `vn`.`invoiceOutTax` (`invoiceOutFk`, `taxableBase`, `vat`, `pgcFk`)
VALUES
(1, 100, 10, 4722000010),
(1, 200, 21, 4722000021),
(2, 100, 10, 4722000010),
(2, 200, 21, 4722000021),
(3, 100, 10, 4722000010),
(3, 200, 21, 4722000021),
(4, 100, 10, 4722000010),
(4, 200, 21, 4722000021),
(5, 100, 10, 4722000010),
(5, 200, 21, 4722000021);
(1, 895.76, 89.58, 4722000010),
(1, 33.80, 7.10, 4722000021),
(2, 110.33, 11.03, 4770000010),
(3, 8.07, 0.81, 4770000010),
(4, 8.07, 0.81, 4770000010),
(5, 8.07, 0.81, 4770000010);
INSERT INTO `vn`.`invoiceOutExpence`(`id`, `invoiceOutFk`, `amount`, `expenceFk`, `created`)
VALUES
(1, 1, 813.06, 2000000000, CURDATE()),
(2, 1, 33.80, 4751000000, CURDATE()),
(3, 1, 70.70, 6210000567, CURDATE()),
(4, 2, 110.33, 2000000000, CURDATE()),
(5, 3, 8.07, 2000000000, CURDATE()),
(6, 4, 8.07, 2000000000, CURDATE()),
(7, 5, 8.07, 2000000000, CURDATE());
INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`)
VALUES
@ -421,68 +427,93 @@ INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaF
('T', 'Española rapida', 1, 'NATIONAL', 0),
('V', 'Intracomunitaria global', 0, 'CEE', 1);
INSERT INTO `vn`.`ticket`(`id`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `created`)
INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `warehouseFk`, `agencyModeFk`, `travelingDays`, `price`, `bonus`)
VALUES
(1 , 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) , 101, 'address 21', 121, 'T1111111', 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY) ),
(2 , 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) , 101, 'address 21', 121, 'T2222222', 0, DATE_ADD(CURDATE(), INTERVAL -10 DAY) ),
(3 , 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) , 102, 'address 22', 122, 'T2222222', 0, DATE_ADD(CURDATE(), INTERVAL -5 DAY) ),
(4 , 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) , 102, 'address 22', 122, 'T3333333', 0, DATE_ADD(CURDATE(), INTERVAL -4 DAY) ),
(5 , 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) , 103, 'address 23', 123, 'T3333333', 0, DATE_ADD(CURDATE(), INTERVAL -3 DAY) ),
(6 , 3, 3, 4, DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) , 103, 'address 23', 123, 'T4444444', 0, DATE_ADD(CURDATE(), INTERVAL -2 DAY) ),
(7 , 4, 4, 4, DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) , 104, 'address 24', 124, 'T4444444', 0, DATE_ADD(CURDATE(), INTERVAL -1 DAY) ),
(8 , 1, 1, 4, CURDATE(), CURDATE(), 104, 'address 24', 124, NULL, 0, CURDATE()),
(9 , 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 105, 'address 25', 125, 'A1111111', 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH) ),
(10, 6, 5, 5, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 105, 'address 25', 125, 'A1111111', 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH) ),
(11, 7, 1, 1, CURDATE() , DATE_ADD(CURDATE(), INTERVAL +1 DAY) , 101, 'address 21', 121, NULL, 0, CURDATE() ),
(12, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH) ),
(13, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +2 MONTH) ),
(14, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +3 MONTH) ),
(15, 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH), 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +4 MONTH) ),
(16, 1, 1, 1, CURDATE(), CURDATE(), 101, 'address 21', 121, NULL, 0, CURDATE() ),
(17, 4, 4, 4, CURDATE(), CURDATE(), 106, 'address 26', 126, NULL, 0, CURDATE() ),
(18, 4, 4, 4, CURDATE(), CURDATE(), 107, 'address 27', 127, NULL, 0, CURDATE() ),
(19, 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), 108, 'address 28', 128, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY) ),
(20, 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), 108, 'address 28', 128, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY) ),
(21, 5, 5, 4, CURDATE(), CURDATE(), 110, 'address 29', 129, NULL, 1, CURDATE() ),
(22, 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), 108, 'address 28', 128, NULL, 1, DATE_ADD(CURDATE(), INTERVAL +1 DAY) );
(1, 'Zone pickup A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 1, 0, 0, 0),
(2, 'Zone pickup B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 1, 0, 0, 0),
(3, 'Zone 247 A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 7, 1, 2, 0),
(4, 'Zone 247 B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 7, 1, 2, 0),
(5, 'Zone expensive A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 8, 1, 1000, 0),
(6, 'Zone expensive B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 8, 1, 1000, 0),
(7, 'Zone refund', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 10, 0, 0, 0),
(8, 'Zone others', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 23, 0, 0, 0),
(9, 'Zone superMan', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 2, 0, 0, 0),
(10, 'Zone teleportation', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 3, 3, 0, 0, 0),
(11, 'Zone pickup C', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 5, 1, 0, 0, 0),
(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`.`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, 1, 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, 23, 1, NULL, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'address 21', 121, NULL, 0, 8, CURDATE()),
(24 ,NULL, 23, 1, NULL, CURDATE(), CURDATE(), 101, 'Bruce Wayne', 1, NULL, 0, 8, CURDATE());
INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
VALUES
(1, 1, 1, 'ready' ),
(1, 11, 1, 'ready'),
(2, 2, 2, 'do it fast please'),
(3, 3, 3, 'Faster faster fasteeeeeer!!!'),
(4, 4, 3, 'Deliver before 8am'),
(5, 13, 3, 'You can run from the disappointments you are trying to forget. But its only when you embrace your past that you truly move forward. Maybe I never get to go home again, but I found my way there. And I am glad I did.'),
(6, 14, 3, 'Careful, armed warhead');
(6, 14, 3, 'Careful, armed warhead'),
(7, 23, 1, 'under the floor'),
(8, 23, 2, 'wears leather and goes out at night'),
(9, 23, 3, 'care with the dog'),
(10, 23, 4, 'Reclama ticket: 8'),
(11, 24, 4, 'Reclama ticket: 7');
INSERT INTO `vn`.`ticketTracking`(`id`, `ticketFk`, `stateFk`, `workerFk`, `created`)
VALUES
(1, 1, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
(2, 2, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -10 DAY)),
(3, 3, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -5 DAY)),
(4, 4, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -4 DAY)),
(5, 5, 16, 18, DATE_ADD(CURDATE(), INTERVAL -3 DAY)),
(6, 6, 16, 18, DATE_ADD(CURDATE(), INTERVAL -2 DAY)),
(7, 7, 16, 18, DATE_ADD(CURDATE(), INTERVAL -1 DAY)),
(8, 8, 3, 19, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
(9, 9, 16, 19, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
(10, 10, 16, 19, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
(1, 1, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
(2, 2, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
(3, 3, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
(4, 4, 16, 5 , DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
(5, 5, 16, 18, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)),
(6, 6, 16, 18, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
(7, 7, 10, 18, CURDATE()),
(8, 8, 5, 19, CURDATE()),
(9, 9, 5, 19, CURDATE()),
(10, 10, 5, 19, CURDATE()),
(11, 11, 3, 19, CURDATE()),
(12, 12, 3, 19, CURDATE()),
(13, 13, 3, 19, CURDATE()),
(14, 14, 3, 19, CURDATE()),
(15, 15, 3, 19, CURDATE()),
(16, 16, 1, 19, CURDATE()),
(17, 17, 1, 19, CURDATE()),
(18, 18, 1, 19, CURDATE()),
(19, 19, 13, 19, CURDATE()),
(20, 20, 13, 19, CURDATE()),
(21, 21, 3, 19, CURDATE()),
(23, 21, 13, 19, CURDATE());
(16, 16, 3, 19, CURDATE()),
(17, 17, 3, 19, CURDATE()),
(18, 18, 3, 19, CURDATE()),
(19, 19, 17, 19, CURDATE()),
(20, 20, 1, 19, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
(21, 21, 1, 19, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
(22, 22, 1, 19, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
(23, 23, 16, 21, CURDATE()),
(24, 24, 16, 21, CURDATE());
INSERT INTO `vn`.`stowaway`(`id`, `shipFk`, `created`)
VALUES
(19, 20, CURDATE());
(12, 13, CURDATE());
INSERT INTO `vn`.`vehicle`(`id`, `numberPlate`, `tradeMark`, `model`, `companyFk`, `warehouseFk`, `description`, `m3`, `isActive`)
VALUES
@ -608,17 +639,24 @@ INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `d
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `checked`, `workerFk`)
VALUES
(1, 1, 1, 71, CURDATE(), 1, 0, 1, 18),
(2, 1, 1, 71, CURDATE(), 2, 1, 0, 18),
(3, 2, 1, 71, CURDATE(), 3, 2, 0, 18),
(4, 1, 1, 71, CURDATE(), 1, 0, 1, 18),
(5, 1, 1, 71, CURDATE(), 2, 1, 0, 18),
(6, 2, 1, 71, CURDATE(), 3, 2, 0, 18);
(1, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 1, 18),
(2, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 18),
(3, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 3, 1, 18),
(4, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 18),
(5, 1, 2, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 1, 18),
(6, 7, 3, 71, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 1, 1, 1, 18),
(7, 2, 4, 71, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 1, 1, 1, 18),
(8, 3, 5, 71, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), 1, 1, 1, 18),
(9, 3, 6, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1, 1, 18),
(10, 7, 7, 71, CURDATE(), 1, 1, 1, 18);
INSERT INTO `vn`.`packaging`(`id`, `volume`, `width`, `height`, `depth`, `isPackageReturnable`, `created`, `itemFk`, `price`)
VALUES
(1, 0.00, 10, 10, 0, 0, CURDATE(), 6, 1.50),
(2, 100.00, 20, 20, 0, 0, CURDATE(), 7, 1.00),
(3, 14000.00, 0, 0, 0, 0, CURDATE(), NULL, 0),
(4, 218000.00, 0, 0, 0, 0, CURDATE(), NULL, 0),
(5, 292000.00, 0, 0, 0, 0, CURDATE(), NULL, 0),
(94, 140875.00, 49.00, 115.00, 25.00, 0, CURDATE(), 71, 0.00);
INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`, `created`, `pvp`)
@ -629,30 +667,38 @@ INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`,
INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `price`, `discount`, `reserved`, `isPicked`, `created`)
VALUES
(1, 1, 1, 'Ranged weapon longbow 2m', 5, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
(2, 2, 1, 'Melee weapon combat fist 15cm', 10, 1.07, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
(3, 1, 1, 'Ranged weapon longbow 2m', 2, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
(4, 4, 1, 'Melee weapon heavy shield 1x0.5m', 20, 3.06, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
(5, 1, 2, 'Ranged weapon longbow 2m', 10, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -10 DAY)),
(6, 1, 3, 'Ranged weapon longbow 2m', 15, 6.50, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -5 DAY)),
(7, 2, 11, 'Melee weapon combat fist 15cm', 15, 1.02, 0, 0, 0, CURDATE()),
(8, 4, 11, 'Melee weapon heavy shield 1x0.5m', 10, 3.01, 0, 0, 0, CURDATE()),
(9, 1, 16, 'Ranged weapon longbow 2m', 5, 9.10, 0, 0, 0, CURDATE()),
(10, 2, 16, 'Melee weapon combat fist 15cm', 10, 1.07, 0, 0, 0, CURDATE()),
(11, 1, 16, 'Ranged weapon longbow 2m', 2, 9.10, 0, 0, 0, CURDATE()),
(12, 4, 16, 'Melee weapon heavy shield 1x0.5m', 20, 3.06, 0, 0, 0, CURDATE()),
(13, 2, 8, 'Melee weapon combat fist 15cm', 15, 1.30, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
(14, 1, 8, 'Ranged weapon longbow 2m', 10, 9.28, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
(15, 1, 19, 'Ranged weapon longbow 2m', 10, 1.50, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY)),
(16, 2, 20, 'Melee weapon combat fist 15cm', 15, 1.30, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY)),
(17, 2, 22, 'Melee weapon combat fist 15cm', 30, 2.30, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY)),
(18, 4, 22, 'Melee weapon heavy shield 1x0.5m', 20, 3.00, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY)),
(19, 1, 4, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -4 DAY)),
(20, 1, 5, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -3 DAY)),
(21, 1, 6, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -2 DAY)),
(22, 1, 7, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 DAY)),
(23, 1, 9, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
(24, 1, 10, 'Ranged weapon longbow 2m', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH));
(1, 1, 1, 'Ranged weapon longbow 2m', 5, 100.39, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
(2, 2, 1, 'Melee weapon combat fist 15cm', 10, 7.07, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
(3, 1, 1, 'Ranged weapon longbow 2m', 2, 100.39, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
(4, 4, 1, 'Melee weapon heavy shield 1x0.5m', 20, 1.69, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
(5, 1, 2, 'Ranged weapon longbow 2m', 1, 110.33, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
(6, 1, 3, 'Ranged weapon longbow 2m', 1, 110.33, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
(7, 2, 11, 'Melee weapon combat fist 15cm', 15, 7.43, 0, 0, 0, CURDATE()),
(8, 4, 11, 'Melee weapon heavy shield 1x0.5m', 10, 1.79, 0, 0, 0, CURDATE()),
(9, 1, 16, 'Ranged weapon longbow 2m', 1, 103.49, 0, 0, 0, CURDATE()),
(10, 2, 16, 'Melee weapon combat fist 15cm', 10, 7.08, 0, 0, 0, CURDATE()),
(11, 1, 16, 'Ranged weapon longbow 2m', 1, 103.49, 0, 0, 0, CURDATE()),
(12, 4, 16, 'Melee weapon heavy shield 1x0.5m', 20, 1.71, 0, 0, 0, CURDATE()),
(13, 2, 8, 'Melee weapon combat fist 15cm', 10, 7.08, 0, 0, 0, CURDATE()),
(14, 1, 8, 'Ranged weapon longbow 2m', 2, 103.49, 0, 0, 0, CURDATE()),
(15, 1, 19, 'Ranged weapon longbow 2m', 1, 103.49, 0, 0, 0, CURDATE()),
(16, 2, 20, 'Melee weapon combat fist 15cm', 20, 7.07, 0, 0, 0, CURDATE()),
(17, 2, 22, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
(18, 4, 22, 'Melee weapon heavy shield 1x0.5m', 20, 1.69, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
(19, 1, 4, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
(20, 1, 5, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)),
(21, 1, 6, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
(22, 1, 7, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, CURDATE()),
(23, 1, 9, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, CURDATE()),
(24, 1, 10, 'Ranged weapon longbow 2m', 1, 8.07, 0, 0, 0, CURDATE()),
(25, 4, 12, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, CURDATE()),
(26, 4, 13, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, CURDATE()),
(27, 4, 14, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, CURDATE()),
(28, 4, 15, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, CURDATE()),
(29, 4, 17, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, CURDATE()),
(30, 4, 18, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, CURDATE()),
(31, 2, 23, 'Melee weapon combat fist 15cm', -5, 7.08, 0, 0, 0, CURDATE()),
(32, 1, 24, 'Ranged weapon longbow 2m', -1, 8.07, 0, 0, 0, CURDATE());
INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`)
VALUES
@ -661,123 +707,139 @@ INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`)
INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
VALUES
(1, 15, 0.58),
(1, 23, 6.5),
(1, 28, 20.72),
(1, 29, -18.72),
(1, 39, 0.02),
(2, 15, 0.058),
(2, 21, 0.002),
(2, 28, 5.6),
(2, 29, -4.6),
(2, 39, 0.01),
(3, 15, 0.58),
(3, 23, 6.5),
(3, 28, 20.72),
(3, 29, -18.72),
(3, 39, 0.02),
(4, 15, 0.051),
(4, 21, -0.001),
(4, 28, 20.72),
(4, 29, -19.72),
(4, 37, 2),
(4, 39, 0.01),
(5, 15, 0.58),
(5, 23, 6.5),
(5, 28, 20.72),
(5, 29, -18.72),
(5, 39, 0.02),
(6, 23, 6.5),
(1, 28, 50),
(1, 29, 49.4),
(1, 39, 0.994),
(2, 28, 5),
(2, 29, 2),
(2, 39, 0.07),
(3, 28, 50),
(3, 29, 49.4),
(3, 39, 0.994),
(4, 28, 1.25),
(4, 29, 0.42),
(4, 39, 0.017),
(5, 17, 9.94),
(5, 28, 50),
(5, 29, 49.4),
(5, 39, 0.994),
(6, 17, 9.94),
(6, 28, 50),
(6, 29, 49.4),
(6, 39, 0.994),
(7, 15, 0.0114),
(7, 28, 5.6),
(7, 29, -4.6),
(7, 39, 0.01),
(8, 15, 0.0016),
(8, 28, 20.72),
(8, 29, -19.72),
(8, 37, 2),
(8, 39, 0.01),
(9, 15, 0.58),
(9, 23, 6.5),
(9, 28, 20.72),
(9, 29, -18.72),
(9, 39, 0.02),
(10, 15, 0.058),
(10, 21, 0.002),
(10, 28, 5.6),
(10, 29, -4.6),
(10, 39, 0.01),
(11, 15, 0.58),
(11, 23, 6.5),
(11, 28, 20.72),
(11, 29, -18.72),
(11, 39, 0.02),
(12, 15, 0.051),
(12, 22, -0.001),
(12, 28, 20.72),
(12, 29, -19.72),
(12, 37, 2),
(12, 39, 0.01),
(13, 15, 0.2899),
(13, 28, 5.6),
(13, 29, -4.6),
(13, 39, 0.01),
(14, 15, 0.58),
(14, 23, 6.5),
(14, 28, 20.72),
(14, 29, -18.72),
(14, 39, 0.02),
(15, 15, 0.58),
(15, 23, 6.5),
(15, 28, 20.72),
(15, 29, -18.72),
(15, 39, 0.02),
(16, 15, 0.058),
(16, 21, 0.002),
(16, 28, 5.6),
(16, 29, -4.6),
(16, 39, 0.01),
(17, 15, 0.058),
(17, 21, 0.002),
(17, 28, 5.6),
(17, 29, -4.6),
(17, 39, 0.01),
(18, 15, 0.051),
(18, 22, -0.001),
(18, 28, 20.72),
(18, 29, -19.72),
(18, 37, 2),
(18, 39, 0.01),
(19, 15, 0.58),
(19, 23, 6.5),
(19, 28, 20.72),
(19, 29, -18.72),
(7, 17, 0.35),
(7, 28, 5),
(7, 29, 2),
(7, 39, 0.07),
(8, 15, 0.0199),
(8, 17, 0.084),
(8, 28, 1.25),
(8, 29, 0.42),
(8, 39, 0.017),
(9, 15, 3.0949),
(9, 21, 0.001),
(9, 28, 50),
(9, 29, 49.4),
(9, 39, 0.994),
(10, 15, 0.0111),
(10, 21, -0.001),
(10, 28, 5),
(10, 29, 2),
(10, 39, 0.07),
(11, 15, 3.0949),
(11, 21, 0.001),
(11, 28, 50),
(11, 29, 49.4),
(11, 39, 0.994),
(12, 15, 0.0199),
(12, 21, 0.003),
(12, 28, 1.25),
(12, 29, 0.42),
(12, 39, 0.017),
(13, 15, 0.114),
(13, 28, 5),
(13, 29, 2),
(13, 39, 0.07),
(14, 15, 3.0949),
(14, 28, 50),
(14, 29, 49.4),
(14, 39, 0.994),
(15, 15, 3.0949),
(15, 28, 50),
(15, 29, 49.4),
(15, 39, 0.994),
(16, 28, 5),
(16, 29, 2),
(16, 39, 0.07),
(17, 28, 5),
(17, 29, 2),
(17, 39, 0.07),
(18, 28, 1.25),
(18, 29, 0.42),
(18, 39, 0.017),
(19, 17, 0.7),
(19, 22, 0.3),
(19, 28, 5),
(19, 29, 2),
(19, 39, 0.02),
(20, 15, 0.58),
(20, 23, 6.5),
(20, 28, 20.72),
(20, 29, -18.72),
(20, 17, 0.7),
(20, 22, 0.3),
(20, 28, 5),
(20, 29, 2),
(20, 39, 0.02),
(21, 15, 0.58),
(21, 23, 6.5),
(21, 28, 20.72),
(21, 29, -18.72),
(21, 17, 0.7),
(21, 22, 0.3),
(21, 28, 5),
(21, 29, 2),
(21, 39, 0.02),
(22, 15, 0.58),
(22, 23, 6.5),
(22, 28, 20.72),
(22, 29, -18.72),
(22, 17, 0.7),
(22, 22, 0.3),
(22, 28, 5),
(22, 29, 2),
(22, 39, 0.02),
(23, 15, 0.58),
(23, 23, 6.5),
(23, 28, 20.72),
(23, 29, -18.72),
(23, 17, 0.7),
(23, 22, 0.3),
(23, 28, 5),
(23, 29, 2),
(23, 39, 0.02),
(24, 15, 0.58),
(24, 23, 6.5),
(24, 28, 20.72),
(24, 29, -18.72),
(24, 39, 0.02);
(24, 17, 0.7),
(24, 22, 0.3),
(24, 28, 5),
(24, 29, 2),
(24, 39, 0.02),
(25, 17, 0.033),
(25, 28, 1.25),
(25, 29, 0.42),
(25, 39, 0.017),
(26, 17, 0.033),
(26, 28, 1.25),
(26, 29, 0.42),
(26, 39, 0.017),
(27, 17, 0.033),
(27, 28, 1.25),
(27, 29, 0.42),
(27, 39, 0.017),
(28, 17, 0.033),
(28, 28, 1.25),
(28, 29, 0.42),
(28, 39, 0.017),
(29, 17, 0.033),
(29, 28, 1.25),
(29, 29, 0.42),
(29, 39, 0.017),
(30, 17, 0.033),
(30, 28, 1.25),
(30, 29, 0.42),
(30, 39, 0.017),
(31, 28, 5),
(31, 29, 2),
(31, 36, 0.01),
(31, 39, 0.07),
(32, 28, 50),
(32, 29, 49.4),
(32, 36, -92.324),
(32, 39, 0.994);
INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`, `stateFk`)
VALUES
@ -930,6 +992,8 @@ INSERT INTO `vn`.`itemTypeTag`(`id`, `itemTypeFk`, `tagFk`, `priority`)
(4, 1, 4, 1),
(5, 1, 5, 1);
CALL `vn`.`itemRefreshTags`(NULL);
INSERT INTO `vn`.`itemLog` (`id`, `originFk`, `userFk`, `action`, `description`)
VALUES
('1', '1', '1', 'insert', 'We made a change!');
@ -941,13 +1005,6 @@ INSERT INTO `vn`.`recovery`(`id`, `clientFk`, `started`, `finished`, `amount`, `
(3, 102, CURDATE(), DATE_ADD(CURDATE(),INTERVAL 1 MONTH), 50, 7),
(4, 103, CURDATE(), NULL, 50, 7);
INSERT INTO `bi`.`rotacion`(`Id_Article`, `warehouse_id`, `total`, `rotacion`, `cm3`, `almacenaje`, `manipulacion`, `auxiliar`, `mermas`)
VALUES
(1, 1, 0, 0.0000, 1500, 0.0015, 0.0250, 0.0085, 0.0000),
(1, 2, 0, 0.0000, 100, 0.0060, 0.0200, 0.0080, 0.0000),
(2, 1, 10, 3.5000, 0, 0.0000, 0.0000, 0.0080, 0.0000),
(3, 1, 50, 5.5000, 100, 0.0000, 0.0000, 0.0080, 0.0000);
INSERT INTO `vn`.`annualAverageInvoiced`(`clientFk`, `invoiced`)
VALUES
(101, 1500),
@ -981,15 +1038,20 @@ INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseO
(1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000),
(2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150, 2000),
(3, CURDATE(), CURDATE(), 1, 2, 1, 0.00, 0.00),
(4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 50.00, 500);
(4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 50.00, 500),
(5, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3, 2, 1, 50.00, 500),
(6, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 2, 1, 50.00, 500),
(7, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 2, 1, 50.00, 500);
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `companyFk`,`ref`)
VALUES
(1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 442, 'Movimiento 1'),
(2, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 442, 'Movimiento 2'),
(3, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3, 442, 'Movimiento 3'),
(4, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 69, 'Movimiento 4');
(4, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4, 69, 'Movimiento 4'),
(5, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 442, 'Movimiento 5'),
(6, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 6, 442, 'Movimiento 6'),
(7, 2, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 7, 442, 'Movimiento 7');
INSERT INTO `bi`.`claims_ratio`(`id_Cliente`, `Consumo`, `Reclamaciones`, `Ratio`, `recobro`, `inflacion`)
VALUES
@ -1000,14 +1062,21 @@ INSERT INTO `bi`.`claims_ratio`(`id_Cliente`, `Consumo`, `Reclamaciones`, `Ratio
INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packageFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`,`minPrice`,`producer`,`printedStickers`,`isChecked`,`isIgnored`, `created`)
VALUES
(1, 1, 1, 2.5, 5000, 1, 1, 0.350, 0.050, 0.000, 10, 10, 1, NULL, 0.00, 1.30, 1.25, 1.00, NULL, 0, 1, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
(2, 2, 1, 20 , 100, 1, 1, 0.700, 0.020, 0.000, 5, 5, 1, NULL, 0.00, 2.50, 2.00, 0.50, NULL, 0, 1, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
(3, 3, 1, 20 , 100, 1, 1, 0.700, 0.020, 0.000, 1, 1, 0, NULL, 0.00, 2.50, 2.00, 0.50, NULL, 0, 1, 0, CURDATE()),
(4, 2, 2, 5 , 450, 1, 1, 0.500, 0.100, 0.000, 10, 10, 0, NULL, 0.00, 1.30, 1.00, 0.00, NULL, 0, 1, 0, CURDATE()),
(5, 3, 3, 10 , 500, 1, 1, 1.000, 0.050, 0.000, 10, 10, 0, NULL, 0.00, 2.50, 1.00, 0.00, NULL, 0, 1, 0, CURDATE()),
(6, 4, 8, 20 , 1000, 1, 1, 0.700, 0.020, 0.000, 10, 10, 1, NULL, 0.00, 2.50, 1.00, 0.00, NULL, 0, 1, 0, CURDATE()),
(7, 4, 9, 20 , 1000, 1, 1, 0.700, 0.020, 0.000, 10, 10, 1, NULL, 0.00, 2.50, 1.00, 0.00, NULL, 0, 1, 0, CURDATE()),
(8, 4, 4, 20 , 1000, 1, 1, 0.700, 0.020, 0.000, 10, 10, 1, NULL, 0.00, 2.50, 1.00, 0.00, NULL, 0, 1, 0, CURDATE());
(1, 1, 1, 50, 5000, 4, 1, 0.000, 0.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
(2, 2, 1, 50, 100, 4, 1, 0.000, 0.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
(3, 3, 1, 50, 100, 4, 1, 0.000, 0.000, 0.000, 1, 1, 0, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, CURDATE()),
(4, 2, 2, 5, 450, 1, 1, 0.000, 0.000, 0.000, 10, 10, 0, NULL, 0.00, 7.30, 7.00, 0.00, NULL, 0, 1, 0, CURDATE()),
(5, 3, 3, 55, 500, 5, 1, 0.000, 0.000, 0.000, 1, 1, 0, NULL, 0.00, 78.3, 75.6, 0.00, NULL, 0, 1, 0, CURDATE()),
(6, 4, 8, 50, 1000, 4, 1, 0.000, 0.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, CURDATE()),
(7, 4, 9, 20, 1000, 1, 1, 0.000, 0.000, 0.000, 10, 10, 1, NULL, 0.00, 30.50, 29.00, 0.00, NULL, 0, 1, 0, CURDATE()),
(8, 4, 4, 1.25, 1000, 3, 1, 0.000, 0.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0.00, NULL, 0, 1, 0, CURDATE()),
(9, 4, 4, 1.25, 1000, 3, 1, 0.000, 0.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0.00, NULL, 0, 1, 0, CURDATE()),
(10, 5, 1, 50, 10, 4, 1, 0.000, 0.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, CURDATE()),
(11, 5, 4, 1.25, 10, 3, 1, 0.000, 0.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0.00, NULL, 0, 1, 0, CURDATE()),
(12, 6, 4, 1.25, 0, 3, 1, 0.000, 0.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0.00, NULL, 0, 1, 0, CURDATE()),
(13, 7, 1, 50, 0, 3, 1, 0.000, 0.000, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0.00, NULL, 0, 1, 0, CURDATE()),
(14, 7, 2, 5, 0, 3, 1, 0.000, 0.000, 0.000, 10, 10, 1, NULL, 0.00, 7.30, 7.00, 0.00, NULL, 0, 1, 0, CURDATE()),
(15, 7, 4, 1.25, 0, 3, 1, 0.000, 0.000, 0.000, 10, 10, 1, NULL, 0.00, 1.75, 1.67, 0.00, NULL, 0, 1, 0, CURDATE());
INSERT INTO `vn2008`.`tblContadores`(`id`,`FechaInventario`)
VALUES
@ -1030,43 +1099,61 @@ INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`)
INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`, `date_make`, `first_row_stamp`, `confirm_date`)
VALUES
(1 , DATE_ADD(CURDATE(), INTERVAL -15 DAY), 101, 1, 1, 121, 442, NULL, 'TPV', 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), DATE_ADD(CURDATE(), INTERVAL -15 DAY), DATE_ADD(CURDATE(), INTERVAL -15 DAY)),
(2 , DATE_ADD(CURDATE(), INTERVAL -10 DAY), 101, 2, 1, 121, 442, NULL, 'WEB', 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL -10 DAY)),
(3 , DATE_ADD(CURDATE(), INTERVAL -5 DAY), 102, 3, 2, 122, 442, NULL, 'ANDROID', 1, DATE_ADD(CURDATE(), INTERVAL -5 DAY), DATE_ADD(CURDATE(), INTERVAL -5 DAY), DATE_ADD(CURDATE(), INTERVAL -5 DAY)),
(4 , DATE_ADD(CURDATE(), INTERVAL -4 DAY), 102, 1, 2, 122, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -4 DAY), DATE_ADD(CURDATE(), INTERVAL -4 DAY), DATE_ADD(CURDATE(), INTERVAL -4 DAY)),
(5 , DATE_ADD(CURDATE(), INTERVAL -3 DAY), 103, 2, 3, 123, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -3 DAY), DATE_ADD(CURDATE(), INTERVAL -3 DAY), DATE_ADD(CURDATE(), INTERVAL -3 DAY)),
(6 , DATE_ADD(CURDATE(), INTERVAL -2 DAY), 103, 3, 3, 123, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -2 DAY), DATE_ADD(CURDATE(), INTERVAL -2 DAY), DATE_ADD(CURDATE(), INTERVAL -2 DAY)),
(7 , DATE_ADD(CURDATE(), INTERVAL -1 DAY), 104, 1, 4, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -1 DAY), DATE_ADD(CURDATE(), INTERVAL -1 DAY), DATE_ADD(CURDATE(), INTERVAL -1 DAY)),
(8 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 104, 2, 4, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
(9 , DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 105, 3, 5, 125, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
(10, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 105, 1, 6, 125, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
(11, CURDATE(), 101, 2, 7, 121, 442, NULL, 'SALIX', 1, CURDATE(), CURDATE(), CURDATE()),
(12, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 101, 3, 1, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
(13, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 101, 1, 2, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH)),
(14, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), 101, 2, 2, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH)),
(15, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), 101, 3, 3, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH)),
(16, DATE_ADD(CURDATE(), INTERVAL +2 DAY), 101, 1, 7, 121, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(17, CURDATE(), 106, 2, 4, 126, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(18, CURDATE(), 107, 3, 4, 127, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(19, CURDATE(), 108, 1, 5, 128, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(20, CURDATE(), 109, 2, 1, 119, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(21, CURDATE(), 110, 3, 5, 129, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE());
(1, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 3, 1, 121, 442, NULL, 'TPV', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
(2, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 104, 3, 1, 124, 442, NULL, 'WEB', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
(3, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 104, 1, 2, 124, 442, NULL, 'ANDROID', 1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
(4, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 104, 1, 2, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
(5, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 104, 1, 3, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(CURDATE(), INTERVAL -4 MONTH)),
(6, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 1, 3, 1, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
(7, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 2, 7, 1, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(8, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 2, 7, 121, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(9, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 2, 7, 124, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(10, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 3, 1, 2, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(11, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 2, 7, 122, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(12, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 3, 1, 3, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(13, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 1, 2, 123, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(14, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 1, 2, 4, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(15, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 1, 3, 125, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(16, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 2, 7, 126, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(17, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 107, 1, 4, 127, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(18, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 1, 4, 128, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(19, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 1, 5, 129, 442, NULL, 'SALIX', 0, CURDATE(), CURDATE(), CURDATE()),
(20, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 101, 442, NULL, 'SALIX', 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
(21, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 102, 442, NULL, 'SALIX', 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
(22, DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 1, 5, 103, 442, NULL, 'SALIX', 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH));
INSERT INTO `hedera`.`orderRow`(`id`, `orderFk`, `itemFk`, `warehouseFk`, `shipment`, `amount`, `price`, `rate`, `created`, `saleFk`)
VALUES
(1, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 5, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 1),
(2, 1, 2, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 10, 1.07, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 2),
(3, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 2, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 3),
(4, 1, 4, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 20, 3.06, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 4),
(5, 2, 1, 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 10, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 5),
(6, 3, 1, 2, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 15, 6.50, 0, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 6),
(1, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1),
(2, 1, 2, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 10, 1.07, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2),
(3, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 3),
(4, 1, 4, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 20, 3.06, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 4),
(5, 2, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 10, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 5),
(6, 3, 1, 2, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 15, 6.50, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 6),
(7, 11, 2, 1, CURDATE(), 15, 1.30, 0, CURDATE(), 7),
(8, 11, 4, 1, CURDATE(), 10, 3.26, 0, CURDATE(), 8),
(9, 16, 1, 1, CURDATE(), 5, 9.10, 0, CURDATE(), 9),
(10, 16, 2, 1, CURDATE(), 10, 1.07, 0, CURDATE(), 10),
(11, 16, 1, 1, CURDATE(), 2, 9.10, 0, CURDATE(), 11),
(12, 16, 4, 1, CURDATE(), 20, 3.06, 0, CURDATE(), 12),
(13, 20, 1, 1, CURDATE(), 2, 9.10, 0, CURDATE(), NULL);
(13, 8, 2, 1, CURDATE(), 15, 1.30, 0, CURDATE(), 13),
(14, 8, 1, 1, CURDATE(), 10, 9.28, 0, CURDATE(), 14),
(15, 19, 1, 1, CURDATE(), 10, 1.50, 0, CURDATE(), 15),
(16, 20, 2, 1, CURDATE(), 15, 1.30, 0, CURDATE(), 16),
(17, 22, 2, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 30, 2.30, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 17),
(18, 22, 4, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 20, 3.00, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 18),
(19, 4, 1, 1, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 1, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 19),
(20, 5, 1, 1, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), 1, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), 20),
(21, 6, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 9.10, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 21),
(22, 7, 1, 1, CURDATE(), 1, 9.10, 0, CURDATE(), 22),
(23, 9, 1, 1, CURDATE(), 1, 9.10, 0, CURDATE(), 23),
(24, 10, 1, 1, CURDATE(), 1, 9.10, 0, CURDATE(), 24),
(25, 12, 4, 1, CURDATE(), 20, 3.00, 0, CURDATE(), 25),
(26, 13, 4, 1, CURDATE(), 20, 3.00, 0, CURDATE(), 26),
(27, 14, 4, 1, CURDATE(), 20, 3.00, 0, CURDATE(), 27),
(28, 15, 4, 1, CURDATE(), 20, 3.00, 0, CURDATE(), 28),
(29, 17, 4, 1, CURDATE(), 20, 3.00, 0, CURDATE(), 29),
(30, 18, 4, 1, CURDATE(), 20, 3.00, 0, CURDATE(), 30);
INSERT INTO `hedera`.`orderRowComponent`(`rowFk`, `componentFk`, `price`)
VALUES
@ -1097,12 +1184,11 @@ INSERT INTO `hedera`.`orderRowComponent`(`rowFk`, `componentFk`, `price`)
(5, 29, -18.72),
(5, 39, 0.02),
(6, 23, 6.5),
(7, 15, 0.2899),
(7, 15, 0.0114),
(7, 28, 5.6),
(7, 29, -4.6),
(7, 39, 0.01),
(8, 15, 0.254),
(8, 21, -0.004),
(8, 15, 0.0016),
(8, 28, 20.72),
(8, 29, -19.72),
(8, 37, 2),
@ -1128,11 +1214,102 @@ INSERT INTO `hedera`.`orderRowComponent`(`rowFk`, `componentFk`, `price`)
(12, 29, -19.72),
(12, 37, 2),
(12, 39, 0.01),
(13, 15, 0.58),
(13, 23, 6.5),
(13, 28, 20.72),
(13, 29, -18.72),
(13, 39, 0.02);
(13, 15, 0.2899),
(13, 28, 5.6),
(13, 29, -4.6),
(13, 39, 0.01),
(14, 15, 0.58),
(14, 23, 6.5),
(14, 28, 20.72),
(14, 29, -18.72),
(14, 39, 0.02),
(15, 15, 0.58),
(15, 23, 6.5),
(15, 28, 20.72),
(15, 29, -18.72),
(15, 39, 0.02),
(16, 15, 0.058),
(16, 21, 0.002),
(16, 28, 5.6),
(16, 29, -4.6),
(16, 39, 0.01),
(17, 15, 0.058),
(17, 21, 0.002),
(17, 28, 5.6),
(17, 29, -4.6),
(17, 39, 0.01),
(18, 15, 0.051),
(18, 22, -0.001),
(18, 28, 20.72),
(18, 29, -19.72),
(18, 37, 2),
(18, 39, 0.01),
(19, 15, 0.58),
(19, 23, 6.5),
(19, 28, 20.72),
(19, 29, -18.72),
(19, 39, 0.02),
(20, 15, 0.58),
(20, 23, 6.5),
(20, 28, 20.72),
(20, 29, -18.72),
(20, 39, 0.02),
(21, 15, 0.58),
(21, 23, 6.5),
(21, 28, 20.72),
(21, 29, -18.72),
(21, 39, 0.02),
(22, 15, 0.58),
(22, 23, 6.5),
(22, 28, 20.72),
(22, 29, -18.72),
(22, 39, 0.02),
(23, 15, 0.58),
(23, 23, 6.5),
(23, 28, 20.72),
(23, 29, -18.72),
(23, 39, 0.02),
(24, 15, 0.58),
(24, 23, 6.5),
(24, 28, 20.72),
(24, 29, -18.72),
(24, 39, 0.02),
(25, 15, 0.051),
(25, 22, -0.001),
(25, 28, 20.72),
(25, 29, -19.72),
(25, 37, 2),
(25, 39, 0.01),
(26, 15, 0.051),
(26, 22, -0.001),
(26, 28, 20.72),
(26, 29, -19.72),
(26, 37, 2),
(26, 39, 0.01),
(27, 15, 0.051),
(27, 22, -0.001),
(27, 28, 20.72),
(27, 29, -19.72),
(27, 37, 2),
(27, 39, 0.01),
(28, 15, 0.051),
(28, 22, -0.001),
(28, 28, 20.72),
(28, 29, -19.72),
(28, 37, 2),
(28, 39, 0.01),
(29, 15, 0.051),
(29, 22, -0.001),
(29, 28, 20.72),
(29, 29, -19.72),
(29, 37, 2),
(29, 39, 0.01),
(30, 15, 0.051),
(30, 22, -0.001),
(30, 28, 20.72),
(30, 29, -19.72),
(30, 37, 2),
(30, 39, 0.01);
INSERT INTO `vn`.`clientContact`(`id`, `clientFk`, `name`, `phone`)
VALUES
@ -1169,24 +1346,23 @@ INSERT INTO `vn`.`claimState`(`id`, `description`, `roleFk`)
INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `observation`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created` )
VALUES
(1, CURDATE(), 1, 'observation one', 101, 18, 1, 0, CURDATE()),
(2, CURDATE(), 2, 'observation two', 101, 18, 2, 0, CURDATE()),
(3, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 3, 'observation three', 101, 18, 3, 0, CURDATE()),
(4, CURDATE(), 3, 'observation four', 104, 18, 1, 0, CURDATE());
(1, CURDATE(), 1, 'observation one', 101, 18, 3, 0, CURDATE()),
(2, CURDATE(), 2, 'observation two', 101, 18, 3, 0, CURDATE()),
(3, CURDATE(), 3, 'observation three', 101, 18, 1, 1, CURDATE()),
(4, CURDATE(), 3, 'observation four', 104, 18, 5, 0, CURDATE());
INSERT INTO `vn`.`claimBeginning`(`id`, `claimFk`, `saleFk`, `quantity`)
VALUES
(1, 1, 7, 5),
(2, 1, 8, 4),
(3, 2, 10, 10),
(4, 3, 6, 5),
(5, 4, 13, 5);
(2, 2, 10, 10),
(3, 3, 22, 1),
(4, 4, 13, 5);
INSERT INTO `vn`.`claimDestination`(`id`, `description`, `addressFk`)
VALUES
(1, 'Bueno', null),
(1, 'Bueno', NULL),
(2, 'Basura/Perd.', 12),
(3, 'Confeccion', null),
(3, 'Confeccion', NULL),
(4, 'Reclam.PRAG', 12),
(5, 'Corregido', 11);
@ -1198,6 +1374,11 @@ INSERT INTO `vn`.`claimDevelopment`(`id`, `claimFk`, `claimResponsibleFk`, `work
(4, 3, 7, 21, 15, 8, 2, 5),
(5, 4, 7, 21, 7, 8, 2, 5);
INSERT INTO `vn`.`claimEnd`(`id`, `saleFk`, `claimFk`, `workerFk`, `claimDestinationFk`)
VALUES
(1, 31, 4, 21, 2),
(2, 32, 3, 21, 3);
INSERT INTO `hedera`.`tpvMerchant`(`id`, `description`, `companyFk`, `bankFk`, `secretKey`)
VALUES
(1, 'Arkham Bank', 442, 1, 'h12387193H10238'),
@ -1228,7 +1409,14 @@ INSERT INTO `vn`.`orderTicket`(`orderFk`, `ticketFk`)
(12, 12),
(13, 13),
(14, 14),
(15, 15);
(15, 15),
(16, 16),
(17, 17),
(18, 18),
(19, 19),
(20, 20),
(21, 21),
(22, 22);
INSERT INTO `vn`.`userConfig` (`userFk`, `warehouseFk`, `companyFk`)
VALUES
@ -1353,17 +1541,6 @@ INSERT INTO `vn`.`sharingCart`(`id`, `workerFk`, `started`, `ended`, `workerSubs
VALUES
(1, 18, DATE_ADD(CURDATE(), INTERVAL -5 DAY), DATE_ADD(CURDATE(), INTERVAL +15 DAY), 19, DATE_ADD(CURDATE(), INTERVAL -5 DAY));
INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `warehouseFk`, `agencyModeFk`, `travelingDays`, `price`, `bonus`)
VALUES
(1, 'Zone pickup A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 1, 0, '0', '0'),
(2, 'Zone pickup B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 1, 0, '0', '0'),
(3, 'Zone 247 A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 7, 1, '2', '0'),
(4, 'Zone 247 B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 7, 1, '2', '0'),
(5, 'Zone expensive A', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 8, 1, '5', '-1'),
(6, 'Zone expensive B', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 2, 8, 1, '5', '-1'),
(7, 'Zone refund', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 10, 0, 0, 0),
(8, 'Zone others', CONCAT(CURRENT_DATE(), ' ', TIME('22:00')), 1, 23, 0, 0, 0);
INSERT INTO `vn`.`zoneIncluded` (`zoneFk`, `geoFk`, `isIncluded`)
VALUES
(1, 3, 0),

File diff suppressed because it is too large Load Diff

View File

@ -20,21 +20,27 @@ describe('last_buy_refresh()', () => {
let lastBuyTable = result[lastBuyTableIndex];
expect(lastBuyTable.length).toEqual(4);
expect(lastBuyTable.length).toEqual(6);
expect(lastBuyTable[0].item_id).toEqual(1);
expect(lastBuyTable[1].item_id).toEqual(2);
expect(lastBuyTable[2].item_id).toEqual(3);
expect(lastBuyTable[3].item_id).toEqual(4);
expect(lastBuyTable[4].item_id).toEqual(8);
expect(lastBuyTable[5].item_id).toEqual(9);
expect(lastBuyTable[0].warehouse_id).toEqual(1);
expect(lastBuyTable[1].warehouse_id).toEqual(1);
expect(lastBuyTable[2].warehouse_id).toEqual(1);
expect(lastBuyTable[3].warehouse_id).toEqual(1);
expect(lastBuyTable[4].warehouse_id).toEqual(1);
expect(lastBuyTable[5].warehouse_id).toEqual(1);
expect(lastBuyTable[1].buy_id).toEqual(4);
expect(lastBuyTable[0].buy_id).toEqual(3);
expect(lastBuyTable[2].buy_id).toEqual(5);
expect(lastBuyTable[3].buy_id).toEqual(6);
expect(lastBuyTable[3].buy_id).toEqual(8);
expect(lastBuyTable[4].buy_id).toEqual(6);
expect(lastBuyTable[5].buy_id).toEqual(7);
});
});

View File

@ -29,21 +29,27 @@ describe('buyUltimate()', () => {
let buyUltimateTable = result[buyUltimateTableIndex];
expect(buyUltimateTable.length).toEqual(4);
expect(buyUltimateTable.length).toEqual(6);
expect(buyUltimateTable[0].itemFk).toEqual(1);
expect(buyUltimateTable[1].itemFk).toEqual(2);
expect(buyUltimateTable[2].itemFk).toEqual(3);
expect(buyUltimateTable[3].itemFk).toEqual(4);
expect(buyUltimateTable[4].itemFk).toEqual(8);
expect(buyUltimateTable[5].itemFk).toEqual(9);
expect(buyUltimateTable[0].warehouseFk).toEqual(1);
expect(buyUltimateTable[1].warehouseFk).toEqual(1);
expect(buyUltimateTable[2].warehouseFk).toEqual(1);
expect(buyUltimateTable[3].warehouseFk).toEqual(1);
expect(buyUltimateTable[4].warehouseFk).toEqual(1);
expect(buyUltimateTable[5].warehouseFk).toEqual(1);
expect(buyUltimateTable[1].buyFk).toEqual(4);
expect(buyUltimateTable[0].buyFk).toEqual(3);
expect(buyUltimateTable[2].buyFk).toEqual(5);
expect(buyUltimateTable[3].buyFk).toEqual(6);
expect(buyUltimateTable[3].buyFk).toEqual(8);
expect(buyUltimateTable[4].buyFk).toEqual(6);
expect(buyUltimateTable[5].buyFk).toEqual(7);
});
});

View File

@ -86,18 +86,20 @@ describe('ticket ticketCalculateClon()', () => {
stmt = new ParameterizedSQL('CALL vn.ticketCalculateClon(@result, ?)', [params.originalTicketId]);
stmts.push(stmt);
let orderIndex = stmts.push(`SELECT * FROM vn.orderTicket WHERE ticketFk = @result`) - 1;
stmts.push('ROLLBACK');
let sql = ParameterizedSQL.join(stmts, ';');
let result = await app.models.Ticket.rawStmt(sql);
let expectedOrder = 11;
let newestTicketIdInFixtures = 21;
let error;
expect(result[orderIndex][0].orderFk).toEqual(expectedOrder);
expect(result[orderIndex][0].ticketFk).toBeGreaterThan(newestTicketIdInFixtures);
try {
await app.models.Ticket.rawStmt(sql);
} catch (e) {
error = e;
}
expect(error).toBeDefined();
expect(error.statusCode).toBe(500);
expect(error.code).toBe('ER_SIGNAL_EXCEPTION');
});
});

View File

@ -14,8 +14,8 @@ describe('ticket ticketCreateWithUser()', () => {
shipped: today,
warehouseFk: 1,
companyFk: 442,
addressFk: 1,
agencyModeFk: 2,
addressFk: 121,
agencyModeFk: 1,
routeFk: null,
landed: today,
userId: 18
@ -64,8 +64,8 @@ describe('ticket ticketCreateWithUser()', () => {
shipped: today,
warehouseFk: 1,
companyFk: 442,
addressFk: 1,
agencyModeFk: 2,
addressFk: 121,
agencyModeFk: 1,
routeFk: null,
landed: today,
userId: 18
@ -91,7 +91,6 @@ describe('ticket ticketCreateWithUser()', () => {
let sql = ParameterizedSQL.join(stmts, ';');
let result = await app.models.Ticket.rawStmt(sql);
let firstTicketObservation = result[ticketObsevationsIndex][0];
let secondTicketObservation = result[ticketObsevationsIndex][1];
let thirdTicketObservation = result[ticketObsevationsIndex][2];
@ -116,7 +115,7 @@ describe('ticket ticketCreateWithUser()', () => {
warehouseFk: 1,
companyFk: 442,
addressFk: 0,
agencyModeFk: 2,
agencyModeFk: 1,
routeFk: null,
landed: today,
userId: 18
@ -162,8 +161,8 @@ describe('ticket ticketCreateWithUser()', () => {
shipped: today,
warehouseFk: 1,
companyFk: 442,
addressFk: 0,
agencyModeFk: 2,
addressFk: 121,
agencyModeFk: 1,
routeFk: null,
landed: today,
userId: 18
@ -186,7 +185,7 @@ describe('ticket ticketCreateWithUser()', () => {
params.userId
]);
stmts.push(stmt);
stmts.push(`select @newTicketId`);
let ticketStateCodeIndex = stmts.push(`SELECT code FROM vn.ticketState WHERE ticketFk = @newTicketId`) - 1;
stmts.push('ROLLBACK');
@ -196,6 +195,6 @@ describe('ticket ticketCreateWithUser()', () => {
let ticketStateCode = result[ticketStateCodeIndex][0].code;
expect(ticketStateCode).toEqual('DELIVERED');
expect(ticketStateCode).toEqual('FREE');
});
});

1
e2e/dms/temp/file.txt Normal file
View File

@ -0,0 +1 @@
It works!

View File

@ -1,3 +1,3 @@
export default {
module.exports = {
url: 'http://localhost:5000'
};

View File

@ -144,6 +144,7 @@ let actions = {
waitToGetProperty: function(selector, property, done) {
this.wait((selector, property) => {
const element = document.querySelector(selector);
return element && element[property] != null && element[property] !== '';
}, selector, property)
.getProperty(selector, property)
@ -164,10 +165,10 @@ let actions = {
.catch(done);
},
waitToFocus: function(selector, done) {
focusElement: function(selector, done) {
this.wait(selector)
.evaluate_now(selector => {
let element = document.querySelector(selector);
.evaluate_now(elemenetSelector => {
let element = document.querySelector(elemenetSelector);
element.focus();
}, done, selector)
.then(done)
@ -270,8 +271,8 @@ let actions = {
waitForClassPresent: function(selector, className, done) {
this.wait(selector)
.wait((selector, className) => {
if (document.querySelector(selector).classList.contains(className))
.wait((elementSelector, targetClass) => {
if (document.querySelector(elementSelector).classList.contains(targetClass))
return true;
}, selector, className)
.then(done)
@ -398,7 +399,7 @@ let actions = {
},
autocompleteSearch: function(autocompleteSelector, searchValue, done) {
this.wait(autocompleteSelector)
this.wait(`${autocompleteSelector} input`)
.waitToClick(`${autocompleteSelector} input`)
.write(`${autocompleteSelector} vn-drop-down input`, searchValue)
.waitToClick(`${autocompleteSelector} li.active`)
@ -488,7 +489,14 @@ let actions = {
})
.then(done)
.catch(done);
}
},
waitForSpinnerLoad: function(done) {
let spinnerSelector = 'vn-spinner > div';
this.waitForClassNotPresent(spinnerSelector, 'is-active')
.then(done)
.catch(done);
},
};
Object.keys(actions).forEach(function(name) {

View File

@ -1,6 +1,4 @@
/* eslint no-console: 0 */
const Nightmare = require('nightmare');
let nightmare;
module.exports = function createNightmare(width = 1280, height = 720) {

View File

@ -9,7 +9,7 @@ export default {
ticketsButton: 'vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="ticket.index"]',
invoiceOutButton: 'vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="invoiceOut.index"]',
claimsButton: 'vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="claim.index"]',
returnToModuleIndexButton: `a[translate-attr="{title: 'Return to module index'}"]`,
returnToModuleIndexButton: 'a[ui-sref="order.index"]',
userMenuButton: 'vn-topbar #user',
userLocalWarehouse: 'vn-topbar vn-popover vn-autocomplete[field="$ctrl.localWarehouseFk"]',
userLocalBank: 'vn-topbar vn-popover vn-autocomplete[field="$ctrl.localBankFk"]',
@ -19,7 +19,7 @@ export default {
userConfigFirstAutocompleteClear: '#localWarehouse > div > div > div > vn-icon.clear',
userConfigSecondAutocompleteClear: '#localBank > div > div > div > vn-icon.clear',
userConfigThirdAutocompleteClear: '#localCompany > div > div > div > vn-icon.clear',
acceptVnConfirm: 'vn-confirm button[response=ACCEPT]'
acceptButton: 'vn-confirm button[response=ACCEPT]'
},
clientsIndex: {
searchClientInput: `${components.vnTextfield}`,
@ -90,7 +90,7 @@ export default {
newBankEntityButton: 'vn-client-billing-data vn-icon-button[vn-tooltip="New bank entity"] > button',
newBankEntityName: 'vn-client-billing-data > vn-dialog vn-textfield[label="Name"] input',
newBankEntityBIC: 'vn-client-billing-data > vn-dialog vn-textfield[label="Swift / BIC"] input',
newBankEntityCode: 'vn-client-billing-data > vn-dialog vn-textfield[label="Code"] 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}`
},
@ -116,7 +116,7 @@ export default {
firstObservationDescriptionInput: 'vn-client-address-edit [name=observations] :nth-child(1) [model="observation.description"] input',
secondObservationTypeAutocomplete: 'vn-client-address-edit [name=observations] :nth-child(2) [field="observation.observationTypeFk"]',
secondObservationDescriptionInput: 'vn-client-address-edit [name=observations] :nth-child(2) [model="observation.description"] input',
addObservationButton: 'vn-client-address-edit vn-icon-button[icon="add_circle"]',
addObservationButton: 'vn-client-address-edit div[name="observations"] vn-icon-button[icon="add_circle"]',
saveButton: `${components.vnSubmit}`,
cancelCreateAddressButton: 'button[ui-sref="client.card.address.index"]',
cancelEditAddressButton: 'vn-client-address-edit > form > vn-button-bar > vn-button > button'
@ -164,7 +164,7 @@ export default {
balanceButton: 'vn-left-menu a[ui-sref="client.card.balance.index"]',
companyAutocomplete: 'vn-client-balance-index vn-autocomplete[field="$ctrl.companyFk"]',
newPaymentButton: `${components.vnFloatButton}`,
newPaymentBankInut: 'vn-client-balance-create vn-textfield[field="$ctrl.receipt.bankFk"] input',
newPaymentBank: 'vn-client-balance-create vn-autocomplete[field="$ctrl.receipt.bankFk"]',
newPaymentAmountInput: 'vn-client-balance-create vn-input-number[field="$ctrl.receipt.amountPaid"] input',
saveButton: 'vn-client-balance-create vn-button[label="Save"]',
firstBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)'
@ -176,7 +176,6 @@ export default {
},
itemsIndex: {
searchIcon: 'vn-item-index vn-searchbar vn-icon[icon="search"]',
goBackToModuleIndexButton: 'vn-item-descriptor a[href="#!/item/index"]',
createItemButton: `${components.vnFloatButton}`,
searchResult: 'vn-item-index a.vn-tr',
searchResultPreviewButton: 'vn-item-index .buttons > [icon="desktop_windows"]',
@ -211,6 +210,7 @@ export default {
cancelButton: 'button[ui-sref="item.index"]'
},
itemDescriptor: {
goBackToModuleIndexButton: 'vn-item-descriptor a[href="#!/item/index"]',
moreMenu: 'vn-item-descriptor vn-icon-menu > div > vn-icon',
moreMenuRegularizeButton: 'vn-item-descriptor vn-drop-down > vn-popover ul > li[name="Regularize stock"]',
regularizeQuantityInput: 'vn-item-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-textfield > div > div > div.infix > input',
@ -290,9 +290,9 @@ export default {
barcode: 'vn-item-summary [name="barcode"]'
},
itemDiary: {
thirdTicketId: 'vn-item-diary vn-tbody > vn-tr:nth-child(3) > vn-td:nth-child(2) > span',
secondTicketId: 'vn-item-diary vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(2) > span',
firstBalance: 'vn-item-diary vn-tbody > vn-tr:nth-child(1) > vn-td.balance',
fifthBalance: 'vn-item-diary vn-tbody > vn-tr:nth-child(5) > vn-td.balance',
fourthBalance: 'vn-item-diary vn-tbody > vn-tr:nth-child(4) > vn-td.balance',
warehouseAutocomplete: 'vn-item-diary vn-autocomplete[field="$ctrl.warehouseFk"]',
},
itemLog: {
@ -300,12 +300,20 @@ export default {
fifthLineCreatedProperty: 'vn-item-log > vn-log vn-tbody > vn-tr:nth-child(5) > vn-td > vn-one:nth-child(3) > div span:nth-child(3)',
},
ticketSummary: {
header: 'vn-ticket-summary > vn-card > div > h5',
state: 'vn-ticket-summary vn-label-value[label="State"] > section > span',
route: 'vn-ticket-summary vn-label-value[label="Route"] > section > span',
total: 'vn-ticket-summary vn-one.taxes > p:nth-child(3) > strong',
sale: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr',
firstSaleItemId: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span',
firstSaleDescriptorImage: 'vn-ticket-summary vn-item-descriptor-popover > vn-popover vn-item-descriptor img',
itemDescriptorPopover: 'vn-ticket-summary vn-item-descriptor-popover > vn-popover',
itemDescriptorPopoverItemDiaryButton: 'vn-ticket-summary > vn-item-descriptor-popover a[href="#!/item/2/diary?warehouseFk=5&ticketFk=20"]',
popoverDiaryButton: 'vn-ticket-summary vn-item-descriptor-popover vn-item-descriptor vn-icon[icon="icon-transaction"]',
firstSaleQuantity: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3)',
firstSaleDiscount: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6)',
invoiceOutRef: 'vn-ticket-summary > vn-card > div > vn-horizontal > vn-one:nth-child(1) > vn-label-value:nth-child(6) > section > span'
invoiceOutRef: 'vn-ticket-summary > vn-card > div > vn-horizontal > vn-one:nth-child(1) > vn-label-value:nth-child(6) > section > span',
setOk: 'vn-ticket-summary vn-button[label="SET OK"] > button'
},
ticketsIndex: {
openAdvancedSearchButton: 'vn-ticket-index vn-searchbar t-right-icons > vn-icon[icon="keyboard_arrow_down"]',
@ -332,16 +340,17 @@ export default {
createButton: `${components.vnSubmit}`
},
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',
moreMenuAddStowaway: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Add stowaway"]',
moreMenuDeleteStowawayButton: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Remove stowaway"]',
moreMenuAddToTurn: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Add turn"]',
moreMenuDeleteTicket: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Delete ticket"]',
moreMenuMakeInvoice: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Make invoice"]',
addStowawayDialogSecondTicket: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog vn-table vn-tr:nth-child(2)',
shipSelectButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks > vn-button-menu[icon="icon-stowaway"]',
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"]',
shipMenuSecondTicket: 'vn-ticket-descriptor div.quicklinks vn-drop-down li:nth-child(2)',
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"]',
@ -375,27 +384,33 @@ export default {
saleButton: 'vn-left-menu a[ui-sref="ticket.card.sale"]',
saleLine: 'vn-table div > vn-tbody > vn-tr',
saleDescriptorPopover: 'vn-ticket-sale vn-item-descriptor-popover > vn-popover',
saleDescriptorPopoverSummaryButton: 'vn-item-descriptor-popover a[href="#!/item/1/summary"]',
saleDescriptorPopoverSummaryButton: 'vn-item-descriptor-popover a[ui-sref="item.card.summary({id: $ctrl.item.id})"]',
descriptorItemDiaryButton: 'vn-item-descriptor .quicklinks.ng-scope > vn-horizontal > a > vn-icon > i',
newItemButton: 'vn-float-button[icon="add"]',
moreMenu: 'vn-ticket-sale vn-tool-bar > vn-button-menu[vn-id="more-button"] > div > button',
moreMenuCreateClaim: 'vn-ticket-sale vn-tool-bar > vn-button-menu[vn-id="more-button"] vn-drop-down > vn-popover ul > li[name="Add claim"]',
moreMenuReserve: 'vn-ticket-sale vn-tool-bar > vn-button-menu[vn-id="more-button"] vn-drop-down > vn-popover ul > li[name="Mark as reserved"]',
moreMenuUnmarkReseved: 'vn-ticket-sale vn-tool-bar > vn-button-menu[vn-id="more-button"] vn-drop-down > vn-popover ul > li[name="Unmark as reserved"]',
moreMenuUpdateDiscount: 'vn-ticket-sale vn-tool-bar > vn-button-menu[vn-id="more-button"] vn-drop-down > vn-popover ul > li[name="Update discount"]',
moreMenuUpdateDiscountInput: 'vn-ticket-sale vn-dialog form vn-ticket-sale-edit-discount vn-input-number[model="$ctrl.newDiscount"] input',
firstSaleClaimIcon: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(1) vn-icon[icon="icon-claims"]',
firstSaleDescriptorImage: 'vn-ticket-sale vn-item-descriptor-popover > vn-popover vn-item-descriptor img',
firstSaleText: 'vn-table div > vn-tbody > vn-tr:nth-child(1)',
firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) vn-td:nth-child(3) > img',
firstSaleZoomedImage: 'body > div > div > img',
firstSaleQuantity: 'vn-textfield[model="sale.quantity"]:nth-child(1) input',
firstSaleQuantityCell: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td-editable',
firstSaleQuantity: 'vn-input-number[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[model="sale.quantity"] div.suffix > i',
firstSaleID: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(4) > span',
firstSalePrice: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) > vn-td:nth-child(7) > span',
firstSalePriceInput: 'vn-ticket-sale:nth-child(1) vn-popover.edit.dialog-summary.ng-isolate-scope.vn-popover.shown vn-textfield input',
firstSaleDiscount: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(8) > span',
firstSaleDiscountInput: 'vn-ticket-sale:nth-child(1) vn-ticket-sale-edit-discount vn-textfield input',
firstSaleID: 'vn-ticket-sale:nth-child(1) vn-td-editable:nth-child(4) text > span',
firstSalePrice: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) > vn-td:nth-child(7)',
firstSalePriceInput: 'vn-ticket-sale:nth-child(1) vn-popover.edit.dialog-summary.ng-isolate-scope.vn-popover.shown vn-input-number input',
firstSaleDiscount: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(8)',
firstSaleDiscountInput: 'vn-ticket-sale:nth-child(1) vn-ticket-sale-edit-discount vn-input-number input',
firstSaleImport: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(9)',
firstSaleReservedIcon: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td:nth-child(2) > vn-icon:nth-child(3)',
firstSaleColour: 'vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(6) section:nth-child(1)',
firstSaleLength: 'vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(6) section:nth-child(3)',
firstSaleColour: 'vn-ticket-sale vn-tr:nth-child(1) vn-td-editable:nth-child(6) section:nth-child(1)',
firstSaleLength: 'vn-ticket-sale vn-tr:nth-child(1) vn-td-editable:nth-child(6) section:nth-child(3)',
firstSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(1) vn-check[field="sale.checked"] md-checkbox',
secondSaleClaimIcon: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(2) > a > vn-icon',
secondSaleColour: 'vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(6) section:nth-child(5)',
secondSalePrice: 'vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(7) > span',
secondSaleDiscount: 'vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(8)',
@ -407,12 +422,12 @@ export default {
thirdSaleCheckbox: 'vn-ticket-sale vn-tr:nth-child(3) vn-check[field="sale.checked"] md-checkbox',
deleteSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="delete"]',
transferSaleButton: 'vn-ticket-sale vn-tool-bar > vn-button[icon="call_split"]',
moveToTicketInput: 'vn-ticket-sale vn-popover.transfer vn-textfield[model="$ctrl.moveToTicketFk"] input',
moveToTicketInput: 'vn-ticket-sale vn-popover.transfer vn-textfield[model="$ctrl.receiverTicketId"] input',
moveToTicketInputClearButton: 'vn-popover.shown i[title="Clear"]',
moveToTicketButton: 'vn-ticket-sale vn-popover.transfer vn-icon[icon="arrow_forward_ios"]',
moveToNewTicketButton: 'vn-ticket-sale vn-popover.transfer vn-button[label="New ticket"]',
acceptDeleteLineButton: 'vn-ticket-sale > vn-confirm[vn-id="delete-lines"] button[response=ACCEPT]',
acceptDeleteTicketButton: 'vn-ticket-sale > vn-confirm[vn-id="deleteConfirmation"] button[response=ACCEPT]',
acceptDeleteTicketButton: 'vn-ticket-sale > vn-confirm[vn-id="delete-ticket"] button[response=ACCEPT]',
stateMenuButton: 'vn-ticket-sale vn-tool-bar > vn-button-menu[label="State"]'
},
ticketTracking: {
@ -479,6 +494,24 @@ export default {
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"]',
moreMenuDeleteClaim: 'vn-claim-descriptor vn-icon-menu vn-drop-down li[name="Delete claim"]',
acceptDeleteClaim: 'vn-claim-descriptor > vn-confirm[vn-id="confirm-delete-claim"] button[response="ACCEPT"]'
},
claimSummary: {
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[model="$ctrl.summary.claim.observation"] > div > 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',
firstSaleDescriptorImage: 'vn-claim-summary vn-item-descriptor-popover > vn-popover vn-item-descriptor img',
itemDescriptorPopover: 'vn-claim-summary vn-item-descriptor-popover > vn-popover',
itemDescriptorPopoverItemDiaryButton: 'vn-claim-summary > vn-item-descriptor-popover 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-claim-summary > vn-worker-descriptor-popover > vn-popover 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',
firstActionTicketDescriptor: 'vn-claim-summary > vn-ticket-descriptor-popover > vn-popover > div > div.content > vn-ticket-descriptor'
},
claimBasicData: {
claimStateAutocomplete: 'vn-claim-basic-data vn-autocomplete[field="$ctrl.claim.claimStateFk"]',
responsabilityInputRange: 'vn-input-range',
@ -486,10 +519,13 @@ export default {
saveButton: `${components.vnSubmit}`
},
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(7) > span',
discountInput: 'vn-claim-detail vn-popover vn-input-number[model="$ctrl.newDiscount"] > div > div > div.infix > input',
discoutPopoverMana: 'vn-claim-detail > vn-popover > div > div.content > div > vn-horizontal > h5',
addItemButton: 'vn-claim-detail a vn-float-button',
firstClaimableSaleFromTicket: 'vn-claim-detail > vn-dialog vn-tbody > vn-tr',
claimDetailLine: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr',
secondItemQuantityInput: 'vn-claim-detail vn-tr:nth-child(2) vn-input-number[model="saleClaimed.quantity"] input',
firstItemQuantityInput: 'vn-claim-detail vn-tr:nth-child(1) vn-input-number[model="saleClaimed.quantity"] input',
totalClaimed: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-horizontal > div > vn-label-value:nth-child(2) > section > span',
secondItemDeleteButton: 'vn-claim-detail > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(9) > vn-icon-button > button > vn-icon > i'
},
@ -513,10 +549,8 @@ export default {
importTicketButton: 'vn-claim-action vn-button[label="Import ticket"]',
secondImportableTicket: 'vn-claim-action > vn-vertical > vn-popover > div > div.content > div > vn-table > div > vn-tbody > vn-tr:nth-child(2)',
firstLineDestination: 'vn-claim-action vn-tr:nth-child(1) vn-autocomplete[field="saleClaimed.claimDestinationFk"]',
thirdLineDestination: 'vn-claim-action vn-tr:nth-child(3) vn-autocomplete[field="saleClaimed.claimDestinationFk"]',
secondLineDestination: 'vn-claim-action vn-tr:nth-child(2) vn-autocomplete[field="saleClaimed.claimDestinationFk"]',
firstDeleteLine: 'vn-claim-action vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
secondDeleteLine: 'vn-claim-action vn-tr:nth-child(2) vn-icon-button[icon="delete"]',
thirdDeleteLine: 'vn-claim-action vn-tr:nth-child(3) vn-icon-button[icon="delete"]',
isPaidWithManaCheckbox: 'vn-check[field="$ctrl.claim.isChargedToMana"] md-checkbox'
},
ordersIndex: {
@ -572,6 +606,9 @@ export default {
descriptionInput: 'vn-route-create vn-textfield[field="$ctrl.route.description"] input',
submitButton: 'vn-route-create vn-submit > input[type="submit"]'
},
routeDescriptor: {
volume: 'vn-route-descriptor vn-label-value[label="Volume"] > section > span'
},
routeSummary: {
routeId: 'vn-route-summary > vn-card > div > vn-horizontal > vn-one:nth-child(1) > vn-label-value:nth-child(1) > section > span'
},
@ -591,6 +628,7 @@ export default {
secondTicketPriority: 'vn-route-tickets vn-tr:nth-child(2) vn-textfield[model="ticket.priority"] input',
thirdTicketPriority: 'vn-route-tickets vn-tr:nth-child(3) vn-textfield[model="ticket.priority"] input',
fourthTicketPriority: 'vn-route-tickets vn-tr:nth-child(4) vn-textfield[model="ticket.priority"] input',
eleventhTicketPriority: 'vn-route-tickets vn-tr:nth-child(11) vn-textfield[model="ticket.priority"] input',
firstTicketCheckbox: 'vn-route-tickets vn-tr:nth-child(1) vn-check md-checkbox',
buscamanButton: 'vn-route-tickets vn-button[icon="icon-buscaman"]',
firstTicketDeleteButton: 'vn-route-tickets vn-tr:nth-child(1) vn-icon[icon="delete"]',

View File

@ -227,11 +227,11 @@ describe('Client Edit fiscalData path', () => {
expect(result).toBe('unchecked');
});
it('should confirm frozen checkbox is unchecked', async() => {
it('should confirm frozen checkbox is checked', async() => {
const result = await nightmare
.checkboxState(selectors.clientFiscalData.frozenCheckbox);
expect(result).toBe('unchecked');
expect(result).toBe('checked');
});
it('should confirm Has to invoice checkbox is unchecked', async() => {

View File

@ -8,7 +8,7 @@ describe('Client lock verified data path', () => {
beforeAll(() => {
nightmare
.loginAndModule('salesPerson', 'client')
.accessToSearchResult('Petter Parker')
.accessToSearchResult('Hank Pym')
.accessToSection('client.card.fiscalData');
});
@ -27,7 +27,7 @@ describe('Client lock verified data path', () => {
const result = await nightmare
.wait(selectors.clientFiscalData.socialNameInput)
.clearInput(selectors.clientFiscalData.socialNameInput)
.write(selectors.clientFiscalData.socialNameInput, 'salesPerson was here')
.write(selectors.clientFiscalData.socialNameInput, 'Captain America Civil War')
.waitToClick(selectors.clientFiscalData.saveButton)
.waitForLastSnackbar();
@ -39,55 +39,16 @@ describe('Client lock verified data path', () => {
.reloadSection('client.card.fiscalData')
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
expect(result).toEqual('salesPerson was here');
expect(result).toEqual('Captain America Civil War');
});
});
describe('as administrative', () => {
beforeAll(() => {
nightmare
.waitForLogin('administrative');
});
it('should navigate to clients index', async() => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
});
it('should search again for the user Petter Parker', async() => {
const resultCount = await nightmare
.write(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the Petter Parkers fiscal data`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
.parsedUrl();
expect(url.hash).toContain('fiscal-data');
});
it(`should click on the fiscal data button`, async() => {
const url = await nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
.parsedUrl();
expect(url.hash).toContain('fiscal-data');
.loginAndModule('administrative', 'client')
.accessToSearchResult('Hank Pym')
.accessToSection('client.card.fiscalData');
});
it('should confirm verified data button is enabled for administrative', async() => {
@ -110,18 +71,18 @@ describe('Client lock verified data path', () => {
});
it('should confirm Verified data checkbox is checked', async() => {
const result = await nightmare
const isChecked = await nightmare
.reloadSection('client.card.fiscalData')
.checkboxState(selectors.clientFiscalData.verifiedDataCheckbox);
expect(result).toBe('checked');
expect(isChecked).toEqual('checked');
});
it('should again edit the social name', async() => {
const result = await nightmare
.wait(selectors.clientFiscalData.socialNameInput)
.clearInput(selectors.clientFiscalData.socialNameInput)
.write(selectors.clientFiscalData.socialNameInput, 'administrative was here')
.write(selectors.clientFiscalData.socialNameInput, 'Ant-Man and the Wasp')
.waitToClick(selectors.clientFiscalData.saveButton)
.waitForLastSnackbar();
@ -133,71 +94,32 @@ describe('Client lock verified data path', () => {
.reloadSection('client.card.fiscalData')
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
expect(result).toEqual('administrative was here');
expect(result).toEqual('Ant-Man and the Wasp');
});
});
describe('as salesPerson second run', () => {
beforeAll(() => {
nightmare
.waitForLogin('salesPerson');
});
it('should again click on the Clients button of the top bar menu', async() => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
});
it('should again search for the user Petter Parker', async() => {
const resultCount = await nightmare
.write(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the client's fiscal data`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
.parsedUrl();
expect(url.hash).toContain('fiscal-data');
});
it(`should click on the fiscal data button to start editing`, async() => {
const url = await nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
.parsedUrl();
expect(url.hash).toContain('fiscal-data');
.loginAndModule('salesPerson', 'client')
.accessToSearchResult('Hank Pym')
.accessToSection('client.card.fiscalData');
});
it('should confirm verified data button is disabled once again for salesPerson', async() => {
const result = await nightmare
.wait(selectors.clientFiscalData.verifiedDataCheckbox)
const isChecked = await nightmare
.waitForClassPresent(selectors.clientFiscalData.verifiedDataCheckbox, 'md-checked')
.evaluate(selector => {
return document.querySelector(selector).getAttribute('disabled');
}, selectors.clientFiscalData.verifiedDataCheckbox);
expect(result).toBeTruthy();
expect(isChecked).toBeTruthy();
});
it('should not be able to save change throwing a verified data error', async() => {
const result = await nightmare
.clearInput(selectors.clientFiscalData.socialNameInput)
.write(selectors.clientFiscalData.socialNameInput, 'salesPerson was here')
.write(selectors.clientFiscalData.socialNameInput, 'This wont happen')
.waitToClick(selectors.clientFiscalData.saveButton)
.waitForSnackbar();
@ -209,64 +131,25 @@ describe('Client lock verified data path', () => {
beforeAll(() => {
nightmare
.forceReloadSection('client.card.fiscalData')
.waitForLogin('salesAssistant');
});
it('should now navigate to clients index', async() => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
});
it('should now search again for the user Petter Parker', async() => {
const resultCount = await nightmare
.write(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the Petter Parkers fiscal data`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
.parsedUrl();
expect(url.hash).toContain('fiscal-data');
});
it(`should click on the fiscal data button`, async() => {
const url = await nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
.parsedUrl();
expect(url.hash).toContain('fiscal-data');
.loginAndModule('salesAssistant', 'client')
.accessToSearchResult('Hank Pym')
.accessToSection('client.card.fiscalData');
});
it('should confirm verified data button is enabled for salesAssistant', async() => {
const result = await nightmare
.wait(selectors.clientFiscalData.verifiedDataCheckbox)
const isDisabled = await nightmare
.waitForClassPresent(selectors.clientFiscalData.verifiedDataCheckbox, 'md-checked')
.evaluate(selector => {
return document.querySelector(selector).getAttribute('disabled');
return document.querySelector(selector).getAttribute('aria-disabled');
}, selectors.clientFiscalData.verifiedDataCheckbox);
expect(result).toBeFalsy();
expect(isDisabled).toEqual('false');
});
it('should now edit the social name', async() => {
const result = await nightmare
.clearInput(selectors.clientFiscalData.socialNameInput)
.write(selectors.clientFiscalData.socialNameInput, 'salesAssistant was here')
.write(selectors.clientFiscalData.socialNameInput, 'new social name edition')
.waitToClick(selectors.clientFiscalData.saveButton)
.waitForLastSnackbar();
@ -278,65 +161,26 @@ describe('Client lock verified data path', () => {
.reloadSection('client.card.fiscalData')
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
expect(result).toEqual('salesAssistant was here');
expect(result).toEqual('new social name edition');
});
});
describe('as salesPerson third run', () => {
beforeAll(() => {
nightmare
.waitForLogin('salesPerson');
});
it('should now click on the Clients button of the top bar menu', async() => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
});
it('should once again search for the user Petter Parker', async() => {
const resultCount = await nightmare
.write(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the client's fiscal data`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
.parsedUrl();
expect(url.hash).toContain('fiscal-data');
});
it(`should click on the fiscal data button to start editing`, async() => {
const url = await nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
.parsedUrl();
expect(url.hash).toContain('fiscal-data');
.loginAndModule('salesPerson', 'client')
.accessToSearchResult('Hank Pym')
.accessToSection('client.card.fiscalData');
});
it('should confirm verified data button is enabled once again', async() => {
const result = await nightmare
.wait(selectors.clientFiscalData.verifiedDataCheckbox)
const isChecked = await nightmare
.waitForClassPresent(selectors.clientFiscalData.verifiedDataCheckbox, 'md-checked')
.evaluate(selector => {
return document.querySelector(selector).getAttribute('disabled');
}, selectors.clientFiscalData.verifiedDataCheckbox);
expect(result).toBeTruthy();
expect(isChecked).toBeTruthy();
});
it('should confirm the form is enabled for salesPerson', async() => {

View File

@ -48,8 +48,7 @@ describe('Client balance path', () => {
it('should create a new payment that clears the debt', async() => {
let result = await nightmare
.clearInput(selectors.clientBalance.newPaymentBankInut)
.write(selectors.clientBalance.newPaymentBankInut, '2')
.autocompleteSearch(selectors.clientBalance.newPaymentBank, 'Pay on receipt')
.waitToClick(selectors.clientBalance.saveButton)
.waitForLastSnackbar();

View File

@ -17,6 +17,7 @@ describe('Worker time control path', () => {
const scanTime = '07:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
@ -28,6 +29,7 @@ describe('Worker time control path', () => {
const scanTime = '10:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
@ -39,6 +41,7 @@ describe('Worker time control path', () => {
const scanTime = '15:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
@ -50,6 +53,7 @@ describe('Worker time control path', () => {
const scanTime = '10:20';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText');
@ -78,6 +82,7 @@ describe('Worker time control path', () => {
const scanTime = '08:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText');
@ -89,6 +94,7 @@ describe('Worker time control path', () => {
const scanTime = '10:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText');
@ -100,6 +106,7 @@ describe('Worker time control path', () => {
const scanTime = '10:20';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText');
@ -111,6 +118,7 @@ describe('Worker time control path', () => {
const scanTime = '16:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText');
@ -131,6 +139,7 @@ describe('Worker time control path', () => {
const scanTime = '09:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText');
@ -142,6 +151,7 @@ describe('Worker time control path', () => {
const scanTime = '10:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText');
@ -153,6 +163,7 @@ describe('Worker time control path', () => {
const scanTime = '10:20';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText');
@ -164,6 +175,7 @@ describe('Worker time control path', () => {
const scanTime = '17:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText');
@ -184,6 +196,7 @@ describe('Worker time control path', () => {
const scanTime = '09:59';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText');
@ -195,6 +208,7 @@ describe('Worker time control path', () => {
const scanTime = '10:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText');
@ -206,6 +220,7 @@ describe('Worker time control path', () => {
const scanTime = '10:20';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText');
@ -217,6 +232,7 @@ describe('Worker time control path', () => {
const scanTime = '17:59';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText');
@ -237,6 +253,7 @@ describe('Worker time control path', () => {
const scanTime = '07:30';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText');
@ -248,6 +265,7 @@ describe('Worker time control path', () => {
const scanTime = '10:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText');
@ -259,6 +277,7 @@ describe('Worker time control path', () => {
const scanTime = '10:20';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText');
@ -270,6 +289,7 @@ describe('Worker time control path', () => {
const scanTime = '15:30';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText');
@ -299,6 +319,7 @@ describe('Worker time control path', () => {
const scanTime = '06:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText');
@ -310,6 +331,7 @@ describe('Worker time control path', () => {
const scanTime = '13:40';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText');
@ -330,6 +352,7 @@ describe('Worker time control path', () => {
const scanTime = '05:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.sundayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText');
@ -341,6 +364,7 @@ describe('Worker time control path', () => {
const scanTime = '12:40';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.sundayAddTimeButton)
.clearInput(selectors.workerTimeControl.timeDialogInput)
.write(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText');
@ -385,6 +409,7 @@ describe('Worker time control path', () => {
it('should Hank Pym check his hours are alright', async() => {
const wholeWeekHours = await nightmare
.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '56:00 Hours')
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
expect(wholeWeekHours).toEqual('56:00 Hours');

View File

@ -174,9 +174,9 @@ describe('Item regularize path', () => {
expect(url.hash).toEqual('#!/ticket/index');
});
it('should search for the ticket with id 23 once again', async() => {
it('should search for the ticket with id 25 once again', async() => {
const result = await nightmare
.write(selectors.ticketsIndex.searchTicketInput, 23)
.write(selectors.ticketsIndex.searchTicketInput, 25)
.waitToClick(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
@ -186,7 +186,7 @@ describe('Item regularize path', () => {
it(`should now click on the search result to access to the ticket summary`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, '23')
.waitForTextInElement(selectors.ticketsIndex.searchResult, '25')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitForURL('/summary')
.parsedUrl();

View File

@ -39,7 +39,7 @@ describe('Item index path', () => {
it('should navigate forth and back to see the images column is still visible', async() => {
const imageVisible = await nightmare
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton)
.waitToClick(selectors.itemsIndex.searchIcon)
.wait(selectors.itemsIndex.searchResult)
.isVisible(selectors.itemsIndex.firstItemImage);
@ -76,7 +76,7 @@ describe('Item index path', () => {
it('should now navigate forth and back to see the ids column is now visible', async() => {
const idVisible = await nightmare
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton)
.waitToClick(selectors.itemsIndex.searchIcon)
.wait(selectors.itemsIndex.searchResult)
.isVisible(selectors.itemsIndex.firstItemId);

View File

@ -7,13 +7,12 @@ describe('Ticket Create notes path', () => {
beforeAll(() => {
return nightmare
.loginAndModule('employee', 'ticket')
.accessToSearchResult('id:1')
.accessToSearchResult(1)
.accessToSection('ticket.card.observation');
});
it(`should click create a new note and delete a former one`, async() => {
it('should create a new note', async() => {
let result = await nightmare
.waitToClick(selectors.ticketNotes.firstNoteRemoveButton)
.waitToClick(selectors.ticketNotes.addNoteButton)
.autocompleteSearch(selectors.ticketNotes.firstNoteTypeAutocomplete, 'observation one')
.write(selectors.ticketNotes.firstDescriptionInput, 'description')
@ -23,7 +22,7 @@ describe('Ticket Create notes path', () => {
expect(result).toEqual('Data saved!');
});
it(`should confirm the note is the expected one`, async() => {
it('should confirm the note is the expected one', async() => {
let result = await nightmare
.reloadSection('ticket.card.observation')
.waitToGetProperty(`${selectors.ticketNotes.firstNoteTypeAutocomplete} input`, 'value');
@ -35,4 +34,13 @@ describe('Ticket Create notes path', () => {
expect(firstDescription).toEqual('description');
});
it('should delete the note', async() => {
let result = await nightmare
.waitToClick(selectors.ticketNotes.firstNoteRemoveButton)
.waitToClick(selectors.ticketNotes.submitNotesButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
});

View File

@ -21,7 +21,7 @@ describe('Ticket expeditions and log path', () => {
.wait(selectors.ticketExpedition.expeditionRow)
.countElement(selectors.ticketExpedition.expeditionRow);
expect(result).toEqual(5);
expect(result).toEqual(3);
});
it(`should confirm the expedition deleted is shown now in the ticket log`, async() => {

View File

@ -7,7 +7,7 @@ describe('Ticket List sale path', () => {
beforeAll(() => {
return nightmare
.loginAndModule('employee', 'ticket')
.accessToSearchResult('id:8')
.accessToSearchResult(12)
.accessToSection('ticket.card.sale');
});
@ -15,21 +15,21 @@ describe('Ticket List sale path', () => {
const value = await nightmare
.waitToGetProperty(selectors.ticketSales.firstSaleColour, 'innerText');
expect(value).toContain('Silver');
expect(value).toContain('Black');
});
it('should confirm the first ticket sale contains the lenght', async() => {
const value = await nightmare
.waitToGetProperty(selectors.ticketSales.firstSaleText, 'innerText');
expect(value).toContain('5');
expect(value).toContain('1');
});
it('should confirm the first ticket sale contains the price', async() => {
const value = await nightmare
.waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText');
expect(value).toContain('1.30');
expect(value).toContain('1.72');
});
it('should confirm the first ticket sale contains the discount', async() => {
@ -43,7 +43,7 @@ describe('Ticket List sale path', () => {
const value = await nightmare
.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
expect(value).toContain('19.50');
expect(value).toContain('34.40');
});
it('should navigate to the catalog by pressing the new item button', async() => {

View File

@ -23,10 +23,9 @@ describe('Ticket Edit basic data path', () => {
it(`should have a price diference`, async() => {
const result = await nightmare
.wait(1900)
.waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText');
expect(result).toContain('-€13.95');
expect(result).toContain('-€184.25');
});
it(`should then click next to move on to step three`, async() => {

View File

@ -1,28 +1,26 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
// #1387 e2e Ticket Edit sale path
xdescribe('Ticket Edit sale path', () => {
describe('Ticket Edit sale path', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('salesPerson', 'ticket')
.accessToSearchResult('16')
.accessToSearchResult(16)
.accessToSection('ticket.card.sale');
});
it(`should click on the second claim id to navigate over there`, async() => {
it(`should click on the first sale claim icon to navigate over there`, async() => {
const url = await nightmare
.waitToClick(selectors.ticketSales.secondSaleClaimIcon)
.waitToClick(selectors.ticketSales.firstSaleClaimIcon)
.wait(selectors.claimBasicData.claimStateAutocomplete)
.parsedUrl();
expect(url.hash).toEqual('#!/claim/2/basic-data');
});
it('should now click on the Tickets button of the top bar menu', async() => {
it('should navigate to the tickets index', async() => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
@ -33,28 +31,17 @@ xdescribe('Ticket Edit sale path', () => {
expect(url.hash).toEqual('#!/ticket/index');
});
it('should again search for a specific ticket', async() => {
const result = await nightmare
.write(selectors.ticketsIndex.searchTicketInput, '16')
.waitToClick(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should now click on the search result to access to the ticket Sale`, async() => {
it(`should search for a ticket and then navigate to it's sales`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton)
.accessToSearchResult(16)
.accessToSection('ticket.card.sale')
.waitForURL('/sale')
.parsedUrl();
expect(url.hash).toContain('/sale');
});
it(`should check the zoomed image isnt present`, async() => {
it(`should check the zoomed image isn't present`, async() => {
const result = await nightmare
.countElement(selectors.ticketSales.firstSaleZoomedImage);
@ -71,7 +58,7 @@ xdescribe('Ticket Edit sale path', () => {
it(`should click on the zoomed image to close it`, async() => {
const result = await nightmare
.wait(1000)
.wait(100)
.clickIfVisible(selectors.ticketSales.firstSaleZoomedImage)
.countElement(selectors.ticketSales.firstSaleZoomedImage);
@ -124,12 +111,8 @@ xdescribe('Ticket Edit sale path', () => {
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.write(selectors.ticketsIndex.searchTicketInput, '16')
.waitToClick(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton)
.accessToSearchResult(16)
.accessToSection('ticket.card.sale')
.waitForURL('/sale')
.parsedUrl();
@ -138,17 +121,17 @@ xdescribe('Ticket Edit sale path', () => {
it('should try to add a higher quantity value and then receive an error', async() => {
const result = await nightmare
.waitToFocus(selectors.ticketSales.firstSaleQuantityCell)
.write(selectors.ticketSales.firstSaleQuantity, '9\u000d')
.focusElement(selectors.ticketSales.firstSaleQuantityCell)
.write(selectors.ticketSales.firstSaleQuantity, '11\u000d')
.waitForLastSnackbar();
expect(result).toEqual('The new quantity should be smaller than the old one');
});
it('should remove 1 from quantity', async() => {
it('should remove 1 from the first sale quantity', async() => {
const result = await nightmare
.waitToFocus(selectors.ticketSales.firstSaleQuantityCell)
.write(selectors.ticketSales.firstSaleQuantity, '4\u000d')
.focusElement(selectors.ticketSales.firstSaleQuantityCell)
.write(selectors.ticketSales.firstSaleQuantity, '9\u000d')
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
@ -156,7 +139,7 @@ xdescribe('Ticket Edit sale path', () => {
it('should update the price', async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.firstSalePrice)
.waitToClick(`${selectors.ticketSales.firstSalePrice} > span`)
.write(selectors.ticketSales.firstSalePriceInput, '5\u000d')
.waitForLastSnackbar();
@ -165,7 +148,8 @@ xdescribe('Ticket Edit sale path', () => {
it('should confirm the price have been updated', async() => {
const result = await nightmare
.waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText');
.wait(1999)
.waitToGetProperty(`${selectors.ticketSales.firstSalePrice} span`, 'innerText');
expect(result).toContain('5.00');
});
@ -174,14 +158,13 @@ xdescribe('Ticket Edit sale path', () => {
const result = await nightmare
.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
expect(result).toContain('20.00');
expect(result).toContain('45.00');
});
it('should update the discount', async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.firstSaleDiscount)
.waitToClick(`${selectors.ticketSales.firstSaleDiscount} > span`)
.write(selectors.ticketSales.firstSaleDiscountInput, '50\u000d')
// .write('body', '\u000d') // simulates enter
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
@ -189,29 +172,29 @@ xdescribe('Ticket Edit sale path', () => {
it('should confirm the discount have been updated', async() => {
const result = await nightmare
.waitForTextInElement(selectors.ticketSales.firstSaleDiscount, '50 %')
.waitToGetProperty(selectors.ticketSales.firstSaleDiscount, 'innerText');
.waitForTextInElement(`${selectors.ticketSales.firstSaleDiscount} > span`, '50 %')
.waitToGetProperty(`${selectors.ticketSales.firstSaleDiscount} > span`, 'innerText');
expect(result).toContain('50 %');
});
it('should confirm the total import for that item have been updated', async() => {
const result = await nightmare
.waitForTextInElement(selectors.ticketSales.firstSaleImport, '10.00')
.waitForTextInElement(selectors.ticketSales.firstSaleImport, '22.50')
.waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
expect(result).toContain('10.00');
expect(result).toContain('22.50');
});
it('should select the third sale and create a claim of it', async() => {
const url = await nightmare
.waitToClick(selectors.ticketSales.thirdSaleCheckbox)
.waitToClick(selectors.ticketSales.moreMenuButton)
.waitToClick(selectors.ticketSales.moreMenu)
.waitToClick(selectors.ticketSales.moreMenuCreateClaim)
.wait(selectors.claimBasicData.claimStateAutocomplete)
.parsedUrl();
expect(url.hash).toEqual('#!/claim/5/basic-data');
expect(url.hash).toContain('basic-data');
});
it('should click on the Claims button of the top bar menu', async() => {
@ -246,21 +229,10 @@ xdescribe('Ticket Edit sale path', () => {
expect(url.hash).toEqual('#!/ticket/index');
});
it('should search the ticket', async() => {
const result = await nightmare
.write(selectors.ticketsIndex.searchTicketInput, '16')
.waitToClick(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should click on the result to access to the ticket Sale`, async() => {
it('should search for a ticket then access to the sales section', async() => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton)
.accessToSearchResult(16)
.accessToSection('ticket.card.sale')
.waitForURL('/sale')
.parsedUrl();
@ -272,6 +244,7 @@ xdescribe('Ticket Edit sale path', () => {
.waitToClick(selectors.ticketSales.thirdSaleCheckbox)
.waitToClick(selectors.ticketSales.deleteSaleButton)
.waitToClick(selectors.ticketSales.acceptDeleteLineButton)
.waitForSpinnerLoad()
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
@ -284,45 +257,33 @@ xdescribe('Ticket Edit sale path', () => {
expect(result).toEqual(3);
});
it('should select the third sale and attempt to send it to a frozen client ticket', async() => {
it('should select the third sale and transfer it to a valid ticket', async() => {
const targetTicketId = 12;
const result = await nightmare
.waitToClick(selectors.ticketSales.thirdSaleCheckbox)
.waitToClick(selectors.ticketSales.transferSaleButton)
.write(selectors.ticketSales.moveToTicketInput, 2)
.write(selectors.ticketSales.moveToTicketInput, targetTicketId)
.waitToClick(selectors.ticketSales.moveToTicketButton)
.waitForLastSnackbar();
expect(result).toEqual(`The sales of this ticket can't be modified`);
});
it('should transfer the third sale to a valid ticket', async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.moveToTicketInputClearButton)
.write(selectors.ticketSales.moveToTicketInput, 12)
.waitToClick(selectors.ticketSales.moveToTicketButton)
.waitForURL('ticket/12/sale')
.waitForURL(`ticket/${targetTicketId}/sale`)
.parsedUrl();
expect(result.hash).toContain(`ticket/12/sale`);
expect(result.hash).toContain(`ticket/${targetTicketId}/sale`);
});
it('should confirm the transfered line is the correct one', async() => {
const result = await nightmare
.wait(selectors.ticketSales.firstSaleText)
.waitToGetProperty(selectors.ticketSales.firstSaleText, 'innerText');
.wait(selectors.ticketSales.secondSaleText)
.waitToGetProperty(selectors.ticketSales.secondSaleText, 'innerText');
expect(result).toContain(`Melee weapon heavy shield 1x0.5m`);
expect(result).toContain(`Ranged weapon longbow 2m`);
});
it('should go back to the original ticket sales section', async() => {
const url = await nightmare
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
.write(selectors.ticketsIndex.searchTicketInput, '16')
.waitToClick(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton)
.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton)
.accessToSearchResult(16)
.accessToSection('ticket.card.sale')
.waitForURL('/sale')
.parsedUrl();
@ -339,13 +300,9 @@ xdescribe('Ticket Edit sale path', () => {
it('should go back to the receiver ticket sales section', async() => {
const url = await nightmare
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
.write(selectors.ticketsIndex.searchTicketInput, 'id:12')
.waitToClick(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton)
.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton)
.accessToSearchResult(12)
.accessToSection('ticket.card.sale')
.waitForURL('/sale')
.parsedUrl();
@ -353,78 +310,66 @@ xdescribe('Ticket Edit sale path', () => {
});
it('should transfer the sale back to the original ticket', async() => {
const targetTicketId = 16;
const result = await nightmare
.waitToClick(selectors.ticketSales.firstSaleCheckbox)
.waitToClick(selectors.ticketSales.secondSaleCheckbox)
.waitToClick(selectors.ticketSales.transferSaleButton)
.write(selectors.ticketSales.moveToTicketInput, '16')
.write(selectors.ticketSales.moveToTicketInput, targetTicketId)
.waitToClick(selectors.ticketSales.moveToTicketButton)
.waitForURL('ticket/16/sale')
.waitForURL(`ticket/${targetTicketId}/sale`)
.parsedUrl();
expect(result.hash).toContain(`ticket/16/sale`);
expect(result.hash).toContain(`ticket/${targetTicketId}/sale`);
});
it('should confirm the original ticket received the line', async() => {
const result = await nightmare
// .waitForNumberOfElements(selectors.ticketSales.saleLine, 3)
.waitForNumberOfElements(selectors.ticketSales.saleLine, 3)
.countElement(selectors.ticketSales.saleLine);
expect(result).toEqual(3);
});
it('should now go back to the original ticket sales section', async() => {
it(`should throw an error when attempting to create a ticket for an inactive client`, async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.firstSaleCheckbox)
.waitToClick(selectors.ticketSales.transferSaleButton)
.waitToClick(selectors.ticketSales.moveToNewTicketButton)
.waitToClick(selectors.ticketSales.acceptDeleteTicketButton)
.waitForLastSnackbar();
expect(result).toEqual(`You can't create a ticket for a inactive client`);
});
it('should go now to the ticket sales section of an active, not frozen client', async() => {
const url = await nightmare
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
.write(selectors.ticketsIndex.searchTicketInput, 'id:8')
.waitToClick(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 24')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton)
.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton)
.accessToSearchResult(13)
.accessToSection('ticket.card.sale')
.waitForURL('/sale')
.parsedUrl();
expect(url.hash).toContain('/sale');
});
it('should select the second and third sale and tranfer them to a new ticket then get to the ticket index', async() => {
it(`should select all sales, tranfer them to a new ticket and delete the sender ticket as it would've been left empty`, async() => {
const senderTicketId = 13;
const url = await nightmare
.waitToClick(selectors.ticketSales.firstSaleCheckbox)
.waitToClick(selectors.ticketSales.transferSaleButton)
.waitToClick(selectors.ticketSales.moveToNewTicketButton)
.resetLogin()
.waitForLogin('salesPerson')
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchTicketInput)
.parsedUrl();
expect(url.hash).toEqual('#!/ticket/index');
});
it('should search for a specific created ticket', async() => {
const result = await nightmare
.write(selectors.ticketsIndex.searchTicketInput, 'nickname:(address 24) stateFk:2')
.waitToClick(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should click on the search result to access to the ticket Sale once more`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 24')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale')
.waitToClick(selectors.ticketSales.acceptDeleteTicketButton)
.wait((selector, ticketId) => {
return document.querySelector(selector).innerText.toLowerCase().indexOf(`${ticketId}`) == -1;
}, selectors.ticketDescriptor.idLabelValue, senderTicketId)
.parsedUrl();
expect(url.hash).toContain('/sale');
});
it('should confirm the new ticket received both lines', async() => {
it('should confirm the new ticket received the line', async() => {
const result = await nightmare
.countElement(selectors.ticketSales.saleLine);
@ -441,8 +386,8 @@ xdescribe('Ticket Edit sale path', () => {
it('should mark the first sale as reserved', async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.firstSaleCheckbox)
.waitToClick(selectors.ticketSales.moreMenuButton)
.waitToClick(selectors.ticketSales.moreMenuReseveOption)
.waitToClick(selectors.ticketSales.moreMenu)
.waitToClick(selectors.ticketSales.moreMenuReserve)
.waitForClassNotPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide')
.isVisible(selectors.ticketSales.firstSaleReservedIcon);
@ -451,9 +396,8 @@ xdescribe('Ticket Edit sale path', () => {
it('should unmark the first sale as reserved', async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.firstSaleCheckbox)
.waitToClick(selectors.ticketSales.moreMenuButton)
.waitToClick(selectors.ticketSales.moreMenuUnmarkResevedOption)
.waitToClick(selectors.ticketSales.moreMenu)
.waitToClick(selectors.ticketSales.moreMenuUnmarkReseved)
.waitForClassPresent(selectors.ticketSales.firstSaleReservedIcon, 'ng-hide')
.isVisible(selectors.ticketSales.firstSaleReservedIcon);
@ -462,8 +406,7 @@ xdescribe('Ticket Edit sale path', () => {
it('should update all sales discount', async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.selectAllSalesCheckbox)
.waitToClick(selectors.ticketSales.moreMenuButton)
.waitToClick(selectors.ticketSales.moreMenu)
.waitToClick(selectors.ticketSales.moreMenuUpdateDiscount)
.write(selectors.ticketSales.moreMenuUpdateDiscountInput, 100)
.write('body', '\u000d')
@ -473,80 +416,39 @@ xdescribe('Ticket Edit sale path', () => {
expect(result).toContain('0.00');
});
it('should log in as Production role and go to the ticket index', async() => {
it('should log in as Production role and go to a target ticket summary', async() => {
const url = await nightmare
.waitForLogin('production')
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchTicketInput)
.loginAndModule('production', 'ticket')
.accessToSearchResult(13)
.waitForURL('/summary')
.parsedUrl();
expect(url.hash).toEqual('#!/ticket/index');
expect(url.hash).toContain('/summary');
});
it('should now search for a specific ticket', async() => {
it(`should check it's state is deleted`, async() => {
const result = await nightmare
.write(selectors.ticketsIndex.searchTicketInput, '16')
.waitToClick(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
expect(result).toEqual(1);
});
it(`should now click on the search result to access to the ticket Tracking`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketTracking.trackingButton)
.waitForURL('/tracking/index')
.parsedUrl();
expect(url.hash).toContain('/tracking/index');
});
it(`should click on the edit ticket tracking state button`, async() => {
const url = await nightmare
.waitToClick(selectors.ticketTracking.createStateButton)
.waitForURL('/tracking/edit')
.parsedUrl();
expect(url.hash).toContain('/tracking/edit');
});
it(`should set the state of the ticket to preparation`, async() => {
const url = await nightmare
.autocompleteSearch(selectors.ticketTracking.stateAutocomplete, 'Preparación')
.waitToClick(selectors.ticketTracking.saveButton)
.waitForURL('/tracking/index')
.parsedUrl();
expect(url.hash).toContain('/tracking/index');
});
it(`should click on the ticket Sale menu button`, async() => {
const url = await nightmare
.waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale')
.parsedUrl();
expect(url.hash).toContain('/sale');
expect(result).toEqual('State Eliminado');
});
describe('when state is preparation and loged as Production', () => {
it(`should not be able to edit the sale price`, async() => {
const result = await nightmare
.wait(selectors.ticketSales.firstSaleID)
.exists(selectors.ticketSales.firstSalePrice);
.waitToClick(selectors.ticketDescriptor.goBackToModuleIndexButton)
.accessToSearchResult(8)
.accessToSection('ticket.card.sale')
.waitToClick(selectors.ticketSales.firstSalePrice)
.exists(selectors.ticketSales.firstSalePriceInput);
expect(result).toBeFalsy();
});
it(`should not be able to edit the sale discount`, async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.firstSaleID)
.exists(selectors.ticketSales.firstSaleDiscount);
.waitToClick(selectors.ticketSales.firstSaleDiscount)
.exists(selectors.ticketSales.firstSaleDiscountInput);
expect(result).toBeFalsy();
});
@ -559,33 +461,11 @@ xdescribe('Ticket Edit sale path', () => {
expect(result).toBeFalsy();
});
it('should log in as salesPerson role and go to the ticket index', async() => {
it('should log in as salesPerson then go to the sales of a target ticket', async() => {
const url = await nightmare
.waitForLogin('salesPerson')
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchTicketInput)
.parsedUrl();
expect(url.hash).toEqual('#!/ticket/index');
});
it('should once again search for a specific ticket', async() => {
const result = await nightmare
.write(selectors.ticketsIndex.searchTicketInput, '16')
.waitToClick(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(1);
});
it(`should click on the search result to access to the ticket Sale once again`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton)
.loginAndModule('salesPerson', 'ticket')
.accessToSearchResult(8)
.accessToSection('ticket.card.sale')
.waitForURL('/sale')
.parsedUrl();
@ -594,23 +474,23 @@ xdescribe('Ticket Edit sale path', () => {
});
describe('when state is preparation and loged as salesPerson', () => {
it(`shouldnt be able to edit the sale price`, async() => {
it(`shouldn't be able to edit the sale price`, async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.firstSaleID)
.exists(selectors.ticketSales.firstSalePrice);
.waitToClick(selectors.ticketSales.firstSalePrice)
.exists(selectors.ticketSales.firstSalePriceInput);
expect(result).toBeFalsy();
});
it(`shouldnt be able to edit the sale discount`, async() => {
it(`should be able to edit the sale discount`, async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.firstSaleID)
.exists(selectors.ticketSales.firstSaleDiscount);
.waitToClick(selectors.ticketSales.firstSaleDiscount)
.exists(selectors.ticketSales.firstSaleDiscountInput);
expect(result).toBeFalsy();
});
it(`shouldnt be able to edit the sale state`, async() => {
it(`should not be able to edit the sale state`, async() => {
const result = await nightmare
.waitToClick(selectors.ticketSales.stateMenuButton)
.exists(selectors.ticketSales.stateMenuOptions);

View File

@ -12,7 +12,7 @@ describe('Ticket diary path', () => {
it('should search for a specific ticket', async() => {
const result = await nightmare
.write(selectors.ticketsIndex.searchTicketInput, 'id:1')
.write(selectors.ticketsIndex.searchTicketInput, 1)
.waitToClick(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
@ -22,7 +22,7 @@ describe('Ticket diary path', () => {
it(`should click on the search result to access to the ticket summary`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Bat cave')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitForURL('/summary')
.parsedUrl();
@ -31,26 +31,27 @@ describe('Ticket diary path', () => {
});
it(`should navigate to the item diary from the 1st sale item id descriptor popover`, async() => {
const itemId = 2;
const url = await nightmare
.waitToClick(selectors.ticketSummary.firstSaleItemId)
.waitToClick(selectors.ticketSummary.popoverDiaryButton)
.waitForLogin('employee')
.goto(`${config.url}#!/item/1/diary?warehouseFk=1&ticketFk=1`)
.goto(`${config.url}#!/item/${itemId}/diary?warehouseFk=1&ticketFk=1`)
.parsedUrl();
expect(url.hash).toContain('/diary');
});
it(`should check the seventh line id is marked as counter`, async() => {
it(`should check the second line id is marked as counter`, async() => {
const result = await nightmare
.waitToGetProperty(selectors.itemDiary.thirdTicketId, 'className');
.waitToGetProperty(selectors.itemDiary.secondTicketId, 'className');
expect(result).toContain('counter');
});
it(`should check the fifth line balance is marked as counter`, async() => {
it(`should check the third line balance is marked as counter`, async() => {
const result = await nightmare
.waitToGetProperty(`${selectors.itemDiary.fifthBalance} > span`, 'className');
.waitToGetProperty(`${selectors.itemDiary.fourthBalance} > span`, 'className');
expect(result).toContain('counter');
});

View File

@ -6,13 +6,13 @@ describe('Ticket descriptor path', () => {
beforeAll(() => {
nightmare
.loginAndModule('employee', 'ticket');
.loginAndModule('salesperson', 'ticket');
});
describe('Delete ticket', () => {
it('should search for an specific ticket', async() => {
const result = await nightmare
.write(selectors.ticketsIndex.searchTicketInput, '17')
.write(selectors.ticketsIndex.searchTicketInput, 18)
.waitToClick(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
@ -22,7 +22,7 @@ describe('Ticket descriptor path', () => {
it(`should click on the search result to access to the ticket summary`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 26')
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Cerebro')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitForURL('/summary')
.parsedUrl();
@ -49,7 +49,7 @@ describe('Ticket descriptor path', () => {
it(`should search for the deleted ticket and check it's date`, async() => {
const result = await nightmare
.write(selectors.ticketsIndex.searchTicketInput, 17)
.write(selectors.ticketsIndex.searchTicketInput, 18)
.waitToClick(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.wait(selectors.ticketsIndex.searchResultDate)
@ -63,7 +63,7 @@ describe('Ticket descriptor path', () => {
it('should search for a ticket', async() => {
const result = await nightmare
.clearInput(selectors.ticketsIndex.searchTicketInput)
.write(selectors.ticketsIndex.searchTicketInput, 20)
.write(selectors.ticketsIndex.searchTicketInput, 16)
.waitToClick(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
@ -71,9 +71,9 @@ describe('Ticket descriptor path', () => {
expect(result).toEqual(1);
});
it(`should click on the search result to access to the ticket summary`, async() => {
it(`should now click on the search result to access to the ticket summary`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 28')
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Many Places')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitForURL('/summary')
.parsedUrl();
@ -85,16 +85,16 @@ describe('Ticket descriptor path', () => {
const isVisible = await nightmare
.waitToClick(selectors.ticketDescriptor.moreMenu)
.waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway)
.wait(selectors.ticketDescriptor.addStowawayDialogSecondTicket)
.isVisible(selectors.ticketDescriptor.addStowawayDialogSecondTicket);
.wait(selectors.ticketDescriptor.addStowawayDialogFirstTicket)
.isVisible(selectors.ticketDescriptor.addStowawayDialogFirstTicket);
expect(isVisible).toBeTruthy();
});
it('should add the second ticket as stowaway', async() => {
it('should add a ticket as stowaway', async() => {
const result = await nightmare
.waitToClick(selectors.ticketDescriptor.addStowawayDialogSecondTicket)
.waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
@ -103,32 +103,37 @@ describe('Ticket descriptor path', () => {
it(`should navigate to the added ticket using the descriptors ship button`, async() => {
const url = await nightmare
.waitToClick(selectors.ticketDescriptor.closeStowawayDialog)
.waitToClick(selectors.ticketDescriptor.shipSelectButton)
.waitToClick(selectors.ticketDescriptor.shipMenuSecondTicket)
.waitForURL('#!/ticket/22/sale')
.waitToClick(selectors.ticketDescriptor.shipButton)
.waitForURL('#!/ticket/17/summary')
.parsedUrl();
expect(url.hash).toContain('#!/ticket/22/sale');
expect(url.hash).toContain('#!/ticket/17/summary');
});
it(`should check the state of the stowaway ticket is embarked`, async() => {
const state = await nightmare
.waitToGetProperty(selectors.ticketDescriptor.stateLabelValue, 'innerText');
expect(state).toEqual('State Embarcando');
});
it(`should navigate to the ship ticket using the descriptors ship button`, async() => {
const url = await nightmare
.waitToClick(selectors.ticketDescriptor.shipButton)
.waitForURL('#!/ticket/20/summary')
.waitForURL('#!/ticket/16/summary')
.parsedUrl();
expect(url.hash).toContain('#!/ticket/20/summary');
expect(url.hash).toContain('#!/ticket/16/summary');
});
it(`should navigate back to the added ticket using the descriptors ship button`, async() => {
const url = await nightmare
.waitToClick(selectors.ticketDescriptor.closeStowawayDialog)
.waitToClick(selectors.ticketDescriptor.shipSelectButton)
.waitToClick(selectors.ticketDescriptor.shipMenuSecondTicket)
.waitForURL('#!/ticket/22/sale')
.waitToClick(selectors.ticketDescriptor.shipButton)
.waitForURL('#!/ticket/17/summary')
.parsedUrl();
expect(url.hash).toContain('#!/ticket/22/sale');
expect(url.hash).toContain('#!/ticket/17/summary');
});
it('should delete the stowaway', async() => {
@ -151,7 +156,7 @@ describe('Ticket descriptor path', () => {
describe('Make invoice', () => {
it('should login as adminBoss role then search for a ticket', async() => {
const invoiceableTicketId = 11;
const invoiceableTicketId = 14;
const url = await nightmare
.loginAndModule('adminBoss', 'ticket')

View File

@ -3,7 +3,7 @@ import createNightmare from '../../helpers/nightmare';
describe('Ticket services path', () => {
const nightmare = createNightmare();
const invoicedTicketId = 10;
const invoicedTicketId = 1;
describe('as employee', () => {
beforeAll(() => {
@ -36,12 +36,16 @@ describe('Ticket services path', () => {
});
describe('as administrative', () => {
let editableTicketId = 13;
beforeAll(() => {
nightmare
let editableTicketId = 16;
it('should navigate to the services of a target ticket', async() => {
const url = await nightmare
.loginAndModule('administrative', 'ticket')
.accessToSearchResult(editableTicketId)
.accessToSection('ticket.card.service');
.accessToSection('ticket.card.service')
.waitForURL('/service')
.parsedUrl();
expect(url.hash).toContain('/service');
});
it('should click on the add button to prepare the form to create a new service', async() => {

View File

@ -0,0 +1,105 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Ticket Summary path', () => {
const nightmare = createNightmare();
const ticketId = 20;
it('should navigate to the target ticket summary section', async() => {
let url = await nightmare
.loginAndModule('employee', 'ticket')
.accessToSearchResult(ticketId)
.waitForURL('/summary')
.parsedUrl();
expect(url.hash).toContain('/summary');
});
it(`should display details from the ticket and it's client on the top of the header`, async() => {
let result = await nightmare
.waitForSpinnerLoad()
.waitToGetProperty(selectors.ticketSummary.header, 'innerText');
expect(result).toContain(`Ticket #${ticketId}`);
expect(result).toContain('Bruce Banner (109)');
expect(result).toContain('Somewhere in Thailand');
});
it('should display ticket details', async() => {
let result = await nightmare
.waitToGetProperty(selectors.ticketSummary.state, 'innerText');
expect(result).toContain('Arreglar');
});
it('should display delivery details', async() => {
let result = await nightmare
.waitToGetProperty(selectors.ticketSummary.route, 'innerText');
expect(result).toContain('3');
});
it('should display the ticket total', async() => {
let result = await nightmare
.waitToGetProperty(selectors.ticketSummary.total, 'innerText');
expect(result).toContain('€155.54');
});
it('should display the ticket line(s)', async() => {
let result = await nightmare
.waitToGetProperty(selectors.ticketSummary.firstSaleItemId, 'innerText');
expect(result).toContain('000002');
});
it(`should click on the first sale ID making the item descriptor visible`, async() => {
const visible = await nightmare
.waitToClick(selectors.ticketSummary.firstSaleItemId)
.waitImgLoad(selectors.ticketSummary.firstSaleDescriptorImage)
.isVisible(selectors.ticketSummary.itemDescriptorPopover);
expect(visible).toBeTruthy();
});
it(`should check the url for the item diary link of the descriptor is for the right item id`, async() => {
const exists = await nightmare
.exists(selectors.ticketSummary.itemDescriptorPopoverItemDiaryButton);
expect(exists).toBeTruthy();
});
it('should click on the SET OK button and throw a privileges error', async() => {
let result = await nightmare
.waitToClick(selectors.ticketSummary.setOk)
.waitForLastSnackbar();
expect(result).toEqual(`You don't have enough privileges`);
});
it('should log in as production then navigate to the summary of the same ticket', async() => {
let url = await nightmare
.loginAndModule('production', 'ticket')
.accessToSearchResult(ticketId)
.waitForURL('/summary')
.parsedUrl();
expect(url.hash).toContain('/summary');
});
it('should click on the SET OK button', async() => {
let result = await nightmare
.waitToClick(selectors.ticketSummary.setOk)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm the ticket state was updated', async() => {
let result = await nightmare
.waitForSpinnerLoad()
.waitToGetProperty(selectors.ticketSummary.state, 'innerText');
expect(result).toContain('OK');
});
});

View File

@ -1,13 +1,14 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Claim detail', () => {
// #1528 e2e claim/detail
xdescribe('Claim detail', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('salesPerson', 'claim')
.accessToSearchResult('4')
.accessToSearchResult(1)
.accessToSection('claim.card.detail');
});
@ -27,25 +28,54 @@ describe('Claim detail', () => {
expect(result).toEqual(2);
});
it('should edit de second item claimed quantity', async() => {
it('should edit de first item claimed quantity', async() => {
const result = await nightmare
.clearInput(selectors.claimDetail.secondItemQuantityInput)
.write(selectors.claimDetail.secondItemQuantityInput, 10)
.clearInput(selectors.claimDetail.firstItemQuantityInput)
.write(selectors.claimDetail.firstItemQuantityInput, 4)
.write('body', '\u000d') // simulates enter
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm the second item, and the claimed total were correctly edited', async() => {
it('should confirm the first item quantity, and the claimed total were correctly edited', async() => {
const claimedQuantity = await nightmare
.waitToGetProperty(selectors.claimDetail.secondItemQuantityInput, 'value');
.waitToGetProperty(selectors.claimDetail.firstItemQuantityInput, 'value');
const totalClaimed = await nightmare
.waitToGetProperty(selectors.claimDetail.totalClaimed, 'innerText');
expect(claimedQuantity).toEqual('10');
expect(totalClaimed).toContain('99.30');
expect(claimedQuantity).toEqual('4');
expect(totalClaimed).toContain('€47.62');
});
it('should login as salesAssistant and navigate to the claim.detail section', async() => {
const url = await nightmare
.loginAndModule('salesAssistant', 'claim')
.accessToSearchResult(1)
.accessToSection('claim.card.detail')
.waitForURL('/detail')
.parsedUrl();
expect(url.hash).toContain('/detail');
});
it('should edit de second item claimed discount', async() => {
const result = await nightmare
.waitToClick(selectors.claimDetail.secondItemDiscount)
.write(selectors.claimDetail.discountInput, 100)
.write('body', '\u000d') // simulates enter
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should check the mana is the expected one', async() => {
const result = await nightmare
.waitToClick(selectors.claimDetail.secondItemDiscount)
.waitToGetProperty(selectors.claimDetail.discoutPopoverMana, 'innerText');
expect(result).toContain('MANÁ: €106');
});
it('should delete the second item from the claim', async() => {
@ -63,11 +93,8 @@ describe('Claim detail', () => {
expect(result).toEqual(1);
});
it('should login as salesAssistant to be redirected to the next claim section', async() => {
it('should add the deleted ticket from to the claim', async() => {
const result = await nightmare
.loginAndModule('salesAssistant', 'claim')
.accessToSearchResult('2')
.accessToSection('claim.card.detail')
.waitToClick(selectors.claimDetail.addItemButton)
.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket)
.waitForLastSnackbar();
@ -82,4 +109,13 @@ describe('Claim detail', () => {
expect(url.hash).toContain('development');
});
it('should navigate back to claim.detail to confirm the claim contains now two items', async() => {
const result = await nightmare
.accessToSection('claim.card.detail')
.wait(selectors.claimDetail.claimDetailLine)
.countElement(selectors.claimDetail.claimDetailLine);
expect(result).toEqual(2);
});
});

View File

@ -7,7 +7,7 @@ describe('Claim action path', () => {
beforeAll(() => {
nightmare
.loginAndModule('administrative', 'claim')
.accessToSearchResult('4')
.accessToSearchResult(4)
.accessToSection('claim.card.action');
});
@ -19,7 +19,7 @@ describe('Claim action path', () => {
expect(result).toEqual('Data saved!');
});
it('should import the eighth ticket', async() => {
it('should import the second importable ticket', async() => {
const result = await nightmare
.waitToClick(selectors.claimAction.importTicketButton)
.waitToClick(selectors.claimAction.secondImportableTicket)
@ -28,17 +28,16 @@ describe('Claim action path', () => {
expect(result).toEqual('Data saved!');
});
it('should edit the fourth line destination field', async() => {
it('should edit the second line destination field', async() => {
const result = await nightmare
.autocompleteSearch(selectors.claimAction.thirdLineDestination, 'Bueno')
.autocompleteSearch(selectors.claimAction.secondLineDestination, 'Bueno')
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should delete two first lines', async() => {
it('should delete the first line', async() => {
const result = await nightmare
.waitToClick(selectors.claimAction.secondDeleteLine)
.waitToClick(selectors.claimAction.firstDeleteLine)
.waitForLastSnackbar();
@ -61,7 +60,7 @@ describe('Claim action path', () => {
expect(result).toEqual('Data saved!');
});
it('should check the Is paid with mana checkbox', async() => {
it('should check the "is paid with mana" checkbox', async() => {
const result = await nightmare
.waitToClick(selectors.claimAction.isPaidWithManaCheckbox)
.waitForSnackbar();
@ -69,7 +68,7 @@ describe('Claim action path', () => {
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
});
it('should confirm the Is paid with mana checkbox is checked', async() => {
it('should confirm the "is paid with mana" checkbox is checked', async() => {
const result = await nightmare
.reloadSection('claim.card.action')
.checkboxState(selectors.claimAction.isPaidWithManaCheckbox);

View File

@ -0,0 +1,95 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('claim Summary path', () => {
const nightmare = createNightmare();
const claimId = 4;
it('should navigate to the target claim summary section', async() => {
let url = await nightmare
.loginAndModule('employee', 'claim')
.accessToSearchResult(claimId)
.waitForURL('/summary')
.parsedUrl();
expect(url.hash).toContain('/summary');
});
it(`should display details from the claim and it's client on the top of the header`, async() => {
let result = await nightmare
.waitForSpinnerLoad()
.waitToGetProperty(selectors.claimSummary.header, 'innerText');
expect(result).toContain('4 -');
expect(result).toContain('Tony Stark');
});
it('should display the claim state', async() => {
let result = await nightmare
.waitToGetProperty(selectors.claimSummary.state, 'innerText');
expect(result).toContain('Resuelto');
});
it('should display the observation', async() => {
let result = await nightmare
.waitToGetProperty(selectors.claimSummary.observation, 'value');
expect(result).toContain('observation four');
});
it('should display the claimed line(s)', async() => {
let result = await nightmare
.waitToGetProperty(selectors.claimSummary.firstSaleItemId, 'innerText');
expect(result).toContain('000002');
});
it(`should click on the first sale ID making the item descriptor visible`, async() => {
const visible = await nightmare
.waitToClick(selectors.claimSummary.firstSaleItemId)
.waitImgLoad(selectors.claimSummary.firstSaleDescriptorImage)
.isVisible(selectors.claimSummary.itemDescriptorPopover);
expect(visible).toBeTruthy();
});
it(`should check the url for the item diary link of the descriptor is for the right item id`, async() => {
const exists = await nightmare
.exists(selectors.claimSummary.itemDescriptorPopoverItemDiaryButton);
expect(exists).toBeTruthy();
});
it('should display the claim development details', async() => {
let result = await nightmare
.waitToGetProperty(selectors.claimSummary.firstDevelopmentWorker, 'innerText');
expect(result).toContain('salesAssistantNick');
});
it(`should click on the first development worker making the worker descriptor visible`, async() => {
const visible = await nightmare
.waitToClick(selectors.claimSummary.firstDevelopmentWorker)
.wait(selectors.claimSummary.firstDevelopmentWorkerGoToClientButton)
.isVisible(selectors.claimSummary.firstDevelopmentWorkerGoToClientButton);
expect(visible).toBeTruthy();
});
it(`should check the url for the go to clientlink of the descriptor is for the right client id`, async() => {
const exists = await nightmare
.exists(selectors.claimSummary.firstDevelopmentWorkerGoToClientButton);
expect(exists).toBeTruthy();
});
it(`should click on the first action ticket ID making the ticket descriptor visible`, async() => {
const visible = await nightmare
.waitToClick(selectors.claimSummary.firstActionTicketId)
.wait(selectors.claimSummary.firstActionTicketDescriptor)
.isVisible(selectors.claimSummary.firstActionTicketDescriptor);
expect(visible).toBeTruthy();
});
});

View File

@ -0,0 +1,70 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('claim Descriptor path', () => {
const nightmare = createNightmare();
const claimId = 1;
it('should navigate to the target claim summary section', async() => {
let url = await nightmare
.loginAndModule('employee', 'claim')
.accessToSearchResult(claimId)
.waitForURL('/summary')
.parsedUrl();
expect(url.hash).toContain('/summary');
});
it(`should not be able to see the delete claim button of the descriptor more menu`, async() => {
let exists = await nightmare
.waitToClick(selectors.claimDescriptor.moreMenu)
.exists(selectors.claimDescriptor.moreMenuDeleteClaim);
expect(exists).toBeFalsy();
});
it(`should log in as salesAssistant and navigate to the target claim`, async() => {
let url = await nightmare
.loginAndModule('salesAssistant', 'claim')
.accessToSearchResult(claimId)
.waitForURL('/summary')
.parsedUrl();
expect(url.hash).toContain('/summary');
});
it(`should be able to see the delete claim button of the descriptor more menu`, async() => {
let exists = await nightmare
.waitToClick(selectors.claimDescriptor.moreMenu)
.exists(selectors.claimDescriptor.moreMenuDeleteClaim);
expect(exists).toBeTruthy();
});
it(`should delete the claim`, async() => {
let result = await nightmare
.waitToClick(selectors.claimDescriptor.moreMenuDeleteClaim)
.waitToClick(selectors.claimDescriptor.acceptDeleteClaim)
.waitForLastSnackbar();
expect(result).toEqual('Claim deleted!');
});
it(`should have been relocated to the claim index`, async() => {
let url = await nightmare
.waitForURL('/claim/index')
.parsedUrl();
expect(url.hash).toContain('/claim/index');
});
it(`should search for the deleted claim to find no results`, async() => {
const result = await nightmare
.write(selectors.claimsIndex.searchClaimInput, claimId)
.waitToClick(selectors.claimsIndex.searchButton)
.waitForNumberOfElements(selectors.claimsIndex.searchResult, 0)
.countElement(selectors.claimsIndex.searchResult);
expect(result).toEqual(0);
});
});

View File

@ -3,11 +3,13 @@ import createNightmare from '../../helpers/nightmare';
describe('Order edit basic data path', () => {
const nightmare = createNightmare();
const today = new Date().getDate();
describe('when confirmed order', () => {
beforeAll(() => {
nightmare
.loginAndModule('employee', 'order')
.accessToSearchResult('1')
.accessToSearchResult(1)
.accessToSection('order.card.basicData');
});
@ -24,19 +26,20 @@ describe('Order edit basic data path', () => {
describe('when order with rows', () => {
it('should now navigate to order index', async() => {
const orderId = 16;
const url = await nightmare
.waitToClick(selectors.globalItems.returnToModuleIndexButton)
.waitToClick(selectors.globalItems.acceptVnConfirm)
.waitToClick(selectors.globalItems.acceptButton)
.wait(selectors.ordersIndex.createOrderButton)
.accessToSearchResult('16')
.accessToSearchResult(orderId)
.accessToSection('order.card.basicData')
.wait(selectors.orderBasicData.observationInput)
.parsedUrl();
expect(url.hash).toEqual('#!/order/16/basic-data');
expect(url.hash).toEqual(`#!/order/${orderId}/basic-data`);
});
it('should not be able to change the company', async() => {
it('should not be able to change anything', async() => {
const result = await nightmare
.write(selectors.orderBasicData.observationInput, 'observation')
.waitToClick(selectors.orderBasicData.saveButton)
@ -47,17 +50,36 @@ describe('Order edit basic data path', () => {
});
describe('when new order', () => {
it('should once more navigate to order index', async() => {
it('should navigate to the order index and click the new order button', async() => {
const url = await nightmare
.waitToClick(selectors.globalItems.returnToModuleIndexButton)
.waitToClick(selectors.globalItems.acceptVnConfirm)
.wait(selectors.ordersIndex.createOrderButton)
.accessToSearchResult('18')
.waitToClick(selectors.globalItems.acceptButton)
.waitToClick(selectors.ordersIndex.createOrderButton)
.waitForURL('#!/order/create')
.parsedUrl();
expect(url.hash).toContain('#!/order/create');
});
it('should now create a new one', async() => {
const url = await nightmare
.autocompleteSearch(selectors.createOrderView.clientAutocomplete, 'Jessica Jones')
.datePicker(selectors.createOrderView.landedDatePicker, 0, today)
.autocompleteSearch(selectors.createOrderView.agencyAutocomplete, 'inhouse pickup')
.waitToClick(selectors.createOrderView.createButton)
.waitForURL('/catalog')
.parsedUrl();
expect(url.hash).toContain('/catalog');
});
it('should navigate to the basic data section of the new order', async() => {
const url = await nightmare
.accessToSection('order.card.basicData')
.wait(selectors.orderBasicData.observationInput)
.parsedUrl();
expect(url.hash).toEqual('#!/order/18/basic-data');
expect(url.hash).toContain('/basic-data');
});
it('should be able to modify all the properties', async() => {
@ -65,8 +87,7 @@ describe('Order edit basic data path', () => {
.autocompleteSearch(selectors.orderBasicData.clientAutocomplete, 'Tony Stark')
.autocompleteSearch(selectors.orderBasicData.addressAutocomplete, 'Tony Stark')
.autocompleteSearch(selectors.orderBasicData.agencyAutocomplete, 'Silla247')
.clearTextarea(selectors.orderBasicData.observationInput)
.write(selectors.orderBasicData.observationInput, 'Observation modified')
.write(selectors.orderBasicData.observationInput, 'my observation')
.waitToClick(selectors.orderBasicData.saveButton)
.waitForLastSnackbar();
@ -92,7 +113,7 @@ describe('Order edit basic data path', () => {
const result = await nightmare
.waitToGetProperty(selectors.orderBasicData.observationInput, 'value');
expect(result).toEqual('Observation modified');
expect(result).toEqual('my observation');
});
});
});

View File

@ -6,7 +6,7 @@ describe('Order lines', () => {
beforeAll(() => {
nightmare
.loginAndModule('employee', 'order')
.accessToSearchResult('16')
.accessToSearchResult(16)
.accessToSection('order.card.line');
});

View File

@ -1,35 +1,18 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Route basic Data path', () => {
// #1528 e2e claim/detail
xdescribe('Route basic Data path', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('delivery', 'route')
.accessToSearchResult(2)
.accessToSearchResult(3)
.accessToSection('route.card.tickets');
});
it('should now modify the first ticket priority', async() => {
const result = await nightmare
.write(selectors.routeTickets.firstTicketPriority, 4)
.write('body', '\u000d') // simulates enter
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should next modify the first ticket priority', async() => {
const result = await nightmare
.write(selectors.routeTickets.firstTicketPriority, 3)
.write('body', '\u000d') // simulates enter
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should once more modify the first ticket priority', async() => {
it('should modify the first ticket priority', async() => {
const result = await nightmare
.write(selectors.routeTickets.firstTicketPriority, 2)
.write('body', '\u000d') // simulates enter
@ -38,44 +21,6 @@ describe('Route basic Data path', () => {
expect(result).toEqual('Data saved!');
});
it('should finally modify the first ticket priority', async() => {
const result = await nightmare
.write(selectors.routeTickets.firstTicketPriority, 1)
.write('body', '\u000d') // simulates enter
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should reload the section as a pre-step to check the first ticket priority', async() => {
const result = await nightmare
.reloadSection('route.card.tickets')
.waitToGetProperty(selectors.routeTickets.firstTicketPriority, 'value');
expect(result).toEqual('1');
});
it('should confirm the second ticket priority', async() => {
const result = await nightmare
.waitToGetProperty(selectors.routeTickets.secondTicketPriority, 'value');
expect(result).toEqual('2');
});
it('should confirm the third ticket priority', async() => {
const result = await nightmare
.waitToGetProperty(selectors.routeTickets.thirdTicketPriority, 'value');
expect(result).toEqual('3');
});
it('should confirm the fourth ticket priority', async() => {
const result = await nightmare
.waitToGetProperty(selectors.routeTickets.fourthTicketPriority, 'value');
expect(result).toEqual('4');
});
it('should confirm the buscamanButton is disabled', async() => {
const result = await nightmare
.evaluate(selector => {
@ -85,7 +30,7 @@ describe('Route basic Data path', () => {
expect(result).toBeTruthy();
});
it('should check the first ticket checkbox and confirm the buscamanButton button isnt disabled anymore', async() => {
it('should check the first ticket checkbox and confirm the buscamanButton button is no longer disabled', async() => {
const result = await nightmare
.waitToClick(selectors.routeTickets.firstTicketCheckbox)
.evaluate(selector => {
@ -95,11 +40,18 @@ describe('Route basic Data path', () => {
expect(result).toBeFalsy();
});
it('should check the route volume on the descriptor', async() => {
const result = await nightmare
.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText');
expect(result).toEqual('1.1 / 18 m³');
});
it('should count how many tickets are in route', async() => {
const result = await nightmare
.countElement('vn-route-tickets vn-textfield[model="ticket.priority"]');
expect(result).toEqual(4);
expect(result).toEqual(11);
});
it('should delete the first ticket in route', async() => {
@ -111,10 +63,26 @@ describe('Route basic Data path', () => {
expect(result).toEqual('Ticket removed from route');
});
it('should again delete the first ticket in route', async() => {
const result = await nightmare
.waitToClick(selectors.routeTickets.firstTicketDeleteButton)
.waitToClick(selectors.routeTickets.confirmButton)
.waitForLastSnackbar();
expect(result).toEqual('Ticket removed from route');
});
it('should now count how many tickets are in route to find one less', async() => {
const result = await nightmare
.countElement('vn-route-tickets vn-textfield[model="ticket.priority"]');
expect(result).toEqual(3);
expect(result).toEqual(9);
});
it('should confirm the route volume on the descriptor has been updated by the changes made', async() => {
const result = await nightmare
.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText');
expect(result).toEqual('0.9 / 18 m³');
});
});

View File

@ -3,6 +3,7 @@ import createNightmare from '../../helpers/nightmare';
describe('InvoiceOut descriptor path', () => {
const nightmare = createNightmare();
let bookedDate;
describe('as Administrative', () => {
beforeAll(() => {
@ -15,10 +16,10 @@ describe('InvoiceOut descriptor path', () => {
.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton)
.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222')
.waitToClick(selectors.ticketsIndex.advancedSearchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 2)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(2);
expect(result).toEqual(1);
});
it('should navigate to the invoiceOut index', async() => {
@ -44,8 +45,7 @@ describe('InvoiceOut descriptor path', () => {
it(`should click on the search result to access to the invoiceOut summary`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.invoiceOutIndex.searchResult, 'T2222222')
.waitToClick(selectors.invoiceOutIndex.searchResult)
.accessToSearchResult('T2222222')
.waitForURL('/summary')
.parsedUrl();
@ -112,34 +112,25 @@ describe('InvoiceOut descriptor path', () => {
expect(url.hash).toEqual('#!/invoice-out/index');
});
it('should search for a new target invoiceOut', async() => {
const result = await nightmare
.write(selectors.invoiceOutIndex.searchInvoiceOutInput, 'A1111111')
.waitToClick(selectors.invoiceOutIndex.searchButton)
.waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 1)
.countElement(selectors.invoiceOutIndex.searchResult);
expect(result).toEqual(1);
});
it(`should now click on the search result to access to the invoiceOut summary`, async() => {
it(`should search and access to the invoiceOut summary`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.invoiceOutIndex.searchResult, 'A1111111')
.waitToClick(selectors.invoiceOutIndex.searchResult)
.accessToSearchResult('T1111111')
.waitForURL('/summary')
.parsedUrl();
expect(url.hash).toContain('/summary');
});
it(`should check the invoiceOut isn't booked yet in the summary data`, async() => {
it(`should check the invoiceOut is booked in the summary data`, async() => {
const result = await nightmare
.waitToGetProperty(selectors.invoiceOutSummary.bookedLabel, 'innerText');
expect(result).toEqual('-');
bookedDate = result;
expect(result.length).toBeGreaterThan(1);
});
it('should book the invoiceOut using the descriptor more menu', async() => {
it('should re-book the invoiceOut using the descriptor more menu', async() => {
const result = await nightmare
.waitToClick(selectors.invoiceOutDescriptor.moreMenu)
.waitToClick(selectors.invoiceOutDescriptor.moreMenuBookInvoiceOut)
@ -153,7 +144,7 @@ describe('InvoiceOut descriptor path', () => {
const result = await nightmare
.waitToGetProperty(selectors.invoiceOutSummary.bookedLabel, 'innerText');
expect(result.length).toBeGreaterThan(1);
expect(result).not.toEqual(bookedDate);
});
});

View File

@ -16,7 +16,7 @@
</div>
<label class="mdl-textfield__label">
<span translate>{{::$ctrl.label}}</span>
<span translate ng-show="::$ctrl.required">(*)</span>
<span translate ng-show="::$ctrl.required">*</span>
</label>
</div>
</div>

View File

@ -30,6 +30,8 @@ export default class Autocomplete extends Input {
componentHandler.upgradeElement(
this.element.querySelector('.mdl-textfield'));
this.registerEvents();
}
$postLink() {
@ -40,6 +42,15 @@ export default class Autocomplete extends Input {
this.refreshSelection();
}
/**
* Registers all event emitters
*/
registerEvents() {
this.input.addEventListener('focus', event => {
this.emit('focus', {event});
});
}
get model() {
return this._model;
}
@ -223,7 +234,6 @@ export default class Autocomplete extends Input {
const value = item[this.valueField];
this.selection = item;
this.setValue(value);
this.field = value;
}
onClearClick(event) {
@ -232,7 +242,7 @@ export default class Autocomplete extends Input {
}
onKeyDown(event) {
if (event.defaultPrevented) return;
// if (event.defaultPrevented) return;
switch (event.keyCode) {
case 38: // Up

View File

@ -8,7 +8,10 @@ export default class ButtonMenu extends Input {
super($element, $scope);
this.$transclude = $transclude;
this.input = this.element.querySelector('.mdl-button');
$element.on('click', e => this.onClick(e));
$element.on('click', e => {
if (!this.disabled)
this.onClick(e);
});
}
get model() {

View File

@ -26,37 +26,55 @@
<vn-vertical class="body">
<vn-horizontal class="weekdays">
<section class="day" ng-click="$ctrl.selectAll(1)">
<section title="{{'Monday' | translate}}"
ng-click="$ctrl.selectAll(1)">
<span>L</span>
</section>
<section class="day" ng-click="$ctrl.selectAll(2)">
<section title="{{'Tuesday' | translate}}"
ng-click="$ctrl.selectAll(2)">
<span>M</span>
</section>
<section class="day" ng-click="$ctrl.selectAll(3)">
<section title="{{'Wednesday' | translate}}"
ng-click="$ctrl.selectAll(3)">
<span>X</span>
</section>
<section class="day" ng-click="$ctrl.selectAll(4)">
<section title="{{'Thursday' | translate}}"
ng-click="$ctrl.selectAll(4)">
<span>J</span>
</section>
<section class="day" ng-click="$ctrl.selectAll(5)">
<section title="{{'Friday' | translate}}"
ng-click="$ctrl.selectAll(5)">
<span>V</span>
</section>
<section class="day" ng-click="$ctrl.selectAll(6)">
<section title="{{'Saturday' | translate}}"
ng-click="$ctrl.selectAll(6)">
<span>S</span>
</section>
<section class="day" ng-click="$ctrl.selectAll(0)">
<section title="{{'Sunday' | translate}}"
ng-click="$ctrl.selectAll(0)">
<span>D</span>
</section>
</vn-horizontal>
<vn-horizontal class="days">
<section ng-repeat="day in $ctrl.days" class="day {{day.event.className || day.className}}"
ng-click="$ctrl.select($index)"
ng-style="{'color': day.event.style.color}">
<span ng-if="day.event" vn-tooltip="{{day.event.title}}"
ng-style="{'background-color': day.event.style.background}">
<section ng-repeat="day in $ctrl.days" class="day"
ng-class="{'primary': day.events.length > 0}">
<div class="content">
<div class="day-number"
title="{{(day.events[0].description || day.events[0].name) | translate}}"
ng-style="$ctrl.renderStyle(day.style || day.events[0].style)"
ng-click="$ctrl.select($index)">
{{::day.dated | date: 'd'}}
</div>
<div ng-if="day.events" class="events">
<div ng-repeat="event in day.events" class="event"
title="{{(event.description || event.name) | translate}}">
<span class="chip ellipsize"
ng-style="::$ctrl.renderStyle(event.style)">
{{::event.name}}
</span>
<span ng-if="!day.event">{{::day.dated | date: 'd'}}</span>
</div>
</div>
</div>
</section>
</vn-horizontal>
</vn-vertical>

View File

@ -12,7 +12,25 @@ export default class Calendar extends Component {
this.events = [];
this.defaultDate = new Date();
this.displayControls = true;
this.disabled = false;
this.skip = 1;
this.window.addEventListener('resize', () => {
this.checkSize();
});
}
/**
* Resizes the calendar
* based on component height
*/
checkSize() {
const height = this.$element[0].clientHeight;
if (height < 530)
this.$element.addClass('small');
else
this.$element.removeClass('small');
}
/**
@ -49,8 +67,10 @@ export default class Calendar extends Component {
this.addEvent(event);
});
if (value.length && this.defaultDate)
if (value.length && this.defaultDate) {
this.repaint();
this.checkSize();
}
}
/**
@ -165,16 +185,28 @@ export default class Calendar extends Component {
* @param {Date} dated - Date of month
* @param {String} className - Default class style
*/
insertDay(dated, className = '') {
let event = this.events.find(event => {
insertDay(dated) {
let events = this.events.filter(event => {
return event.dated >= dated && event.dated <= dated;
});
// Weeekends
if (dated.getMonth() === this.currentMonth.getMonth() && dated.getDay() == 0)
className = 'red';
const params = {dated, events};
this.days.push({dated, className, event});
const isSaturday = dated.getDay() === 6;
const isSunday = dated.getDay() === 0;
const isCurrentMonth = dated.getMonth() === this.currentMonth.getMonth();
const hasEvents = events.length > 0;
if (isCurrentMonth && isSunday && !hasEvents)
params.style = {color: '#f42121'};
if (isCurrentMonth && isSaturday && !hasEvents)
params.style = {color: '#666666'};
if (!isCurrentMonth && !hasEvents)
params.style = {color: '#9b9b9b'};
this.days.push(params);
}
/**
@ -182,7 +214,7 @@ export default class Calendar extends Component {
*
* @param {Object} options - Event params
* @param {Date} options.dated - Day to add event
* @param {String} options.title - Tooltip description
* @param {String} options.name - Tooltip description
* @param {String} options.className - ClassName style
* @param {Object} options.style - Style properties
* @param {Boolean} options.isRemovable - True if is removable by users
@ -194,11 +226,6 @@ export default class Calendar extends Component {
options.dated = new Date(options.dated);
options.dated.setHours(0, 0, 0, 0);
const event = this.events.findIndex(event => {
return event.dated >= options.dated && event.dated <= options.dated;
});
if (event < 0)
this.events.push(options);
}
@ -252,6 +279,7 @@ export default class Calendar extends Component {
* @param {Integer} index - Index from days array
*/
select(index) {
if (this.disabled) return;
let day = this.days[index];
day.index = index;
@ -264,6 +292,8 @@ export default class Calendar extends Component {
* @param {Integer} weekday - weekday index
*/
selectAll(weekday) {
if (this.disabled) return;
let selected = [];
for (let i in this.days) {
const day = this.days[i];
@ -274,6 +304,16 @@ export default class Calendar extends Component {
}
this.emit('selection', {values: selected});
}
renderStyle(style) {
if (style) {
return {
'background-color': style.backgroundColor,
'font-weight': style.fontWeight,
'color': style.color
};
}
}
}
Calendar.$inject = ['$element', '$scope'];
@ -289,6 +329,7 @@ ngModule.component('vnCalendar', {
onMoveNext: '&?',
onMovePrevious: '&?',
displayControls: '<?',
disabled: '<?',
skip: '<?'
}
});

View File

@ -20,8 +20,8 @@ describe('Component vnCalendar', () => {
let currentDate = new Date().toString();
controller.data = [
{dated: currentDate, title: 'Event 1'},
{dated: currentDate, title: 'Event 2'},
{dated: currentDate, name: 'Event 1'},
{dated: currentDate, name: 'Event 2'},
];
expect(controller.events[0].dated instanceof Object).toBeTruthy();
@ -34,12 +34,11 @@ describe('Component vnCalendar', () => {
controller.events = [];
controller.addEvent({
dated: new Date(),
title: 'My event',
className: 'color'
name: 'My event'
});
const firstEvent = controller.events[0];
expect(firstEvent.title).toEqual('My event');
expect(firstEvent.name).toEqual('My event');
expect(firstEvent.isRemovable).toBeDefined();
expect(firstEvent.isRemovable).toBeTruthy();
});
@ -50,19 +49,17 @@ describe('Component vnCalendar', () => {
controller.events = [{
dated: curDate,
title: 'My event 1',
className: 'color'
name: 'My event 1'
}];
controller.addEvent({
dated: curDate,
title: 'My event 2',
className: 'color'
name: 'My event 2'
});
const firstEvent = controller.events[0];
expect(controller.events.length).toEqual(1);
expect(firstEvent.title).toEqual('My event 1');
expect(controller.events.length).toEqual(2);
expect(firstEvent.name).toEqual('My event 1');
});
});
@ -71,7 +68,7 @@ describe('Component vnCalendar', () => {
const curDate = new Date();
controller._events = [{
dated: curDate,
title: 'My event 1',
name: 'My event 1',
className: 'color'
}];
controller.removeEvent(curDate);

View File

@ -1,143 +1,123 @@
@import "variables";
vn-calendar.small {
.events {
display: none
}
}
vn-calendar {
display: block;
max-width: 250px;
.header vn-one {
text-align: center;
padding: 0.2em 0
padding: 0.2em 0;
height: 1.5em
}
.weekdays {
color: $color-font-secondary;
margin-bottom: 0.5em;
padding: 0.5em 0;
font-weight: bold;
font-size: 0.8em;
}
.weekdays section {
cursor: pointer
}
.weekdays section, .day {
position: relative;
text-align: center;
box-sizing: border-box;
width: 14.28%;
outline: 0;
}
.body {
.days {
justify-content: flex-start;
align-items: flex-start;
flex-wrap: wrap;
}
.weekdays {
border-bottom: 1px solid $color-hover-cd;
border-top: 1px solid $color-hover-cd;
color: $color-font-secondary;
font-weight: bold
}
.day {
box-sizing: border-box;
padding: 0.1em;
width: 14.2857143%;
line-height: 1.5em;
outline: 0;
.content {
position: absolute;
bottom: 0;
right: 0;
left: 0;
top: 0
}
span {
.day-number {
transition: background-color 0.3s;
text-align:center;
font-size: .8em;
float:inline-end;
margin: 0 auto;
border-radius: 50%;
display: block;
padding: 0.2em;
cursor: pointer
font-size: 0.85em;
width:2.2em;
height: 1.2em;
padding: 0.5em 0;
cursor: pointer;
outline: 0
}
.day-number:hover {
background-color: lighten($color-font-secondary, 20%);
opacity: 0.8
}
}
.day:hover span {
background-color: #DDD
.day::after {
content: "";
display: block;
padding-top: 100%;
}
.day.primary .day-number {
background-color: $color-main;
color: $color-font-bg;
}
.events {
margin-top: 0.5em;
font-size: 0.6em
}
.events {
color: $color-font-secondary;
.event {
margin-bottom: .1em;
}
}
.chip {
background-color: $color-main;
color: $color-font-bg;
display: inline-block;
border-radius: .3em;
padding: 0.3em .8em;
max-width: 5em;
}
.day.gray {
.day-number {
color: $color-font-secondary
}
.day.orange {
font-weight: bold;
color: $color-main;
}
.day.orange-circle {
color: $color-font;
& > span {
background-color: $color-main
}
}
.day.orange-circle:hover {
& > span {
background-color: $color-main-medium
}
}
.day.light-orange {
color: $color-main-medium
}
.day.green {
font-weight: bold;
color: $color-success;
}
.day.green-circle {
color: $color-font;
& > span {
background-color: $color-success
}
}
.day.green-circle:hover {
& > span {
background-color: $color-success-medium
}
}
.day.light-green {
font-weight: bold;
color: $color-success-medium
}
.day.blue {
font-weight: bold;
color: $color-notice;
}
.day.blue-circle {
color: $color-font;
& > span {
background-color: $color-notice
}
}
.day.blue-circle:hover {
& > span {
background-color: $color-notice-medium
}
}
.day.light-blue {
font-weight: bold;
color: $color-notice-medium
}
.day.red {
font-weight: bold;
color: $color-alert
}
.day.red-circle {
color: $color-font;
& > span {
background-color: $color-alert
}
}
.day.red-circle:hover {
& > span {
background-color: $color-alert-medium
}
}
.day.light-red {
font-weight: bold;
color: $color-alert-medium;
.day.sunday {
.day-number {
color: $color-alert;
font-weight: bold
}
}
}

View File

@ -4,7 +4,7 @@
ng-disabled="::$ctrl.disabled"
ng-checked="$ctrl.isChecked"
ng-model="$ctrl.model">
<span translate>{{::$ctrl.label}}</span>
<span translate ng-if="::$ctrl.label">{{::$ctrl.label}}</span>
</md-checkbox>
<i class="material-icons"
ng-if="::$ctrl.hasInfo"

View File

@ -16,6 +16,10 @@ vn-check {
}
md-checkbox {
margin-bottom: 0.8em
margin-bottom: 0.8em;
.md-label:empty {
margin: 0
}
}
}

View File

@ -45,8 +45,7 @@ export default class Dialog extends Component {
this.element.style.display = 'flex';
this.transitionTimeout = setTimeout(() => this.$element.addClass('shown'), 30);
if (this.onOpen)
this.onOpen();
this.emit('open');
}
/**
@ -55,6 +54,7 @@ export default class Dialog extends Component {
hide() {
this.fireResponse();
this.realHide();
this.emit('close');
}
/**
@ -120,7 +120,6 @@ ngModule.component('vnDialog', {
buttons: '?tplButtons'
},
bindings: {
onOpen: '&?',
onResponse: '&?'
},
controller: Dialog

View File

@ -7,7 +7,7 @@ describe('Component vnDialog', () => {
beforeEach(angular.mock.inject($componentController => {
$element = angular.element('<vn-dialog></vn-dialog>');
controller = $componentController('vnDialog', {$element, $transclude: null});
controller.onOpen = jasmine.createSpy('onOpen');
controller.emit = jasmine.createSpy('emit');
}));
describe('show()', () => {
@ -17,15 +17,15 @@ describe('Component vnDialog', () => {
controller.show();
expect(controller.element.style.display).toEqual('none');
expect(controller.onOpen).not.toHaveBeenCalledWith();
expect(controller.emit).not.toHaveBeenCalledWith('open');
});
it(`should set shown on the controller, set style.display on the element and call onOpen()`, () => {
it(`should set shown on the controller, set style.display on the element and emit onOpen() event`, () => {
controller.show();
expect(controller.element.style.display).toEqual('flex');
expect(controller.shown).toBeTruthy();
expect(controller.onOpen).toHaveBeenCalledWith();
expect(controller.emit).toHaveBeenCalledWith('open');
});
});

View File

@ -20,7 +20,7 @@ import './multi-check/multi-check';
import './date-picker/date-picker';
import './button/button';
import './check/check';
import './radio/radio';
import './radio-group/radio-group';
import './textarea/textarea';
import './icon-button/icon-button';
import './submit/submit';

View File

@ -22,7 +22,10 @@
ng-focus="$ctrl.hasFocus = true"
ng-blur="$ctrl.hasFocus = false"
tabindex="{{$ctrl.input.tabindex}}"/>
<label class="label" translate>{{::$ctrl.label}}</label>
<label class="label">
<span translate>{{::$ctrl.label}}</span>
<span translate ng-show="::$ctrl.required">*</span>
</label>
</div>
<div class="underline"></div>
<div class="selected underline"></div>

View File

@ -192,6 +192,7 @@ ngModule.component('vnInputNumber', {
label: '@?',
name: '@?',
disabled: '<?',
required: '@?',
min: '<?',
max: '<?',
step: '<?',

View File

@ -1,9 +1,5 @@
vn-multi-check {
md-checkbox {
margin-bottom: 0.8em;
.md-label {
margin: 0
}
margin-bottom: 0.8em
}
}

View File

@ -0,0 +1,8 @@
<md-radio-group ng-model="$ctrl.model">
<md-radio-button aria-label="::option.label"
ng-repeat="option in $ctrl.options"
ng-value="option.value"
ng-disabled="$ctrl.disabled">
<span translate>{{::option.label}}</span>
</md-radio-button>
</md-radio-group>

View File

@ -0,0 +1,41 @@
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.hasInfo = Boolean($attrs.info);
this.info = $attrs.info || null;
}
get model() {
return this._model;
}
set model(value) {
this._model = value;
}
get field() {
return this._model;
}
set field(value) {
this._model = value;
}
}
Controller.$inject = ['$element', '$scope', '$attrs'];
ngModule.component('vnRadioGroup', {
template: require('./radio-group.html'),
controller: Controller,
bindings: {
field: '=?',
options: '<?',
disabled: '<?',
checked: '<?'
}
});

View File

@ -0,0 +1,11 @@
@import "variables";
md-radio-group md-radio-button.md-checked .md-container {
.md-on {
background-color: $color-main
}
.md-off {
border-color: $color-main
}
}

View File

@ -1,7 +0,0 @@
<input
type="radio"
class="*[className]*"
name="*[name]*"
ng-model="*[model]*.*[name]*"
*[enabled]*>
<span class="mdl-radio__label" translate>*[text]*</span>

View File

@ -1,15 +0,0 @@
import ngModule from '../../module';
import template from './radio.html';
directive.$inject = ['vnTemplate'];
export default function directive(vnTemplate) {
return {
restrict: 'E',
template: (_, $attrs) =>
vnTemplate.get(template, $attrs, {
enabled: 'true',
className: 'mdl-radio mdl-js-radio mdl-js-ripple-effect'
})
};
}
ngModule.directive('vnRadio', directive);

View File

@ -1,7 +1,9 @@
import ngModule from '../../module';
import Input from '../../lib/input';
export default class Controller {
constructor($element) {
export default class Controller extends Input {
constructor($element, $scope) {
super($element, $scope);
this.$element = $element;
this.input = $element[0].querySelector('input');
}
@ -11,7 +13,7 @@ export default class Controller {
}
}
Controller.$inject = ['$element'];
Controller.$inject = ['$element', '$scope'];
ngModule.component('vnSubmit', {
template: require('./submit.html'),

View File

@ -63,6 +63,10 @@ vn-table {
padding-bottom: .8em;
}
& > vn-th,
& > vn-td {
overflow: hidden;
}
& > vn-th,
& > vn-td,
& > vn-td-editable {
vertical-align: middle;
@ -70,7 +74,6 @@ vn-table {
text-align: left;
padding: .6em .5em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 5em;
@ -157,7 +160,7 @@ vn-table {
}
vn-autocomplete {
div.mdl-textfield {
padding: 0px !important;
padding: 0 !important;
}
label.mdl-textfield__label:after {
bottom: 0;

View File

@ -1,43 +1,71 @@
import ngModule from '../../module';
import Component from '../../lib/component';
import {focus} from '../../directives/focus';
import Input from '../../lib/input';
import './style.scss';
export default class Controller extends Component {
constructor($element, $scope, $transclude, $timeout) {
super($element, $scope);
this.$timeout = $timeout;
let element = $element[0];
element.tabIndex = 0;
this.element.tabIndex = 0;
element.addEventListener('focus', () => {
this.element.addEventListener('focus', () => {
if (this.field || this.disabled) return;
$transclude((tClone, tScope) => {
this.field = tClone;
this.tScope = tScope;
this.element.querySelector('.field').appendChild(this.field[0]);
element.tabIndex = -1;
this.element.tabIndex = -1;
}, null, 'field');
element.classList.add('selected');
this.element.classList.add('selected');
});
element.addEventListener('focusout', event => {
if (!this.field || this.disabled) return;
// this.destroyTimer();
this.element.addEventListener('focusout', event => this.hideField(event));
this.element.addEventListener('keyup', event => {
if (event.key === 'Enter')
this.hideField(event);
});
this.element.addEventListener('click', event => {
if (this.disabled) return;
let target = event.target;
while (target) {
if (target == this.field[0]) return;
target = target.parentNode;
}
let inputCtrl = this.field[0].firstElementChild.$ctrl;
if (inputCtrl instanceof Input) {
let evt = new MouseEvent('click', {
bubbles: true,
cancelable: true,
view: window
});
inputCtrl.input.dispatchEvent(evt);
}
});
}
hideField(event) {
if (!this.field || !this.tScope) return;
this.lastEvent = event;
let target = event.relatedTarget;
while (target && target != element)
while (target && target != this.element)
target = target.parentNode;
if (!target) {
this.tScope.$destroy();
this.tScope = null;
this.field.remove();
this.field = null;
element.classList.remove('selected');
element.tabIndex = 0;
this.element.classList.remove('selected');
this.element.tabIndex = 0;
}
});
}
destroyTimer() {
if (this.timer) {
this.$timeout.cancel(this.timer);
@ -48,6 +76,21 @@ export default class Controller extends Component {
$onDestroy() {
this.destroyTimer();
}
get disabled() {
return this._disabled;
}
set disabled(value) {
this._disabled = value;
const classList = this.element.classList;
if (value)
classList.add('disabled');
else
classList.remove('disabled');
}
}
Controller.$inject = ['$element', '$scope', '$transclude', '$timeout'];

View File

@ -1,11 +1,21 @@
@import "variables";
vn-td-editable {
text {
border-bottom: 1px solid rgba(0,0,0,.12);
min-height: 15px;
cursor: pointer;
display: block
outline: none;
position: relative;
overflow: visible;
text {
border: 1px dashed rgba(0, 0, 0, .15);
border-radius: 1em;
padding: 5px 10px;
min-height: 15px;
display: block;
overflow: hidden;
&:hover {
border-color: $color-main;
}
}
text::after {
@ -13,25 +23,17 @@ vn-td-editable {
content: '';
clear: both;
}
outline: none;
position: relative;
&:not([disabled="true"]) {
cursor: initial
}
&[disabled="true"] {
cursor: not-allowed;
}
&.selected > .text {
visibility: hidden;
}
& > .field {
display: none;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
position: absolute;
z-index:10;
top: 0;
left: 0;
box-sizing: border-box;
align-items: center;
padding: .6em;
@ -55,3 +57,10 @@ vn-td-editable {
display: flex;
}
}
vn-td-editable.disabled {
cursor: initial;
}
vn-td-editable.disabled text {
border: none;
}

View File

@ -16,7 +16,7 @@
tabindex="{{$ctrl.input.tabindex}}"/>
<label class="label">
<span translate>{{::$ctrl.label}}</span>
<span translate ng-show="::$ctrl.required">(*)</span>
<span translate vn-tooltip="Required" ng-show="::$ctrl.required">*</span>
</label>
</div>
<div class="underline"></div>

View File

@ -36,19 +36,24 @@ function vnAcl(aclService, $timeout) {
return conditions;
}
function permissionElement($scope, $element, action) {
function permissionElement($element, action) {
if (!aclService.hasAny(acls)) {
if (action === 'disabled') {
let input = $element[0];
let element = $element[0];
let selector = 'input, textarea, button, submit, md-checkbox';
if (!input.matches(selector))
input = input.querySelector(selector);
if (element.$ctrl) {
element.setAttribute('disabled', 'true');
element.$ctrl.disabled = true;
}
if (input) {
if (!element.matches(selector))
element = element.querySelector(selector);
if (element) {
$timeout(() => {
input.setAttribute('disabled', 'true');
updateMaterial(input);
element.setAttribute('disabled', 'true');
updateMaterial(element);
});
$element[0].querySelectorAll('vn-drop-down').forEach(element => {
element.parentNode.removeChild(element);
@ -78,7 +83,7 @@ function vnAcl(aclService, $timeout) {
let action = $attrs.vnAclAction || 'disabled';
let conditions = getDynamicConditions($attrs);
permissionElement($scope, $element, action);
permissionElement($element, action);
if (Object.keys(conditions).length) {
let watchConditions = $scope.$watch(() => {
@ -86,7 +91,7 @@ function vnAcl(aclService, $timeout) {
let hasPermission = $scope.$eval($attrs[attrName]);
if (!hasPermission) {
updateAcls(conditions[attrName].role, hasPermission);
permissionElement($scope, $element, action);
permissionElement($element, action);
delete conditions[attrName];
}
});

View File

@ -1,13 +1,20 @@
import ngModule from '../module';
export function focus(input) {
const element = input;
let selector = 'input, textarea, button, submit';
if (!input.matches(selector))
input = input.querySelector(selector);
if (!input) {
console.warn(`vnFocus: Can't find a focusable element`);
const focusEvent = new MouseEvent('focus', {
bubbles: true,
cancelable: true,
view: window
});
element.dispatchEvent(focusEvent);
return;
}

View File

@ -0,0 +1,29 @@
import ngModule from '../module';
/**
* Disables a clicked element while request is being processed
* Enables again when promise ends
*
* @param {Object} $parse
* @return {Object} The directive
*/
export function directive($parse) {
return {
restrict: 'A',
link: function($scope, $element, $attrs) {
const cb = $parse($attrs.vnHttpClick);
const element = $element[0];
$element.on('click', () => {
element.$ctrl.disabled = true;
cb($scope).finally(() => {
element.$ctrl.disabled = false;
});
});
}
};
}
directive.$inject = ['$parse'];
ngModule.directive('vnHttpClick', directive);

View File

@ -0,0 +1,37 @@
import ngModule from '../module';
/**
* Disables a submitted form while request is being processed
* Enables again when promise ends
*
* @param {Object} $parse
* @return {Object} The directive
*/
export function directive($parse) {
return {
restrict: 'A',
link: function($scope, $element, $attrs) {
const cb = $parse($attrs.vnHttpSubmit);
const element = $element[0];
$element.on('submit', () => {
const selector = 'vn-textfield, vn-autocomplete, vn-submit';
const elements = element.querySelectorAll(selector);
const fields = angular.element(elements);
angular.forEach(fields, field => {
field.$ctrl.disabled = true;
});
cb($scope).finally(() => {
angular.forEach(fields, field => {
field.$ctrl.disabled = false;
});
});
});
}
};
}
directive.$inject = ['$parse'];
ngModule.directive('vnHttpSubmit', directive);

Some files were not shown because too many files have changed in this diff Show More