Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5918-worker.time-control_resend
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
commit
21ddcb7e8e
|
@ -5,13 +5,20 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [2342.01] - 2023-10-19
|
||||||
|
|
||||||
|
### Added
|
||||||
|
### Changed
|
||||||
|
### Fixed
|
||||||
|
|
||||||
## [2340.01] - 2023-10-05
|
## [2340.01] - 2023-10-05
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
### Changed
|
- (Usuarios -> Foto) Se muestra la foto del trabajador
|
||||||
|
|
||||||
|
### Changed
|
||||||
### Fixed
|
### Fixed
|
||||||
|
- (Usuarios -> Historial) Abre el descriptor del usuario correctamente
|
||||||
|
|
||||||
## [2338.01] - 2023-09-21
|
## [2338.01] - 2023-09-21
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
ALTER TABLE `vn`.`deviceLog` ADD serialNumber varchar(45) DEFAULT NULL NULL;
|
-- ALTER TABLE `vn`.`deviceLog` ADD serialNumber varchar(45) DEFAULT NULL NULL;
|
||||||
|
|
||||||
INSERT INTO `salix`.`ACL` ( model, property, accessType, permission, principalType, principalId)
|
-- INSERT INTO `salix`.`ACL` ( model, property, accessType, permission, principalType, principalId)
|
||||||
VALUES( 'DeviceLog', 'create', 'WRITE', 'ALLOW', 'ROLE', 'employee');
|
-- VALUES( 'DeviceLog', 'create', 'WRITE', 'ALLOW', 'ROLE', 'employee');
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
INSERT INTO `salix`.`ACL` ( model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES
|
||||||
|
('ExpeditionMistakeType', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('WorkerMistakeType', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('ExpeditionMistake','*','WRITE','ALLOW','ROLE','employee'),
|
||||||
|
('WorkerMistake', '*', 'WRITE', 'ALLOW', 'ROLE', 'coolerBoss'),
|
||||||
|
('MistakesTypes', '*', 'WRITE', 'ALLOW', 'ROLE', 'coolerBoss'),
|
||||||
|
('MistakeType','*','READ','ALLOW','ROLE','employee'),
|
||||||
|
('MachineWorker', '*', 'READ', 'ALLOW', 'ROLE', 'coolerAssist'),
|
||||||
|
('Printer','*','READ','ALLOW','ROLE','employee'),
|
||||||
|
('SaleMistake', '*', 'WRITE', 'ALLOW', 'ROLE', 'production');
|
|
@ -8,9 +8,14 @@ FROM account.roleInherit ri
|
||||||
JOIN account.role r2 ON r2.id = ri.`role`
|
JOIN account.role r2 ON r2.id = ri.`role`
|
||||||
WHERE r2.name = 'deliveryBoss';
|
WHERE r2.name = 'deliveryBoss';
|
||||||
|
|
||||||
|
DELETE `account`.`roleInherit` FROM `account`.`roleInherit`
|
||||||
|
JOIN `account`.`role` r ON `account`.`roleInherit`.role = r.id
|
||||||
|
WHERE r.name = 'deliveryBoss';
|
||||||
|
|
||||||
INSERT INTO `account`.`roleInherit` (role, inheritsFrom)
|
INSERT INTO `account`.`roleInherit` (role, inheritsFrom)
|
||||||
SELECT (SELECT id FROM account.role WHERE name = 'deliveryBoss') role,
|
SELECT (SELECT id FROM account.role WHERE name = 'deliveryBoss') role,
|
||||||
(SELECT id FROM account.role WHERE name = 'deliveryAssistant') roleInherit;
|
(SELECT id FROM account.role WHERE name = 'deliveryAssistant') roleInherit;
|
||||||
|
|
||||||
|
UPDATE `salix`.`ACL`
|
||||||
CALL `account`.`role_syncPrivileges`();
|
SET principalId='deliveryAssistant'
|
||||||
|
WHERE principalId='deliveryBoss';
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
-- Locally it fails because it is executed before the fixtures and the roleConfig table is empty
|
||||||
|
CALL `account`.`role_syncPrivileges`();
|
|
@ -0,0 +1,291 @@
|
||||||
|
ALTER TABLE `vn`.`itemShelvingSale` DROP COLUMN IF EXISTS isPicked;
|
||||||
|
|
||||||
|
ALTER TABLE`vn`.`itemShelvingSale`
|
||||||
|
ADD isPicked TINYINT(1) DEFAULT FALSE NOT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE `vn`.`productionConfig` DROP COLUMN IF EXISTS orderMode;
|
||||||
|
|
||||||
|
ALTER TABLE `vn`.`productionConfig`
|
||||||
|
ADD orderMode ENUM('Location', 'Age') NOT NULL DEFAULT 'Location';
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_reserveByCollection`(
|
||||||
|
vCollectionFk INT(11)
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Reserva cantidades con ubicaciones para el contenido de una colección
|
||||||
|
*
|
||||||
|
* @param vCollectionFk Identificador de collection
|
||||||
|
*/
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||||
|
(INDEX(saleFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT s.id saleFk, NULL userFk
|
||||||
|
FROM ticketCollection tc
|
||||||
|
JOIN sale s ON s.ticketFk = tc.ticketFk
|
||||||
|
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 = s.id
|
||||||
|
WHERE tc.collectionFk = vCollectionFk
|
||||||
|
AND st.saleFk IS NULL
|
||||||
|
AND NOT s.isPicked;
|
||||||
|
|
||||||
|
CALL itemShelvingSale_reserve();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
||||||
|
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_setQuantity`(
|
||||||
|
vItemShelvingSaleFk INT(10),
|
||||||
|
vQuantity DECIMAL(10,0),
|
||||||
|
vIsItemShelvingSaleEmpty BOOLEAN
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Gestiona la reserva de un itemShelvingFk, actualizando isPicked y quantity
|
||||||
|
* en vn.itemShelvingSale y vn.sale.isPicked en caso necesario.
|
||||||
|
* Si la reserva de la ubicación es fallida, se regulariza la situación
|
||||||
|
*
|
||||||
|
* @param vItemShelvingSaleFk Id itemShelvingSaleFK
|
||||||
|
* @param vQuantity Cantidad real que se ha cogido de la ubicación
|
||||||
|
* @param vIsItemShelvingSaleEmpty determina si ka ubicación itemShelvingSale se ha
|
||||||
|
* quedado vacio tras el movimiento
|
||||||
|
*/
|
||||||
|
DECLARE vSaleFk INT;
|
||||||
|
DECLARE vCursorSaleFk INT;
|
||||||
|
DECLARE vItemShelvingFk INT;
|
||||||
|
DECLARE vReservedQuantity INT;
|
||||||
|
DECLARE vRemainingQuantity INT;
|
||||||
|
DECLARE vItemFk INT;
|
||||||
|
DECLARE vUserFk INT;
|
||||||
|
DECLARE vDone BOOLEAN DEFAULT FALSE;
|
||||||
|
DECLARE vSales CURSOR FOR
|
||||||
|
SELECT iss.saleFk, iss.userFk
|
||||||
|
FROM itemShelvingSale iss
|
||||||
|
JOIN sale s ON s.id = iss.saleFk
|
||||||
|
WHERE iss.id = vItemShelvingSaleFk
|
||||||
|
AND s.itemFk = vItemFk
|
||||||
|
AND NOT iss.isPicked;
|
||||||
|
|
||||||
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
|
|
||||||
|
IF (SELECT isPicked FROM itemShelvingSale WHERE id = vItemShelvingSaleFk) THEN
|
||||||
|
CALL util.throw('Booking completed');
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
SELECT s.itemFk, iss.saleFk, iss.itemShelvingFk
|
||||||
|
INTO vItemFk, vSaleFk, vItemShelvingFk
|
||||||
|
FROM itemShelvingSale iss
|
||||||
|
JOIN sale s ON s.id = iss.saleFk
|
||||||
|
WHERE iss.id = vItemShelvingSaleFk
|
||||||
|
AND NOT iss.isPicked;
|
||||||
|
|
||||||
|
UPDATE itemShelvingSale
|
||||||
|
SET isPicked = TRUE,
|
||||||
|
quantity = vQuantity
|
||||||
|
WHERE id = vItemShelvingSaleFk;
|
||||||
|
|
||||||
|
UPDATE itemShelving
|
||||||
|
SET visible = IF(vIsItemShelvingSaleEmpty, 0, GREATEST(0,visible - vQuantity))
|
||||||
|
WHERE id = vItemShelvingFk;
|
||||||
|
|
||||||
|
IF vIsItemShelvingSaleEmpty THEN
|
||||||
|
OPEN vSales;
|
||||||
|
l: LOOP
|
||||||
|
SET vDone = FALSE;
|
||||||
|
FETCH vSales INTO vCursorSaleFk, vUserFk;
|
||||||
|
IF vDone THEN
|
||||||
|
LEAVE l;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||||
|
(INDEX(saleFk, userFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT vCursorSaleFk, vUserFk;
|
||||||
|
|
||||||
|
CALL itemShelvingSale_reserveWhitUser();
|
||||||
|
DROP TEMPORARY TABLE tmp.sale;
|
||||||
|
|
||||||
|
END LOOP;
|
||||||
|
CLOSE vSales;
|
||||||
|
|
||||||
|
DELETE iss
|
||||||
|
FROM itemShelvingSale iss
|
||||||
|
JOIN sale s ON s.id = iss.saleFk
|
||||||
|
WHERE iss.id = vItemShelvingSaleFk
|
||||||
|
AND s.itemFk = vItemFk
|
||||||
|
AND NOT iss.isPicked;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
SELECT SUM(quantity) INTO vRemainingQuantity
|
||||||
|
FROM itemShelvingSale
|
||||||
|
WHERE saleFk = vSaleFk
|
||||||
|
AND NOT isPicked;
|
||||||
|
|
||||||
|
IF vRemainingQuantity THEN
|
||||||
|
CALL itemShelvingSale_reserveBySale (vSaleFk, vRemainingQuantity, NULL);
|
||||||
|
|
||||||
|
SELECT SUM(quantity) INTO vRemainingQuantity
|
||||||
|
FROM itemShelvingSale
|
||||||
|
WHERE saleFk = vSaleFk
|
||||||
|
AND NOT isPicked;
|
||||||
|
|
||||||
|
IF NOT vRemainingQuantity <=> 0 THEN
|
||||||
|
SELECT SUM(iss.quantity)
|
||||||
|
INTO vReservedQuantity
|
||||||
|
FROM itemShelvingSale iss
|
||||||
|
WHERE iss.saleFk = vSaleFk;
|
||||||
|
|
||||||
|
CALL saleTracking_new(
|
||||||
|
vSaleFk,
|
||||||
|
TRUE,
|
||||||
|
vReservedQuantity,
|
||||||
|
`account`.`myUser_getId`(),
|
||||||
|
NULL,
|
||||||
|
'PREPARED',
|
||||||
|
TRUE);
|
||||||
|
|
||||||
|
UPDATE sale s
|
||||||
|
SET s.quantity = vReservedQuantity
|
||||||
|
WHERE s.id = vSaleFk ;
|
||||||
|
END IF;
|
||||||
|
END IF;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
||||||
|
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_reserve`()
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Reserva cantidades con ubicaciones para un conjunto de sales del mismo wareHouse
|
||||||
|
*
|
||||||
|
* @table tmp.sale(saleFk, userFk)
|
||||||
|
*/
|
||||||
|
DECLARE vCalcFk INT;
|
||||||
|
DECLARE vWarehouseFk INT;
|
||||||
|
DECLARE vCurrentYear INT DEFAULT YEAR(util.VN_NOW());
|
||||||
|
DECLARE vLastPickingOrder INT;
|
||||||
|
|
||||||
|
SELECT t.warehouseFk, MAX(p.pickingOrder)
|
||||||
|
INTO vWarehouseFk, vLastPickingOrder
|
||||||
|
FROM ticket t
|
||||||
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
|
JOIN tmp.sale ts ON ts.saleFk = s.id
|
||||||
|
LEFT JOIN itemShelvingSale iss ON iss.saleFk = ts.saleFk
|
||||||
|
LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||||
|
LEFT JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||||
|
LEFT JOIN parking p ON p.id = sh.parkingFk
|
||||||
|
WHERE t.warehouseFk IS NOT NULL;
|
||||||
|
|
||||||
|
IF vWarehouseFk IS NULL THEN
|
||||||
|
CALL util.throw('Warehouse not set');
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
CALL cache.visible_refresh(vCalcFk, FALSE, vWarehouseFk);
|
||||||
|
|
||||||
|
SET @outstanding = 0;
|
||||||
|
SET @oldsaleFk = 0;
|
||||||
|
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tSalePlacementQuantity
|
||||||
|
(INDEX(saleFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT saleFk, userFk, quantityToReserve, itemShelvingFk
|
||||||
|
FROM( SELECT saleFk,
|
||||||
|
sub.userFk,
|
||||||
|
itemShelvingFk ,
|
||||||
|
IF(saleFk <> @oldsaleFk, @outstanding := quantity, @outstanding),
|
||||||
|
@qtr := LEAST(@outstanding, available) quantityToReserve,
|
||||||
|
@outStanding := @outStanding - @qtr,
|
||||||
|
@oldsaleFk := saleFk
|
||||||
|
FROM(
|
||||||
|
SELECT ts.saleFk,
|
||||||
|
ts.userFk,
|
||||||
|
s.quantity,
|
||||||
|
ish.id itemShelvingFk,
|
||||||
|
ish.visible - IFNULL(ishr.reservedQuantity, 0) available
|
||||||
|
FROM tmp.sale ts
|
||||||
|
JOIN sale s ON s.id = ts.saleFk
|
||||||
|
JOIN itemShelving ish ON ish.itemFk = s.itemFk
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT itemShelvingFk, SUM(quantity) reservedQuantity
|
||||||
|
FROM itemShelvingSale
|
||||||
|
WHERE NOT isPicked
|
||||||
|
GROUP BY itemShelvingFk) ishr ON ishr.itemShelvingFk = ish.id
|
||||||
|
JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||||
|
JOIN parking p ON p.id = sh.parkingFk
|
||||||
|
JOIN sector sc ON sc.id = p.sectorFk
|
||||||
|
JOIN warehouse w ON w.id = sc.warehouseFk
|
||||||
|
JOIN productionConfig pc
|
||||||
|
WHERE w.id = vWarehouseFk
|
||||||
|
AND NOT sc.isHideForPickers
|
||||||
|
ORDER BY
|
||||||
|
s.id,
|
||||||
|
p.pickingOrder >= vLastPickingOrder,
|
||||||
|
sh.priority DESC,
|
||||||
|
ish.visible >= s.quantity DESC,
|
||||||
|
s.quantity MOD ish.grouping = 0 DESC,
|
||||||
|
ish.grouping DESC,
|
||||||
|
IF(pc.orderMode = 'Location', p.pickingOrder, ish.created)
|
||||||
|
)sub
|
||||||
|
)sub2
|
||||||
|
WHERE quantityToReserve > 0;
|
||||||
|
|
||||||
|
INSERT INTO itemShelvingSale(
|
||||||
|
itemShelvingFk,
|
||||||
|
saleFk,
|
||||||
|
quantity,
|
||||||
|
userFk)
|
||||||
|
SELECT itemShelvingFk,
|
||||||
|
saleFk,
|
||||||
|
quantityToReserve,
|
||||||
|
IFNULL(userFk, getUser())
|
||||||
|
FROM tSalePlacementQuantity spl;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE tmp.sale;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelvingSale_reserveBySale`(
|
||||||
|
vSelf INT ,
|
||||||
|
vQuantity INT,
|
||||||
|
vUserFk INT
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Reserva cantida y ubicación para una saleFk
|
||||||
|
*
|
||||||
|
* @param vSelf Identificador de la venta
|
||||||
|
* @param vQuantity Cantidad a reservar
|
||||||
|
* @param vUserFk Id de usuario que realiza la reserva
|
||||||
|
*/
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT vSelf saleFk, vUserFk userFk;
|
||||||
|
|
||||||
|
CALL itemShelvingSale_reserve();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemShelvingSale_AFTER_INSERT`
|
||||||
|
AFTER INSERT ON `itemShelvingSale`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
UPDATE vn.sale
|
||||||
|
SET isPicked = TRUE
|
||||||
|
WHERE id = NEW.saleFk;
|
||||||
|
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
File diff suppressed because one or more lines are too long
|
@ -2974,3 +2974,7 @@ INSERT INTO vn.XDiario (id, ASIEN, FECHA, SUBCTA, CONTRA, CONCEPTO, EURODEBE, EU
|
||||||
(4, 2.0, util.VN_CURDATE(), '4300001104', NULL, 'n/fra T4444444', 8.88, NULL, NULL, NULL, '0', NULL, 0.00, NULL, NULL, NULL, NULL, NULL, '2', NULL, 1, 2, 'I.F.', 'Nombre Importador', 1, 0, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
|
(4, 2.0, util.VN_CURDATE(), '4300001104', NULL, 'n/fra T4444444', 8.88, NULL, NULL, NULL, '0', NULL, 0.00, NULL, NULL, NULL, NULL, NULL, '2', NULL, 1, 2, 'I.F.', 'Nombre Importador', 1, 0, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
|
||||||
(5, 2.0, util.VN_CURDATE(), '2000000000', '4300001104', 'n/fra T4444444 Tony Stark', NULL, 8.07, NULL, NULL, '0', NULL, 0.00, NULL, NULL, NULL, NULL, NULL, '2', NULL, 1, 2, 'I.F.', 'Nombre Importador', 1, 0, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
|
(5, 2.0, util.VN_CURDATE(), '2000000000', '4300001104', 'n/fra T4444444 Tony Stark', NULL, 8.07, NULL, NULL, '0', NULL, 0.00, NULL, NULL, NULL, NULL, NULL, '2', NULL, 1, 2, 'I.F.', 'Nombre Importador', 1, 0, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
|
||||||
(6, 2.0, util.VN_CURDATE(), '4770000010', '4300001104', 'Inmovilizado pendiente : n/fra T4444444 Tony Stark', NULL, 0.81, 8.07, 'T', '4444444', 10.00, NULL, NULL, NULL, NULL, NULL, '', '2', '', 1, 1, '06089160W', 'IRON MAN', 1, 1, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, 1, 1, 1, 1, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0);
|
(6, 2.0, util.VN_CURDATE(), '4770000010', '4300001104', 'Inmovilizado pendiente : n/fra T4444444 Tony Stark', NULL, 0.81, 8.07, 'T', '4444444', 10.00, NULL, NULL, NULL, NULL, NULL, '', '2', '', 1, 1, '06089160W', 'IRON MAN', 1, 1, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, 1, 1, 1, 1, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`mistakeType` (`id`, `description`)
|
||||||
|
VALUES
|
||||||
|
(1, 'Incorrect quantity');
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
import getBrowser from '../../helpers/puppeteer.js';
|
||||||
|
|
||||||
// #1528 e2e claim/detail
|
// #1528 e2e claim/detail
|
||||||
xdescribe('Claim detail', () => {
|
xdescribe('Claim detail', () => {
|
|
@ -1,97 +0,0 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
|
||||||
|
|
||||||
describe('Claim development', () => {
|
|
||||||
let browser;
|
|
||||||
let page;
|
|
||||||
|
|
||||||
beforeAll(async() => {
|
|
||||||
browser = await getBrowser();
|
|
||||||
page = browser.page;
|
|
||||||
await page.loginAndModule('claimManager', 'claim');
|
|
||||||
await page.accessToSearchResult('1');
|
|
||||||
await page.accessToSection('claim.card.development');
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async() => {
|
|
||||||
await browser.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should delete a development and create a new one', async() => {
|
|
||||||
await page.waitToClick(selectors.claimDevelopment.firstDeleteDevelopmentButton);
|
|
||||||
await page.waitToClick(selectors.claimDevelopment.addDevelopmentButton);
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimReason, 'Baja calidad');
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimResult, 'Deshidratacion');
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimResponsible, 'Calidad general');
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimWorker, 'deliveryNick');
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimRedelivery, 'Reparto');
|
|
||||||
await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton);
|
|
||||||
const message = await page.waitForSnackbar();
|
|
||||||
|
|
||||||
expect(message.text).toContain('Data saved!');
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should redirect to the next section of claims as the role is claimManager`, async() => {
|
|
||||||
await page.waitForState('claim.card.action');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should edit a development', async() => {
|
|
||||||
await page.reloadSection('claim.card.development');
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimReason, 'Calor');
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimResult, 'Cocido');
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimResponsible, 'Calidad general');
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimWorker, 'adminAssistantNick');
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimRedelivery, 'Cliente');
|
|
||||||
await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton);
|
|
||||||
const message = await page.waitForSnackbar();
|
|
||||||
|
|
||||||
expect(message.text).toContain('Data saved!');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should confirm the first development is the expected one', async() => {
|
|
||||||
await page.reloadSection('claim.card.development');
|
|
||||||
const reason = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.firstClaimReason, 'value');
|
|
||||||
|
|
||||||
const result = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.firstClaimResult, 'value');
|
|
||||||
|
|
||||||
const responsible = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.firstClaimResponsible, 'value');
|
|
||||||
|
|
||||||
const worker = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.firstClaimWorker, 'value');
|
|
||||||
|
|
||||||
const redelivery = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.firstClaimRedelivery, 'value');
|
|
||||||
|
|
||||||
expect(reason).toEqual('Calor');
|
|
||||||
expect(result).toEqual('Baboso/Cocido');
|
|
||||||
expect(responsible).toEqual('Calidad general');
|
|
||||||
expect(worker).toEqual('adminAssistantNick');
|
|
||||||
expect(redelivery).toEqual('Cliente');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should confirm the second development is the expected one', async() => {
|
|
||||||
const reason = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.secondClaimReason, 'value');
|
|
||||||
|
|
||||||
const result = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.secondClaimResult, 'value');
|
|
||||||
|
|
||||||
const responsible = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.secondClaimResponsible, 'value');
|
|
||||||
|
|
||||||
const worker = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.secondClaimWorker, 'value');
|
|
||||||
|
|
||||||
const redelivery = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.secondClaimRedelivery, 'value');
|
|
||||||
|
|
||||||
expect(reason).toEqual('Baja calidad');
|
|
||||||
expect(result).toEqual('Deshidratacion');
|
|
||||||
expect(responsible).toEqual('Calidad general');
|
|
||||||
expect(worker).toEqual('deliveryNick');
|
|
||||||
expect(redelivery).toEqual('Reparto');
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,5 +1,5 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
import getBrowser from '../../helpers/puppeteer.js';
|
||||||
|
|
||||||
describe('Claim action path', () => {
|
describe('Claim action path', () => {
|
||||||
let browser;
|
let browser;
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
import getBrowser from '../../helpers/puppeteer.js';
|
||||||
|
|
||||||
describe('Claim summary path', () => {
|
describe('Claim summary path', () => {
|
||||||
let browser;
|
let browser;
|
|
@ -1,5 +1,5 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
import getBrowser from '../../helpers/puppeteer.js';
|
||||||
|
|
||||||
describe('Claim descriptor path', () => {
|
describe('Claim descriptor path', () => {
|
||||||
let browser;
|
let browser;
|
|
@ -18,6 +18,7 @@ import './section';
|
||||||
import './summary';
|
import './summary';
|
||||||
import './topbar/topbar';
|
import './topbar/topbar';
|
||||||
import './user-popover';
|
import './user-popover';
|
||||||
|
import './user-photo';
|
||||||
import './upload-photo';
|
import './upload-photo';
|
||||||
import './bank-entity';
|
import './bank-entity';
|
||||||
import './log';
|
import './log';
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<vn-avatar
|
<vn-avatar
|
||||||
ng-class="::{system: !userLog.user}"
|
ng-class="::{system: !userLog.user}"
|
||||||
val="{{::userLog.user ? userLog.user.nickname : $ctrl.$t('System')}}"
|
val="{{::userLog.user ? userLog.user.nickname : $ctrl.$t('System')}}"
|
||||||
ng-click="$ctrl.showWorkerDescriptor($event, userLog)">
|
ng-click="$ctrl.showDescriptor($event, userLog)">
|
||||||
<img
|
<img
|
||||||
ng-if="::userLog.user.image"
|
ng-if="::userLog.user.image"
|
||||||
ng-src="/api/Images/user/160x160/{{::userLog.userFk}}/download?access_token={{::$ctrl.vnToken.token}}">
|
ng-src="/api/Images/user/160x160/{{::userLog.userFk}}/download?access_token={{::$ctrl.vnToken.token}}">
|
||||||
|
@ -260,3 +260,6 @@
|
||||||
<vn-worker-descriptor-popover
|
<vn-worker-descriptor-popover
|
||||||
vn-id="worker-descriptor">
|
vn-id="worker-descriptor">
|
||||||
</vn-worker-descriptor-popover>
|
</vn-worker-descriptor-popover>
|
||||||
|
<vn-account-descriptor-popover
|
||||||
|
vn-id="account-descriptor">
|
||||||
|
</vn-account-descriptor-popover>
|
||||||
|
|
|
@ -362,9 +362,11 @@ export default class Controller extends Section {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
showWorkerDescriptor(event, userLog) {
|
showDescriptor(event, userLog) {
|
||||||
if (userLog.user?.worker)
|
if (userLog.user?.worker && this.$state.current.name.split('.')[0] != 'account')
|
||||||
this.$.workerDescriptor.show(event.target, userLog.userFk);
|
return this.$.workerDescriptor.show(event.target, userLog.userFk);
|
||||||
|
|
||||||
|
this.$.accountDescriptor.show(event.target, userLog.userFk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<div class="photo" text-center>
|
||||||
|
<img vn-id="photo"
|
||||||
|
ng-src="{{$root.imagePath('user', '520x520', $ctrl.userId)}}"
|
||||||
|
zoom-image="{{$root.imagePath('user', '1600x1600', $ctrl.userId)}}"
|
||||||
|
on-error-src/>
|
||||||
|
<vn-float-button ng-click="uploadPhoto.show('user', $ctrl.userId)"
|
||||||
|
icon="edit"
|
||||||
|
vn-visible-by="userPhotos">
|
||||||
|
</vn-float-button>
|
||||||
|
</div>
|
||||||
|
<!-- Upload photo dialog -->
|
||||||
|
<vn-upload-photo
|
||||||
|
vn-id="uploadPhoto"
|
||||||
|
on-response="$ctrl.onUploadResponse()">
|
||||||
|
</vn-upload-photo>
|
|
@ -0,0 +1,31 @@
|
||||||
|
import ngModule from '../../module';
|
||||||
|
|
||||||
|
export default class Controller {
|
||||||
|
constructor($element, $, $rootScope) {
|
||||||
|
Object.assign(this, {
|
||||||
|
$element,
|
||||||
|
$,
|
||||||
|
$rootScope,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onUploadResponse() {
|
||||||
|
const timestamp = Date.vnNew().getTime();
|
||||||
|
const src = this.$rootScope.imagePath('user', '520x520', this.userId);
|
||||||
|
const zoomSrc = this.$rootScope.imagePath('user', '1600x1600', this.userId);
|
||||||
|
const newSrc = `${src}&t=${timestamp}`;
|
||||||
|
const newZoomSrc = `${zoomSrc}&t=${timestamp}`;
|
||||||
|
|
||||||
|
this.$.photo.setAttribute('src', newSrc);
|
||||||
|
this.$.photo.setAttribute('zoom-image', newZoomSrc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Controller.$inject = ['$element', '$scope', '$rootScope'];
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnUserPhoto', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: Controller,
|
||||||
|
bindings: {
|
||||||
|
userId: '@?',
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,6 @@
|
||||||
|
My account: Mi cuenta
|
||||||
|
Local warehouse: Almacén local
|
||||||
|
Local bank: Banco local
|
||||||
|
Local company: Empresa local
|
||||||
|
User warehouse: Almacén del usuario
|
||||||
|
User company: Empresa del usuario
|
|
@ -187,5 +187,6 @@
|
||||||
"This ticket is not editable.": "This ticket is not editable.",
|
"This ticket is not editable.": "This ticket is not editable.",
|
||||||
"The ticket doesn't exist.": "The ticket doesn't exist.",
|
"The ticket doesn't exist.": "The ticket doesn't exist.",
|
||||||
"The sales do not exists": "The sales do not exists",
|
"The sales do not exists": "The sales do not exists",
|
||||||
"Ticket without Route": "Ticket without route"
|
"Ticket without Route": "Ticket without route",
|
||||||
|
"Booking completed": "Booking completed"
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,5 +317,6 @@
|
||||||
"Social name should be uppercase": "La razón social debe ir en mayúscula",
|
"Social name should be uppercase": "La razón social debe ir en mayúscula",
|
||||||
"Street should be uppercase": "La dirección fiscal debe ir en mayúscula",
|
"Street should be uppercase": "La dirección fiscal debe ir en mayúscula",
|
||||||
"The response is not a PDF": "La respuesta no es un PDF",
|
"The response is not a PDF": "La respuesta no es un PDF",
|
||||||
"Ticket without Route": "Ticket sin ruta"
|
"Ticket without Route": "Ticket sin ruta",
|
||||||
|
"Booking completed": "Reserva completada"
|
||||||
}
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
<slot-descriptor>
|
||||||
|
<vn-user-descriptor>
|
||||||
|
</vn-user-descriptor>
|
||||||
|
</slot-descriptor>
|
|
@ -0,0 +1,9 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
import DescriptorPopover from 'salix/components/descriptor-popover';
|
||||||
|
|
||||||
|
class Controller extends DescriptorPopover {}
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnAccountDescriptorPopover', {
|
||||||
|
slotTemplate: require('./index.html'),
|
||||||
|
controller: Controller
|
||||||
|
});
|
|
@ -2,6 +2,9 @@
|
||||||
module="account"
|
module="account"
|
||||||
description="$ctrl.user.nickname"
|
description="$ctrl.user.nickname"
|
||||||
summary="$ctrl.$.summary">
|
summary="$ctrl.$.summary">
|
||||||
|
<slot-before>
|
||||||
|
<vn-user-photo user-id="{{$ctrl.id}}"/>
|
||||||
|
</slot-before>
|
||||||
<slot-menu>
|
<slot-menu>
|
||||||
<vn-item
|
<vn-item
|
||||||
ng-click="deleteUser.show()"
|
ng-click="deleteUser.show()"
|
||||||
|
|
|
@ -24,6 +24,28 @@ class Controller extends Descriptor {
|
||||||
.then(res => this.hasAccount = res.data.exists);
|
.then(res => this.hasAccount = res.data.exists);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadData() {
|
||||||
|
const filter = {
|
||||||
|
where: {id: this.$params.id},
|
||||||
|
include: {
|
||||||
|
relation: 'role',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'name']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return Promise.all([
|
||||||
|
this.$http.get(`VnUsers/preview`, {filter})
|
||||||
|
.then(res => {
|
||||||
|
const [user] = res.data;
|
||||||
|
this.user = user;
|
||||||
|
}),
|
||||||
|
this.$http.get(`Accounts/${this.$params.id}/exists`)
|
||||||
|
.then(res => this.hasAccount = res.data.exists)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
onDelete() {
|
onDelete() {
|
||||||
return this.$http.delete(`VnUsers/${this.id}`)
|
return this.$http.delete(`VnUsers/${this.id}`)
|
||||||
.then(() => this.$state.go('account.index'))
|
.then(() => this.$state.go('account.index'))
|
||||||
|
|
|
@ -9,6 +9,7 @@ import './acl';
|
||||||
import './summary';
|
import './summary';
|
||||||
import './card';
|
import './card';
|
||||||
import './descriptor';
|
import './descriptor';
|
||||||
|
import './descriptor-popover';
|
||||||
import './search-panel';
|
import './search-panel';
|
||||||
import './create';
|
import './create';
|
||||||
import './basic-data';
|
import './basic-data';
|
||||||
|
|
|
@ -1,116 +1,2 @@
|
||||||
<vn-crud-model
|
<vn-card>
|
||||||
vn-id="model"
|
|
||||||
url="ClaimDevelopments"
|
|
||||||
fields="['id', 'claimFk', 'claimReasonFk', 'claimResultFk', 'claimResponsibleFk', 'workerFk', 'claimRedeliveryFk']"
|
|
||||||
link="{claimFk: $ctrl.$params.id}"
|
|
||||||
filter="$ctrl.filter"
|
|
||||||
data="claimDevelopments"
|
|
||||||
auto-load="true">
|
|
||||||
</vn-crud-model>
|
|
||||||
<vn-crud-model
|
|
||||||
url="ClaimReasons"
|
|
||||||
data="claimReasons"
|
|
||||||
order="description"
|
|
||||||
auto-load="true">
|
|
||||||
</vn-crud-model>
|
|
||||||
<vn-crud-model
|
|
||||||
url="ClaimResults"
|
|
||||||
data="claimResults"
|
|
||||||
order="description"
|
|
||||||
auto-load="true">
|
|
||||||
</vn-crud-model>
|
|
||||||
<vn-crud-model
|
|
||||||
url="ClaimResponsibles"
|
|
||||||
data="claimResponsibles"
|
|
||||||
order="description"
|
|
||||||
auto-load="true">
|
|
||||||
</vn-crud-model>
|
|
||||||
<vn-crud-model
|
|
||||||
url="ClaimRedeliveries"
|
|
||||||
data="claimRedeliveries"
|
|
||||||
order="description"
|
|
||||||
auto-load="true">
|
|
||||||
</vn-crud-model>
|
|
||||||
<vn-watcher
|
|
||||||
vn-id="watcher"
|
|
||||||
data="claimDevelopments"
|
|
||||||
form="form">
|
|
||||||
</vn-watcher>
|
|
||||||
<vn-vertical class="vn-w-lg">
|
|
||||||
<vn-card class="vn-pa-lg">
|
|
||||||
<vn-vertical>
|
|
||||||
<form name="form">
|
|
||||||
<vn-horizontal ng-repeat="claimDevelopment in claimDevelopments">
|
|
||||||
<vn-autocomplete
|
|
||||||
vn-focus
|
|
||||||
label="Reason"
|
|
||||||
ng-model="claimDevelopment.claimReasonFk"
|
|
||||||
data="claimReasons"
|
|
||||||
fields="['id', 'description']"
|
|
||||||
show-field="description"
|
|
||||||
rule>
|
|
||||||
</vn-autocomplete>
|
|
||||||
<vn-autocomplete
|
|
||||||
label="Result"
|
|
||||||
ng-model="claimDevelopment.claimResultFk"
|
|
||||||
data="claimResults"
|
|
||||||
fields="['id', 'description']"
|
|
||||||
show-field="description"
|
|
||||||
rule>
|
|
||||||
</vn-autocomplete>
|
|
||||||
<vn-autocomplete
|
|
||||||
label="Responsible"
|
|
||||||
ng-model="claimDevelopment.claimResponsibleFk"
|
|
||||||
data="claimResponsibles"
|
|
||||||
fields="['id', 'description']"
|
|
||||||
show-field="description"
|
|
||||||
rule>
|
|
||||||
</vn-autocomplete>
|
|
||||||
<vn-worker-autocomplete
|
|
||||||
ng-model="claimDevelopment.workerFk"
|
|
||||||
show-field="nickname"
|
|
||||||
rule>
|
|
||||||
</vn-worker-autocomplete>
|
|
||||||
<vn-autocomplete
|
|
||||||
label="Redelivery"
|
|
||||||
ng-model="claimDevelopment.claimRedeliveryFk"
|
|
||||||
data="claimRedeliveries"
|
|
||||||
fields="['id', 'description']"
|
|
||||||
show-field="description"
|
|
||||||
rule>
|
|
||||||
</vn-autocomplete>
|
|
||||||
<vn-icon-button
|
|
||||||
vn-none
|
|
||||||
class="vn-my-md"
|
|
||||||
vn-tooltip="Remove sale"
|
|
||||||
icon="delete"
|
|
||||||
ng-click="model.remove($index)"
|
|
||||||
tabindex="-1">
|
|
||||||
</vn-icon-button>
|
|
||||||
</vn-horizontal>
|
|
||||||
</form>
|
|
||||||
<vn-one class="vn-pt-md">
|
|
||||||
<vn-icon-button
|
|
||||||
vn-bind="+"
|
|
||||||
vn-tooltip="Add sale"
|
|
||||||
icon="add_circle"
|
|
||||||
ng-click="model.insert()">
|
|
||||||
</vn-icon-button>
|
|
||||||
</vn-one>
|
|
||||||
</vn-vertical>
|
|
||||||
</vn-card>
|
</vn-card>
|
||||||
<vn-button-bar>
|
|
||||||
<vn-submit
|
|
||||||
disabled="!watcher.dataChanged()"
|
|
||||||
ng-click="$ctrl.onSubmit()"
|
|
||||||
label="Save">
|
|
||||||
</vn-submit>
|
|
||||||
<!-- # #2680 Undo changes button bugs -->
|
|
||||||
<!-- <vn-button
|
|
||||||
class="cancel"
|
|
||||||
label="Undo changes"
|
|
||||||
disabled="!watcher.dataChanged()"
|
|
||||||
ng-click="watcher.loadOriginalData()">
|
|
||||||
</vn-button> -->
|
|
||||||
</vn-button-bar>
|
|
||||||
</vn-vertical>
|
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
import Section from 'salix/components/section';
|
import Section from 'salix/components/section';
|
||||||
import './style.scss';
|
|
||||||
|
|
||||||
class Controller extends Section {
|
class Controller extends Section {
|
||||||
onSubmit() {
|
constructor($element, $) {
|
||||||
this.$.watcher.check();
|
super($element, $);
|
||||||
this.$.model.save().then(() => {
|
}
|
||||||
this.$.watcher.notifySaved();
|
|
||||||
this.$.watcher.updateOriginalData();
|
|
||||||
|
|
||||||
if (this.aclService.hasAny(['claimManager']))
|
async $onInit() {
|
||||||
this.$state.go('claim.card.action');
|
this.$state.go('claim.card.summary', {id: this.$params.id});
|
||||||
});
|
window.location.href = await this.vnApp.getUrl(`claim/${this.$params.id}/development`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
import './index.js';
|
|
||||||
import watcher from 'core/mocks/watcher';
|
|
||||||
import crudModel from 'core/mocks/crud-model';
|
|
||||||
|
|
||||||
describe('Claim', () => {
|
|
||||||
describe('Component vnClaimDevelopment', () => {
|
|
||||||
let controller;
|
|
||||||
let $scope;
|
|
||||||
|
|
||||||
beforeEach(ngModule('claim'));
|
|
||||||
|
|
||||||
beforeEach(inject(($componentController, $rootScope) => {
|
|
||||||
$scope = $rootScope.$new();
|
|
||||||
$scope.watcher = watcher;
|
|
||||||
$scope.model = crudModel;
|
|
||||||
const $element = angular.element('<vn-claim-development></vn-claim-development>');
|
|
||||||
controller = $componentController('vnClaimDevelopment', {$element, $scope});
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe('onSubmit()', () => {
|
|
||||||
it(`should redirect to 'claim.card.action' state`, () => {
|
|
||||||
jest.spyOn(controller.aclService, 'hasAny').mockReturnValue(true);
|
|
||||||
jest.spyOn(controller.$state, 'go');
|
|
||||||
|
|
||||||
controller.onSubmit();
|
|
||||||
|
|
||||||
expect(controller.$state.go).toHaveBeenCalledWith('claim.card.action');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,8 +0,0 @@
|
||||||
Destination: Destino
|
|
||||||
Development: Trazabilidad
|
|
||||||
Reason: Motivo
|
|
||||||
Result: Consecuencia
|
|
||||||
Responsible: Responsable
|
|
||||||
Worker: Trabajador
|
|
||||||
Redelivery: Devolución
|
|
||||||
Add line: Añadir Linea
|
|
|
@ -18,6 +18,13 @@
|
||||||
"isLabeler": {
|
"isLabeler": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"sector": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Sector",
|
||||||
|
"foreignKey": "sectorFk"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"acls": [{
|
"acls": [{
|
||||||
"accessType": "READ",
|
"accessType": "READ",
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('itemShelvingSaleByCollection', {
|
||||||
|
description: 'Insert sales of the collection in itemShelvingSale',
|
||||||
|
accessType: 'WRITE',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The collection id',
|
||||||
|
required: true,
|
||||||
|
http: {source: 'path'}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
http: {
|
||||||
|
path: `/:id/itemShelvingSaleByCollection`,
|
||||||
|
verb: 'POST'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.itemShelvingSaleByCollection = async(ctx, id, options) => {
|
||||||
|
const myOptions = {userId: ctx.req.accessToken.userId};
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
await Self.rawSql(`CALL vn.itemShelvingSale_addByCollection(?)`, [id], myOptions);
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,41 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('itemShelvingSaleSetQuantity', {
|
||||||
|
description: 'Set quanitity of a sale in itemShelvingSale',
|
||||||
|
accessType: 'WRITE',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
required: true,
|
||||||
|
description: 'The sale id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'quantity',
|
||||||
|
type: 'number',
|
||||||
|
required: true,
|
||||||
|
description: 'The quantity to set',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'isItemShelvingSaleEmpty',
|
||||||
|
type: 'boolean',
|
||||||
|
required: true,
|
||||||
|
description: 'True if the shelvingFk is empty ',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
http: {
|
||||||
|
path: `/itemShelvingSaleSetQuantity`,
|
||||||
|
verb: 'POST'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.itemShelvingSaleSetQuantity = async(ctx, id, quantity, isItemShelvingSaleEmpty, options) => {
|
||||||
|
const myOptions = {userId: ctx.req.accessToken.userId};
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
await Self.rawSql(`CALL vn.itemShelvingSale_setQuantity(?, ?, ? )`,
|
||||||
|
[id, quantity, isItemShelvingSaleEmpty],
|
||||||
|
myOptions);
|
||||||
|
};
|
||||||
|
};
|
|
@ -32,6 +32,6 @@ module.exports = Self => {
|
||||||
|
|
||||||
Self.setVisibleDiscard = async(ctx, itemFk, warehouseFk, quantity, addressFk) => {
|
Self.setVisibleDiscard = async(ctx, itemFk, warehouseFk, quantity, addressFk) => {
|
||||||
const query = `CALL vn.item_setVisibleDiscard(?, ?, ?, ?)`;
|
const query = `CALL vn.item_setVisibleDiscard(?, ?, ?, ?)`;
|
||||||
await Self.rawSql(query, [itemFk, warehouseFk, quantity, addressFk]);
|
await Self.rawSql(query, [itemFk, warehouseFk, quantity, addressFk], {userId: ctx.req.accessToken.userId});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,11 +26,17 @@
|
||||||
"shelving": {
|
"shelving": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"subName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"packing": {
|
"packing": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"stock": {
|
"stock": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
|
},
|
||||||
|
"size": {
|
||||||
|
"type": "number"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
require('../methods/item-shelving-sale/filter')(Self);
|
require('../methods/item-shelving-sale/filter')(Self);
|
||||||
|
require('../methods/item-shelving-sale/itemShelvingSaleByCollection')(Self);
|
||||||
|
require('../methods/item-shelving-sale/itemShelvingSaleSetQuantity')(Self);
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,10 +20,16 @@
|
||||||
},
|
},
|
||||||
"created": {
|
"created": {
|
||||||
"type": "date"
|
"type": "date"
|
||||||
|
},
|
||||||
|
"grouping": {
|
||||||
|
"type": "number"
|
||||||
},
|
},
|
||||||
"isChecked": {
|
"isChecked": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"packing": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
"visible": {
|
"visible": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,5 +10,8 @@
|
||||||
},
|
},
|
||||||
"Sector": {
|
"Sector": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"Train": {
|
||||||
|
"dataSource": "vn"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,12 +9,11 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"id": true,
|
"description": "Identifier",
|
||||||
"description": "Identifier"
|
"id": true
|
||||||
},
|
},
|
||||||
"code": {
|
"code": {
|
||||||
"type": "string",
|
"type": "string"
|
||||||
"required": true
|
|
||||||
},
|
},
|
||||||
"parkingFk": {
|
"parkingFk": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"name": "Train",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "train"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -118,7 +118,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
// Send notification to salesPerson
|
// Send notification to salesPerson
|
||||||
const salesPersonUser = ticket.client().salesPersonUser();
|
const salesPersonUser = ticket.client().salesPersonUser();
|
||||||
if (salesPersonUser) {
|
if (salesPersonUser && sales.length) {
|
||||||
const origin = ctx.req.headers.origin;
|
const origin = ctx.req.headers.origin;
|
||||||
const message = $t(`I have deleted the ticket id`, {
|
const message = $t(`I have deleted the ticket id`, {
|
||||||
id: id,
|
id: id,
|
||||||
|
|
|
@ -49,7 +49,7 @@ describe('ticket merge()', () => {
|
||||||
|
|
||||||
expect(deletedTicket.isDeleted).toEqual(true);
|
expect(deletedTicket.isDeleted).toEqual(true);
|
||||||
expect(salesTicketFuture.length).toEqual(2);
|
expect(salesTicketFuture.length).toEqual(2);
|
||||||
expect(chatNotificationBeforeMerge.length).toEqual(chatNotificationAfterMerge.length - 2);
|
expect(chatNotificationBeforeMerge.length).toEqual(chatNotificationAfterMerge.length - 1);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -17,6 +17,12 @@
|
||||||
"Expedition": {
|
"Expedition": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"ExpeditionPallet": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"ExpeditionScan": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"ExpeditionState": {
|
"ExpeditionState": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -32,6 +38,9 @@
|
||||||
"ExpeditionMistake": {
|
"ExpeditionMistake": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"ExpeditionMistakeType": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"PrintServerQueue": {
|
"PrintServerQueue": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -47,6 +56,9 @@
|
||||||
"SaleGroup": {
|
"SaleGroup": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"SaleMistake": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"SaleGroupDetail": {
|
"SaleGroupDetail": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
},
|
},
|
||||||
"type": {
|
"type": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "MistakeType",
|
"model": "ExpeditionMistakeType",
|
||||||
"foreignKey": "typeFk"
|
"foreignKey": "typeFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"name": "ExpeditionMistakeType",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "expeditionMistakeType"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"code": {
|
||||||
|
"id":true,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"name": "ExpeditionPallet",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "expeditionPallet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"acls": [{
|
||||||
|
"accessType": "WRITE",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "production",
|
||||||
|
"permission": "ALLOW"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
{
|
||||||
|
"name": "ExpeditionScan",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "expeditionScan"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"expeditionFk": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "Identifier",
|
||||||
|
"id": true
|
||||||
|
},
|
||||||
|
"palletFk": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "Identifier",
|
||||||
|
"id": true
|
||||||
|
},
|
||||||
|
"scanned": {
|
||||||
|
"type": "date",
|
||||||
|
"default": "$now"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"expedition": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Expedition",
|
||||||
|
"foreignKey": "expeditionFk"
|
||||||
|
},
|
||||||
|
"pallet": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "expeditionPallet",
|
||||||
|
"foreignKey": "palletFk"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"acls": [{
|
||||||
|
"accessType": "WRITE",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "production",
|
||||||
|
"permission": "ALLOW"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
{
|
||||||
|
"name": "SaleMistake",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "saleMistake"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"id": true,
|
||||||
|
"type": "number",
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"created": {
|
||||||
|
"type": "date"
|
||||||
|
},
|
||||||
|
"saleFk": {
|
||||||
|
"type": "number",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"userFk": {
|
||||||
|
"type": "number",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"typeFk": {
|
||||||
|
"type": "number",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"sale": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Sale",
|
||||||
|
"foreignKey": "saleFk"
|
||||||
|
},
|
||||||
|
"worker": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Worker",
|
||||||
|
"foreignKey": "userFk"
|
||||||
|
},
|
||||||
|
"mistakeType": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "MistakeType",
|
||||||
|
"foreignKey": "typeFk"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -43,6 +43,9 @@
|
||||||
},
|
},
|
||||||
"EducationLevel": {
|
"EducationLevel": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"MistakeType": {
|
||||||
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"ProfileType":{
|
"ProfileType":{
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
|
@ -83,6 +86,12 @@
|
||||||
"WorkerMana": {
|
"WorkerMana": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"WorkerMistake": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"WorkerMistakeType": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"WorkerMedia": {
|
"WorkerMedia": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"name": "MistakeType",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "mistakeType"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"id":true,
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"name": "WorkerMistake",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "workerMistake"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"id":true,
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"userFk": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"workerMistakeTypeFk": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"created": {
|
||||||
|
"type": "date"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"name": "WorkerMistakeType",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "workerMistakeType"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"code": {
|
||||||
|
"id":true,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"type": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "WorkerMistakeType",
|
||||||
|
"foreignKey": "code"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -3,16 +3,7 @@
|
||||||
description="$ctrl.worker.firstName +' '+ $ctrl.worker.lastName"
|
description="$ctrl.worker.firstName +' '+ $ctrl.worker.lastName"
|
||||||
summary="$ctrl.$.summary">
|
summary="$ctrl.$.summary">
|
||||||
<slot-before>
|
<slot-before>
|
||||||
<div class="photo" text-center>
|
<vn-user-photo user-id="{{$ctrl.worker.id}}"/>
|
||||||
<img vn-id="photo"
|
|
||||||
ng-src="{{$root.imagePath('user', '520x520', $ctrl.worker.id)}}"
|
|
||||||
zoom-image="{{$root.imagePath('user', '1600x1600', $ctrl.worker.id)}}"
|
|
||||||
on-error-src/>
|
|
||||||
<vn-float-button ng-click="uploadPhoto.show('user', $ctrl.worker.id)"
|
|
||||||
icon="edit"
|
|
||||||
vn-visible-by="userPhotos">
|
|
||||||
</vn-float-button>
|
|
||||||
</div>
|
|
||||||
</slot-before>
|
</slot-before>
|
||||||
<slot-menu>
|
<slot-menu>
|
||||||
<vn-item ng-click="$ctrl.handleExcluded()" translate>
|
<vn-item ng-click="$ctrl.handleExcluded()" translate>
|
||||||
|
@ -76,8 +67,3 @@
|
||||||
<vn-worker-summary worker="$ctrl.worker"></vn-worker-summary>
|
<vn-worker-summary worker="$ctrl.worker"></vn-worker-summary>
|
||||||
</vn-popup>
|
</vn-popup>
|
||||||
|
|
||||||
<!-- Upload photo dialog -->
|
|
||||||
<vn-upload-photo
|
|
||||||
vn-id="uploadPhoto"
|
|
||||||
on-response="$ctrl.onUploadResponse()">
|
|
||||||
</vn-upload-photo>
|
|
||||||
|
|
|
@ -71,17 +71,6 @@ class Controller extends Descriptor {
|
||||||
return this.getData(`Workers/${this.id}`, {filter})
|
return this.getData(`Workers/${this.id}`, {filter})
|
||||||
.then(res => this.entity = res.data);
|
.then(res => this.entity = res.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
onUploadResponse() {
|
|
||||||
const timestamp = Date.vnNew().getTime();
|
|
||||||
const src = this.$rootScope.imagePath('user', '520x520', this.worker.id);
|
|
||||||
const zoomSrc = this.$rootScope.imagePath('user', '1600x1600', this.worker.id);
|
|
||||||
const newSrc = `${src}&t=${timestamp}`;
|
|
||||||
const newZoomSrc = `${zoomSrc}&t=${timestamp}`;
|
|
||||||
|
|
||||||
this.$.photo.setAttribute('src', newSrc);
|
|
||||||
this.$.photo.setAttribute('zoom-image', newZoomSrc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$element', '$scope', '$rootScope'];
|
Controller.$inject = ['$element', '$scope', '$rootScope'];
|
||||||
|
|
|
@ -52,6 +52,28 @@ class Controller extends Section {
|
||||||
|
|
||||||
set worker(value) {
|
set worker(value) {
|
||||||
this._worker = value;
|
this._worker = value;
|
||||||
|
this.fetchHours();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Worker hours data
|
||||||
|
*/
|
||||||
|
get hours() {
|
||||||
|
return this._hours;
|
||||||
|
}
|
||||||
|
|
||||||
|
set hours(value) {
|
||||||
|
this._hours = value;
|
||||||
|
|
||||||
|
for (const weekDay of this.weekDays) {
|
||||||
|
if (value) {
|
||||||
|
let day = weekDay.dated.getDay();
|
||||||
|
weekDay.hours = value
|
||||||
|
.filter(hour => new Date(hour.timed).getDay() == day)
|
||||||
|
.sort((a, b) => new Date(a.timed) - new Date(b.timed));
|
||||||
|
} else
|
||||||
|
weekDay.hours = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,11 +109,19 @@ class Controller extends Section {
|
||||||
dayIndex.setDate(dayIndex.getDate() + 1);
|
dayIndex.setDate(dayIndex.getDate() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fetchHours();
|
if (!this.weekTotalHours) this.fetchHours();
|
||||||
this.getWeekData();
|
this.getWeekData();
|
||||||
this.isMailSended();
|
this.isMailSended();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set weekTotalHours(totalHours) {
|
||||||
|
this._weekTotalHours = this.formatHours(totalHours);
|
||||||
|
}
|
||||||
|
|
||||||
|
get weekTotalHours() {
|
||||||
|
return this._weekTotalHours;
|
||||||
|
}
|
||||||
|
|
||||||
getWeekData() {
|
getWeekData() {
|
||||||
const filter = {
|
const filter = {
|
||||||
where: {
|
where: {
|
||||||
|
@ -102,13 +132,13 @@ class Controller extends Section {
|
||||||
};
|
};
|
||||||
this.$http.get('WorkerTimeControlMails', {filter})
|
this.$http.get('WorkerTimeControlMails', {filter})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const workerTimeControlMail = res.data;
|
const mail = res.data;
|
||||||
if (!workerTimeControlMail.length) {
|
if (!mail.length) {
|
||||||
this.state = null;
|
this.state = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.state = workerTimeControlMail[0].state;
|
this.state = mail[0].state;
|
||||||
this.reason = workerTimeControlMail[0].reason;
|
this.reason = mail[0].reason;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,28 +173,9 @@ class Controller extends Section {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Worker hours data
|
|
||||||
*/
|
|
||||||
get hours() {
|
|
||||||
return this._hours;
|
|
||||||
}
|
|
||||||
|
|
||||||
set hours(value) {
|
|
||||||
this._hours = value;
|
|
||||||
|
|
||||||
for (const weekDay of this.weekDays) {
|
|
||||||
if (value) {
|
|
||||||
let day = weekDay.dated.getDay();
|
|
||||||
weekDay.hours = value
|
|
||||||
.filter(hour => new Date(hour.timed).getDay() == day)
|
|
||||||
.sort((a, b) => new Date(a.timed) - new Date(b.timed));
|
|
||||||
} else
|
|
||||||
weekDay.hours = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fetchHours() {
|
fetchHours() {
|
||||||
|
if (!this.worker || !this.date) return;
|
||||||
|
|
||||||
const params = {workerFk: this.$params.id};
|
const params = {workerFk: this.$params.id};
|
||||||
const filter = {
|
const filter = {
|
||||||
where: {and: [
|
where: {and: [
|
||||||
|
@ -180,58 +191,6 @@ class Controller extends Section {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
hasEvents(day) {
|
|
||||||
return day >= this.started && day < this.ended;
|
|
||||||
}
|
|
||||||
|
|
||||||
getAbsences() {
|
|
||||||
const fullYear = this.started.getFullYear();
|
|
||||||
let params = {
|
|
||||||
workerFk: this.$params.id,
|
|
||||||
businessFk: null,
|
|
||||||
year: fullYear
|
|
||||||
};
|
|
||||||
|
|
||||||
return this.$http.get(`Calendars/absences`, {params})
|
|
||||||
.then(res => this.onData(res.data));
|
|
||||||
}
|
|
||||||
|
|
||||||
onData(data) {
|
|
||||||
const events = {};
|
|
||||||
|
|
||||||
const addEvent = (day, event) => {
|
|
||||||
events[new Date(day).getTime()] = event;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (data.holidays) {
|
|
||||||
data.holidays.forEach(holiday => {
|
|
||||||
const holidayDetail = holiday.detail && holiday.detail.description;
|
|
||||||
const holidayType = holiday.type && holiday.type.name;
|
|
||||||
const holidayName = holidayDetail || holidayType;
|
|
||||||
|
|
||||||
addEvent(holiday.dated, {
|
|
||||||
name: holidayName,
|
|
||||||
color: '#ff0'
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (data.absences) {
|
|
||||||
data.absences.forEach(absence => {
|
|
||||||
const type = absence.absenceType;
|
|
||||||
addEvent(absence.dated, {
|
|
||||||
name: type.name,
|
|
||||||
color: type.rgb
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.weekDays.forEach(day => {
|
|
||||||
const timestamp = day.dated.getTime();
|
|
||||||
if (events[timestamp])
|
|
||||||
day.event = events[timestamp];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
getWorkedHours(from, to) {
|
getWorkedHours(from, to) {
|
||||||
this.weekTotalHours = null;
|
this.weekTotalHours = null;
|
||||||
let weekTotalHours = 0;
|
let weekTotalHours = 0;
|
||||||
|
@ -271,6 +230,58 @@ class Controller extends Section {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getAbsences() {
|
||||||
|
const fullYear = this.started.getFullYear();
|
||||||
|
let params = {
|
||||||
|
workerFk: this.$params.id,
|
||||||
|
businessFk: null,
|
||||||
|
year: fullYear
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.$http.get(`Calendars/absences`, {params})
|
||||||
|
.then(res => this.onData(res.data));
|
||||||
|
}
|
||||||
|
|
||||||
|
hasEvents(day) {
|
||||||
|
return day >= this.started && day < this.ended;
|
||||||
|
}
|
||||||
|
|
||||||
|
onData(data) {
|
||||||
|
const events = {};
|
||||||
|
|
||||||
|
const addEvent = (day, event) => {
|
||||||
|
events[new Date(day).getTime()] = event;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (data.holidays) {
|
||||||
|
data.holidays.forEach(holiday => {
|
||||||
|
const holidayDetail = holiday.detail && holiday.detail.description;
|
||||||
|
const holidayType = holiday.type && holiday.type.name;
|
||||||
|
const holidayName = holidayDetail || holidayType;
|
||||||
|
|
||||||
|
addEvent(holiday.dated, {
|
||||||
|
name: holidayName,
|
||||||
|
color: '#ff0'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (data.absences) {
|
||||||
|
data.absences.forEach(absence => {
|
||||||
|
const type = absence.absenceType;
|
||||||
|
addEvent(absence.dated, {
|
||||||
|
name: type.name,
|
||||||
|
color: type.rgb
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.weekDays.forEach(day => {
|
||||||
|
const timestamp = day.dated.getTime();
|
||||||
|
if (events[timestamp])
|
||||||
|
day.event = events[timestamp];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
getFinishTime() {
|
getFinishTime() {
|
||||||
if (!this.weekDays) return;
|
if (!this.weekDays) return;
|
||||||
|
|
||||||
|
@ -299,14 +310,6 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set weekTotalHours(totalHours) {
|
|
||||||
this._weekTotalHours = this.formatHours(totalHours);
|
|
||||||
}
|
|
||||||
|
|
||||||
get weekTotalHours() {
|
|
||||||
return this._weekTotalHours;
|
|
||||||
}
|
|
||||||
|
|
||||||
formatHours(timestamp = 0) {
|
formatHours(timestamp = 0) {
|
||||||
let hour = Math.floor(timestamp / 3600);
|
let hour = Math.floor(timestamp / 3600);
|
||||||
let min = Math.floor(timestamp / 60 - 60 * hour);
|
let min = Math.floor(timestamp / 60 - 60 * hour);
|
||||||
|
|
|
@ -22,7 +22,7 @@ describe('Component vnWorkerTimeControl', () => {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('date() setter', () => {
|
describe('date() setter', () => {
|
||||||
it(`should set the weekDays, the date in the controller and call fetchHours`, () => {
|
it(`should set the weekDays and the date in the controller`, () => {
|
||||||
let today = Date.vnNew();
|
let today = Date.vnNew();
|
||||||
jest.spyOn(controller, 'fetchHours').mockReturnThis();
|
jest.spyOn(controller, 'fetchHours').mockReturnThis();
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ describe('Component vnWorkerTimeControl', () => {
|
||||||
expect(controller.started).toBeDefined();
|
expect(controller.started).toBeDefined();
|
||||||
expect(controller.ended).toBeDefined();
|
expect(controller.ended).toBeDefined();
|
||||||
expect(controller.weekDays.length).toEqual(7);
|
expect(controller.weekDays.length).toEqual(7);
|
||||||
expect(controller.fetchHours).toHaveBeenCalledWith();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "salix-back",
|
"name": "salix-back",
|
||||||
"version": "23.32.02",
|
"version": "23.42.01",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "salix-back",
|
"name": "salix-back",
|
||||||
"version": "23.26.01",
|
"version": "23.42.01",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.2.2",
|
"axios": "^1.2.2",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-back",
|
"name": "salix-back",
|
||||||
"version": "23.40.01",
|
"version": "23.42.01",
|
||||||
"author": "Verdnatura Levante SL",
|
"author": "Verdnatura Levante SL",
|
||||||
"description": "Salix backend",
|
"description": "Salix backend",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
Loading…
Reference in New Issue