diff --git a/back/models/buyer.json b/back/models/buyer.json
index a1297eda3..a17d3b538 100644
--- a/back/models/buyer.json
+++ b/back/models/buyer.json
@@ -15,9 +15,6 @@
"nickname": {
"type": "string",
"required": true
- },
- "display": {
- "type": "boolean"
}
},
"acls": [
diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql
index ffbc6a864..58a4dc9f1 100644
--- a/db/dump/fixtures.before.sql
+++ b/db/dump/fixtures.before.sql
@@ -179,12 +179,12 @@ INSERT INTO `vn`.`country`(`id`, `name`, `isUeeMember`, `code`, `currencyFk`, `i
(30,'Canarias', 1, 'IC', 1, 24, 4, 1, 2);
INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory`, `hasAvailable`, `isManaged`, `hasDms`, `hasComission`, `countryFk`, `hasProduction`, `isOrigin`, `isDestiny`)
- VALUES (1, 'Warehouse One', 'ALG', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
+ VALUES
+ (1, 'Warehouse One', 'ALG', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
(2, 'Warehouse Two', NULL, 1, 1, 1, 1, 0, 1, 13, 1, 1, 0),
(3, 'Warehouse Three', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0),
(4, 'Warehouse Four', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1),
(5, 'Warehouse Five', NULL, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0),
- (6, 'Warehouse six', 'VNH', 1, 1, 1, 1, 0, 0, 1, 1, 0, 0),
(13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 1, 0, 0, 0),
(60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0);
@@ -1544,7 +1544,7 @@ INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `sal
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '186', '0', '51', '53.12', '56.20', '56.20', '56.20'),
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '277', '0', '53.12', '56.20', '56.20', '56.20', '56.20');
-INSERT INTO vn.buy(id,entryFk,itemFk,buyingValue,quantity,packagingFk,stickers,freightValue,packageValue,comissionValue,packing,grouping,groupingMode,location,price1,price2,price3,printedStickers,isChecked,isIgnored,weight,created)
+ INSERT INTO vn.buy(id,entryFk,itemFk,buyingValue,quantity,packagingFk,stickers,freightValue,packageValue,comissionValue,packing,grouping,groupingMode,location,price1,price2,price3,printedStickers,isChecked,isIgnored,weight,created)
VALUES
(1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 2 MONTH),
(2, 2, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 1 MONTH),
@@ -1560,7 +1560,7 @@ INSERT INTO vn.buy(id,entryFk,itemFk,buyingValue,quantity,packagingFk,stickers,f
(12, 6, 4, 1.25, 0, 3, 1, 2.500, 2.500, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()),
(13, 7, 1, 50, 0, 3, 1, 2.000, 2.000, 0.000, 1, 1, 'packing', NULL, 0.00, 99.6, 99.4, 0, 1, 0, 4, util.VN_CURDATE()),
(14, 7, 2, 5, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 7.30, 7.00, 0, 1, 0, 4, util.VN_CURDATE()),
- (15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()),
+ (15, 7, 4, 1.25, 0, 3, 1, 2.000, 2.000, 0.000, 10, 10, 'grouping', NULL, 0.00, 1.75, 1.67, 0, 1, 0, 4, util.VN_CURDATE()),
(16, 99,1,50.0000, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 'packing', NULL, 0.00, 99.60, 99.40, 0, 1, 0, 1.00, '2024-07-30 08:13:51.000');
INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`,`total`, `date_make`, `first_row_stamp`, `confirm_date`)
@@ -2442,30 +2442,32 @@ INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`, `
(1107, CONCAT(util.VN_CURDATE(), ' 10:20'), TRUE, 'middle', 1),
(1107, CONCAT(util.VN_CURDATE(), ' 14:50'), TRUE, 'out', 1);
-INSERT INTO `vn`.`dmsType`(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
+INSERT INTO `vn`.`dmsType`
+ (`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
VALUES
- (1, 'Facturas Recibidas', NULL, NULL, 'invoiceIn'),
- (2, 'Doc oficial', NULL, NULL, 'officialDoc'),
- (3, 'Laboral', 37, 37, 'hhrrData'),
- (4, 'Albaranes recibidos', NULL, NULL, 'deliveryNote'),
- (5, 'Otros', 1, 1, 'miscellaneous'),
- (6, 'Pruebas', NULL, NULL, 'tests'),
- (7, 'IAE Clientes', 1, 1, 'economicActivitiesTax'),
- (8, 'Fiscal', NULL, NULL, 'fiscal'),
- (9, 'Vehiculos', NULL, NULL, 'vehicles'),
- (10, 'Plantillas', NULL, NULL, 'templates'),
- (11, 'Contratos', NULL, NULL, 'contracts'),
- (12, 'ley de pagos', 1, 1, 'paymentsLaw'),
- (13, 'Basura', 1, 1, 'trash'),
- (14, 'Ticket', 1, 1, 'ticket'),
- (15, 'Presupuestos', NULL, NULL, 'budgets'),
- (16, 'Logistica', NULL, NULL, 'logistics'),
- (17, 'cmr', 1, 1, 'cmr'),
- (18, 'dua', NULL, NULL, 'dua'),
- (19, 'inmovilizado', NULL, NULL, 'fixedAssets'),
- (20, 'Reclamación', 1, 1, 'claim'),
- (21, 'Entrada', 1, 1, 'entry'),
- (22, 'Proveedor', 1, 1, 'supplier');
+ (1, 'Facturas Recibidas', NULL, NULL, 'invoiceIn'),
+ (2, 'Doc oficial', NULL, NULL, 'officialDoc'),
+ (3, 'Laboral', 37, 37, 'hhrrData'),
+ (4, 'Albaranes recibidos', NULL, NULL, 'deliveryNote'),
+ (5, 'Otros', 1, 1, 'miscellaneous'),
+ (6, 'Pruebas', NULL, NULL, 'tests'),
+ (7, 'IAE Clientes', 1, 1, 'economicActivitiesTax'),
+ (8, 'Fiscal', NULL, NULL, 'fiscal'),
+ (9, 'Vehiculos', NULL, NULL, 'vehicles'),
+ (10, 'Plantillas', NULL, NULL, 'templates'),
+ (11, 'Contratos', NULL, NULL, 'contracts'),
+ (12, 'ley de pagos', 1, 1, 'paymentsLaw'),
+ (13, 'Basura', 1, 1, 'trash'),
+ (14, 'Ticket', 1, 1, 'ticket'),
+ (15, 'Presupuestos', NULL, NULL, 'budgets'),
+ (16, 'Logistica', NULL, NULL, 'logistics'),
+ (17, 'cmr', 1, 1, 'cmr'),
+ (18, 'dua', NULL, NULL, 'dua'),
+ (19, 'inmovilizado', NULL, NULL, 'fixedAssets'),
+ (20, 'Reclamación', 1, 1, 'claim'),
+ (21, 'Entrada', 1, 1, 'entry'),
+ (22, 'Proveedor', 1, 1, 'supplier'),
+ (23, 'Termografos', 35, 35, 'thermograph');
INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`)
VALUES
@@ -2473,7 +2475,7 @@ INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `wa
(2, 5, '2.txt', 'text/plain', 5, 1, 442, 1, TRUE, 'Client:104', 'Client:104 dms for the client', util.VN_CURDATE()),
(3, 5, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Client: 104', 'Client:104 readme', util.VN_CURDATE()),
(4, 3, '4.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Worker: 106', 'Worker:106 readme', util.VN_CURDATE()),
- (5, 5, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', util.VN_CURDATE()),
+ (5, 23, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', util.VN_CURDATE()),
(6, 5, '6.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'NotExists', 'DoesNotExists', util.VN_CURDATE()),
(7, 20, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()),
(8, 20, '8.mp4', 'video/mp4', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()),
@@ -3188,7 +3190,7 @@ UPDATE vn.department
SET workerFk = null;
INSERT INTO vn.packaging
- VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0,0);
+ VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0,0,1);
INSERT IGNORE INTO vn.intrastat
@@ -3939,37 +3941,43 @@ INSERT INTO vn.medicalReview
(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
VALUES(3, 9, 2, '2000-01-01', '8:00', 1, 150.0, NULL, NULL);
-INSERT INTO vn.stockBought (workerFk, bought, reserve, dated)
- VALUES(35, 1.00, 1.00, '2001-01-01');
-
-INSERT INTO vn.auctionConfig (id,conversionCoefficient,warehouseFk)
- VALUES (1,0.6,6);
-
-INSERT INTO vn.payrollComponent (id, name, isSalaryAgreed, isVariable, isException)
- VALUES (1, 'Salario1', 1, 0, 0),
+INSERT INTO vn.payrollComponent
+(id, name, isSalaryAgreed, isVariable, isException)
+ VALUES
+ (1, 'Salario1', 1, 0, 0),
(2, 'Salario2', 1, 1, 0),
(3, 'Salario3', 1, 0, 1);
-INSERT INTO vn.workerIncome (debit, credit, incomeTypeFk, paymentDate, workerFk, concept)
- VALUES (1000.00, 900.00, 2, '2000-01-01', 1106, NULL),
+
+INSERT INTO vn.workerIncome
+(debit, credit, incomeTypeFk, paymentDate, workerFk, concept)
+ VALUES
+ (1000.00, 900.00, 2, '2000-01-01', 1106, NULL),
(1001.00, 800.00, 2, '2000-01-01', 1106, NULL);
-INSERT INTO dipole.printer (id, description) VALUES(1, '');
-INSERT INTO dipole.expedition_PrintOut (expeditionFk, ticketFk, addressFk, street, postalCode, city, shopName, isPrinted, created, printerFk, routeFk, parkingCode, truckName, clientFk, phone, province, agency, m3, workerCode, itemFk, quantity, longName, shelvingFk, comments)
- VALUES(1, 1, 0, ' ', ' ', ' ', ' ', 0, '2001-01-01 00:00:00', 1, 0, ' ', ' ', 0, NULL, '', NULL, 0.000, NULL, 10, NULL, NULL, 'NCC', NULL);
+INSERT INTO dipole.printer (id, description)
+VALUES(1, '');
-INSERT INTO vn.accountDetail (id, value, accountDetailTypeFk, supplierAccountFk)
- VALUES (21, 'ES12345B12345678', 3, 241),
- (35, 'ES12346B12345679', 3, 241);
+INSERT INTO dipole.expedition_PrintOut (expeditionFk, ticketFk, addressFk, street, postalCode, city, shopName, isPrinted, created, printerFk, routeFk, parkingCode,
+truckName, clientFk, phone, province, agency, m3, workerCode, itemFk, quantity, longName, shelvingFk, comments)
+VALUES(1, 1, 0, ' ', ' ', ' ', ' ', 0, '2001-01-01 00:00:00', 1, 0, ' ', ' ', 0, NULL, '', NULL, 0.000, NULL, 10, NULL, NULL, 'NCC', NULL);
-INSERT INTO vn.accountDetailType (id, description, code)
- VALUES (1, 'IBAN', 'iban'),
- (2, 'SWIFT', 'swift'),
- (3, 'Referencia Remesas', 'remRef'),
- (4, 'Referencia Transferencias', 'trnRef'),
- (5, 'Referencia Nominas', 'payRef'),
- (6, 'ABA', 'aba');
+INSERT INTO vn.accountDetail
+(id, value, accountDetailTypeFk, supplierAccountFk)
+VALUES
+ (21, 'ES12345B12345678', 3, 241),
+ (35, 'ES12346B12345679', 3, 241);
+
+INSERT INTO vn.accountDetailType
+(id, description, code)
+VALUES
+ (1, 'IBAN', 'iban'),
+ (2, 'SWIFT', 'swift'),
+ (3, 'Referencia Remesas', 'remRef'),
+ (4, 'Referencia Transferencias', 'trnRef'),
+ (5, 'Referencia Nominas', 'payRef'),
+ (6, 'ABA', 'aba');
INSERT IGNORE INTO ormConfig
SET id =1,
diff --git a/db/routines/vn/events/travel_setDelivered.sql b/db/routines/vn/events/travel_setDelivered.sql
index 769ee9d24..396f3e144 100644
--- a/db/routines/vn/events/travel_setDelivered.sql
+++ b/db/routines/vn/events/travel_setDelivered.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`travel_setDelivered`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`travel_setDelivered`
ON SCHEDULE EVERY 1 DAY
STARTS '2024-07-12 00:10:00.000'
ON COMPLETION PRESERVE
diff --git a/db/routines/vn/procedures/buy_getUltimate.sql b/db/routines/vn/procedures/buy_getUltimate.sql
index 023e81774..1532222ad 100644
--- a/db/routines/vn/procedures/buy_getUltimate.sql
+++ b/db/routines/vn/procedures/buy_getUltimate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_getUltimate`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getUltimate`(
vItemFk INT,
vWarehouseFk SMALLINT,
vDated DATE
diff --git a/db/routines/vn/procedures/buy_getUltimateFromInterval.sql b/db/routines/vn/procedures/buy_getUltimateFromInterval.sql
index 2115beb95..24a843eb0 100644
--- a/db/routines/vn/procedures/buy_getUltimateFromInterval.sql
+++ b/db/routines/vn/procedures/buy_getUltimateFromInterval.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_getUltimateFromInterval`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getUltimateFromInterval`(
vItemFk INT,
vWarehouseFk SMALLINT,
vStarted DATE,
diff --git a/db/routines/vn/procedures/catalog_componentCalculate.sql b/db/routines/vn/procedures/catalog_componentCalculate.sql
index d4ce88ca7..e29e13a8c 100644
--- a/db/routines/vn/procedures/catalog_componentCalculate.sql
+++ b/db/routines/vn/procedures/catalog_componentCalculate.sql
@@ -29,21 +29,24 @@ BEGIN
(INDEX (itemFk))
ENGINE = MEMORY
SELECT i.id itemFk,
- SUM(IFNULL(pd.absIncreasing,0)) absIncreasing,
- SUM(IFNULL(pd.ratIncreasing,0)) ratIncreasing,
- pd.warehouseFk
- FROM item i
- JOIN priceDelta pd
- ON pd.itemTypeFk = i.typeFk
- AND (pd.minSize IS NULL OR pd.minSize <= i.`size`)
- AND (pd.maxSize IS NULL OR pd.maxSize >= i.`size`)
- AND (pd.inkFk IS NULL OR pd.inkFk = i.inkFk)
- AND (pd.originFk IS NULL OR pd.originFk = i.originFk)
- AND (pd.producerFk IS NULL OR pd.producerFk = i.producerFk)
- AND (pd.warehouseFk IS NULL OR pd.warehouseFk = vWarehouseFk)
- WHERE (pd.fromDated IS NULL OR pd.fromDated <= vShipped)
- AND (pd.toDated IS NULL OR pd.toDated >= vShipped)
- GROUP BY i.id;
+ SUM(IFNULL(pd.absIncreasing,0)) absIncreasing,
+ SUM(IFNULL(pd.ratIncreasing,0)) ratIncreasing,
+ pd.warehouseFk
+ FROM item i
+ JOIN priceDelta pd
+ ON pd.itemTypeFk = i.typeFk
+ AND (pd.minSize IS NULL OR pd.minSize <= i.`size`)
+ AND (pd.maxSize IS NULL OR pd.maxSize >= i.`size`)
+ AND (pd.inkFk IS NULL OR pd.inkFk = i.inkFk)
+ AND (pd.originFk IS NULL OR pd.originFk = i.originFk)
+ AND (pd.producerFk IS NULL OR pd.producerFk = i.producerFk)
+ AND (pd.warehouseFk IS NULL OR pd.warehouseFk = vWarehouseFk)
+ LEFT JOIN zoneGeo zg ON zg.id = pd.zoneGeoFk
+ LEFT JOIN zoneGeo zg2 ON zg2.id = address_getGeo(vAddressFk)
+ WHERE (pd.fromDated IS NULL OR pd.fromDated <= vShipped)
+ AND (pd.toDated IS NULL OR pd.toDated >= vShipped)
+ AND (pd.zoneGeoFk IS NULL OR zg2.lft BETWEEN zg.lft AND zg.rgt)
+ GROUP BY itemFk;
CREATE OR REPLACE TEMPORARY TABLE tSpecialPrice
(INDEX (itemFk))
@@ -130,15 +133,15 @@ BEGIN
-- Bonus del comprador a un rango de productos
INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost)
- SELECT
+ SELECT
tcb.warehouseFk,
tcb.itemFk,
c.id,
IFNULL(tcb.base * tpd.ratIncreasing / 100,0) + IFNULL(tpd.absIncreasing,0)
FROM tmp.ticketComponentBase tcb
JOIN component c ON c.code = 'bonus'
- JOIN tPriceDelta tpd
- ON tpd.itemFk = tcb.itemFk
+ JOIN tPriceDelta tpd
+ ON tpd.itemFk = tcb.itemFk
AND tpd.warehouseFk = tcb.warehouseFk;
-- RECOBRO
diff --git a/db/routines/vn/procedures/clean.sql b/db/routines/vn/procedures/clean.sql
index a8ca68e5f..4a1f526fc 100644
--- a/db/routines/vn/procedures/clean.sql
+++ b/db/routines/vn/procedures/clean.sql
@@ -59,7 +59,7 @@ BEGIN
DELETE b FROM buy b
JOIN entryConfig e ON e.defaultEntry = b.entryFk
WHERE b.created < v2Months;
- DELETE FROM stockBuyed WHERE creationDate < v2Months;
+ DELETE FROM stockBought WHERE dated < v2Months;
DELETE FROM printQueue WHERE statusCode = 'printed' AND created < v2Months;
-- Equipos duplicados
DELETE w.*
diff --git a/db/routines/vn/procedures/collectionPlacement_get.sql b/db/routines/vn/procedures/collectionPlacement_get.sql
index d81847375..239dbd3a2 100644
--- a/db/routines/vn/procedures/collectionPlacement_get.sql
+++ b/db/routines/vn/procedures/collectionPlacement_get.sql
@@ -55,24 +55,20 @@ BEGIN
SELECT ts.saleFk,
ts.itemFk,
CAST(0 AS DECIMAL(10,0)) saleOrder,
- IF(ish.visible > 0 OR iss.id, 1, 100000) *
- IFNULL(p2.pickingOrder, p.pickingOrder) `order`,
- TO_SECONDS(IF(iss.id,
- iss.created - INTERVAL vCurrentYear YEAR,
- ish.created - INTERVAL YEAR(ish.created) YEAR)) priority,
+ (IF(ish.visible > 0 OR iss.id, 1, 100000) *
+ COALESCE(p2.pickingOrder, p.pickingOrder)) `order`,
+ TO_SECONDS(COALESCE(iss.created, ish.created)) - TO_SECONDS(MAKEDATE(IFNULL(YEAR(iss.created), YEAR(ish.created)), 1)) priority,
CONCAT(
- IF(iss.id,
- CONCAT('< ', IFNULL(wk.`code`, '---'),' > '),
- ''),
- p.`code`) COLLATE utf8_general_ci placement,
+ IF(iss.id, CONCAT('< ', COALESCE(wk.`code`, '---'),' > '), ''),
+ p.`code`
+ ) COLLATE utf8_general_ci placement,
sh.priority shelvingPriority,
sh.code COLLATE utf8_general_ci shelving,
ish.created,
ish.visible,
- IFNULL(
- IF(st.code = 'previousByPacking', ish.packing, g.`grouping`),
- 1) `grouping`,
- st.code = 'previousPrepared' isPreviousPrepared,
+ COALESCE(
+ IF(st.code = 'previousByPacking', ish.packing, g.`grouping`),1) `grouping`,
+ (st.code = 'previousPrepared') isPreviousPrepared,
iss.id itemShelvingSaleFk,
ts.ticketFk,
iss.id,
@@ -80,11 +76,12 @@ BEGIN
iss.userFk,
ts.quantity
FROM tSale ts
- LEFT JOIN (SELECT DISTINCT saleFk
- FROM saleTracking st
- JOIN state s ON s.id = st.stateFk
- WHERE st.isChecked
- AND s.semaphore = 1) st ON st.saleFk = ts.saleFk
+ LEFT JOIN (SELECT st.saleFk
+ FROM saleTracking st
+ JOIN state s ON s.id = st.stateFk
+ WHERE st.isChecked
+ AND s.semaphore = 1
+ GROUP BY st.saleFk) st ON st.saleFk = ts.saleFk
JOIN itemShelving ish ON ish.itemFk = ts.itemFk
JOIN shelving sh ON sh.code = ish.shelvingFk
JOIN parking p ON p.id = sh.parkingFk
@@ -93,14 +90,14 @@ BEGIN
JOIN warehouse w ON w.id = sc.warehouseFk
LEFT JOIN tGrouping g ON g.itemFk = ts.itemFk
LEFT JOIN itemShelvingSale iss ON iss.saleFk = ts.saleFk
- AND iss.itemShelvingFk = ish.id
+ AND iss.itemShelvingFk = ish.id
LEFT JOIN worker wk ON wk.id = iss.userFk
LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = ts.saleFk
LEFT JOIN saleGroup sg ON sg.id = sgd.saleGroupFk
LEFT JOIN parking p2 ON p2.id = sg.parkingFk
WHERE w.id = vWarehouseFk
- AND NOT sc.isHideForPickers
- HAVING (iss.id AND st.saleFk) OR salePreviousPrepared IS NULL;
+ AND NOT sc.isHideForPickers
+ AND ((iss.id AND st.saleFk) OR st.saleFk IS NULL);
CREATE OR REPLACE TEMPORARY TABLE tSalePlacementList2
(INDEX(saleFk), INDEX(olderPriority))
diff --git a/db/routines/vn/procedures/collection_getTickets.sql b/db/routines/vn/procedures/collection_getTickets.sql
index 0f675041a..4566792fa 100644
--- a/db/routines/vn/procedures/collection_getTickets.sql
+++ b/db/routines/vn/procedures/collection_getTickets.sql
@@ -23,7 +23,7 @@ BEGIN
JOIN vn.ticketCollection tc ON tc.ticketFk = tob.ticketFk
LEFT JOIN vn.observationType ot ON ot.id = tob.observationTypeFk
WHERE ot.`code` = 'itemPicker'
- AND tc.collectionFk = vParamFk
+ AND tc.collectionFk = vParamFk OR tc.ticketFk = vParamFk
)
SELECT t.id ticketFk,
IF(!(vItemPackingTypeFk <=> 'V'), cc.code, CONCAT(SUBSTRING('ABCDEFGH', tc.wagon, 1), '-', tc.`level`)) `level`,
diff --git a/db/routines/vn/procedures/collection_mergeSales.sql b/db/routines/vn/procedures/collection_mergeSales.sql
index 26444d6f9..297bdb97e 100644
--- a/db/routines/vn/procedures/collection_mergeSales.sql
+++ b/db/routines/vn/procedures/collection_mergeSales.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_mergeSales`(vCollectionFk INT)
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`collection_mergeSales`(vCollectionFk INT)
BEGIN
DECLARE vDone BOOL;
DECLARE vTicketFk INT;
diff --git a/db/routines/vn/procedures/collection_new.sql b/db/routines/vn/procedures/collection_new.sql
index 1f85aeebe..480a88f35 100644
--- a/db/routines/vn/procedures/collection_new.sql
+++ b/db/routines/vn/procedures/collection_new.sql
@@ -128,8 +128,9 @@ BEGIN
SELECT TRUE
FROM tmp.productionBuffer pb
JOIN state s ON s.id = pb.state
- WHERE s.code = 'PICKER_DESIGNED'
- AND pb.workerCode = vWorkerCode
+ WHERE (s.code = 'PICKER_DESIGNED'
+ AND pb.workerCode = vWorkerCode)
+ OR s.code = 'LAST_CALL'
) INTO vHasAssignedTickets;
-- Se dejan en la tabla tmp.productionBuffer sólo aquellos tickets adecuados
@@ -138,8 +139,9 @@ BEGIN
DELETE pb
FROM tmp.productionBuffer pb
JOIN state s ON s.id = pb.state
- WHERE s.code <> 'PICKER_DESIGNED'
- OR pb.workerCode <> vWorkerCode;
+ WHERE (s.code <> 'PICKER_DESIGNED'
+ OR pb.workerCode <> vWorkerCode)
+ AND s.code <> 'LAST_CALL';
ELSE
DELETE pb
FROM tmp.productionBuffer pb
diff --git a/db/routines/vn/procedures/itemMinimumQuantity_check.sql b/db/routines/vn/procedures/itemMinimumQuantity_check.sql
index fef7cdbdb..a4b15b90a 100644
--- a/db/routines/vn/procedures/itemMinimumQuantity_check.sql
+++ b/db/routines/vn/procedures/itemMinimumQuantity_check.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemMinimumQuantity_check`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemMinimumQuantity_check`(
vSelf INT,
vItemFk INT,
vStarted DATE,
diff --git a/db/routines/vn/procedures/itemShelvingSale_addBySaleGroup.sql b/db/routines/vn/procedures/itemShelvingSale_addBySaleGroup.sql
index 285b9f93f..08d09c63e 100644
--- a/db/routines/vn/procedures/itemShelvingSale_addBySaleGroup.sql
+++ b/db/routines/vn/procedures/itemShelvingSale_addBySaleGroup.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_addBySaleGroup`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingSale_addBySaleGroup`(
vSaleGroupFk INT(11)
)
BEGIN
diff --git a/db/routines/vn/procedures/item_getSimilar.sql b/db/routines/vn/procedures/item_getSimilar.sql
index b524e30a7..56afd92e9 100644
--- a/db/routines/vn/procedures/item_getSimilar.sql
+++ b/db/routines/vn/procedures/item_getSimilar.sql
@@ -1,10 +1,10 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_getSimilar`(
- vSelf INT,
- vWarehouseFk INT,
- vDated DATE,
- vShowType BOOL,
- vDaysInForward INT
+ vSelf INT,
+ vWarehouseFk INT,
+ vDated DATE,
+ vShowType BOOL,
+ vDaysInForward INT
)
BEGIN
/**
@@ -17,48 +17,48 @@ BEGIN
* @param vShowType Mostrar tipos
* @param vDaysInForward Días de alcance para las ventas
*/
- DECLARE vAvailableCalcFk INT;
- DECLARE vPriority INT DEFAULT 1;
+ DECLARE vAvailableCalcFk INT;
+ DECLARE vPriority INT DEFAULT 1;
- CALL cache.available_refresh(vAvailableCalcFk, FALSE, vWarehouseFk, vDated);
+ CALL cache.available_refresh(vAvailableCalcFk, FALSE, vWarehouseFk, vDated);
- WITH itemTags AS (
- SELECT i.id,
- typeFk,
- tag5,
- value5,
- tag6,
- value6,
- tag7,
- value7,
- tag8,
- value8,
- t.name,
- it.value
+ WITH itemTags AS (
+ SELECT i.id,
+ typeFk,
+ tag5,
+ value5,
+ tag6,
+ value6,
+ tag7,
+ value7,
+ tag8,
+ value8,
+ t.name,
+ it.value
FROM vn.item i
LEFT JOIN vn.itemTag it ON it.itemFk = i.id
AND it.priority = vPriority
LEFT JOIN vn.tag t ON t.id = it.tagFk
WHERE i.id = vSelf
- ),
- stock AS (
- SELECT itemFk, SUM(visible) stock
+ ),
+ stock AS (
+ SELECT itemFk, SUM(visible) stock
FROM vn.itemShelvingStock
WHERE warehouseFk = vWarehouseFk
GROUP BY itemFk
- ),
- sold AS (
- SELECT SUM(s.quantity) quantity, s.itemFk
+ ),
+ sold AS (
+ SELECT SUM(s.quantity) quantity, s.itemFk
FROM vn.sale s
JOIN vn.ticket t ON t.id = s.ticketFk
LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id
- WHERE t.shipped BETWEEN CURDATE() AND CURDATE() + INTERVAL vDaysInForward DAY
+ WHERE t.shipped >= CURDATE() + INTERVAL vDaysInForward DAY
AND iss.saleFk IS NULL
AND t.warehouseFk = vWarehouseFk
GROUP BY s.itemFk
- )
- SELECT i.id itemFk,
- CAST(sd.quantity AS INT) advanceable,
+ )
+ SELECT i.id itemFk,
+ LEAST(CAST(sd.quantity AS INT), sk.stock) advanceable,
i.longName,
i.subName,
i.tag5,
diff --git a/db/routines/vn/procedures/stockBought_calculate.sql b/db/routines/vn/procedures/stockBought_calculate.sql
index 0930a86de..8b2a32e5d 100644
--- a/db/routines/vn/procedures/stockBought_calculate.sql
+++ b/db/routines/vn/procedures/stockBought_calculate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`stockBought_calculate`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`stockBought_calculate`(
vDated DATE
)
proc: BEGIN
@@ -14,8 +14,8 @@ proc: BEGIN
END IF;
CREATE OR REPLACE TEMPORARY TABLE tStockBought
- SELECT workerFk, reserve
- FROM stockBought
+ SELECT workerFk, reserve
+ FROM stockBought
WHERE dated = vDated
AND reserve;
@@ -35,7 +35,7 @@ proc: BEGIN
LEFT JOIN tmp.item ti ON ti.itemFk = i.id
JOIN itemCategory ic ON ic.id = it.categoryFk
JOIN warehouse wh ON wh.code = 'VNH'
- JOIN tmp.buyUltimate bu ON bu.itemFk = i.id
+ JOIN tmp.buyUltimate bu ON bu.itemFk = i.id
AND bu.warehouseFk = wh.id
JOIN buy b ON b.id = bu.buyFk
JOIN volumeConfig vc
diff --git a/db/routines/vn/procedures/stockBuyedByWorker.sql b/db/routines/vn/procedures/stockBuyedByWorker.sql
deleted file mode 100644
index 13bda0133..000000000
--- a/db/routines/vn/procedures/stockBuyedByWorker.sql
+++ /dev/null
@@ -1,74 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`stockBuyedByWorker`(
- vDated DATE,
- vWorker INT
-)
-BEGIN
-/**
- * Inserta el volumen de compra de un comprador
- * en stockBuyed de acuerdo con la fecha.
- *
- * @param vDated Fecha de compra
- * @param vWorker Id de trabajador
- */
- CREATE OR REPLACE TEMPORARY TABLE tStockBuyed
- (INDEX (userFk))
- ENGINE = MEMORY
- SELECT requested, reserved, userFk
- FROM stockBuyed
- WHERE dated = vDated
- AND userFk = vWorker;
-
- DELETE FROM stockBuyed
- WHERE dated = vDated
- AND userFk = vWorker;
-
- CALL item_calculateStock(vDated);
-
- INSERT INTO stockBuyed(userFk, buyed, `dated`, reserved, requested, description)
- SELECT it.workerFk,
- SUM((ti.quantity / b.packing) * buy_getVolume(b.id)) / vc.palletM3 / 1000000,
- vDated,
- sb.reserved,
- sb.requested,
- u.name
- FROM itemType it
- JOIN item i ON i.typeFk = it.id
- LEFT JOIN tmp.item ti ON ti.itemFk = i.id
- JOIN itemCategory ic ON ic.id = it.categoryFk
- JOIN warehouse wh ON wh.code = 'VNH'
- JOIN tmp.buyUltimate bu ON bu.itemFk = i.id
- AND bu.warehouseFk = wh.id
- JOIN buy b ON b.id = bu.buyFk
- JOIN volumeConfig vc
- JOIN account.`user` u ON u.id = it.workerFk
- LEFT JOIN tStockBuyed sb ON sb.userFk = it.workerFk
- WHERE ic.display
- AND it.workerFk = vWorker;
-
- SELECT b.entryFk Id_Entrada,
- i.id Id_Article,
- i.name Article,
- ti.quantity Cantidad,
- (ac.conversionCoefficient * (ti.quantity / b.packing) * buy_getVolume(b.id))
- / (vc.trolleyM3 * 1000000) buyed,
- b.packagingFk id_cubo,
- b.packing
- FROM tmp.item ti
- JOIN item i ON i.id = ti.itemFk
- JOIN itemType it ON i.typeFk = it.id
- JOIN itemCategory ic ON ic.id = it.categoryFk
- JOIN worker w ON w.id = it.workerFk
- JOIN auctionConfig ac
- JOIN tmp.buyUltimate bu ON bu.itemFk = i.id
- AND bu.warehouseFk = ac.warehouseFk
- JOIN buy b ON b.id = bu.buyFk
- JOIN volumeConfig vc
- WHERE ic.display
- AND w.id = vWorker;
-
- DROP TEMPORARY TABLE tmp.buyUltimate,
- tmp.item,
- tStockBuyed;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/procedures/stockBuyed_add.sql b/db/routines/vn/procedures/stockBuyed_add.sql
deleted file mode 100644
index aab85e7fa..000000000
--- a/db/routines/vn/procedures/stockBuyed_add.sql
+++ /dev/null
@@ -1,70 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`stockBuyed_add`(
- vDated DATE
-)
-BEGIN
-/**
- * Inserta el volumen de compra por comprador
- * en stockBuyed de acuerdo con la fecha.
- *
- * @param vDated Fecha de compra
- */
- CREATE OR REPLACE TEMPORARY TABLE tStockBuyed
- (INDEX (userFk))
- ENGINE = MEMORY
- SELECT requested, reserved, userFk
- FROM stockBuyed
- WHERE dated = vDated;
-
- DELETE FROM stockBuyed WHERE dated = vDated;
-
- CALL item_calculateStock(vDated);
-
- INSERT INTO stockBuyed(userFk, buyed, `dated`, description)
- SELECT it.workerFk,
- SUM((ti.quantity / b.packing) * buy_getVolume(b.id)) / vc.palletM3 / 1000000,
- vDated,
- u.name
- FROM itemType it
- JOIN item i ON i.typeFk = it.id
- LEFT JOIN tmp.item ti ON ti.itemFk = i.id
- JOIN itemCategory ic ON ic.id = it.categoryFk
- JOIN warehouse wh ON wh.code = 'VNH'
- JOIN tmp.buyUltimate bu ON bu.itemFk = i.id AND bu.warehouseFk = wh.id
- JOIN buy b ON b.id = bu.buyFk
- JOIN volumeConfig vc
- JOIN account.`user` u ON u.id = it.workerFk
- JOIN workerDepartment wd ON wd.workerFk = u.id
- JOIN department d ON d.id = wd.departmentFk
- WHERE ic.display
- AND d.code IN ('shopping', 'logistic', 'franceTeam')
- GROUP BY it.workerFk;
-
- INSERT INTO stockBuyed(buyed, dated, description)
- SELECT SUM(ic.cm3 * ito.quantity / vc.palletM3 / 1000000),
- vDated,
- IF(c.code = 'ES', p.name, c.name) destiny
- FROM itemTicketOut ito
- JOIN ticket t ON t.id = ito.ticketFk
- JOIN `address` a ON a.id = t.addressFk
- JOIN province p ON p.id = a.provinceFk
- JOIN country c ON c.id = p.countryFk
- JOIN warehouse wh ON wh.id = t.warehouseFk
- JOIN itemCost ic ON ic.itemFk = ito.itemFk
- AND ic.warehouseFk = t.warehouseFk
- JOIN volumeConfig vc
- WHERE ito.shipped BETWEEN vDated AND util.dayend(vDated)
- AND wh.code = 'VNH'
- GROUP BY destiny;
-
- UPDATE stockBuyed s
- JOIN tStockBuyed ts ON ts.userFk = s.userFk
- SET s.requested = ts.requested,
- s.reserved = ts.reserved
- WHERE s.dated = vDated;
-
- DROP TEMPORARY TABLE tmp.buyUltimate,
- tmp.item,
- tStockBuyed;
-END$$
-DELIMITER ;
diff --git a/db/routines/vn/procedures/supplier_statementWithEntries.sql b/db/routines/vn/procedures/supplier_statementWithEntries.sql
index 55b271296..c0014f8e5 100644
--- a/db/routines/vn/procedures/supplier_statementWithEntries.sql
+++ b/db/routines/vn/procedures/supplier_statementWithEntries.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE vn.supplier_statementWithEntries(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE vn.supplier_statementWithEntries(
vSupplierFk INT,
vCurrencyFk INT,
vCompanyFk INT,
diff --git a/db/routines/vn/procedures/ticketRefund_upsert.sql b/db/routines/vn/procedures/ticketRefund_upsert.sql
new file mode 100644
index 000000000..fb22e6e8c
--- /dev/null
+++ b/db/routines/vn/procedures/ticketRefund_upsert.sql
@@ -0,0 +1,25 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketRefund_upsert`(
+ vRefundTicketFk INT,
+ vOriginalTicketFk INT
+)
+ READS SQL DATA
+BEGIN
+/**
+ * Common code for ticketRefund triggers
+ *
+ * @param vRefundTicketFk
+ * @param vOriginalTicketFk
+ */
+ DECLARE vIsDeleted BOOL;
+
+ SELECT COUNT(*) INTO vIsDeleted
+ FROM ticket
+ WHERE id IN (vRefundTicketFk, vOriginalTicketFk)
+ AND isDeleted;
+
+ IF vIsDeleted THEN
+ CALL util.throw('The refund ticket cannot be deleted tickets');
+ END IF;
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/procedures/ticket_mergeSales.sql b/db/routines/vn/procedures/ticket_mergeSales.sql
index a2177de2e..8ef5f6d90 100644
--- a/db/routines/vn/procedures/ticket_mergeSales.sql
+++ b/db/routines/vn/procedures/ticket_mergeSales.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_mergeSales`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_mergeSales`(
vSelf INT
)
BEGIN
diff --git a/db/routines/vn/procedures/ticket_setProblemRiskByClient.sql b/db/routines/vn/procedures/ticket_setProblemRiskByClient.sql
index 8479550de..1652fd29e 100644
--- a/db/routines/vn/procedures/ticket_setProblemRiskByClient.sql
+++ b/db/routines/vn/procedures/ticket_setProblemRiskByClient.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemRiskByClient`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setProblemRiskByClient`(
vClientFk INT
)
BEGIN
diff --git a/db/routines/vn/procedures/ticket_setVolume.sql b/db/routines/vn/procedures/ticket_setVolume.sql
index d0fe9740c..c3cf0d057 100644
--- a/db/routines/vn/procedures/ticket_setVolume.sql
+++ b/db/routines/vn/procedures/ticket_setVolume.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setVolume`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setVolume`(
vSelf INT
)
BEGIN
diff --git a/db/routines/vn/procedures/ticket_setVolumeItemCost.sql b/db/routines/vn/procedures/ticket_setVolumeItemCost.sql
index d7fb4473d..3c23b7c34 100644
--- a/db/routines/vn/procedures/ticket_setVolumeItemCost.sql
+++ b/db/routines/vn/procedures/ticket_setVolumeItemCost.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setVolumeItemCost`(
+CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setVolumeItemCost`(
vItemFk INT
)
BEGIN
diff --git a/db/routines/vn/triggers/host_beforeInsert.sql b/db/routines/vn/triggers/host_beforeInsert.sql
index c2cb82334..96b78bfb7 100644
--- a/db/routines/vn/triggers/host_beforeInsert.sql
+++ b/db/routines/vn/triggers/host_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`host_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`host_beforeInsert`
BEFORE INSERT ON `host`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/itemShelving_afterInsert.sql b/db/routines/vn/triggers/itemShelving_afterInsert.sql
new file mode 100644
index 000000000..92243ca03
--- /dev/null
+++ b/db/routines/vn/triggers/itemShelving_afterInsert.sql
@@ -0,0 +1,18 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemShelving_afterInsert`
+ AFTER INSERT ON `itemShelving`
+ FOR EACH ROW
+BEGIN
+ INSERT INTO itemShelvingLog
+ SET itemShelvingFk = NEW.id,
+ workerFk = account.myUser_getId(),
+ accion = 'CREA REGISTRO',
+ itemFk = NEW.itemFk,
+ shelvingFk = NEW.shelvingFk,
+ visible = NEW.visible,
+ `grouping` = NEW.`grouping`,
+ packing = NEW.packing,
+ available = NEW.available;
+
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/triggers/roadmap_beforeInsert.sql b/db/routines/vn/triggers/roadmap_beforeInsert.sql
index df07d5540..2f9481140 100644
--- a/db/routines/vn/triggers/roadmap_beforeInsert.sql
+++ b/db/routines/vn/triggers/roadmap_beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`roadmap_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_beforeInsert`
BEFORE INSERT ON `roadmap`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/roadmap_beforeUpdate.sql b/db/routines/vn/triggers/roadmap_beforeUpdate.sql
index 4905a0442..a2a02e96a 100644
--- a/db/routines/vn/triggers/roadmap_beforeUpdate.sql
+++ b/db/routines/vn/triggers/roadmap_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`roadmap_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_beforeUpdate`
BEFORE UPDATE ON `roadmap`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/saleGroupDetail._beforeInsert.sql b/db/routines/vn/triggers/saleGroupDetail._beforeInsert.sql
index 9513be46a..da975933c 100644
--- a/db/routines/vn/triggers/saleGroupDetail._beforeInsert.sql
+++ b/db/routines/vn/triggers/saleGroupDetail._beforeInsert.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleGroupDetail_beforeInsert`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`saleGroupDetail_beforeInsert`
BEFORE INSERT ON `saleGroupDetail`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/saleGroupDetail_afterDelete.sql b/db/routines/vn/triggers/saleGroupDetail_afterDelete.sql
index 1698ad8ce..37c3e9a2b 100644
--- a/db/routines/vn/triggers/saleGroupDetail_afterDelete.sql
+++ b/db/routines/vn/triggers/saleGroupDetail_afterDelete.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleGroupDetail_afterDelete`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`saleGroupDetail_afterDelete`
AFTER DELETE ON `saleGroupDetail`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/saleGroupDetail_beforeUpdate.sql b/db/routines/vn/triggers/saleGroupDetail_beforeUpdate.sql
index 0da18fd98..1f4238cdc 100644
--- a/db/routines/vn/triggers/saleGroupDetail_beforeUpdate.sql
+++ b/db/routines/vn/triggers/saleGroupDetail_beforeUpdate.sql
@@ -1,5 +1,5 @@
DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleGroupDetail_beforeUpdate`
+CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`saleGroupDetail_beforeUpdate`
BEFORE UPDATE ON `saleGroupDetail`
FOR EACH ROW
BEGIN
diff --git a/db/routines/vn/triggers/ticketRefund_beforeInsert.sql b/db/routines/vn/triggers/ticketRefund_beforeInsert.sql
index 61d9fe7a2..dd1da6650 100644
--- a/db/routines/vn/triggers/ticketRefund_beforeInsert.sql
+++ b/db/routines/vn/triggers/ticketRefund_beforeInsert.sql
@@ -3,6 +3,8 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketRefund_beforeInse
BEFORE INSERT ON `ticketRefund`
FOR EACH ROW
BEGIN
+ CALL ticketRefund_upsert(NEW.refundTicketFk, NEW.originalTicketFk);
+
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/ticketRefund_beforeUpdate.sql b/db/routines/vn/triggers/ticketRefund_beforeUpdate.sql
index 807695de6..f27e3f092 100644
--- a/db/routines/vn/triggers/ticketRefund_beforeUpdate.sql
+++ b/db/routines/vn/triggers/ticketRefund_beforeUpdate.sql
@@ -3,6 +3,8 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketRefund_beforeUpda
BEFORE UPDATE ON `ticketRefund`
FOR EACH ROW
BEGIN
+ CALL ticketRefund_upsert(NEW.refundTicketFk, NEW.originalTicketFk);
+
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/travelThermograph_beforeInsert.sql b/db/routines/vn/triggers/travelThermograph_beforeInsert.sql
index f56109fba..256ee12a6 100644
--- a/db/routines/vn/triggers/travelThermograph_beforeInsert.sql
+++ b/db/routines/vn/triggers/travelThermograph_beforeInsert.sql
@@ -4,5 +4,14 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`travelThermograph_befor
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
+
+ IF NEW.travelFk IS NULL AND
+ (SELECT COUNT(*) FROM travelThermograph
+ WHERE thermographFk = NEW.thermographFk
+ AND travelFk IS NULL
+ AND id <> NEW.id) > 0
+ THEN
+ CALL util.throw('Duplicate thermographFk without travelFk not allowed.');
+ END IF;
END$$
DELIMITER ;
diff --git a/db/routines/vn/triggers/travelThermograph_beforeUpdate.sql b/db/routines/vn/triggers/travelThermograph_beforeUpdate.sql
index 49f52f181..ffe81b38d 100644
--- a/db/routines/vn/triggers/travelThermograph_beforeUpdate.sql
+++ b/db/routines/vn/triggers/travelThermograph_beforeUpdate.sql
@@ -4,5 +4,14 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`travelThermograph_befor
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
+
+ IF NEW.travelFk IS NULL AND
+ (SELECT COUNT(*) FROM travelThermograph
+ WHERE thermographFk = NEW.thermographFk
+ AND travelFk IS NULL
+ AND id <> NEW.id) > 0
+ THEN
+ CALL util.throw('Duplicate thermographFk without travelFk not allowed.');
+ END IF;
END$$
DELIMITER ;
diff --git a/db/routines/vn/views/buyer.sql b/db/routines/vn/views/buyer.sql
index e690dc16f..4f668d35d 100644
--- a/db/routines/vn/views/buyer.sql
+++ b/db/routines/vn/views/buyer.sql
@@ -2,12 +2,10 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost`
SQL SECURITY DEFINER
VIEW `vn`.`buyer`
AS SELECT DISTINCT `u`.`id` AS `userFk`,
- `u`.`nickname` AS `nickname`,
- `ic`.`display` AS `display`
+ `u`.`nickname` AS `nickname`
FROM (
`account`.`user` `u`
JOIN `vn`.`itemType` `it` ON(`it`.`workerFk` = `u`.`id`)
- JOIN `vn`.`itemCategory` `ic` ON(`ic`.`id` = `it`.`categoryFk`)
)
WHERE `u`.`active` <> 0
ORDER BY `u`.`nickname`
diff --git a/db/routines/vn2008/views/Agencias.sql b/db/routines/vn2008/views/Agencias.sql
index d70ec73f4..1176d02c4 100644
--- a/db/routines/vn2008/views/Agencias.sql
+++ b/db/routines/vn2008/views/Agencias.sql
@@ -13,6 +13,5 @@ AS SELECT `am`.`id` AS `Id_Agencia`,
`am`.`reportMail` AS `send_mail`,
`am`.`isActive` AS `tpv`,
`am`.`code` AS `code`,
- `am`.`showAgencyName` AS `show_AgencyName`,
`am`.`isRiskFree` AS `isRiskFree`
FROM `vn`.`agencyMode` `am`
diff --git a/db/routines/vn2008/views/Cubos.sql b/db/routines/vn2008/views/Cubos.sql
index 4ece9c435..1b23af4fc 100644
--- a/db/routines/vn2008/views/Cubos.sql
+++ b/db/routines/vn2008/views/Cubos.sql
@@ -17,5 +17,6 @@ AS SELECT `p`.`id` AS `Id_Cubo`,
`p`.`upload` AS `Suben`,
`p`.`base` AS `Base`,
`p`.`isBox` AS `box`,
- `p`.`returnCost` AS `costeRetorno`
+ `p`.`returnCost` AS `costeRetorno`,
+ `p`.`isActive` AS `isActive`
FROM `vn`.`packaging` `p`
diff --git a/db/versions/11261-bronzeDracena/00-firstScript.sql b/db/versions/11261-bronzeDracena/00-firstScript.sql
new file mode 100644
index 000000000..1ef944db2
--- /dev/null
+++ b/db/versions/11261-bronzeDracena/00-firstScript.sql
@@ -0,0 +1,2 @@
+ALTER TABLE vn.agencyMode
+ CHANGE IF EXISTS showAgencyName showAgencyName__ tinyint(1) DEFAULT 1 COMMENT '@deprecated 2024-09-24';
\ No newline at end of file
diff --git a/db/versions/11262-chocolateCamellia/00-firstScript.sql b/db/versions/11262-chocolateCamellia/00-firstScript.sql
new file mode 100644
index 000000000..79910fa76
--- /dev/null
+++ b/db/versions/11262-chocolateCamellia/00-firstScript.sql
@@ -0,0 +1,31 @@
+-- vn.priceDelta definition
+
+CREATE OR REPLACE TABLE vn.priceDelta (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `itemTypeFk` smallint(5) unsigned NOT NULL,
+ `minSize` int(10) unsigned DEFAULT NULL COMMENT 'Minimum item.size',
+ `maxSize` int(10) unsigned DEFAULT NULL COMMENT 'Maximum item.size',
+ `inkFk` varchar(3) DEFAULT NULL,
+ `originFk` tinyint(2) unsigned DEFAULT NULL,
+ `producerFk` mediumint(3) unsigned DEFAULT NULL,
+ `fromDated` date DEFAULT NULL,
+ `toDated` date DEFAULT NULL,
+ `absIncreasing` decimal(10,3) DEFAULT NULL COMMENT 'Absolute increasing of final price',
+ `ratIncreasing` int(11) DEFAULT NULL COMMENT 'Increasing ratio for the cost price',
+ `warehouseFk` smallint(6) unsigned NOT NULL,
+ `created` timestamp NOT NULL DEFAULT current_timestamp(),
+ `editorFk` int(10) unsigned DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `priceDelta_itemType_FK` (`itemTypeFk`),
+ KEY `priceDelta_ink_FK` (`inkFk`),
+ KEY `priceDelta_producer_FK` (`producerFk`),
+ KEY `priceDelta_warehouse_FK` (`warehouseFk`),
+ KEY `priceDelta_worker_FK` (`editorFk`),
+ CONSTRAINT `priceDelta_ink_FK` FOREIGN KEY (`inkFk`) REFERENCES `ink` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_itemType_FK` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_producer_FK` FOREIGN KEY (`producerFk`) REFERENCES `producer` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_warehouse_FK` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_worker_FK` FOREIGN KEY (`editorFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Defines the increasing o decreasing for ranges of items';
+
+GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE vn.priceDelta TO buyer;
\ No newline at end of file
diff --git a/db/versions/11263-brownAnthurium/00-firstScript.sql b/db/versions/11263-brownAnthurium/00-firstScript.sql
new file mode 100644
index 000000000..0824ea5f7
--- /dev/null
+++ b/db/versions/11263-brownAnthurium/00-firstScript.sql
@@ -0,0 +1,32 @@
+-- Place your SQL code here
+-- vn.priceDelta definition
+
+CREATE OR REPLACE TABLE vn.priceDelta (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `itemTypeFk` smallint(5) unsigned NOT NULL,
+ `minSize` int(10) unsigned DEFAULT NULL COMMENT 'Minimum item.size',
+ `maxSize` int(10) unsigned DEFAULT NULL COMMENT 'Maximum item.size',
+ `inkFk` varchar(3) DEFAULT NULL,
+ `originFk` tinyint(2) unsigned DEFAULT NULL,
+ `producerFk` mediumint(3) unsigned DEFAULT NULL,
+ `fromDated` date DEFAULT NULL,
+ `toDated` date DEFAULT NULL,
+ `absIncreasing` decimal(10,3) DEFAULT NULL COMMENT 'Absolute increasing of final price',
+ `ratIncreasing` int(11) DEFAULT NULL COMMENT 'Increasing ratio for the cost price',
+ `warehouseFk` smallint(6) unsigned NOT NULL,
+ `created` timestamp NOT NULL DEFAULT current_timestamp(),
+ `editorFk` int(10) unsigned DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `priceDelta_itemType_FK` (`itemTypeFk`),
+ KEY `priceDelta_ink_FK` (`inkFk`),
+ KEY `priceDelta_producer_FK` (`producerFk`),
+ KEY `priceDelta_warehouse_FK` (`warehouseFk`),
+ KEY `priceDelta_worker_FK` (`editorFk`),
+ CONSTRAINT `priceDelta_ink_FK` FOREIGN KEY (`inkFk`) REFERENCES `ink` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_itemType_FK` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_producer_FK` FOREIGN KEY (`producerFk`) REFERENCES `producer` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_warehouse_FK` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE,
+ CONSTRAINT `priceDelta_worker_FK` FOREIGN KEY (`editorFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Defines the increasing o decreasing for ranges of items';
+
+GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE vn.priceDelta TO buyer;
\ No newline at end of file
diff --git a/db/versions/11271-blackMastic/00-firstScript.sql b/db/versions/11271-blackMastic/00-firstScript.sql
new file mode 100644
index 000000000..dcc8349a5
--- /dev/null
+++ b/db/versions/11271-blackMastic/00-firstScript.sql
@@ -0,0 +1,3 @@
+-- Place your SQL code here
+ALTER TABLE vn.priceDelta ADD IF NOT EXISTS zoneGeoFk int(11) NULL COMMENT 'Application area for the bonus component';
+ALTER TABLE vn.priceDelta ADD CONSTRAINT priceDelta_zoneGeo_FK FOREIGN KEY IF NOT EXISTS (zoneGeoFk) REFERENCES vn.zoneGeo(id) ON DELETE RESTRICT ON UPDATE CASCADE;
diff --git a/db/versions/11272-azureLilium/00-firstScript.sql b/db/versions/11272-azureLilium/00-firstScript.sql
new file mode 100644
index 000000000..0194ece18
--- /dev/null
+++ b/db/versions/11272-azureLilium/00-firstScript.sql
@@ -0,0 +1,4 @@
+-- Place your SQL code here
+RENAME TABLE vn.stockBuyed TO vn.stockBuyed__;
+ALTER TABLE vn.stockBuyed__
+COMMENT='@deprecated 2024-10-01 rename and refactor to stockBought';
diff --git a/db/versions/11274-redGerbera/00-firstScript copy 2.sql b/db/versions/11274-redGerbera/00-firstScript copy 2.sql
new file mode 100644
index 000000000..452accf2e
--- /dev/null
+++ b/db/versions/11274-redGerbera/00-firstScript copy 2.sql
@@ -0,0 +1 @@
+ALTER TABLE vn.address MODIFY COLUMN isEqualizated tinyint(1) DEFAULT FALSE NOT NULL;
diff --git a/db/versions/11274-redGerbera/00-firstScript copy 3.sql b/db/versions/11274-redGerbera/00-firstScript copy 3.sql
new file mode 100644
index 000000000..c1f574379
--- /dev/null
+++ b/db/versions/11274-redGerbera/00-firstScript copy 3.sql
@@ -0,0 +1 @@
+ALTER TABLE vn.autonomy MODIFY COLUMN isUeeMember tinyint(1) DEFAULT FALSE NOT NULL;
\ No newline at end of file
diff --git a/db/versions/11274-redGerbera/00-firstScript copy 4.sql b/db/versions/11274-redGerbera/00-firstScript copy 4.sql
new file mode 100644
index 000000000..18a4d3314
--- /dev/null
+++ b/db/versions/11274-redGerbera/00-firstScript copy 4.sql
@@ -0,0 +1 @@
+ALTER TABLE vn.chat MODIFY COLUMN checkUserStatus tinyint(1) DEFAULT FALSE NOT NULL;
diff --git a/db/versions/11274-redGerbera/00-firstScript copy 5.sql b/db/versions/11274-redGerbera/00-firstScript copy 5.sql
new file mode 100644
index 000000000..c75965735
--- /dev/null
+++ b/db/versions/11274-redGerbera/00-firstScript copy 5.sql
@@ -0,0 +1,3 @@
+ALTER TABLE vn.warehouse
+ MODIFY COLUMN isOrigin tinyint(1) DEFAULT FALSE NOT NULL,
+ MODIFY COLUMN isDestiny tinyint(1) DEFAULT FALSE NOT NULL;
\ No newline at end of file
diff --git a/db/versions/11274-redGerbera/00-firstScript copy 6.sql b/db/versions/11274-redGerbera/00-firstScript copy 6.sql
new file mode 100644
index 000000000..63b942e9d
--- /dev/null
+++ b/db/versions/11274-redGerbera/00-firstScript copy 6.sql
@@ -0,0 +1 @@
+ALTER TABLE vn.zoneIncluded MODIFY COLUMN isIncluded tinyint(1) DEFAULT FALSE NOT NULL;
diff --git a/db/versions/11274-redGerbera/00-firstScript copy.sql b/db/versions/11274-redGerbera/00-firstScript copy.sql
new file mode 100644
index 000000000..f14ff371d
--- /dev/null
+++ b/db/versions/11274-redGerbera/00-firstScript copy.sql
@@ -0,0 +1 @@
+ALTER TABLE bs.defaulter MODIFY COLUMN hasChanged tinyint(1) DEFAULT FALSE NOT NULL;
diff --git a/db/versions/11274-redGerbera/00-firstScript.sql b/db/versions/11274-redGerbera/00-firstScript.sql
new file mode 100644
index 000000000..8bcf7e027
--- /dev/null
+++ b/db/versions/11274-redGerbera/00-firstScript.sql
@@ -0,0 +1 @@
+ALTER TABLE account.user MODIFY COLUMN emailVerified tinyint(1) DEFAULT FALSE NOT NULL;
diff --git a/db/versions/11278-crimsonEucalyptus/00-firstScript.sql b/db/versions/11278-crimsonEucalyptus/00-firstScript.sql
new file mode 100644
index 000000000..f69f75f1d
--- /dev/null
+++ b/db/versions/11278-crimsonEucalyptus/00-firstScript.sql
@@ -0,0 +1,6 @@
+-- Place your SQL code here
+
+ALTER TABLE vn.priceDelta ADD IF NOT EXISTS zoneGeoFk int(11) NULL;
+
+ALTER TABLE vn.priceDelta ADD CONSTRAINT priceDelta_zoneGeo_FK FOREIGN KEY IF NOT EXISTS (zoneGeoFk)
+REFERENCES vn.zoneGeo (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
diff --git a/db/versions/11279-turquoiseDendro/00-firstScript.sql b/db/versions/11279-turquoiseDendro/00-firstScript.sql
new file mode 100644
index 000000000..a241e6af2
--- /dev/null
+++ b/db/versions/11279-turquoiseDendro/00-firstScript.sql
@@ -0,0 +1,6 @@
+-- Place your SQL code here
+
+ALTER TABLE vn.priceDelta ADD IF NOT EXISTS zoneGeoFk int(11) NULL;
+
+ALTER TABLE vn.priceDelta ADD CONSTRAINT priceDelta_zoneGeo_FK FOREIGN KEY IF NOT EXISTS (zoneGeoFk)
+REFERENCES vn.zoneGeo (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
\ No newline at end of file
diff --git a/db/versions/11280-goldenCamellia/00-firstScript.sql b/db/versions/11280-goldenCamellia/00-firstScript.sql
new file mode 100644
index 000000000..fd55760c1
--- /dev/null
+++ b/db/versions/11280-goldenCamellia/00-firstScript.sql
@@ -0,0 +1,24 @@
+ALTER TABLE `vn`.`packaging`
+ ADD COLUMN IF NOT EXISTS `isActive` TINYINT(1) DEFAULT 1;
+
+UPDATE vn.packaging
+ SET isActive = FALSE
+ WHERE id IN('06x04x06','07x04x03','1000','100SM','1031','104','105','1060','10x04x06','10x04x07','1100','118','119','1200','129','1300',
+ '134','146','147','148','158','159','17x01x02','17X01X03','17x01x04','17x01x05','18X01X04','198','199',
+ '20P','20x01x03','246','273','278','279','280','290','359','37247','382','40P','453','463','464','465','466',
+ '467','469','471','473','494','508','509','511','512','514','515','516','518','519-50B','575','598-3x6','604','605','606',
+ '607','609','647','67515','676','680','682','685','687','688','691','692','693','694','695','730','751','7808','790','7910',
+ '7920','79450','7950','7952','7960','7976','7982','7986','7988',
+ '7993','8000','8046','8049','8053','8057','8058','8065','8076','8085','8086','8088',
+ '8091','8095','8096','8097','8101','8106','8108','8110','8112','8124','8134','8140','8141','8143','8145','8149','8150',
+ '8170','8174','8192','8200','8210','8249','8270','8275','8288','8300','8350','8375','8399','8400','8420','845','847','8480','8500',
+ '855','858','8600','862','869','871','872','8720','878','879','880','8800','882','885','910','911','912','914','916','917','918','919',
+ '920','921','922','923','924','925','926','927','930','9300','932','934','935','936','938','942','948','9600','980','984','9920',
+ 'B20x16','B43x13','Bande Rota','bb3','Bcesta','BcestaOVAL','BcestaRED','Bcirios','BciriosG','BjarronBLN','BjarronNGR',
+ 'Btazon','Bvelas','cactus200','Caja040','CajaTGLF','CC Alza Pl','CC_falso',
+ 'EB-RSMINA','EMB 1_4','EMB 2_5','espuma','FB-BENCH','granel','Grenex','guzma1200','guzma1400','guzma330','guzma400','guzma650','guzma900','HB-ALEX',
+ 'HB-APOSENT','HB-MAGIC','HB-NATUF','HB-RSMINA','HB-TES-RSR','HB068','HB117','HB2-CIRCA','JB-AROMA','jumboX3','kalan330','kalan400',
+ 'kalan577','kalan900','L12','L120','L14','L2-120','L200','L3-120','L4-120','L44','L6','L6-180','L8','L8-200','MB-BENCH','MBOLA','mc_11',
+ 'mc_13','Msp','NO VALIDO','NO-002','PANIC','PBLG','PISOCC/3','PISOCC/4','PISOCC/5','PISOCC/6',
+ 'procona','QB-CARDENA','QB-PANDERO','QB-TES-RSR','QB7-TOSCA','QB9-TOSCA','RB-BENCH','SemiEuroPa','spolette','t_flori11','T26x23',
+ 'T26x25','T27x24','T27x30','T28x26','T30x24','T33x30','THA50','ti_13','Tumbado','UB-BENCH')
\ No newline at end of file
diff --git a/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js b/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js
deleted file mode 100644
index 9c37ce9ba..000000000
--- a/e2e/paths/01-salix/03_smartTable_searchBar_integrations.spec.js
+++ /dev/null
@@ -1,68 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('SmartTable SearchBar integration', () => {
- let browser;
- let page;
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('salesPerson', 'item');
- await page.waitToClick(selectors.globalItems.searchButton);
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should search by type in searchBar, reload page and have same results', async() => {
- await page.waitToClick(selectors.itemsIndex.openAdvancedSearchButton);
- await page.autocompleteSearch(selectors.itemsIndex.advancedSearchItemType, 'Anthurium');
- await page.waitToClick(selectors.itemsIndex.advancedSearchButton);
- await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 4);
-
- await page.reload({
- waitUntil: 'networkidle2'
- });
-
- await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 4);
-
- await page.write(selectors.itemsIndex.advancedSmartTableGrouping, '1');
- await page.keyboard.press('Enter');
- await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2);
-
- await page.reload({
- waitUntil: 'networkidle2'
- });
-
- await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
- });
-
- it('should filter in section without smart-table and search in searchBar go to zone section', async() => {
- await page.loginAndModule('salesPerson', 'zone');
- await page.waitToClick(selectors.globalItems.searchButton);
-
- await page.doSearch('A');
- const firstCount = await page.countElement(selectors.zoneIndex.searchResult);
-
- await page.doSearch('A');
- const secondCount = await page.countElement(selectors.zoneIndex.searchResult);
-
- expect(firstCount).toEqual(7);
- expect(secondCount).toEqual(7);
- });
-
- it('should order orders by first id and order by last id, reload page and have same order', async() => {
- await page.loginAndModule('developer', 'item');
- await page.accessToSection('item.fixedPrice');
- await page.keyboard.press('Enter');
-
- await page.waitForTextInField(selectors.itemFixedPrice.firstItemID, '1');
-
- await page.waitToClick(selectors.itemFixedPrice.orderColumnId);
- await page.reload({
- waitUntil: 'networkidle2'
- });
- await page.waitForTextInField(selectors.itemFixedPrice.firstItemID, '3');
- });
-});
diff --git a/e2e/paths/10-travel/01_create.spec.js b/e2e/paths/10-travel/01_create.spec.js
deleted file mode 100644
index 98ade4852..000000000
--- a/e2e/paths/10-travel/01_create.spec.js
+++ /dev/null
@@ -1,42 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Travel create path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('buyer', 'travel');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should create a new travel and check it was created with the correct data', async() => {
- const date = Date.vnNew();
- date.setDate(15);
- date.setUTCHours(0, 0, 0, 0);
-
- await page.waitToClick(selectors.travelIndex.newTravelButton);
- await page.waitForState('travel.create');
-
- const values = {
- reference: 'Testing reference',
- agencyMode: 'inhouse pickup',
- shipped: date,
- landed: date,
- warehouseOut: 'Warehouse One',
- warehouseIn: 'Warehouse Five'
- };
-
- const message = await page.sendForm('vn-travel-create form', values);
- await page.waitForState('travel.card.basicData');
- const formValues = await page.fetchForm('vn-travel-basic-data form', Object.keys(values));
-
- expect(message.isSuccess).toBeTrue();
- expect(formValues).toEqual(values);
- });
-});
diff --git a/e2e/paths/10-travel/02_basic_data_and_log.spec.js b/e2e/paths/10-travel/02_basic_data_and_log.spec.js
deleted file mode 100644
index 701e6b1b4..000000000
--- a/e2e/paths/10-travel/02_basic_data_and_log.spec.js
+++ /dev/null
@@ -1,97 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Travel basic data path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('buyer', 'travel');
- await page.write(selectors.travelIndex.generalSearchFilter, '3');
- await page.keyboard.press('Enter');
- await page.accessToSection('travel.card.basicData');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should reach the thermograph section', async() => {
- await page.waitForState('travel.card.basicData');
- });
-
- it('should set a wrong delivery date then receive an error on submit', async() => {
- await page.loginAndModule('buyer', 'travel');
- await page.write(selectors.travelIndex.generalSearchFilter, '4');
- await page.keyboard.press('Enter');
- await page.accessToSection('travel.card.basicData');
- await page.waitForState('travel.card.basicData');
-
- const lastMonth = Date.vnNew();
- lastMonth.setMonth(lastMonth.getMonth() - 2);
-
- await page.pickDate(selectors.travelBasicData.deliveryDate, lastMonth);
- await page.waitToClick(selectors.travelBasicData.save);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Landing cannot be lesser than shipment');
- });
-
- it('should undo the changes', async() => {
- await page.clearInput(selectors.travelBasicData.reference);
- await page.write(selectors.travelBasicData.reference, 'totally pointless ref');
- await page.waitToClick(selectors.travelBasicData.undoChanges);
- const result = await page.waitToGetProperty(selectors.travelBasicData.reference, 'value');
-
- expect(result).toEqual('fourth travel');
- });
-
- it('should now edit the whole form then save', async() => {
- await page.clearInput(selectors.travelBasicData.reference);
- await page.write(selectors.travelBasicData.reference, 'new reference!');
- await page.autocompleteSearch(selectors.travelBasicData.agency, 'Entanglement');
- await page.autocompleteSearch(selectors.travelBasicData.outputWarehouse, 'Warehouse Three');
- await page.autocompleteSearch(selectors.travelBasicData.inputWarehouse, 'Warehouse Four');
- await page.waitToClick(selectors.travelBasicData.delivered);
- await page.waitToClick(selectors.travelBasicData.received);
- await page.waitToClick(selectors.travelBasicData.save);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it('should reload the section and check the reference was saved', async() => {
- await page.reloadSection('travel.card.basicData');
- const result = await page.waitToGetProperty(selectors.travelBasicData.reference, 'value');
-
- expect(result).toEqual('new reference!');
- });
-
- it('should check the agency was saved', async() => {
- const result = await page.waitToGetProperty(selectors.travelBasicData.agency, 'value');
-
- expect(result).toEqual('Entanglement');
- });
-
- it('should check the output warehouse date was saved', async() => {
- const result = await page.waitToGetProperty(selectors.travelBasicData.outputWarehouse, 'value');
-
- expect(result).toEqual('Warehouse Three');
- });
-
- it('should check the input warehouse date was saved', async() => {
- const result = await page.waitToGetProperty(selectors.travelBasicData.inputWarehouse, 'value');
-
- expect(result).toEqual('Warehouse Four');
- });
-
- it(`should check the delivered checkbox was saved even tho it doesn't make sense`, async() => {
- await page.waitForClassPresent(selectors.travelBasicData.delivered, 'checked');
- });
-
- it(`should check the received checkbox was saved even tho it doesn't make sense`, async() => {
- await page.waitForClassPresent(selectors.travelBasicData.received, 'checked');
- });
-});
diff --git a/e2e/paths/10-travel/03_descriptor.spec.js b/e2e/paths/10-travel/03_descriptor.spec.js
deleted file mode 100644
index f066a74ca..000000000
--- a/e2e/paths/10-travel/03_descriptor.spec.js
+++ /dev/null
@@ -1,36 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Travel descriptor path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('buyer', 'travel');
- await page.write(selectors.travelIndex.generalSearchFilter, '3');
- await page.keyboard.press('Enter');
- await page.waitForState('travel.card.summary');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should click the descriptor button to navigate to the travel index showing all travels with current agency', async() => {
- await page.waitToClick(selectors.travelDescriptor.filterByAgencyButton);
- await page.waitForState('travel.index');
- const result = await page.countElement(selectors.travelIndex.anySearchResult);
-
- expect(result).toBeGreaterThanOrEqual(1);
- });
-
- it('should navigate to the first search result', async() => {
- await page.waitToClick(selectors.travelIndex.firstSearchResult);
- await page.waitForState('travel.card.summary');
- const state = await page.getState();
-
- expect(state).toBe('travel.card.summary');
- });
-});
diff --git a/e2e/paths/10-travel/04_extra_community.spec.js b/e2e/paths/10-travel/04_extra_community.spec.js
deleted file mode 100644
index c5975c958..000000000
--- a/e2e/paths/10-travel/04_extra_community.spec.js
+++ /dev/null
@@ -1,42 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Travel extra community path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('buyer', 'travel');
- await page.accessToSection('travel.extraCommunity');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should edit the travel reference and the locked kilograms', async() => {
- await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter);
- await page.waitForSpinnerLoad();
- await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelReference, 'edited reference');
- await page.waitForSpinnerLoad();
- await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelLockedKg, '1500');
-
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it('should reload the index and confirm the reference and locked kg were edited', async() => {
- await page.accessToSection('travel.index');
- await page.accessToSection('travel.extraCommunity');
- await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter);
- await page.waitForTextInElement(selectors.travelExtraCommunity.firstTravelReference, 'edited reference');
- const reference = await page.getProperty(selectors.travelExtraCommunity.firstTravelReference, 'innerText');
- const lockedKg = await page.getProperty(selectors.travelExtraCommunity.firstTravelLockedKg, 'innerText');
-
- expect(reference).toContain('edited reference');
- expect(lockedKg).toContain(1500);
- });
-});
diff --git a/e2e/paths/10-travel/06_search_panel.spec.js b/e2e/paths/10-travel/06_search_panel.spec.js
deleted file mode 100644
index 420ceaf48..000000000
--- a/e2e/paths/10-travel/06_search_panel.spec.js
+++ /dev/null
@@ -1,62 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Travel search panel path', () => {
- let browser;
- let page;
- let httpRequest;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('buyer', 'travel');
- page.on('request', req => {
- if (req.url().includes(`Travels/filter`))
- httpRequest = req.url();
- });
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should filter using all the fields', async() => {
- await page.click(selectors.travelIndex.chip);
- await page.write(selectors.travelIndex.generalSearchFilter, 'travel');
- await page.keyboard.press('Enter');
-
- expect(httpRequest).toContain('search=travel');
-
- await page.click(selectors.travelIndex.chip);
- await page.autocompleteSearch(selectors.travelIndex.agencyFilter, 'Entanglement');
-
- expect(httpRequest).toContain('agencyModeFk');
-
- await page.click(selectors.travelIndex.chip);
- await page.autocompleteSearch(selectors.travelIndex.warehouseOutFilter, 'Warehouse One');
-
- expect(httpRequest).toContain('warehouseOutFk');
-
- await page.click(selectors.travelIndex.chip);
- await page.autocompleteSearch(selectors.travelIndex.warehouseInFilter, 'Warehouse Two');
-
- expect(httpRequest).toContain('warehouseInFk');
-
- await page.click(selectors.travelIndex.chip);
- await page.overwrite(selectors.travelIndex.scopeDaysFilter, '15');
- await page.keyboard.press('Enter');
-
- expect(httpRequest).toContain('scopeDays=15');
-
- await page.click(selectors.travelIndex.chip);
- await page.autocompleteSearch(selectors.travelIndex.continentFilter, 'Asia');
-
- expect(httpRequest).toContain('continent');
-
- await page.click(selectors.travelIndex.chip);
- await page.write(selectors.travelIndex.totalEntriesFilter, '1');
- await page.keyboard.press('Enter');
-
- expect(httpRequest).toContain('totalEntries=1');
- });
-});
diff --git a/e2e/paths/11-zone/01_basic-data.spec.js b/e2e/paths/11-zone/01_basic-data.spec.js
deleted file mode 100644
index 34d08c57f..000000000
--- a/e2e/paths/11-zone/01_basic-data.spec.js
+++ /dev/null
@@ -1,104 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Zone basic data path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
-
- await page.loginAndModule('deliveryAssistant',
- 'zone'); // turns up the zone module name and route aint the same lol
- await page.accessToSearchResult('10');
- await page.accessToSection('zone.card.basicData');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should reach the basic data section', async() => {
- await page.waitForState('zone.card.basicData');
- });
-
- it('should edit de form and then save', async() => {
- await page.clearInput(selectors.zoneBasicData.name);
- await page.write(selectors.zoneBasicData.name, 'Brimstone teleportation');
- await page.autocompleteSearch(selectors.zoneBasicData.agency, 'Quantum break device');
- await page.clearInput(selectors.zoneBasicData.maxVolume);
- await page.write(selectors.zoneBasicData.maxVolume, '10');
- await page.clearInput(selectors.zoneBasicData.travelingDays);
- await page.write(selectors.zoneBasicData.travelingDays, '1');
- await page.clearInput(selectors.zoneBasicData.closing);
- await page.pickTime(selectors.zoneBasicData.closing, '21:00');
- await page.clearInput(selectors.zoneBasicData.price);
- await page.write(selectors.zoneBasicData.price, '999');
- await page.clearInput(selectors.zoneBasicData.bonus);
- await page.write(selectors.zoneBasicData.bonus, '100');
- await page.clearInput(selectors.zoneBasicData.inflation);
- await page.write(selectors.zoneBasicData.inflation, '200');
- await page.waitToClick(selectors.zoneBasicData.volumetric);
- await page.waitToClick(selectors.zoneBasicData.saveButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it('should now reload the section', async() => {
- await page.reloadSection('zone.card.basicData');
- });
-
- it('should confirm the name was updated', async() => {
- const result = await page.waitToGetProperty(selectors.zoneBasicData.name, 'value');
-
- expect(result).toEqual('Brimstone teleportation');
- });
-
- it('should confirm the agency was updated', async() => {
- const result = await page.waitToGetProperty(selectors.zoneBasicData.agency, 'value');
-
- expect(result).toEqual('Quantum break device');
- });
-
- it('should confirm the max volume was updated', async() => {
- const result = await page.waitToGetProperty(selectors.zoneBasicData.maxVolume, 'value');
-
- expect(result).toEqual('10');
- });
-
- it('should confirm the traveling days were updated', async() => {
- const result = await page.waitToGetProperty(selectors.zoneBasicData.travelingDays, 'value');
-
- expect(result).toEqual('1');
- });
-
- it('should confirm the closing hour was updated', async() => {
- const result = await page.waitToGetProperty(selectors.zoneBasicData.closing, 'value');
-
- expect(result).toEqual('21:00');
- });
-
- it('should confirm the price was updated', async() => {
- const result = await page.waitToGetProperty(selectors.zoneBasicData.price, 'value');
-
- expect(result).toEqual('999');
- });
-
- it('should confirm the bonus was updated', async() => {
- const result = await page.waitToGetProperty(selectors.zoneBasicData.bonus, 'value');
-
- expect(result).toEqual('100');
- });
-
- it('should confirm the inflation was updated', async() => {
- const result = await page.waitToGetProperty(selectors.zoneBasicData.inflation, 'value');
-
- expect(result).toEqual('200');
- });
-
- it('should confirm the volumetric checkbox was checked', async() => {
- await page.waitForClassPresent(selectors.zoneBasicData.volumetric, 'checked');
- });
-});
diff --git a/e2e/paths/11-zone/02_descriptor.spec.js b/e2e/paths/11-zone/02_descriptor.spec.js
deleted file mode 100644
index baccc910f..000000000
--- a/e2e/paths/11-zone/02_descriptor.spec.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Zone descriptor path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('deliveryAssistant', 'zone');
- await page.accessToSearchResult('13');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should eliminate the zone using the descriptor option', async() => {
- await page.waitToClick(selectors.zoneDescriptor.menu);
- await page.waitToClick(selectors.zoneDescriptor.deleteZone);
- await page.respondToDialog('accept');
- await page.waitForState('zone.index');
- });
-
- it('should search for the deleted zone to find no results', async() => {
- await page.doSearch('13');
- const count = await page.countElement(selectors.zoneIndex.searchResult);
-
- expect(count).toEqual(0);
- });
-});
diff --git a/front/core/services/app.js b/front/core/services/app.js
index cec7bea7f..b8fcc43e1 100644
--- a/front/core/services/app.js
+++ b/front/core/services/app.js
@@ -57,7 +57,7 @@ export default class App {
getUrl(route, appName = 'lilium') {
const index = window.location.hash.indexOf(route.toLowerCase());
- const newRoute = index < 0 ? route : window.location.hash.substring(index);
+ let newRoute = index < 0 ? route : window.location.hash.substring(index);
const env = process.env.NODE_ENV;
const filter = {
where: {and: [
@@ -66,6 +66,11 @@ export default class App {
]}
};
+
+ if (this.logger.$params.q)
+ newRoute = newRoute.concat(`?table=${this.logger.$params.q}`);
+
+
return this.logger.$http.get('Urls/findOne', {filter})
.then(res => {
if (res && res.data)
diff --git a/loopback/locale/en.json b/loopback/locale/en.json
index 352e08826..ea84cb6eb 100644
--- a/loopback/locale/en.json
+++ b/loopback/locale/en.json
@@ -235,10 +235,10 @@
"Cannot add holidays on this day": "Cannot add holidays on this day",
"Cannot send mail": "Cannot send mail",
"CONSTRAINT `chkParkingCodeFormat` failed for `vn`.`parking`": "CONSTRAINT `chkParkingCodeFormat` failed for `vn`.`parking`",
+ "This postcode already exists": "This postcode already exists",
"Original invoice not found": "Original invoice not found",
"There is already a tray with the same height": "There is already a tray with the same height",
"The height must be greater than 50cm": "The height must be greater than 50cm",
"The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm",
- "This postcode already exists": "This postcode already exists",
- "This buyer has already made a reservation for this date": "This buyer has already made a reservation for this date"
-}
\ No newline at end of file
+ "The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line"
+}
diff --git a/loopback/locale/es.json b/loopback/locale/es.json
index ba4b90cb5..796c945e8 100644
--- a/loopback/locale/es.json
+++ b/loopback/locale/es.json
@@ -366,9 +366,11 @@
"The invoices have been created but the PDFs could not be generated": "Se ha facturado pero no se ha podido generar el PDF",
"It has been invoiced but the PDF of refund not be generated": "Se ha facturado pero no se ha podido generar el PDF del abono",
"Payment method is required": "El método de pago es obligatorio",
- "Cannot send mail": "No se ha podido enviar el correo",
+ "Cannot send mail": "Não é possível enviar o email",
"CONSTRAINT `supplierAccountTooShort` failed for `vn`.`supplier`": "La cuenta debe tener exactamente 10 dígitos",
"The sale not exists in the item shelving": "La venta no existe en la estantería del artículo",
+ "The entry not have stickers": "La entrada no tiene etiquetas",
+ "Too many records": "Demasiados registros",
"Original invoice not found": "Factura original no encontrada",
"The entry has no lines or does not exist": "La entrada no tiene lineas o no existe",
"Weight already set": "El peso ya está establecido",
@@ -377,7 +379,7 @@
"The height must be greater than 50cm": "La altura debe ser superior a 50cm",
"The maximum height of the wagon is 200cm": "La altura máxima es 200cm",
"The entry does not have stickers": "La entrada no tiene etiquetas",
- "Too many records": "Demasiados registros",
"This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha",
- "No valid travel thermograph found": "No se encontró un termógrafo válido"
+ "No valid travel thermograph found": "No se encontró un termógrafo válido",
+ "The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea"
}
diff --git a/loopback/locale/fr.json b/loopback/locale/fr.json
index 601fe35f5..a6648b186 100644
--- a/loopback/locale/fr.json
+++ b/loopback/locale/fr.json
@@ -361,6 +361,6 @@
"The invoices have been created but the PDFs could not be generated": "La facture a été émise mais le PDF n'a pas pu être généré",
"It has been invoiced but the PDF of refund not be generated": "Il a été facturé mais le PDF de remboursement n'a pas été généré",
"Cannot send mail": "Impossible d'envoyer le mail",
- "Original invoice not found": "Facture originale introuvable"
-
+ "Original invoice not found": "Facture originale introuvable",
+ "The quantity claimed cannot be greater than the quantity of the line": "Le montant réclamé ne peut pas être supérieur au montant de la ligne"
}
diff --git a/loopback/locale/pt.json b/loopback/locale/pt.json
index a6a65710f..a43f0e780 100644
--- a/loopback/locale/pt.json
+++ b/loopback/locale/pt.json
@@ -361,5 +361,6 @@
"The invoices have been created but the PDFs could not be generated": "Foi faturado, mas o PDF não pôde ser gerado",
"It has been invoiced but the PDF of refund not be generated": "Foi faturado mas não foi gerado o PDF do reembolso",
"Original invoice not found": "Fatura original não encontrada",
- "Cannot send mail": "Não é possível enviar o email"
+ "Cannot send mail": "Não é possível enviar o email",
+ "The quantity claimed cannot be greater than the quantity of the line": "O valor reclamado não pode ser superior ao valor da linha"
}
diff --git a/modules/account/back/models/mail-alias-account.js b/modules/account/back/models/mail-alias-account.js
index 0eee6a123..61ca344e9 100644
--- a/modules/account/back/models/mail-alias-account.js
+++ b/modules/account/back/models/mail-alias-account.js
@@ -1,6 +1,5 @@
const ForbiddenError = require('vn-loopback/util/forbiddenError');
-const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.rewriteDbError(function(err) {
diff --git a/modules/claim/back/methods/claim-beginning/specs/claim-beginning.spec.js b/modules/claim/back/methods/claim-beginning/specs/claim-beginning.spec.js
new file mode 100644
index 000000000..b7974ad23
--- /dev/null
+++ b/modules/claim/back/methods/claim-beginning/specs/claim-beginning.spec.js
@@ -0,0 +1,55 @@
+const models = require('vn-loopback/server/server').models;
+const LoopBackContext = require('loopback-context');
+
+describe('ClaimBeginning model()', () => {
+ const claimFk = 1;
+ const activeCtx = {
+ accessToken: {userId: 18},
+ headers: {origin: 'localhost:5000'},
+ __: () => {}
+ };
+
+ beforeEach(() => {
+ spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
+ active: activeCtx
+ });
+ });
+
+ it('should change quantity claimed', async() => {
+ const tx = await models.ClaimBeginning.beginTransaction({});
+
+ let error;
+ try {
+ const options = {transaction: tx};
+ const claim = await models.ClaimBeginning.findOne({where: {claimFk}}, options);
+ const sale = await models.Sale.findById(claim.saleFk, {}, options);
+ await claim.updateAttribute('quantity', sale.quantity - 1, options);
+
+ await tx.rollback();
+ } catch (e) {
+ error = e;
+ await tx.rollback();
+ }
+
+ expect(error).toBeUndefined();
+ });
+
+ it('should throw error when quantity claimed is greater than quantity of the sale', async() => {
+ const tx = await models.ClaimBeginning.beginTransaction({});
+
+ let error;
+ try {
+ const options = {transaction: tx};
+ const claim = await models.ClaimBeginning.findOne({where: {claimFk}}, options);
+ const sale = await models.Sale.findById(claim.saleFk, {}, options);
+ await claim.updateAttribute('quantity', sale.quantity + 1, options);
+
+ await tx.rollback();
+ } catch (e) {
+ error = e;
+ await tx.rollback();
+ }
+
+ expect(error.toString()).toContain('The quantity claimed cannot be greater than the quantity of the line');
+ });
+});
diff --git a/modules/claim/back/models/claim-beginning.js b/modules/claim/back/models/claim-beginning.js
index d269b2285..3dc9261c3 100644
--- a/modules/claim/back/models/claim-beginning.js
+++ b/modules/claim/back/models/claim-beginning.js
@@ -10,16 +10,21 @@ module.exports = Self => {
});
Self.observe('before save', async ctx => {
+ const options = ctx.options;
+ const models = Self.app.models;
+ const saleFk = ctx?.currentInstance?.saleFk || ctx?.instance?.saleFk;
+ const sale = await models.Sale.findById(saleFk, {fields: ['ticketFk', 'quantity']}, options);
+
if (ctx.isNewInstance) {
- const models = Self.app.models;
- const options = ctx.options;
- const instance = ctx.instance;
- const ticket = await models.Sale.findById(instance.saleFk, {fields: ['ticketFk']}, options);
- const claim = await models.Claim.findById(instance.claimFk, {fields: ['ticketFk']}, options);
- if (ticket.ticketFk != claim.ticketFk)
+ const claim = await models.Claim.findById(ctx.instance.claimFk, {fields: ['ticketFk']}, options);
+ if (sale.ticketFk != claim.ticketFk)
throw new UserError(`Cannot create a new claimBeginning from a different ticket`);
}
+
await claimIsEditable(ctx);
+
+ if (sale?.quantity && ctx.data?.quantity && ctx.data.quantity > sale?.quantity)
+ throw new UserError('The quantity claimed cannot be greater than the quantity of the line');
});
Self.observe('before delete', async ctx => {
diff --git a/modules/entry/back/methods/entry/filter.js b/modules/entry/back/methods/entry/filter.js
index 776544bc6..f4703245c 100644
--- a/modules/entry/back/methods/entry/filter.js
+++ b/modules/entry/back/methods/entry/filter.js
@@ -106,10 +106,15 @@ module.exports = Self => {
description: `The to shipped date filter`
},
{
- arg: 'days',
+ arg: 'daysOnward',
type: 'number',
description: `N days interval`
},
+ {
+ arg: 'daysAgo',
+ type: 'number',
+ description: `N days ago interval`
+ },
{
arg: 'invoiceAmount',
type: 'number',
@@ -216,16 +221,29 @@ module.exports = Self => {
JOIN vn.currency cu ON cu.id = e.currencyFk`
);
- if (ctx.args.days) {
- stmt.merge({
- sql: `
- AND t.shipped <= util.VN_CURDATE() + INTERVAL ? DAY
- AND t.shipped >= util.VN_CURDATE()
- `,
- params: [ctx.args.days]
- });
+ stmt.merge(conn.makeWhere(filter.where));
+
+ const {daysAgo, daysOnward} = ctx.args;
+ if (daysOnward || daysAgo) {
+ const params = [];
+ let today = 'util.VN_CURDATE()';
+ let from = today;
+ let to = today;
+
+ if (daysAgo) {
+ from += ' - INTERVAL ? DAY';
+ params.push(daysAgo);
+ }
+ if (daysOnward) {
+ to += ' + INTERVAL ? DAY';
+ params.push(daysOnward);
+ }
+
+ const whereDays = (filter.where ? 'AND' : 'WHERE') + ` t.shipped BETWEEN ${from} AND ${to}`;
+ stmt.merge({sql: whereDays, params});
}
- stmt.merge(conn.makeSuffix(filter));
+
+ stmt.merge(conn.makePagination(filter));
const itemsIndex = stmts.push(stmt) - 1;
const sql = ParameterizedSQL.join(stmts, ';');
diff --git a/modules/entry/back/methods/entry/print.js b/modules/entry/back/methods/entry/print.js
index 11abf0788..5b9de9a69 100644
--- a/modules/entry/back/methods/entry/print.js
+++ b/modules/entry/back/methods/entry/print.js
@@ -52,7 +52,7 @@ module.exports = Self => {
await merger.add(new Uint8Array(pdfBuffer[0]));
}
- if (!merger._doc) throw new UserError('The entry does not have stickers');
+ if (!merger._doc) throw new UserError('The entry not have stickers');
await Self.rawSql(`
UPDATE buy
diff --git a/modules/entry/back/methods/entry/specs/filter.spec.js b/modules/entry/back/methods/entry/specs/filter.spec.js
index 145da170a..105838858 100644
--- a/modules/entry/back/methods/entry/specs/filter.spec.js
+++ b/modules/entry/back/methods/entry/specs/filter.spec.js
@@ -39,7 +39,7 @@ describe('Entry filter()', () => {
const result = await models.Entry.filter(ctx, options);
- expect(result.length).toEqual(12);
+ expect(result.length).toEqual(11);
await tx.rollback();
} catch (e) {
@@ -49,13 +49,13 @@ describe('Entry filter()', () => {
});
describe('should return the entry matching the supplier', () => {
- it('when userId is supplier ', async() => {
+ it('when userId is supplier and searching days onward', async() => {
const tx = await models.Entry.beginTransaction({});
const options = {transaction: tx};
try {
const ctx = {
- args: {days: 6},
+ args: {daysOnward: 6},
req: {accessToken: {userId: 1102}}
};
@@ -70,6 +70,27 @@ describe('Entry filter()', () => {
}
});
+ it('when userId is supplier and searching days ago', async() => {
+ const tx = await models.Entry.beginTransaction({});
+ const options = {transaction: tx};
+
+ try {
+ const ctx = {
+ args: {daysAgo: 31},
+ req: {accessToken: {userId: 1102}}
+ };
+
+ const result = await models.Entry.filter(ctx, options);
+
+ expect(result.length).toEqual(6);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+
it('when userId is supplier fetching other supplier', async() => {
const tx = await models.Entry.beginTransaction({});
const options = {transaction: tx};
@@ -131,7 +152,7 @@ describe('Entry filter()', () => {
const result = await models.Entry.filter(ctx, options);
- expect(result.length).toEqual(11);
+ expect(result.length).toEqual(10);
await tx.rollback();
} catch (e) {
diff --git a/modules/entry/back/model-config.json b/modules/entry/back/model-config.json
index 85f5e8285..5c45b6e07 100644
--- a/modules/entry/back/model-config.json
+++ b/modules/entry/back/model-config.json
@@ -29,4 +29,4 @@
"StockBought": {
"dataSource": "vn"
}
-}
\ No newline at end of file
+}
diff --git a/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js b/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js
index bf7e7d3cb..2fad1afd8 100644
--- a/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js
+++ b/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js
@@ -64,7 +64,7 @@ module.exports = Self => {
try {
const client = await models.Client.findById(args.clientId, {
fields: ['id', 'hasToInvoiceByAddress']
- }, options);
+ }, myOptions);
if (client.hasToInvoiceByAddress) {
await Self.rawSql('CALL ticketToInvoiceByAddress(?, ?, ?, ?)', [
@@ -72,13 +72,13 @@ module.exports = Self => {
args.maxShipped,
args.addressId,
args.companyFk
- ], options);
+ ], myOptions);
} else {
await Self.rawSql('CALL invoiceFromClient(?, ?, ?)', [
args.maxShipped,
client.id,
args.companyFk
- ], options);
+ ], myOptions);
}
const invoiceId = await models.Ticket.makeInvoice(
@@ -87,7 +87,7 @@ module.exports = Self => {
args.companyFk,
args.invoiceDate,
null,
- options
+ myOptions
);
if (tx) await tx.commit();
diff --git a/modules/item/back/methods/item-shelving/updateFromSale.js b/modules/item/back/methods/item-shelving/updateFromSale.js
index 167509074..47ca2a010 100644
--- a/modules/item/back/methods/item-shelving/updateFromSale.js
+++ b/modules/item/back/methods/item-shelving/updateFromSale.js
@@ -38,9 +38,13 @@ module.exports = Self => {
const itemShelving = itemShelvingSale.itemShelving();
const quantity = itemShelving.visible + itemShelvingSale.quantity;
+ const available = itemShelving.available + itemShelvingSale.quantity;
await itemShelving.updateAttributes(
- {visible: quantity},
+ {
+ visible: quantity,
+ available: available
+ },
myOptions
);
if (tx) await tx.commit();
diff --git a/modules/ticket/back/methods/sale-tracking/setPicked.js b/modules/ticket/back/methods/sale-tracking/setPicked.js
index ed3656cf4..b63a0474f 100644
--- a/modules/ticket/back/methods/sale-tracking/setPicked.js
+++ b/modules/ticket/back/methods/sale-tracking/setPicked.js
@@ -75,7 +75,11 @@ module.exports = Self => {
const itemShelving = await models.ItemShelving.findById(itemShelvingFk, null, myOptions);
- await itemShelving.updateAttributes({visible: itemShelving.visible - quantity}, myOptions);
+ await itemShelving.updateAttributes(
+ {
+ visible: itemShelving.visible - quantity,
+ available: itemShelving.available - quantity
+ }, myOptions);
await Self.updateAll(
{saleFk},
diff --git a/modules/ticket/back/methods/sale/clone.js b/modules/ticket/back/methods/sale/clone.js
index 24346f3ba..0b658a69e 100644
--- a/modules/ticket/back/methods/sale/clone.js
+++ b/modules/ticket/back/methods/sale/clone.js
@@ -142,12 +142,19 @@ module.exports = Self => {
ctx.args.addressId = ticket.addressFk;
const newTicket = await models.Ticket.new(ctx, myOptions);
-
- await models.TicketRefund.create({
- originalTicketFk: ticketId,
- refundTicketFk: newTicket.id
- }, myOptions);
-
+ const existingRefund = await models.TicketRefund.findOne({
+ where: {
+ originalTicketFk: ticketId,
+ refundTicketFk: newTicket.id
+ },
+ myOptions
+ });
+ if (!existingRefund) {
+ await models.TicketRefund.create({
+ originalTicketFk: ticketId,
+ refundTicketFk: newTicket.id
+ }, myOptions);
+ }
return newTicket;
}
};
diff --git a/modules/travel/back/methods/travel/saveThermograph.js b/modules/travel/back/methods/travel/saveThermograph.js
index d246d8149..6f7e1c8bf 100644
--- a/modules/travel/back/methods/travel/saveThermograph.js
+++ b/modules/travel/back/methods/travel/saveThermograph.js
@@ -117,7 +117,8 @@ module.exports = Self => {
result: state,
maxTemperature,
minTemperature,
- temperatureFk
+ temperatureFk,
+ warehouseFk: warehouseId,
}, myOptions);
if (tx) await tx.commit();
diff --git a/modules/travel/back/methods/travel/specs/saveThermograph.spec.js b/modules/travel/back/methods/travel/specs/saveThermograph.spec.js
index c7d848c08..c2da4234e 100644
--- a/modules/travel/back/methods/travel/specs/saveThermograph.spec.js
+++ b/modules/travel/back/methods/travel/specs/saveThermograph.spec.js
@@ -4,7 +4,7 @@ describe('Thermograph saveThermograph()', () => {
const ctx = beforeAll.getCtx();
const travelFk = 1;
const thermographId = '138350-0';
- const warehouseFk = '1';
+ const warehouseFk = 1;
const state = 'COMPLETED';
const maxTemperature = 30;
const minTemperature = 10;
@@ -41,7 +41,7 @@ describe('Thermograph saveThermograph()', () => {
maxTemperature,
minTemperature,
temperatureFk,
- null,
+ warehouseFk,
null,
null,
null,
diff --git a/modules/travel/front/basic-data/index.html b/modules/travel/front/basic-data/index.html
deleted file mode 100644
index 783208d9a..000000000
--- a/modules/travel/front/basic-data/index.html
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
-
-
-
diff --git a/modules/travel/front/basic-data/index.js b/modules/travel/front/basic-data/index.js
deleted file mode 100644
index 581fd71e5..000000000
--- a/modules/travel/front/basic-data/index.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-
-class Controller extends Section {
- onSubmit() {
- return this.$.watcher.submit().then(() =>
- this.card.reload()
- );
- }
-}
-
-ngModule.vnComponent('vnTravelBasicData', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- travel: '<'
- },
- require: {
- card: '^vnTravelCard'
- }
-});
diff --git a/modules/travel/front/basic-data/index.spec.js b/modules/travel/front/basic-data/index.spec.js
deleted file mode 100644
index 11894d6e0..000000000
--- a/modules/travel/front/basic-data/index.spec.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import './index.js';
-
-describe('Travel Component vnTravelBasicData', () => {
- let controller;
-
- beforeEach(angular.mock.module('travel', $translateProvider => {
- $translateProvider.translations('en', {});
- }));
-
- beforeEach(inject($componentController => {
- const $element = angular.element('');
- controller = $componentController('vnTravelBasicData', {$element});
- controller.card = {reload: () => {}};
- controller.$.watcher = {submit: () => {}};
- }));
-
- describe('onSubmit()', () => {
- it('should call the card reload method after the watcher submits', done => {
- jest.spyOn(controller.card, 'reload');
- jest.spyOn(controller.$.watcher, 'submit').mockReturnValue(Promise.resolve());
-
- controller.onSubmit().then(() => {
- expect(controller.card.reload).toHaveBeenCalledWith();
- done();
- }).catch(done.fail);
- });
- });
-});
diff --git a/modules/travel/front/basic-data/locale/es.yml b/modules/travel/front/basic-data/locale/es.yml
deleted file mode 100644
index d95675612..000000000
--- a/modules/travel/front/basic-data/locale/es.yml
+++ /dev/null
@@ -1 +0,0 @@
-Undo changes: Deshacer cambios
diff --git a/modules/travel/front/card/index.html b/modules/travel/front/card/index.html
deleted file mode 100644
index 91964be21..000000000
--- a/modules/travel/front/card/index.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/modules/travel/front/card/index.js b/modules/travel/front/card/index.js
deleted file mode 100644
index d46244cb5..000000000
--- a/modules/travel/front/card/index.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import ngModule from '../module';
-import ModuleCard from 'salix/components/module-card';
-
-class Controller extends ModuleCard {
- reload() {
- let filter = {
- include: [
- {
- relation: 'warehouseIn',
- scope: {
- fields: ['id', 'name']
- }
- }, {
- relation: 'warehouseOut',
- scope: {
- fields: ['id', 'name']
- }
- }
- ]
- };
-
- this.$http.get(`Travels/${this.$params.id}`, {filter})
- .then(response => this.travel = response.data);
- }
-}
-
-ngModule.vnComponent('vnTravelCard', {
- template: require('./index.html'),
- controller: Controller
-});
-
diff --git a/modules/travel/front/create/index.html b/modules/travel/front/create/index.html
deleted file mode 100644
index 593887a22..000000000
--- a/modules/travel/front/create/index.html
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
diff --git a/modules/travel/front/create/index.js b/modules/travel/front/create/index.js
deleted file mode 100644
index a85917ca8..000000000
--- a/modules/travel/front/create/index.js
+++ /dev/null
@@ -1,48 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-
-class Controller extends Section {
- $onChanges() {
- if (this.$params && this.$params.q)
- this.travel = JSON.parse(this.$params.q);
- }
-
- onShippedChange(value) {
- let hasFilledProperties;
- let hasAgencyMode;
- if (this.travel) {
- hasAgencyMode = Boolean(this.travel.agencyModeFk);
- hasFilledProperties = this.travel.landed || this.travel.warehouseInFk || this.travel.warehouseOutFk;
- }
- if (!hasAgencyMode || hasFilledProperties)
- return;
-
- const query = `travels/getAverageDays`;
- const params = {
- agencyModeFk: this.travel.agencyModeFk
- };
- this.$http.get(query, {params}).then(res => {
- if (!res.data)
- return;
-
- const landed = new Date(value);
- const futureDate = landed.getDate() + res.data.dayDuration;
- landed.setDate(futureDate);
-
- this.travel.landed = landed;
- this.travel.warehouseInFk = res.data.warehouseInFk;
- this.travel.warehouseOutFk = res.data.warehouseOutFk;
- });
- }
-
- onSubmit() {
- return this.$.watcher.submit().then(
- res => this.$state.go('travel.card.basicData', {id: res.data.id})
- );
- }
-}
-
-ngModule.vnComponent('vnTravelCreate', {
- template: require('./index.html'),
- controller: Controller
-});
diff --git a/modules/travel/front/create/index.spec.js b/modules/travel/front/create/index.spec.js
deleted file mode 100644
index cdff8cfb9..000000000
--- a/modules/travel/front/create/index.spec.js
+++ /dev/null
@@ -1,88 +0,0 @@
-import './index';
-import watcher from 'core/mocks/watcher';
-
-describe('Travel Component vnTravelCreate', () => {
- let $scope;
- let $state;
- let controller;
- let $httpBackend;
-
- beforeEach(ngModule('travel'));
-
- beforeEach(inject(($componentController, $rootScope, _$state_, _$httpBackend_) => {
- $httpBackend = _$httpBackend_;
- $scope = $rootScope.$new();
- $state = _$state_;
- $scope.watcher = watcher;
- const $element = angular.element('');
- controller = $componentController('vnTravelCreate', {$element, $scope});
- }));
-
- describe('onSubmit()', () => {
- it(`should call submit() on the watcher then expect a callback`, () => {
- jest.spyOn($state, 'go');
-
- controller.onSubmit();
-
- expect(controller.$state.go).toHaveBeenCalledWith('travel.card.basicData', {id: 1234});
- });
- });
-
- describe('$onChanges()', () => {
- it('should update the travel data when $params.q is defined', () => {
- controller.$params = {q: '{"ref": 1,"agencyModeFk": 1}'};
-
- const params = {q: '{"ref": 1, "agencyModeFk": 1}'};
- const json = JSON.parse(params.q);
-
- controller.$onChanges();
-
- expect(controller.travel).toEqual(json);
- });
- });
-
- describe('onShippedChange()', () => {
- it(`should do nothing if there's no agencyModeFk in the travel.`, () => {
- controller.travel = {};
- controller.onShippedChange();
-
- expect(controller.travel.landed).toBeUndefined();
- expect(controller.travel.warehouseInFk).toBeUndefined();
- expect(controller.travel.warehouseOutFk).toBeUndefined();
- });
-
- it(`should do nothing if there's no response data.`, () => {
- controller.travel = {agencyModeFk: 4};
- const tomorrow = Date.vnNew();
-
- const query = `travels/getAverageDays?agencyModeFk=${controller.travel.agencyModeFk}`;
- $httpBackend.expectGET(query).respond(undefined);
- controller.onShippedChange(tomorrow);
- $httpBackend.flush();
-
- expect(controller.travel.warehouseInFk).toBeUndefined();
- expect(controller.travel.warehouseOutFk).toBeUndefined();
- expect(controller.travel.dayDuration).toBeUndefined();
- });
-
- it(`should fill the fields when it's selected a date and agency.`, () => {
- controller.travel = {agencyModeFk: 1};
- const tomorrow = Date.vnNew();
- tomorrow.setDate(tomorrow.getDate() + 9);
- const expectedResponse = {
- id: 8,
- dayDuration: 9,
- warehouseInFk: 5,
- warehouseOutFk: 1
- };
-
- const query = `travels/getAverageDays?agencyModeFk=${controller.travel.agencyModeFk}`;
- $httpBackend.expectGET(query).respond(expectedResponse);
- controller.onShippedChange(tomorrow);
- $httpBackend.flush();
-
- expect(controller.travel.warehouseInFk).toEqual(expectedResponse.warehouseInFk);
- expect(controller.travel.warehouseOutFk).toEqual(expectedResponse.warehouseOutFk);
- });
- });
-});
diff --git a/modules/travel/front/descriptor-menu/index.html b/modules/travel/front/descriptor-menu/index.html
deleted file mode 100644
index 19831860b..000000000
--- a/modules/travel/front/descriptor-menu/index.html
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
- Clone travel
-
-
- Clone travel and his entries
-
-
- Delete travel
-
-
- Add entry
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/modules/travel/front/descriptor-menu/index.js b/modules/travel/front/descriptor-menu/index.js
deleted file mode 100644
index f68502ec3..000000000
--- a/modules/travel/front/descriptor-menu/index.js
+++ /dev/null
@@ -1,95 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-import './style.scss';
-
-class Controller extends Section {
- constructor($element, $) {
- super($element, $);
- }
-
- get travelId() {
- return this._travelId;
- }
-
- set travelId(value) {
- this._travelId = value;
-
- if (value) this.loadData();
- }
-
- loadData() {
- const filter = {
- fields: [
- 'id',
- 'ref',
- 'shipped',
- 'landed',
- 'totalEntries',
- 'agencyModeFk',
- 'warehouseInFk',
- 'warehouseOutFk',
- 'cargoSupplierFk'
- ],
- include: [
- {
- relation: 'warehouseIn',
- scope: {
- fields: ['name']
- }
- }, {
- relation: 'warehouseOut',
- scope: {
- fields: ['name']
- }
- }
- ]
- };
- this.$http.get(`Travels/${this.travelId}`, {filter})
- .then(res => this.travel = res.data);
-
- this.$http.get(`Travels/${this.travelId}/getEntries`)
- .then(res => this.entries = res.data);
- }
-
- get isBuyer() {
- return this.aclService.hasAny(['buyer']);
- }
-
- onDeleteAccept() {
- this.$http.delete(`Travels/${this.travelId}`)
- .then(() => this.$state.go('travel.index'))
- .then(() => this.vnApp.showSuccess(this.$t('Travel deleted')));
- }
-
- onCloneAccept() {
- const params = JSON.stringify({
- ref: this.travel.ref,
- agencyModeFk: this.travel.agencyModeFk,
- shipped: this.travel.shipped,
- landed: this.travel.landed,
- warehouseInFk: this.travel.warehouseInFk,
- warehouseOutFk: this.travel.warehouseOutFk
- });
- this.$state.go('travel.create', {q: params});
- }
-
- async redirectToCreateEntry() {
- this.$state.go('home');
- window.location.href = await this.vnApp.getUrl(`entry/create?travelFk=${this.travelId}`);
- }
-
- onCloneWithEntriesAccept() {
- this.$http.post(`Travels/${this.travelId}/cloneWithEntries`)
- .then(res => this.$state.go('travel.card.basicData', {id: res.data}));
- }
-}
-
-Controller.$inject = ['$element', '$scope'];
-
-ngModule.vnComponent('vnTravelDescriptorMenu', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- travelId: '<',
- }
-});
diff --git a/modules/travel/front/descriptor-menu/index.spec.js b/modules/travel/front/descriptor-menu/index.spec.js
deleted file mode 100644
index 40319e8e2..000000000
--- a/modules/travel/front/descriptor-menu/index.spec.js
+++ /dev/null
@@ -1,71 +0,0 @@
-import './index.js';
-
-describe('Travel Component vnTravelDescriptorMenu', () => {
- let controller;
- let $httpBackend;
- beforeEach(ngModule('travel'));
-
- beforeEach(inject(($componentController, _$httpBackend_) => {
- $httpBackend = _$httpBackend_;
- const $element = angular.element('');
- controller = $componentController('vnTravelDescriptorMenu', {$element});
- controller._travelId = 5;
- }));
-
- describe('onCloneAccept()', () => {
- it('should call state.go with the travel data', () => {
- jest.spyOn(controller.$state, 'go').mockReturnValue('ok');
-
- controller.travel = {
- ref: 'the ref',
- agencyModeFk: 'the agency',
- shipped: 'the shipped date',
- landed: 'the landing date',
- warehouseInFk: 'the receiver warehouse',
- warehouseOutFk: 'the sender warehouse'
- };
-
- controller.onCloneAccept();
-
- const params = JSON.stringify({
- ref: controller.travel.ref,
- agencyModeFk: controller.travel.agencyModeFk,
- shipped: controller.travel.shipped,
- landed: controller.travel.landed,
- warehouseInFk: controller.travel.warehouseInFk,
- warehouseOutFk: controller.travel.warehouseOutFk
- });
-
- expect(controller.$state.go).toHaveBeenCalledWith('travel.create', {'q': params});
- });
- });
-
- describe('onDeleteAccept()', () => {
- it('should perform a delete query', () => {
- jest.spyOn(controller.$state, 'go').mockReturnValue('ok');
- controller.travelId = 1;
-
- $httpBackend.when('GET', `Travels/${controller.travelId}`).respond(200);
- $httpBackend.when('GET', `Travels/${controller.travelId}/getEntries`).respond(200);
- $httpBackend.expect('DELETE', `Travels/${controller.travelId}`).respond(200);
- controller.onDeleteAccept();
- $httpBackend.flush();
-
- expect(controller.$state.go).toHaveBeenCalledWith('travel.index');
- });
- });
-
- describe('onCloneWithEntriesAccept()', () => {
- it('should make an HTTP query and then call to the $state.go method with the returned id', () => {
- jest.spyOn(controller.$state, 'go').mockReturnValue('ok');
-
- $httpBackend.expect('POST', `Travels/${controller.travelId}/cloneWithEntries`).respond(200, 9);
- controller.onCloneWithEntriesAccept();
- $httpBackend.flush();
-
- expect(controller.$state.go).toHaveBeenCalledWith('travel.card.basicData', {
- id: jasmine.any(Number)
- });
- });
- });
-});
diff --git a/modules/travel/front/descriptor-menu/locale/es.yml b/modules/travel/front/descriptor-menu/locale/es.yml
deleted file mode 100644
index e019d1769..000000000
--- a/modules/travel/front/descriptor-menu/locale/es.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-Clone travel: Clonar envío
-Add entry: Añadir entrada
-Clone travel and his entries: Clonar travel y sus entradas
-Do you want to clone this travel and all containing entries?: ¿Quieres clonar este travel y todas las entradas que contiene?
-Delete travel: Eliminar envío
-The travel will be deleted: El envío será eliminado
-Do you want to delete this travel?: ¿Quieres eliminar este envío?
-Travel deleted: Envío eliminado
\ No newline at end of file
diff --git a/modules/travel/front/descriptor-menu/style.scss b/modules/travel/front/descriptor-menu/style.scss
deleted file mode 100644
index beab9335e..000000000
--- a/modules/travel/front/descriptor-menu/style.scss
+++ /dev/null
@@ -1,24 +0,0 @@
-@import "./effects";
-@import "variables";
-
-vn-travel-descriptor-menu {
- & > vn-icon-button[icon="more_vert"] {
- display: flex;
- min-width: 45px;
- height: 45px;
- box-sizing: border-box;
- align-items: center;
- justify-content: center;
- }
- & > vn-icon-button[icon="more_vert"] {
- @extend %clickable;
- color: inherit;
-
- & > vn-icon {
- padding: 10px;
- }
- vn-icon {
- font-size: 1.75rem;
- }
- }
-}
\ No newline at end of file
diff --git a/modules/travel/front/descriptor-popover/index.html b/modules/travel/front/descriptor-popover/index.html
deleted file mode 100644
index 376423bbc..000000000
--- a/modules/travel/front/descriptor-popover/index.html
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/modules/travel/front/descriptor-popover/index.js b/modules/travel/front/descriptor-popover/index.js
deleted file mode 100644
index 12c5908ca..000000000
--- a/modules/travel/front/descriptor-popover/index.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import ngModule from '../module';
-import DescriptorPopover from 'salix/components/descriptor-popover';
-
-class Controller extends DescriptorPopover {}
-
-ngModule.vnComponent('vnTravelDescriptorPopover', {
- slotTemplate: require('./index.html'),
- controller: Controller
-});
diff --git a/modules/travel/front/descriptor/index.html b/modules/travel/front/descriptor/index.html
deleted file mode 100644
index bbf5721fd..000000000
--- a/modules/travel/front/descriptor/index.html
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/modules/travel/front/descriptor/index.js b/modules/travel/front/descriptor/index.js
deleted file mode 100644
index b1f2f53be..000000000
--- a/modules/travel/front/descriptor/index.js
+++ /dev/null
@@ -1,63 +0,0 @@
-import ngModule from '../module';
-import Descriptor from 'salix/components/descriptor';
-
-class Controller extends Descriptor {
- get travel() {
- return this.entity;
- }
-
- set travel(value) {
- this.entity = value;
- }
-
- get travelFilter() {
- let travelFilter;
- const travel = this.travel;
-
- if (travel && travel.agencyModeFk) {
- travelFilter = this.travel && JSON.stringify({
- agencyModeFk: this.travel.agencyModeFk
- });
- }
- return travelFilter;
- }
-
- loadData() {
- const filter = {
- fields: [
- 'id',
- 'ref',
- 'shipped',
- 'landed',
- 'totalEntries',
- 'warehouseInFk',
- 'warehouseOutFk',
- 'cargoSupplierFk'
- ],
- include: [
- {
- relation: 'warehouseIn',
- scope: {
- fields: ['name']
- }
- }, {
- relation: 'warehouseOut',
- scope: {
- fields: ['name']
- }
- }
- ]
- };
-
- return this.getData(`Travels/${this.id}`, {filter})
- .then(res => this.entity = res.data);
- }
-}
-
-ngModule.vnComponent('vnTravelDescriptor', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- travel: '<'
- }
-});
diff --git a/modules/travel/front/descriptor/index.spec.js b/modules/travel/front/descriptor/index.spec.js
deleted file mode 100644
index 0a88c8607..000000000
--- a/modules/travel/front/descriptor/index.spec.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import './index.js';
-
-describe('vnTravelDescriptor', () => {
- let controller;
- let $httpBackend;
-
- beforeEach(ngModule('travel'));
-
- beforeEach(inject(($componentController, _$httpBackend_) => {
- $httpBackend = _$httpBackend_;
- controller = $componentController('vnTravelDescriptor', {$element: null});
- }));
-
- describe('loadData()', () => {
- it(`should perform a get query to store the worker data into the controller`, () => {
- const id = 1;
- const response = 'foo';
-
- $httpBackend.expectRoute('GET', `Travels/${id}`).respond(response);
- controller.id = id;
- $httpBackend.flush();
-
- expect(controller.travel).toEqual(response);
- });
- });
-});
diff --git a/modules/travel/front/descriptor/locale/es.yml b/modules/travel/front/descriptor/locale/es.yml
deleted file mode 100644
index 3e6d62735..000000000
--- a/modules/travel/front/descriptor/locale/es.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-Reference: Referencia
-Wh. In: Alm. entrada
-Wh. Out: Alm. salida
-Shipped: F. envío
-Landed: F. entrega
-Total entries: Entradas totales
\ No newline at end of file
diff --git a/modules/travel/front/extra-community-search-panel/index.html b/modules/travel/front/extra-community-search-panel/index.html
deleted file mode 100644
index c0d726718..000000000
--- a/modules/travel/front/extra-community-search-panel/index.html
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
-
-
diff --git a/modules/travel/front/extra-community-search-panel/index.js b/modules/travel/front/extra-community-search-panel/index.js
deleted file mode 100644
index 1add11dce..000000000
--- a/modules/travel/front/extra-community-search-panel/index.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import ngModule from '../module';
-import SearchPanel from 'core/components/searchbar/search-panel';
-
-class Controller extends SearchPanel {
- constructor($, $element) {
- super($, $element);
-
- this.filter = this.$.filter;
- }
-
- get shippedFrom() {
- return this.filter.shippedFrom;
- }
-
- set shippedFrom(value) {
- this.filter.shippedFrom = value;
- }
-
- get landedTo() {
- return this.filter.landedTo;
- }
-
- set landedTo(value) {
- this.filter.landedTo = value;
- }
-}
-
-ngModule.vnComponent('vnExtraCommunitySearchPanel', {
- template: require('./index.html'),
- controller: Controller
-});
diff --git a/modules/travel/front/extra-community/index.html b/modules/travel/front/extra-community/index.html
deleted file mode 100644
index 8132bddb1..000000000
--- a/modules/travel/front/extra-community/index.html
+++ /dev/null
@@ -1,189 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Id
- |
-
- Supplier
- |
-
- Agency
- |
-
- Amount
- |
-
- Reference
- |
-
- Packages
- |
-
- Bl. KG
- |
-
- Phy. KG
- |
-
- Vol. KG
- |
-
- Wh. Out
- |
-
- W. Shipped
- |
-
- Wh. In
- |
-
- W. Landed
- |
-
-
-
-
-
-
-
- {{::entry.id}}
-
- |
-
-
- {{::entry.supplierName}}
-
- |
- {{::entry.invoiceAmount | currency: 'EUR': 2}} |
- |
- {{::entry.reference}} |
- {{::entry.stickers}} |
- |
- {{::entry.loadedkg}} |
- {{::entry.volumeKg}} |
- |
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/modules/travel/front/extra-community/index.js b/modules/travel/front/extra-community/index.js
deleted file mode 100644
index 6e9c39f43..000000000
--- a/modules/travel/front/extra-community/index.js
+++ /dev/null
@@ -1,162 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-import './style.scss';
-
-class Controller extends Section {
- constructor($element, $, vnReport) {
- super($element, $);
-
- this.vnReport = vnReport;
-
- const draggable = this.element.querySelector('.travel-list');
- draggable.addEventListener('dragstart',
- event => this.dragStart(event));
- draggable.addEventListener('dragend',
- event => this.dragEnd(event));
-
- draggable.addEventListener('dragover',
- event => this.dragOver(event));
- draggable.addEventListener('dragenter',
- event => this.dragEnter(event));
- draggable.addEventListener('dragleave',
- event => this.dragLeave(event));
-
- this.draggableElement = 'tr[draggable]';
- this.droppableElement = 'tbody[vn-droppable]';
-
- const twoDays = 2;
- const shippedFrom = Date.vnNew();
- shippedFrom.setDate(shippedFrom.getDate() - twoDays);
- shippedFrom.setHours(0, 0, 0, 0);
-
- const sevenDays = 7;
- const landedTo = Date.vnNew();
- landedTo.setDate(landedTo.getDate() + sevenDays);
- landedTo.setHours(23, 59, 59, 59);
-
- this.defaultFilter = {
- shippedFrom: shippedFrom,
- landedTo: landedTo,
- continent: 'AM'
- };
-
- this.smartTableOptions = {};
- }
-
- onDragInterval() {
- if (this.dragClientY > 0 && this.dragClientY < 75)
- this.$window.scrollTo(0, this.$window.scrollY - 10);
-
- const maxHeight = window.screen.availHeight - (window.outerHeight - window.innerHeight);
- if (this.dragClientY > maxHeight - 75 && this.dragClientY < maxHeight)
- this.$window.scrollTo(0, this.$window.scrollY + 10);
- }
-
- findDraggable($event) {
- const target = $event.target;
- const draggable = target.closest(this.draggableElement);
-
- return draggable;
- }
-
- findDroppable($event) {
- const target = $event.target;
- const droppable = target.closest(this.droppableElement);
-
- return droppable;
- }
-
- dragStart($event) {
- const draggable = this.findDraggable($event);
- draggable.classList.add('dragging');
-
- const id = parseInt(draggable.id);
- this.entryId = id;
- this.entry = draggable;
- this.interval = setInterval(() => this.onDragInterval(), 50);
- }
-
- dragEnd($event) {
- const draggable = this.findDraggable($event);
- draggable.classList.remove('dragging');
- this.entryId = null;
- this.entry = null;
-
- clearInterval(this.interval);
- }
-
- onDrop($event) {
- const model = this.$.model;
- const droppable = this.findDroppable($event);
- const travelId = parseInt(droppable.id);
-
- const currentDroppable = this.entry.closest(this.droppableElement);
-
- if (currentDroppable == droppable) return;
-
- if (this.entryId && travelId) {
- const path = `Entries/${this.entryId}`;
- this.$http.patch(path, {travelFk: travelId})
- .then(() => model.refresh())
- .then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
- }
- }
-
- undrop() {
- if (!this.dropping) return;
- this.dropping.classList.remove('dropping');
- this.dropping = null;
- }
-
- dragOver($event) {
- this.dragClientY = $event.clientY;
- $event.preventDefault();
- }
-
- dragEnter($event) {
- let element = this.findDroppable($event);
- if (element) this.dropCount++;
-
- if (element != this.dropping) {
- this.undrop();
- if (element) element.classList.add('dropping');
- this.dropping = element;
- }
- }
-
- dragLeave($event) {
- let element = this.findDroppable($event);
-
- if (element) {
- this.dropCount--;
- if (this.dropCount == 0) this.undrop();
- }
- }
-
- save(id, data) {
- const endpoint = `Travels/${id}`;
- this.$http.patch(endpoint, data)
- .then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
- }
-
- get reportParams() {
- const userParams = this.$.model.userParams;
- const currentFilter = this.$.model.currentFilter;
-
- return Object.assign({
- authorization: this.vnToken.tokenMultimedia,
- filter: currentFilter
- }, userParams);
- }
-
- showReport() {
- this.vnReport.show(`Travels/extra-community-pdf`, this.reportParams);
- }
-}
-
-Controller.$inject = ['$element', '$scope', 'vnReport'];
-
-ngModule.vnComponent('vnTravelExtraCommunity', {
- template: require('./index.html'),
- controller: Controller
-});
diff --git a/modules/travel/front/extra-community/index.spec.js b/modules/travel/front/extra-community/index.spec.js
deleted file mode 100644
index 18ddee665..000000000
--- a/modules/travel/front/extra-community/index.spec.js
+++ /dev/null
@@ -1,128 +0,0 @@
-import './index.js';
-
-describe('Travel Component vnTravelExtraCommunity', () => {
- let controller;
- let $httpBackend;
-
- beforeEach(ngModule('travel'));
-
- beforeEach(inject(($componentController, _$httpBackend_) => {
- $httpBackend = _$httpBackend_;
- const $element = angular.element('');
- controller = $componentController('vnTravelExtraCommunity', {$element});
- controller.$.model = {};
- controller.$.model.refresh = jest.fn();
- }));
-
- describe('findDraggable()', () => {
- it('should find the draggable element', () => {
- const draggable = document.createElement('tr');
- draggable.setAttribute('draggable', true);
-
- const $event = new Event('dragstart');
- const target = document.createElement('div');
- draggable.appendChild(target);
- target.dispatchEvent($event);
-
- const result = controller.findDraggable($event);
-
- expect(result).toEqual(draggable);
- });
- });
-
- describe('findDroppable()', () => {
- it('should find the droppable element', () => {
- const droppable = document.createElement('tbody');
- droppable.setAttribute('vn-droppable', true);
-
- const $event = new Event('drop');
- const target = document.createElement('div');
- droppable.appendChild(target);
- target.dispatchEvent($event);
-
- const result = controller.findDroppable($event);
-
- expect(result).toEqual(droppable);
- });
- });
-
- describe('dragStart()', () => {
- it(`should add the class "dragging" to the draggable element
- and then set the entryId controller property`, () => {
- const draggable = document.createElement('tr');
- draggable.setAttribute('draggable', true);
- draggable.setAttribute('id', 3);
-
- jest.spyOn(controller, 'findDraggable').mockReturnValue(draggable);
-
- const $event = new Event('dragStart');
- controller.dragStart($event);
-
- const firstClass = draggable.classList[0];
-
- expect(firstClass).toEqual('dragging');
- expect(controller.entryId).toEqual(3);
- expect(controller.entry).toEqual(draggable);
- });
- });
-
- describe('dragEnd()', () => {
- it(`should remove the class "dragging" from the draggable element
- and then set the entryId controller property to null`, () => {
- const draggable = document.createElement('tr');
- draggable.setAttribute('draggable', true);
- draggable.setAttribute('id', 3);
- draggable.classList.add('dragging');
-
- jest.spyOn(controller, 'findDraggable').mockReturnValue(draggable);
-
- const $event = new Event('dragStart');
- controller.dragEnd($event);
-
- const classList = draggable.classList;
-
- expect(classList.length).toEqual(0);
- expect(controller.entryId).toBeNull();
- expect(controller.entry).toBeNull();
- });
- });
-
- describe('onDrop()', () => {
- it('should make an HTTP patch query', () => {
- const droppable = document.createElement('tbody');
- droppable.setAttribute('vn-droppable', true);
- droppable.setAttribute('id', 1);
-
- jest.spyOn(controller, 'findDroppable').mockReturnValue(droppable);
-
- const oldDroppable = document.createElement('tbody');
- oldDroppable.setAttribute('vn-droppable', true);
- const entry = document.createElement('div');
- oldDroppable.appendChild(entry);
-
- controller.entryId = 3;
- controller.entry = entry;
-
- const $event = new Event('drop');
- const expectedData = {travelFk: 1};
- $httpBackend.expect('PATCH', `Entries/3`, expectedData).respond(200);
- controller.onDrop($event);
- $httpBackend.flush();
- });
- });
-
- describe('save()', () => {
- it('should make an HTTP query', () => {
- jest.spyOn(controller.vnApp, 'showSuccess');
-
- const travelId = 1;
- const data = {ref: 'New reference'};
- const expectedData = {ref: 'New reference'};
- $httpBackend.expect('PATCH', `Travels/${travelId}`, expectedData).respond(200);
- controller.save(travelId, data);
- $httpBackend.flush();
-
- expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
- });
- });
-});
diff --git a/modules/travel/front/extra-community/locale/es.yml b/modules/travel/front/extra-community/locale/es.yml
deleted file mode 100644
index ed6179c91..000000000
--- a/modules/travel/front/extra-community/locale/es.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-Family: Familia
-Extra community: Extra comunitarios
-Freighter: Transitario
-Bl. KG: KG Bloq.
-Phy. KG: KG físico
-Vol. KG: KG Vol.
-Search by travel id or reference: Buscar por id de travel o referencia
-Search by extra community travel: Buscar por envío extra comunitario
-Continent Out: Cont. salida
-W. Shipped: F. envío
-W. Landed: F. llegada
diff --git a/modules/travel/front/extra-community/style.scss b/modules/travel/front/extra-community/style.scss
deleted file mode 100644
index fb64822f9..000000000
--- a/modules/travel/front/extra-community/style.scss
+++ /dev/null
@@ -1,67 +0,0 @@
-@import "variables";
-
-vn-travel-extra-community {
- .header {
- margin-bottom: 16px;
- line-height: 1;
- padding: 7px;
- padding-bottom: 7px;
- padding-bottom: 4px;
- font-weight: lighter;
- background-color: $color-bg;
- color: white;
- border-bottom: 1px solid #f7931e;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- cursor: pointer;
- .multi-line{
- padding-top: 15px;
- padding-bottom: 15px;
- }
- }
-
- table[vn-droppable] {
- border-radius: 0;
- }
-
- tr[draggable] {
- transition: all .5s;
- cursor: move;
- overflow: auto;
- outline: 0;
- height: 65px;
- pointer-events: fill;
- user-select: all;
- }
-
- tr[draggable] *::selection {
- background-color: transparent;
- }
-
- tr[draggable]:hover {
- background-color: $color-hover-cd;
- }
-
- tr[draggable].dragging {
- background-color: $color-primary-light;
- color: $color-font-light;
- font-weight: bold;
- }
-
-
- .multi-line{
- max-width: 200px;
- word-wrap: normal;
- white-space: normal;
- }
-
- vn-td-editable text {
- background-color: transparent;
- padding: 0;
- border: 0;
- border-bottom: 1px dashed $color-active;
- border-radius: 0;
- color: $color-active
- }
-}
diff --git a/modules/travel/front/index.js b/modules/travel/front/index.js
index e4375c59d..a7209a0bd 100644
--- a/modules/travel/front/index.js
+++ b/modules/travel/front/index.js
@@ -1,18 +1,3 @@
export * from './module';
import './main';
-import './index/';
-import './search-panel';
-import './descriptor';
-import './card';
-import './summary';
-import './basic-data';
-import './log';
-import './create';
-import './thermograph/index/';
-import './thermograph/create/';
-import './thermograph/edit/';
-import './descriptor-popover';
-import './descriptor-menu';
-import './extra-community';
-import './extra-community-search-panel';
diff --git a/modules/travel/front/index/index.html b/modules/travel/front/index/index.html
deleted file mode 100644
index a768e4a29..000000000
--- a/modules/travel/front/index/index.html
+++ /dev/null
@@ -1,107 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- Reference
- Agency
- Warehouse Out
- Shipped
-
- Warehouse In
- Landed
-
- Total entries
-
-
-
-
-
- {{::travel.ref}}
- {{::travel.agencyModeName}}
- {{::travel.warehouseOutName}}
-
-
- {{::travel.shipped | date:'dd/MM/yyyy'}}
-
-
-
-
-
-
- {{::travel.warehouseInName}}
-
-
- {{::travel.landed | date:'dd/MM/yyyy'}}
-
-
-
-
-
-
- {{::travel.totalEntries}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/modules/travel/front/index/index.js b/modules/travel/front/index/index.js
deleted file mode 100644
index a570146fe..000000000
--- a/modules/travel/front/index/index.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-import './style.scss';
-
-export default class Controller extends Section {
- preview(travel) {
- this.travelSelected = travel;
- this.$.summary.show();
- }
-
- onCloneAccept(travel) {
- const params = JSON.stringify({
- ref: travel.ref,
- agencyModeFk: travel.agencyModeFk,
- shipped: travel.shipped,
- landed: travel.landed,
- warehouseInFk: travel.warehouseInFk,
- warehouseOutFk: travel.warehouseOutFk
- });
- this.$state.go('travel.create', {q: params});
- }
-
- compareDate(date) {
- let today = Date.vnNew();
- today.setHours(0, 0, 0, 0);
-
- date = new Date(date);
- date.setHours(0, 0, 0, 0);
-
- const timeDifference = today - date;
- if (timeDifference == 0) return 'warning';
- if (timeDifference < 0) return 'success';
- }
-}
-
-ngModule.vnComponent('vnTravelIndex', {
- template: require('./index.html'),
- controller: Controller
-});
diff --git a/modules/travel/front/index/index.spec.js b/modules/travel/front/index/index.spec.js
deleted file mode 100644
index 9083c4519..000000000
--- a/modules/travel/front/index/index.spec.js
+++ /dev/null
@@ -1,78 +0,0 @@
-import './index.js';
-
-describe('Travel Component vnTravelIndex', () => {
- let controller;
- let travel = {
- id: 1,
- warehouseInFk: 1,
- totalEntries: 3,
- isDelivered: false
- };
-
- beforeEach(ngModule('travel'));
-
- beforeEach(inject($componentController => {
- const $element = angular.element('');
- controller = $componentController('vnTravelIndex', {$element});
- controller.$.summary = {show: jasmine.createSpy('show')};
- }));
-
- describe('preview()', () => {
- it('should show the dialog summary', () => {
- let event = new MouseEvent('click', {
- bubbles: true,
- cancelable: true
- });
- controller.preview(event, travel);
-
- expect(controller.$.summary.show).toHaveBeenCalledWith();
- });
- });
-
- describe('onCloneAccept()', () => {
- it('should call go() then update travelSelected in the controller', () => {
- jest.spyOn(controller.$state, 'go');
-
- const travel = {
- ref: 1,
- agencyModeFk: 1
- };
- const travelParams = {
- ref: travel.ref,
- agencyModeFk: travel.agencyModeFk
- };
- const queryParams = JSON.stringify(travelParams);
- controller.onCloneAccept(travel);
-
- expect(controller.$state.go).toHaveBeenCalledWith('travel.create', {q: queryParams});
- });
- });
-
- describe('compareDate()', () => {
- it('should return warning if the date passed to compareDate() is todays', () => {
- const today = Date.vnNew();
-
- const result = controller.compareDate(today);
-
- expect(result).toEqual('warning');
- });
-
- it('should return success if the date passed to compareDate() is in the future', () => {
- const tomorrow = Date.vnNew();
- tomorrow.setDate(tomorrow.getDate() + 1);
-
- const result = controller.compareDate(tomorrow);
-
- expect(result).toEqual('success');
- });
-
- it('should return undefined if the date passed to compareDate() is in the past', () => {
- const yesterday = Date.vnNew();
- yesterday.setDate(yesterday.getDate() - 1);
-
- const result = controller.compareDate(yesterday);
-
- expect(result).toBeUndefined();
- });
- });
-});
diff --git a/modules/travel/front/index/locale/es.yml b/modules/travel/front/index/locale/es.yml
deleted file mode 100644
index 5ce4c502f..000000000
--- a/modules/travel/front/index/locale/es.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-Do you want to clone this travel?: ¿Desea clonar este envio?
-All it's properties will be copied: Todas sus propiedades serán copiadas
-Clone: Clonar
\ No newline at end of file
diff --git a/modules/travel/front/index/style.scss b/modules/travel/front/index/style.scss
deleted file mode 100644
index ca1cf538b..000000000
--- a/modules/travel/front/index/style.scss
+++ /dev/null
@@ -1,11 +0,0 @@
-@import "variables";
-
-vn-travel-index {
- vn-icon {
- color: $color-font-secondary
- }
-
- vn-icon.active {
- color: $color-success
- }
-}
diff --git a/modules/travel/front/log/index.html b/modules/travel/front/log/index.html
deleted file mode 100644
index fc4622e5a..000000000
--- a/modules/travel/front/log/index.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/modules/travel/front/log/index.js b/modules/travel/front/log/index.js
deleted file mode 100644
index 7af601b5c..000000000
--- a/modules/travel/front/log/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-
-ngModule.vnComponent('vnTravelLog', {
- template: require('./index.html'),
- controller: Section,
-});
diff --git a/modules/travel/front/main/index.html b/modules/travel/front/main/index.html
index 131d9409e..e69de29bb 100644
--- a/modules/travel/front/main/index.html
+++ b/modules/travel/front/main/index.html
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/modules/travel/front/main/index.js b/modules/travel/front/main/index.js
index 6a153f21a..37dcbb0dc 100644
--- a/modules/travel/front/main/index.js
+++ b/modules/travel/front/main/index.js
@@ -5,6 +5,10 @@ export default class Travel extends ModuleMain {
constructor() {
super();
}
+ async $onInit() {
+ this.$state.go('home');
+ window.location.href = await this.vnApp.getUrl(`travel/`);
+ }
}
ngModule.vnComponent('vnTravel', {
diff --git a/modules/travel/front/routes.json b/modules/travel/front/routes.json
index 5a63620d4..6ae61bd02 100644
--- a/modules/travel/front/routes.json
+++ b/modules/travel/front/routes.json
@@ -27,80 +27,6 @@
"state": "travel.index",
"component": "vn-travel-index",
"description": "Travels"
- }, {
- "url": "/:id",
- "state": "travel.card",
- "abstract": true,
- "component": "vn-travel-card"
- }, {
- "url": "/summary",
- "state": "travel.card.summary",
- "component": "vn-travel-summary",
- "description": "Summary",
- "params": {
- "travel": "$ctrl.travel"
- }
- }, {
- "url": "/basic-data",
- "state": "travel.card.basicData",
- "component": "vn-travel-basic-data",
- "description": "Basic data",
- "acl": ["buyer","logistic"],
- "params": {
- "travel": "$ctrl.travel"
- }
- }, {
- "url" : "/log",
- "state": "travel.card.log",
- "component": "vn-travel-log",
- "description": "Log"
- }, {
- "url": "/create?q",
- "state": "travel.create",
- "component": "vn-travel-create",
- "description": "New travel"
- }, {
- "url": "/thermograph",
- "state": "travel.card.thermograph",
- "abstract": true,
- "component": "ui-view"
- }, {
- "url" : "/index",
- "state": "travel.card.thermograph.index",
- "component": "vn-travel-thermograph-index",
- "description": "Thermographs",
- "params": {
- "travel": "$ctrl.travel"
- },
- "acl": ["buyer"]
- }, {
- "url" : "/create",
- "state": "travel.card.thermograph.create",
- "component": "vn-travel-thermograph-create",
- "description": "Add thermograph",
- "params": {
- "travel": "$ctrl.travel"
- },
- "acl": ["buyer"]
- }, {
- "url" : "/:thermographId/edit",
- "state": "travel.card.thermograph.edit",
- "component": "vn-travel-thermograph-edit",
- "description": "Edit thermograph",
- "params": {
- "travel": "$ctrl.travel"
- },
- "acl": ["buyer"]
- },
- {
- "url": "/extra-community?q",
- "state": "travel.extraCommunity",
- "component": "vn-travel-extra-community",
- "description": "Extra community",
- "acl": ["buyer"],
- "params": {
- "travel": "$ctrl.travel"
- }
}
]
}
diff --git a/modules/travel/front/search-panel/index.html b/modules/travel/front/search-panel/index.html
deleted file mode 100644
index dd8d98af1..000000000
--- a/modules/travel/front/search-panel/index.html
+++ /dev/null
@@ -1,146 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Id/{{$ctrl.$t('Reference')}}: {{$ctrl.filter.search}}
-
-
- {{$ctrl.$t('Agency')}}: {{agency.selection.name}}
-
-
- {{$ctrl.$t('Warehouse Out')}}: {{warehouseOut.selection.name}}
-
-
- {{$ctrl.$t('Warehouse In')}}: {{warehouseIn.selection.name}}
-
-
- {{$ctrl.$t('Days onward')}}: {{$ctrl.filter.scopeDays}}
-
-
- {{$ctrl.$t('Landed from')}}: {{$ctrl.filter.landedFrom | date:'dd/MM/yyyy'}}
-
-
- {{$ctrl.$t('Landed to')}}: {{$ctrl.filter.landedTo | date:'dd/MM/yyyy'}}
-
-
- {{$ctrl.$t('Continent Out')}}: {{continent.selection.name}}
-
-
- {{$ctrl.$t('Total entries')}}: {{$ctrl.filter.totalEntries}}
-
-
-
diff --git a/modules/travel/front/search-panel/index.js b/modules/travel/front/search-panel/index.js
deleted file mode 100644
index 5969a8c3f..000000000
--- a/modules/travel/front/search-panel/index.js
+++ /dev/null
@@ -1,72 +0,0 @@
-import ngModule from '../module';
-import SearchPanel from 'core/components/searchbar/search-panel';
-import './style.scss';
-
-class Controller extends SearchPanel {
- constructor($, $element) {
- super($, $element);
- this.initFilter();
- this.fetchData();
- }
-
- $onChanges() {
- if (this.model)
- this.applyFilters();
- }
-
- fetchData() {
- this.$http.get('AgencyModes').then(res => {
- this.agencyModes = res.data;
- });
- this.$http.get('Warehouses').then(res => {
- this.warehouses = res.data;
- });
- this.$http.get('Continents').then(res => {
- this.continents = res.data;
- });
- }
-
- initFilter() {
- this.filter = {};
- if (this.$params.q) {
- this.filter = JSON.parse(this.$params.q);
- this.search = this.filter.search;
- this.totalEntries = this.filter.totalEntries;
- }
- if (!this.filter.scopeDays) this.filter.scopeDays = 7;
- }
-
- applyFilters(param) {
- if (this.filter?.search)
- delete this.filter.scopeDays;
-
- this.model.applyFilter({}, this.filter)
- .then(() => {
- if (param && this.model._orgData.length === 1)
- this.$state.go('travel.card.summary', {id: this.model._orgData[0].id});
- else
- this.$state.go(this.$state.current.name, {q: JSON.stringify(this.filter)}, {location: 'replace'});
- });
- }
-
- removeParamFilter(param) {
- if (this[param]) delete this[param];
- delete this.filter[param];
- this.applyFilters();
- }
-
- onKeyPress($event, param) {
- if ($event.key === 'Enter') {
- this.filter[param] = this[param];
- this.applyFilters(param === 'search');
- }
- }
-}
-
-ngModule.vnComponent('vnTravelSearchPanel', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- model: '<'
- }
-});
diff --git a/modules/travel/front/search-panel/index.spec.js b/modules/travel/front/search-panel/index.spec.js
deleted file mode 100644
index 488143e80..000000000
--- a/modules/travel/front/search-panel/index.spec.js
+++ /dev/null
@@ -1,38 +0,0 @@
-import './index';
-
-describe('Travel Component vnTravelSearchPanel', () => {
- let controller;
-
- beforeEach(ngModule('travel'));
-
- beforeEach(inject($componentController => {
- controller = $componentController('vnTravelSearchPanel', {$element: null});
- controller.$t = () => {};
- }));
-
- describe('applyFilters()', () => {
- it('should apply filters', async() => {
- controller.filter = {foo: 'bar'};
- controller.model = {
- applyFilter: jest.fn().mockResolvedValue(),
- _orgData: [{id: 1}]
- };
- controller.$state = {
- current: {
- name: 'foo'
- },
- go: jest.fn()
- };
-
- await controller.applyFilters(true);
-
- expect(controller.model.applyFilter).toHaveBeenCalledWith({}, controller.filter);
- expect(controller.$state.go).toHaveBeenCalledWith('travel.card.summary', {id: 1});
-
- await controller.applyFilters(false);
-
- expect(controller.$state.go).toHaveBeenCalledWith(controller.$state.current.name,
- {q: JSON.stringify(controller.filter)}, {location: 'replace'});
- });
- });
-});
diff --git a/modules/travel/front/search-panel/locale/es.yml b/modules/travel/front/search-panel/locale/es.yml
deleted file mode 100644
index 1f892a742..000000000
--- a/modules/travel/front/search-panel/locale/es.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-Ticket id: Id ticket
-Client id: Id cliente
-Nickname: Alias
-From: Desde
-To: Hasta
-Agency: Agencia
-Warehouse: Almacén
\ No newline at end of file
diff --git a/modules/travel/front/search-panel/style.scss b/modules/travel/front/search-panel/style.scss
deleted file mode 100644
index 0da52408a..000000000
--- a/modules/travel/front/search-panel/style.scss
+++ /dev/null
@@ -1,37 +0,0 @@
-@import "variables";
-
-vn-travel-search-panel vn-side-menu {
- .menu {
- min-width: $menu-width;
- }
- & > div {
- .input {
- padding-left: $spacing-md;
- padding-right: $spacing-md;
- border-color: $color-spacer;
- border-bottom: $border-thin;
- }
- .horizontal {
- padding-left: $spacing-md;
- padding-right: $spacing-md;
- grid-auto-flow: column;
- grid-column-gap: $spacing-sm;
- align-items: center;
- }
- .chips {
- display: flex;
- flex-wrap: wrap;
- padding: $spacing-md;
- overflow: hidden;
- max-width: 100%;
- border-color: $color-spacer;
- }
-
- .or {
- align-self: center;
- font-weight: bold;
- font-size: 26px;
- color: $color-font-secondary;
- }
- }
-}
diff --git a/modules/travel/front/summary/index.html b/modules/travel/front/summary/index.html
deleted file mode 100644
index d9dbb0f90..000000000
--- a/modules/travel/front/summary/index.html
+++ /dev/null
@@ -1,167 +0,0 @@
-
-
-
-
-
- {{$ctrl.travelData.id}} - {{$ctrl.travelData.ref}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Entries
-
-
-
- Confirmed
- Entry Id
- Supplier
- Reference
- HB
- Freight
- Package
- CC
- Pallet
- m³
-
-
-
-
-
-
-
-
-
-
-
- {{entry.id}}
-
-
- {{entry.supplierName}}
- {{entry.reference}}
- {{entry.hb}}
- {{entry.freightValue | currency: 'EUR': 2}}
- {{entry.packageValue | currency: 'EUR': 2}}
- {{entry.cc}}
- {{entry.pallet}}
- {{entry.m3}}
-
-
-
-
-
-
-
-
-
-
-
-
- {{$ctrl.total('hb')}}
- {{$ctrl.total('freightValue') | currency: 'EUR': 2}}
- {{$ctrl.total('packageValue') | currency: 'EUR': 2}}
- {{$ctrl.total('cc') | number:2}}
- {{$ctrl.total('pallet') | number:2}}
- {{$ctrl.total('m3') | number:2}}
-
-
-
-
-
-
-
-
- Thermograph
-
-
-
-
- Code
- Temperature
- State
- Destination
- Created
-
-
-
-
- {{thermograph.thermographFk}}
- {{thermograph.temperatureFk}}
- {{thermograph.result}}
- {{thermograph.warehouse.name}}
- {{thermograph.created | date: 'dd/MM/yyyy'}}
-
-
-
-
-
-
-
-
diff --git a/modules/travel/front/summary/index.js b/modules/travel/front/summary/index.js
deleted file mode 100644
index 5144a0bb5..000000000
--- a/modules/travel/front/summary/index.js
+++ /dev/null
@@ -1,71 +0,0 @@
-import ngModule from '../module';
-import Summary from 'salix/components/summary';
-import './style.scss';
-
-class Controller extends Summary {
- $onInit() {
- this.entries = [];
- }
-
- get travel() {
- return this._travel;
- }
-
- set travel(value) {
- this._travel = value;
-
- if (value && value.id) {
- this.getTravel();
- this.getEntries();
- this.getThermographs();
- }
- }
-
- getTravel() {
- return this.$http.get(`Travels/${this.travel.id}/getTravel`)
- .then(res => this.travelData = res.data);
- }
-
- getEntries() {
- return this.$http.get(`Travels/${this.travel.id}/getEntries`)
- .then(res => this.entries = res.data);
- }
-
- getThermographs() {
- const filter = {
- include: {
- relation: 'warehouse',
- scope: {
- fields: ['id', 'name']
- }
- },
- where: {
- travelFk: this.travel.id
- }
- };
-
- return this.$http.get(`TravelThermographs`, {filter})
- .then(res => this.travelThermographs = res.data);
- }
-
- total(field) {
- let total = 0;
-
- for (let entry of this.entries)
- total += entry[field];
-
- return total;
- }
-
- get isBuyer() {
- return this.aclService.hasAny(['buyer']);
- }
-}
-
-ngModule.vnComponent('vnTravelSummary', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- travel: '<'
- }
-});
diff --git a/modules/travel/front/summary/index.spec.js b/modules/travel/front/summary/index.spec.js
deleted file mode 100644
index b1b750689..000000000
--- a/modules/travel/front/summary/index.spec.js
+++ /dev/null
@@ -1,86 +0,0 @@
-import './index';
-
-describe('component vnTravelSummary', () => {
- let controller;
- let $httpBackend;
- let $scope;
- let $httpParamSerializer;
-
- beforeEach(angular.mock.module('travel', $translateProvider => {
- $translateProvider.translations('en', {});
- }));
-
- beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => {
- $httpBackend = _$httpBackend_;
- $httpParamSerializer = _$httpParamSerializer_;
- $scope = $rootScope.$new();
- const $element = angular.element(``);
- controller = $componentController('vnTravelSummary', {$element, $scope});
- }));
-
- describe('travel setter/getter', () => {
- it('should return the travel and then call both getTravel() and getEntries()', () => {
- jest.spyOn(controller, 'getTravel');
- jest.spyOn(controller, 'getEntries');
- jest.spyOn(controller, 'getThermographs');
- controller.travel = {id: 99};
-
- expect(controller._travel.id).toEqual(99);
- expect(controller.getTravel).toHaveBeenCalledWith();
- expect(controller.getEntries).toHaveBeenCalledWith();
- expect(controller.getThermographs).toHaveBeenCalledWith();
- });
- });
-
- describe('getTravel()', () => {
- it('should perform a get and then store data on the controller', () => {
- controller._travel = {id: 999};
-
- const query = `Travels/${controller._travel.id}/getTravel`;
- $httpBackend.expectGET(query).respond('I am the travelData');
- controller.getTravel();
- $httpBackend.flush();
-
- expect(controller.travelData).toEqual('I am the travelData');
- });
- });
-
- describe('getEntries()', () => {
- it('should call the getEntries method to get the entries data', () => {
- controller._travel = {id: 999};
-
- const query = `Travels/${controller._travel.id}/getEntries`;
- $httpBackend.expectGET(query).respond('I am the entries');
- controller.getEntries();
- $httpBackend.flush();
-
- expect(controller.entries).toEqual('I am the entries');
- });
- });
-
- describe('getThermographs()', () => {
- it('should call the getThermographs method to get the thermographs', () => {
- controller._travel = {id: 2};
-
- $httpBackend.expectGET(`TravelThermographs`).respond('I am the thermographs');
- controller.getThermographs();
- $httpBackend.flush();
-
- expect(controller.travelThermographs).toEqual('I am the thermographs');
- });
- });
-
- describe('total()', () => {
- it('should calculate the total amount of a given property for every row', () => {
- controller.entries = [
- {id: 1, freightValue: 1, packageValue: 2, cc: 0.01},
- {id: 2, freightValue: 1, packageValue: 2, cc: 0.01},
- {id: 3, freightValue: 1, packageValue: 2, cc: 0.01}
- ];
-
- expect(controller.total('freightValue')).toEqual(3);
- expect(controller.total('packageValue')).toEqual(6);
- expect(controller.total('cc')).toEqual(0.03);
- });
- });
-});
diff --git a/modules/travel/front/summary/locale/es.yml b/modules/travel/front/summary/locale/es.yml
deleted file mode 100644
index aa6adc938..000000000
--- a/modules/travel/front/summary/locale/es.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-Reference: Referencia
-Warehouse In: Alm. entrada
-Warehouse Out: Alm. salida
-Shipped: F. envío
-Landed: F. entrega
-Total entries: Ent. totales
-Delivered: Enviada
-Received: Recibida
-Agency: Agencia
-Entries: Entradas
-Confirmed: Confirmada
-Entry Id: Id entrada
-Supplier: Proveedor
-Pallet: Pallet
-Freight: Porte
-Package: Embalaje
-Half box: Media caja
-Go to the travel: Ir al envío
diff --git a/modules/travel/front/summary/style.scss b/modules/travel/front/summary/style.scss
deleted file mode 100644
index dd4cfa72d..000000000
--- a/modules/travel/front/summary/style.scss
+++ /dev/null
@@ -1,6 +0,0 @@
-@import "variables";
-
-
-vn-travel-summary .summary {
- max-width: $width-lg;
-}
\ No newline at end of file
diff --git a/modules/travel/front/thermograph/create/index.html b/modules/travel/front/thermograph/create/index.html
deleted file mode 100644
index 41709e1fb..000000000
--- a/modules/travel/front/thermograph/create/index.html
+++ /dev/null
@@ -1,177 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/modules/travel/front/thermograph/create/index.js b/modules/travel/front/thermograph/create/index.js
deleted file mode 100644
index 9f0678807..000000000
--- a/modules/travel/front/thermograph/create/index.js
+++ /dev/null
@@ -1,122 +0,0 @@
-import ngModule from '../../module';
-import Section from 'salix/components/section';
-import UserError from 'core/lib/user-error';
-
-class Controller extends Section {
- constructor($element, $) {
- super($element, $);
- this.dms = {files: [], state: 'Ok'};
- }
-
- get travel() {
- return this._travel;
- }
-
- set travel(value) {
- this._travel = value;
-
- if (value) {
- this.setDefaultParams();
- this.getAllowedContentTypes();
- }
- }
-
- getAllowedContentTypes() {
- this.$http.get('DmsContainers/allowedContentTypes').then(res => {
- const contentTypes = res.data.join(', ');
- this.allowedContentTypes = contentTypes;
- });
- }
-
- get contentTypesInfo() {
- return this.$t('ContentTypesInfo', {
- allowedContentTypes: this.allowedContentTypes
- });
- }
-
- setDefaultParams() {
- const params = {filter: {
- where: {code: 'miscellaneous'}
- }};
- this.$http.get('DmsTypes/findOne', {params}).then(res => {
- const dmsTypeId = res.data && res.data.id;
- const companyId = this.vnConfig.companyFk;
- const warehouseId = this.vnConfig.warehouseFk;
- const defaultParams = {
- reference: this.travel.id,
- warehouseId: warehouseId,
- companyId: companyId,
- dmsTypeId: dmsTypeId,
- description: this.$t('TravelFileDescription', {
- travelId: this.travel.id
- }).toUpperCase()
- };
-
- this.dms = Object.assign(this.dms, defaultParams);
- });
- }
-
- onAddThermographClick(event) {
- const defaultTemperature = 'cool';
- const defaultModel = 'DISPOSABLE';
-
- event.preventDefault();
- this.newThermograph = {
- thermographId: this.thermographId,
- warehouseId: this.warehouseId,
- temperatureFk: defaultTemperature,
- model: defaultModel
- };
-
- this.$.modelsModel.refresh();
- this.$.newThermographDialog.show();
- }
-
- onNewThermographAccept() {
- const hasMissingField =
- !this.newThermograph.thermographId ||
- !this.newThermograph.warehouseId ||
- !this.newThermograph.temperatureFk ||
- !this.newThermograph.model;
-
- if (hasMissingField)
- throw new UserError(`Some fields are invalid`);
-
- return this.$http.post(`Thermographs/createThermograph`, this.newThermograph)
- .then(res => this.dms.thermographId = res.data.id);
- }
-
- onSubmit() {
- const query = `Travels/${this.travel.id}/saveThermograph`;
- const options = {
- method: 'POST',
- url: query,
- params: this.dms,
- headers: {
- 'Content-Type': undefined
- },
- transformRequest: files => {
- const formData = new FormData();
-
- for (let i = 0; i < files.length; i++)
- formData.append(files[i].name, files[i]);
-
- return formData;
- },
- data: this.dms.files
- };
- this.$http(options).then(res => {
- this.vnApp.showSuccess(this.$t('Data saved!'));
- this.$.watcher.updateOriginalData();
- this.$state.go('travel.card.thermograph.index');
- });
- }
-}
-
-ngModule.vnComponent('vnTravelThermographCreate', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- travel: '<'
- }
-});
diff --git a/modules/travel/front/thermograph/create/index.spec.js b/modules/travel/front/thermograph/create/index.spec.js
deleted file mode 100644
index 1ad263d31..000000000
--- a/modules/travel/front/thermograph/create/index.spec.js
+++ /dev/null
@@ -1,108 +0,0 @@
-import './index';
-
-describe('Ticket', () => {
- describe('Component vnTravelThermographCreate', () => {
- let controller;
- let $httpBackend;
- let $httpParamSerializer;
- const travelId = 3;
- const dmsTypeId = 5;
-
- beforeEach(ngModule('travel'));
-
- beforeEach(inject(($componentController, _$httpBackend_, _$httpParamSerializer_) => {
- $httpBackend = _$httpBackend_;
- $httpParamSerializer = _$httpParamSerializer_;
- const $element = angular.element('');
- controller = $componentController('vnTravelThermographCreate', {$element});
- controller._travel = {
- id: travelId
- };
- }));
-
- describe('travel() setter', () => {
- it('should set the travel data and then call setDefaultParams() and getAllowedContentTypes()', () => {
- jest.spyOn(controller, 'setDefaultParams');
- jest.spyOn(controller, 'getAllowedContentTypes');
- controller.travel = {
- id: travelId
- };
-
- expect(controller.travel).toBeDefined();
- expect(controller.setDefaultParams).toHaveBeenCalledWith();
- expect(controller.getAllowedContentTypes).toHaveBeenCalledWith();
- });
- });
-
- describe('setDefaultParams()', () => {
- it('should perform a GET query and define the dms property on controller', () => {
- const params = {filter: {
- where: {code: 'miscellaneous'}
- }};
- let serializedParams = $httpParamSerializer(params);
- $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: dmsTypeId, code: 'miscellaneous'});
- controller.setDefaultParams();
- $httpBackend.flush();
-
- expect(controller.dms).toBeDefined();
- expect(controller.dms.reference).toEqual(travelId);
- expect(controller.dms.dmsTypeId).toEqual(dmsTypeId);
- });
- });
-
- describe('getAllowedContentTypes()', () => {
- it('should make an HTTP GET request to get the allowed content types', () => {
- const expectedResponse = ['application/pdf', 'image/png', 'image/jpg'];
- $httpBackend.expect('GET', `DmsContainers/allowedContentTypes`).respond(expectedResponse);
- controller.getAllowedContentTypes();
- $httpBackend.flush();
-
- expect(controller.allowedContentTypes).toBeDefined();
- expect(controller.allowedContentTypes).toEqual('application/pdf, image/png, image/jpg');
- });
- });
-
- describe('onAddThermographClick()', () => {
- it('should call the show() function of the create thermograph dialog', () => {
- controller.$.newThermographDialog = {show: jest.fn()};
- controller.$.modelsModel = {refresh: jest.fn()};
- controller.$.temperaturesModel = {refresh: jest.fn()};
-
- const event = new Event('click');
- jest.spyOn(event, 'preventDefault');
-
- controller.onAddThermographClick(event);
-
- expect(event.preventDefault).toHaveBeenCalledTimes(1);
- expect(controller.$.newThermographDialog.show).toHaveBeenCalledTimes(1);
- });
- });
-
- describe('onNewThermographAccept()', () => {
- it('should set the created thermograph data on to the controller for the autocomplete to use it', () => {
- const id = 'the created id';
- const warehouseId = 1;
- const temperatureId = 'cool';
- const model = 'my model';
-
- controller.newThermograph = {
- thermographId: id,
- warehouseId: warehouseId,
- temperatureFk: temperatureId,
- model: model
- };
- const response = {
- id: id,
- warehouseId: warehouseId,
- temperatureFk: temperatureId,
- model: model
- };
- $httpBackend.when('POST', `Thermographs/createThermograph`).respond(response);
- controller.onNewThermographAccept();
- $httpBackend.flush();
-
- expect(controller.dms.thermographId).toEqual(response.id);
- });
- });
- });
-});
diff --git a/modules/travel/front/thermograph/edit/index.html b/modules/travel/front/thermograph/edit/index.html
deleted file mode 100644
index 3fe448b56..000000000
--- a/modules/travel/front/thermograph/edit/index.html
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-
diff --git a/modules/travel/front/thermograph/edit/index.js b/modules/travel/front/thermograph/edit/index.js
deleted file mode 100644
index 17caf9ef2..000000000
--- a/modules/travel/front/thermograph/edit/index.js
+++ /dev/null
@@ -1,98 +0,0 @@
-import ngModule from '../../module';
-import Section from 'salix/components/section';
-import './style.scss';
-
-class Controller extends Section {
- get travel() {
- return this._travel;
- }
-
- set travel(value) {
- this._travel = value;
-
- if (value) {
- this.setDefaultParams();
- this.getAllowedContentTypes();
- }
- }
-
- getAllowedContentTypes() {
- this.$http.get('DmsContainers/allowedContentTypes').then(res => {
- const contentTypes = res.data.join(', ');
- this.allowedContentTypes = contentTypes;
- });
- }
-
- get contentTypesInfo() {
- return this.$t('ContentTypesInfo', {
- allowedContentTypes: this.allowedContentTypes
- });
- }
-
- setDefaultParams() {
- const filterObj = {include: {relation: 'dms'}};
- const filter = encodeURIComponent(JSON.stringify(filterObj));
- const path = `TravelThermographs/${this.$params.thermographId}?filter=${filter}`;
- this.$http.get(path).then(res => {
- const thermograph = res.data;
- this.thermograph = {
- thermographId: thermograph.thermographFk,
- state: thermograph.result,
- reference: thermograph.dms.reference,
- warehouseId: thermograph.dms.warehouseFk,
- companyId: thermograph.dms.companyFk,
- dmsTypeId: thermograph.dms.dmsTypeFk,
- description: thermograph.dms.description,
- hasFile: thermograph.dms.hasFile,
- hasFileAttached: false,
- files: []
- };
- });
- }
-
- onSubmit() {
- const query = `travels/${this.$params.id}/saveThermograph`;
- const options = {
- method: 'POST',
- url: query,
- params: this.thermograph,
- headers: {
- 'Content-Type': undefined
- },
- transformRequest: files => {
- const formData = new FormData();
-
- for (const element of files)
- formData.append(element.name, element);
-
- return formData;
- },
- data: this.thermograph.files
- };
- this.$http(options).then(res => {
- if (res) {
- this.vnApp.showSuccess(this.$t('Data saved!'));
- this.$.watcher.updateOriginalData();
- this.$state.go('travel.card.thermograph.index');
- }
- });
- }
-
- onFileChange(files) {
- let hasFileAttached = false;
- if (files.length > 0)
- hasFileAttached = true;
-
- this.$.$applyAsync(() => {
- this.thermograph.hasFileAttached = hasFileAttached;
- });
- }
-}
-
-ngModule.vnComponent('vnTravelThermographEdit', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- travel: '<'
- }
-});
diff --git a/modules/travel/front/thermograph/edit/index.spec.js b/modules/travel/front/thermograph/edit/index.spec.js
deleted file mode 100644
index 0b3ef4fbe..000000000
--- a/modules/travel/front/thermograph/edit/index.spec.js
+++ /dev/null
@@ -1,120 +0,0 @@
-import './index';
-import watcher from 'core/mocks/watcher.js';
-
-describe('Worker', () => {
- describe('Component vnTravelThermographEdit', () => {
- let controller;
- let $scope;
- let $httpBackend;
- let $httpParamSerializer;
-
- beforeEach(ngModule('travel'));
-
- beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => {
- $scope = $rootScope.$new();
- $httpBackend = _$httpBackend_;
- $httpParamSerializer = _$httpParamSerializer_;
- const $element = angular.element(` {
- it('should set the travel data and then call setDefaultParams() and getAllowedContentTypes()', () => {
- jest.spyOn(controller, 'setDefaultParams');
- jest.spyOn(controller, 'getAllowedContentTypes');
- controller._travel = undefined;
- controller.travel = {
- id: 3
- };
-
- expect(controller.setDefaultParams).toHaveBeenCalledWith();
- expect(controller.travel).toBeDefined();
- expect(controller.getAllowedContentTypes).toHaveBeenCalledWith();
- });
- });
-
- describe('setDefaultParams()', () => {
- it('should perform a GET query and define the dms property on controller', () => {
- const thermographId = 6;
- const expectedResponse = {
- thermographFk: 6,
- result: 'Ok',
- dms: {
- reference: '123456-01',
- warehouseFk: 1,
- companyFk: 442,
- dmsTypeFk: 3,
- description: 'Test'
- }
- };
-
- const filterObj = {include: {relation: 'dms'}};
- const filter = encodeURIComponent(JSON.stringify(filterObj));
- const query = `TravelThermographs/${thermographId}?filter=${filter}`;
- $httpBackend.expect('GET', query).respond(expectedResponse);
- controller.setDefaultParams();
- $httpBackend.flush();
-
- expect(controller.thermograph).toBeDefined();
- expect(controller.thermograph.reference).toEqual('123456-01');
- expect(controller.thermograph.dmsTypeId).toEqual(3);
- expect(controller.thermograph.state).toEqual('Ok');
- });
- });
-
- describe('onFileChange()', () => {
- it('should set dms hasFileAttached property to true if has any files', () => {
- const files = [{id: 1, name: 'MyFile'}];
- controller.thermograph = {hasFileAttached: false};
- controller.onFileChange(files);
- $scope.$apply();
-
- expect(controller.thermograph.hasFileAttached).toBeTruthy();
- });
- });
-
- describe('getAllowedContentTypes()', () => {
- it('should make an HTTP GET request to get the allowed content types', () => {
- const expectedResponse = ['image/png', 'image/jpg'];
- $httpBackend.expect('GET', `DmsContainers/allowedContentTypes`).respond(expectedResponse);
- controller.getAllowedContentTypes();
- $httpBackend.flush();
-
- expect(controller.allowedContentTypes).toBeDefined();
- expect(controller.allowedContentTypes).toEqual('image/png, image/jpg');
- });
- });
-
- describe('contentTypesInfo()', () => {
- it('should return a description with a list of allowed content types', () => {
- controller.allowedContentTypes = ['image/png', 'image/jpg'];
- const expectedTypes = controller.allowedContentTypes.join(', ');
-
- const expectedResult = `Allowed content types: ${expectedTypes}`;
- jest.spyOn(controller.$translate, 'instant').mockReturnValue(expectedResult);
-
- const result = controller.contentTypesInfo;
-
- expect(result).toEqual(expectedResult);
- });
- });
-
- describe('onSubmit()', () => {
- it('should make an HTTP POST request to save the form data', () => {
- jest.spyOn(controller.$.watcher, 'updateOriginalData');
-
- const files = [{id: 1, name: 'MyFile'}];
- controller.thermograph = {files};
- const serializedParams = $httpParamSerializer(controller.thermograph);
- const query = `travels/${controller.$params.id}/saveThermograph?${serializedParams}`;
-
- $httpBackend.expect('POST', query).respond({});
- controller.onSubmit();
- $httpBackend.flush();
- });
- });
- });
-});
diff --git a/modules/travel/front/thermograph/edit/style.scss b/modules/travel/front/thermograph/edit/style.scss
deleted file mode 100644
index 73f136fc1..000000000
--- a/modules/travel/front/thermograph/edit/style.scss
+++ /dev/null
@@ -1,7 +0,0 @@
-vn-ticket-request {
- .vn-textfield {
- margin: 0!important;
- max-width: 100px;
- }
-}
-
diff --git a/modules/travel/front/thermograph/index/index.html b/modules/travel/front/thermograph/index/index.html
deleted file mode 100644
index 4d711613d..000000000
--- a/modules/travel/front/thermograph/index/index.html
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/modules/travel/front/thermograph/index/index.js b/modules/travel/front/thermograph/index/index.js
deleted file mode 100644
index f8b239cfe..000000000
--- a/modules/travel/front/thermograph/index/index.js
+++ /dev/null
@@ -1,51 +0,0 @@
-import ngModule from '../../module';
-import Section from 'salix/components/section';
-import './style.scss';
-
-class Controller extends Section {
- constructor($element, $, vnFile) {
- super($element, $);
- this.vnFile = vnFile;
- this.filter = {
- include:
- {relation: 'warehouse',
- scope: {
- fields: ['id', 'name']
- }
- }
- };
- }
-
- showDeleteConfirm(index) {
- this.thermographIndex = index;
- this.$.confirm.show();
- }
-
- deleteThermograph() {
- const data = this.travelThermographs;
- const thermographId = data[this.thermographIndex].id;
- const query = `Travels/deleteThermograph?id=${thermographId}`;
- this.$http.delete(query).then(() => {
- this.vnApp.showSuccess(this.$t('Thermograph deleted'));
- this.$.model.remove(this.thermographIndex);
- this.thermographIndex = null;
- });
- }
-
- downloadFile(dmsId) {
- this.vnFile.download(`api/dms/${dmsId}/downloadFile`);
- }
-}
-
-Controller.$inject = ['$element', '$scope', 'vnFile'];
-
-ngModule.vnComponent('vnTravelThermographIndex', {
- template: require('./index.html'),
- controller: Controller,
- require: {
- card: '^vnTravelCard'
- },
- bindings: {
- travel: '<'
- }
-});
diff --git a/modules/travel/front/thermograph/index/style.scss b/modules/travel/front/thermograph/index/style.scss
deleted file mode 100644
index 2c287ed9d..000000000
--- a/modules/travel/front/thermograph/index/style.scss
+++ /dev/null
@@ -1,6 +0,0 @@
-@import "variables";
-
-vn-route-tickets form{
- margin: 0 auto;
- max-width: $width-lg;
-}
\ No newline at end of file
diff --git a/modules/travel/front/thermograph/locale/es.yml b/modules/travel/front/thermograph/locale/es.yml
deleted file mode 100644
index 1fdb98c8e..000000000
--- a/modules/travel/front/thermograph/locale/es.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-Code: Código
-Temperature: Temperatura
-State: Estado
-Destination: Destino
-Created: Creado
-Remove thermograph: Eliminar termógrafo
-Upload file: Subir fichero
-Edit file: Editar fichero
-Upload: Subir
-File: Fichero
-TravelFileDescription: Travel id {{travelId}}
-ContentTypesInfo: 'Tipos de archivo permitidos: {{allowedContentTypes}}'
-Are you sure you want to continue?: ¿Seguro que quieres continuar?
-Add thermograph: Añadir termógrafo
-Edit thermograph: Editar termógrafo
-Thermograph deleted: Termógrafo eliminado
-Thermograph: Termógrafo
-New thermograph: Nuevo termógrafo
-Are you sure you want to remove the thermograph?: ¿Seguro que quieres quitar el termógrafo?
-Identifier: Identificador
\ No newline at end of file
diff --git a/modules/worker/back/methods/device/handle-user.js b/modules/worker/back/methods/device/handle-user.js
index ac4ff2704..55302c1cb 100644
--- a/modules/worker/back/methods/device/handle-user.js
+++ b/modules/worker/back/methods/device/handle-user.js
@@ -82,7 +82,7 @@ module.exports = Self => {
const getDataOperator = await models.Operator.findOne({
where: {workerFk: user.id},
fields: ['numberOfWagons', 'warehouseFk', 'itemPackingTypeFk', 'sectorFk', 'sector',
- 'trainFk', 'train', 'labelerFk', 'printer'],
+ 'trainFk', 'train', 'labelerFk', 'printer', 'isOnReservationMode'],
include: [
{
relation: 'sector',
diff --git a/modules/zone/front/basic-data/index.html b/modules/zone/front/basic-data/index.html
deleted file mode 100644
index 5070a3aea..000000000
--- a/modules/zone/front/basic-data/index.html
+++ /dev/null
@@ -1,114 +0,0 @@
-
-
-
-
diff --git a/modules/zone/front/basic-data/index.js b/modules/zone/front/basic-data/index.js
deleted file mode 100644
index 402b471fc..000000000
--- a/modules/zone/front/basic-data/index.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-
-class Controller extends Section {
- onSubmit() {
- this.$.watcher.submit().then(() =>
- this.card.reload()
- );
- }
-}
-
-ngModule.vnComponent('vnZoneBasicData', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- zone: '<'
- },
- require: {
- card: '^vnZoneCard'
- }
-});
diff --git a/modules/zone/front/calendar/index.html b/modules/zone/front/calendar/index.html
deleted file mode 100644
index cfcebf359..000000000
--- a/modules/zone/front/calendar/index.html
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/modules/zone/front/calendar/index.js b/modules/zone/front/calendar/index.js
deleted file mode 100644
index 288a8f328..000000000
--- a/modules/zone/front/calendar/index.js
+++ /dev/null
@@ -1,191 +0,0 @@
-import ngModule from '../module';
-import Component from 'core/lib/component';
-import './style.scss';
-
-class Controller extends Component {
- constructor($element, $, vnWeekDays) {
- super($element, $);
- this.vnWeekDays = vnWeekDays;
- this.nMonths = 4;
-
- let date = Date.vnNew();
- date.setDate(1);
- date.setHours(0, 0, 0, 0);
- this.date = date;
- }
-
- get date() {
- return this._date;
- }
-
- set date(value) {
- this._date = value;
- let stamp = value.getTime();
-
- let firstDay = new Date(stamp);
- firstDay.setDate(1);
- this.firstDay = firstDay;
-
- let lastDay = new Date(stamp);
- lastDay.setMonth(lastDay.getMonth() + this.nMonths);
- lastDay.setDate(0);
- this.lastDay = lastDay;
-
- this.months = [];
- for (let i = 0; i < this.nMonths; i++) {
- let monthDate = new Date(stamp);
- monthDate.setMonth(value.getMonth() + i);
- this.months.push(monthDate);
- }
-
- this.refreshEvents();
- }
-
- step(direction) {
- let date = new Date(this.date.getTime());
- date.setMonth(date.getMonth() + (this.nMonths * direction));
- this.date = date;
-
- this.emit('step');
- }
-
- get data() {
- return this._data;
- }
-
- set data(value) {
- this._data = value;
-
- value = value || {};
-
- this.events = value.events;
-
- function toStamp(date) {
- return date && new Date(date).setHours(0, 0, 0, 0);
- }
-
- this.exclusions = {};
- let exclusions = value.exclusions;
-
- if (exclusions) {
- for (let exclusion of exclusions) {
- let stamp = toStamp(exclusion.dated);
- if (!this.exclusions[stamp]) this.exclusions[stamp] = [];
- this.exclusions[stamp].push(exclusion);
- }
- }
-
- this.geoExclusions = {};
- let geoExclusions = value.geoExclusions;
-
- if (geoExclusions) {
- for (let geoExclusion of geoExclusions) {
- let stamp = toStamp(geoExclusion.dated);
- if (!this.geoExclusions[stamp]) this.geoExclusions[stamp] = [];
- this.geoExclusions[stamp].push(geoExclusion);
- }
- }
-
- let events = value.events;
-
- if (events) {
- for (let event of events) {
- event.dated = toStamp(event.dated);
- event.ended = toStamp(event.ended);
- event.started = toStamp(event.started);
- event.wdays = this.vnWeekDays.fromSet(event.weekDays);
- }
- }
-
- this.refreshEvents();
-
- let calendars = this.element.querySelectorAll('vn-calendar');
- for (let calendar of calendars)
- calendar.$ctrl.repaint();
- }
-
- refreshEvents() {
- this.days = {};
- if (!this.data) return;
-
- let day = new Date(this.firstDay.getTime());
-
- while (day <= this.lastDay) {
- let stamp = day.getTime();
- let wday = day.getDay();
- let dayEvents = [];
- let exclusions = this.exclusions[stamp] || [];
-
- if (this.events) {
- for (let event of this.events) {
- let match;
-
- switch (event.type) {
- case 'day':
- match = event.dated == stamp;
- break;
- default:
- match = event.wdays[wday]
- && (!event.started || stamp >= event.started)
- && (!event.ended || stamp <= event.ended);
- break;
- }
-
- if (match && !exclusions.find(e => e.zoneFk == event.zoneFk))
- dayEvents.push(event);
- }
- }
-
- if (dayEvents.length)
- this.days[stamp] = dayEvents;
-
- day.setDate(day.getDate() + 1);
- }
- }
-
- onSelection($event, $days, $type, $weekday) {
- let $events = [];
- let $exclusions = [];
- let $geoExclusions = [];
-
- for (let day of $days) {
- let stamp = day.getTime();
- $events = $events.concat(this.days[stamp] || []);
- $exclusions = $exclusions.concat(this.exclusions[stamp] || []);
- $geoExclusions = $geoExclusions.concat(this.geoExclusions[stamp] || []);
- }
-
- this.emit('selection', {
- $event,
- $days,
- $type,
- $weekday,
- $events,
- $exclusions,
- $geoExclusions
- });
- }
-
- hasEvents(day) {
- let stamp = day.getTime();
- return this.days[stamp] || this.exclusions[stamp] || this.geoExclusions[stamp];
- }
-
- getClass(day) {
- let stamp = day.getTime();
- if (this.geoExclusions[stamp])
- return 'geoExcluded';
- else if (this.exclusions[stamp])
- return 'excluded';
- else return '';
- }
-}
-Controller.$inject = ['$element', '$scope', 'vnWeekDays'];
-
-ngModule.vnComponent('vnZoneCalendar', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- data: ''
- }
-});
diff --git a/modules/zone/front/calendar/index.spec.js b/modules/zone/front/calendar/index.spec.js
deleted file mode 100644
index 43280a9e8..000000000
--- a/modules/zone/front/calendar/index.spec.js
+++ /dev/null
@@ -1,172 +0,0 @@
-import './index';
-import crudModel from 'core/mocks/crud-model';
-
-describe('component vnZoneCalendar', () => {
- let $scope;
- let controller;
-
- beforeEach(ngModule('zone'));
-
- beforeEach(inject(($componentController, $rootScope) => {
- $scope = $rootScope.$new();
- const $element = angular.element(``);
- controller = $componentController('vnZoneCalendar', {$element, $scope});
- controller.$.model = crudModel;
- controller.zone = {id: 1};
- controller.days = [];
- controller.exclusions = [];
- controller.geoExclusions = [];
- }));
-
- describe('date() setter', () => {
- it('should set the month property and then call the refreshEvents() method', () => {
- jest.spyOn(controller, 'refreshEvents').mockReturnThis();
-
- controller.date = Date.vnNew();
-
- expect(controller.refreshEvents).toHaveBeenCalledWith();
- expect(controller.months.length).toEqual(4);
- });
- });
-
- describe('step()', () => {
- it('should set the date month to 4 months backwards', () => {
- const now = Date.vnNew();
- now.setDate(15);
- now.setMonth(now.getMonth() - 4);
-
- controller.step(-1);
-
- const expectedMonth = now.getMonth();
- const currentMonth = controller.date.getMonth();
-
- expect(currentMonth).toEqual(expectedMonth);
- });
-
- it('should set the date month to 4 months forwards', () => {
- const now = Date.vnNew();
- now.setDate(15);
- now.setMonth(now.getMonth() + 4);
-
- controller.step(1);
-
- const expectedMonth = now.getMonth();
- const currentMonth = controller.date.getMonth();
-
- expect(currentMonth).toEqual(expectedMonth);
- });
- });
-
- describe('data() setter', () => {
- it('should set the events, exclusions and geoExclusions and then call the refreshEvents() method', () => {
- jest.spyOn(controller, 'refreshEvents').mockReturnThis();
-
- controller.data = {
- exclusions: [{
- dated: Date.vnNew()
- }],
- events: [{
- dated: Date.vnNew()
- }],
- geoExclusions: [{
- dated: Date.vnNew()
- }],
- };
-
- expect(controller.refreshEvents).toHaveBeenCalledWith();
- expect(controller.events).toBeDefined();
- expect(controller.events.length).toEqual(1);
- expect(controller.exclusions).toBeDefined();
- expect(controller.geoExclusions).toBeDefined();
- expect(Object.keys(controller.exclusions).length).toEqual(1);
- });
- });
-
- describe('refreshEvents()', () => {
- it('should fill the days property with the events.', () => {
- controller.data = [];
- controller.firstDay = Date.vnNew();
-
- const lastDay = Date.vnNew();
- lastDay.setDate(lastDay.getDate() + 10);
- controller.lastDay = lastDay;
-
- const firstEventStamp = controller.firstDay.getTime();
- const lastEventStamp = controller.lastDay.getTime();
- controller.events = [{
- type: 'day',
- dated: firstEventStamp
- },
- {
- type: 'day',
- dated: lastEventStamp
- }];
-
- controller.refreshEvents();
- const expectedDays = Object.keys(controller.days);
-
- expect(expectedDays.length).toEqual(2);
- });
- });
-
- describe('onSelection()', () => {
- it('should call the emit() method', () => {
- jest.spyOn(controller, 'emit');
-
- const $event = {};
- const $days = [Date.vnNew()];
- const $type = 'day';
- const $weekday = 1;
-
- controller.onSelection($event, $days, $type, $weekday);
-
- expect(controller.emit).toHaveBeenCalledWith('selection',
- {
- $days: $days,
- $event: {},
- $events: [],
- $exclusions: [],
- $type: 'day',
- $weekday: 1,
- $geoExclusions: [],
- }
- );
- });
- });
-
- describe('hasEvents()', () => {
- it('should return true for an existing event on a date', () => {
- const dated = Date.vnNew();
-
- controller.days[dated.getTime()] = true;
-
- const result = controller.hasEvents(dated);
-
- expect(result).toBeTruthy();
- });
- });
-
- describe('getClass()', () => {
- it('should return the className "excluded" for an excluded date', () => {
- const dated = Date.vnNew();
-
- controller.exclusions = [];
- controller.exclusions[dated.getTime()] = true;
-
- const result = controller.getClass(dated);
-
- expect(result).toEqual('excluded');
- });
-
- it('should return the className "geoExcluded" for a date with geo excluded', () => {
- const dated = Date.vnNew();
-
- controller.geoExclusions = [];
- controller.geoExclusions[dated.getTime()] = true;
-
- const result = controller.getClass(dated);
-
- expect(result).toEqual('geoExcluded');
- });
- });
-});
diff --git a/modules/zone/front/calendar/style.scss b/modules/zone/front/calendar/style.scss
deleted file mode 100644
index 38491af58..000000000
--- a/modules/zone/front/calendar/style.scss
+++ /dev/null
@@ -1,43 +0,0 @@
-@import "variables";
-
-vn-zone-calendar {
- display: block;
-
- & > vn-card {
- & > .header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- background-color: $color-main;
- color: white;
- font-weight: bold;
- height: 45px;
-
- & > .vn-button {
- color: inherit;
- height: 100%;
- }
- }
- & > .calendars {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-evenly;
-
- & > .vn-calendar {
- max-width: 288px;
-
- #days-container .day {
- &.event .day-number {
- background-color: $color-success;
- }
- &.excluded .day-number {
- background-color: $color-alert;
- }
- &.geoExcluded .day-number {
- background-color: $color-main;
- }
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/modules/zone/front/card/index.html b/modules/zone/front/card/index.html
deleted file mode 100644
index ae6a7f10a..000000000
--- a/modules/zone/front/card/index.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/modules/zone/front/card/index.js b/modules/zone/front/card/index.js
deleted file mode 100644
index 4e8ac7e8c..000000000
--- a/modules/zone/front/card/index.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import ngModule from '../module';
-import ModuleCard from 'salix/components/module-card';
-
-class Controller extends ModuleCard {
- reload() {
- let filter = {
- include: {
- relation: 'agencyMode',
- scope: {fields: ['name']}
- }
- };
-
- this.$http.get(`Zones/${this.$params.id}`, {filter})
- .then(res => this.zone = res.data);
- }
-}
-
-ngModule.vnComponent('vnZoneCard', {
- template: require('./index.html'),
- controller: Controller
-});
diff --git a/modules/zone/front/card/index.spec.js b/modules/zone/front/card/index.spec.js
deleted file mode 100644
index 64127990f..000000000
--- a/modules/zone/front/card/index.spec.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import './index.js';
-
-describe('Zone Component vnZoneCard', () => {
- let controller;
- let $httpBackend;
- let data = {id: 1, name: 'fooName'};
-
- beforeEach(ngModule('zone'));
-
- beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => {
- $httpBackend = _$httpBackend_;
-
- let $element = angular.element('');
- controller = $componentController('vnZoneCard', {$element});
-
- $stateParams.id = data.id;
- $httpBackend.whenRoute('GET', 'Zones/:id').respond(data);
- }));
-
- it('should request data and set it on the controller', () => {
- controller.reload();
- $httpBackend.flush();
-
- expect(controller.zone).toEqual(data);
- });
-});
diff --git a/modules/zone/front/create/index.html b/modules/zone/front/create/index.html
deleted file mode 100644
index f8c7df391..000000000
--- a/modules/zone/front/create/index.html
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
-
-
-
-
-
diff --git a/modules/zone/front/create/index.js b/modules/zone/front/create/index.js
deleted file mode 100644
index db337a9a3..000000000
--- a/modules/zone/front/create/index.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-
-export default class Controller extends Section {
- $onInit() {
- this.zone = {
- travelingDays: 0,
- price: 0.20,
- bonus: 0.20,
- hour: Date.vnNew()
- };
- }
-
- onSubmit() {
- return this.$.watcher.submit().then(res =>
- this.$state.go('zone.card.location', {id: res.data.id})
- );
- }
-}
-
-ngModule.vnComponent('vnZoneCreate', {
- template: require('./index.html'),
- controller: Controller
-});
diff --git a/modules/zone/front/create/index.spec.js b/modules/zone/front/create/index.spec.js
deleted file mode 100644
index fe0088225..000000000
--- a/modules/zone/front/create/index.spec.js
+++ /dev/null
@@ -1,40 +0,0 @@
-import './index';
-import watcher from 'core/mocks/watcher';
-
-describe('Zone Component vnZoneCreate', () => {
- let $scope;
- let $state;
- let controller;
-
- beforeEach(ngModule('zone'));
-
- beforeEach(inject(($componentController, $rootScope, _$state_) => {
- $scope = $rootScope.$new();
- $state = _$state_;
- $scope.watcher = watcher;
- $scope.watcher.submit = () => {
- return {
- then: callback => {
- callback({data: {id: 1234}});
- }
- };
- };
- const $element = angular.element('');
- controller = $componentController('vnZoneCreate', {$element, $scope});
- }));
-
- describe('onSubmit()', () => {
- it(`should call submit() on the watcher then expect a callback`, () => {
- jest.spyOn($state, 'go');
-
- controller.zone = {
- name: 'Zone One'
- };
-
- controller.onSubmit();
-
- expect(controller.$state.go).toHaveBeenCalledWith('zone.card.location', Object({id: 1234}));
- });
- });
-});
-
diff --git a/modules/zone/front/create/locale/es.yml b/modules/zone/front/create/locale/es.yml
deleted file mode 100644
index 4827ced37..000000000
--- a/modules/zone/front/create/locale/es.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-Traveling days: Días de viaje
-Closing hour: Hora de cierre
-Bonus: Bonificación
\ No newline at end of file
diff --git a/modules/zone/front/delivery-days/index.html b/modules/zone/front/delivery-days/index.html
deleted file mode 100644
index c47d89982..000000000
--- a/modules/zone/front/delivery-days/index.html
+++ /dev/null
@@ -1,102 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Id
- Name
- Agency
- Closing
- Price
-
-
-
-
-
- {{::zone.id}}
- {{::zone.name}}
- {{::zone.agencyModeName}}
- {{::zone.hour | date: 'HH:mm'}}
- {{::zone.price | currency: 'EUR':2}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/modules/zone/front/delivery-days/index.js b/modules/zone/front/delivery-days/index.js
deleted file mode 100644
index 71e8c8ab7..000000000
--- a/modules/zone/front/delivery-days/index.js
+++ /dev/null
@@ -1,95 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-import './style.scss';
-
-class Controller extends Section {
- $onInit() {
- this.setParams();
- }
-
- $postLink() {
- this.deliveryMethodFk = 'delivery';
- }
-
- setParams() {
- const hasParams = this.$params.deliveryMethodFk || this.$params.geoFk || this.$params.agencyModeFk;
- if (hasParams) {
- if (this.$params.deliveryMethodFk)
- this.deliveryMethodFk = this.$params.deliveryMethodFk;
-
- if (this.$params.geoFk)
- this.geoFk = this.$params.geoFk;
-
- if (this.$params.agencyModeFk)
- this.agencyModeFk = this.$params.agencyModeFk;
-
- this.fetchData();
- }
- }
-
- fetchData() {
- const params = {
- deliveryMethodFk: this.deliveryMethodFk,
- geoFk: this.geoFk,
- agencyModeFk: this.agencyModeFk
- };
- this.$.data = null;
- this.$http.get(`Zones/getEvents`, {params})
- .then(res => {
- let data = res.data;
- this.$.data = data;
- if (!data.events.length)
- this.vnApp.showMessage(this.$t('No service for the specified zone'));
-
- this.$state.go(this.$state.current.name, params);
- });
- }
-
- get deliveryMethodFk() {
- return this._deliveryMethodFk;
- }
-
- set deliveryMethodFk(value) {
- this._deliveryMethodFk = value;
-
- let filter;
-
- if (value === 'pickUp')
- filter = {where: {code: 'PICKUP'}};
- else
- filter = {where: {code: {inq: ['DELIVERY', 'AGENCY']}}};
-
- this.$http.get(`DeliveryMethods`, {filter}).then(res => {
- const deliveryMethods = res.data.map(deliveryMethod => deliveryMethod.id);
- this.agencyFilter = {deliveryMethodFk: {inq: deliveryMethods}};
- });
- }
-
- onSelection($event, $events, $days) {
- if (!$events.length) return;
-
- const day = $days[0];
- const zoneIds = [];
- for (let event of $events)
- zoneIds.push(event.zoneFk);
-
- const params = {
- zoneIds: zoneIds,
- date: day
- };
-
- this.$http.post(`Zones/getZoneClosing`, params)
- .then(res => this.zoneClosing = res.data)
- .then(() => this.$.zoneEvents.show($event.target));
- }
-
- preview(zone) {
- this.selectedZone = zone;
- this.$.summary.show();
- }
-}
-
-ngModule.vnComponent('vnZoneDeliveryDays', {
- template: require('./index.html'),
- controller: Controller
-});
diff --git a/modules/zone/front/delivery-days/index.spec.js b/modules/zone/front/delivery-days/index.spec.js
deleted file mode 100644
index 28705880c..000000000
--- a/modules/zone/front/delivery-days/index.spec.js
+++ /dev/null
@@ -1,126 +0,0 @@
-import './index.js';
-import popover from 'core/mocks/popover';
-import crudModel from 'core/mocks/crud-model';
-
-describe('Zone Component vnZoneDeliveryDays', () => {
- let $httpBackend;
- let controller;
- let $element;
-
- beforeEach(ngModule('zone'));
-
- beforeEach(inject(($componentController, _$httpBackend_) => {
- $httpBackend = _$httpBackend_;
- $element = angular.element(' {
- it('should set the deliveryMethodFk property as pickup and then perform a query that sets the filter', () => {
- $httpBackend.expect('GET', 'DeliveryMethods').respond([{id: 999}]);
- controller.deliveryMethodFk = 'pickUp';
- $httpBackend.flush();
-
- expect(controller.agencyFilter).toEqual({deliveryMethodFk: {inq: [999]}});
- });
- });
-
- describe('setParams()', () => {
- it('should do nothing when no params are received', () => {
- controller.setParams();
-
- expect(controller.deliveryMethodFk).toBeUndefined();
- expect(controller.geoFk).toBeUndefined();
- expect(controller.agencyModeFk).toBeUndefined();
- });
-
- it('should set the controller properties when the params are provided', () => {
- controller.$params = {
- deliveryMethodFk: 3,
- geoFk: 2,
- agencyModeFk: 1
- };
- controller.setParams();
-
- expect(controller.deliveryMethodFk).toEqual(controller.$params.deliveryMethodFk);
- expect(controller.geoFk).toEqual(controller.$params.geoFk);
- expect(controller.agencyModeFk).toEqual(controller.$params.agencyModeFk);
- });
- });
-
- describe('fetchData()', () => {
- it('should make an HTTP GET query and then call the showMessage() method', () => {
- jest.spyOn(controller.vnApp, 'showMessage');
- jest.spyOn(controller.$state, 'go');
-
- controller.agencyModeFk = 1;
- controller.deliveryMethodFk = 2;
- controller.geoFk = 3;
- controller.$state.current.name = 'myState';
-
- const expectedData = {events: []};
-
- const url = 'Zones/getEvents?agencyModeFk=1&deliveryMethodFk=2&geoFk=3';
-
- $httpBackend.when('GET', 'DeliveryMethods').respond([]);
- $httpBackend.expect('GET', url).respond({events: []});
- controller.fetchData();
- $httpBackend.flush();
-
- expect(controller.$.data).toEqual(expectedData);
- expect(controller.vnApp.showMessage).toHaveBeenCalledWith('No service for the specified zone');
- expect(controller.$state.go).toHaveBeenCalledWith(
- controller.$state.current.name,
- {
- agencyModeFk: 1,
- deliveryMethodFk: 2,
- geoFk: 3
- }
- );
- });
- });
-
- describe('onSelection()', () => {
- it('should not call the show popover method if events array is empty', () => {
- jest.spyOn(controller.$.zoneEvents, 'show');
-
- const event = new Event('click');
- const target = document.createElement('div');
- target.dispatchEvent(event);
- const events = [];
- controller.onSelection(event, events);
-
- expect(controller.$.zoneEvents.show).not.toHaveBeenCalled();
- });
-
- it('should call the show() method and call getZoneClosing() with the expected ids', () => {
- jest.spyOn(controller.$.zoneEvents, 'show');
-
- const event = new Event('click');
- const target = document.createElement('div');
- target.dispatchEvent(event);
-
- const day = Date.vnNew();
- const events = [
- {zoneFk: 1},
- {zoneFk: 2},
- {zoneFk: 8}
- ];
- const params = {
- zoneIds: [1, 2, 8],
- date: [day][0]
- };
- const response = [{id: 1, hour: ''}];
-
- $httpBackend.when('POST', 'Zones/getZoneClosing', params).respond({response});
- controller.onSelection(event, events, [day]);
- $httpBackend.flush();
-
- expect(controller.$.zoneEvents.show).toHaveBeenCalledWith(target);
- expect(controller.zoneClosing.id).toEqual(response.id);
- });
- });
-});
diff --git a/modules/zone/front/delivery-days/style.scss b/modules/zone/front/delivery-days/style.scss
deleted file mode 100644
index 3dd4abb7c..000000000
--- a/modules/zone/front/delivery-days/style.scss
+++ /dev/null
@@ -1,36 +0,0 @@
-@import "variables";
-
-vn-zone-delivery-days {
- vn-zone-calendar {
- display: flex;
- justify-content: center;
- flex-wrap: wrap;
-
- & > vn-calendar {
- min-width: 264px;
- }
- }
- form {
- display: flex;
- flex-direction: column;
- }
-}
-
-.zoneEvents {
- width: 700px;
- max-height: 450px;
-
- vn-data-viewer {
- margin-bottom: 0;
- vn-pagination {
- padding: 0
- }
- }
-
- & > .header {
- background-color: $color-main;
- color: white;
- font-weight: bold;
- text-align: center
- }
-}
\ No newline at end of file
diff --git a/modules/zone/front/descriptor-popover/index.html b/modules/zone/front/descriptor-popover/index.html
deleted file mode 100644
index 7e4e8f5d8..000000000
--- a/modules/zone/front/descriptor-popover/index.html
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/modules/zone/front/descriptor-popover/index.js b/modules/zone/front/descriptor-popover/index.js
deleted file mode 100644
index a21232e41..000000000
--- a/modules/zone/front/descriptor-popover/index.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import ngModule from '../module';
-import DescriptorPopover from 'salix/components/descriptor-popover';
-
-class Controller extends DescriptorPopover {}
-
-ngModule.vnComponent('vnZoneDescriptorPopover', {
- slotTemplate: require('./index.html'),
- controller: Controller
-});
diff --git a/modules/zone/front/descriptor/index.html b/modules/zone/front/descriptor/index.html
deleted file mode 100644
index a3432a99d..000000000
--- a/modules/zone/front/descriptor/index.html
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
- Delete
-
-
- Clone
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/modules/zone/front/descriptor/index.js b/modules/zone/front/descriptor/index.js
deleted file mode 100644
index 3f4863a60..000000000
--- a/modules/zone/front/descriptor/index.js
+++ /dev/null
@@ -1,65 +0,0 @@
-import ngModule from '../module';
-import Descriptor from 'salix/components/descriptor';
-
-class Controller extends Descriptor {
- get zone() {
- return this.entity;
- }
-
- set zone(value) {
- this.entity = value;
- }
-
- loadData() {
- const filter = {
- include: [
- {
- relation: 'agencyMode',
- scope: {
- fields: ['name'],
- }
- }
- ]
- };
-
- return this.getData(`Zones/${this.id}`, {filter})
- .then(res => this.entity = res.data);
- }
-
- onDelete() {
- const $t = this.$translate.instant;
- const today = Date.vnNew();
- today.setHours(0, 0, 0, 0);
- const filter = {where: {zoneFk: this.id, shipped: {gte: today}}};
- this.$http.get(`Tickets`, {filter}).then(res => {
- const ticketsAmount = res.data.length;
- if (ticketsAmount) {
- const params = {ticketsAmount};
- const question = $t('This zone contains tickets', params, null, null, 'sanitizeParameters');
- this.$.deleteZone.question = question;
- this.$.deleteZone.show();
- } else
- this.deleteZone();
- });
- }
-
- deleteZone() {
- return this.$http.post(`Zones/${this.id}/deleteZone`).then(() => {
- this.$state.go('zone.index');
- this.vnApp.showSuccess(this.$t('Zone deleted'));
- });
- }
-
- onCloneAccept() {
- return this.$http.post(`Zones/${this.id}/clone`).
- then(res => this.$state.go('zone.card.basicData', {id: res.data.id}));
- }
-}
-
-ngModule.vnComponent('vnZoneDescriptor', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- zone: '<'
- }
-});
diff --git a/modules/zone/front/descriptor/index.spec.js b/modules/zone/front/descriptor/index.spec.js
deleted file mode 100644
index 435a1d00f..000000000
--- a/modules/zone/front/descriptor/index.spec.js
+++ /dev/null
@@ -1,74 +0,0 @@
-import './index.js';
-
-describe('Zone descriptor', () => {
- let $httpBackend;
- let controller;
- let $element;
-
- beforeEach(ngModule('zone'));
-
- beforeEach(inject(($componentController, _$httpBackend_) => {
- $httpBackend = _$httpBackend_;
- $element = angular.element(' {},
- show: () => {}
- };
- }));
-
- describe('onDelete()', () => {
- it('should make an HTTP POST query and then call the deleteZone show() method', () => {
- jest.spyOn(controller.$.deleteZone, 'show');
-
- const expectedData = [{id: 16}];
- $httpBackend.when('GET', 'Tickets').respond(expectedData);
- controller.onDelete();
- $httpBackend.flush();
-
- expect(controller.$.deleteZone.show).toHaveBeenCalledWith();
- });
-
- it('should make an HTTP POST query and then call the deleteZone() method', () => {
- jest.spyOn(controller, 'deleteZone').mockReturnThis();
-
- const expectedData = [];
- $httpBackend.when('GET', 'Tickets').respond(expectedData);
- controller.onDelete();
- $httpBackend.flush();
-
- expect(controller.deleteZone).toHaveBeenCalledWith();
- });
- });
-
- describe('deleteZone()', () => {
- it('should make an HTTP POST query and then call the showMessage() method', () => {
- jest.spyOn(controller.$state, 'go').mockReturnThis();
- jest.spyOn(controller.vnApp, 'showSuccess');
-
- const stateName = 'zone.index';
- $httpBackend.when('POST', 'Zones/1/deleteZone').respond(200);
- controller.deleteZone();
- $httpBackend.flush();
-
- expect(controller.$state.go).toHaveBeenCalledWith(stateName);
- expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Zone deleted');
- });
- });
-
- describe('onCloneAccept()', () => {
- it('should make an HTTP POST query and then call the state go() method', () => {
- jest.spyOn(controller.$state, 'go').mockReturnThis();
-
- const stateName = 'zone.card.basicData';
- const expectedData = {id: 1};
- $httpBackend.when('POST', 'Zones/1/clone').respond(expectedData);
- controller.onCloneAccept();
- $httpBackend.flush();
-
- expect(controller.$state.go).toHaveBeenCalledWith(stateName, expectedData);
- });
- });
-});
diff --git a/modules/zone/front/descriptor/locale/es.yml b/modules/zone/front/descriptor/locale/es.yml
deleted file mode 100644
index 0581ee93a..000000000
--- a/modules/zone/front/descriptor/locale/es.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-This zone contains tickets: Esta zona contiene {{ticketsAmount}} tickets por servir. ¿Seguro que quieres eliminar esta zona?
-Do you want to clone this zone?: ¿Quieres clonar esta zona?
-All it's properties will be copied: Todas sus propiedades serán copiadas
-Zone deleted: Zona eliminada
\ No newline at end of file
diff --git a/modules/zone/front/events/index.html b/modules/zone/front/events/index.html
deleted file mode 100644
index 157b2a669..000000000
--- a/modules/zone/front/events/index.html
+++ /dev/null
@@ -1,277 +0,0 @@
-
-
-
-
-
- Edit mode
-
-
-
-
-
-
-
-
-
- Events
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/modules/zone/front/events/index.js b/modules/zone/front/events/index.js
deleted file mode 100644
index b86330126..000000000
--- a/modules/zone/front/events/index.js
+++ /dev/null
@@ -1,316 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-import './style.scss';
-
-class Controller extends Section {
- constructor($element, $, vnWeekDays) {
- super($element, $);
- this.vnWeekDays = vnWeekDays;
- this.editMode = 'include';
- }
-
- $onInit() {
- this.refresh();
- }
-
- get path() {
- return `Zones/${this.$params.id}/events`;
- }
-
- get exclusionsPath() {
- return `Zones/${this.$params.id}/exclusions`;
- }
-
- get checked() {
- const geos = this.$.model.data || [];
- const checkedLines = [];
- for (let geo of geos) {
- if (geo.checked)
- checkedLines.push(geo);
- }
- return checkedLines;
- }
-
- refresh() {
- this.$.data = null;
- this.$.$applyAsync(() => {
- const params = {
- zoneFk: this.$params.id,
- started: this.$.calendar.firstDay,
- ended: this.$.calendar.lastDay
- };
-
- this.$http.get(`Zones/getEventsFiltered`, {params}).then(res => {
- const data = res.data;
- this.$.data = data;
- });
- });
- }
-
- formatWdays(weekDays) {
- if (!weekDays) return;
-
- let abrWdays = weekDays
- .split(',')
- .map(wday => this.vnWeekDays.map[wday].localeAbr);
-
- return abrWdays.length < 7
- ? abrWdays.join(', ')
- : this.$t('Everyday');
- }
-
- onSelection(days, type, weekday, events, exclusions, exclusionGeos) {
- if (this.editMode == 'include') {
- if (events.length)
- return this.editInclusion(events[0]);
- return this.createInclusion(type, days, weekday);
- } else if (this.editMode == 'exclude') {
- if (exclusions.length || exclusionGeos.length)
- return this.editExclusion(exclusions[0] || {}, exclusionGeos);
- return this.createExclusion(days);
- }
- }
-
- editExclusion(exclusion, exclusionGeos) {
- this.isNew = false;
- this.excludeSelected = angular.copy(exclusion);
- this.excludeSelected.type = exclusionGeos.length ?
- 'specificLocations' : 'all';
-
- this.exclusionGeos = new Set();
- if (exclusionGeos.length) {
- this.excludeSelected.id = exclusionGeos[0].zoneExclusionFk;
- exclusionGeos.forEach(x => this.exclusionGeos.add(x.geoFk));
- }
-
- this.$.excludeDialog.show();
- }
-
- createExclusion(days) {
- this.isNew = true;
- this.excludeSelected = {
- type: 'all',
- dated: days[0]
- };
- this.exclusionGeos = new Set();
- this.$.excludeDialog.show();
- }
-
- onEditClick(row, event) {
- if (event.defaultPrevented) return;
- this.editInclusion(row);
- }
-
- editInclusion(row) {
- this.isNew = false;
- this.selected = angular.copy(row);
- this.selected.wdays = this.vnWeekDays.fromSet(row.weekDays);
- this.$.includeDialog.show();
- }
-
- createInclusion(type, days, weekday) {
- this.isNew = true;
-
- if (type == 'weekday') {
- let wdays = [];
- if (weekday) wdays[weekday] = true;
-
- this.selected = {
- type: 'indefinitely',
- wdays
- };
- } else {
- this.selected = {
- type: 'day',
- dated: days[0]
- };
- }
-
- this.$.includeDialog.show();
- }
-
- onIncludeResponse(response) {
- switch (response) {
- case 'accept': {
- let selected = this.selected;
- let type = selected.type;
-
- selected.weekDays = this.vnWeekDays.toSet(selected.wdays);
-
- if (type == 'day')
- selected.weekDays = '';
- else
- selected.dated = null;
-
- if (type != 'range') {
- selected.started = null;
- selected.ended = null;
- }
-
- let req;
-
- if (this.isNew)
- req = this.$http.post(this.path, selected);
- else
- req = this.$http.put(`${this.path}/${selected.id}`, selected);
-
- return req.then(() => {
- this.selected = null;
- this.isNew = null;
- this.refresh();
- });
- }
- case 'delete':
- return this.onDelete(this.selected.id)
- .then(response => response == 'accept');
- }
- }
-
- onExcludeResponse(response) {
- const type = this.excludeSelected.type;
- switch (response) {
- case 'accept': {
- if (type == 'all')
- return this.exclusionCreate();
- return this.exclusionGeoCreate();
- }
- case 'delete':
- return this.exclusionDelete(this.excludeSelected);
- }
- }
-
- onDeleteClick(id, event) {
- if (event.defaultPrevented) return;
- event.preventDefault();
- this.onDelete(id);
- }
-
- onDelete(id) {
- return this.$.confirm.show(
- response => this.onDeleteResponse(response, id));
- }
-
- onDeleteResponse(response, id) {
- if (response != 'accept' || !id) return;
- return this.$http.delete(`${this.path}/${id}`)
- .then(() => this.refresh());
- }
-
- exclusionCreate() {
- const excludeSelected = this.excludeSelected;
- const dated = excludeSelected.dated;
- let req;
-
- if (this.isNew)
- req = this.$http.post(this.exclusionsPath, [{dated}]);
- if (!this.isNew)
- req = this.$http.put(`${this.exclusionsPath}/${excludeSelected.id}`, {dated});
-
- return req.then(() => {
- this.refresh();
- });
- }
-
- exclusionGeoCreate() {
- const excludeSelected = this.excludeSelected;
- let req;
- const geoIds = [];
- this.exclusionGeos.forEach(id => geoIds.push(id));
-
- if (this.isNew) {
- const params = {
- zoneFk: parseInt(this.$params.id),
- date: excludeSelected.dated,
- geoIds
- };
- req = this.$http.post(`Zones/exclusionGeo`, params);
- } else {
- const params = {
- zoneExclusionFk: this.excludeSelected.id,
- geoIds
- };
- req = this.$http.post(`Zones/updateExclusionGeo`, params);
- }
- return req.then(() => this.refresh());
- }
-
- exclusionDelete(exclusion) {
- const path = `${this.exclusionsPath}/${exclusion.id}`;
- return this.$http.delete(path)
- .then(() => this.refresh());
- }
-
- set excludeSearch(value) {
- this._excludeSearch = value;
- if (!value) this.onSearch();
- }
-
- get excludeSearch() {
- return this._excludeSearch;
- }
-
- onKeyDown(event) {
- if (event.key == 'Enter') {
- event.preventDefault();
- this.onSearch();
- }
- }
-
- onSearch() {
- const params = {search: this._excludeSearch};
- if (this.excludeSelected.type == 'specificLocations') {
- this.$.model.applyFilter({}, params).then(() => {
- const data = this.$.model.data;
- this.getChecked(data);
- this.$.treeview.data = data;
- });
- }
- }
-
- onFetch(item) {
- const params = item ? {parentId: item.id} : null;
- return this.$.model.applyFilter({}, params).then(() => {
- const data = this.$.model.data;
- this.getChecked(data);
- return data;
- });
- }
-
- onSort(a, b) {
- if (b.selected !== a.selected) {
- if (a.selected == null)
- return 1;
- if (b.selected == null)
- return -1;
- return b.selected - a.selected;
- }
-
- return a.name.localeCompare(b.name);
- }
-
- getChecked(data) {
- for (let geo of data) {
- geo.checked = this.exclusionGeos.has(geo.id);
- if (geo.childs) this.getChecked(geo.childs);
- }
- }
-
- onItemCheck(geoId, checked) {
- if (checked)
- this.exclusionGeos.add(geoId);
- else
- this.exclusionGeos.delete(geoId);
- }
-}
-Controller.$inject = ['$element', '$scope', 'vnWeekDays'];
-
-ngModule.vnComponent('vnZoneEvents', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- zone: '<'
- },
- require: {
- card: '^vnZoneCard'
- }
-});
diff --git a/modules/zone/front/events/index.spec.js b/modules/zone/front/events/index.spec.js
deleted file mode 100644
index 558d97b6f..000000000
--- a/modules/zone/front/events/index.spec.js
+++ /dev/null
@@ -1,340 +0,0 @@
-import './index';
-import crudModel from 'core/mocks/crud-model';
-
-describe('component vnZoneEvents', () => {
- let $scope;
- let controller;
- let $httpBackend;
-
- beforeEach(ngModule('zone'));
-
- beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
- $httpBackend = _$httpBackend_;
- $scope = $rootScope.$new();
- const $element = angular.element(``);
- controller = $componentController('vnZoneEvents', {$element, $scope});
- controller.$params = {id: 1};
- }));
-
- describe('refresh()', () => {
- it('should set the zone and then call both getSummary() and getWarehouses()', () => {
- const date = '2021-10-01';
-
- controller.$params.id = 999;
- controller.$.calendar = {
- firstDay: date,
- lastDay: date
- };
-
- const params = {
- zoneFk: controller.$params.id,
- started: date,
- ended: date
- };
-
- const query = `Zones/getEventsFiltered?ended=${date}&started=${date}&zoneFk=${params.zoneFk}`;
- const response = {
- events: 'myEvents',
- exclusions: 'myExclusions',
- geoExclusions: 'myGeoExclusions',
- };
- $httpBackend.whenGET(query).respond(response);
- controller.refresh();
- $httpBackend.flush();
-
- const data = controller.$.data;
-
- expect(data.events).toBeDefined();
- expect(data.exclusions).toBeDefined();
- });
- });
-
- describe('onSelection()', () => {
- it('should call the editInclusion() method', () => {
- jest.spyOn(controller, 'editInclusion').mockReturnThis();
-
- const weekday = {};
- const days = [];
- const type = 'EventType';
- const events = [{name: 'Event'}];
- const exclusions = [];
- const exclusionsGeo = [];
- controller.editMode = 'include';
- controller.onSelection(days, type, weekday, events, exclusions, exclusionsGeo);
-
- expect(controller.editInclusion).toHaveBeenCalledWith({name: 'Event'});
- });
-
- it('should call the createInclusion() method', () => {
- jest.spyOn(controller, 'createInclusion').mockReturnThis();
-
- const weekday = {dated: Date.vnNew()};
- const days = [weekday];
- const type = 'EventType';
- const events = [];
- const exclusions = [];
- const exclusionsGeo = [];
- controller.editMode = 'include';
- controller.onSelection(days, type, weekday, events, exclusions, exclusionsGeo);
-
- expect(controller.createInclusion).toHaveBeenCalledWith(type, days, weekday);
- });
-
- it('should call the editExclusion() method with exclusions', () => {
- jest.spyOn(controller, 'editExclusion').mockReturnThis();
-
- const weekday = {};
- const days = [];
- const type = 'EventType';
- const events = [];
- const exclusions = [{name: 'Exclusion'}];
- const exclusionsGeo = [];
- controller.editMode = 'exclude';
- controller.onSelection(days, type, weekday, events, exclusions, exclusionsGeo);
-
- expect(controller.editExclusion).toHaveBeenCalled();
- });
-
- it('should call the editExclusion() method with exclusionsGeo', () => {
- jest.spyOn(controller, 'editExclusion').mockReturnThis();
-
- const weekday = {};
- const days = [];
- const type = 'EventType';
- const events = [];
- const exclusions = [];
- const exclusionsGeo = [{name: 'GeoExclusion'}];
- controller.editMode = 'exclude';
- controller.onSelection(days, type, weekday, events, exclusions, exclusionsGeo);
-
- expect(controller.editExclusion).toHaveBeenCalled();
- });
-
- it('should call the createExclusion() method', () => {
- jest.spyOn(controller, 'createExclusion').mockReturnThis();
-
- const weekday = {};
- const days = [{dated: Date.vnNew()}];
- const type = 'EventType';
- const events = [];
- const exclusions = [];
- const exclusionsGeo = [];
- controller.editMode = 'exclude';
- controller.onSelection(days, type, weekday, events, exclusions, exclusionsGeo);
-
- expect(controller.createExclusion).toHaveBeenCalledWith(days);
- });
- });
-
- describe('editExclusion()', () => {
- it('shoud set the excludeSelected.type = "specificLocations" and then call the excludeDialog show() method', () => {
- controller.$.excludeDialog = {show: jest.fn()};
-
- const exclusionGeos = [{id: 1}];
- const exclusions = [];
-
- controller.editExclusion(exclusions, exclusionGeos);
-
- expect(controller.excludeSelected.type).toEqual('specificLocations');
- expect(controller.$.excludeDialog.show).toHaveBeenCalledWith();
- });
-
- it('shoud set the excludeSelected.type = "all" and then call the excludeDialog show() method', () => {
- controller.$.excludeDialog = {show: jest.fn()};
-
- const exclusionGeos = [];
- const exclusions = [{id: 1}];
-
- controller.editExclusion(exclusions, exclusionGeos);
-
- expect(controller.excludeSelected.type).toEqual('all');
- expect(controller.$.excludeDialog.show).toHaveBeenCalledWith();
- });
- });
-
- describe('createExclusion()', () => {
- it('shoud set the excludeSelected property and then call the excludeDialog show() method', () => {
- controller.$.excludeDialog = {show: jest.fn()};
-
- const days = [Date.vnNew()];
- controller.createExclusion(days);
-
- expect(controller.excludeSelected).toBeDefined();
- expect(controller.isNew).toBeTruthy();
- expect(controller.$.excludeDialog.show).toHaveBeenCalledWith();
- });
- });
-
- describe('createInclusion()', () => {
- it('shoud set the selected property and then call the includeDialog show() method', () => {
- controller.$.includeDialog = {show: jest.fn()};
-
- const type = 'weekday';
- const days = [Date.vnNew()];
- const weekday = 1;
- controller.createInclusion(type, days, weekday);
-
- const selection = controller.selected;
- const firstWeekday = selection.wdays[weekday];
-
- expect(selection.type).toEqual('indefinitely');
- expect(firstWeekday).toBeTruthy();
- expect(controller.isNew).toBeTruthy();
- expect(controller.$.includeDialog.show).toHaveBeenCalledWith();
- });
-
- it('shoud set the selected property with the first day and then call the includeDialog show() method', () => {
- controller.$.includeDialog = {show: jest.fn()};
-
- const type = 'nonListedType';
- const days = [Date.vnNew()];
- const weekday = 1;
- controller.createInclusion(type, days, weekday);
-
- const selection = controller.selected;
-
- expect(selection.type).toEqual('day');
- expect(selection.dated).toEqual(days[0]);
- expect(controller.isNew).toBeTruthy();
- expect(controller.$.includeDialog.show).toHaveBeenCalledWith();
- });
- });
-
- describe('onIncludeResponse()', () => {
- it('shoud call the onDelete() method', () => {
- jest.spyOn(controller, 'onDelete').mockReturnValue(
- new Promise(accept => accept())
- );
-
- controller.selected = {id: 1};
- controller.onIncludeResponse('delete');
-
- expect(controller.onDelete).toHaveBeenCalledWith(1);
- });
-
- it('shoud make an HTTP POST query to create a new one and then call the refresh() method', () => {
- jest.spyOn(controller, 'refresh').mockReturnThis();
-
- controller.selected = {id: 1};
- controller.isNew = true;
-
- $httpBackend.when('POST', `Zones/1/events`).respond(200);
- controller.onIncludeResponse('accept');
- $httpBackend.flush();
-
- expect(controller.refresh).toHaveBeenCalledWith();
- });
-
- it('shoud make an HTTP PUT query and then call the refresh() method', () => {
- jest.spyOn(controller, 'refresh').mockReturnThis();
-
- controller.selected = {id: 1};
- controller.isNew = false;
-
- const eventId = 1;
- $httpBackend.when('PUT', `Zones/1/events/${eventId}`).respond(200);
- controller.onIncludeResponse('accept');
- $httpBackend.flush();
-
- expect(controller.refresh).toHaveBeenCalledWith();
- });
- });
-
- describe('onExcludeResponse()', () => {
- it('should call the exclusionCreate() method', () => {
- jest.spyOn(controller, 'exclusionCreate').mockReturnThis();
-
- controller.excludeSelected = {type: 'all'};
- controller.onExcludeResponse('accept');
-
- expect(controller.exclusionCreate).toHaveBeenCalledWith();
- });
-
- it('should call the exclusionGeoCreate() method', () => {
- jest.spyOn(controller, 'exclusionGeoCreate').mockReturnThis();
-
- controller.excludeSelected = {type: 'specificLocations'};
- controller.onExcludeResponse('accept');
-
- expect(controller.exclusionGeoCreate).toHaveBeenCalledWith();
- });
-
- it('should call the exclusionDelete() method', () => {
- jest.spyOn(controller, 'exclusionDelete').mockReturnThis();
-
- controller.excludeSelected = {id: 1, type: 'all'};
- controller.onExcludeResponse('delete');
-
- expect(controller.exclusionDelete).toHaveBeenCalledWith(controller.excludeSelected);
- });
- });
-
- describe('onDeleteResponse()', () => {
- it('shoud make an HTTP DELETE query and then call the refresh() method', () => {
- jest.spyOn(controller, 'refresh').mockReturnThis();
-
- const eventId = 1;
- $httpBackend.expect('DELETE', `Zones/1/events/1`).respond({id: 1});
- controller.onDeleteResponse('accept', eventId);
- $httpBackend.flush();
-
- expect(controller.refresh).toHaveBeenCalledWith();
- });
- });
-
- describe('exclusionCreate()', () => {
- it('shoud make an HTTP POST query and then call the refresh() method', () => {
- jest.spyOn(controller, 'refresh').mockReturnThis();
-
- controller.excludeSelected = {};
- controller.isNew = true;
- $httpBackend.expect('POST', `Zones/1/exclusions`).respond({id: 1});
- controller.exclusionCreate();
- $httpBackend.flush();
-
- expect(controller.refresh).toHaveBeenCalledWith();
- });
- });
-
- describe('exclusionDelete()', () => {
- it('shoud make an HTTP DELETE query once and then call the refresh() method', () => {
- jest.spyOn(controller, 'refresh').mockReturnThis();
-
- const exclusions = {id: 1};
- const firstExclusionId = 1;
- $httpBackend.expectDELETE(`Zones/1/exclusions/${firstExclusionId}`).respond(200);
- controller.exclusionDelete(exclusions);
- $httpBackend.flush();
-
- expect(controller.refresh).toHaveBeenCalledWith();
- });
- });
-
- describe('onSearch()', () => {
- it('should call the applyFilter() method and then set the data', () => {
- jest.spyOn(controller, 'getChecked').mockReturnValue([1, 2, 3]);
-
- controller.$.treeview = {};
- controller.$.model = crudModel;
- controller.excludeSelected = {type: 'specificLocations'};
- controller._excludeSearch = 'es';
-
- controller.onSearch();
- const treeviewData = controller.$.treeview.data;
-
- expect(treeviewData).toBeDefined();
- expect(treeviewData.length).toEqual(3);
- });
- });
-
- describe('onFetch()', () => {
- it('should call the applyFilter() method and then return the model data', () => {
- jest.spyOn(controller, 'getChecked').mockReturnValue([1, 2, 3]);
-
- controller.$.model = crudModel;
- const result = controller.onFetch();
-
- expect(result.length).toEqual(3);
- });
- });
-});
diff --git a/modules/zone/front/events/locale/es.yml b/modules/zone/front/events/locale/es.yml
deleted file mode 100644
index d6eee9f67..000000000
--- a/modules/zone/front/events/locale/es.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-Edit mode: Modo de edición
-Include: Incluir
-Exclude: Excluir
-Events: Eventos
-Add event: Añadir evento
-Edit event: Editar evento
-All: Todo
-Specific locations: Localizaciones concretas
-Locations where it is not distributed: Localizaciones en las que no se reparte
-You must select a location: Debes seleccionar una localización
-Add exclusion: Añadir exclusión
-Edit exclusion: Editar exclusión
diff --git a/modules/zone/front/events/style.scss b/modules/zone/front/events/style.scss
deleted file mode 100644
index 49a6e87a6..000000000
--- a/modules/zone/front/events/style.scss
+++ /dev/null
@@ -1,11 +0,0 @@
-@import "variables";
-
- .width{
- width: 600px
- }
-
- .treeview{
- max-height: 300px;
- overflow: auto;
- }
-
diff --git a/modules/zone/front/index.js b/modules/zone/front/index.js
index dc20eea47..a7209a0bd 100644
--- a/modules/zone/front/index.js
+++ b/modules/zone/front/index.js
@@ -1,19 +1,3 @@
export * from './module';
import './main';
-import './index/';
-import './delivery-days';
-import './summary';
-import './card';
-import './descriptor';
-import './descriptor-popover';
-import './search-panel';
-import './create';
-import './basic-data';
-import './warehouses';
-import './events';
-import './calendar';
-import './location';
-import './calendar';
-import './upcoming-deliveries';
-import './log';
diff --git a/modules/zone/front/index/index.html b/modules/zone/front/index/index.html
deleted file mode 100644
index 78e3f2cd8..000000000
--- a/modules/zone/front/index/index.html
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
-
-
-
-
- Id
- Name
- Agency
- Closing
- Price
-
-
-
-
-
- {{::zone.id}}
- {{::zone.name}}
- {{::zone.agencyMode.name}}
- {{::zone.hour | date: 'HH:mm'}}
- {{::zone.price | currency: 'EUR':2}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/modules/zone/front/index/index.js b/modules/zone/front/index/index.js
deleted file mode 100644
index ad54f7df4..000000000
--- a/modules/zone/front/index/index.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-
-export default class Controller extends Section {
- preview(zone) {
- this.selectedZone = zone;
- this.$.summary.show();
- }
-
- onCloneAccept(zone) {
- return this.$http.post(`Zones/${zone.id}/clone`)
- .then(res => {
- this.$state.go('zone.card.basicData', {id: res.data.id});
- });
- }
-}
-
-ngModule.vnComponent('vnZoneIndex', {
- template: require('./index.html'),
- controller: Controller
-});
diff --git a/modules/zone/front/index/locale/es.yml b/modules/zone/front/index/locale/es.yml
deleted file mode 100644
index 14195e869..000000000
--- a/modules/zone/front/index/locale/es.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-Do you want to clone this zone?: ¿Seguro que quieres clonar esta zona?
-All it's properties will be copied: Todas sus propiedades serán copiadas
\ No newline at end of file
diff --git a/modules/zone/front/locale/es.yml b/modules/zone/front/locale/es.yml
index 7c9e783ab..4d528f37a 100644
--- a/modules/zone/front/locale/es.yml
+++ b/modules/zone/front/locale/es.yml
@@ -13,7 +13,7 @@ Indefinitely: Indefinido
Inflation: Inflación
Locations: Localizaciones
Maximum m³: M³ máximo
-Max m³: Medida máxima
+Max m³: Medida máxima
New zone: Nueva zona
One day: Un día
Pick up: Recogida
@@ -32,4 +32,4 @@ Warehouses: Almacenes
Week days: Días de la semana
Zones: Zonas
zone: zona
-Go to the zone: Ir a la zona
\ No newline at end of file
+Go to the zone: Ir a la zona
diff --git a/modules/zone/front/location/index.html b/modules/zone/front/location/index.html
deleted file mode 100644
index b86c618b7..000000000
--- a/modules/zone/front/location/index.html
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/modules/zone/front/location/index.js b/modules/zone/front/location/index.js
deleted file mode 100644
index 0f92f37de..000000000
--- a/modules/zone/front/location/index.js
+++ /dev/null
@@ -1,56 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-import './style.scss';
-
-class Controller extends Section {
- onSearch(params) {
- this.$.model.applyFilter({}, params).then(() => {
- const data = this.$.model.data;
- this.$.treeview.data = data;
- });
- }
-
- onFetch(item) {
- const params = item ? {parentId: item.id} : null;
- return this.$.model.applyFilter({}, params)
- .then(() => this.$.model.data);
- }
-
- onSort(a, b) {
- if (b.selected !== a.selected) {
- if (a.selected == null)
- return 1;
- if (b.selected == null)
- return -1;
- return b.selected - a.selected;
- }
-
- return a.name.localeCompare(b.name);
- }
-
- exprBuilder(param, value) {
- switch (param) {
- case 'search':
- return {name: {like: `%${value}%`}};
- }
- }
-
- onSelection(value, item) {
- if (value == null)
- value = undefined;
- const params = {geoId: item.id, isIncluded: value};
- const path = `zones/${this.zone.id}/toggleIsIncluded`;
- this.$http.post(path, params);
- }
-}
-
-ngModule.vnComponent('vnZoneLocation', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- zone: '<'
- },
- require: {
- card: '^vnZoneCard'
- }
-});
diff --git a/modules/zone/front/location/index.spec.js b/modules/zone/front/location/index.spec.js
deleted file mode 100644
index 30968209c..000000000
--- a/modules/zone/front/location/index.spec.js
+++ /dev/null
@@ -1,50 +0,0 @@
-import './index';
-import crudModel from 'core/mocks/crud-model';
-
-describe('component vnZoneLocation', () => {
- let $scope;
- let controller;
- let $httpBackend;
-
- beforeEach(ngModule('zone'));
-
- beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
- $httpBackend = _$httpBackend_;
- $scope = $rootScope.$new();
- const $element = angular.element(``);
- controller = $componentController('vnZoneLocation', {$element, $scope});
- controller.$.model = crudModel;
- controller.zone = {id: 1};
- }));
-
- describe('onSearch()', () => {
- it('should call the applyFilter() method and then set the data', () => {
- controller.$.treeview = {};
- controller.onSearch({});
-
- const treeviewData = controller.$.treeview.data;
-
- expect(treeviewData).toBeDefined();
- expect(treeviewData.length).toEqual(3);
- });
- });
-
- describe('onFetch()', () => {
- it('should call the applyFilter() method and then return the model data', () => {
- const result = controller.onFetch();
-
- expect(result.length).toEqual(3);
- });
- });
-
- describe('onSelection()', () => {
- it('should make an HTTP POST query', () => {
- const item = {id: 123};
-
- const expectedParams = {geoId: 123, isIncluded: true};
- $httpBackend.expect('POST', `zones/1/toggleIsIncluded`, expectedParams).respond(200);
- controller.onSelection(true, item);
- $httpBackend.flush();
- });
- });
-});
diff --git a/modules/zone/front/location/style.scss b/modules/zone/front/location/style.scss
deleted file mode 100644
index 24d685a51..000000000
--- a/modules/zone/front/location/style.scss
+++ /dev/null
@@ -1,21 +0,0 @@
-@import "variables";
-
-vn-zone-location {
- vn-treeview-child {
- .content > .vn-check:not(.indeterminate):not(.checked) {
- color: $color-alert;
-
- & > .btn {
- border-color: $color-alert;
- }
- }
- .content > .vn-check.checked {
- color: $color-notice;
-
- & > .btn {
- background-color: $color-notice;
- border-color: $color-notice
- }
- }
- }
-}
diff --git a/modules/zone/front/log/index.html b/modules/zone/front/log/index.html
deleted file mode 100644
index 539afda82..000000000
--- a/modules/zone/front/log/index.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/modules/zone/front/log/index.js b/modules/zone/front/log/index.js
deleted file mode 100644
index 8c3be2423..000000000
--- a/modules/zone/front/log/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-
-ngModule.vnComponent('vnZoneLog', {
- template: require('./index.html'),
- controller: Section,
-});
diff --git a/modules/zone/front/main/index.html b/modules/zone/front/main/index.html
index 8dd6cdf78..e69de29bb 100644
--- a/modules/zone/front/main/index.html
+++ b/modules/zone/front/main/index.html
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/modules/zone/front/main/index.js b/modules/zone/front/main/index.js
index 3be60c5a1..38896d418 100644
--- a/modules/zone/front/main/index.js
+++ b/modules/zone/front/main/index.js
@@ -4,25 +4,10 @@ import ModuleMain from 'salix/components/module-main';
export default class Zone extends ModuleMain {
constructor($element, $) {
super($element, $);
- this.filter = {
- include: {
- relation: 'agencyMode',
- scope: {fields: ['name']}
- }
- };
}
-
- exprBuilder(param, value) {
- switch (param) {
- case 'search':
- return /^\d+$/.test(value)
- ? {id: value}
- : {name: {like: `%${value}%`}};
- case 'name':
- return {[param]: {like: `%${value}%`}};
- case 'agencyModeFk':
- return {[param]: value};
- }
+ async $onInit() {
+ this.$state.go('home');
+ window.location.href = await this.vnApp.getUrl(`zone/`);
}
}
diff --git a/modules/zone/front/main/index.spec.js b/modules/zone/front/main/index.spec.js
deleted file mode 100644
index 1e50cee80..000000000
--- a/modules/zone/front/main/index.spec.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import './index.js';
-
-describe('Zone Component vnZone', () => {
- let controller;
-
- beforeEach(ngModule('zone'));
-
- beforeEach(inject($componentController => {
- const $element = angular.element('');
- controller = $componentController('vnZone', {$element});
- }));
-
- describe('exprBuilder()', () => {
- it('should return a formated object with the id in case of search', () => {
- let param = 'search';
- let value = 1;
- let result = controller.exprBuilder(param, value);
-
- expect(result).toEqual({id: 1});
- });
-
- it('should return a formated object with the agencyModeFk in case of agencyModeFk', () => {
- let param = 'agencyModeFk';
- let value = 'My Delivery';
- let result = controller.exprBuilder(param, value);
-
- expect(result).toEqual({agencyModeFk: 'My Delivery'});
- });
- });
-});
diff --git a/modules/zone/front/routes.json b/modules/zone/front/routes.json
index 7f67260da..a4993007d 100644
--- a/modules/zone/front/routes.json
+++ b/modules/zone/front/routes.json
@@ -7,15 +7,6 @@
"menus": {
"main": [
{"state": "zone.index", "icon": "icon-zone"},
- {"state": "zone.deliveryDays", "icon": "today"},
- {"state": "zone.upcomingDeliveries", "icon": "today"}
- ],
- "card": [
- {"state": "zone.card.basicData", "icon": "settings"},
- {"state": "zone.card.location", "icon": "my_location"},
- {"state": "zone.card.warehouses", "icon": "home"},
- {"state": "zone.card.log", "icon": "history"},
- {"state": "zone.card.events", "icon": "today"}
]
},
"keybindings": [
@@ -34,79 +25,6 @@
"state": "zone.index",
"component": "vn-zone-index",
"description": "Zones"
- },
- {
- "url": "/delivery-days?q&deliveryMethodFk&geoFk&agencyModeFk",
- "state": "zone.deliveryDays",
- "component": "vn-zone-delivery-days",
- "description": "Delivery days"
- },
- {
- "url": "/upcoming-deliveries",
- "state": "zone.upcomingDeliveries",
- "component": "vn-upcoming-deliveries",
- "description": "Upcoming deliveries"
- },
- {
- "url": "/create",
- "state": "zone.create",
- "component": "vn-zone-create",
- "description": "New zone"
- },
- {
- "url": "/:id",
- "state": "zone.card",
- "component": "vn-zone-card",
- "abstract": true,
- "description": "Detail"
- },
- {
- "url": "/summary",
- "state": "zone.card.summary",
- "component": "vn-zone-summary",
- "description": "Summary",
- "params": {
- "zone": "$ctrl.zone"
- }
- },
- {
- "url": "/basic-data",
- "state": "zone.card.basicData",
- "component": "vn-zone-basic-data",
- "description": "Basic data",
- "params": {
- "zone": "$ctrl.zone"
- }
- },
- {
- "url": "/warehouses",
- "state": "zone.card.warehouses",
- "component": "vn-zone-warehouses",
- "description": "Warehouses"
- },
- {
- "url": "/events?q",
- "state": "zone.card.events",
- "component": "vn-zone-events",
- "description": "Calendar",
- "params": {
- "zone": "$ctrl.zone"
- }
- },
- {
- "url": "/location?q",
- "state": "zone.card.location",
- "component": "vn-zone-location",
- "description": "Locations",
- "params": {
- "zone": "$ctrl.zone"
- }
- },
- {
- "url" : "/log",
- "state": "zone.card.log",
- "component": "vn-zone-log",
- "description": "Log"
}
]
-}
\ No newline at end of file
+}
diff --git a/modules/zone/front/search-panel/index.html b/modules/zone/front/search-panel/index.html
deleted file mode 100644
index bda8a946e..000000000
--- a/modules/zone/front/search-panel/index.html
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/modules/zone/front/search-panel/index.js b/modules/zone/front/search-panel/index.js
deleted file mode 100644
index 598af02b2..000000000
--- a/modules/zone/front/search-panel/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import ngModule from '../module';
-import SearchPanel from 'core/components/searchbar/search-panel';
-
-ngModule.vnComponent('vnZoneSearchPanel', {
- template: require('./index.html'),
- controller: SearchPanel
-});
diff --git a/modules/zone/front/summary/index.html b/modules/zone/front/summary/index.html
deleted file mode 100644
index 2fe94388f..000000000
--- a/modules/zone/front/summary/index.html
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
- #{{$ctrl.summary.id}} - {{$ctrl.summary.name}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Name
-
-
-
-
- {{zoneWarehouse.warehouse.name}}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/modules/zone/front/summary/index.js b/modules/zone/front/summary/index.js
deleted file mode 100644
index ad33f28be..000000000
--- a/modules/zone/front/summary/index.js
+++ /dev/null
@@ -1,56 +0,0 @@
-import ngModule from '../module';
-import Summary from 'salix/components/summary';
-
-class Controller extends Summary {
- get zone() {
- return this._zone;
- }
-
- set zone(value) {
- this._zone = value;
-
- if (!value) return;
-
- this.getSummary();
- this.getWarehouses();
- }
-
- getSummary() {
- const params = {
- filter: {
- include: {
- relation: 'agencyMode',
- fields: ['name']
- },
- where: {
- id: this.zone.id
- }
- }
- };
- this.$http.get(`Zones/findOne`, {params}).then(res => {
- this.summary = res.data;
- });
- }
-
- getWarehouses() {
- const params = {
- filter: {
- include: {
- relation: 'warehouse',
- fields: ['name']
- }
- }
- };
- this.$http.get(`Zones/${this.zone.id}/warehouses`, {params}).then(res => {
- this.zoneWarehouses = res.data;
- });
- }
-}
-
-ngModule.vnComponent('vnZoneSummary', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- zone: '<'
- }
-});
diff --git a/modules/zone/front/summary/index.spec.js b/modules/zone/front/summary/index.spec.js
deleted file mode 100644
index 7541ee795..000000000
--- a/modules/zone/front/summary/index.spec.js
+++ /dev/null
@@ -1,76 +0,0 @@
-import './index';
-
-describe('component vnZoneSummary', () => {
- let $scope;
- let controller;
- let $httpBackend;
- let $httpParamSerializer;
-
- beforeEach(ngModule('zone'));
-
- beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => {
- $httpBackend = _$httpBackend_;
- $httpParamSerializer = _$httpParamSerializer_;
- $scope = $rootScope.$new();
- const $element = angular.element(``);
- controller = $componentController('vnZoneSummary', {$element, $scope});
- }));
-
- describe('zone setter', () => {
- it('should set the zone and then call both getSummary() and getWarehouses()', () => {
- jest.spyOn(controller, 'getSummary');
- jest.spyOn(controller, 'getWarehouses');
-
- controller.zone = {id: 1};
-
- expect(controller.getSummary).toHaveBeenCalledWith();
- expect(controller.getWarehouses).toHaveBeenCalledWith();
- });
- });
-
- describe('getSummary()', () => {
- it('should perform a get and then store data on the controller', () => {
- controller._zone = {id: 1};
- let params = {
- filter: {
- include: {
- relation: 'agencyMode',
- fields: ['name']
- },
- where: {
- id: controller._zone.id
- }
- }
- };
- const serializedParams = $httpParamSerializer(params);
- const query = `Zones/findOne?${serializedParams}`;
- $httpBackend.expectGET(query).respond({id: 1});
- controller.getSummary();
- $httpBackend.flush();
-
- expect(controller.summary).toBeDefined();
- });
- });
-
- describe('getWarehouses()', () => {
- it('should make an HTTP get query and then store data on the controller', () => {
- controller._zone = {id: 1};
- const params = {
- filter: {
- include: {
- relation: 'warehouse',
- fields: ['name']
- }
- }
- };
-
- const serializedParams = $httpParamSerializer(params);
- const query = `Zones/1/warehouses?${serializedParams}`;
- $httpBackend.expect('GET', query).respond([{id: 1}]);
- controller.getWarehouses();
- $httpBackend.flush();
-
- expect(controller.zoneWarehouses.length).toEqual(1);
- });
- });
-});
diff --git a/modules/zone/front/upcoming-deliveries/index.html b/modules/zone/front/upcoming-deliveries/index.html
deleted file mode 100644
index afcd0bbc6..000000000
--- a/modules/zone/front/upcoming-deliveries/index.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
- Province
- Closing
- Id
-
-
-
-
- {{::zone.name}}
- {{::zone.hour}}
- {{::zone.zoneFk}}
-
-
-
-
-
-
diff --git a/modules/zone/front/upcoming-deliveries/index.js b/modules/zone/front/upcoming-deliveries/index.js
deleted file mode 100644
index 371321711..000000000
--- a/modules/zone/front/upcoming-deliveries/index.js
+++ /dev/null
@@ -1,23 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-import './style.scss';
-
-class Controller extends Section {
- constructor($element, $, vnWeekDays) {
- super($element, $);
- this.days = vnWeekDays.days;
- }
-
- getWeekDay(jsonDate) {
- const weekDay = new Date(jsonDate).getDay();
-
- return this.days[weekDay].locale;
- }
-}
-
-Controller.$inject = ['$element', '$scope', 'vnWeekDays'];
-
-ngModule.vnComponent('vnUpcomingDeliveries', {
- template: require('./index.html'),
- controller: Controller
-});
diff --git a/modules/zone/front/upcoming-deliveries/index.spec.js b/modules/zone/front/upcoming-deliveries/index.spec.js
deleted file mode 100644
index 95eb999f9..000000000
--- a/modules/zone/front/upcoming-deliveries/index.spec.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import './index';
-
-describe('component vnUpcomingDeliveries', () => {
- let $scope;
- let controller;
-
- beforeEach(ngModule('zone'));
-
- beforeEach(inject(($componentController, $rootScope) => {
- $scope = $rootScope.$new();
- const $element = angular.element(``);
- controller = $componentController('vnUpcomingDeliveries', {$element, $scope});
- }));
-
- describe('getWeekDay()', () => {
- it('should retrieve a weekday for a json passed', () => {
- let jsonDate = '1970-01-01T22:00:00.000Z';
-
- expect(controller.getWeekDay(jsonDate)).toEqual('Thursday');
- });
- });
-});
diff --git a/modules/zone/front/upcoming-deliveries/locale/es.yml b/modules/zone/front/upcoming-deliveries/locale/es.yml
deleted file mode 100644
index 9f08e3a72..000000000
--- a/modules/zone/front/upcoming-deliveries/locale/es.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-Family: Familia
-Percentage: Porcentaje
-Dwindle: Mermas
\ No newline at end of file
diff --git a/modules/zone/front/upcoming-deliveries/style.scss b/modules/zone/front/upcoming-deliveries/style.scss
deleted file mode 100644
index b52231a09..000000000
--- a/modules/zone/front/upcoming-deliveries/style.scss
+++ /dev/null
@@ -1,26 +0,0 @@
-@import "variables";
-
-vn-upcoming-deliveries {
- .header {
- margin-bottom: 16px;
- text-transform: uppercase;
- font-size: 1.25rem;
- line-height: 1;
- padding: 7px;
- padding-bottom: 7px;
- padding-bottom: 4px;
- font-weight: lighter;
- background-color: $color-main-light;
- border-bottom: 1px solid $color-primary;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- background-color: $color-bg;
- }
-
- vn-table vn-th.waste-family,
- vn-table vn-td.waste-family {
- max-width: 64px;
- width: 64px
- }
-}
\ No newline at end of file
diff --git a/modules/zone/front/warehouses/index.html b/modules/zone/front/warehouses/index.html
deleted file mode 100644
index acd85f182..000000000
--- a/modules/zone/front/warehouses/index.html
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
-
- {{::row.warehouse.name}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/modules/zone/front/warehouses/index.js b/modules/zone/front/warehouses/index.js
deleted file mode 100644
index 85b398658..000000000
--- a/modules/zone/front/warehouses/index.js
+++ /dev/null
@@ -1,56 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-
-class Controller extends Section {
- $onInit() {
- this.refresh();
- }
-
- get path() {
- return `Zones/${this.$params.id}/warehouses`;
- }
-
- refresh() {
- let filter = {include: 'warehouse'};
- this.$http.get(this.path, {params: {filter}})
- .then(res => this.$.data = res.data);
- }
-
- onCreate() {
- this.selected = {};
- this.$.dialog.show();
- }
-
- onSave() {
- this.$http.post(this.path, this.selected)
- .then(() => {
- this.selected = null;
- this.isNew = null;
- this.$.dialog.hide();
- this.refresh();
- });
-
- return false;
- }
-
- onDelete(row) {
- this.$.confirm.show();
- this.deleteRow = row;
- }
-
- delete() {
- let row = this.deleteRow;
- if (!row) return;
- return this.$http.delete(`${this.path}/${row.id}`)
- .then(() => {
- let index = this.$.data.indexOf(row);
- if (index !== -1) this.$.data.splice(index, 1);
- this.deleteRow = null;
- });
- }
-}
-
-ngModule.vnComponent('vnZoneWarehouses', {
- template: require('./index.html'),
- controller: Controller
-});
diff --git a/modules/zone/front/warehouses/index.spec.js b/modules/zone/front/warehouses/index.spec.js
deleted file mode 100644
index 0e71d541c..000000000
--- a/modules/zone/front/warehouses/index.spec.js
+++ /dev/null
@@ -1,60 +0,0 @@
-import './index.js';
-
-describe('Zone warehouses', () => {
- let $httpBackend;
- let $httpParamSerializer;
- let controller;
- let $element;
-
- beforeEach(ngModule('zone'));
-
- beforeEach(inject(($componentController, _$httpBackend_, _$httpParamSerializer_) => {
- $httpBackend = _$httpBackend_;
- $httpParamSerializer = _$httpParamSerializer_;
- $element = angular.element(' {
- it('should make an HTTP GET query and then set the data', () => {
- const params = {filter: {include: 'warehouse'}};
- const serializedParams = $httpParamSerializer(params);
- const path = `Zones/1/warehouses?${serializedParams}`;
- $httpBackend.expect('GET', path).respond([{id: 1, name: 'Warehouse one'}]);
- controller.refresh();
- $httpBackend.flush();
-
- expect(controller.$.data).toBeDefined();
- });
- });
-
- describe('onSave()', () => {
- it('should make an HTTP POST query and then call the refresh() method', () => {
- jest.spyOn(controller, 'refresh').mockReturnThis();
-
- $httpBackend.expect('POST', `Zones/1/warehouses`).respond(200);
- controller.onSave();
- $httpBackend.flush();
-
- expect(controller.selected).toBeNull();
- expect(controller.isNew).toBeNull();
- expect(controller.$.dialog.hide).toHaveBeenCalledWith();
- expect(controller.refresh).toHaveBeenCalledWith();
- });
- });
-
- describe('delete()', () => {
- it('should make an HTTP DELETE query and then set deleteRow property to null value', () => {
- controller.deleteRow = {id: 1};
- controller.$.data = [{id: 1}];
- $httpBackend.expect('DELETE', `Zones/1/warehouses/1`).respond(200);
- controller.delete();
- $httpBackend.flush();
-
- expect(controller.deleteRow).toBeNull();
- });
- });
-});