fixes #5170-feat(recover-password): use user #1300
19
CHANGELOG.md
19
CHANGELOG.md
|
@ -5,21 +5,40 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [2306.01] - 2023-02-23
|
||||||
|
|
||||||
|
### Added
|
||||||
|
-
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
-
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
-
|
||||||
|
|
||||||
## [2304.01] - 2023-02-09
|
## [2304.01] - 2023-02-09
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- (Rutas) Al descargar varias facturas se comprime en un zip
|
- (Rutas) Al descargar varias facturas se comprime en un zip
|
||||||
- (Trabajadores -> Nuevo trabajador) Nueva sección
|
- (Trabajadores -> Nuevo trabajador) Nueva sección
|
||||||
|
- (Tickets -> Adelantar tickets) Añadidos campos "líneas" y "litros" al ticket origen
|
||||||
|
- (Tickets -> Adelantar tickets) Nuevo icono muestra cuando las agencias de los tickets origen/destino son distintas
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- (Entradas -> Compras) Cambiados los campos "Precio Grouping/Packing" por "PVP" y "Precio" por "Coste"
|
- (Entradas -> Compras) Cambiados los campos "Precio Grouping/Packing" por "PVP" y "Precio" por "Coste"
|
||||||
- (Artículos -> Últimas entradas) Cambiados los campos "P.P.U." y "P.P.P." por "PVP"
|
- (Artículos -> Últimas entradas) Cambiados los campos "P.P.U." y "P.P.P." por "PVP"
|
||||||
- (Rutas -> Sumario/Tickets) Actualizados campos de los tickets
|
- (Rutas -> Sumario/Tickets) Actualizados campos de los tickets
|
||||||
|
- (Proveedores -> Crear/Editar) Permite añadir Proveedores con la misma razón social pero con países distintos
|
||||||
|
- (Tickets -> Adelantar tickets) Cambiados selectores de estado por checks "Pendiente origen/destino"
|
||||||
|
- (Tickets -> Adelantar tickets) Cambiado stock de destino a origen.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- (Artículos -> Etiquetas) Permite intercambiar la relevancia entre dos etiquetas.
|
- (Artículos -> Etiquetas) Permite intercambiar la relevancia entre dos etiquetas.
|
||||||
- (Cliente -> Datos Fiscales) No se permite seleccionar 'Notificar vía e-mail' a los clientes sin e-mail
|
- (Cliente -> Datos Fiscales) No se permite seleccionar 'Notificar vía e-mail' a los clientes sin e-mail
|
||||||
|
- (Tickets -> Datos básicos) Permite guardar la hora de envío
|
||||||
- (Tickets -> Añadir pago) Eliminado "null" en las referencias
|
- (Tickets -> Añadir pago) Eliminado "null" en las referencias
|
||||||
|
- (Tickets -> Adelantar tickets) Permite ordenar por importe
|
||||||
|
- (Tickets -> Adelantar tickets) El filtrado por encajado muestra también los tickets sin tipo de encajado
|
||||||
|
|
||||||
## [2302.01] - 2023-01-26
|
## [2302.01] - 2023-01-26
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,16 @@
|
||||||
"table": "util.notificationAcl"
|
"table": "util.notificationAcl"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"properties":{
|
||||||
|
"notificationFk": {
|
||||||
|
"id": true,
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"roleFk":{
|
||||||
|
"id": true,
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
"notification": {
|
"notification": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.observe('before save', async function(ctx) {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const userId = ctx.options.accessToken.userId;
|
||||||
|
const user = await ctx.instance.userFk;
|
||||||
|
const modifiedUser = await getUserToModify(null, user, models);
|
||||||
|
|
||||||
|
if (userId != modifiedUser.id && userId != modifiedUser.bossFk)
|
||||||
|
throw new UserError('You dont have permission to modify this user');
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.remoteMethod('deleteNotification', {
|
||||||
|
description: 'Deletes a notification subscription',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'ctx',
|
||||||
|
type: 'object',
|
||||||
|
http: {source: 'context'}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'notificationId',
|
||||||
|
type: 'number',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
],
|
||||||
|
returns: {
|
||||||
|
type: 'object',
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
verb: 'POST',
|
||||||
|
path: '/deleteNotification'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.deleteNotification = async function(ctx, notificationId) {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const user = ctx.req.accessToken.userId;
|
||||||
|
const modifiedUser = await getUserToModify(notificationId, null, models);
|
||||||
|
|
||||||
|
if (user != modifiedUser.id && user != modifiedUser.bossFk)
|
||||||
|
throw new UserError('You dont have permission to modify this user');
|
||||||
|
|
||||||
|
await models.NotificationSubscription.destroyById(notificationId);
|
||||||
|
};
|
||||||
|
|
||||||
|
async function getUserToModify(notificationId, userFk, models) {
|
||||||
|
let userToModify = userFk;
|
||||||
|
if (notificationId) {
|
||||||
|
const subscription = await models.NotificationSubscription.findById(notificationId);
|
||||||
|
userToModify = subscription.userFk;
|
||||||
|
}
|
||||||
|
return await models.Worker.findOne({
|
||||||
|
fields: ['id', 'bossFk'],
|
||||||
|
where: {
|
||||||
|
id: userToModify
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
|
@ -7,15 +7,18 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"notificationFk": {
|
"id": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"id": true,
|
"id": true,
|
||||||
"description": "Identifier"
|
"description": "Primary key"
|
||||||
|
},
|
||||||
|
"notificationFk": {
|
||||||
|
"type": "number",
|
||||||
|
"description": "Foreign key to Notification"
|
||||||
},
|
},
|
||||||
"userFk": {
|
"userFk": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"id": true,
|
"description": "Foreign key to Account"
|
||||||
"description": "Identifier"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
|
describe('loopback model NotificationSubscription', () => {
|
||||||
|
it('Should fail to delete a notification if the user is not editing itself or a subordinate', async() => {
|
||||||
|
const tx = await models.NotificationSubscription.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
const user = 9;
|
||||||
|
const notificationSubscriptionId = 2;
|
||||||
|
const ctx = {req: {accessToken: {userId: user}}};
|
||||||
|
const notification = await models.NotificationSubscription.findById(notificationSubscriptionId);
|
||||||
|
|
||||||
|
let error;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await models.NotificationSubscription.deleteNotification(ctx, notification.id, options);
|
||||||
|
} catch (e) {
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toContain('You dont have permission to modify this user');
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should delete a notification if the user is editing itself', async() => {
|
||||||
|
const tx = await models.NotificationSubscription.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
const user = 9;
|
||||||
|
const notificationSubscriptionId = 4;
|
||||||
|
const ctx = {req: {accessToken: {userId: user}}};
|
||||||
|
const notification = await models.NotificationSubscription.findById(notificationSubscriptionId);
|
||||||
|
|
||||||
|
await models.NotificationSubscription.deleteNotification(ctx, notification.id, options);
|
||||||
|
|
||||||
|
const deletedNotification = await models.NotificationSubscription.findById(notificationSubscriptionId);
|
||||||
|
|
||||||
|
expect(deletedNotification).toBeNull();
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should delete a notification if the user is editing a subordinate', async() => {
|
||||||
|
const tx = await models.NotificationSubscription.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
const user = 9;
|
||||||
|
const notificationSubscriptionId = 5;
|
||||||
|
const ctx = {req: {accessToken: {userId: user}}};
|
||||||
|
const notification = await models.NotificationSubscription.findById(notificationSubscriptionId);
|
||||||
|
|
||||||
|
await models.NotificationSubscription.deleteNotification(ctx, notification.id, options);
|
||||||
|
|
||||||
|
const deletedNotification = await models.NotificationSubscription.findById(notificationSubscriptionId);
|
||||||
|
|
||||||
|
expect(deletedNotification).toBeNull();
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE `vn`.`supplier` ADD UNIQUE (name, countryFk);
|
|
@ -0,0 +1,4 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (model,property,accessType,principalId)
|
||||||
|
VALUES
|
||||||
|
('NotificationSubscription','*','*','employee'),
|
||||||
|
('NotificationAcl','*','READ','employee');
|
|
@ -0,0 +1,110 @@
|
||||||
|
DROP PROCEDURE IF EXISTS vn.ticket_canAdvance;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Devuelve los tickets y la cantidad de lineas de venta que se pueden adelantar.
|
||||||
|
*
|
||||||
|
* @param vDateFuture Fecha de los tickets que se quieren adelantar.
|
||||||
|
* @param vDateToAdvance Fecha a cuando se quiere adelantar.
|
||||||
|
* @param vWarehouseFk Almacén
|
||||||
|
*/
|
||||||
|
|
||||||
|
DECLARE vDateInventory DATE;
|
||||||
|
|
||||||
|
SELECT inventoried INTO vDateInventory FROM vn.config;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp.stock;
|
||||||
|
CREATE TEMPORARY TABLE tmp.stock
|
||||||
|
(itemFk INT PRIMARY KEY,
|
||||||
|
amount INT)
|
||||||
|
ENGINE = MEMORY;
|
||||||
|
|
||||||
|
INSERT INTO tmp.stock(itemFk, amount)
|
||||||
|
SELECT itemFk, SUM(quantity) amount FROM
|
||||||
|
(
|
||||||
|
SELECT itemFk, quantity
|
||||||
|
FROM vn.itemTicketOut
|
||||||
|
WHERE shipped >= vDateInventory
|
||||||
|
AND shipped < vDateFuture
|
||||||
|
AND warehouseFk = vWarehouseFk
|
||||||
|
UNION ALL
|
||||||
|
SELECT itemFk, quantity
|
||||||
|
FROM vn.itemEntryIn
|
||||||
|
WHERE landed >= vDateInventory
|
||||||
|
AND landed < vDateFuture
|
||||||
|
AND isVirtualStock = FALSE
|
||||||
|
AND warehouseInFk = vWarehouseFk
|
||||||
|
UNION ALL
|
||||||
|
SELECT itemFk, quantity
|
||||||
|
FROM vn.itemEntryOut
|
||||||
|
WHERE shipped >= vDateInventory
|
||||||
|
AND shipped < vDateFuture
|
||||||
|
AND warehouseOutFk = vWarehouseFk
|
||||||
|
) t
|
||||||
|
GROUP BY itemFk HAVING amount != 0;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp.filter;
|
||||||
|
CREATE TEMPORARY TABLE tmp.filter
|
||||||
|
(INDEX (id))
|
||||||
|
SELECT s.ticketFk futureId,
|
||||||
|
t2.ticketFk id,
|
||||||
|
count(DISTINCT s.id) saleCount,
|
||||||
|
t2.state,
|
||||||
|
t2.isNotValidated,
|
||||||
|
st.name futureState,
|
||||||
|
st.isNotValidated futureIsNotValidated,
|
||||||
|
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt,
|
||||||
|
t2.ipt,
|
||||||
|
t.workerFk,
|
||||||
|
CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters,
|
||||||
|
CAST(COUNT(*) AS DECIMAL(10,0)) `futureLines`,
|
||||||
|
t2.shipped,
|
||||||
|
t.shipped futureShipped,
|
||||||
|
t2.totalWithVat,
|
||||||
|
t.totalWithVat futureTotalWithVat,
|
||||||
|
t2.agency,
|
||||||
|
am.name futureAgency,
|
||||||
|
t2.lines,
|
||||||
|
t2.liters,
|
||||||
|
SUM((s.quantity <= IFNULL(st.amount,0))) hasStock
|
||||||
|
FROM vn.ticket t
|
||||||
|
JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
||||||
|
JOIN vn.state st ON st.id = ts.stateFk
|
||||||
|
JOIN vn.saleVolume sv ON t.id = sv.ticketFk
|
||||||
|
JOIN (SELECT
|
||||||
|
t2.id ticketFk,
|
||||||
|
t2.addressFk,
|
||||||
|
st.isNotValidated,
|
||||||
|
st.name state,
|
||||||
|
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt,
|
||||||
|
t2.shipped,
|
||||||
|
t2.totalWithVat,
|
||||||
|
am.name agency,
|
||||||
|
CAST(SUM(litros) AS DECIMAL(10,0)) liters,
|
||||||
|
CAST(COUNT(*) AS DECIMAL(10,0)) `lines`
|
||||||
|
FROM vn.ticket t2
|
||||||
|
JOIN vn.saleVolume sv ON t2.id = sv.ticketFk
|
||||||
|
JOIN vn.sale s ON s.ticketFk = t2.id
|
||||||
|
JOIN vn.item i ON i.id = s.itemFk
|
||||||
|
JOIN vn.ticketState ts ON ts.ticketFk = t2.id
|
||||||
|
JOIN vn.state st ON st.id = ts.stateFk
|
||||||
|
JOIN vn.agencyMode am ON t2.agencyModeFk = am.id
|
||||||
|
LEFT JOIN vn.itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
|
||||||
|
WHERE t2.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance)
|
||||||
|
AND t2.warehouseFk = vWarehouseFk
|
||||||
|
GROUP BY t2.id) t2 ON t2.addressFk = t.addressFk
|
||||||
|
JOIN vn.sale s ON s.ticketFk = t.id
|
||||||
|
JOIN vn.item i ON i.id = s.itemFk
|
||||||
|
JOIN vn.agencyMode am ON t.agencyModeFk = am.id
|
||||||
|
LEFT JOIN vn.itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
|
||||||
|
LEFT JOIN tmp.stock st ON st.itemFk = s.itemFk
|
||||||
|
WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture)
|
||||||
|
AND t.warehouseFk = vWarehouseFk
|
||||||
|
GROUP BY t.id;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE tmp.stock;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,4 @@
|
||||||
|
ALTER TABLE
|
||||||
|
`util`.`notificationSubscription`
|
||||||
|
ADD
|
||||||
|
CONSTRAINT `notificationSubscription_UN` UNIQUE KEY (`notificationFk`, `userFk`);
|
|
@ -0,0 +1,7 @@
|
||||||
|
ALTER TABLE `util`.`notificationSubscription`
|
||||||
|
ADD `id` int(11) auto_increment NULL,
|
||||||
|
DROP PRIMARY KEY,
|
||||||
|
ADD CONSTRAINT PRIMARY KEY (`id`);
|
||||||
|
|
||||||
|
ALTER TABLE `util`.`notificationSubscription`
|
||||||
|
ADD KEY `notificationSubscription_ibfk_1` (`notificationFk`);
|
|
@ -1954,10 +1954,6 @@ INSERT INTO `vn`.`workerBusinessType` (`id`, `name`, `isFullTime`, `isPermanent`
|
||||||
(100, 'INDEFINIDO A TIEMPO COMPLETO', 1, 1, 1),
|
(100, 'INDEFINIDO A TIEMPO COMPLETO', 1, 1, 1),
|
||||||
(109, 'CONVERSION DE TEMPORAL EN INDEFINIDO T.COMPLETO', 1, 1, 1);
|
(109, 'CONVERSION DE TEMPORAL EN INDEFINIDO T.COMPLETO', 1, 1, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`businessCategory` (`id`, `description`, `rate`)
|
|
||||||
VALUES
|
|
||||||
(1, 'basic employee', 1);
|
|
||||||
|
|
||||||
UPDATE `vn`.`business` b
|
UPDATE `vn`.`business` b
|
||||||
SET `rate` = 7,
|
SET `rate` = 7,
|
||||||
`workerBusinessCategoryFk` = 1,
|
`workerBusinessCategoryFk` = 1,
|
||||||
|
@ -2705,7 +2701,10 @@ INSERT INTO `util`.`notificationSubscription` (`notificationFk`, `userFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1109),
|
(1, 1109),
|
||||||
(1, 1110),
|
(1, 1110),
|
||||||
(3, 1109);
|
(3, 1109),
|
||||||
|
(1,9),
|
||||||
|
(1,3);
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
|
INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
|
||||||
VALUES
|
VALUES
|
||||||
|
|
|
@ -80203,4 +80203,3 @@ USE `vncontrol`;
|
||||||
-- Dump completed on 2022-11-21 7:57:28
|
-- Dump completed on 2022-11-21 7:57:28
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -562,15 +562,15 @@ export default {
|
||||||
payoutBank: '.vn-dialog vn-autocomplete[ng-model="$ctrl.bankFk"]',
|
payoutBank: '.vn-dialog vn-autocomplete[ng-model="$ctrl.bankFk"]',
|
||||||
payoutDescription: 'vn-textfield[ng-model="$ctrl.receipt.description"]',
|
payoutDescription: 'vn-textfield[ng-model="$ctrl.receipt.description"]',
|
||||||
submitPayout: '.vn-dialog button[response="accept"]',
|
submitPayout: '.vn-dialog button[response="accept"]',
|
||||||
searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr',
|
searchWeeklyResult: 'vn-ticket-weekly-index vn-card smart-table slot-table table tbody tr',
|
||||||
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-table vn-tbody vn-tr:nth-child(4)',
|
fourthWeeklyTicket: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(4)',
|
||||||
fiveWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tbody vn-tr:nth-child(5)',
|
fiveWeeklyTicket: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(5)',
|
||||||
weeklyTicket: 'vn-ticket-weekly-index vn-table > div > vn-tbody > vn-tr',
|
weeklyTicket: 'vn-ticket-weekly-index vn-card smart-table slot-table table tbody tr',
|
||||||
firstWeeklyTicketDeleteIcon: 'vn-ticket-weekly-index vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
|
firstWeeklyTicketDeleteIcon: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(1) vn-icon-button[icon="delete"]',
|
||||||
firstWeeklyTicketAgency: 'vn-ticket-weekly-index vn-tr:nth-child(1) [ng-model="weekly.agencyModeFk"]',
|
firstWeeklyTicketAgency: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(1) [ng-model="weekly.agencyModeFk"]',
|
||||||
acceptDeleteTurn: '.vn-confirm.shown button[response="accept"]'
|
acceptDeleteTurn: '.vn-confirm.shown button[response="accept"]'
|
||||||
},
|
},
|
||||||
createTicketView: {
|
createTicketView: {
|
||||||
|
@ -778,8 +778,8 @@ export default {
|
||||||
ipt: 'vn-autocomplete[label="Destination IPT"]',
|
ipt: 'vn-autocomplete[label="Destination IPT"]',
|
||||||
tableIpt: 'vn-autocomplete[name="ipt"]',
|
tableIpt: 'vn-autocomplete[name="ipt"]',
|
||||||
tableFutureIpt: 'vn-autocomplete[name="futureIpt"]',
|
tableFutureIpt: 'vn-autocomplete[name="futureIpt"]',
|
||||||
futureState: 'vn-autocomplete[label="Origin Grouped State"]',
|
futureState: 'vn-check[label="Pending Origin"]',
|
||||||
state: 'vn-autocomplete[label="Destination Grouped State"]',
|
state: 'vn-check[label="Pending Destination"]',
|
||||||
warehouseFk: 'vn-autocomplete[label="Warehouse"]',
|
warehouseFk: 'vn-autocomplete[label="Warehouse"]',
|
||||||
tableButtonSearch: 'vn-button[vn-tooltip="Search"]',
|
tableButtonSearch: 'vn-button[vn-tooltip="Search"]',
|
||||||
moveButton: 'vn-button[vn-tooltip="Advance tickets"]',
|
moveButton: 'vn-button[vn-tooltip="Advance tickets"]',
|
||||||
|
|
|
@ -50,7 +50,7 @@ describe('Ticket Advance path', () => {
|
||||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||||
await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'Horizontal');
|
await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'Horizontal');
|
||||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 0);
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||||
|
|
||||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||||
await page.clearInput(selectors.ticketAdvance.ipt);
|
await page.clearInput(selectors.ticketAdvance.ipt);
|
||||||
|
@ -62,7 +62,7 @@ describe('Ticket Advance path', () => {
|
||||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||||
await page.autocompleteSearch(selectors.ticketAdvance.futureIpt, 'Horizontal');
|
await page.autocompleteSearch(selectors.ticketAdvance.futureIpt, 'Horizontal');
|
||||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 0);
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||||
|
|
||||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||||
await page.clearInput(selectors.ticketAdvance.futureIpt);
|
await page.clearInput(selectors.ticketAdvance.futureIpt);
|
||||||
|
@ -70,26 +70,36 @@ describe('Ticket Advance path', () => {
|
||||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search with the origin grouped state', async() => {
|
it('should search with the origin pending state', async() => {
|
||||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||||
await page.autocompleteSearch(selectors.ticketAdvance.futureState, 'Free');
|
await page.waitToClick(selectors.ticketAdvance.futureState);
|
||||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||||
|
|
||||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||||
await page.clearInput(selectors.ticketAdvance.futureState);
|
await page.waitToClick(selectors.ticketAdvance.futureState);
|
||||||
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||||
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 0);
|
||||||
|
|
||||||
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||||
|
await page.waitToClick(selectors.ticketAdvance.futureState);
|
||||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search with the destination grouped state', async() => {
|
it('should search with the destination grouped state', async() => {
|
||||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||||
await page.autocompleteSearch(selectors.ticketAdvance.state, 'Free');
|
await page.waitToClick(selectors.ticketAdvance.state);
|
||||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 0);
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 0);
|
||||||
|
|
||||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||||
await page.clearInput(selectors.ticketAdvance.state);
|
await page.waitToClick(selectors.ticketAdvance.state);
|
||||||
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||||
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||||
|
|
||||||
|
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||||
|
await page.waitToClick(selectors.ticketAdvance.state);
|
||||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||||
});
|
});
|
||||||
|
@ -116,42 +126,7 @@ describe('Ticket Advance path', () => {
|
||||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search in smart-table with stock', async() => {
|
it('should check the one ticket and move to the present', async() => {
|
||||||
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
|
||||||
await page.write(selectors.ticketAdvance.tableStock, '5');
|
|
||||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 2);
|
|
||||||
|
|
||||||
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
|
||||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
|
||||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
|
||||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should search in smart-table with especified Lines', async() => {
|
|
||||||
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
|
||||||
await page.write(selectors.ticketAdvance.tableLines, '0');
|
|
||||||
await page.keyboard.press('Enter');
|
|
||||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
|
||||||
|
|
||||||
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
|
||||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
|
||||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
|
||||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should search in smart-table with especified Liters', async() => {
|
|
||||||
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
|
||||||
await page.write(selectors.ticketAdvance.tableLiters, '0');
|
|
||||||
await page.keyboard.press('Enter');
|
|
||||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
|
||||||
|
|
||||||
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
|
||||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
|
||||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
|
||||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should check the three last tickets and move to the future', async() => {
|
|
||||||
await page.waitToClick(selectors.ticketAdvance.multiCheck);
|
await page.waitToClick(selectors.ticketAdvance.multiCheck);
|
||||||
await page.waitToClick(selectors.ticketAdvance.moveButton);
|
await page.waitToClick(selectors.ticketAdvance.moveButton);
|
||||||
await page.waitToClick(selectors.ticketAdvance.acceptButton);
|
await page.waitToClick(selectors.ticketAdvance.acceptButton);
|
||||||
|
|
|
@ -478,8 +478,8 @@ export default class SmartTable extends Component {
|
||||||
|
|
||||||
const params = {q: JSON.stringify(stateFilter)};
|
const params = {q: JSON.stringify(stateFilter)};
|
||||||
|
|
||||||
this.$state.go(this.$state.current.name, params, {location: 'replace'});
|
this.$state.go(this.$state.current.name, params, {location: 'replace'})
|
||||||
this.refresh();
|
.then(() => this.refresh());
|
||||||
}
|
}
|
||||||
|
|
||||||
applySort() {
|
applySort() {
|
||||||
|
@ -499,8 +499,8 @@ export default class SmartTable extends Component {
|
||||||
stateFilter.tableOrder = order;
|
stateFilter.tableOrder = order;
|
||||||
|
|
||||||
const params = {q: JSON.stringify(stateFilter)};
|
const params = {q: JSON.stringify(stateFilter)};
|
||||||
this.$state.go(this.$state.current.name, params, {location: 'replace'});
|
this.$state.go(this.$state.current.name, params, {location: 'replace'})
|
||||||
this.refresh();
|
.then(() => this.refresh());
|
||||||
}
|
}
|
||||||
|
|
||||||
filterSanitizer(field) {
|
filterSanitizer(field) {
|
||||||
|
@ -589,7 +589,7 @@ export default class SmartTable extends Component {
|
||||||
refresh() {
|
refresh() {
|
||||||
this.isRefreshing = true;
|
this.isRefreshing = true;
|
||||||
this.model.refresh()
|
this.model.refresh()
|
||||||
.then(() => this.isRefreshing = false);
|
.finally(() => this.isRefreshing = false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ describe('Component smartTable', () => {
|
||||||
describe('applySort()', () => {
|
describe('applySort()', () => {
|
||||||
it('should call the $state go and model refresh without making changes on the model order', () => {
|
it('should call the $state go and model refresh without making changes on the model order', () => {
|
||||||
controller.$state = {
|
controller.$state = {
|
||||||
go: jest.fn(),
|
go: jest.fn().mockReturnValue(new Promise(resolve => resolve())),
|
||||||
current: {
|
current: {
|
||||||
name: 'section'
|
name: 'section'
|
||||||
}
|
}
|
||||||
|
@ -171,13 +171,12 @@ describe('Component smartTable', () => {
|
||||||
|
|
||||||
expect(controller.model.order).toBeUndefined();
|
expect(controller.model.order).toBeUndefined();
|
||||||
expect(controller.$state.go).toHaveBeenCalled();
|
expect(controller.$state.go).toHaveBeenCalled();
|
||||||
expect(controller.refresh).toHaveBeenCalled();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call the $state go and model refresh after setting model order according to the controller sortCriteria', () => {
|
it('should call the $state go and model refresh after setting model order according to the controller sortCriteria', () => {
|
||||||
const orderBy = {field: 'myField', sortType: 'ASC'};
|
const orderBy = {field: 'myField', sortType: 'ASC'};
|
||||||
controller.$state = {
|
controller.$state = {
|
||||||
go: jest.fn(),
|
go: jest.fn().mockReturnValue(new Promise(resolve => resolve())),
|
||||||
current: {
|
current: {
|
||||||
name: 'section'
|
name: 'section'
|
||||||
}
|
}
|
||||||
|
@ -190,7 +189,6 @@ describe('Component smartTable', () => {
|
||||||
|
|
||||||
expect(controller.model.order).toEqual(`${orderBy.field} ${orderBy.sortType}`);
|
expect(controller.model.order).toEqual(`${orderBy.field} ${orderBy.sortType}`);
|
||||||
expect(controller.$state.go).toHaveBeenCalled();
|
expect(controller.$state.go).toHaveBeenCalled();
|
||||||
expect(controller.refresh).toHaveBeenCalled();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -293,12 +291,10 @@ describe('Component smartTable', () => {
|
||||||
controller.$inputsScope = {
|
controller.$inputsScope = {
|
||||||
searchProps: {}
|
searchProps: {}
|
||||||
};
|
};
|
||||||
jest.spyOn(controller, 'refresh');
|
|
||||||
|
|
||||||
controller.defaultFilter();
|
controller.defaultFilter();
|
||||||
|
|
||||||
expect(controller.model.addFilter).toHaveBeenCalled();
|
expect(controller.model.addFilter).toHaveBeenCalled();
|
||||||
expect(controller.refresh).toHaveBeenCalled();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -262,5 +262,7 @@
|
||||||
"It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar",
|
"It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar",
|
||||||
"It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo",
|
"It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo",
|
||||||
"It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas",
|
"It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas",
|
||||||
|
"A supplier with the same name already exists. Change the country.": "Un proveedor con el mismo nombre ya existe. Cambie el país.",
|
||||||
"There is no assigned email for this client": "No hay correo asignado para este cliente"
|
"There is no assigned email for this client": "No hay correo asignado para este cliente"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,6 @@ module.exports = Self => {
|
||||||
message: 'The social name cannot be empty'
|
message: 'The social name cannot be empty'
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.validatesUniquenessOf('name', {
|
|
||||||
message: 'The supplier name must be unique'
|
|
||||||
});
|
|
||||||
|
|
||||||
if (this.city) {
|
if (this.city) {
|
||||||
Self.validatesPresenceOf('city', {
|
Self.validatesPresenceOf('city', {
|
||||||
message: 'City cannot be empty'
|
message: 'City cannot be empty'
|
||||||
|
@ -117,6 +113,27 @@ 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.validateAsync('name', 'countryFk', hasSupplierSameName, {
|
||||||
|
message: 'A supplier with the same name already exists. Change the country.'
|
||||||
|
});
|
||||||
|
|
||||||
|
async function hasSupplierSameName(err, done) {
|
||||||
|
if (!this.name || !this.countryFk) done();
|
||||||
|
const supplier = await Self.app.models.Supplier.findOne(
|
||||||
|
{
|
||||||
|
where: {
|
||||||
|
name: this.name,
|
||||||
|
countryFk: this.countryFk
|
||||||
|
},
|
||||||
|
fields: ['id']
|
||||||
|
});
|
||||||
|
|
||||||
|
if (supplier && supplier.id != this.id)
|
||||||
|
err();
|
||||||
|
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
|
||||||
Self.observe('before save', async function(ctx) {
|
Self.observe('before save', async function(ctx) {
|
||||||
const changes = ctx.data || ctx.instance;
|
const changes = ctx.data || ctx.instance;
|
||||||
const orgData = ctx.currentInstance;
|
const orgData = ctx.currentInstance;
|
||||||
|
|
|
@ -50,14 +50,14 @@ module.exports = Self => {
|
||||||
required: false
|
required: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'state',
|
arg: 'isNotValidated',
|
||||||
type: 'string',
|
type: 'boolean',
|
||||||
description: 'Origin state',
|
description: 'Origin state',
|
||||||
required: false
|
required: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'futureState',
|
arg: 'futureIsNotValidated',
|
||||||
type: 'string',
|
type: 'boolean',
|
||||||
description: 'Destination state',
|
description: 'Destination state',
|
||||||
required: false
|
required: false
|
||||||
},
|
},
|
||||||
|
@ -92,13 +92,23 @@ module.exports = Self => {
|
||||||
case 'futureId':
|
case 'futureId':
|
||||||
return {'f.futureId': value};
|
return {'f.futureId': value};
|
||||||
case 'ipt':
|
case 'ipt':
|
||||||
return {'f.ipt': value};
|
return {or:
|
||||||
|
[
|
||||||
|
{'f.ipt': {like: `%${value}%`}},
|
||||||
|
{'f.ipt': null}
|
||||||
|
]
|
||||||
|
};
|
||||||
case 'futureIpt':
|
case 'futureIpt':
|
||||||
return {'f.futureIpt': value};
|
return {or:
|
||||||
case 'state':
|
[
|
||||||
return {'f.stateCode': {like: `%${value}%`}};
|
{'f.futureIpt': {like: `%${value}%`}},
|
||||||
case 'futureState':
|
{'f.futureIpt': null}
|
||||||
return {'f.futureStateCode': {like: `%${value}%`}};
|
]
|
||||||
|
};
|
||||||
|
case 'isNotValidated':
|
||||||
|
return {'f.isNotValidated': value};
|
||||||
|
case 'futureIsNotValidated':
|
||||||
|
return {'f.futureIsNotValidated': value};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ describe('TicketFuture getTicketsAdvance()', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the tickets matching the origin grouped state', async() => {
|
it('should return the tickets matching the origin pending state', async() => {
|
||||||
const tx = await models.Ticket.beginTransaction({});
|
const tx = await models.Ticket.beginTransaction({});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -39,7 +39,7 @@ describe('TicketFuture getTicketsAdvance()', () => {
|
||||||
dateFuture: tomorrow,
|
dateFuture: tomorrow,
|
||||||
dateToAdvance: today,
|
dateToAdvance: today,
|
||||||
warehouseFk: 1,
|
warehouseFk: 1,
|
||||||
state: 'OK'
|
futureIsNotValidated: true
|
||||||
};
|
};
|
||||||
|
|
||||||
const ctx = {req: {accessToken: {userId: 9}}, args};
|
const ctx = {req: {accessToken: {userId: 9}}, args};
|
||||||
|
@ -54,7 +54,7 @@ describe('TicketFuture getTicketsAdvance()', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the tickets matching the destination grouped state', async() => {
|
it('should return the tickets matching the destination pending state', async() => {
|
||||||
const tx = await models.Ticket.beginTransaction({});
|
const tx = await models.Ticket.beginTransaction({});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -64,13 +64,13 @@ describe('TicketFuture getTicketsAdvance()', () => {
|
||||||
dateFuture: tomorrow,
|
dateFuture: tomorrow,
|
||||||
dateToAdvance: today,
|
dateToAdvance: today,
|
||||||
warehouseFk: 1,
|
warehouseFk: 1,
|
||||||
futureState: 'FREE'
|
isNotValidated: true
|
||||||
};
|
};
|
||||||
|
|
||||||
const ctx = {req: {accessToken: {userId: 9}}, args};
|
const ctx = {req: {accessToken: {userId: 9}}, args};
|
||||||
const result = await models.Ticket.getTicketsAdvance(ctx, options);
|
const result = await models.Ticket.getTicketsAdvance(ctx, options);
|
||||||
|
|
||||||
expect(result.length).toBeGreaterThan(0);
|
expect(result.length).toEqual(0);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -89,7 +89,7 @@ describe('TicketFuture getTicketsAdvance()', () => {
|
||||||
dateFuture: tomorrow,
|
dateFuture: tomorrow,
|
||||||
dateToAdvance: today,
|
dateToAdvance: today,
|
||||||
warehouseFk: 1,
|
warehouseFk: 1,
|
||||||
ipt: 'Vertical'
|
ipt: 'V'
|
||||||
};
|
};
|
||||||
|
|
||||||
const ctx = {req: {accessToken: {userId: 9}}, args};
|
const ctx = {req: {accessToken: {userId: 9}}, args};
|
||||||
|
@ -114,7 +114,7 @@ describe('TicketFuture getTicketsAdvance()', () => {
|
||||||
dateFuture: tomorrow,
|
dateFuture: tomorrow,
|
||||||
dateToAdvance: today,
|
dateToAdvance: today,
|
||||||
warehouseFk: 1,
|
warehouseFk: 1,
|
||||||
tfIpt: 'Vertical'
|
tfIpt: 'V'
|
||||||
};
|
};
|
||||||
|
|
||||||
const ctx = {req: {accessToken: {userId: 9}}, args};
|
const ctx = {req: {accessToken: {userId: 9}}, args};
|
||||||
|
|
|
@ -39,26 +39,18 @@
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal class="vn-px-lg">
|
<vn-horizontal class="vn-px-lg">
|
||||||
<vn-autocomplete vn-one
|
<vn-check
|
||||||
data="$ctrl.groupedStates"
|
vn-one
|
||||||
label="Origin Grouped State"
|
label="Pending Origin"
|
||||||
value-field="code"
|
ng-model="filter.futureIsNotValidated"
|
||||||
show-field="name"
|
triple-state="true">
|
||||||
ng-model="filter.futureState">
|
</vn-check>
|
||||||
<tpl-item>
|
<vn-check
|
||||||
{{name}}
|
vn-one
|
||||||
</tpl-item>
|
label="Pending Destination"
|
||||||
</vn-autocomplete>
|
ng-model="filter.isNotValidated"
|
||||||
<vn-autocomplete vn-one
|
triple-state="true">
|
||||||
data="$ctrl.groupedStates"
|
</vn-check>
|
||||||
label="Destination Grouped State"
|
|
||||||
value-field="code"
|
|
||||||
show-field="name"
|
|
||||||
ng-model="filter.state">
|
|
||||||
<tpl-item>
|
|
||||||
{{name}}
|
|
||||||
</tpl-item>
|
|
||||||
</vn-autocomplete>
|
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal class="vn-px-lg">
|
<vn-horizontal class="vn-px-lg">
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
|
|
|
@ -5,24 +5,9 @@ class Controller extends SearchPanel {
|
||||||
constructor($, $element) {
|
constructor($, $element) {
|
||||||
super($, $element);
|
super($, $element);
|
||||||
this.filter = this.$.filter;
|
this.filter = this.$.filter;
|
||||||
this.getGroupedStates();
|
|
||||||
this.getItemPackingTypes();
|
this.getItemPackingTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
getGroupedStates() {
|
|
||||||
let groupedStates = [];
|
|
||||||
this.$http.get('AlertLevels').then(res => {
|
|
||||||
for (let state of res.data) {
|
|
||||||
groupedStates.push({
|
|
||||||
id: state.id,
|
|
||||||
code: state.code,
|
|
||||||
name: this.$t(state.code)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.groupedStates = groupedStates;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
getItemPackingTypes() {
|
getItemPackingTypes() {
|
||||||
let itemPackingTypes = [];
|
let itemPackingTypes = [];
|
||||||
const filter = {
|
const filter = {
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
Advance tickets: Adelantar tickets
|
Advance tickets: Adelantar tickets
|
||||||
|
Pending Origin: Pendiente origen
|
||||||
|
Pending Destination: Pendiente destino
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr second-header>
|
<tr second-header>
|
||||||
<td></td>
|
<td></td>
|
||||||
<th colspan="5" translate>Origin</th>
|
<th colspan="9" translate>Origin</th>
|
||||||
<th colspan="8" translate>Destination</th>
|
<th colspan="7" translate>Destination</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th shrink>
|
<th shrink>
|
||||||
|
@ -43,19 +43,30 @@
|
||||||
check-field="checked">
|
check-field="checked">
|
||||||
</vn-multi-check>
|
</vn-multi-check>
|
||||||
</th>
|
</th>
|
||||||
|
<th shrink>
|
||||||
|
</th>
|
||||||
<th field="futureId">
|
<th field="futureId">
|
||||||
<span translate>ID</span>
|
<span translate>ID</span>
|
||||||
</th>
|
</th>
|
||||||
<th field="futureShipped">
|
<th field="futureShipped">
|
||||||
<span translate>Date</span>
|
<span translate>Date</span>
|
||||||
</th>
|
</th>
|
||||||
<th field="futureIpt" title="Item Packing Type">
|
<th field="futureIpt" title="{{'Item Packing Type' | translate}}">
|
||||||
<span>IPT</span>
|
<span>IPT</span>
|
||||||
</th>
|
</th>
|
||||||
<th field="futureState">
|
<th field="futureState">
|
||||||
<span translate>State</span>
|
<span translate>State</span>
|
||||||
</th>
|
</th>
|
||||||
<th field="totalWithVat">
|
<th field="futureLiters">
|
||||||
|
<span translate>Liters</span>
|
||||||
|
</th>
|
||||||
|
<th field="hasStock">
|
||||||
|
<span>Stock</span>
|
||||||
|
</th>
|
||||||
|
<th field="futureLines">
|
||||||
|
<span translate>Lines</span>
|
||||||
|
</th>
|
||||||
|
<th field="futureTotalWithVat">
|
||||||
<span translate>Import</span>
|
<span translate>Import</span>
|
||||||
</th>
|
</th>
|
||||||
<th separator field="id">
|
<th separator field="id">
|
||||||
|
@ -64,7 +75,7 @@
|
||||||
<th field="shipped">
|
<th field="shipped">
|
||||||
<span translate>Date</span>
|
<span translate>Date</span>
|
||||||
</th>
|
</th>
|
||||||
<th field="ipt" title="Item Packing Type">
|
<th field="ipt" title="{{'Item Packing Type' | translate}}">
|
||||||
<span>IPT</span>
|
<span>IPT</span>
|
||||||
</th>
|
</th>
|
||||||
<th field="state">
|
<th field="state">
|
||||||
|
@ -73,13 +84,10 @@
|
||||||
<th field="liters">
|
<th field="liters">
|
||||||
<span translate>Liters</span>
|
<span translate>Liters</span>
|
||||||
</th>
|
</th>
|
||||||
<th field="hasStock">
|
|
||||||
<span>Stock</span>
|
|
||||||
</th>
|
|
||||||
<th field="lines">
|
<th field="lines">
|
||||||
<span translate>Lines</span>
|
<span translate>Lines</span>
|
||||||
</th>
|
</th>
|
||||||
<th field="futureTotalWithVat">
|
<th field="totalWithVat">
|
||||||
<span translate>Import</span>
|
<span translate>Import</span>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -92,6 +100,13 @@
|
||||||
vn-click-stop>
|
vn-click-stop>
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<vn-icon
|
||||||
|
ng-show="ticket.futureAgency !== ticket.agency"
|
||||||
|
icon="icon-agency-term"
|
||||||
|
vn-tooltip="{{$ctrl.agencies(ticket.futureAgency, ticket.agency)}}">
|
||||||
|
</vn-icon>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span
|
<span
|
||||||
ng-click="ticketDescriptor.show($event, ticket.futureId)"
|
ng-click="ticketDescriptor.show($event, ticket.futureId)"
|
||||||
|
@ -111,6 +126,9 @@
|
||||||
{{::ticket.futureState | dashIfEmpty}}
|
{{::ticket.futureState | dashIfEmpty}}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
<td>{{::ticket.futureLiters | dashIfEmpty}}</td>
|
||||||
|
<td>{{::ticket.hasStock | dashIfEmpty}}</td>
|
||||||
|
<td>{{::ticket.futureLines | dashIfEmpty}}</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="chip {{$ctrl.totalPriceColor(ticket.futureTotalWithVat)}}">
|
<span class="chip {{$ctrl.totalPriceColor(ticket.futureTotalWithVat)}}">
|
||||||
{{::(ticket.futureTotalWithVat ? ticket.futureTotalWithVat : 0) | currency: 'EUR': 2}}
|
{{::(ticket.futureTotalWithVat ? ticket.futureTotalWithVat : 0) | currency: 'EUR': 2}}
|
||||||
|
@ -136,7 +154,6 @@
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>{{::ticket.liters | dashIfEmpty}}</td>
|
<td>{{::ticket.liters | dashIfEmpty}}</td>
|
||||||
<td>{{::ticket.hasStock | dashIfEmpty}}</td>
|
|
||||||
<td>{{::ticket.lines | dashIfEmpty}}</td>
|
<td>{{::ticket.lines | dashIfEmpty}}</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="chip {{$ctrl.totalPriceColor(ticket.totalWithVat)}}">
|
<span class="chip {{$ctrl.totalPriceColor(ticket.totalWithVat)}}">
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
import Section from 'salix/components/section';
|
import Section from 'salix/components/section';
|
||||||
|
import './style.scss';
|
||||||
|
|
||||||
export default class Controller extends Section {
|
export default class Controller extends Section {
|
||||||
constructor($element, $) {
|
constructor($element, $) {
|
||||||
|
@ -128,6 +129,11 @@ export default class Controller extends Section {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
agencies(futureAgency, agency) {
|
||||||
|
return this.$t(`Origin agency`, {agency: futureAgency}) +
|
||||||
|
'<br/>' + this.$t(`Destination agency`, {agency: agency});
|
||||||
|
}
|
||||||
|
|
||||||
moveTicketsAdvance() {
|
moveTicketsAdvance() {
|
||||||
let ticketsToMove = [];
|
let ticketsToMove = [];
|
||||||
this.checked.forEach(ticket => {
|
this.checked.forEach(ticket => {
|
||||||
|
@ -157,6 +163,10 @@ export default class Controller extends Section {
|
||||||
return {'liters': value};
|
return {'liters': value};
|
||||||
case 'lines':
|
case 'lines':
|
||||||
return {'lines': value};
|
return {'lines': value};
|
||||||
|
case 'futureLiters':
|
||||||
|
return {'futureLiters': value};
|
||||||
|
case 'futureLines':
|
||||||
|
return {'futureLines': value};
|
||||||
case 'ipt':
|
case 'ipt':
|
||||||
return {'ipt': value};
|
return {'ipt': value};
|
||||||
case 'futureIpt':
|
case 'futureIpt':
|
||||||
|
|
|
@ -4,3 +4,6 @@ Advance confirmation: ¿Desea adelantar {{checked}} tickets?
|
||||||
Success: Tickets movidos correctamente
|
Success: Tickets movidos correctamente
|
||||||
Lines: Líneas
|
Lines: Líneas
|
||||||
Liters: Litros
|
Liters: Litros
|
||||||
|
Item Packing Type: Encajado
|
||||||
|
Origin agency: "Agencia origen: {{agency}}"
|
||||||
|
Destination agency: "Agencia destino: {{agency}}"
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
@import "variables";
|
||||||
|
|
||||||
|
vn-ticket-advance{
|
||||||
|
vn-icon {
|
||||||
|
color: #f7931e
|
||||||
|
}
|
||||||
|
}
|
|
@ -75,8 +75,10 @@ class Controller extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
set shipped(value) {
|
set shipped(value) {
|
||||||
|
if (new Date(this.ticket.shipped).toDateString() != value.toDateString())
|
||||||
|
value.setHours(0, 0, 0, 0);
|
||||||
|
|
||||||
this.ticket.shipped = value;
|
this.ticket.shipped = value;
|
||||||
this.ticket.shipped.setHours(0, 0, 0, 0);
|
|
||||||
this.getLanded({
|
this.getLanded({
|
||||||
shipped: value,
|
shipped: value,
|
||||||
addressFk: this.ticket.addressFk,
|
addressFk: this.ticket.addressFk,
|
||||||
|
|
|
@ -17,43 +17,65 @@
|
||||||
model="model">
|
model="model">
|
||||||
</vn-searchbar>
|
</vn-searchbar>
|
||||||
</vn-portal>
|
</vn-portal>
|
||||||
<vn-data-viewer
|
|
||||||
model="model"
|
|
||||||
class="vn-w-xl">
|
|
||||||
<vn-card>
|
<vn-card>
|
||||||
<vn-table model="model">
|
<smart-table
|
||||||
<vn-thead>
|
model="model"
|
||||||
<vn-tr>
|
options="$ctrl.smartTableOptions"
|
||||||
<vn-th field="ticketFk" number>Ticket ID</vn-th>
|
view-config-id="ticketsMonitor"
|
||||||
<vn-th field="clientName">Client</vn-th>
|
expr-builder="$ctrl.exprBuilder(param, value)"
|
||||||
<vn-th>Shipment</vn-th>
|
>
|
||||||
<vn-th>Agency</vn-th>
|
<slot-actions>
|
||||||
<vn-th>Warehouse</vn-th>
|
<vn-check
|
||||||
<vn-th>Salesperson</vn-th>
|
label="Auto-refresh"
|
||||||
<vn-th shrink></vn-th>
|
vn-tooltip="Toggle auto-refresh every 2 minutes"
|
||||||
</vn-tr>
|
on-change="$ctrl.autoRefresh(value)">
|
||||||
</vn-thead>
|
</vn-check>
|
||||||
<vn-tbody>
|
</slot-actions>
|
||||||
<vn-tr
|
<slot-table>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th field="ticketFk">
|
||||||
|
<span translate>Ticket ID</span>
|
||||||
|
</th>
|
||||||
|
<th field="clientName">
|
||||||
|
<span translate>Client</span>
|
||||||
|
</th>
|
||||||
|
<th field="weekDay">
|
||||||
|
<span translate>Shipment</span>
|
||||||
|
</th>
|
||||||
|
<th field="agencyModeFk">
|
||||||
|
<span translate>Agency</span>
|
||||||
|
</th>
|
||||||
|
<th field="warehouseFk">
|
||||||
|
<span translate>Warehouse</span>
|
||||||
|
</th>
|
||||||
|
<th field="nickName">
|
||||||
|
<span translate>Salesperson</span>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr
|
||||||
ng-repeat="weekly in weeklies"
|
ng-repeat="weekly in weeklies"
|
||||||
ui-sref="ticket.card.summary({id: {{::weekly.ticketFk}}})"
|
ui-sref="ticket.card.summary({id: {{::weekly.ticketFk}}})"
|
||||||
class="clickable">
|
class="clickable">
|
||||||
<vn-td number>
|
<td number>
|
||||||
<span
|
<span
|
||||||
vn-click-stop="ticketDescriptor.show($event, weekly.ticketFk)"
|
vn-click-stop="ticketDescriptor.show($event, weekly.ticketFk)"
|
||||||
class="link">
|
class="link">
|
||||||
{{weekly.ticketFk}}
|
{{weekly.ticketFk}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</td>
|
||||||
<vn-td>
|
<td>
|
||||||
<span
|
<span
|
||||||
vn-click-stop="clientDescriptor.show($event, weekly.clientFk)"
|
vn-click-stop="clientDescriptor.show($event, weekly.clientFk)"
|
||||||
title ="{{::weekly.clientName}}"
|
title ="{{::weekly.clientName}}"
|
||||||
class="link">
|
class="link">
|
||||||
{{::weekly.clientName}}
|
{{::weekly.clientName}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</td>
|
||||||
<vn-td vn-click-stop>
|
<td vn-click-stop>
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
vn-id="weekday"
|
vn-id="weekday"
|
||||||
ng-model="weekly.weekDay"
|
ng-model="weekly.weekDay"
|
||||||
|
@ -65,8 +87,8 @@
|
||||||
order="id"
|
order="id"
|
||||||
class="dense">
|
class="dense">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</vn-td>
|
</td>
|
||||||
<vn-td vn-click-stop>
|
<td vn-click-stop>
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
vn-id="agencyMode"
|
vn-id="agencyMode"
|
||||||
ng-model="weekly.agencyModeFk"
|
ng-model="weekly.agencyModeFk"
|
||||||
|
@ -77,27 +99,28 @@
|
||||||
order="name"
|
order="name"
|
||||||
class="dense">
|
class="dense">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</vn-td>
|
</td>
|
||||||
<vn-td>{{::weekly.warehouseName}}</vn-td>
|
<td vn-click-stop>{{weekly.warehouseName}}</td>
|
||||||
<vn-td>
|
<td>
|
||||||
<span
|
<span
|
||||||
vn-click-stop="workerDescriptor.show($event, weekly.workerFk)"
|
vn-click-stop="workerDescriptor.show($event, weekly.workerFk)"
|
||||||
class="link" >
|
class="link" >
|
||||||
{{::weekly.userName}}
|
{{::weekly.userName}}
|
||||||
</span>
|
</span>
|
||||||
</vn-td>
|
</td>
|
||||||
<vn-td shrink>
|
<td shrink>
|
||||||
<vn-icon-button
|
<vn-icon-button
|
||||||
icon="delete"
|
icon="delete"
|
||||||
vn-click-stop="deleteWeekly.show(weekly.ticketFk)"
|
vn-click-stop="deleteWeekly.show(weekly.ticketFk)"
|
||||||
vn-tooltip="Delete">
|
vn-tooltip="Delete">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
</vn-td>
|
</td>
|
||||||
</vn-tr>
|
</tr>
|
||||||
</vn-tbody>
|
</tbody>
|
||||||
</vn-table>
|
</table>
|
||||||
|
</slot-table>
|
||||||
|
</smart-table>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
</vn-data-viewer>
|
|
||||||
<vn-client-descriptor-popover
|
<vn-client-descriptor-popover
|
||||||
vn-id="clientDescriptor">
|
vn-id="clientDescriptor">
|
||||||
</vn-client-descriptor-popover>
|
</vn-client-descriptor-popover>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
import Section from 'salix/components/section';
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
|
@ -15,6 +16,44 @@ export default class Controller extends Section {
|
||||||
{id: 5, name: 'Saturday'},
|
{id: 5, name: 'Saturday'},
|
||||||
{id: 6, name: 'Sunday'}
|
{id: 6, name: 'Sunday'}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
this.smartTableOptions = {
|
||||||
|
activeButtons: {
|
||||||
|
search: true,
|
||||||
|
shownColumns: true,
|
||||||
|
},
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
field: 'ticketFk',
|
||||||
|
searchable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'clientName',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'weekDay',
|
||||||
|
searchable: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'agencyModeFk',
|
||||||
|
searchable: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'warehouseFk',
|
||||||
|
searchable: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'nickname',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
exprBuilder(param, value) {
|
||||||
|
switch (param) {
|
||||||
|
case 'clientName': return {'c.name': value};
|
||||||
|
case 'nickName': return {'u.name': value};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onUpdate(ticketFk, field, value) {
|
onUpdate(ticketFk, field, value) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-back",
|
"name": "salix-back",
|
||||||
"version": "23.04.01",
|
"version": "23.06.01",
|
||||||
"author": "Verdnatura Levante SL",
|
"author": "Verdnatura Levante SL",
|
||||||
"description": "Salix backend",
|
"description": "Salix backend",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
Loading…
Reference in New Issue