merge(dev): branch 'dev' into 6266-minimumImprtSmsFix refs #6266
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
1920a1b893
|
@ -14,9 +14,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
## [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
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,146 @@
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('getTickets', {
|
||||||
|
description: 'Make a new collection of tickets',
|
||||||
|
accessType: 'WRITE',
|
||||||
|
accepts: [{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The collection id',
|
||||||
|
required: true,
|
||||||
|
http: {source: 'path'}
|
||||||
|
}, {
|
||||||
|
arg: 'print',
|
||||||
|
type: 'boolean',
|
||||||
|
description: 'True if you want to print'
|
||||||
|
}],
|
||||||
|
returns: {
|
||||||
|
type: ['object'],
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/:id/getTickets`,
|
||||||
|
verb: 'POST'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.getTickets = async(ctx, id, print, options) => {
|
||||||
|
const userId = ctx.req.accessToken.userId;
|
||||||
|
const origin = ctx.req.headers.origin;
|
||||||
|
const $t = ctx.req.__;
|
||||||
|
const myOptions = {};
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
myOptions.userId = userId;
|
||||||
|
|
||||||
|
const promises = [];
|
||||||
|
|
||||||
|
const [tickets] = await Self.rawSql(`CALL vn.collection_getTickets(?)`, [id], myOptions);
|
||||||
|
const sales = await Self.rawSql(`
|
||||||
|
SELECT s.ticketFk,
|
||||||
|
sgd.saleGroupFk,
|
||||||
|
s.id saleFk,
|
||||||
|
s.itemFk,
|
||||||
|
i.longName,
|
||||||
|
i.size,
|
||||||
|
ic.color,
|
||||||
|
o.code origin,
|
||||||
|
ish.packing,
|
||||||
|
ish.grouping,
|
||||||
|
s.isAdded,
|
||||||
|
s.originalQuantity,
|
||||||
|
s.quantity saleQuantity,
|
||||||
|
iss.quantity reservedQuantity,
|
||||||
|
SUM(iss.quantity) OVER (PARTITION BY s.id ORDER BY ish.id) accumulatedQuantity,
|
||||||
|
ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY pickingOrder) currentItemShelving,
|
||||||
|
COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) totalItemShelving,
|
||||||
|
sh.code,
|
||||||
|
IFNULL(p2.code, p.code) parkingCode,
|
||||||
|
IFNULL(p2.pickingOrder, p.pickingOrder) pickingOrder,
|
||||||
|
iss.id itemShelvingSaleFk,
|
||||||
|
iss.isPicked
|
||||||
|
FROM ticketCollection tc
|
||||||
|
LEFT JOIN collection c ON c.id = tc.collectionFk
|
||||||
|
JOIN ticket t ON t.id = tc.ticketFk
|
||||||
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
|
LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id
|
||||||
|
LEFT JOIN saleGroup sg ON sg.id = sgd.saleGroupFk
|
||||||
|
LEFT JOIN parking p2 ON p2.id = sg.parkingFk
|
||||||
|
JOIN item i ON i.id = s.itemFk
|
||||||
|
LEFT JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
||||||
|
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
|
||||||
|
LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk
|
||||||
|
LEFT JOIN origin o ON o.id = i.originFk
|
||||||
|
WHERE tc.collectionFk = ?
|
||||||
|
GROUP BY ish.id, p.code, p2.code
|
||||||
|
ORDER BY pickingOrder;`, [id], myOptions);
|
||||||
|
|
||||||
|
if (print)
|
||||||
|
await Self.rawSql(`CALL vn.collection_printSticker(?, ?)`, [id, null], myOptions);
|
||||||
|
|
||||||
|
const collection = {collectionFk: id, tickets: []};
|
||||||
|
if (tickets && tickets.length) {
|
||||||
|
for (const ticket of tickets) {
|
||||||
|
const ticketId = ticket.ticketFk;
|
||||||
|
|
||||||
|
// SEND ROCKET
|
||||||
|
if (ticket.observaciones != '') {
|
||||||
|
for (observation of ticket.observaciones.split(' ')) {
|
||||||
|
if (['#', '@'].includes(observation.charAt(0))) {
|
||||||
|
promises.push(Self.app.models.Chat.send(ctx, observation,
|
||||||
|
$t('The ticket is in preparation', {
|
||||||
|
ticketId: ticketId,
|
||||||
|
ticketUrl: `${origin}/#!/ticket/${ticketId}/summary`,
|
||||||
|
salesPersonId: ticket.salesPersonFk
|
||||||
|
})));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SET COLLECTION
|
||||||
|
if (sales && sales.length) {
|
||||||
|
// GET BARCODES
|
||||||
|
const barcodes = await Self.rawSql(`
|
||||||
|
SELECT s.id saleFk, b.code, c.id
|
||||||
|
FROM vn.sale s
|
||||||
|
LEFT JOIN vn.itemBarcode b ON b.itemFk = s.itemFk
|
||||||
|
LEFT JOIN vn.buy c ON c.itemFk = s.itemFk
|
||||||
|
LEFT JOIN vn.entry e ON e.id = c.entryFk
|
||||||
|
LEFT JOIN vn.travel tr ON tr.id = e.travelFk
|
||||||
|
WHERE s.ticketFk = ?
|
||||||
|
AND tr.landed >= util.VN_CURDATE() - INTERVAL 1 YEAR`,
|
||||||
|
[ticketId], myOptions);
|
||||||
|
|
||||||
|
// BINDINGS
|
||||||
|
ticket.sales = [];
|
||||||
|
for (const sale of sales) {
|
||||||
|
if (sale.ticketFk === ticketId) {
|
||||||
|
sale.Barcodes = [];
|
||||||
|
|
||||||
|
if (barcodes && barcodes.length) {
|
||||||
|
for (const barcode of barcodes) {
|
||||||
|
if (barcode.saleFk === sale.saleFk) {
|
||||||
|
for (const prop in barcode) {
|
||||||
|
if (['id', 'code'].includes(prop) && barcode[prop])
|
||||||
|
sale.Barcodes.push(barcode[prop].toString(), '0' + barcode[prop]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ticket.sales.push(sale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
collection.tickets.push(ticket);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await Promise.all(promises);
|
||||||
|
|
||||||
|
return collection;
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,39 @@
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
|
describe('collection getTickets()', () => {
|
||||||
|
let ctx;
|
||||||
|
beforeAll(async() => {
|
||||||
|
ctx = {
|
||||||
|
req: {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should get tickets, sales and barcodes from collection', async() => {
|
||||||
|
const tx = await models.Collection.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
const collectionId = 1;
|
||||||
|
|
||||||
|
const collectionTickets = await models.Collection.getTickets(ctx, collectionId, null, options);
|
||||||
|
|
||||||
|
expect(collectionTickets.collectionFk).toEqual(collectionId);
|
||||||
|
expect(collectionTickets.tickets.length).toEqual(3);
|
||||||
|
expect(collectionTickets.tickets[0].ticketFk).toEqual(1);
|
||||||
|
expect(collectionTickets.tickets[1].ticketFk).toEqual(2);
|
||||||
|
expect(collectionTickets.tickets[2].ticketFk).toEqual(23);
|
||||||
|
expect(collectionTickets.tickets[0].sales[0].ticketFk).toEqual(1);
|
||||||
|
expect(collectionTickets.tickets[0].sales[1].ticketFk).toEqual(1);
|
||||||
|
expect(collectionTickets.tickets[0].sales[2].ticketFk).toEqual(1);
|
||||||
|
expect(collectionTickets.tickets[0].sales[0].Barcodes.length).toBeTruthy();
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
|
@ -4,4 +4,5 @@ module.exports = Self => {
|
||||||
require('../methods/collection/getSectors')(Self);
|
require('../methods/collection/getSectors')(Self);
|
||||||
require('../methods/collection/setSaleQuantity')(Self);
|
require('../methods/collection/setSaleQuantity')(Self);
|
||||||
require('../methods/collection/previousLabel')(Self);
|
require('../methods/collection/previousLabel')(Self);
|
||||||
|
require('../methods/collection/getTickets')(Self);
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
INSERT INTO `salix`.`ACL`(model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES
|
||||||
|
('Collection', 'getTickets', 'WRITE', 'ALLOW', 'ROLE', 'employee');
|
|
@ -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 ;
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
INSERT INTO `salix`.`ACL` ( model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES('TicketCollection', '*', 'WRITE', 'ALLOW', 'ROLE', 'production');
|
|
@ -0,0 +1,6 @@
|
||||||
|
UPDATE `vn`.`supplier`
|
||||||
|
SET account = LPAD(id,10,'0')
|
||||||
|
WHERE account IS NULL;
|
||||||
|
|
||||||
|
ALTER TABLE `vn`.`supplier` ADD CONSTRAINT supplierAccountTooShort CHECK (LENGTH(account) = 10);
|
||||||
|
ALTER TABLE `vn`.`supplier` MODIFY COLUMN account varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT 4100000000 NOT NULL COMMENT 'Default accounting code for suppliers.';
|
|
@ -1409,10 +1409,8 @@ INSERT INTO `cache`.`cache_calc`(`id`, `cache_id`, `cacheName`, `params`, `last_
|
||||||
|
|
||||||
INSERT INTO `vn`.`ticketWeekly`(`ticketFk`, `weekDay`)
|
INSERT INTO `vn`.`ticketWeekly`(`ticketFk`, `weekDay`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 0),
|
|
||||||
(2, 1),
|
(2, 1),
|
||||||
(3, 2),
|
(3, 2),
|
||||||
(4, 4),
|
|
||||||
(5, 6),
|
(5, 6),
|
||||||
(15, 6);
|
(15, 6);
|
||||||
|
|
||||||
|
@ -2834,24 +2832,24 @@ UPDATE `account`.`user`
|
||||||
|
|
||||||
INSERT INTO `vn`.`ticketLog` (`originFk`, userFk, `action`, changedModel, oldInstance, newInstance, changedModelId, `description`)
|
INSERT INTO `vn`.`ticketLog` (`originFk`, userFk, `action`, changedModel, oldInstance, newInstance, changedModelId, `description`)
|
||||||
VALUES
|
VALUES
|
||||||
(7, 18, 'update', 'Sale', '{"quantity":1}', '{"quantity":10}', 1, NULL),
|
(7, 18, 'update', 'Sale', '{"quantity":1}', '{"quantity":10}', 22, NULL),
|
||||||
(7, 18, 'update', 'Ticket', '{"quantity":1,"concept":"Chest ammo box"}', '{"quantity":10,"concept":"Chest ammo box"}', 1, NULL),
|
(7, 18, 'update', 'Ticket', '{"quantity":1,"concept":"Chest ammo box"}', '{"quantity":10,"concept":"Chest ammo box"}', 22, NULL),
|
||||||
(7, 18, 'update', 'Sale', '{"price":3}', '{"price":5}', 1, NULL),
|
(7, 18, 'update', 'Sale', '{"price":3}', '{"price":5}', 22, NULL),
|
||||||
(7, 18, 'update', NULL, NULL, NULL, NULL, "Cambio cantidad Melee weapon heavy shield 100cm de '5' a '10'"),
|
(7, 18, 'update', NULL, NULL, NULL, NULL, "Cambio cantidad Melee weapon heavy shield 100cm de '5' a '10'"),
|
||||||
(16, 9, 'update', 'Sale', '{"quantity":10,"concept":"Shield", "price": 10.5, "itemFk": 1}', '{"quantity":8,"concept":"Shield", "price": 10.5, "itemFk": 1}' , 5689, 'Shield');
|
(16, 9, 'update', 'Sale', '{"quantity":10,"concept":"Shield", "price": 10.5, "itemFk": 1}', '{"quantity":8,"concept":"Shield", "price": 10.5, "itemFk": 1}' , 12, 'Shield');
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`ticketLog` (originFk, userFk, `action`, creationDate, changedModel, changedModelId, changedModelValue, oldInstance, newInstance, description)
|
INSERT INTO `vn`.`ticketLog` (originFk, userFk, `action`, creationDate, changedModel, changedModelId, changedModelValue, oldInstance, newInstance, description)
|
||||||
VALUES
|
VALUES
|
||||||
(1, NULL, 'delete', '2001-06-09 11:00:04', 'Ticket', 45, 'Spider Man' , NULL, NULL, NULL),
|
(1, NULL, 'delete', '2001-06-09 11:00:04', 'Ticket', 45, 'Spider Man' , NULL, NULL, NULL),
|
||||||
(1, 18, 'select', '2001-06-09 11:00:03', 'Ticket', 45, 'Spider Man' , NULL, NULL, NULL),
|
(1, 18, 'select', '2001-06-09 11:00:03', 'Ticket', 45, 'Spider Man' , NULL, NULL, NULL),
|
||||||
(1, NULL, 'update', '2001-05-09 10:00:02', 'Sale', 69854, 'Armor' , '{"isPicked": false}','{"isPicked": true}', NULL),
|
(1, NULL, 'update', '2001-05-09 10:00:02', 'Sale', 5, 'Armor' , '{"isPicked": false}','{"isPicked": true}', NULL),
|
||||||
(1, 18, 'update', '2001-01-01 10:05:01', 'Sale', 69854, 'Armor' , NULL, NULL, 'Armor quantity changed from ''15'' to ''10'''),
|
(1, 18, 'update', '2001-01-01 10:05:01', 'Sale', 5, 'Armor' , NULL, NULL, 'Armor quantity changed from ''15'' to ''10'''),
|
||||||
(1, NULL, 'delete', '2001-01-01 10:00:10', 'Sale', 5689, 'Shield' , '{"quantity":10,"concept":"Shield"}', NULL, NULL),
|
(1, NULL, 'delete', '2001-01-01 10:00:10', 'Sale', 4, 'Shield' , '{"quantity":10,"concept":"Shield"}', NULL, NULL),
|
||||||
(1, 18, 'insert', '2000-12-31 15:00:05', 'Sale', 69854, 'Armor' , NULL,'{"quantity":15,"concept":"Armor", "price": 345.99, "itemFk": 2}', NULL),
|
(1, 18, 'insert', '2000-12-31 15:00:05', 'Sale', 1, 'Armor' , NULL,'{"quantity":15,"concept":"Armor", "price": 345.99, "itemFk": 2}', NULL),
|
||||||
(1, 18, 'update', '2000-12-28 08:40:45', 'Ticket', 45, 'Spider Man' , '{"warehouseFk":60,"shipped":"2023-05-16T22:00:00.000Z","nickname":"Super Man","isSigned":true,"isLabeled":true,"isPrinted":true,"packages":0,"hour":0,"isBlocked":false,"hasPriority":false,"companyFk":442,"landed":"2023-05-17T22:00:00.000Z","isBoxed":true,"isDeleted":true,"zoneFk":713,"zonePrice":13,"zoneBonus":0}','{"warehouseFk":61,"shipped":"2023-05-17T22:00:00.000Z","nickname":"Spider Man","isSigned":false,"isLabeled":false,"isPrinted":false,"packages":1,"hour":0,"isBlocked":true,"hasPriority":true,"companyFk":443,"landed":"2023-05-18T22:00:00.000Z","isBoxed":false,"isDeleted":false,"zoneFk":713,"zonePrice":13,"zoneBonus":1}', NULL),
|
(1, 18, 'update', '2000-12-28 08:40:45', 'Ticket', 45, 'Spider Man' , '{"warehouseFk":60,"shipped":"2023-05-16T22:00:00.000Z","nickname":"Super Man","isSigned":true,"isLabeled":true,"isPrinted":true,"packages":0,"hour":0,"isBlocked":false,"hasPriority":false,"companyFk":442,"landed":"2023-05-17T22:00:00.000Z","isBoxed":true,"isDeleted":true,"zoneFk":713,"zonePrice":13,"zoneBonus":0}','{"warehouseFk":61,"shipped":"2023-05-17T22:00:00.000Z","nickname":"Spider Man","isSigned":false,"isLabeled":false,"isPrinted":false,"packages":1,"hour":0,"isBlocked":true,"hasPriority":true,"companyFk":443,"landed":"2023-05-18T22:00:00.000Z","isBoxed":false,"isDeleted":false,"zoneFk":713,"zonePrice":13,"zoneBonus":1}', NULL),
|
||||||
(1, 18, 'select', '2000-12-27 03:40:30', 'Ticket', 45, NULL , NULL, NULL, NULL),
|
(1, 18, 'select', '2000-12-27 03:40:30', 'Ticket', 45, NULL , NULL, NULL, NULL),
|
||||||
(1, 18, 'insert', '2000-04-10 09:40:15', 'Sale', 5689, 'Shield' , NULL, '{"quantity":10,"concept":"Shield", "price": 10.5, "itemFk": 1}', NULL),
|
(1, 18, 'insert', '2000-04-10 09:40:15', 'Sale', 4, 'Shield' , NULL, '{"quantity":10,"concept":"Shield", "price": 10.5, "itemFk": 1}', NULL),
|
||||||
(1, 18, 'insert', '1999-05-09 10:00:00', 'Ticket', 45, 'Super Man' , NULL, '{"id":45,"clientFk":8608,"warehouseFk":60,"shipped":"2023-05-16T22:00:00.000Z","nickname":"Super Man","addressFk":48637,"isSigned":true,"isLabeled":true,"isPrinted":true,"packages":0,"hour":0,"created":"2023-05-16T11:42:56.000Z","isBlocked":false,"hasPriority":false,"companyFk":442,"agencyModeFk":639,"landed":"2023-05-17T22:00:00.000Z","isBoxed":true,"isDeleted":true,"zoneFk":713,"zonePrice":13,"zoneBonus":0}', NULL);
|
(1, 18, 'insert', '1999-05-09 10:00:00', 'Ticket', 45, 'Super Man' , NULL, '{"id":45,"clientFk":8608,"warehouseFk":60,"shipped":"2023-05-16T22:00:00.000Z","nickname":"Super Man","addressFk":48637,"isSigned":true,"isLabeled":true,"isPrinted":true,"packages":0,"hour":0,"created":"2023-05-16T11:42:56.000Z","isBlocked":false,"hasPriority":false,"companyFk":442,"agencyModeFk":639,"landed":"2023-05-17T22:00:00.000Z","isBoxed":true,"isDeleted":true,"zoneFk":713,"zonePrice":13,"zoneBonus":0}', NULL);
|
||||||
INSERT INTO `vn`.`osTicketConfig` (`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`, `responseType`, `fromEmailId`, `replyTo`)
|
INSERT INTO `vn`.`osTicketConfig` (`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`, `responseType`, `fromEmailId`, `replyTo`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
|
@ -520,8 +520,7 @@ export default {
|
||||||
searchResultDate: 'vn-ticket-summary [label=Landed] span',
|
searchResultDate: 'vn-ticket-summary [label=Landed] span',
|
||||||
topbarSearch: 'vn-searchbar',
|
topbarSearch: 'vn-searchbar',
|
||||||
moreMenu: 'vn-ticket-index vn-icon-button[icon=more_vert]',
|
moreMenu: 'vn-ticket-index vn-icon-button[icon=more_vert]',
|
||||||
fourthWeeklyTicket: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(5)',
|
thirdWeeklyTicket: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(4)',
|
||||||
fiveWeeklyTicket: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(6)',
|
|
||||||
weeklyTicket: 'vn-ticket-weekly-index vn-card smart-table slot-table table tbody tr',
|
weeklyTicket: 'vn-ticket-weekly-index vn-card smart-table slot-table table tbody tr',
|
||||||
firstWeeklyTicketDeleteIcon: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(2) vn-icon-button[icon="delete"]',
|
firstWeeklyTicketDeleteIcon: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(2) vn-icon-button[icon="delete"]',
|
||||||
firstWeeklyTicketAgency: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(2) [ng-model="weekly.agencyModeFk"]',
|
firstWeeklyTicketAgency: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(2) [ng-model="weekly.agencyModeFk"]',
|
||||||
|
|
|
@ -19,7 +19,7 @@ describe('Ticket descriptor path', () => {
|
||||||
it('should count the amount of tickets in the turns section', async() => {
|
it('should count the amount of tickets in the turns section', async() => {
|
||||||
const result = await page.countElement(selectors.ticketsIndex.weeklyTicket);
|
const result = await page.countElement(selectors.ticketsIndex.weeklyTicket);
|
||||||
|
|
||||||
expect(result).toEqual(7);
|
expect(result).toEqual(5);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should go back to the ticket index then search and access a ticket summary', async() => {
|
it('should go back to the ticket index then search and access a ticket summary', async() => {
|
||||||
|
@ -45,7 +45,7 @@ describe('Ticket descriptor path', () => {
|
||||||
|
|
||||||
it('should confirm the ticket 11 was added to thursday', async() => {
|
it('should confirm the ticket 11 was added to thursday', async() => {
|
||||||
await page.accessToSection('ticket.weekly.index');
|
await page.accessToSection('ticket.weekly.index');
|
||||||
const result = await page.waitToGetProperty(selectors.ticketsIndex.fourthWeeklyTicket, 'value');
|
const result = await page.waitToGetProperty(selectors.ticketsIndex.thirdWeeklyTicket, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Thursday');
|
expect(result).toEqual('Thursday');
|
||||||
});
|
});
|
||||||
|
@ -80,7 +80,9 @@ describe('Ticket descriptor path', () => {
|
||||||
|
|
||||||
it('should confirm the ticket 11 was added on saturday', async() => {
|
it('should confirm the ticket 11 was added on saturday', async() => {
|
||||||
await page.accessToSection('ticket.weekly.index');
|
await page.accessToSection('ticket.weekly.index');
|
||||||
const result = await page.waitToGetProperty(selectors.ticketsIndex.fiveWeeklyTicket, 'value');
|
await page.waitForTimeout(5000);
|
||||||
|
|
||||||
|
const result = await page.waitToGetProperty(selectors.ticketsIndex.thirdWeeklyTicket, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('Saturday');
|
expect(result).toEqual('Saturday');
|
||||||
});
|
});
|
||||||
|
@ -104,7 +106,7 @@ describe('Ticket descriptor path', () => {
|
||||||
await page.doSearch();
|
await page.doSearch();
|
||||||
const nResults = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
const nResults = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
||||||
|
|
||||||
expect(nResults).toEqual(7);
|
expect(nResults).toEqual(5);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update the agency then remove it afterwards', async() => {
|
it('should update the agency then remove it afterwards', async() => {
|
||||||
|
|
|
@ -39,6 +39,7 @@ import './range';
|
||||||
import './input-time';
|
import './input-time';
|
||||||
import './input-file';
|
import './input-file';
|
||||||
import './label';
|
import './label';
|
||||||
|
import './link-phone';
|
||||||
import './list';
|
import './list';
|
||||||
import './popover';
|
import './popover';
|
||||||
import './popup';
|
import './popup';
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<span ng-if="$ctrl.phoneNumber">
|
||||||
|
{{$ctrl.phoneNumber}}
|
||||||
|
<a href="tel:{{$ctrl.phoneNumber}}">
|
||||||
|
<vn-icon
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
icon="phone"
|
||||||
|
title="MicroSIP"
|
||||||
|
ng-click="$event.stopPropagation();"
|
||||||
|
>
|
||||||
|
</vn-icon>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
<span ng-if="!$ctrl.phoneNumber">-</span>
|
|
@ -0,0 +1,15 @@
|
||||||
|
import ngModule from '../../module';
|
||||||
|
import './style.scss';
|
||||||
|
class Controller {
|
||||||
|
constructor() {
|
||||||
|
this.phoneNumber = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ngModule.vnComponent('vnLinkPhone', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: Controller,
|
||||||
|
bindings: {
|
||||||
|
phoneNumber: '<',
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,7 @@
|
||||||
|
vn-link-phone {
|
||||||
|
vn-icon {
|
||||||
|
font-size: 1.1em;
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -18,8 +18,8 @@ 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';
|
||||||
import './instance-log';
|
|
||||||
import './sendSms';
|
import './sendSms';
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
<vn-dialog
|
|
||||||
vn-id="instanceLog">
|
|
||||||
<tpl-body>
|
|
||||||
<vn-log
|
|
||||||
class="vn-instance-log"
|
|
||||||
url="{{$ctrl.url}}"
|
|
||||||
origin-id="$ctrl.originId"
|
|
||||||
changed-model="$ctrl.changedModel"
|
|
||||||
changed-model-id="$ctrl.changedModelId">
|
|
||||||
</vn-log>
|
|
||||||
</tpl-body>
|
|
||||||
</vn-dialog>
|
|
|
@ -1,21 +0,0 @@
|
||||||
import ngModule from '../../module';
|
|
||||||
import Section from '../section';
|
|
||||||
import './style.scss';
|
|
||||||
|
|
||||||
export default class Controller extends Section {
|
|
||||||
open() {
|
|
||||||
this.$.instanceLog.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ngModule.vnComponent('vnInstanceLog', {
|
|
||||||
controller: Controller,
|
|
||||||
template: require('./index.html'),
|
|
||||||
bindings: {
|
|
||||||
model: '<',
|
|
||||||
originId: '<',
|
|
||||||
changedModelId: '<',
|
|
||||||
changedModel: '@',
|
|
||||||
url: '@'
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,9 +0,0 @@
|
||||||
vn-log.vn-instance-log {
|
|
||||||
vn-card {
|
|
||||||
width: 900px;
|
|
||||||
visibility: hidden;
|
|
||||||
& > * {
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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>
|
||||||
|
|
|
@ -72,6 +72,7 @@ export default class Controller extends Section {
|
||||||
|
|
||||||
$postLink() {
|
$postLink() {
|
||||||
this.resetFilter();
|
this.resetFilter();
|
||||||
|
this.defaultFilter();
|
||||||
this.$.$watch(
|
this.$.$watch(
|
||||||
() => this.$.filter,
|
() => this.$.filter,
|
||||||
() => this.applyFilter(),
|
() => this.applyFilter(),
|
||||||
|
@ -79,6 +80,14 @@ export default class Controller extends Section {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defaultFilter() {
|
||||||
|
const defaultFilters = ['changedModel', 'changedModelId'];
|
||||||
|
for (const defaultFilter of defaultFilters) {
|
||||||
|
if (this[defaultFilter])
|
||||||
|
this.$.filter[defaultFilter] = this[defaultFilter];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get logs() {
|
get logs() {
|
||||||
return this._logs;
|
return this._logs;
|
||||||
}
|
}
|
||||||
|
@ -362,9 +371,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,7 @@
|
||||||
"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 complete",
|
||||||
|
"The ticket is in preparation": "The ticket [{{ticketId}}]({{{ticketUrl}}}) of the sales person {{salesPersonId}} is in preparation"
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,6 +216,7 @@
|
||||||
"The worker has hours recorded that day": "El trabajador tiene horas fichadas ese día",
|
"The worker has hours recorded that day": "El trabajador tiene horas fichadas ese día",
|
||||||
"The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día",
|
"The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día",
|
||||||
"You can not modify is pay method checked": "No se puede modificar el campo método de pago validado",
|
"You can not modify is pay method checked": "No se puede modificar el campo método de pago validado",
|
||||||
|
"The account size must be exactly 10 characters": "El tamaño de la cuenta debe ser exactamente de 10 caracteres",
|
||||||
"Can't transfer claimed sales": "No puedes transferir lineas reclamadas",
|
"Can't transfer claimed sales": "No puedes transferir lineas reclamadas",
|
||||||
"You don't have privileges to create refund": "No tienes permisos para crear un abono",
|
"You don't have privileges to create refund": "No tienes permisos para crear un abono",
|
||||||
"The item is required": "El artículo es requerido",
|
"The item is required": "El artículo es requerido",
|
||||||
|
@ -317,5 +318,7 @@
|
||||||
"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",
|
||||||
|
"The ticket is in preparation": "El ticket [{{ticketId}}]({{{ticketUrl}}}) del comercial {{salesPersonId}} está en preparación"
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,5 +1,5 @@
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('clientCreditEmail', {
|
Self.remoteMethodCtx('creditRequestEmail', {
|
||||||
description: 'Sends the credit request email with an attached PDF',
|
description: 'Sends the credit request email with an attached PDF',
|
||||||
accessType: 'WRITE',
|
accessType: 'WRITE',
|
||||||
accepts: [
|
accepts: [
|
||||||
|
@ -40,5 +40,5 @@ module.exports = Self => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.clientCreditEmail = ctx => Self.sendTemplate(ctx, 'credit-request');
|
Self.creditRequestEmail = ctx => Self.sendTemplate(ctx, 'credit-request');
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,6 +33,12 @@ module.exports = Self => {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
description: 'The company id',
|
description: 'The company id',
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'addressId',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The address id',
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: {
|
returns: {
|
||||||
|
|
|
@ -21,6 +21,12 @@ module.exports = Self => {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
description: 'The company id',
|
description: 'The company id',
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'addressId',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The address id',
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: [
|
returns: [
|
||||||
|
|
|
@ -21,6 +21,12 @@ module.exports = Self => {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
description: 'The company id',
|
description: 'The company id',
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'addressId',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The address id',
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: [
|
returns: [
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
'description',
|
'description',
|
||||||
'model',
|
'model',
|
||||||
'hasCompany',
|
'hasCompany',
|
||||||
|
'hasAddress',
|
||||||
'hasPreview',
|
'hasPreview',
|
||||||
'datepickerEnabled'
|
'datepickerEnabled'
|
||||||
]"
|
]"
|
||||||
|
@ -69,6 +70,32 @@
|
||||||
ng-if="sampleType.selection.hasCompany"
|
ng-if="sampleType.selection.hasCompany"
|
||||||
required="true">
|
required="true">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
|
<vn-autocomplete
|
||||||
|
ng-if="sampleType.selection.id == 20"
|
||||||
|
vn-one
|
||||||
|
required="true"
|
||||||
|
data="$ctrl.addresses"
|
||||||
|
label="Address"
|
||||||
|
show-field="nickname"
|
||||||
|
value-field="id"
|
||||||
|
ng-model="$ctrl.addressId"
|
||||||
|
model="ClientSample.addressFk"
|
||||||
|
order="isActive DESC">
|
||||||
|
<tpl-item class="address" ng-class="::{inactive: !isActive}">
|
||||||
|
<span class="inactive" translate>{{::!isActive ? '(Inactive)' : ''}}</span>
|
||||||
|
{{::nickname}}
|
||||||
|
<span ng-show="city || province || street">
|
||||||
|
, {{::street}}, {{::city}}, {{::province.name}} - {{::agencyMode.name}}
|
||||||
|
</span>
|
||||||
|
</tpl-item>
|
||||||
|
<append>
|
||||||
|
<vn-icon-button
|
||||||
|
ui-sref="client.card.address.edit({id: $ctrl.clientId, addressId: $ctrl.addressId})"
|
||||||
|
icon="edit"
|
||||||
|
vn-tooltip="Edit address">
|
||||||
|
</vn-icon-button>
|
||||||
|
</append>
|
||||||
|
</vn-autocomplete>
|
||||||
<vn-date-picker
|
<vn-date-picker
|
||||||
vn-one
|
vn-one
|
||||||
label="From"
|
label="From"
|
||||||
|
|
|
@ -15,8 +15,10 @@ class Controller extends Section {
|
||||||
set client(value) {
|
set client(value) {
|
||||||
this._client = value;
|
this._client = value;
|
||||||
|
|
||||||
if (value)
|
if (value) {
|
||||||
this.setClientSample(value);
|
this.setClientSample(value);
|
||||||
|
this.clientAddressesList(value.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get companyId() {
|
get companyId() {
|
||||||
|
@ -29,6 +31,16 @@ class Controller extends Section {
|
||||||
this.clientSample.companyFk = value;
|
this.clientSample.companyFk = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get addressId() {
|
||||||
|
if (!this.clientSample.addressId)
|
||||||
|
this.clientSample.addressId = this.client.defaultAddressFk;
|
||||||
|
return this.clientSample.addressId;
|
||||||
|
}
|
||||||
|
|
||||||
|
set addressId(value) {
|
||||||
|
this.clientSample.addressId = value;
|
||||||
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
this.$.watcher.check();
|
this.$.watcher.check();
|
||||||
|
|
||||||
|
@ -65,6 +77,9 @@ class Controller extends Section {
|
||||||
|
|
||||||
if (sampleType.datepickerEnabled)
|
if (sampleType.datepickerEnabled)
|
||||||
params.from = this.clientSample.from;
|
params.from = this.clientSample.from;
|
||||||
|
|
||||||
|
if (this.clientSample.addressId)
|
||||||
|
params.addressId = this.clientSample.addressId;
|
||||||
}
|
}
|
||||||
|
|
||||||
preview() {
|
preview() {
|
||||||
|
@ -126,6 +141,40 @@ class Controller extends Section {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clientAddressesList(value) {
|
||||||
|
let filter = {
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'province',
|
||||||
|
scope: {
|
||||||
|
fields: ['name']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
relation: 'agencyMode',
|
||||||
|
scope: {
|
||||||
|
fields: ['name']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
filter = encodeURIComponent(JSON.stringify(filter));
|
||||||
|
|
||||||
|
let query = `Clients/${value}/addresses?filter=${filter}`;
|
||||||
|
this.$http.get(query).then(res => {
|
||||||
|
if (res.data)
|
||||||
|
this.addresses = res.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getClientDefaultAddress(value) {
|
||||||
|
let query = `Clients/${value}`;
|
||||||
|
this.$http.get(query).then(res => {
|
||||||
|
if (res.data)
|
||||||
|
this.addressId = res.data.defaultAddressFk;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$element', '$scope', 'vnEmail'];
|
Controller.$inject = ['$element', '$scope', 'vnEmail'];
|
||||||
|
|
|
@ -45,11 +45,18 @@
|
||||||
<vn-label-value label="Contact"
|
<vn-label-value label="Contact"
|
||||||
value="{{$ctrl.summary.contact}}">
|
value="{{$ctrl.summary.contact}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Phone"
|
<vn-label-value label="Phone">
|
||||||
value="{{$ctrl.summary.phone}}">
|
|
||||||
|
<vn-link-phone
|
||||||
|
phone-number="$ctrl.summary.phone"
|
||||||
|
></vn-link-phone>
|
||||||
|
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Mobile"
|
<vn-label-value label="Mobile">
|
||||||
value="{{$ctrl.summary.mobile}}">
|
|
||||||
|
<vn-link-phone
|
||||||
|
phone-number="$ctrl.summary.mobile"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Email" no-ellipsize
|
<vn-label-value label="Email" no-ellipsize
|
||||||
value="{{$ctrl.listEmails($ctrl.summary.email)}}">
|
value="{{$ctrl.listEmails($ctrl.summary.email)}}">
|
||||||
|
|
|
@ -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);
|
||||||
|
};
|
||||||
|
};
|
|
@ -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);
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,6 +47,11 @@
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "VnUser",
|
"model": "VnUser",
|
||||||
"foreignKey": "userFk"
|
"foreignKey": "userFk"
|
||||||
|
},
|
||||||
|
"shelving": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Shelving",
|
||||||
|
"foreignKey": "shelvingFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,8 +48,10 @@
|
||||||
<vn-label-value label="Landed"
|
<vn-label-value label="Landed"
|
||||||
value="{{$ctrl.summary.landed | date: 'dd/MM/yyyy HH:mm'}}">
|
value="{{$ctrl.summary.landed | date: 'dd/MM/yyyy HH:mm'}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Phone"
|
<vn-label-value label="Phone">
|
||||||
value="{{$ctrl.summary.address.phone}}">
|
<vn-link-phone
|
||||||
|
phone-number="$ctrl.summary.address.phone"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Created from"
|
<vn-label-value label="Created from"
|
||||||
value="{{$ctrl.summary.sourceApp}}">
|
value="{{$ctrl.summary.sourceApp}}">
|
||||||
|
|
|
@ -25,7 +25,10 @@
|
||||||
<vn-one>
|
<vn-one>
|
||||||
<vn-label-value
|
<vn-label-value
|
||||||
label="Phone"
|
label="Phone"
|
||||||
value="{{summary.phone}}">
|
>
|
||||||
|
<vn-link-phone
|
||||||
|
phone-number="summary.phone"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value
|
<vn-label-value
|
||||||
label="Worker"
|
label="Worker"
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
@import "variables";
|
@import "variables";
|
||||||
|
|
||||||
vn-roadmap-summary .summary {
|
vn-roadmap-summary .summary {
|
||||||
a {
|
a:not(vn-link-phone a) {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 18.328px;
|
height: 18.328px;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ describe('Supplier newSupplier()', () => {
|
||||||
const result = await models.Supplier.newSupplier(ctx, options);
|
const result = await models.Supplier.newSupplier(ctx, options);
|
||||||
|
|
||||||
expect(result.name).toEqual('newSupplier');
|
expect(result.name).toEqual('newSupplier');
|
||||||
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -123,5 +123,21 @@ describe('loopback model Supplier', () => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should update the account attribute when a new supplier is created', async() => {
|
||||||
|
const tx = await models.Supplier.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const newSupplier = await models.Supplier.create({name: 'Alfred Pennyworth'}, options);
|
||||||
|
const fetchedSupplier = await models.Supplier.findById(newSupplier.id, null, options);
|
||||||
|
|
||||||
|
expect(Number(fetchedSupplier.account)).toEqual(4100000000 + newSupplier.id);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -117,6 +117,16 @@ module.exports = Self => {
|
||||||
throw new UserError('You can not modify is pay method checked');
|
throw new UserError('You can not modify is pay method checked');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Self.observe('after save', async function(ctx) {
|
||||||
|
if (ctx.instance && ctx.isNewInstance) {
|
||||||
|
const {id} = ctx.instance;
|
||||||
|
const {Supplier} = Self.app.models;
|
||||||
|
|
||||||
|
const supplier = await Supplier.findById(id, null, ctx.options);
|
||||||
|
await supplier?.updateAttribute('account', Number(supplier.account) + id, ctx.options);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Self.validateAsync('name', 'countryFk', hasSupplierSameName, {
|
Self.validateAsync('name', 'countryFk', hasSupplierSameName, {
|
||||||
message: 'A supplier with the same name already exists. Change the country.'
|
message: 'A supplier with the same name already exists. Change the country.'
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
</vn-card>
|
</vn-card>
|
||||||
<vn-button-bar>
|
<vn-button-bar>
|
||||||
<vn-submit
|
<vn-submit
|
||||||
disabled="!watcher.dataChanged()"
|
|
||||||
label="Create">
|
label="Create">
|
||||||
</vn-submit>
|
</vn-submit>
|
||||||
<vn-button
|
<vn-button
|
||||||
|
|
|
@ -14,7 +14,7 @@ describe('ticket-request filter()', () => {
|
||||||
|
|
||||||
const result = await models.TicketRequest.filter(ctx, options);
|
const result = await models.TicketRequest.filter(ctx, options);
|
||||||
|
|
||||||
expect(result.length).toEqual(3);
|
expect(result.length).toEqual(5);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -93,7 +93,7 @@ describe('ticket-request filter()', () => {
|
||||||
const result = await models.TicketRequest.filter(ctx, options);
|
const result = await models.TicketRequest.filter(ctx, options);
|
||||||
const requestId = result[0].id;
|
const requestId = result[0].id;
|
||||||
|
|
||||||
expect(requestId).toEqual(3);
|
expect(requestId).toEqual(1);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -113,7 +113,7 @@ describe('ticket-request filter()', () => {
|
||||||
const result = await models.TicketRequest.filter(ctx, options);
|
const result = await models.TicketRequest.filter(ctx, options);
|
||||||
const requestId = result[0].id;
|
const requestId = result[0].id;
|
||||||
|
|
||||||
expect(requestId).toEqual(3);
|
expect(requestId).toEqual(1);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -153,7 +153,7 @@ describe('ticket-request filter()', () => {
|
||||||
const result = await models.TicketRequest.filter(ctx, {order: 'id'}, options);
|
const result = await models.TicketRequest.filter(ctx, {order: 'id'}, options);
|
||||||
const requestId = result[0].id;
|
const requestId = result[0].id;
|
||||||
|
|
||||||
expect(requestId).toEqual(3);
|
expect(requestId).toEqual(1);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -173,7 +173,7 @@ describe('ticket-request filter()', () => {
|
||||||
const result = await models.TicketRequest.filter(ctx, options);
|
const result = await models.TicketRequest.filter(ctx, options);
|
||||||
const requestId = result[0].id;
|
const requestId = result[0].id;
|
||||||
|
|
||||||
expect(requestId).toEqual(3);
|
expect(requestId).toEqual(1);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -16,8 +16,8 @@ describe('ticket-weekly filter()', () => {
|
||||||
|
|
||||||
const firstRow = result[0];
|
const firstRow = result[0];
|
||||||
|
|
||||||
expect(firstRow.ticketFk).toEqual(1);
|
expect(firstRow.ticketFk).toEqual(2);
|
||||||
expect(result.length).toEqual(6);
|
expect(result.length).toEqual(4);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -52,12 +52,12 @@ describe('ticket-weekly filter()', () => {
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const ctx = {req: {accessToken: {userId: authUserId}}, args: {search: 'bruce'}};
|
const ctx = {req: {accessToken: {userId: authUserId}}, args: {search: 'max'}};
|
||||||
|
|
||||||
const result = await models.TicketWeekly.filter(ctx, null, options);
|
const result = await models.TicketWeekly.filter(ctx, null, options);
|
||||||
const firstRow = result[0];
|
const firstRow = result[0];
|
||||||
|
|
||||||
expect(firstRow.clientName).toEqual('Bruce Wayne');
|
expect(firstRow.clientName).toEqual('Max Eisenhardt');
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -72,13 +72,13 @@ describe('ticket-weekly filter()', () => {
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const ctx = {req: {accessToken: {userId: authUserId}}, args: {search: 1101}};
|
const ctx = {req: {accessToken: {userId: authUserId}}, args: {search: 1105}};
|
||||||
|
|
||||||
const result = await models.TicketWeekly.filter(ctx, null, options);
|
const result = await models.TicketWeekly.filter(ctx, null, options);
|
||||||
const firstRow = result[0];
|
const firstRow = result[0];
|
||||||
|
|
||||||
expect(firstRow.clientFk).toEqual(1101);
|
expect(firstRow.clientFk).toEqual(1105);
|
||||||
expect(firstRow.clientName).toEqual('Bruce Wayne');
|
expect(firstRow.clientName).toEqual('Max Eisenhardt');
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ module.exports = Self => {
|
||||||
if (!isEditable && !isRoleAdvanced)
|
if (!isEditable && !isRoleAdvanced)
|
||||||
throw new ForbiddenError(`This ticket is not editable.`);
|
throw new ForbiddenError(`This ticket is not editable.`);
|
||||||
|
|
||||||
if (isLocked)
|
if (isLocked && !isWeekly)
|
||||||
throw new ForbiddenError(`This ticket is locked.`);
|
throw new ForbiddenError(`This ticket is locked.`);
|
||||||
|
|
||||||
if (isWeekly && !canEditWeeklyTicket)
|
if (isWeekly && !canEditWeeklyTicket)
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe('isEditable()', () => {
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
const ctx = {req: {accessToken: {userId: 35}}};
|
const ctx = {req: {accessToken: {userId: 35}}};
|
||||||
result = await models.Ticket.isEditable(ctx, 5, options);
|
result = await models.Ticket.isEditable(ctx, 19, options);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
"id": {
|
"id": {
|
||||||
"id": true,
|
"id": true,
|
||||||
"type": "number"
|
"type": "number"
|
||||||
|
},
|
||||||
|
"usedShelves": {
|
||||||
|
"type": "number"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -3,8 +3,8 @@ Are you sure you want to send it?: ¿Seguro que quieres enviarlo?
|
||||||
Show pallet report: Ver hoja de pallet
|
Show pallet report: Ver hoja de pallet
|
||||||
Change shipped hour: Cambiar hora de envío
|
Change shipped hour: Cambiar hora de envío
|
||||||
Shipped hour: Hora de envío
|
Shipped hour: Hora de envío
|
||||||
Make a payment: "Verdnatura le comunica:\rSu pedido está pendiente de pago.\rPor favor, entre en la página web y efectue el pago con tarjeta.\rMuchas gracias."
|
Make a payment: "Verdnatura le comunica:\rSu pedido está pendiente de pago.\rPor favor, entre en la página web y efectúe el pago con tarjeta.\rMuchas gracias."
|
||||||
Minimum is needed: "Verdnatura le recuerda:\rEs necesario un importe mínimo de 50€ (Sin IVA) en su pedido {{ticketId}} del día {{shipped | date: 'dd/MM/yyyy'}} para recibirlo sin portes adicionales."
|
Minimum is needed: "Verdnatura le recuerda:\rEs necesario un importe mínimo de 50€ (Sin IVA) en su pedido {{ticketId}} del día {{created | date: 'dd/MM/yyyy'}} para recibirlo sin portes adicionales."
|
||||||
Ticket invoiced: Ticket facturado
|
Ticket invoiced: Ticket facturado
|
||||||
Make invoice: Crear factura
|
Make invoice: Crear factura
|
||||||
Regenerate invoice PDF: Regenerar PDF factura
|
Regenerate invoice PDF: Regenerar PDF factura
|
||||||
|
|
|
@ -1 +1,6 @@
|
||||||
<vn-log url="TicketLogs" origin-id="$ctrl.$params.id"></vn-log>
|
<vn-log
|
||||||
|
url="TicketLogs"
|
||||||
|
origin-id="$ctrl.$params.id"
|
||||||
|
changed-model="$ctrl.$params.changedModel"
|
||||||
|
changed-model-id="$ctrl.$params.changedModelId">
|
||||||
|
</vn-log>
|
||||||
|
|
|
@ -187,7 +187,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url" : "/log",
|
"url" : "/log?changedModel&changedModelId",
|
||||||
"state": "ticket.card.log",
|
"state": "ticket.card.log",
|
||||||
"component": "vn-ticket-log",
|
"component": "vn-ticket-log",
|
||||||
"description": "Log"
|
"description": "Log"
|
||||||
|
|
|
@ -212,16 +212,9 @@
|
||||||
vn-none
|
vn-none
|
||||||
vn-tooltip="History"
|
vn-tooltip="History"
|
||||||
icon="history"
|
icon="history"
|
||||||
ng-click="log.open()"
|
ng-click="$ctrl.goToLog(sale.id)"
|
||||||
ng-show="sale.$hasLogs">
|
ng-show="sale.$hasLogs">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
<vn-instance-log
|
|
||||||
vn-id="log"
|
|
||||||
url="TicketLogs"
|
|
||||||
origin-id="$ctrl.$params.id"
|
|
||||||
changed-model="Sale"
|
|
||||||
changed-model-id="sale.id">
|
|
||||||
</vn-instance-log>
|
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
|
|
|
@ -558,6 +558,14 @@ class Controller extends Section {
|
||||||
cancel() {
|
cancel() {
|
||||||
this.$.editDiscount.hide();
|
this.$.editDiscount.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
goToLog(saleId) {
|
||||||
|
this.$state.go('ticket.card.log', {
|
||||||
|
originId: this.$params.id,
|
||||||
|
changedModel: 'Sale',
|
||||||
|
changedModelId: saleId
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.vnComponent('vnTicketSale', {
|
ngModule.vnComponent('vnTicketSale', {
|
||||||
|
|
|
@ -83,19 +83,29 @@
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Address phone"
|
<vn-label-value label="Address phone"
|
||||||
ng-if="$ctrl.summary.address.phone != null"
|
ng-if="$ctrl.summary.address.phone != null"
|
||||||
value="{{$ctrl.summary.address.phone}}">
|
>
|
||||||
|
<vn-link-phone
|
||||||
|
phone-number="$ctrl.summary.address.phone"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Address mobile"
|
<vn-label-value label="Address mobile"
|
||||||
ng-if="$ctrl.summary.address.mobile != null"
|
ng-if="$ctrl.summary.address.mobile != null"
|
||||||
value="{{$ctrl.summary.address.mobile}}">
|
>
|
||||||
|
<vn-link-phone
|
||||||
|
phone-number="$ctrl.summary.address.mobile"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Client phone"
|
<vn-label-value label="Client phone"
|
||||||
ng-if="$ctrl.summary.client.phone != null"
|
ng-if="$ctrl.summary.client.phone != null">
|
||||||
value="{{$ctrl.summary.client.phone}}">
|
<vn-link-phone
|
||||||
|
phone-number="$ctrl.summary.client.phone"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Client mobile"
|
<vn-label-value label="Client mobile"
|
||||||
ng-if="$ctrl.summary.client.mobile != null"
|
ng-if="$ctrl.summary.client.mobile != null">
|
||||||
value="{{$ctrl.summary.client.mobile}}">
|
<vn-link-phone
|
||||||
|
phone-number="$ctrl.summary.client.mobile"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Address" no-ellipsize
|
<vn-label-value label="Address" no-ellipsize
|
||||||
value="{{$ctrl.formattedAddress}}">
|
value="{{$ctrl.formattedAddress}}">
|
||||||
|
|
|
@ -47,4 +47,9 @@ vn-ticket-summary .summary {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vn-icon.tel {
|
||||||
|
font-size: 1.1em;
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -47,6 +47,9 @@
|
||||||
},
|
},
|
||||||
"locker": {
|
"locker": {
|
||||||
"type" : "number"
|
"type" : "number"
|
||||||
|
},
|
||||||
|
"isF11Allowed": {
|
||||||
|
"type" : "boolean"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -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>
|
||||||
|
@ -37,11 +28,17 @@
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value
|
<vn-label-value
|
||||||
label="Phone"
|
label="Phone"
|
||||||
value="{{$ctrl.worker.phone}}">
|
>
|
||||||
|
<vn-link-phone
|
||||||
|
phone-number="$ctrl.worker.phone"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value
|
<vn-label-value
|
||||||
label="Extension"
|
label="Extension"
|
||||||
value="{{$ctrl.worker.sip.extension}}">
|
>
|
||||||
|
<vn-link-phone
|
||||||
|
phone-number="$ctrl.worker.sip.extension"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
</div>
|
</div>
|
||||||
<div class="icons">
|
<div class="icons">
|
||||||
|
@ -76,8 +73,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>
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
import Descriptor from 'salix/components/descriptor';
|
import Descriptor from 'salix/components/descriptor';
|
||||||
|
|
||||||
class Controller extends Descriptor {
|
class Controller extends Descriptor {
|
||||||
constructor($element, $, $rootScope) {
|
constructor($element, $, $rootScope) {
|
||||||
super($element, $);
|
super($element, $);
|
||||||
|
@ -71,17 +70,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'];
|
||||||
|
|
|
@ -42,14 +42,21 @@
|
||||||
{{::worker.boss.name}}
|
{{::worker.boss.name}}
|
||||||
</span>
|
</span>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Mobile extension"
|
<vn-label-value label="Mobile extension">
|
||||||
value="{{worker.mobileExtension}}">
|
<vn-link-phone
|
||||||
|
phone-number="worker.mobileExtension"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Business phone"
|
<vn-label-value label="Business phone">
|
||||||
value="{{worker.phone}}">
|
<vn-link-phone
|
||||||
|
phone-number="worker.phone"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Personal phone"
|
<vn-label-value label="Personal phone"
|
||||||
value="{{worker.client.phone}}">
|
>
|
||||||
|
<vn-link-phone
|
||||||
|
phone-number="worker.client.phone"
|
||||||
|
></vn-link-phone>
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Locker"
|
<vn-label-value label="Locker"
|
||||||
value="{{worker.locker}}">
|
value="{{worker.locker}}">
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
import Summary from 'salix/components/summary';
|
import Summary from 'salix/components/summary';
|
||||||
|
|
||||||
class Controller extends Summary {
|
class Controller extends Summary {
|
||||||
get worker() {
|
get worker() {
|
||||||
return this._worker;
|
return this._worker;
|
||||||
|
|
|
@ -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,10 +109,18 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set weekTotalHours(totalHours) {
|
||||||
|
this._weekTotalHours = this.formatHours(totalHours);
|
||||||
|
}
|
||||||
|
|
||||||
|
get weekTotalHours() {
|
||||||
|
return this._weekTotalHours;
|
||||||
|
}
|
||||||
|
|
||||||
getWeekData() {
|
getWeekData() {
|
||||||
const filter = {
|
const filter = {
|
||||||
where: {
|
where: {
|
||||||
|
@ -101,38 +131,19 @@ 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;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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: [
|
||||||
|
@ -148,58 +159,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;
|
||||||
|
@ -239,6 +198,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;
|
||||||
|
|
||||||
|
@ -267,14 +278,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();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,10 @@ module.exports = {
|
||||||
companyId: {
|
companyId: {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
addressId: {
|
||||||
|
type: Number,
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
const Stylesheet = require(`vn-print/core/stylesheet`);
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const vnPrintPath = path.resolve('print');
|
||||||
|
|
||||||
|
module.exports = new Stylesheet([
|
||||||
|
`${vnPrintPath}/common/css/spacing.css`,
|
||||||
|
`${vnPrintPath}/common/css/misc.css`,
|
||||||
|
`${vnPrintPath}/common/css/layout.css`,
|
||||||
|
`${vnPrintPath}/common/css/email.css`,
|
||||||
|
`${__dirname}/style.css`])
|
||||||
|
.mergeStyles();
|
|
@ -0,0 +1,8 @@
|
||||||
|
.jsonSection {
|
||||||
|
text-align: left;
|
||||||
|
background-color: #e4e4e4;
|
||||||
|
padding: 25px;
|
||||||
|
margin-left: 60px;
|
||||||
|
margin-right: 60px;
|
||||||
|
border-radius: 25px;
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
subject: Modified collection volumetry
|
||||||
|
title: Modified collection volumetry
|
||||||
|
description: Action performed
|
|
@ -0,0 +1,3 @@
|
||||||
|
subject: Volumetría de colección modificada
|
||||||
|
title: Volumetría de colección modificada
|
||||||
|
description: Acción realizada
|
|
@ -0,0 +1,15 @@
|
||||||
|
<email-body v-bind="$props">
|
||||||
|
<div class="grid-row">
|
||||||
|
<div class="grid-block vn-pa-ml">
|
||||||
|
<div class="centered">
|
||||||
|
<h1>{{ $t('title') }}</h1>
|
||||||
|
<h3>{{ $t('description') }}: <u>{{ data.action }}</u> <i> {{ `(${this.username})` }} </i></h3>
|
||||||
|
<div class="jsonSection">
|
||||||
|
<span v-for="(value, key) in data" v-if="key !== 'action' && key !== 'userFk'">
|
||||||
|
<b> {{ `${key}:` }} </b> {{ value }} <br>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</email-body>
|
|
@ -0,0 +1,25 @@
|
||||||
|
const Component = require(`vn-print/core/component`);
|
||||||
|
const emailBody = new Component('email-body');
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'modified-collection-volumetry',
|
||||||
|
components: {
|
||||||
|
'email-body': emailBody.build(),
|
||||||
|
},
|
||||||
|
async serverPrefetch() {
|
||||||
|
this.username = (this.data.userFk) ? await this.getUsername(this.data.userFk) : 'system';
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async getUsername(id) {
|
||||||
|
const account = await models.VnUser.findById(id);
|
||||||
|
return account.name;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
|
@ -3,16 +3,16 @@
|
||||||
<div class="grid-block">
|
<div class="grid-block">
|
||||||
<p
|
<p
|
||||||
v-html="$t('description', {
|
v-html="$t('description', {
|
||||||
socialName: client.socialName,
|
socialName: address.nickname,
|
||||||
name: client.name,
|
name: client.name,
|
||||||
address: client.street,
|
address: address.street,
|
||||||
country: client.country,
|
country: client.country,
|
||||||
fiscalID: client.fi
|
fiscalID: client.fi
|
||||||
})"
|
})"
|
||||||
></p>
|
></p>
|
||||||
<p
|
<p
|
||||||
v-html="$t('declaration', {
|
v-html="$t('declaration', {
|
||||||
socialName: client.socialName
|
socialName: address.nickname
|
||||||
})"
|
})"
|
||||||
></p>
|
></p>
|
||||||
<p
|
<p
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
v-html="$t('declarations[' + $index + ']', {
|
v-html="$t('declarations[' + $index + ']', {
|
||||||
companyName: company.name,
|
companyName: company.name,
|
||||||
companyCity: company.city,
|
companyCity: company.city,
|
||||||
socialName: client.socialName,
|
socialName: address.nickname,
|
||||||
destinationCountry: client.country
|
destinationCountry: client.country
|
||||||
})"
|
})"
|
||||||
></p>
|
></p>
|
||||||
|
|
|
@ -7,6 +7,7 @@ module.exports = {
|
||||||
this.client = await this.findOneFromDef('client', [this.id]);
|
this.client = await this.findOneFromDef('client', [this.id]);
|
||||||
this.checkMainEntity(this.client);
|
this.checkMainEntity(this.client);
|
||||||
this.company = await this.findOneFromDef('company', [this.companyId]);
|
this.company = await this.findOneFromDef('company', [this.companyId]);
|
||||||
|
this.address = await this.findOneFromDef('address', [this.addressId]);
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
|
@ -17,6 +18,10 @@ module.exports = {
|
||||||
companyId: {
|
companyId: {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
addressId: {
|
||||||
|
type: Number,
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
reportName: autorizacion-incoterms
|
reportName: autorizacion-incoterms
|
||||||
description: '<em>{socialName}</em> una sociedad debidamente constituida con responsabilidad <em>limitada</em>
|
description: '<em>{socialName}</em> una sociedad debidamente constituida con responsabilidad <em>limitada</em>
|
||||||
y registrada conforme al derecho de sociedades de {country} y aquí representada por
|
y registrada conforme al derecho de sociedades de {country} y aquí representada por {socialName}, con domicilio en {address},
|
||||||
<span>___________________</span>. {socialName}, con domicilio en {address},
|
|
||||||
CIF <em>{fiscalID}</em>. En adelante denominada {name}.'
|
CIF <em>{fiscalID}</em>. En adelante denominada {name}.'
|
||||||
issued: 'En {0}, a {1} de {2} de {3}'
|
issued: 'En {0}, a {1} de {2} de {3}'
|
||||||
client: 'Cliente {0}'
|
client: 'Cliente {0}'
|
||||||
declaration: '<em>{socialName}</em> declara por la presente que:'
|
declaration: '<em>{socialName}</em> declara por la presente que:'
|
||||||
declarations:
|
declarations:
|
||||||
- 'Todas las compras realizadas por {socialName} con {companyName} se
|
- 'Todas las compras realizadas por {socialName} con {companyName} se entregan según las condiciones definidas en el incoterm.'
|
||||||
entregan, Ex Works (Incoterms), en el almacén de {companyName} situado en
|
|
||||||
{companyCity}.'
|
|
||||||
- '{socialName} reconoce que es importante para {companyName} tener
|
- '{socialName} reconoce que es importante para {companyName} tener
|
||||||
comprobante de la entrega intracomunitaria de la mercancía a {destinationCountry} para
|
comprobante de la entrega intracomunitaria de la mercancía a {destinationCountry} para
|
||||||
poder facturar con 0% de IVA.'
|
poder facturar con 0% de IVA.'
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
reportName: autorizacion-incoterms
|
reportName: autorizacion-incoterms
|
||||||
description: '<em>{socialName}</em> uma sociedade devidamente constituída com responsabilidade <em>limitada e registada</em>
|
description: '<em>{socialName}</em> uma sociedade devidamente constituída com responsabilidade <em>limitada e registada</em>
|
||||||
conforme ao direito de sociedades da {country} e aqui representada por
|
conforme ao direito de sociedades da {country} e aqui representada por {socialName}, com domicílio em {address},
|
||||||
<span>___________________</span>. {socialName}, com domicílio em {address},
|
|
||||||
CIF <em>{fiscalID}</em>. Em adiante denominada {name}.'
|
CIF <em>{fiscalID}</em>. Em adiante denominada {name}.'
|
||||||
issued: 'Em {0}, em {1} de {2} de {3}'
|
issued: 'Em {0}, em {1} de {2} de {3}'
|
||||||
client: 'Cliente {0}'
|
client: 'Cliente {0}'
|
||||||
|
@ -11,14 +10,14 @@ declarations:
|
||||||
Ex Works (Incoterms), no armazém da {companyName} situado em
|
Ex Works (Incoterms), no armazém da {companyName} situado em
|
||||||
{companyCity}.'
|
{companyCity}.'
|
||||||
- '{socialName} reconhece ser importante para {companyName}
|
- '{socialName} reconhece ser importante para {companyName}
|
||||||
ter o comprovante da entrega intracomunitária da mercadoria a {destinationCountry}
|
ter o comprovante da entrega intracomunitária da mercadoria em {destinationCountry}
|
||||||
para poder faturar com 0% de IVA.'
|
para poder faturar com 0% de IVA.'
|
||||||
- 'Portanto, ao assinar este acordo, {socialName} declara que todos os bens
|
- 'Portanto, ao assinar este acordo, {socialName} declara que todos os bens
|
||||||
que se comprem na {companyName} serão entregues na {destinationCountry}.'
|
que se comprem na {companyName} serão entregues na {destinationCountry}.'
|
||||||
- 'Além disto, {socialName} deverá, na primeira solicitude da {companyName},
|
- 'Além disto, {socialName} deverá, na primeira solicitude da {companyName},
|
||||||
proporcionar uma prova de que todos os produtos comprados na {companyName}
|
proporcionar uma prova de que todos os produtos comprados em {companyName}
|
||||||
foram entregues na {destinationCountry}.'
|
foram entregues em {destinationCountry}.'
|
||||||
- 'Além do anterio, {companyName} proporcionará a {socialName}
|
- 'Além do anterior, {companyName} proporcionará a {socialName}
|
||||||
um resumo mensal onde se incluem todas as faturas (e as entregas correspondentes).
|
um resumo mensal onde se incluem todas as faturas (e as entregas correspondentes).
|
||||||
{socialName} assinará e devolverá o resumo mensal à {companyName},
|
{socialName} assinará e devolverá o resumo mensal à {companyName},
|
||||||
dentro dos 5 dias posteriores à receção do resumo.'
|
dentro dos 5 dias posteriores à receção do resumo.'
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
SELECT
|
||||||
|
a.nickname,
|
||||||
|
a.street,
|
||||||
|
a.postalCode,
|
||||||
|
a.city,
|
||||||
|
p.name province
|
||||||
|
FROM address a
|
||||||
|
LEFT JOIN province p ON p.id = a.provinceFk
|
||||||
|
WHERE a.id = ?
|
|
@ -44,3 +44,7 @@ h2 {
|
||||||
.phytosanitary-info {
|
.phytosanitary-info {
|
||||||
margin-top: 10px
|
margin-top: 10px
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.panel {
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue