refactor: refs #7414 update Spanish translation for 'total' to 'importe' #3397
|
@ -52,7 +52,7 @@
|
||||||
},
|
},
|
||||||
"payMethod": {
|
"payMethod": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "PayMethodFk",
|
"model": "PayMethod",
|
||||||
"foreignKey": "payMethodFk"
|
"foreignKey": "payMethodFk"
|
||||||
},
|
},
|
||||||
"company": {
|
"company": {
|
||||||
|
@ -61,4 +61,4 @@
|
||||||
"foreignKey": "companyFk"
|
"foreignKey": "companyFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2641,9 +2641,9 @@ REPLACE INTO `vn`.`invoiceIn`(`id`, `serialNumber`,`serial`, `supplierFk`, `issu
|
||||||
(9, 1009, 'R', 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1242, 0, 442, 1,util.VN_CURDATE()),
|
(9, 1009, 'R', 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1242, 0, 442, 1,util.VN_CURDATE()),
|
||||||
(10, 1010, 'R', 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1243, 0, 442, 1,util.VN_CURDATE());
|
(10, 1010, 'R', 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1243, 0, 442, 1,util.VN_CURDATE());
|
||||||
|
|
||||||
INSERT INTO `vn`.`invoiceInConfig` (`id`, `retentionRate`, `retentionName`, `sageFarmerWithholdingFk`, `daysAgo`)
|
INSERT INTO `vn`.`invoiceInConfig` (`id`, `retentionRate`, `retentionName`, `sageFarmerWithholdingFk`, `daysAgo`, `balanceStartingDate`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, -2, '2% retention', 2, 45);
|
(1, -2, '2% retention', 2, 45, '2000-01-01');
|
||||||
|
|
||||||
INSERT INTO `vn`.`invoiceInDueDay`(`invoiceInFk`, `dueDated`, `bankFk`, `amount`)
|
INSERT INTO `vn`.`invoiceInDueDay`(`invoiceInFk`, `dueDated`, `bankFk`, `amount`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -3207,7 +3207,7 @@ UPDATE vn.department
|
||||||
SET workerFk = null;
|
SET workerFk = null;
|
||||||
|
|
||||||
INSERT INTO vn.packaging
|
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,1);
|
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,0);
|
||||||
|
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.intrastat
|
INSERT IGNORE INTO vn.intrastat
|
||||||
|
@ -4052,6 +4052,9 @@ INSERT IGNORE INTO vn.saySimpleConfig (url, defaultChannel)
|
||||||
INSERT INTO vn.workerIrpf (workerFk,spouseNif, geographicMobilityDate)
|
INSERT INTO vn.workerIrpf (workerFk,spouseNif, geographicMobilityDate)
|
||||||
VALUES (1106,'26493101E','2019-09-20');
|
VALUES (1106,'26493101E','2019-09-20');
|
||||||
|
|
||||||
|
INSERT INTO vn.payment (received, supplierFk, amount, currencyFk, divisa, bankFk, payMethodFk, bankingFees, concept, companyFk, created, isConciliated, dueDated, workerFk) VALUES
|
||||||
|
(util.VN_CURDATE(), 1, 1000.00, 1, NULL, 1, 1, 0.0, 'n/pago', 442, util.VN_CURDATE(), 1, util.VN_CURDATE(), 9);
|
||||||
|
|
||||||
INSERT INTO vn.referenceRate (currencyFk, dated, value)
|
INSERT INTO vn.referenceRate (currencyFk, dated, value)
|
||||||
VALUES (2, '2000-12-01', 1.0495),
|
VALUES (2, '2000-12-01', 1.0495),
|
||||||
(2, '2001-01-01', 1.0531),
|
(2, '2001-01-01', 1.0531),
|
||||||
|
|
|
@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refres
|
||||||
OUT `vCalc` INT,
|
OUT `vCalc` INT,
|
||||||
`vRefresh` INT,
|
`vRefresh` INT,
|
||||||
`vWarehouse` INT,
|
`vWarehouse` INT,
|
||||||
`vDated` DATE
|
`vAvailabled` DATETIME
|
||||||
)
|
)
|
||||||
proc: BEGIN
|
proc: BEGIN
|
||||||
DECLARE vStartDate DATE;
|
DECLARE vStartDate DATE;
|
||||||
|
@ -12,6 +12,7 @@ proc: BEGIN
|
||||||
DECLARE vInventoryDate DATE;
|
DECLARE vInventoryDate DATE;
|
||||||
DECLARE vLifeScope DATE;
|
DECLARE vLifeScope DATE;
|
||||||
DECLARE vWarehouseFkInventory INT;
|
DECLARE vWarehouseFkInventory INT;
|
||||||
|
DECLARE vDated DATE;
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -19,13 +20,17 @@ proc: BEGIN
|
||||||
RESIGNAL;
|
RESIGNAL;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
IF vDated < util.VN_CURDATE() THEN
|
IF vAvailabled < util.VN_CURDATE() THEN
|
||||||
LEAVE proc;
|
LEAVE proc;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
SET vDated = DATE(vAvailabled);
|
||||||
|
|
||||||
|
SET vAvailabled = vDated + INTERVAL HOUR(vAvailabled) HOUR;
|
||||||
|
|
||||||
CALL vn.item_getStock(vWarehouse, vDated, NULL);
|
CALL vn.item_getStock(vWarehouse, vDated, NULL);
|
||||||
|
|
||||||
SET vParams = CONCAT_WS('/', vWarehouse, vDated);
|
SET vParams = CONCAT_WS('/', vWarehouse, vAvailabled);
|
||||||
CALL cache_calc_start (vCalc, vRefresh, 'available', vParams);
|
CALL cache_calc_start (vCalc, vRefresh, 'available', vParams);
|
||||||
|
|
||||||
IF !vRefresh THEN
|
IF !vRefresh THEN
|
||||||
|
@ -87,11 +92,10 @@ proc: BEGIN
|
||||||
SELECT i.itemFk, i.landed, i.quantity
|
SELECT i.itemFk, i.landed, i.quantity
|
||||||
FROM vn.itemEntryIn i
|
FROM vn.itemEntryIn i
|
||||||
JOIN itemRange ir ON ir.itemFk = i.itemFk
|
JOIN itemRange ir ON ir.itemFk = i.itemFk
|
||||||
LEFT JOIN edi.warehouseFloramondo wf ON wf.entryFk = i.entryFk
|
|
||||||
WHERE i.landed >= vStartDate
|
WHERE i.landed >= vStartDate
|
||||||
|
AND IFNULL(i.availabled, i.landed) <= vAvailabled
|
||||||
AND (ir.ended IS NULL OR i.landed <= ir.ended)
|
AND (ir.ended IS NULL OR i.landed <= ir.ended)
|
||||||
AND i.warehouseInFk = vWarehouse
|
AND i.warehouseInFk = vWarehouse
|
||||||
AND ISNULL(wf.entryFk)
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT i.itemFk, i.shipped, i.quantity
|
SELECT i.itemFk, i.shipped, i.quantity
|
||||||
FROM vn.itemEntryOut i
|
FROM vn.itemEntryOut i
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_transfer`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_transfer`(
|
||||||
vOriginalEntry INT,
|
vOriginalEntry INT,
|
||||||
OUT vNewEntryFk INT
|
OUT vNewEntryFk INT
|
||||||
)
|
)
|
||||||
|
|
|
@ -15,8 +15,6 @@ BEGIN
|
||||||
*
|
*
|
||||||
* @return tmp.itemList(itemFk, stock, visible, available)
|
* @return tmp.itemList(itemFk, stock, visible, available)
|
||||||
*/
|
*/
|
||||||
DECLARE vIsLogifloraDay BOOL DEFAULT vn.isLogifloraDay(vDated, vWarehouseFk);
|
|
||||||
|
|
||||||
SET vDated = TIMESTAMP(vDated, '00:00:00');
|
SET vDated = TIMESTAMP(vDated, '00:00:00');
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.itemList
|
CREATE OR REPLACE TEMPORARY TABLE tmp.itemList
|
||||||
|
@ -36,14 +34,11 @@ BEGIN
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT iei.itemFk, iei.quantity
|
SELECT iei.itemFk, iei.quantity
|
||||||
FROM itemEntryIn iei
|
FROM itemEntryIn iei
|
||||||
LEFT JOIN edi.warehouseFloramondo wf ON wf.entryFk = iei.entryFk
|
|
||||||
JOIN item i ON i.id = iei.itemFk
|
JOIN item i ON i.id = iei.itemFk
|
||||||
WHERE iei.landed >= util.VN_CURDATE()
|
WHERE iei.landed >= util.VN_CURDATE()
|
||||||
AND iei.landed < vDated
|
AND iei.landed < vDated
|
||||||
AND iei.warehouseInFk = vWarehouseFk
|
AND iei.warehouseInFk = vWarehouseFk
|
||||||
AND (vItemFk IS NULL OR iei.itemFk = vItemFk)
|
AND (vItemFk IS NULL OR iei.itemFk = vItemFk)
|
||||||
AND (wf.entryFk IS NULL OR vIsLogifloraDay)
|
|
||||||
AND NOT (iei.landed > util.VN_CURDATE() AND i.isFloramondo)
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT ieo.itemFk, ieo.quantity
|
SELECT ieo.itemFk, ieo.quantity
|
||||||
FROM itemEntryOut ieo
|
FROM itemEntryOut ieo
|
||||||
|
@ -52,7 +47,6 @@ BEGIN
|
||||||
AND ieo.shipped < vDated
|
AND ieo.shipped < vDated
|
||||||
AND ieo.warehouseOutFk = vWarehouseFk
|
AND ieo.warehouseOutFk = vWarehouseFk
|
||||||
AND (vItemFk IS NULL OR ieo.itemFk = vItemFk)
|
AND (vItemFk IS NULL OR ieo.itemFk = vItemFk)
|
||||||
AND NOT (ieo.shipped > util.VN_CURDATE() AND i.isFloramondo)
|
|
||||||
) sub
|
) sub
|
||||||
GROUP BY itemFk
|
GROUP BY itemFk
|
||||||
HAVING stock;
|
HAVING stock;
|
||||||
|
|
|
@ -41,6 +41,7 @@ BEGIN
|
||||||
) currencyBalance
|
) currencyBalance
|
||||||
FROM (
|
FROM (
|
||||||
SELECT NULL bankFk,
|
SELECT NULL bankFk,
|
||||||
|
NULL bank,
|
||||||
ii.companyFk,
|
ii.companyFk,
|
||||||
ii.serial,
|
ii.serial,
|
||||||
ii.id,
|
ii.id,
|
||||||
|
@ -74,6 +75,7 @@ BEGIN
|
||||||
GROUP BY iid.id, ii.id
|
GROUP BY iid.id, ii.id
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT p.bankFk,
|
SELECT p.bankFk,
|
||||||
|
a.bank,
|
||||||
p.companyFk,
|
p.companyFk,
|
||||||
NULL,
|
NULL,
|
||||||
p.id,
|
p.id,
|
||||||
|
@ -109,6 +111,7 @@ BEGIN
|
||||||
AND (vIsConciliated = p.isConciliated OR NOT vIsConciliated)
|
AND (vIsConciliated = p.isConciliated OR NOT vIsConciliated)
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT NULL,
|
SELECT NULL,
|
||||||
|
NULL bankFk,
|
||||||
companyFk,
|
companyFk,
|
||||||
NULL,
|
NULL,
|
||||||
se.id,
|
se.id,
|
||||||
|
@ -136,6 +139,7 @@ BEGIN
|
||||||
AND (vIsConciliated = se.isConciliated OR NOT vIsConciliated)
|
AND (vIsConciliated = se.isConciliated OR NOT vIsConciliated)
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT NULL bankFk,
|
SELECT NULL bankFk,
|
||||||
|
NULL,
|
||||||
e.companyFk,
|
e.companyFk,
|
||||||
'E' serial,
|
'E' serial,
|
||||||
e.invoiceNumber id,
|
e.invoiceNumber id,
|
||||||
|
@ -154,7 +158,7 @@ BEGIN
|
||||||
JOIN travel tr ON tr.id = e.travelFk
|
JOIN travel tr ON tr.id = e.travelFk
|
||||||
JOIN currency c ON c.id = e.currencyFk
|
JOIN currency c ON c.id = e.currencyFk
|
||||||
WHERE e.supplierFk = vSupplierFk
|
WHERE e.supplierFk = vSupplierFk
|
||||||
AND tr.landed >= CURDATE()
|
AND tr.landed >= util.VN_CURDATE()
|
||||||
AND e.invoiceInFk IS NULL
|
AND e.invoiceInFk IS NULL
|
||||||
AND vHasEntries
|
AND vHasEntries
|
||||||
ORDER BY (dated IS NULL AND NOT isBooked),
|
ORDER BY (dated IS NULL AND NOT isBooked),
|
||||||
|
|
|
@ -16,5 +16,9 @@ BEGIN
|
||||||
IF NEW.awbFk IS NOT NULL THEN
|
IF NEW.awbFk IS NOT NULL THEN
|
||||||
CALL travel_throwAwb(NEW.id);
|
CALL travel_throwAwb(NEW.id);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
IF NEW.availabled < NEW.landed THEN
|
||||||
|
CALL util.throw('The travel availabled cannot be earlier than landed');
|
||||||
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -40,5 +40,9 @@ BEGIN
|
||||||
IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL THEN
|
IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL THEN
|
||||||
CALL travel_throwAwb(NEW.id);
|
CALL travel_throwAwb(NEW.id);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
IF NEW.availabled < NEW.landed THEN
|
||||||
|
CALL util.throw('The travel availabled cannot be earlier than landed');
|
||||||
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -7,7 +7,8 @@ AS SELECT `t`.`warehouseInFk` AS `warehouseInFk`,
|
||||||
`b`.`quantity` AS `quantity`,
|
`b`.`quantity` AS `quantity`,
|
||||||
`t`.`isReceived` AS `isReceived`,
|
`t`.`isReceived` AS `isReceived`,
|
||||||
`t`.`isRaid` AS `isVirtualStock`,
|
`t`.`isRaid` AS `isVirtualStock`,
|
||||||
`e`.`id` AS `entryFk`
|
`e`.`id` AS `entryFk`,
|
||||||
|
`t`.`availabled`
|
||||||
FROM (
|
FROM (
|
||||||
(
|
(
|
||||||
`vn`.`buy` `b`
|
`vn`.`buy` `b`
|
||||||
|
|
|
@ -18,5 +18,6 @@ AS SELECT `p`.`id` AS `Id_Cubo`,
|
||||||
`p`.`base` AS `Base`,
|
`p`.`base` AS `Base`,
|
||||||
`p`.`isBox` AS `box`,
|
`p`.`isBox` AS `box`,
|
||||||
`p`.`returnCost` AS `costeRetorno`,
|
`p`.`returnCost` AS `costeRetorno`,
|
||||||
`p`.`isActive` AS `isActive`
|
`p`.`isActive` AS `isActive`,
|
||||||
|
`p`.`flippingCost` AS `flippingCost`
|
||||||
FROM `vn`.`packaging` `p`
|
FROM `vn`.`packaging` `p`
|
||||||
|
|
|
@ -29,5 +29,6 @@ AS SELECT `a`.`id` AS `id`,
|
||||||
`a`.`invoiceInPaletizedFk` AS `invoiceInPaletizedFk`,
|
`a`.`invoiceInPaletizedFk` AS `invoiceInPaletizedFk`,
|
||||||
`a`.`observation` AS `observation`,
|
`a`.`observation` AS `observation`,
|
||||||
`a`.`hasFreightPrepaid` AS `hasFreightPrepaid`,
|
`a`.`hasFreightPrepaid` AS `hasFreightPrepaid`,
|
||||||
`a`.`propertyNumber` AS `propertyNumber`
|
`a`.`propertyNumber` AS `propertyNumber`,
|
||||||
|
`a`.`costPerKg` AS `costPerKg`
|
||||||
FROM `vn`.`awb` `a`
|
FROM `vn`.`awb` `a`
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
ALTER TABLE vn.business
|
||||||
|
ADD CONSTRAINT `business_companyCodeFk` FOREIGN KEY (`companyCodeFk`) REFERENCES `company` (`code`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
-- Auto-generated SQL script. Actual values for binary/complex data types may differ - what you see is the default string representation of values.
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('BusinessReasonEnd','find','*','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('CalendarType','find','*','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('OccupationCode','find','*','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('BusinessReasonEnd','find','*','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('WorkerBusinessProfessionalCategory','find','*','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('WorkerBusinessAgreement','find','*','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('WorkerBusinessType','find','*','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('PayrollCategory','find','*','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Worker','__get__business','*','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Worker','__create__business','*','ALLOW','ROLE','hr');
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Business','crud','*','ALLOW','ROLE','hr');
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
-- Place your SQL code here
|
||||||
|
ALTER TABLE vn.travel ADD IF NOT EXISTS availabled DATETIME NULL
|
||||||
|
COMMENT 'Indicates the moment in time when the goods become available for picking';
|
|
@ -0,0 +1,2 @@
|
||||||
|
INSERT IGNORE INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES('Entry', 'transfer', 'WRITE', 'ALLOW', 'ROLE', 'coolerBoss');
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE vn.packaging
|
||||||
|
ADD COLUMN flippingCost decimal(10, 2) NOT NULL DEFAULT 0.00
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.travel CHANGE appointment appointment__ datetime DEFAULT NULL COMMENT '@deprecated 2025-01-28';
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE `vn`.`awb`
|
||||||
|
ADD COLUMN `costPerKg` DECIMAL(10, 2) UNSIGNED DEFAULT NULL COMMENT 'Tarifa que indica a cuanto cuesta el kilo en ese vuelo';
|
|
@ -1,65 +0,0 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
|
||||||
|
|
||||||
describe('Client defaulter path', () => {
|
|
||||||
let browser;
|
|
||||||
let page;
|
|
||||||
|
|
||||||
beforeAll(async() => {
|
|
||||||
browser = await getBrowser();
|
|
||||||
page = browser.page;
|
|
||||||
await page.loginAndModule('insurance', 'client');
|
|
||||||
await page.accessToSection('client.defaulter');
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async() => {
|
|
||||||
await browser.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should count the amount of clients in the turns section', async() => {
|
|
||||||
const result = await page.countElement(selectors.clientDefaulter.anyClient);
|
|
||||||
|
|
||||||
expect(result).toEqual(6);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should check contain expected client', async() => {
|
|
||||||
const clientName =
|
|
||||||
await page.waitToGetProperty(selectors.clientDefaulter.firstClientName, 'innerText');
|
|
||||||
const salesPersonName =
|
|
||||||
await page.waitToGetProperty(selectors.clientDefaulter.firstSalesPersonName, 'innerText');
|
|
||||||
|
|
||||||
expect(clientName).toEqual('Ororo Munroe');
|
|
||||||
expect(salesPersonName).toEqual('salesperson');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should first observation not changed', async() => {
|
|
||||||
const expectedObservation = 'Madness, as you know, is like gravity, all it takes is a little push';
|
|
||||||
const result = await page.waitToGetProperty(selectors.clientDefaulter.firstObservation, 'value');
|
|
||||||
|
|
||||||
expect(result).toContain(expectedObservation);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not add empty observation', async() => {
|
|
||||||
await page.waitToClick(selectors.clientDefaulter.allDefaulterCheckbox);
|
|
||||||
|
|
||||||
await page.waitToClick(selectors.clientDefaulter.addObservationButton);
|
|
||||||
await page.write(selectors.clientDefaulter.observation, '');
|
|
||||||
await page.waitToClick(selectors.clientDefaulter.saveButton);
|
|
||||||
const message = await page.waitForSnackbar();
|
|
||||||
|
|
||||||
expect(message.text).toContain(`The message can't be empty`);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should checked all defaulters', async() => {
|
|
||||||
await page.loginAndModule('insurance', 'client');
|
|
||||||
await page.accessToSection('client.defaulter');
|
|
||||||
|
|
||||||
await page.waitToClick(selectors.clientDefaulter.allDefaulterCheckbox);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should add observation for all clients', async() => {
|
|
||||||
await page.waitToClick(selectors.clientDefaulter.addObservationButton);
|
|
||||||
await page.write(selectors.clientDefaulter.observation, 'My new observation');
|
|
||||||
await page.waitToClick(selectors.clientDefaulter.saveButton);
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -158,10 +158,12 @@ module.exports = Self => {
|
||||||
a.provinceFk AS provinceAddressFk,
|
a.provinceFk AS provinceAddressFk,
|
||||||
p.name AS province,
|
p.name AS province,
|
||||||
u.id AS salesPersonFk,
|
u.id AS salesPersonFk,
|
||||||
u.name AS salesPerson
|
u.name AS salesPerson,
|
||||||
|
co.name AS country
|
||||||
FROM client c
|
FROM client c
|
||||||
LEFT JOIN account.user u ON u.id = c.salesPersonFk
|
LEFT JOIN account.user u ON u.id = c.salesPersonFk
|
||||||
LEFT JOIN province p ON p.id = c.provinceFk
|
LEFT JOIN province p ON p.id = c.provinceFk
|
||||||
|
LEFT JOIN country co ON co.id = c.countryFk
|
||||||
JOIN address a ON a.clientFk = c.id
|
JOIN address a ON a.clientFk = c.id
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
|
|
|
@ -139,5 +139,23 @@
|
||||||
},
|
},
|
||||||
"Xdiario": {
|
"Xdiario": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"BusinessReasonEnd": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"OccupationCode": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"WorkerBusinessProfessionalCategory": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"CalendarType": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"WorkerBusinessType": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"PayrollCategory": {
|
||||||
|
"dataSource": "vn"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"name": "BusinessReasonEnd",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "businessReasonEnd"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"reason": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,6 +13,63 @@
|
||||||
},
|
},
|
||||||
"workcenterFk" : {
|
"workcenterFk" : {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
|
},
|
||||||
|
"companyCodeFk" : {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"started" : {
|
||||||
|
"type": "date"
|
||||||
|
},
|
||||||
|
"ended" : {
|
||||||
|
"type": "date"
|
||||||
|
},
|
||||||
|
"workerBusiness" : {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"reasonEndFk" : {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"payedHolidays" : {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"occupationCodeFk" : {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workerFk" : {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"notes" : {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"departmentFk": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"workerBusinessProfessionalCategoryFk": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"calendarTypeFk": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"isHourlyLabor": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"rate": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"workerBusinessCategoryFk": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"workerBusinessTypeFk": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"amount": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"workerBusinessAgreementFk": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"basicSalary": {
|
||||||
|
"type": "number"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
@ -25,6 +82,59 @@
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Department",
|
"model": "Department",
|
||||||
"foreignKey": "departmentFk"
|
"foreignKey": "departmentFk"
|
||||||
|
},
|
||||||
|
"workCenter": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "WorkCenter",
|
||||||
|
"foreignKey": "workcenterFk"
|
||||||
|
},
|
||||||
|
"companyCode": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Company",
|
||||||
|
"foreignKey": "companyCodeFk",
|
||||||
|
"primaryKey": "code"
|
||||||
|
},
|
||||||
|
"reasonEnd": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "BusinessReasonEnd",
|
||||||
|
"foreignKey": "reasonEndFk"
|
||||||
|
},
|
||||||
|
"occupationCode": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "OccupationCode",
|
||||||
|
"foreignKey":"occupationCodeFk",
|
||||||
|
"primaryKey": "code"
|
||||||
|
},
|
||||||
|
"payrollCategory": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "PayrollCategory",
|
||||||
|
"foreignKey":"workerBusinessCategoryFk"
|
||||||
|
},
|
||||||
|
"workerBusinessProfessionalCategory": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "WorkerBusinessProfessionalCategory",
|
||||||
|
"foreignKey": "workerBusinessProfessionalCategoryFk"
|
||||||
|
},
|
||||||
|
"calendarType": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "CalendarType",
|
||||||
|
"foreignKey": "calendarTypeFk"
|
||||||
|
},
|
||||||
|
"workerBusinessCategory": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "WorkerBusinessCategory",
|
||||||
|
"foreignKey": "workerBusinessCategoryFk"
|
||||||
|
},
|
||||||
|
"workerBusinessType": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "WorkerBusinessType",
|
||||||
|
"foreignKey": "workerBusinessTypeFk"
|
||||||
|
},
|
||||||
|
"workerBusinessAgreement": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "WorkerBusinessAgreement",
|
||||||
|
"foreignKey": "workerBusinessAgreementFk"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"name": "CalendarType",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "calendarType"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"hoursWeek": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"isPartial": "number"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"name": "OccupationCode",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "occupationCode"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"code": {
|
||||||
|
"type": "string",
|
||||||
|
"id": true
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"name": "PayrollCategory",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "payrollCategories"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"rate": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"name": "WorkerBusinessProfessionalCategory",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "professionalCategory"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"code": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
"name": "WorkerBusinessAgreement",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "workerBusinessAgreement"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"monthHolidays": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"yearsHours": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"started": {
|
||||||
|
"type": "date"
|
||||||
|
},
|
||||||
|
"ended": {
|
||||||
|
"type": "date"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"name": "WorkerBusinessType",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "workerBusinessType"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"isFullTime": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"isPermanent": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"hasHolidayEntitlement": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,200 +1,2 @@
|
||||||
<vn-crud-model
|
|
||||||
vn-id="model"
|
|
||||||
url="Defaulters/filter"
|
|
||||||
filter="::$ctrl.filter"
|
|
||||||
limit="20"
|
|
||||||
order="amount DESC"
|
|
||||||
data="$ctrl.defaulters"
|
|
||||||
on-data-change="$ctrl.reCheck()"
|
|
||||||
auto-load="true">
|
|
||||||
</vn-crud-model>
|
|
||||||
<vn-portal slot="topbar">
|
|
||||||
<vn-searchbar
|
|
||||||
vn-focus
|
|
||||||
placeholder="Search client"
|
|
||||||
info="Search client by id or name"
|
|
||||||
auto-state="false"
|
|
||||||
model="model">
|
|
||||||
</vn-searchbar>
|
|
||||||
</vn-portal>
|
|
||||||
<vn-card>
|
<vn-card>
|
||||||
<smart-table
|
|
||||||
model="model"
|
|
||||||
options="$ctrl.smartTableOptions"
|
|
||||||
expr-builder="$ctrl.exprBuilder(param, value)">
|
|
||||||
<slot-actions>
|
|
||||||
<div>
|
|
||||||
<div class="totalBox" style="text-align: center;">
|
|
||||||
<h6 translate>Total</h6>
|
|
||||||
<vn-label-value
|
|
||||||
label="Balance due"
|
|
||||||
value="{{$ctrl.balanceDueTotal | currency: 'EUR': 2}}">
|
|
||||||
</vn-label-value>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="vn-pa-md">
|
|
||||||
<vn-button
|
|
||||||
disabled="$ctrl.checked.length == 0"
|
|
||||||
ng-click="notesDialog.show()"
|
|
||||||
name="notesDialog"
|
|
||||||
vn-tooltip="Add observation"
|
|
||||||
icon="icon-notes">
|
|
||||||
</vn-button>
|
|
||||||
</div>
|
|
||||||
</slot-actions>
|
|
||||||
<slot-table>
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th shrink>
|
|
||||||
<vn-multi-check
|
|
||||||
model="model">
|
|
||||||
</vn-multi-check>
|
|
||||||
</th>
|
|
||||||
<th field="clientFk">
|
|
||||||
<span translate>Client</span>
|
|
||||||
</th>
|
|
||||||
<th field="isWorker">
|
|
||||||
<span translate>Es trabajador</span>
|
|
||||||
</th>
|
|
||||||
<th field="salesPersonFk">
|
|
||||||
<span translate>Comercial</span>
|
|
||||||
</th>
|
|
||||||
<th field="countryFk">
|
|
||||||
<span translate>Country</span>
|
|
||||||
</th>
|
|
||||||
<th field="payMethod"
|
|
||||||
vn-tooltip="Pay Method">
|
|
||||||
<span translate>P.Method</span>
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
field="amount"
|
|
||||||
vn-tooltip="Balance due">
|
|
||||||
<span translate>Balance D.</span>
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
field="workerFk"
|
|
||||||
vn-tooltip="Worker who made the last observation">
|
|
||||||
<span translate>Author</span>
|
|
||||||
</th>
|
|
||||||
<th field="observation" expand>
|
|
||||||
<span translate>Last observation</span>
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
vn-tooltip="Last observation date"
|
|
||||||
field="created">
|
|
||||||
<span translate>L. O. Date</span>
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
vn-tooltip="Credit insurance"
|
|
||||||
field="creditInsurance"
|
|
||||||
shrink>
|
|
||||||
<span translate>Credit I.</span>
|
|
||||||
</th>
|
|
||||||
<th field="defaulterSinced">
|
|
||||||
<span translate>From</span>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr ng-repeat="defaulter in $ctrl.defaulters">
|
|
||||||
<td shrink>
|
|
||||||
<vn-check
|
|
||||||
ng-model="defaulter.checked"
|
|
||||||
on-change="$ctrl.saveChecked(defaulter.clientFk)"
|
|
||||||
vn-click-stop>
|
|
||||||
</vn-check>
|
|
||||||
</td>
|
|
||||||
<td title="{{::defaulter.clientName}}">
|
|
||||||
<span
|
|
||||||
vn-click-stop="clientDescriptor.show($event, defaulter.clientFk)"
|
|
||||||
title ="{{::defaulter.clientName}}"
|
|
||||||
class="link">
|
|
||||||
{{::defaulter.clientName}}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<vn-check
|
|
||||||
ng-model="defaulter.isWorker"
|
|
||||||
disabled="true">
|
|
||||||
</vn-check>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<span
|
|
||||||
title="{{::defaulter.salesPersonName}}"
|
|
||||||
vn-click-stop="workerDescriptor.show($event, defaulter.salesPersonFk)"
|
|
||||||
class="link">
|
|
||||||
{{::defaulter.salesPersonName | dashIfEmpty}}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{{::defaulter.country}}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{{::defaulter.payMethod}}
|
|
||||||
</td>
|
|
||||||
<td>{{::defaulter.amount | currency: 'EUR': 2}}</td>
|
|
||||||
<td>
|
|
||||||
<span
|
|
||||||
title="{{::defaulter.workerName}}"
|
|
||||||
vn-click-stop="workerDescriptor.show($event, defaulter.workerFk)"
|
|
||||||
class="link">
|
|
||||||
{{::defaulter.workerName | dashIfEmpty}}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td expand>
|
|
||||||
<vn-textarea
|
|
||||||
vn-three
|
|
||||||
disabled="true"
|
|
||||||
ng-model="defaulter.observation">
|
|
||||||
</vn-textarea>
|
|
||||||
</td>
|
|
||||||
<td shrink-date>
|
|
||||||
<span class="chip {{::$ctrl.chipColor(defaulter.created)}}">
|
|
||||||
{{::defaulter.created | date: 'dd/MM/yyyy'}}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td shrink>{{::defaulter.creditInsurance | currency: 'EUR': 2}}</td>
|
|
||||||
<td shrink-date>{{::defaulter.defaulterSinced | date: 'dd/MM/yyyy'}}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</slot-table>
|
|
||||||
</smart-table>
|
|
||||||
</vn-card>
|
</vn-card>
|
||||||
<vn-client-descriptor-popover
|
|
||||||
vn-id="client-descriptor">
|
|
||||||
</vn-client-descriptor-popover>
|
|
||||||
<vn-worker-descriptor-popover
|
|
||||||
vn-id="worker-descriptor">
|
|
||||||
</vn-worker-descriptor-popover>
|
|
||||||
<vn-popup vn-id="dialog-summary-client">
|
|
||||||
<vn-client-summary
|
|
||||||
client="$ctrl.clientSelected">
|
|
||||||
</vn-client-summary>
|
|
||||||
</vn-popup>
|
|
||||||
|
|
||||||
<!-- Dialog of add notes button -->
|
|
||||||
<vn-dialog
|
|
||||||
vn-id="notesDialog"
|
|
||||||
on-accept="$ctrl.onResponse()">
|
|
||||||
<tpl-body>
|
|
||||||
<section class="SMSDialog">
|
|
||||||
<h5 class="vn-py-sm">{{$ctrl.$t('Add observation to all selected clients', {total: $ctrl.checked.length})}}</h5>
|
|
||||||
<vn-horizontal>
|
|
||||||
<vn-textarea vn-one
|
|
||||||
vn-id="message"
|
|
||||||
label="Message"
|
|
||||||
ng-model="$ctrl.defaulter.observation"
|
|
||||||
rows="3"
|
|
||||||
required="true"
|
|
||||||
rule>
|
|
||||||
</vn-textarea>
|
|
||||||
</vn-horizontal>
|
|
||||||
</section>
|
|
||||||
</tpl-body>
|
|
||||||
<tpl-buttons>
|
|
||||||
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
|
|
||||||
<button response="accept" translate>Save</button>
|
|
||||||
</tpl-buttons>
|
|
||||||
</vn-dialog>
|
|
||||||
|
|
|
@ -1,199 +1,13 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
import Section from 'salix/components/section';
|
import Section from 'salix/components/section';
|
||||||
import UserError from 'core/lib/user-error';
|
|
||||||
|
|
||||||
export default class Controller extends Section {
|
export default class Controller extends Section {
|
||||||
constructor($element, $) {
|
constructor($element, $) {
|
||||||
super($element, $);
|
super($element, $);
|
||||||
this.defaulter = {};
|
|
||||||
this.defaulters = [];
|
|
||||||
this.checkedDefaulers = [];
|
|
||||||
|
|
||||||
this.smartTableOptions = {
|
|
||||||
activeButtons: {
|
|
||||||
search: true
|
|
||||||
},
|
|
||||||
columns: [
|
|
||||||
{
|
|
||||||
field: 'clientFk',
|
|
||||||
autocomplete: {
|
|
||||||
url: 'Clients',
|
|
||||||
showField: 'name',
|
|
||||||
valueField: 'id'
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
field: 'salesPersonFk',
|
|
||||||
autocomplete: {
|
|
||||||
url: 'Workers/activeWithInheritedRole',
|
|
||||||
where: `{role: 'salesPerson'}`,
|
|
||||||
searchFunction: '{firstName: $search}',
|
|
||||||
showField: 'name',
|
|
||||||
valueField: 'id',
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
field: 'countryFk',
|
|
||||||
autocomplete: {
|
|
||||||
url: 'Countries',
|
|
||||||
showField: 'country',
|
|
||||||
valueField: 'id'
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
field: 'payMethodFk',
|
|
||||||
autocomplete: {
|
|
||||||
showField: 'name',
|
|
||||||
valueField: 'id'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'workerFk',
|
|
||||||
autocomplete: {
|
|
||||||
url: 'Workers/activeWithInheritedRole',
|
|
||||||
searchFunction: '{firstName: $search}',
|
|
||||||
showField: 'name',
|
|
||||||
valueField: 'id',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'observation',
|
|
||||||
searchable: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'isWorker',
|
|
||||||
checkbox: true,
|
|
||||||
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'created',
|
|
||||||
datepicker: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'defaulterSinced',
|
|
||||||
datepicker: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
|
|
||||||
this.getBalanceDueTotal();
|
|
||||||
}
|
}
|
||||||
|
async $onInit() {
|
||||||
set defaulters(value) {
|
this.$state.go('customer.defaulter', {id: this.$params.id});
|
||||||
if (!value || !value.length) return;
|
window.location.href = await this.vnApp.getUrl(`customer/defaulter`);
|
||||||
this._defaulters = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
get defaulters() {
|
|
||||||
return this._defaulters;
|
|
||||||
}
|
|
||||||
|
|
||||||
get checked() {
|
|
||||||
const clients = this.$.model.data || [];
|
|
||||||
const checkedLines = [];
|
|
||||||
for (let defaulter of clients) {
|
|
||||||
if (defaulter.checked)
|
|
||||||
checkedLines.push(defaulter);
|
|
||||||
}
|
|
||||||
|
|
||||||
return checkedLines;
|
|
||||||
}
|
|
||||||
|
|
||||||
saveChecked(clientId) {
|
|
||||||
this.checkedDefaulers = this.checkedDefaulers.includes(clientId) ?
|
|
||||||
this.checkedDefaulers.filter(id => id !== clientId) : [...this.checkedDefaulers, clientId];
|
|
||||||
}
|
|
||||||
|
|
||||||
reCheck() {
|
|
||||||
if (!this.$.model.data || !this.checkedDefaulers.length) return;
|
|
||||||
|
|
||||||
this.$.model.data.forEach(defaulter => {
|
|
||||||
defaulter.checked = this.checkedDefaulers.includes(defaulter.clientFk);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
getBalanceDueTotal() {
|
|
||||||
this.$http.get('Defaulters/filter')
|
|
||||||
.then(res => {
|
|
||||||
if (!res.data) return 0;
|
|
||||||
|
|
||||||
this.balanceDueTotal = res.data.reduce(
|
|
||||||
(accumulator, currentValue) => {
|
|
||||||
return accumulator + (currentValue['amount'] || 0);
|
|
||||||
}, 0);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
chipColor(date) {
|
|
||||||
const day = 24 * 60 * 60 * 1000;
|
|
||||||
const today = Date.vnNew();
|
|
||||||
today.setHours(0, 0, 0, 0);
|
|
||||||
|
|
||||||
const observationShipped = new Date(date);
|
|
||||||
observationShipped.setHours(0, 0, 0, 0);
|
|
||||||
|
|
||||||
const difference = today - observationShipped;
|
|
||||||
|
|
||||||
if (difference > (day * 20))
|
|
||||||
return 'alert';
|
|
||||||
if (difference > (day * 10))
|
|
||||||
return 'warning';
|
|
||||||
}
|
|
||||||
|
|
||||||
onResponse() {
|
|
||||||
if (!this.defaulter.observation)
|
|
||||||
throw new UserError(`The message can't be empty`);
|
|
||||||
|
|
||||||
const params = [];
|
|
||||||
for (let defaulter of this.checked) {
|
|
||||||
params.push({
|
|
||||||
text: this.defaulter.observation,
|
|
||||||
clientFk: defaulter.clientFk
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$http.post(`ClientObservations`, params) .then(() => {
|
|
||||||
this.vnApp.showSuccess(this.$t('Observation saved!'));
|
|
||||||
this.sendMail();
|
|
||||||
this.$state.reload();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
sendMail() {
|
|
||||||
const params = {
|
|
||||||
defaulters: this.checked,
|
|
||||||
observation: this.defaulter.observation,
|
|
||||||
};
|
|
||||||
this.$http.post(`Defaulters/observationEmail`, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
exprBuilder(param, value) {
|
|
||||||
switch (param) {
|
|
||||||
case 'isWorker':
|
|
||||||
return {isWorker: value};
|
|
||||||
case 'creditInsurance':
|
|
||||||
case 'amount':
|
|
||||||
case 'clientFk':
|
|
||||||
case 'workerFk':
|
|
||||||
case 'countryFk':
|
|
||||||
case 'payMethod':
|
|
||||||
case 'salesPersonFk':
|
|
||||||
return {[`d.${param}`]: value};
|
|
||||||
case 'created':
|
|
||||||
return {'d.created': {
|
|
||||||
between: this.dateRange(value)}
|
|
||||||
};
|
|
||||||
case 'defaulterSinced':
|
|
||||||
return {'d.defaulterSinced': {
|
|
||||||
between: this.dateRange(value)}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dateRange(value) {
|
|
||||||
const minHour = new Date(value);
|
|
||||||
minHour.setHours(0, 0, 0, 0);
|
|
||||||
const maxHour = new Date(value);
|
|
||||||
maxHour.setHours(23, 59, 59, 59);
|
|
||||||
|
|
||||||
return [minHour, maxHour];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,179 +0,0 @@
|
||||||
import './index';
|
|
||||||
import crudModel from 'core/mocks/crud-model';
|
|
||||||
|
|
||||||
describe('client defaulter', () => {
|
|
||||||
describe('Component vnClientDefaulter', () => {
|
|
||||||
let controller;
|
|
||||||
let $httpBackend;
|
|
||||||
|
|
||||||
beforeEach(ngModule('client'));
|
|
||||||
|
|
||||||
beforeEach(inject(($componentController, _$httpBackend_) => {
|
|
||||||
$httpBackend = _$httpBackend_;
|
|
||||||
const $element = angular.element('<vn-client-defaulter></vn-client-defaulter>');
|
|
||||||
controller = $componentController('vnClientDefaulter', {$element});
|
|
||||||
controller.$.model = crudModel;
|
|
||||||
controller.$.model.data = [
|
|
||||||
{clientFk: 1101, amount: 125},
|
|
||||||
{clientFk: 1102, amount: 500},
|
|
||||||
{clientFk: 1103, amount: 250}
|
|
||||||
];
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe('checked() getter', () => {
|
|
||||||
it('should return the checked lines', () => {
|
|
||||||
const data = controller.$.model.data;
|
|
||||||
data[1].checked = true;
|
|
||||||
data[2].checked = true;
|
|
||||||
|
|
||||||
const checkedRows = controller.checked;
|
|
||||||
|
|
||||||
const firstCheckedRow = checkedRows[0];
|
|
||||||
const secondCheckedRow = checkedRows[1];
|
|
||||||
|
|
||||||
expect(firstCheckedRow.clientFk).toEqual(1102);
|
|
||||||
expect(secondCheckedRow.clientFk).toEqual(1103);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('chipColor()', () => {
|
|
||||||
it('should return undefined when the date is the present', () => {
|
|
||||||
let today = Date.vnNew();
|
|
||||||
let result = controller.chipColor(today);
|
|
||||||
|
|
||||||
expect(result).toEqual(undefined);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return warning when the date is 10 days in the past', () => {
|
|
||||||
let pastDate = Date.vnNew();
|
|
||||||
pastDate = pastDate.setDate(pastDate.getDate() - 11);
|
|
||||||
let result = controller.chipColor(pastDate);
|
|
||||||
|
|
||||||
expect(result).toEqual('warning');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return alert when the date is 20 days in the past', () => {
|
|
||||||
let pastDate = Date.vnNew();
|
|
||||||
pastDate = pastDate.setDate(pastDate.getDate() - 21);
|
|
||||||
let result = controller.chipColor(pastDate);
|
|
||||||
|
|
||||||
expect(result).toEqual('alert');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('onResponse()', () => {
|
|
||||||
it('should return error for empty message', () => {
|
|
||||||
let error;
|
|
||||||
try {
|
|
||||||
controller.onResponse();
|
|
||||||
} catch (e) {
|
|
||||||
error = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(error).toBeDefined();
|
|
||||||
expect(error.message).toBe(`The message can't be empty`);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return saved message', () => {
|
|
||||||
const data = controller.$.model.data;
|
|
||||||
data[1].checked = true;
|
|
||||||
controller.defaulter = {observation: 'My new observation'};
|
|
||||||
|
|
||||||
const params = [{text: controller.defaulter.observation, clientFk: data[1].clientFk}];
|
|
||||||
|
|
||||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
|
||||||
$httpBackend.expect('GET', `Defaulters/filter`).respond(200);
|
|
||||||
$httpBackend.expect('POST', `ClientObservations`, params).respond(200, params);
|
|
||||||
$httpBackend.expect('POST', `Defaulters/observationEmail`).respond(200);
|
|
||||||
|
|
||||||
controller.onResponse();
|
|
||||||
$httpBackend.flush();
|
|
||||||
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Observation saved!');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('exprBuilder()', () => {
|
|
||||||
it('should search by sales person', () => {
|
|
||||||
const expr = controller.exprBuilder('salesPersonFk', '5');
|
|
||||||
|
|
||||||
expect(expr).toEqual({'d.salesPersonFk': '5'});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should search by client', () => {
|
|
||||||
const expr = controller.exprBuilder('clientFk', '5');
|
|
||||||
|
|
||||||
expect(expr).toEqual({'d.clientFk': '5'});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('getBalanceDueTotal()', () => {
|
|
||||||
it('should return balance due total', () => {
|
|
||||||
const defaulters = controller.$.model.data;
|
|
||||||
$httpBackend.when('GET', `Defaulters/filter`).respond(defaulters);
|
|
||||||
|
|
||||||
controller.getBalanceDueTotal();
|
|
||||||
$httpBackend.flush();
|
|
||||||
|
|
||||||
expect(controller.balanceDueTotal).toEqual(875);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('dateRange()', () => {
|
|
||||||
it('should return two dates with the hours at the start and end of the given date', () => {
|
|
||||||
const now = Date.vnNew();
|
|
||||||
|
|
||||||
const today = now.getDate();
|
|
||||||
|
|
||||||
const dateRange = controller.dateRange(now);
|
|
||||||
const start = dateRange[0].toString();
|
|
||||||
const end = dateRange[1].toString();
|
|
||||||
|
|
||||||
expect(start).toContain(today);
|
|
||||||
expect(start).toContain('00:00:00');
|
|
||||||
|
|
||||||
expect(end).toContain(today);
|
|
||||||
expect(end).toContain('23:59:59');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('reCheck()', () => {
|
|
||||||
it(`should recheck buys`, () => {
|
|
||||||
controller.$.model.data = [
|
|
||||||
{checked: false, clientFk: 1},
|
|
||||||
{checked: false, clientFk: 2},
|
|
||||||
{checked: false, clientFk: 3},
|
|
||||||
{checked: false, clientFk: 4},
|
|
||||||
];
|
|
||||||
controller.checkedDefaulers = [1, 2];
|
|
||||||
|
|
||||||
controller.reCheck();
|
|
||||||
|
|
||||||
expect(controller.$.model.data[0].checked).toEqual(true);
|
|
||||||
expect(controller.$.model.data[1].checked).toEqual(true);
|
|
||||||
expect(controller.$.model.data[2].checked).toEqual(false);
|
|
||||||
expect(controller.$.model.data[3].checked).toEqual(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('saveChecked()', () => {
|
|
||||||
it(`should check buy`, () => {
|
|
||||||
const buyCheck = 3;
|
|
||||||
controller.checkedDefaulers = [1, 2];
|
|
||||||
|
|
||||||
controller.saveChecked(buyCheck);
|
|
||||||
|
|
||||||
expect(controller.checkedDefaulers[2]).toEqual(buyCheck);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should uncheck buy`, () => {
|
|
||||||
const buyUncheck = 3;
|
|
||||||
controller.checkedDefaulers = [1, 2, 3];
|
|
||||||
|
|
||||||
controller.saveChecked(buyUncheck);
|
|
||||||
|
|
||||||
expect(controller.checkedDefaulers[2]).toEqual(undefined);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,14 +0,0 @@
|
||||||
Add observation: Añadir observación
|
|
||||||
Add observation to all selected clients: Añadir observación a {{total}} cliente(s) seleccionado(s)
|
|
||||||
Balance D.: Saldo V.
|
|
||||||
Credit I.: Crédito A.
|
|
||||||
Last observation: Última observación
|
|
||||||
L. O. Date: Fecha Ú. O.
|
|
||||||
Last observation date: Fecha última observación
|
|
||||||
Search client: Buscar clientes
|
|
||||||
Worker who made the last observation: Trabajador que ha realizado la última observación
|
|
||||||
Email sended!: Email enviado!
|
|
||||||
Observation saved!: Observación añadida!
|
|
||||||
P.Method: F.Pago
|
|
||||||
Pay Method: Forma de Pago
|
|
||||||
Country: Pais
|
|
|
@ -1,6 +1,7 @@
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('transfer', {
|
Self.remoteMethodCtx('transfer', {
|
||||||
description: 'Transfer merchandise from one entry to the next day',
|
description: 'Transfer merchandise from one entry to the next day',
|
||||||
|
accessType: 'WRITE',
|
||||||
accepts: [
|
accepts: [
|
||||||
{
|
{
|
||||||
arg: 'id',
|
arg: 'id',
|
||||||
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
|
||||||
|
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||||
|
const {buildFilter, mergeFilters} = require('vn-loopback/util/filter');
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('receipts', {
|
||||||
|
description: 'Find all suppliers matched by the filter',
|
||||||
|
accessType: 'READ',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'filter',
|
||||||
|
type: 'object',
|
||||||
|
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string',
|
||||||
|
http: {source: 'query'}
|
||||||
|
}, {
|
||||||
|
arg: 'supplierId',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The supplier id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'companyId',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The company id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'currencyFk',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The currency',
|
||||||
|
default: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'bankFk',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The bank',
|
||||||
|
default: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'orderBy',
|
||||||
|
type: 'string',
|
||||||
|
description: 'The supplier fiscal id',
|
||||||
|
enum: ['issued', ' bookEntried', ' booked', ' dueDate'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'isConciliated',
|
||||||
|
default: false,
|
||||||
|
type: 'boolean',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
returns: {
|
||||||
|
type: ['object'],
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/receipts`,
|
||||||
|
verb: 'GET'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.receipts = async(ctx, filter, options) => {
|
||||||
|
const conn = Self.dataSource.connector;
|
||||||
|
const myOptions = {userId: ctx.req.accessToken.userId};
|
||||||
|
const args = ctx.args;
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
const where = buildFilter(ctx.args, (param, value) => {
|
||||||
|
switch (param) {
|
||||||
|
case 'bankFk':
|
||||||
|
return {[param]: value};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let stmts = [];
|
||||||
|
|
||||||
|
stmts.push(new ParameterizedSQL('CALL vn.supplier_statementWithEntries(?,?,?,?,?,?)', [
|
||||||
|
args.supplierId,
|
||||||
|
args.currencyFk,
|
||||||
|
args.companyId,
|
||||||
|
args.orderBy ?? 'issued',
|
||||||
|
args.isConciliated ?? false,
|
||||||
|
false
|
||||||
|
]));
|
||||||
|
|
||||||
|
const stmt = new ParameterizedSQL(`
|
||||||
|
SELECT *
|
||||||
|
FROM tmp.supplierStatement`);
|
||||||
|
|
||||||
|
filter = mergeFilters(args.filter, {where});
|
||||||
|
|
||||||
|
stmt.merge(conn.makeSuffix(filter));
|
||||||
|
stmts.push(stmt);
|
||||||
|
stmts.push(`DROP TEMPORARY TABLE tmp.supplierStatement`);
|
||||||
|
|
||||||
|
const sql = ParameterizedSQL.join(stmts, ';');
|
||||||
|
const results = await conn.executeStmt(sql);
|
||||||
|
const resultsIndex = stmts.length - 2;
|
||||||
|
const result = results[resultsIndex];
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
};
|
|
@ -8,6 +8,7 @@ module.exports = Self => {
|
||||||
require('../methods/supplier/updateFiscalData')(Self);
|
require('../methods/supplier/updateFiscalData')(Self);
|
||||||
require('../methods/supplier/consumption')(Self);
|
require('../methods/supplier/consumption')(Self);
|
||||||
require('../methods/supplier/freeAgencies')(Self);
|
require('../methods/supplier/freeAgencies')(Self);
|
||||||
|
require('../methods/supplier/receipts')(Self);
|
||||||
require('../methods/supplier/campaignMetricsPdf')(Self);
|
require('../methods/supplier/campaignMetricsPdf')(Self);
|
||||||
require('../methods/supplier/campaignMetricsEmail')(Self);
|
require('../methods/supplier/campaignMetricsEmail')(Self);
|
||||||
require('../methods/supplier/newSupplier')(Self);
|
require('../methods/supplier/newSupplier')(Self);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
const validateTin = require('vn-loopback/util/validateTin');
|
|
||||||
require('../methods/worker/filter')(Self);
|
require('../methods/worker/filter')(Self);
|
||||||
require('../methods/worker/mySubordinates')(Self);
|
require('../methods/worker/mySubordinates')(Self);
|
||||||
require('../methods/worker/isSubordinate')(Self);
|
require('../methods/worker/isSubordinate')(Self);
|
||||||
|
@ -23,26 +22,10 @@ module.exports = Self => {
|
||||||
require('../methods/worker/getAvailablePda')(Self);
|
require('../methods/worker/getAvailablePda')(Self);
|
||||||
require('../methods/worker/myTeam')(Self);
|
require('../methods/worker/myTeam')(Self);
|
||||||
|
|
||||||
Self.validateAsync('fi', tinIsValid, {
|
|
||||||
message: 'Invalid TIN'
|
|
||||||
});
|
|
||||||
|
|
||||||
Self.canModifyAbsenceInPast = async(ctx, time) => {
|
Self.canModifyAbsenceInPast = async(ctx, time) => {
|
||||||
const hasPrivs = await Self.app.models.ACL.checkAccessAcl(ctx, 'Worker', 'canModifyAbsenceInPast', 'WRITE');
|
const hasPrivs = await Self.app.models.ACL.checkAccessAcl(ctx, 'Worker', 'canModifyAbsenceInPast', 'WRITE');
|
||||||
const today = Date.vnNew();
|
const today = Date.vnNew();
|
||||||
today.setHours(0, 0, 0, 0);
|
today.setHours(0, 0, 0, 0);
|
||||||
return hasPrivs || today.getTime() < time;
|
return hasPrivs || today.getTime() < time;
|
||||||
};
|
};
|
||||||
|
|
||||||
async function tinIsValid(err, done) {
|
|
||||||
const country = await Self.app.models.Country.findOne({
|
|
||||||
fields: ['code'],
|
|
||||||
where: {id: this.originCountryFk}
|
|
||||||
});
|
|
||||||
const code = country ? country.code.toLowerCase() : null;
|
|
||||||
|
|
||||||
if (!this.fi || !validateTin(this.fi, code))
|
|
||||||
err();
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -75,6 +75,9 @@
|
||||||
},
|
},
|
||||||
"isSsDiscounted": {
|
"isSsDiscounted": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"businessFk": {
|
||||||
|
"type": "number"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
@ -103,6 +106,11 @@
|
||||||
"model": "WorkerDepartment",
|
"model": "WorkerDepartment",
|
||||||
"foreignKey": "id"
|
"foreignKey": "id"
|
||||||
},
|
},
|
||||||
|
"currentBusiness": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Business",
|
||||||
|
"foreignKey": "businessFk"
|
||||||
|
},
|
||||||
"collegues": {
|
"collegues": {
|
||||||
"type": "hasMany",
|
"type": "hasMany",
|
||||||
"model": "WorkerTeamCollegues",
|
"model": "WorkerTeamCollegues",
|
||||||
|
@ -113,6 +121,11 @@
|
||||||
"model": "Locker",
|
"model": "Locker",
|
||||||
"foreignKey": "workerFk"
|
"foreignKey": "workerFk"
|
||||||
},
|
},
|
||||||
|
"business": {
|
||||||
|
"type": "hasMany",
|
||||||
|
"model": "Business",
|
||||||
|
"foreignKey": "workerFk"
|
||||||
|
},
|
||||||
"medicalReview": {
|
"medicalReview": {
|
||||||
"type": "hasMany",
|
"type": "hasMany",
|
||||||
"model": "MedicalReview",
|
"model": "MedicalReview",
|
||||||
|
@ -259,12 +272,36 @@
|
||||||
"relation": "department",
|
"relation": "department",
|
||||||
"scope": {
|
"scope": {
|
||||||
"fields": [
|
"fields": [
|
||||||
"name"
|
"id"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"relation": "business",
|
||||||
|
"scope": {
|
||||||
|
"fields": [
|
||||||
|
"id",
|
||||||
|
"started",
|
||||||
|
"ended",
|
||||||
|
"reasonEndFk",
|
||||||
|
"departmentFk",
|
||||||
|
"workerBusinessProfessionalCategoryFk"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
{
|
||||||
|
"relation": "reasonEnd",
|
||||||
|
"scope": {
|
||||||
|
"fields": [
|
||||||
|
"id",
|
||||||
|
"reason"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"relation": "boss",
|
"relation": "boss",
|
||||||
"scope": {
|
"scope": {
|
||||||
|
@ -312,7 +349,8 @@
|
||||||
"educationLevelFk",
|
"educationLevelFk",
|
||||||
"originCountryFk",
|
"originCountryFk",
|
||||||
"maritalStatus",
|
"maritalStatus",
|
||||||
"SSN"
|
"SSN",
|
||||||
|
"businessFk"
|
||||||
],
|
],
|
||||||
"include": [
|
"include": [
|
||||||
{
|
{
|
||||||
|
@ -323,6 +361,48 @@
|
||||||
"phone"
|
"phone"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"relation": "currentBusiness",
|
||||||
|
"scope": {
|
||||||
|
"fields": [
|
||||||
|
"id",
|
||||||
|
"started",
|
||||||
|
"ended",
|
||||||
|
"reasonEndFk",
|
||||||
|
"departmentFk",
|
||||||
|
"workerBusinessProfessionalCategoryFk"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
{
|
||||||
|
"relation": "reasonEnd",
|
||||||
|
"scope": {
|
||||||
|
"fields": [
|
||||||
|
"id",
|
||||||
|
"reason"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"relation": "department",
|
||||||
|
"scope": {
|
||||||
|
"fields": [
|
||||||
|
"id",
|
||||||
|
"name"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"relation": "workerBusinessProfessionalCategory",
|
||||||
|
"scope": {
|
||||||
|
"fields": [
|
||||||
|
"id",
|
||||||
|
"description"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue