Merge branch 'dev' into 7335-modifyCmr
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
16e7fb9662
|
@ -5,15 +5,15 @@ BEGIN
|
|||
DECLARE vFromDated DATE;
|
||||
DECLARE vForDeleteDated DATE;
|
||||
DECLARE vManaId INT;
|
||||
DECLARE vManaAutoId INT;
|
||||
DECLARE vClaimManaId INT;
|
||||
DECLARE vManaBankId INT;
|
||||
DECLARE vManaGreugeTypeId INT;
|
||||
DECLARE vManaFromDays INT;
|
||||
DECLARE vManaToDays INT;
|
||||
DECLARE vManaAutoId INT;
|
||||
DECLARE vClaimManaId INT;
|
||||
DECLARE vManaBankId INT;
|
||||
DECLARE vManaGreugeTypeId INT;
|
||||
DECLARE vManaFromDays INT;
|
||||
DECLARE vManaToDays INT;
|
||||
|
||||
SELECT id INTO vManaId
|
||||
FROM vn.component WHERE code = 'mana';
|
||||
FROM vn.component WHERE code = 'mana';
|
||||
|
||||
SELECT id INTO vManaAutoId
|
||||
FROM vn.component WHERE code = 'autoMana';
|
||||
|
@ -27,75 +27,68 @@ BEGIN
|
|||
SELECT id INTO vManaGreugeTypeId
|
||||
FROM vn.greugeType WHERE code = 'mana';
|
||||
|
||||
SELECT manaFromDays, manaToDays
|
||||
INTO vManaFromDays, vManaToDays
|
||||
FROM vn.salespersonConfig;
|
||||
SELECT manaFromDays, manaToDays
|
||||
INTO vManaFromDays, vManaToDays
|
||||
FROM vn.salespersonConfig;
|
||||
|
||||
SELECT MAX(dated)
|
||||
INTO vFromDated
|
||||
FROM vn.clientManaCache;
|
||||
SELECT MAX(dated) INTO vFromDated
|
||||
FROM vn.clientManaCache;
|
||||
|
||||
DELETE
|
||||
FROM vn.clientManaCache
|
||||
WHERE dated = vFromDated;
|
||||
DELETE FROM vn.clientManaCache
|
||||
WHERE dated = vFromDated;
|
||||
|
||||
SELECT MAX(dated)
|
||||
INTO vFromDated
|
||||
FROM vn.clientManaCache;
|
||||
SELECT MAX(dated) INTO vFromDated
|
||||
FROM vn.clientManaCache;
|
||||
|
||||
IF ISNULL(vFromDated) THEN
|
||||
SELECT manaDateFrom
|
||||
INTO vFromDated
|
||||
FROM vn.salespersonConfig;
|
||||
END IF;
|
||||
IF vFromDated IS NULL THEN
|
||||
SELECT manaDateFrom
|
||||
INTO vFromDated
|
||||
FROM vn.salespersonConfig;
|
||||
END IF;
|
||||
|
||||
WHILE vFromDated + INTERVAL vManaToDays DAY < util.VN_CURDATE() DO
|
||||
SELECT
|
||||
vFromDated + INTERVAL vManaToDays DAY,
|
||||
vFromDated - INTERVAL vManaFromDays DAY
|
||||
INTO
|
||||
vToDated,
|
||||
vForDeleteDated;
|
||||
WHILE vFromDated + INTERVAL vManaToDays DAY < util.VN_CURDATE() DO
|
||||
SELECT vFromDated + INTERVAL vManaToDays DAY,
|
||||
vFromDated - INTERVAL vManaFromDays DAY
|
||||
INTO vToDated,
|
||||
vForDeleteDated;
|
||||
|
||||
DELETE FROM vn.clientManaCache
|
||||
WHERE dated <= vForDeleteDated;
|
||||
DELETE FROM vn.clientManaCache
|
||||
WHERE dated <= vForDeleteDated;
|
||||
|
||||
INSERT INTO vn.clientManaCache(clientFk, mana, dated)
|
||||
SELECT
|
||||
Id_Cliente,
|
||||
SUM(mana),
|
||||
vToDated
|
||||
FROM
|
||||
(
|
||||
SELECT a.clientFk Id_Cliente, s.quantity * sc.value as mana
|
||||
FROM vn.ticket t
|
||||
JOIN vn.address a ON a.id = t.addressFk
|
||||
JOIN vn.sale s on s.ticketFk = t.id
|
||||
JOIN vn.saleComponent sc on sc.saleFk = s.id
|
||||
WHERE sc.componentFk IN (vManaAutoId, vManaId, vClaimManaId)
|
||||
AND t.shipped > vFromDated
|
||||
AND date(t.shipped) <= vToDated
|
||||
UNION ALL
|
||||
SELECT clientFk, - amountPaid
|
||||
FROM vn.receipt
|
||||
WHERE bankFk = vManaBankId
|
||||
AND payed > vFromDated
|
||||
AND payed <= vToDated
|
||||
UNION ALL
|
||||
SELECT clientFk, amount
|
||||
FROM vn.greuge
|
||||
WHERE greugeTypeFk = vManaGreugeTypeId
|
||||
AND shipped > vFromDated
|
||||
AND shipped <= vToDated
|
||||
UNION ALL
|
||||
SELECT clientFk, mana
|
||||
FROM vn.clientManaCache
|
||||
WHERE dated = vFromDated
|
||||
) sub
|
||||
GROUP BY Id_Cliente
|
||||
HAVING Id_Cliente;
|
||||
INSERT INTO vn.clientManaCache(clientFk, mana, dated)
|
||||
SELECT Id_Cliente,
|
||||
SUM(mana),
|
||||
vToDated
|
||||
FROM (
|
||||
SELECT a.clientFk Id_Cliente, s.quantity * sc.value mana
|
||||
FROM vn.ticket t
|
||||
JOIN vn.address a ON a.id = t.addressFk
|
||||
JOIN vn.sale s ON s.ticketFk = t.id
|
||||
JOIN vn.saleComponent sc ON sc.saleFk = s.id
|
||||
WHERE sc.componentFk IN (vManaAutoId, vManaId, vClaimManaId)
|
||||
AND t.shipped > vFromDated
|
||||
AND DATE(t.shipped) <= vToDated
|
||||
UNION ALL
|
||||
SELECT clientFk, - amountPaid
|
||||
FROM vn.receipt
|
||||
WHERE bankFk = vManaBankId
|
||||
AND payed > vFromDated
|
||||
AND payed <= vToDated
|
||||
UNION ALL
|
||||
SELECT clientFk, amount
|
||||
FROM vn.greuge
|
||||
WHERE greugeTypeFk = vManaGreugeTypeId
|
||||
AND shipped > vFromDated
|
||||
AND shipped <= vToDated
|
||||
UNION ALL
|
||||
SELECT clientFk, mana
|
||||
FROM vn.clientManaCache
|
||||
WHERE dated = vFromDated
|
||||
) sub
|
||||
GROUP BY Id_Cliente
|
||||
HAVING Id_Cliente;
|
||||
|
||||
SET vFromDated = vToDated;
|
||||
END WHILE;
|
||||
SET vFromDated = vToDated;
|
||||
END WHILE;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -259,7 +259,7 @@ BEGIN
|
|||
JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk
|
||||
AND tcs.warehouseFk = tcc.warehouseFk
|
||||
WHERE IFNULL(tcs.classRate, 1) = 1
|
||||
AND NOT tcc.groupingMode = 'packing'
|
||||
AND (tcc.groupingMode = 'grouping' OR tcc.groupingMode IS NULL)
|
||||
AND (tcc.packing > tcc.`grouping` OR tcc.groupingMode IS NULL)
|
||||
GROUP BY tcs.warehouseFk, tcs.itemFk;
|
||||
|
||||
|
|
|
@ -28,11 +28,10 @@ BEGIN
|
|||
JOIN entry e ON e.invoiceInFk = ii.id
|
||||
JOIN duaEntry de ON de.entryFk = e.id
|
||||
JOIN dua d ON d.id = de.duaFk
|
||||
SET ii.isBooked = TRUE,
|
||||
ii.booked = IFNULL(ii.booked,d.booked),
|
||||
ii.operated = IFNULL(ii.operated,d.operated),
|
||||
ii.issued = IFNULL(ii.issued,d.issued),
|
||||
ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried),
|
||||
SET ii.booked = IFNULL(ii.booked, d.booked),
|
||||
ii.operated = IFNULL(ii.operated, d.operated),
|
||||
ii.issued = IFNULL(ii.issued, d.issued),
|
||||
ii.bookEntried = IFNULL(ii.bookEntried, d.bookEntried),
|
||||
e.isBooked = TRUE,
|
||||
e.isConfirmed = TRUE
|
||||
WHERE d.id = vDuaFk;
|
||||
|
@ -71,5 +70,9 @@ BEGIN
|
|||
SET ASIEN = vASIEN
|
||||
WHERE id = vDuaFk;
|
||||
|
||||
UPDATE invoiceIn ii
|
||||
JOIN duaInvoiceIn dii ON dii.invoiceInFk = ii.id
|
||||
SET ii.isBooked = TRUE
|
||||
WHERE dii.duaFk = vDuaFk;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -1,101 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`fv_pca`()
|
||||
BEGIN
|
||||
|
||||
DECLARE done INT DEFAULT FALSE;
|
||||
|
||||
DECLARE vTicketFk INT;
|
||||
DECLARE vSaleFk INT;
|
||||
DECLARE vClonTicket INT DEFAULT 0;
|
||||
|
||||
DECLARE cur1 CURSOR FOR
|
||||
SELECT s.ticketFk, s.id
|
||||
FROM vn.sale s
|
||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN vn.itemType it ON it.id = i.typeFk
|
||||
WHERE t.shipped BETWEEN '2020-10-18' AND '2020-10-31'
|
||||
AND it.code IN ('ANT','ANS','ORQ','TRO')
|
||||
and t.warehouseFk = 1;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||||
|
||||
OPEN cur1;
|
||||
|
||||
FETCH cur1 INTO vTicketFk, vSaleFk;
|
||||
|
||||
WHILE done = 0 DO
|
||||
|
||||
SELECT t.id INTO vClonTicket
|
||||
FROM vn.ticket t
|
||||
JOIN (SELECT addressFk, shipped FROM vn.ticket WHERE id = vTicketFk) sub USING(addressFk, shipped)
|
||||
WHERE t.warehouseFk = 44
|
||||
LIMIT 1;
|
||||
|
||||
SELECT vTicketFk, vClonTicket;
|
||||
|
||||
IF vClonTicket = 0 THEN
|
||||
|
||||
INSERT INTO ticket (
|
||||
clientFk,
|
||||
shipped,
|
||||
addressFk,
|
||||
agencyModeFk,
|
||||
nickname,
|
||||
warehouseFk,
|
||||
companyFk,
|
||||
landed,
|
||||
zoneFk,
|
||||
zonePrice,
|
||||
zoneBonus,
|
||||
routeFk
|
||||
)
|
||||
SELECT
|
||||
clientFk,
|
||||
shipped,
|
||||
addressFk,
|
||||
agencyModeFk,
|
||||
nickname,
|
||||
44,
|
||||
companyFk,
|
||||
landed,
|
||||
zoneFk,
|
||||
zonePrice,
|
||||
zoneBonus,
|
||||
routeFk
|
||||
|
||||
FROM ticket
|
||||
WHERE id = vTicketFk;
|
||||
|
||||
SET vClonTicket = LAST_INSERT_ID();
|
||||
|
||||
SELECT 'lstID', vClonTicket;
|
||||
/*
|
||||
INSERT INTO ticketObservation(ticketFk, observationTypeFk, description)
|
||||
SELECT vTicketFk, ao.observationTypeFk, ao.description
|
||||
FROM addressObservation ao
|
||||
JOIN ticket t ON t.addressFk = ao.addressFk
|
||||
WHERE t.id = vClonTicket;
|
||||
*/
|
||||
INSERT INTO ticketLog
|
||||
SET originFk = vTicketFk, userFk = account.myUser_getId(), `action` = 'insert',
|
||||
description = CONCAT('Ha creado el ticket:', ' ', vClonTicket, ' clonando el ', vTicketFk);
|
||||
|
||||
END IF;
|
||||
|
||||
UPDATE vn.sale
|
||||
SET ticketFk = vClonTicket
|
||||
WHERE id = vSaleFk;
|
||||
|
||||
SET vClonTicket = 0;
|
||||
|
||||
SET done = 0;
|
||||
FETCH cur1 INTO vTicketFk, vSaleFk;
|
||||
|
||||
END WHILE;
|
||||
|
||||
CLOSE cur1;
|
||||
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -10,8 +10,6 @@ BEGIN
|
|||
DECLARE vLines INT;
|
||||
DECLARE vHasDistinctTransactions INT;
|
||||
|
||||
CALL invoiceIn_checkBooked(vInvoiceInFk);
|
||||
|
||||
SELECT taxRowLimit INTO vTaxRowLimit FROM invoiceInConfig;
|
||||
|
||||
SELECT COUNT(*) INTO vLines
|
||||
|
|
|
@ -5,8 +5,6 @@ BEGIN
|
|||
DECLARE vDated DATE;
|
||||
DECLARE vExpenseFk VARCHAR(10);
|
||||
|
||||
CALL invoiceIn_checkBooked(vInvoiceInFk);
|
||||
|
||||
SELECT MAX(rr.dated) INTO vDated
|
||||
FROM referenceRate rr
|
||||
JOIN invoiceIn ii ON ii.id = vInvoiceInFk
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInCorrection_beforeDelete`
|
||||
BEFORE DELETE ON `invoiceInCorrection`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL invoiceIn_checkBooked(OLD.correctingFk);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,8 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInCorrection_beforeInsert`
|
||||
BEFORE INSERT ON `invoiceInCorrection`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL invoiceIn_checkBooked(NEW.correctingFk);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,8 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInCorrection_beforeUpdate`
|
||||
BEFORE UPDATE ON `invoiceInCorrection`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL invoiceIn_checkBooked(OLD.correctingFk);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,8 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInDueDay_beforeDelete`
|
||||
BEFORE DELETE ON `invoiceInDueDay`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL invoiceIn_checkBooked(OLD.invoiceInFk);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -5,8 +5,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInDueDay_befor
|
|||
BEGIN
|
||||
DECLARE vIsNotified BOOLEAN;
|
||||
|
||||
CALL invoiceIn_checkBooked(NEW.invoiceInFk);
|
||||
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
SELECT isNotified INTO vIsNotified
|
||||
|
|
|
@ -5,7 +5,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInDueDay_befor
|
|||
BEGIN
|
||||
DECLARE vIsNotified BOOLEAN;
|
||||
|
||||
CALL invoiceIn_checkBooked(OLD.invoiceInFk);
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
SELECT isNotified INTO vIsNotified
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInIntrastat_beforeDelete`
|
||||
BEFORE DELETE ON `invoiceInIntrastat`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL invoiceIn_checkBooked(OLD.invoiceInFk);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,8 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInIntrastat_beforeInsert`
|
||||
BEFORE INSERT ON `invoiceInIntrastat`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL invoiceIn_checkBooked(NEW.invoiceInFk);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,8 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInIntrastat_beforeUpdate`
|
||||
BEFORE UPDATE ON `invoiceInIntrastat`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL invoiceIn_checkBooked(OLD.invoiceInFk);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,8 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInTax_beforeDelete`
|
||||
BEFORE DELETE ON `invoiceInTax`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL invoiceIn_checkBooked(OLD.invoiceInFk);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -3,8 +3,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInTax_beforeUp
|
|||
BEFORE UPDATE ON `invoiceInTax`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL invoiceIn_checkBooked(OLD.invoiceInFk);
|
||||
|
||||
IF NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) THEN
|
||||
CALL invoiceInTax_afterUpsert(NEW.invoiceInFk);
|
||||
END IF;
|
||||
|
|
|
@ -5,10 +5,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceIn_beforeUpdat
|
|||
BEGIN
|
||||
DECLARE vWithholdingSageFk INT;
|
||||
|
||||
IF NEW.isBooked = OLD.isBooked THEN
|
||||
CALL invoiceIn_checkBooked(OLD.id);
|
||||
END IF;
|
||||
|
||||
IF NOT (NEW.supplierRef <=> OLD.supplierRef) AND NOT util.checkPrintableChars(NEW.supplierRef) THEN
|
||||
CALL util.throw('The invoiceIn reference contains invalid characters');
|
||||
END IF;
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
DELETE FROM salix.ACL
|
||||
WHERE model = 'Worker'
|
||||
AND property = '__get__summary'
|
||||
AND principalId = 'employee';
|
||||
|
||||
UPDATE salix.ACL SET principalId = 'employee'
|
||||
WHERE model = 'Worker'
|
||||
AND property IN ('find','findById','findOne')
|
||||
AND principalId = 'hr';
|
|
@ -2,6 +2,7 @@ import selectors from '../../helpers/selectors.js';
|
|||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Worker summary path', () => {
|
||||
const workerId = 3;
|
||||
let browser;
|
||||
let page;
|
||||
beforeAll(async() => {
|
||||
|
@ -9,7 +10,7 @@ describe('Worker summary path', () => {
|
|||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'worker');
|
||||
const httpDataResponse = page.waitForResponse(response => {
|
||||
return response.status() === 200 && response.url().includes(`Workers/summary`);
|
||||
return response.status() === 200 && response.url().includes(`Workers/${workerId}`);
|
||||
});
|
||||
await page.accessToSearchResult('agencyNick');
|
||||
await httpDataResponse;
|
||||
|
|
|
@ -92,86 +92,5 @@
|
|||
"model": "WorkerTeamCollegues",
|
||||
"foreignKey": "workerFk"
|
||||
}
|
||||
},
|
||||
"scopes":{
|
||||
"summary": {
|
||||
"include": [
|
||||
{
|
||||
"relation": "user",
|
||||
"scope": {
|
||||
"fields": ["email", "name", "nickname", "roleFk", "emailVerified"],
|
||||
"include": [
|
||||
{
|
||||
"relation": "role",
|
||||
"scope": {
|
||||
"fields": ["name"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"relation": "emailUser",
|
||||
"scope": {
|
||||
"fields": ["email"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
"relation": "department",
|
||||
"scope": {
|
||||
"include": {
|
||||
"relation": "department"
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"relation": "boss"
|
||||
}, {
|
||||
"relation": "client",
|
||||
"scope": {
|
||||
"fields": [
|
||||
"id",
|
||||
"name",
|
||||
"fi",
|
||||
"socialName",
|
||||
"contact",
|
||||
"street",
|
||||
"city",
|
||||
"postcode",
|
||||
"email",
|
||||
"mobile",
|
||||
"isActive",
|
||||
"credit",
|
||||
"creditInsurance",
|
||||
"iban",
|
||||
"dueDay",
|
||||
"isEqualizated",
|
||||
"isFreezed",
|
||||
"hasToInvoiceByAddress",
|
||||
"hasToInvoice",
|
||||
"isToBeMailed",
|
||||
"hasSepaVnl",
|
||||
"hasLcr",
|
||||
"hasCoreVnl",
|
||||
"hasCoreVnh",
|
||||
"hasIncoterms",
|
||||
"isTaxDataChecked",
|
||||
"quality",
|
||||
"isVies",
|
||||
"isRelevant",
|
||||
"accountingAccount",
|
||||
"created",
|
||||
"sageTaxTypeFk",
|
||||
"sageTransactionTypeFk",
|
||||
"businessTypeFk",
|
||||
"salesPersonFk",
|
||||
"hasElectronicInvoice",
|
||||
"rating",
|
||||
"recommendedCredit"
|
||||
]
|
||||
}
|
||||
}, {
|
||||
"relation": "sip"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,13 +4,37 @@ import ModuleCard from 'salix/components/module-card';
|
|||
class Controller extends ModuleCard {
|
||||
reload() {
|
||||
const filter = {
|
||||
where: {
|
||||
id: this.$params.id}
|
||||
include: [
|
||||
{
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['name', 'emailVerified'],
|
||||
include: {
|
||||
relation: 'emailUser',
|
||||
scope: {
|
||||
fields: ['email']
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
relation: 'sip',
|
||||
scope: {
|
||||
fields: ['extension', 'secret']
|
||||
}
|
||||
}, {
|
||||
relation: 'department',
|
||||
scope: {
|
||||
include: {
|
||||
relation: 'department'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
return Promise.all([
|
||||
this.$http.get(`Workers/summary`, {filter})
|
||||
.then(res => this.worker = res.data[0]),
|
||||
this.$http.get(`Workers/${this.$params.id}`, {filter})
|
||||
.then(res => this.worker = res.data),
|
||||
this.$http.get(`Workers/${this.$params.id}/activeContract`)
|
||||
.then(res => this.hasWorkCenter = res.data?.workCenterFk)
|
||||
]);
|
||||
|
|
|
@ -37,11 +37,41 @@ class Controller extends Descriptor {
|
|||
|
||||
loadData() {
|
||||
const filter = {
|
||||
where: {id: this.id},
|
||||
include: [
|
||||
{
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['name', 'emailVerified'],
|
||||
include: {
|
||||
relation: 'emailUser',
|
||||
scope: {
|
||||
fields: ['email']
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['fi']
|
||||
}
|
||||
}, {
|
||||
relation: 'sip',
|
||||
scope: {
|
||||
fields: ['extension']
|
||||
}
|
||||
}, {
|
||||
relation: 'department',
|
||||
scope: {
|
||||
include: {
|
||||
relation: 'department'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
return this.getData(`Workers/summary`, {filter})
|
||||
.then(res => this.entity = res.data[0]);
|
||||
return this.getData(`Workers/${this.id}`, {filter})
|
||||
.then(res => this.entity = res.data);
|
||||
}
|
||||
|
||||
getPassRequirements() {
|
||||
|
|
|
@ -14,14 +14,14 @@ describe('vnWorkerDescriptor', () => {
|
|||
describe('loadData()', () => {
|
||||
it(`should perform a get query to store the worker data into the controller`, () => {
|
||||
const id = 1;
|
||||
const response = ['foo'];
|
||||
const response = 'foo';
|
||||
|
||||
$httpBackend.whenGET('UserConfigs/getUserConfig').respond({});
|
||||
$httpBackend.expectRoute('GET', `Workers/summary`).respond(response);
|
||||
$httpBackend.expectRoute('GET', `Workers/${id}`).respond(response);
|
||||
controller.id = id;
|
||||
$httpBackend.flush();
|
||||
|
||||
expect([controller.worker]).toEqual(response);
|
||||
expect(controller.worker).toEqual(response);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -10,14 +10,53 @@ class Controller extends Summary {
|
|||
this.$.worker = null;
|
||||
if (!value) return;
|
||||
|
||||
const query = `Workers/${value.id}`;
|
||||
const filter = {
|
||||
where: {
|
||||
id: value.id
|
||||
}
|
||||
include: [
|
||||
{
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['name', 'roleFk'],
|
||||
include: [{
|
||||
relation: 'role',
|
||||
scope: {
|
||||
fields: ['name']
|
||||
}
|
||||
},
|
||||
{
|
||||
relation: 'emailUser',
|
||||
scope: {
|
||||
fields: ['email']
|
||||
}
|
||||
}]
|
||||
}
|
||||
},
|
||||
{
|
||||
relation: 'client',
|
||||
scope: {fields: ['fi', 'phone']}
|
||||
},
|
||||
{
|
||||
relation: 'boss',
|
||||
scope: {fields: ['id', 'name']}
|
||||
},
|
||||
{
|
||||
relation: 'sip',
|
||||
scope: {fields: ['extension']}
|
||||
},
|
||||
{
|
||||
relation: 'department',
|
||||
scope: {
|
||||
include: {
|
||||
relation: 'department',
|
||||
scope: {fields: ['id', 'code', 'name']}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.$http.get(`Workers/summary`, {filter}).then(res => {
|
||||
this.$.worker = res.data[0];
|
||||
this.$http.get(query, {params: {filter}}).then(res => {
|
||||
this.$.worker = res.data;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue