@@ -195,7 +193,7 @@
vn-id="item-descriptor"
warehouse-fk="$ctrl.vnConfig.warehouseFk">
-
diff --git a/modules/invoiceIn/back/methods/invoice-in/specs/filter.spec.js b/modules/invoiceIn/back/methods/invoice-in/specs/filter.spec.js
index 401b8dab0..adab3cbeb 100644
--- a/modules/invoiceIn/back/methods/invoice-in/specs/filter.spec.js
+++ b/modules/invoiceIn/back/methods/invoice-in/specs/filter.spec.js
@@ -146,8 +146,8 @@ describe('InvoiceIn filter()', () => {
const options = {transaction: tx};
try {
- const from = new Date();
- const to = new Date();
+ const from = Date.vnNew();
+ const to = Date.vnNew();
from.setHours(0, 0, 0, 0);
to.setHours(23, 59, 59, 999);
to.setDate(to.getDate() + 1);
diff --git a/modules/invoiceIn/front/basic-data/index.spec.js b/modules/invoiceIn/front/basic-data/index.spec.js
index 09aa08293..98710ac35 100644
--- a/modules/invoiceIn/front/basic-data/index.spec.js
+++ b/modules/invoiceIn/front/basic-data/index.spec.js
@@ -78,7 +78,7 @@ describe('InvoiceIn', () => {
description: 'This is a description',
files: [{
lastModified: 1668673957761,
- lastModifiedDate: new Date(),
+ lastModifiedDate: Date.vnNew(),
name: 'file-example.png',
size: 19653,
type: 'image/png',
diff --git a/modules/invoiceIn/front/descriptor/index.html b/modules/invoiceIn/front/descriptor/index.html
index 40f7dec18..223914c9c 100644
--- a/modules/invoiceIn/front/descriptor/index.html
+++ b/modules/invoiceIn/front/descriptor/index.html
@@ -36,13 +36,13 @@
ng-if="$ctrl.isAgricultural()"
ng-click="$ctrl.showPdfInvoice()"
translate>
- Show agricultural invoice as PDF
+ Show agricultural receipt as PDF
- Send agricultural invoice as PDF
+ Send agricultural receipt as PDF
diff --git a/modules/invoiceIn/front/descriptor/index.js b/modules/invoiceIn/front/descriptor/index.js
index 4dc89a459..e005211a3 100644
--- a/modules/invoiceIn/front/descriptor/index.js
+++ b/modules/invoiceIn/front/descriptor/index.js
@@ -75,7 +75,7 @@ class Controller extends Descriptor {
filter: {
where: {
invoiceInFk: id,
- dueDated: {gte: new Date()}
+ dueDated: {gte: Date.vnNew()}
}
}})
.then(res => {
diff --git a/modules/invoiceIn/front/dueDay/index.js b/modules/invoiceIn/front/dueDay/index.js
index 3cc1c81e8..ee9b13e5c 100644
--- a/modules/invoiceIn/front/dueDay/index.js
+++ b/modules/invoiceIn/front/dueDay/index.js
@@ -4,7 +4,7 @@ import Section from 'salix/components/section';
class Controller extends Section {
add() {
this.$.model.insert({
- dueDated: new Date(),
+ dueDated: Date.vnNew(),
bankFk: this.vnConfig.local.bankFk
});
}
diff --git a/modules/invoiceIn/front/locale/es.yml b/modules/invoiceIn/front/locale/es.yml
index d8400dd67..35b43f9f6 100644
--- a/modules/invoiceIn/front/locale/es.yml
+++ b/modules/invoiceIn/front/locale/es.yml
@@ -19,6 +19,6 @@ To book: Contabilizar
Total amount: Total importe
Total net: Total neto
Total stems: Total tallos
-Show agricultural invoice as PDF: Ver factura agrícola como PDF
-Send agricultural invoice as PDF: Enviar factura agrícola como PDF
-New InvoiceIn: Nueva Factura
\ No newline at end of file
+Show agricultural receipt as PDF: Ver recibo agrícola como PDF
+Send agricultural receipt as PDF: Enviar recibo agrícola como PDF
+New InvoiceIn: Nueva Factura
diff --git a/modules/invoiceOut/back/methods/invoiceOut/clientsToInvoice.js b/modules/invoiceOut/back/methods/invoiceOut/clientsToInvoice.js
index d42184ae5..f3c7a5093 100644
--- a/modules/invoiceOut/back/methods/invoiceOut/clientsToInvoice.js
+++ b/modules/invoiceOut/back/methods/invoiceOut/clientsToInvoice.js
@@ -60,9 +60,9 @@ module.exports = Self => {
try {
query = `
SELECT MAX(issued) issued
- FROM vn.invoiceOut io
- JOIN vn.time t ON t.dated = io.issued
- WHERE io.serial = 'A'
+ FROM vn.invoiceOut io
+ JOIN vn.time t ON t.dated = io.issued
+ WHERE io.serial = 'A'
AND t.year = YEAR(?)
AND io.companyFk = ?`;
const [maxIssued] = await Self.rawSql(query, [
@@ -77,7 +77,7 @@ module.exports = Self => {
if (args.invoiceDate < args.maxShipped)
args.maxShipped = args.invoiceDate;
- const minShipped = new Date();
+ const minShipped = Date.vnNew();
minShipped.setFullYear(minShipped.getFullYear() - 1);
minShipped.setMonth(1);
minShipped.setDate(1);
@@ -131,11 +131,11 @@ module.exports = Self => {
const models = Self.app.models;
const args = ctx.args;
const query = `SELECT DISTINCT clientFk AS id
- FROM ticket t
+ FROM ticket t
JOIN ticketPackaging tp ON t.id = tp.ticketFk
JOIN client c ON c.id = t.clientFk
WHERE t.shipped BETWEEN '2017-11-21' AND ?
- AND t.clientFk >= ?
+ AND t.clientFk >= ?
AND (t.clientFk <= ? OR ? IS NULL)
AND c.isActive`;
return models.InvoiceOut.rawSql(query, [
@@ -149,16 +149,16 @@ module.exports = Self => {
async function getInvoiceableClients(ctx, options) {
const models = Self.app.models;
const args = ctx.args;
- const minShipped = new Date();
+ const minShipped = Date.vnNew();
minShipped.setFullYear(minShipped.getFullYear() - 1);
const query = `SELECT
c.id,
SUM(IFNULL
(
- s.quantity *
+ s.quantity *
s.price * (100-s.discount)/100,
- 0)
+ 0)
+ IFNULL(ts.quantity * ts.price,0)
) AS sumAmount,
c.hasToInvoiceByAddress,
@@ -170,7 +170,7 @@ module.exports = Self => {
LEFT JOIN ticketService ts ON ts.ticketFk = t.id
JOIN address a ON a.id = t.addressFk
JOIN client c ON c.id = t.clientFk
- WHERE ISNULL(t.refFk) AND c.id >= ?
+ WHERE ISNULL(t.refFk) AND c.id >= ?
AND (t.clientFk <= ? OR ? IS NULL)
AND t.shipped BETWEEN ? AND util.dayEnd(?)
AND t.companyFk = ? AND c.hasToInvoice
diff --git a/modules/invoiceOut/back/methods/invoiceOut/createManualInvoice.js b/modules/invoiceOut/back/methods/invoiceOut/createManualInvoice.js
index 297afa8e8..a458aa18e 100644
--- a/modules/invoiceOut/back/methods/invoiceOut/createManualInvoice.js
+++ b/modules/invoiceOut/back/methods/invoiceOut/createManualInvoice.js
@@ -108,14 +108,14 @@ module.exports = Self => {
throw new UserError(`This client is not invoiceable`);
// Can't invoice tickets into future
- const tomorrow = new Date();
+ const tomorrow = Date.vnNew();
tomorrow.setDate(tomorrow.getDate() + 1);
if (maxShipped >= tomorrow)
throw new UserError(`Can't invoice to future`);
const maxInvoiceDate = await getMaxIssued(args.serial, companyId, myOptions);
- if (new Date() < maxInvoiceDate)
+ if (Date.vnNew() < maxInvoiceDate)
throw new UserError(`Can't invoice to past`);
if (ticketId) {
@@ -155,7 +155,7 @@ module.exports = Self => {
async function isInvoiceable(clientId, options) {
const models = Self.app.models;
const query = `SELECT (hasToInvoice AND isTaxDataChecked) AS invoiceable
- FROM client
+ FROM client
WHERE id = ?`;
const [result] = await models.InvoiceOut.rawSql(query, [clientId], options);
@@ -172,12 +172,12 @@ module.exports = Self => {
async function getMaxIssued(serial, companyId, options) {
const models = Self.app.models;
- const query = `SELECT MAX(issued) AS issued
- FROM invoiceOut
+ const query = `SELECT MAX(issued) AS issued
+ FROM invoiceOut
WHERE serial = ? AND companyFk = ?`;
const [maxIssued] = await models.InvoiceOut.rawSql(query,
[serial, companyId], options);
- const maxInvoiceDate = maxIssued && maxIssued.issued || new Date();
+ const maxInvoiceDate = maxIssued && maxIssued.issued || Date.vnNew();
return maxInvoiceDate;
}
diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/createPdf.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/createPdf.spec.js
index ee3310368..26eae45ac 100644
--- a/modules/invoiceOut/back/methods/invoiceOut/specs/createPdf.spec.js
+++ b/modules/invoiceOut/back/methods/invoiceOut/specs/createPdf.spec.js
@@ -11,7 +11,7 @@ describe('InvoiceOut createPdf()', () => {
const ctx = {req: activeCtx};
it('should create a new PDF file and set true the hasPdf property', async() => {
- pending('https://redmine.verdnatura.es/issues/4875');
+ pending('https://redmine.verdnatura.es/issues/5035');
const invoiceId = 1;
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/downloadZip.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/downloadZip.spec.js
index 4d1833635..0f62a6876 100644
--- a/modules/invoiceOut/back/methods/invoiceOut/specs/downloadZip.spec.js
+++ b/modules/invoiceOut/back/methods/invoiceOut/specs/downloadZip.spec.js
@@ -13,7 +13,6 @@ describe('InvoiceOut downloadZip()', () => {
};
it('should return part of link to dowloand the zip', async() => {
- pending('https://redmine.verdnatura.es/issues/4875');
const tx = await models.InvoiceOut.beginTransaction({});
try {
@@ -31,6 +30,8 @@ describe('InvoiceOut downloadZip()', () => {
});
it('should return an error if the size of the files is too large', async() => {
+ pending('https://redmine.verdnatura.es/issues/5035');
+
const tx = await models.InvoiceOut.beginTransaction({});
let error;
diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js
index 7b5886236..d3d789393 100644
--- a/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js
+++ b/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js
@@ -1,7 +1,7 @@
const models = require('vn-loopback/server/server').models;
describe('InvoiceOut filter()', () => {
- let today = new Date();
+ let today = Date.vnNew();
today.setHours(2, 0, 0, 0);
it('should return the invoice out matching ref', async() => {
@@ -51,7 +51,6 @@ describe('InvoiceOut filter()', () => {
});
it('should return the invoice out matching hasPdf', async() => {
- pending('https://redmine.verdnatura.es/issues/4875');
const tx = await models.InvoiceOut.beginTransaction({});
const options = {transaction: tx};
@@ -67,7 +66,7 @@ describe('InvoiceOut filter()', () => {
const result = await models.InvoiceOut.filter(ctx, {id: invoiceOut.id}, options);
- expect(result.length).toEqual(1);
+ expect(result.length).toBeGreaterThanOrEqual(1);
await tx.rollback();
} catch (e) {
diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/invoiceClient.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/invoiceClient.spec.js
index 5f890de26..9a0574dba 100644
--- a/modules/invoiceOut/back/methods/invoiceOut/specs/invoiceClient.spec.js
+++ b/modules/invoiceOut/back/methods/invoiceOut/specs/invoiceClient.spec.js
@@ -5,7 +5,7 @@ describe('InvoiceOut invoiceClient()', () => {
const clientId = 1101;
const addressId = 121;
const companyFk = 442;
- const minShipped = new Date();
+ const minShipped = Date.vnNew();
minShipped.setFullYear(minShipped.getFullYear() - 1);
minShipped.setMonth(1);
minShipped.setDate(1);
@@ -33,8 +33,8 @@ describe('InvoiceOut invoiceClient()', () => {
ctx.args = {
clientId: clientId,
addressId: addressId,
- invoiceDate: new Date(),
- maxShipped: new Date(),
+ invoiceDate: Date.vnNew(),
+ maxShipped: Date.vnNew(),
companyFk: companyFk,
minShipped: minShipped
};
diff --git a/modules/invoiceOut/front/descriptor-menu/index.html b/modules/invoiceOut/front/descriptor-menu/index.html
index 1c0919288..389fcf81b 100644
--- a/modules/invoiceOut/front/descriptor-menu/index.html
+++ b/modules/invoiceOut/front/descriptor-menu/index.html
@@ -17,12 +17,12 @@
target="_blank"
name="showInvoicePdf"
translate>
- Show as PDF
+ as PDF
- Show as CSV
+ as CSV
diff --git a/modules/invoiceOut/front/descriptor-menu/locale/es.yml b/modules/invoiceOut/front/descriptor-menu/locale/es.yml
index 488c1a3f8..df0ba57cf 100644
--- a/modules/invoiceOut/front/descriptor-menu/locale/es.yml
+++ b/modules/invoiceOut/front/descriptor-menu/locale/es.yml
@@ -2,6 +2,8 @@ Show invoice...: Ver factura...
Send invoice...: Enviar factura...
Send PDF invoice: Enviar factura en PDF
Send CSV invoice: Enviar factura en CSV
+as PDF: como PDF
+as CSV: como CSV
Delete Invoice: Eliminar factura
Clone Invoice: Clonar factura
Book invoice: Asentar factura
diff --git a/modules/invoiceOut/front/index/global-invoicing/index.js b/modules/invoiceOut/front/index/global-invoicing/index.js
index f772a4936..0c5773adc 100644
--- a/modules/invoiceOut/front/index/global-invoicing/index.js
+++ b/modules/invoiceOut/front/index/global-invoicing/index.js
@@ -6,7 +6,7 @@ class Controller extends Dialog {
constructor($element, $, $transclude) {
super($element, $, $transclude);
this.invoice = {
- maxShipped: new Date()
+ maxShipped: Date.vnNew()
};
this.clientsNumber = 'allClients';
}
diff --git a/modules/invoiceOut/front/index/global-invoicing/index.spec.js b/modules/invoiceOut/front/index/global-invoicing/index.spec.js
index e88b0b1d4..aa9674b0e 100644
--- a/modules/invoiceOut/front/index/global-invoicing/index.spec.js
+++ b/modules/invoiceOut/front/index/global-invoicing/index.spec.js
@@ -76,8 +76,8 @@ describe('InvoiceOut', () => {
jest.spyOn(controller.vnApp, 'showError');
controller.invoice = {
- invoiceDate: new Date(),
- maxShipped: new Date()
+ invoiceDate: Date.vnNew(),
+ maxShipped: Date.vnNew()
};
controller.responseHandler('accept');
@@ -88,14 +88,14 @@ describe('InvoiceOut', () => {
it('should make an http POST query and then call to the showSuccess() method', () => {
jest.spyOn(controller.vnApp, 'showSuccess');
- const minShipped = new Date();
+ const minShipped = Date.vnNew();
minShipped.setFullYear(minShipped.getFullYear() - 1);
minShipped.setMonth(1);
minShipped.setDate(1);
minShipped.setHours(0, 0, 0, 0);
controller.invoice = {
- invoiceDate: new Date(),
- maxShipped: new Date(),
+ invoiceDate: Date.vnNew(),
+ maxShipped: Date.vnNew(),
fromClientId: 1101,
toClientId: 1101,
companyFk: 442,
diff --git a/modules/invoiceOut/front/index/manual/index.js b/modules/invoiceOut/front/index/manual/index.js
index ed50e37da..3abe4b825 100644
--- a/modules/invoiceOut/front/index/manual/index.js
+++ b/modules/invoiceOut/front/index/manual/index.js
@@ -8,7 +8,7 @@ class Controller extends Dialog {
this.isInvoicing = false;
this.invoice = {
- maxShipped: new Date()
+ maxShipped: Date.vnNew()
};
}
diff --git a/modules/item/back/methods/fixed-price/getRate2.js b/modules/item/back/methods/fixed-price/getRate2.js
new file mode 100644
index 000000000..c90a380e3
--- /dev/null
+++ b/modules/item/back/methods/fixed-price/getRate2.js
@@ -0,0 +1,39 @@
+module.exports = Self => {
+ Self.remoteMethod('getRate2', {
+ description: 'Return the rate2',
+ accessType: 'READ',
+ accepts: [
+ {
+ arg: 'fixedPriceId',
+ type: 'integer',
+ description: 'The fixedPrice Id',
+ required: true
+ },
+ {
+ arg: 'rate3',
+ type: 'number',
+ description: `The price rate 3`,
+ required: true
+ }
+ ],
+ returns: {
+ type: 'object',
+ root: true
+ },
+ http: {
+ path: `/getRate2`,
+ verb: 'GET'
+ }
+ });
+
+ Self.getRate2 = async(fixedPriceId, rate3, options) => {
+ const myOptions = {};
+
+ if (typeof options == 'object')
+ Object.assign(myOptions, options);
+
+ const [result] = await Self.rawSql(`SELECT vn.priceFixed_getRate2(?, ?) as rate2`,
+ [fixedPriceId, rate3], myOptions);
+ return result;
+ };
+};
diff --git a/modules/item/back/methods/fixed-price/specs/getRate2.spec.js b/modules/item/back/methods/fixed-price/specs/getRate2.spec.js
new file mode 100644
index 000000000..2f5dd93cd
--- /dev/null
+++ b/modules/item/back/methods/fixed-price/specs/getRate2.spec.js
@@ -0,0 +1,39 @@
+const models = require('vn-loopback/server/server').models;
+
+describe('getRate2()', () => {
+ it(`should return new rate2 if exists rate`, async() => {
+ const tx = await models.FixedPrice.beginTransaction({});
+
+ try {
+ const options = {transaction: tx};
+ const fixedPriceId = 1;
+ const rate3 = 2;
+ const result = await models.FixedPrice.getRate2(fixedPriceId, rate3, options);
+
+ expect(result.rate2).toEqual(1.9);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+
+ it(`should return null if not exists rate`, async() => {
+ const tx = await models.FixedPrice.beginTransaction({});
+
+ try {
+ const options = {transaction: tx};
+ const fixedPriceId = 13;
+ const rate3 = 2;
+ const result = await models.FixedPrice.getRate2(fixedPriceId, rate3, options);
+
+ expect(result.rate2).toEqual(null);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+});
diff --git a/modules/item/back/methods/fixed-price/specs/upsertFixedPrice.spec.js b/modules/item/back/methods/fixed-price/specs/upsertFixedPrice.spec.js
index 68eacfbad..5c3fec7d6 100644
--- a/modules/item/back/methods/fixed-price/specs/upsertFixedPrice.spec.js
+++ b/modules/item/back/methods/fixed-price/specs/upsertFixedPrice.spec.js
@@ -1,7 +1,7 @@
const models = require('vn-loopback/server/server').models;
describe('upsertFixedPrice()', () => {
- const now = new Date();
+ const now = Date.vnNew();
const fixedPriceId = 1;
let originalFixedPrice;
diff --git a/modules/item/back/methods/item-image-queue/downloadImages.js b/modules/item/back/methods/item-image-queue/downloadImages.js
index 05b223598..0f57856c7 100644
--- a/modules/item/back/methods/item-image-queue/downloadImages.js
+++ b/modules/item/back/methods/item-image-queue/downloadImages.js
@@ -27,7 +27,7 @@ module.exports = Self => {
});
for (let image of images) {
- const currentStamp = new Date().getTime();
+ const currentStamp = Date.vnNew().getTime();
const updatedStamp = image.updated.getTime();
const graceTime = Math.abs(currentStamp - updatedStamp);
const maxTTL = 3600 * 48 * 1000; // 48 hours in ms;
@@ -97,7 +97,7 @@ module.exports = Self => {
await row.updateAttributes({
error: error,
attempts: row.attempts + 1,
- updated: new Date()
+ updated: Date.vnNew()
});
}
diff --git a/modules/item/back/methods/item-shelving-sale/filter.js b/modules/item/back/methods/item-shelving-sale/filter.js
new file mode 100644
index 000000000..12029d33d
--- /dev/null
+++ b/modules/item/back/methods/item-shelving-sale/filter.js
@@ -0,0 +1,49 @@
+
+const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
+
+module.exports = Self => {
+ Self.remoteMethod('filter', {
+ description: 'Returns all item shelving sale matching with the filter',
+ accessType: 'READ',
+ accepts: [{
+ arg: 'filter',
+ type: 'object',
+ description: 'Filter defining where and paginated data'
+ }],
+ returns: {
+ type: ['object'],
+ root: true
+ },
+ http: {
+ path: `/filter`,
+ verb: 'GET'
+ }
+ });
+
+ Self.filter = async(filter, options) => {
+ const conn = Self.dataSource.connector;
+ const myOptions = {};
+
+ if (typeof options == 'object')
+ Object.assign(myOptions, options);
+
+ const stmt = new ParameterizedSQL(`
+ SELECT iss.created,
+ iss.saleFk,
+ iss.quantity,
+ iss.userFk,
+ ish.shelvingFk,
+ p.code,
+ u.name
+ FROM itemShelvingSale iss
+ LEFT JOIN itemShelving ish ON iss.itemShelvingFk = ish.id
+ LEFT JOIN shelving s ON ish.shelvingFk = s.code
+ LEFT JOIN parking p ON s.parkingFk = p.id
+ LEFT JOIN account.user u ON u.id = iss.userFk`
+ );
+
+ stmt.merge(conn.makeSuffix(filter));
+
+ return conn.executeStmt(stmt);
+ };
+};
diff --git a/modules/item/back/methods/item/getVisibleAvailable.js b/modules/item/back/methods/item/getVisibleAvailable.js
index b291ad9b4..612f64022 100644
--- a/modules/item/back/methods/item/getVisibleAvailable.js
+++ b/modules/item/back/methods/item/getVisibleAvailable.js
@@ -29,7 +29,7 @@ module.exports = Self => {
}
});
- Self.getVisibleAvailable = async(id, warehouseFk, dated = new Date(), options) => {
+ Self.getVisibleAvailable = async(id, warehouseFk, dated = Date.vnNew(), options) => {
const myOptions = {};
if (typeof options == 'object')
diff --git a/modules/item/back/methods/item/getWasteByItem.js b/modules/item/back/methods/item/getWasteByItem.js
index b93d534da..56b90b04a 100644
--- a/modules/item/back/methods/item/getWasteByItem.js
+++ b/modules/item/back/methods/item/getWasteByItem.js
@@ -32,7 +32,7 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
- const date = new Date();
+ const date = Date.vnNew();
date.setHours(0, 0, 0, 0);
const wastes = await Self.rawSql(`
SELECT *, 100 * dwindle / total AS percentage
@@ -43,7 +43,7 @@ module.exports = Self => {
sum(ws.saleTotal) AS total,
sum(ws.saleWaste) AS dwindle
FROM bs.waste ws
- WHERE buyer = ? AND family = ?
+ WHERE buyer = ? AND family = ?
AND year = YEAR(TIMESTAMPADD(WEEK,-1, ?))
AND week = WEEK(TIMESTAMPADD(WEEK,-1, ?), 1)
GROUP BY buyer, itemFk
diff --git a/modules/item/back/methods/item/getWasteByWorker.js b/modules/item/back/methods/item/getWasteByWorker.js
index 4c3c64a91..8fa351eed 100644
--- a/modules/item/back/methods/item/getWasteByWorker.js
+++ b/modules/item/back/methods/item/getWasteByWorker.js
@@ -19,7 +19,7 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
- const date = new Date();
+ const date = Date.vnNew();
date.setHours(0, 0, 0, 0);
const wastes = await Self.rawSql(`
SELECT *, 100 * dwindle / total AS percentage
diff --git a/modules/item/back/methods/item/new.js b/modules/item/back/methods/item/new.js
index fae37836f..0057cb50f 100644
--- a/modules/item/back/methods/item/new.js
+++ b/modules/item/back/methods/item/new.js
@@ -37,7 +37,8 @@ module.exports = Self => {
'typeFk',
'intrastatFk',
'originFk',
- 'relevancy'
+ 'priority',
+ 'tag'
];
for (const key in params) {
@@ -46,10 +47,14 @@ module.exports = Self => {
}
try {
+ const itemConfig = await models.ItemConfig.findOne({fields: ['validPriorities']}, myOptions);
+ if (!itemConfig.validPriorities.includes(params.priority))
+ throw new UserError(`Valid priorities: ${[...itemConfig.validPriorities]}`);
+
const provisionalName = params.provisionalName;
delete params.provisionalName;
- const itemType = await models.ItemType.findById(params.typeFk, myOptions);
+ const itemType = await models.ItemType.findById(params.typeFk, {fields: ['isLaid']}, myOptions);
params.isLaid = itemType.isLaid;
@@ -63,13 +68,14 @@ module.exports = Self => {
await Self.rawSql(query, null, myOptions);
- let nameTag = await models.Tag.findOne({where: {name: 'Nombre temporal'}});
+ const nameTag = await models.Tag.findById(params.tag, {fields: ['id']}, myOptions);
let newTags = [];
- newTags.push({itemFk: item.id, tagFk: nameTag.id, value: provisionalName, priority: '2'});
+ newTags.push({itemFk: item.id, tagFk: nameTag.id, value: provisionalName, priority: item.priority});
typeTags.forEach(typeTag => {
- newTags.push({itemFk: item.id, tagFk: typeTag.tagFk, value: '', priority: typeTag.priority});
+ if (nameTag.id != typeTag.tagFk)
+ newTags.push({itemFk: item.id, tagFk: typeTag.tagFk, value: '', priority: typeTag.priority});
});
await models.ItemTag.create(newTags, myOptions);
diff --git a/modules/item/back/methods/item/regularize.js b/modules/item/back/methods/item/regularize.js
index 0878e3242..dfbcaa69f 100644
--- a/modules/item/back/methods/item/regularize.js
+++ b/modules/item/back/methods/item/regularize.js
@@ -94,8 +94,8 @@ module.exports = Self => {
}
async function createTicket(ctx, options) {
- ctx.args.shipped = new Date();
- ctx.args.landed = new Date();
+ ctx.args.shipped = Date.vnNew();
+ ctx.args.landed = Date.vnNew();
ctx.args.companyId = null;
ctx.args.agencyModeId = null;
ctx.args.routeId = null;
@@ -106,10 +106,10 @@ module.exports = Self => {
}
async function getTicketId(params, options) {
- const minDate = new Date();
+ const minDate = Date.vnNew();
minDate.setHours(0, 0, 0, 0);
- const maxDate = new Date();
+ const maxDate = Date.vnNew();
maxDate.setHours(23, 59, 59, 59);
let ticket = await Self.app.models.Ticket.findOne({
diff --git a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js
index 8e4864ee8..13b2417d7 100644
--- a/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js
+++ b/modules/item/back/methods/item/specs/getVisibleAvailable.spec.js
@@ -8,7 +8,7 @@ describe('item getVisibleAvailable()', () => {
try {
const itemFk = 1;
const warehouseFk = 1;
- const dated = new Date();
+ const dated = Date.vnNew();
const result = await models.Item.getVisibleAvailable(itemFk, warehouseFk, dated, options);
@@ -29,7 +29,7 @@ describe('item getVisibleAvailable()', () => {
try {
const itemFk = 1;
const warehouseFk = 1;
- const dated = new Date();
+ const dated = Date.vnNew();
dated.setDate(dated.getDate() - 1);
const result = await models.Item.getVisibleAvailable(itemFk, warehouseFk, dated, options);
diff --git a/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js b/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js
index 25e661aee..00488e534 100644
--- a/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js
+++ b/modules/item/back/methods/item/specs/lastEntriesFilter.spec.js
@@ -1,9 +1,9 @@
const {models} = require('vn-loopback/server/server');
describe('item lastEntriesFilter()', () => {
it('should return one entry for the given item', async() => {
- const minDate = new Date();
+ const minDate = Date.vnNew();
minDate.setHours(0, 0, 0, 0);
- const maxDate = new Date();
+ const maxDate = Date.vnNew();
maxDate.setHours(23, 59, 59, 59);
const tx = await models.Item.beginTransaction({});
@@ -23,11 +23,11 @@ describe('item lastEntriesFilter()', () => {
});
it('should return five entries for the given item', async() => {
- const minDate = new Date();
+ const minDate = Date.vnNew();
minDate.setHours(0, 0, 0, 0);
minDate.setMonth(minDate.getMonth() - 2, 1);
- const maxDate = new Date();
+ const maxDate = Date.vnNew();
maxDate.setHours(23, 59, 59, 59);
const tx = await models.Item.beginTransaction({});
diff --git a/modules/item/back/methods/item/specs/new.spec.js b/modules/item/back/methods/item/specs/new.spec.js
index 7364faa7d..e34ab2cf5 100644
--- a/modules/item/back/methods/item/specs/new.spec.js
+++ b/modules/item/back/methods/item/specs/new.spec.js
@@ -11,7 +11,8 @@ describe('item new()', () => {
originFk: 1,
provisionalName: 'planta',
typeFk: 2,
- relevancy: 0
+ priority: 2,
+ tag: 1
};
let item = await models.Item.new(itemParams, options);
@@ -20,7 +21,7 @@ describe('item new()', () => {
item.isLaid = itemType.isLaid;
- const temporalNameTag = await models.Tag.findOne({where: {name: 'Nombre temporal'}}, options);
+ const temporalNameTag = await models.Tag.findById(itemParams.tag, {fields: ['id']}, options);
const temporalName = await models.ItemTag.findOne({
where: {
@@ -31,7 +32,7 @@ describe('item new()', () => {
item = await models.Item.findById(item.id, null, options);
- itemType = await models.ItemType.findById(item.typeFk, options);
+ itemType = await models.ItemType.findById(item.typeFk, {fields: ['isLaid']}, options);
item.isLaid = itemType.isLaid;
diff --git a/modules/item/back/methods/tag/onSubmit.js b/modules/item/back/methods/tag/onSubmit.js
new file mode 100644
index 000000000..7abbe60d4
--- /dev/null
+++ b/modules/item/back/methods/tag/onSubmit.js
@@ -0,0 +1,81 @@
+
+module.exports = function(Self) {
+ Self.remoteMethodCtx('onSubmit', {
+ description: 'Save model changes',
+ accessType: 'WRITE',
+ accepts: [
+ {
+ arg: 'creates',
+ type: ['object'],
+ description: 'The itemTags records to create'
+ }, {
+ arg: 'deletes',
+ type: ['number'],
+ description: 'The itemTags ids to delete'
+ }, {
+ arg: 'updates',
+ type: ['object'],
+ description: 'The itemTags records to update'
+ }, {
+ arg: 'maxPriority',
+ type: 'number',
+ description: 'The maxPriority value'
+ }
+ ],
+ returns: {
+ root: true,
+ type: 'object'
+ },
+ http: {
+ verb: 'PATCH',
+ path: '/onSubmit'
+ }
+ });
+
+ Self.onSubmit = async(ctx, options) => {
+ const models = Self.app.models;
+ const args = ctx.args;
+ let tx;
+ const myOptions = {};
+
+ if (typeof options == 'object')
+ Object.assign(myOptions, options);
+
+ if (!myOptions.transaction) {
+ tx = await Self.beginTransaction({});
+ myOptions.transaction = tx;
+ }
+
+ try {
+ if (args.deletes) {
+ for (const itemTagId of args.deletes)
+ await models.ItemTag.destroyById(itemTagId, myOptions);
+ }
+
+ if (args.updates) {
+ for (const row of args.updates) {
+ if (row.data.priority) {
+ const itemTag = await models.ItemTag.findById(row.where.id, null, myOptions);
+ await itemTag.updateAttributes({
+ priority: row.data.priority + args.maxPriority
+ }, myOptions);
+ }
+ }
+ for (const row of args.updates) {
+ const itemTag = await models.ItemTag.findById(row.where.id, null, myOptions);
+ await itemTag.updateAttributes(row.data, myOptions);
+ }
+ }
+
+ if (args.creates) {
+ for (const itemTag of args.creates)
+ await models.ItemTag.create(itemTag, myOptions);
+ }
+
+ if (tx) await tx.commit();
+ } catch (e) {
+ if (tx) await tx.rollback();
+ throw e;
+ }
+ };
+};
diff --git a/modules/item/back/methods/tag/specs/onSubmit.spec.js b/modules/item/back/methods/tag/specs/onSubmit.spec.js
new file mode 100644
index 000000000..f24aad7e4
--- /dev/null
+++ b/modules/item/back/methods/tag/specs/onSubmit.spec.js
@@ -0,0 +1,96 @@
+const models = require('vn-loopback/server/server').models;
+
+describe('tag onSubmit()', () => {
+ it('should delete a tag', async() => {
+ const tx = await models.Item.beginTransaction({});
+ const options = {transaction: tx};
+
+ try {
+ const deletes = [40];
+ const ctx = {
+ args: {
+ deletes: deletes
+ }
+ };
+ await models.Tag.onSubmit(ctx, options);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+
+ it('should update a tag', async() => {
+ const tx = await models.Item.beginTransaction({});
+ const options = {transaction: tx};
+
+ try {
+ const updates = [{data: {value: 'Container Test'}, where: {id: 36}}];
+ const ctx = {
+ args: {
+ updates: updates
+ }
+ };
+ await models.Tag.onSubmit(ctx, options);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+
+ it('should create a tag', async() => {
+ const tx = await models.Item.beginTransaction({});
+ const options = {transaction: tx};
+
+ try {
+ const creates = [{
+ 'itemFk': '6',
+ 'priority': 8,
+ '$orgIndex': null,
+ '$oldData': null,
+ '$isNew': true,
+ 'tagFk': 3,
+ 'value': 'madera'
+ }];
+ const ctx = {
+ args: {
+ creates: creates
+ }
+ };
+ await models.Tag.onSubmit(ctx, options);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+
+ it('should swap priority for two tags', async() => {
+ const tx = await models.Item.beginTransaction({});
+ const options = {transaction: tx};
+
+ try {
+ const updates = [
+ {data: {priority: 2}, where: {id: 36}},
+ {data: {priority: 1}, where: {id: 37}}
+ ];
+ const ctx = {
+ args: {
+ updates: updates,
+ maxPriority: 7,
+
+ }
+ };
+ await models.Tag.onSubmit(ctx, options);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+});
diff --git a/modules/item/back/models/fixed-price.js b/modules/item/back/models/fixed-price.js
index 9c78c586f..91010805f 100644
--- a/modules/item/back/models/fixed-price.js
+++ b/modules/item/back/models/fixed-price.js
@@ -1,4 +1,5 @@
module.exports = Self => {
require('../methods/fixed-price/filter')(Self);
require('../methods/fixed-price/upsertFixedPrice')(Self);
+ require('../methods/fixed-price/getRate2')(Self);
};
diff --git a/modules/item/back/models/item-config.json b/modules/item/back/models/item-config.json
index 364879986..36d25e0bb 100644
--- a/modules/item/back/models/item-config.json
+++ b/modules/item/back/models/item-config.json
@@ -16,6 +16,22 @@
"wasteRecipients": {
"type": "string",
"description": "Buyers waste report recipients"
+ },
+ "validPriorities": {
+ "type": "array"
+ },
+ "defaultPriority": {
+ "type": "int"
+ },
+ "defaultTag": {
+ "type": "int"
+ }
+ },
+ "relations": {
+ "tag": {
+ "type": "belongsTo",
+ "model": "Tag",
+ "foreignKey": "defaultTag"
}
}
-}
\ No newline at end of file
+}
diff --git a/modules/item/back/models/item-packing-type.json b/modules/item/back/models/item-packing-type.json
index d77c37dd8..da435db24 100644
--- a/modules/item/back/models/item-packing-type.json
+++ b/modules/item/back/models/item-packing-type.json
@@ -13,6 +13,9 @@
},
"description": {
"type": "string"
+ },
+ "isActive":{
+ "type": "boolean"
}
},
"acls": [
@@ -23,4 +26,4 @@
"permission": "ALLOW"
}
]
-}
\ No newline at end of file
+}
diff --git a/modules/item/back/models/item-shelving-sale.js b/modules/item/back/models/item-shelving-sale.js
new file mode 100644
index 000000000..b89be9f00
--- /dev/null
+++ b/modules/item/back/models/item-shelving-sale.js
@@ -0,0 +1,3 @@
+module.exports = Self => {
+ require('../methods/item-shelving-sale/filter')(Self);
+};
diff --git a/modules/item/back/models/item-shelving.json b/modules/item/back/models/item-shelving.json
index 951a4553a..0890350da 100644
--- a/modules/item/back/models/item-shelving.json
+++ b/modules/item/back/models/item-shelving.json
@@ -12,21 +12,12 @@
"id": true,
"description": "Identifier"
},
- "shelve": {
- "type": "string"
- },
"shelvingFk": {
"type": "string"
},
"itemFk": {
"type": "number"
},
- "deep": {
- "type": "number"
- },
- "quantity": {
- "type": "number"
- },
"created": {
"type": "date"
}
@@ -41,6 +32,11 @@
"type": "belongsTo",
"model": "Account",
"foreignKey": "userFk"
- }
+ },
+ "shelving": {
+ "type": "belongsTo",
+ "model": "Shelving",
+ "foreignKey": "shelvingFk"
+ }
}
}
diff --git a/modules/item/back/models/tag.js b/modules/item/back/models/tag.js
index 43fbc0db3..92760e34f 100644
--- a/modules/item/back/models/tag.js
+++ b/modules/item/back/models/tag.js
@@ -1,3 +1,4 @@
module.exports = Self => {
require('../methods/tag/filterValue')(Self);
+ require('../methods/tag/onSubmit')(Self);
};
diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html
index 8d1afe4e1..fd21ab240 100644
--- a/modules/item/front/basic-data/index.html
+++ b/modules/item/front/basic-data/index.html
@@ -1,6 +1,6 @@
-
-
@@ -95,7 +95,7 @@
@@ -108,15 +108,15 @@
@@ -124,10 +124,17 @@
+
+
-
@@ -225,12 +232,12 @@
-
\ No newline at end of file
+
diff --git a/modules/item/front/create/index.html b/modules/item/front/create/index.html
index 6deaab1cd..15e212250 100644
--- a/modules/item/front/create/index.html
+++ b/modules/item/front/create/index.html
@@ -16,10 +16,24 @@
+
+
+
+
{
+ if (res.data) {
+ const dataRow = res.data[0];
+ dataRow.validPriorities.forEach(priority => {
+ this.validPriorities.push({priority});
+ });
+ this.item = {
+ priority: dataRow.defaultPriority,
+ tag: dataRow.defaultTag
+ };
+ }
+ });
}
onSubmit() {
diff --git a/modules/item/front/descriptor/index.js b/modules/item/front/descriptor/index.js
index 133b11b48..b88f24456 100644
--- a/modules/item/front/descriptor/index.js
+++ b/modules/item/front/descriptor/index.js
@@ -80,7 +80,7 @@ class Controller extends Descriptor {
}
onUploadResponse() {
- const timestamp = new Date().getTime();
+ const timestamp = Date.vnNew().getTime();
const src = this.$rootScope.imagePath('catalog', '200x200', this.item.id);
const zoomSrc = this.$rootScope.imagePath('catalog', '1600x900', this.item.id);
const newSrc = `${src}&t=${timestamp}`;
diff --git a/modules/item/front/diary/index.js b/modules/item/front/diary/index.js
index c997ea491..1e93f9f16 100644
--- a/modules/item/front/diary/index.js
+++ b/modules/item/front/diary/index.js
@@ -7,7 +7,7 @@ class Controller extends Section {
super($element, $scope);
this.$anchorScroll = $anchorScroll;
this.$location = $location;
- let today = new Date();
+ let today = Date.vnNew();
today.setHours(0, 0, 0, 0);
this.today = today.toJSON();
}
diff --git a/modules/item/front/fixed-price/index.html b/modules/item/front/fixed-price/index.html
index 9498bf96f..f9d177562 100644
--- a/modules/item/front/fixed-price/index.html
+++ b/modules/item/front/fixed-price/index.html
@@ -41,14 +41,12 @@
Warehouse
- P.P.U.
+ field="rate2">
+ Grouping price
|
- P.P.P.
+ field="rate3">
+ Packing price
|
Min price
@@ -72,7 +70,7 @@
show-field="name"
value-field="id"
search-function="$ctrl.itemSearchFunc($search)"
- on-change="$ctrl.upsertPrice(price)"
+ on-change="$ctrl.upsertPrice(price, true)"
order="id DESC"
tabindex="1">
@@ -112,18 +110,32 @@
| |
-
-
+
+ {{price.rate2 | currency: 'EUR':2}}
+
+
+
+
+
|
-
-
+
+ {{price.rate3 | currency: 'EUR':2}}
+
+
+
+
+
|
{
+ const rate2 = res.data.rate2;
+ if (rate2) {
+ price.rate2 = rate2;
+ this.upsertPrice(price);
+ }
+ });
+ }
}
ngModule.vnComponent('vnFixedPrice', {
diff --git a/modules/item/front/fixed-price/index.spec.js b/modules/item/front/fixed-price/index.spec.js
index 94621e352..5f28e22b1 100644
--- a/modules/item/front/fixed-price/index.spec.js
+++ b/modules/item/front/fixed-price/index.spec.js
@@ -24,7 +24,7 @@ describe('fixed price', () => {
});
it('should perform an http request to update the price', () => {
- const now = new Date();
+ const now = Date.vnNew();
jest.spyOn(controller.vnApp, 'showSuccess');
$httpBackend.expectPATCH('FixedPrices/upsertFixedPrice').respond();
@@ -85,5 +85,25 @@ describe('fixed price', () => {
expect(controller.$.model.remove).toHaveBeenCalled();
});
});
+
+ describe('recalculateRate2()', () => {
+ it(`should rate2 recalculate`, () => {
+ jest.spyOn(controller.vnApp, 'showSuccess');
+ const price = {
+ id: 1,
+ itemFk: 1,
+ rate2: 2,
+ rate3: 2
+ };
+ const response = {rate2: 1};
+ controller.recalculateRate2(price);
+
+ const query = `FixedPrices/getRate2?fixedPriceId=${price.id}&rate3=${price.rate3}`;
+ $httpBackend.expectGET(query).respond(response);
+ $httpBackend.flush();
+
+ expect(price.rate2).toEqual(response.rate2);
+ });
+ });
});
});
diff --git a/modules/item/front/fixed-price/locale/es.yml b/modules/item/front/fixed-price/locale/es.yml
index 3f400336d..6bdfcb678 100644
--- a/modules/item/front/fixed-price/locale/es.yml
+++ b/modules/item/front/fixed-price/locale/es.yml
@@ -3,5 +3,3 @@ Search prices by item ID or code: Buscar por ID de artículo o código
Search fixed prices: Buscar precios fijados
Add fixed price: Añadir precio fijado
This row will be removed: Esta linea se eliminará
-Price By Unit: Precio Por Unidad
-Price By Package: Precio Por Paquete
\ No newline at end of file
diff --git a/modules/item/front/last-entries/index.html b/modules/item/front/last-entries/index.html
index 0348d4f66..1c2db10a5 100644
--- a/modules/item/front/last-entries/index.html
+++ b/modules/item/front/last-entries/index.html
@@ -9,15 +9,15 @@
-
+
@@ -35,8 +35,7 @@
Warehouse
Landed
Entry
- P.P.U
- P.P.P
+ PVP
Label
Packing
Grouping
@@ -51,7 +50,7 @@
-
@@ -65,30 +64,31 @@
{{::entry.entryFk | dashIfEmpty}}
- {{::entry.price2 | dashIfEmpty}}
- {{::entry.price3 | dashIfEmpty}}
+
+ {{::entry.price2 | currency: 'EUR':2 | dashIfEmpty}} / {{::entry.price3 | currency: 'EUR':2 | dashIfEmpty}}
+
{{entry.stickers | dashIfEmpty}}
-
+
{{::entry.packing | dashIfEmpty}}
-
+
{{::entry.grouping | dashIfEmpty}}
{{::entry.stems | dashIfEmpty}}
{{::entry.quantity}}
-
- {{::entry.cost | dashIfEmpty}}
+ {{::$ctrl.$t('Cost')}}: {{::entry.buyingValue | currency: 'EUR':2 | dashIfEmpty}}
+ {{::$ctrl.$t('Package')}}: {{::entry.packageValue | currency: 'EUR':2 | dashIfEmpty}}
+ {{::$ctrl.$t('Freight')}}: {{::entry.freightValue | currency: 'EUR':2 | dashIfEmpty}}
+ {{::$ctrl.$t('Comission')}}: {{::entry.comissionValue | currency: 'EUR':2 | dashIfEmpty}}">
+ {{::entry.cost | currency: 'EUR':2 | dashIfEmpty}}
{{::entry.weight | dashIfEmpty}}
@@ -113,24 +113,24 @@
ng-click="contextmenu.filterBySelection()">
Filter by selection
-
Exclude selection
-
Remove filter
-
Remove all filters
-
Copy value
-
\ No newline at end of file
+
diff --git a/modules/item/front/last-entries/index.js b/modules/item/front/last-entries/index.js
index 014761da9..0c6804838 100644
--- a/modules/item/front/last-entries/index.js
+++ b/modules/item/front/last-entries/index.js
@@ -5,11 +5,11 @@ class Controller extends Section {
constructor($element, $) {
super($element, $);
- const from = new Date();
+ const from = Date.vnNew();
from.setDate(from.getDate() - 75);
from.setHours(0, 0, 0, 0);
- const to = new Date();
+ const to = Date.vnNew();
to.setDate(to.getDate() + 10);
to.setHours(23, 59, 59, 59);
diff --git a/modules/item/front/locale/es.yml b/modules/item/front/locale/es.yml
index 88ab031e1..0fc014742 100644
--- a/modules/item/front/locale/es.yml
+++ b/modules/item/front/locale/es.yml
@@ -44,6 +44,7 @@ Weight/Piece: Peso/tallo
Search items by id, name or barcode: Buscar articulos por identificador, nombre o codigo de barras
SalesPerson: Comercial
Concept: Concepto
+Units/Box: Unidades/Caja
# Sections
Items: Artículos
@@ -61,4 +62,4 @@ Item diary: Registro de compra-venta
Last entries: Últimas entradas
Tags: Etiquetas
Waste breakdown: Desglose de mermas
-Waste breakdown by item: Desglose de mermas por artículo
\ No newline at end of file
+Waste breakdown by item: Desglose de mermas por artículo
diff --git a/modules/item/front/request-search-panel/index.spec.js b/modules/item/front/request-search-panel/index.spec.js
index 2fb339209..56c76eabf 100644
--- a/modules/item/front/request-search-panel/index.spec.js
+++ b/modules/item/front/request-search-panel/index.spec.js
@@ -15,7 +15,7 @@ describe(' Component vnRequestSearchPanel', () => {
it('should clear the scope days when setting the from property', () => {
controller.filter.scopeDays = 1;
- controller.from = new Date();
+ controller.from = Date.vnNew();
expect(controller.filter.scopeDays).toBeNull();
expect(controller.from).toBeDefined();
@@ -26,7 +26,7 @@ describe(' Component vnRequestSearchPanel', () => {
it('should clear the scope days when setting the to property', () => {
controller.filter.scopeDays = 1;
- controller.to = new Date();
+ controller.to = Date.vnNew();
expect(controller.filter.scopeDays).toBeNull();
expect(controller.to).toBeDefined();
@@ -35,8 +35,8 @@ describe(' Component vnRequestSearchPanel', () => {
describe('scopeDays() setter', () => {
it('should clear the date range when setting the scopeDays property', () => {
- controller.filter.from = new Date();
- controller.filter.to = new Date();
+ controller.filter.from = Date.vnNew();
+ controller.filter.to = Date.vnNew();
controller.scopeDays = 1;
diff --git a/modules/item/front/request/index.js b/modules/item/front/request/index.js
index 2fe08ada6..747cbeff2 100644
--- a/modules/item/front/request/index.js
+++ b/modules/item/front/request/index.js
@@ -7,10 +7,10 @@ export default class Controller extends Section {
super($element, $);
if (!this.$state.q) {
- const today = new Date();
+ const today = Date.vnNew();
today.setHours(0, 0, 0, 0);
- const nextWeek = new Date();
+ const nextWeek = Date.vnNew();
nextWeek.setHours(23, 59, 59, 59);
nextWeek.setDate(nextWeek.getDate() + 7);
@@ -27,7 +27,7 @@ export default class Controller extends Section {
$params.scopeDays = 1;
if (typeof $params.scopeDays === 'number') {
- const from = new Date();
+ const from = Date.vnNew();
from.setHours(0, 0, 0, 0);
const to = new Date(from.getTime());
@@ -82,7 +82,7 @@ export default class Controller extends Section {
}
compareDate(date) {
- let today = new Date();
+ let today = Date.vnNew();
today.setHours(0, 0, 0, 0);
let timeTicket = new Date(date);
timeTicket.setHours(0, 0, 0, 0);
diff --git a/modules/item/front/request/index.spec.js b/modules/item/front/request/index.spec.js
index 0fc061023..aadeaddca 100644
--- a/modules/item/front/request/index.spec.js
+++ b/modules/item/front/request/index.spec.js
@@ -93,7 +93,7 @@ describe('Item', () => {
});
it(`should return "warning" if date is today`, () => {
- let date = new Date();
+ let date = Date.vnNew();
let result = controller.compareDate(date);
expect(result).toEqual('warning');
diff --git a/modules/item/front/tags/index.html b/modules/item/front/tags/index.html
index c040b9984..f9b5370fa 100644
--- a/modules/item/front/tags/index.html
+++ b/modules/item/front/tags/index.html
@@ -19,7 +19,7 @@
data="tags"
auto-load="true">
-
\ No newline at end of file
+
diff --git a/modules/item/front/tags/index.js b/modules/item/front/tags/index.js
index 3b3cd58ef..bfa1f3f46 100644
--- a/modules/item/front/tags/index.js
+++ b/modules/item/front/tags/index.js
@@ -29,11 +29,17 @@ class Controller extends Section {
}
onSubmit() {
- this.$.watcher.check();
- this.$.model.save().then(() => {
+ const changes = this.$.model.getChanges();
+ const data = {
+ creates: changes.creates,
+ deletes: changes.deletes,
+ updates: changes.updates,
+ maxPriority: this.getHighestPriority()
+ };
+ this.$http.patch(`Tags/onSubmit`, data).then(() => {
+ this.$.model.refresh();
this.$.watcher.notifySaved();
this.$.watcher.updateOriginalData();
- this.card.reload();
});
}
}
diff --git a/modules/mdb/back/methods/mdbApp/lock.js b/modules/mdb/back/methods/mdbApp/lock.js
index 98e61fb53..a12a93814 100644
--- a/modules/mdb/back/methods/mdbApp/lock.js
+++ b/modules/mdb/back/methods/mdbApp/lock.js
@@ -51,7 +51,7 @@ module.exports = Self => {
const updatedMdbApp = await mdbApp.updateAttributes({
userFk: userId,
- locked: new Date()
+ locked: Date.vnNew()
}, myOptions);
if (tx) await tx.commit();
diff --git a/modules/mdb/back/methods/mdbVersion/last.js b/modules/mdb/back/methods/mdbVersion/last.js
new file mode 100644
index 000000000..5f89f10fb
--- /dev/null
+++ b/modules/mdb/back/methods/mdbVersion/last.js
@@ -0,0 +1,46 @@
+const UserError = require('vn-loopback/util/user-error');
+
+module.exports = Self => {
+ Self.remoteMethodCtx('last', {
+ description: 'Gets the latest version of a access file',
+ accepts: [
+ {
+ arg: 'appName',
+ type: 'string',
+ required: true,
+ description: 'The app name'
+ }
+ ],
+ returns: {
+ type: 'number',
+ root: true
+ },
+ http: {
+ path: `/:appName/last`,
+ verb: 'GET'
+ }
+ });
+
+ Self.last = async(ctx, appName) => {
+ const models = Self.app.models;
+ const versions = await models.MdbVersion.find({
+ where: {app: appName},
+ fields: ['version']
+ });
+
+ if (!versions.length)
+ throw new UserError('App name does not exist');
+
+ let maxNumber = 0;
+ for (let mdb of versions) {
+ if (mdb.version > maxNumber)
+ maxNumber = mdb.version;
+ }
+
+ let response = {
+ version: maxNumber
+ };
+
+ return response;
+ };
+};
diff --git a/modules/mdb/back/methods/mdbVersion/upload.js b/modules/mdb/back/methods/mdbVersion/upload.js
index 5dfe5d3ef..1df4365a9 100644
--- a/modules/mdb/back/methods/mdbVersion/upload.js
+++ b/modules/mdb/back/methods/mdbVersion/upload.js
@@ -11,20 +11,22 @@ module.exports = Self => {
type: 'string',
required: true,
description: 'The app name'
- },
- {
- arg: 'newVersion',
+ }, {
+ arg: 'toVersion',
type: 'number',
required: true,
description: `The new version number`
- },
- {
+ }, {
arg: 'branch',
type: 'string',
required: true,
description: `The branch name`
- },
- {
+ }, {
+ arg: 'fromVersion',
+ type: 'string',
+ required: true,
+ description: `The old version number`
+ }, {
arg: 'unlock',
type: 'boolean',
required: false,
@@ -41,16 +43,13 @@ module.exports = Self => {
}
});
- Self.upload = async(ctx, appName, newVersion, branch, unlock, options) => {
+ Self.upload = async(ctx, appName, toVersion, branch, fromVersion, unlock, options) => {
const models = Self.app.models;
- const userId = ctx.req.accessToken.userId;
const myOptions = {};
const $t = ctx.req.__; // $translate
-
const TempContainer = models.TempContainer;
const AccessContainer = models.AccessContainer;
const fileOptions = {};
-
let tx;
if (typeof options == 'object')
@@ -63,14 +62,28 @@ module.exports = Self => {
let srcFile;
try {
+ const userId = ctx.req.accessToken.userId;
const mdbApp = await models.MdbApp.findById(appName, null, myOptions);
- if (mdbApp.locked && mdbApp.userFk != userId) {
+ if (mdbApp && mdbApp.locked && mdbApp.userFk != userId) {
throw new UserError($t('App locked', {
userId: mdbApp.userFk
}));
}
+ const existBranch = await models.MdbBranch.findOne({
+ where: {name: branch}
+ }, myOptions);
+
+ if (!existBranch)
+ throw new UserError('Not exist this branch');
+
+ let lastMethod = await Self.last(ctx, appName, myOptions);
+ lastMethod.version++;
+
+ if (lastMethod.version != toVersion)
+ throw new UserError('Try again');
+
const tempContainer = await TempContainer.container('access');
const uploaded = await TempContainer.upload(tempContainer.name, ctx.req, ctx.result, fileOptions);
const files = Object.values(uploaded.files).map(file => {
@@ -83,7 +96,7 @@ module.exports = Self => {
const accessContainer = await AccessContainer.container('.archive');
const destinationFile = path.join(
- accessContainer.client.root, accessContainer.name, appName, `${newVersion}.7z`);
+ accessContainer.client.root, accessContainer.name, appName, `${toVersion}.7z`);
if (process.env.NODE_ENV == 'test')
await fs.unlink(srcFile);
@@ -104,7 +117,7 @@ module.exports = Self => {
await fs.mkdir(branchPath, {recursive: true});
const destinationBranch = path.join(branchPath, `${appName}.7z`);
- const destinationRelative = `../../.archive/${appName}/${newVersion}.7z`;
+ const destinationRelative = `../../.archive/${appName}/${toVersion}.7z`;
try {
await fs.unlink(destinationBranch);
} catch (e) {}
@@ -112,7 +125,7 @@ module.exports = Self => {
if (branch == 'master') {
const destinationRoot = path.join(accessContainer.client.root, `${appName}.7z`);
- const rootRelative = `./.archive/${appName}/${newVersion}.7z`;
+ const rootRelative = `./.archive/${appName}/${toVersion}.7z`;
try {
await fs.unlink(destinationRoot);
} catch (e) {}
@@ -120,10 +133,18 @@ module.exports = Self => {
}
}
+ await models.MdbVersionTree.create({
+ app: appName,
+ version: toVersion,
+ branchFk: branch,
+ fromVersion,
+ userFk: userId
+ }, myOptions);
+
await models.MdbVersion.upsert({
app: appName,
branchFk: branch,
- version: newVersion
+ version: toVersion
}, myOptions);
if (unlock) await models.MdbApp.unlock(ctx, appName, myOptions);
@@ -133,7 +154,7 @@ module.exports = Self => {
if (tx) await tx.rollback();
if (fs.existsSync(srcFile))
- await fs.unlink(srcFile);
+ fs.unlink(srcFile);
throw e;
}
diff --git a/modules/mdb/back/model-config.json b/modules/mdb/back/model-config.json
index 6107f8790..8010afca2 100644
--- a/modules/mdb/back/model-config.json
+++ b/modules/mdb/back/model-config.json
@@ -8,6 +8,9 @@
"MdbVersion": {
"dataSource": "vn"
},
+ "MdbVersionTree": {
+ "dataSource": "vn"
+ },
"AccessContainer": {
"dataSource": "accessStorage"
}
diff --git a/modules/mdb/back/models/mdbVersion.js b/modules/mdb/back/models/mdbVersion.js
index b36ee2a60..3a7a0c6f3 100644
--- a/modules/mdb/back/models/mdbVersion.js
+++ b/modules/mdb/back/models/mdbVersion.js
@@ -1,3 +1,4 @@
module.exports = Self => {
require('../methods/mdbVersion/upload')(Self);
+ require('../methods/mdbVersion/last')(Self);
};
diff --git a/modules/mdb/back/models/mdbVersionTree.json b/modules/mdb/back/models/mdbVersionTree.json
new file mode 100644
index 000000000..8c0260e54
--- /dev/null
+++ b/modules/mdb/back/models/mdbVersionTree.json
@@ -0,0 +1,35 @@
+{
+ "name": "MdbVersionTree",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "mdbVersionTree"
+ }
+ },
+ "properties": {
+ "app": {
+ "type": "string",
+ "description": "The app name",
+ "id": true
+ },
+ "version": {
+ "type": "number"
+ },
+ "branchFk": {
+ "type": "string"
+ },
+ "fromVersion": {
+ "type": "number"
+ },
+ "userFk": {
+ "type": "number"
+ }
+ },
+ "relations": {
+ "branch": {
+ "type": "belongsTo",
+ "model": "MdbBranch",
+ "foreignKey": "branchFk"
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/monitor/back/methods/sales-monitor/clientsFilter.js b/modules/monitor/back/methods/sales-monitor/clientsFilter.js
index 09ea24eb1..13e38f8e1 100644
--- a/modules/monitor/back/methods/sales-monitor/clientsFilter.js
+++ b/modules/monitor/back/methods/sales-monitor/clientsFilter.js
@@ -34,7 +34,7 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
- const date = new Date();
+ const date = Date.vnNew();
date.setHours(0, 0, 0, 0);
const stmt = new ParameterizedSQL(`
SELECT
@@ -51,7 +51,7 @@ module.exports = Self => {
JOIN account.user u ON c.salesPersonFk = u.id
LEFT JOIN sharingCart sc ON sc.workerFk = c.salesPersonFk
AND ? BETWEEN sc.started AND sc.ended
- LEFT JOIN workerTeamCollegues wtc
+ LEFT JOIN workerTeamCollegues wtc
ON wtc.collegueFk = IFNULL(sc.workerSubstitute, c.salesPersonFk)`,
[date]);
diff --git a/modules/monitor/back/methods/sales-monitor/salesFilter.js b/modules/monitor/back/methods/sales-monitor/salesFilter.js
index 7be130dda..881fc637a 100644
--- a/modules/monitor/back/methods/sales-monitor/salesFilter.js
+++ b/modules/monitor/back/methods/sales-monitor/salesFilter.js
@@ -104,7 +104,7 @@ module.exports = Self => {
const userId = ctx.req.accessToken.userId;
const conn = Self.dataSource.connector;
const models = Self.app.models;
- const date = new Date();
+ const date = Date.vnNew();
date.setHours(0, 0, 0, 0);
const args = ctx.args;
const myOptions = {};
diff --git a/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js b/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js
index bcb37830c..febfc5357 100644
--- a/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js
+++ b/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js
@@ -8,8 +8,8 @@ describe('SalesMonitor clientsFilter()', () => {
const options = {transaction: tx};
const ctx = {req: {accessToken: {userId: 18}}, args: {}};
- const from = new Date();
- const to = new Date();
+ const from = Date.vnNew();
+ const to = Date.vnNew();
from.setHours(0, 0, 0, 0);
to.setHours(23, 59, 59, 59);
@@ -35,9 +35,9 @@ describe('SalesMonitor clientsFilter()', () => {
try {
const options = {transaction: tx};
const ctx = {req: {accessToken: {userId: 18}}, args: {}};
- const yesterday = new Date();
+ const yesterday = Date.vnNew();
yesterday.setDate(yesterday.getDate() - 1);
- const today = new Date();
+ const today = Date.vnNew();
yesterday.setHours(0, 0, 0, 0);
today.setHours(23, 59, 59, 59);
diff --git a/modules/monitor/back/methods/sales-monitor/specs/salesFilter.spec.js b/modules/monitor/back/methods/sales-monitor/specs/salesFilter.spec.js
index d2e1a5bec..4e0fb85b7 100644
--- a/modules/monitor/back/methods/sales-monitor/specs/salesFilter.spec.js
+++ b/modules/monitor/back/methods/sales-monitor/specs/salesFilter.spec.js
@@ -26,9 +26,9 @@ describe('SalesMonitor salesFilter()', () => {
try {
const options = {transaction: tx};
- const yesterday = new Date();
+ const yesterday = Date.vnNew();
yesterday.setHours(0, 0, 0, 0);
- const today = new Date();
+ const today = Date.vnNew();
today.setHours(23, 59, 59, 59);
const ctx = {req: {accessToken: {userId: 9}}, args: {
@@ -54,10 +54,10 @@ describe('SalesMonitor salesFilter()', () => {
try {
const options = {transaction: tx};
- const yesterday = new Date();
+ const yesterday = Date.vnNew();
yesterday.setDate(yesterday.getDate() - 1);
yesterday.setHours(0, 0, 0, 0);
- const today = new Date();
+ const today = Date.vnNew();
today.setHours(23, 59, 59, 59);
const ctx = {req: {accessToken: {userId: 9}}, args: {
@@ -205,10 +205,10 @@ describe('SalesMonitor salesFilter()', () => {
try {
const options = {transaction: tx};
- const yesterday = new Date();
+ const yesterday = Date.vnNew();
yesterday.setDate(yesterday.getDate() - 1);
yesterday.setHours(0, 0, 0, 0);
- const today = new Date();
+ const today = Date.vnNew();
today.setHours(23, 59, 59, 59);
const ctx = {req: {accessToken: {userId: 18}}, args: {}};
@@ -234,10 +234,10 @@ describe('SalesMonitor salesFilter()', () => {
try {
const options = {transaction: tx};
- const yesterday = new Date();
+ const yesterday = Date.vnNew();
yesterday.setDate(yesterday.getDate() - 1);
yesterday.setHours(0, 0, 0, 0);
- const today = new Date();
+ const today = Date.vnNew();
today.setHours(23, 59, 59, 59);
const ctx = {req: {accessToken: {userId: 18}}, args: {}};
diff --git a/modules/monitor/front/index/clients/index.js b/modules/monitor/front/index/clients/index.js
index 58613f09d..ac3ce9140 100644
--- a/modules/monitor/front/index/clients/index.js
+++ b/modules/monitor/front/index/clients/index.js
@@ -5,7 +5,7 @@ export default class Controller extends Section {
constructor($element, $) {
super($element, $);
- const date = new Date();
+ const date = Date.vnNew();
this.dateFrom = date;
this.dateTo = date;
this.filter = {
@@ -64,9 +64,9 @@ export default class Controller extends Section {
let from = this.dateFrom;
let to = this.dateTo;
if (!from)
- from = new Date();
+ from = Date.vnNew();
if (!to)
- to = new Date();
+ to = Date.vnNew();
const minHour = new Date(from);
minHour.setHours(0, 0, 0, 0);
const maxHour = new Date(to);
diff --git a/modules/monitor/front/index/orders/index.js b/modules/monitor/front/index/orders/index.js
index e3a47f68b..40100b79f 100644
--- a/modules/monitor/front/index/orders/index.js
+++ b/modules/monitor/front/index/orders/index.js
@@ -26,7 +26,7 @@ export default class Controller extends Section {
}
chipColor(date) {
- const today = new Date();
+ const today = Date.vnNew();
today.setHours(0, 0, 0, 0);
const orderLanded = new Date(date);
diff --git a/modules/monitor/front/index/search-panel/index.spec.js b/modules/monitor/front/index/search-panel/index.spec.js
index f862e8d77..18cf1abfc 100644
--- a/modules/monitor/front/index/search-panel/index.spec.js
+++ b/modules/monitor/front/index/search-panel/index.spec.js
@@ -38,7 +38,7 @@ describe('Monitor Component vnMonitorSalesSearchPanel', () => {
it('should clear the scope days when setting the from property', () => {
controller.filter.scopeDays = 1;
- controller.from = new Date();
+ controller.from = Date.vnNew();
expect(controller.filter.scopeDays).toBeNull();
expect(controller.from).toBeDefined();
@@ -49,7 +49,7 @@ describe('Monitor Component vnMonitorSalesSearchPanel', () => {
it('should clear the scope days when setting the to property', () => {
controller.filter.scopeDays = 1;
- controller.to = new Date();
+ controller.to = Date.vnNew();
expect(controller.filter.scopeDays).toBeNull();
expect(controller.to).toBeDefined();
@@ -58,8 +58,8 @@ describe('Monitor Component vnMonitorSalesSearchPanel', () => {
describe('scopeDays() setter', () => {
it('should clear the date range when setting the scopeDays property', () => {
- controller.filter.from = new Date();
- controller.filter.to = new Date();
+ controller.filter.from = Date.vnNew();
+ controller.filter.to = Date.vnNew();
controller.scopeDays = 1;
diff --git a/modules/monitor/front/index/tickets/index.html b/modules/monitor/front/index/tickets/index.html
index 2f7c34e2d..b8559154e 100644
--- a/modules/monitor/front/index/tickets/index.html
+++ b/modules/monitor/front/index/tickets/index.html
@@ -79,51 +79,51 @@
@@ -133,64 +133,64 @@
- {{::ticket.id}}
+ {{ticket.id}}
|
- {{::ticket.nickname}}
+ {{ticket.nickname}}
|
- {{::ticket.userName | dashIfEmpty}}
+ {{ticket.userName | dashIfEmpty}}
|
-
- {{::ticket.shippedDate | date: 'dd/MM/yyyy'}}
+
+ {{ticket.shippedDate | date: 'dd/MM/yyyy'}}
|
- {{::ticket.zoneLanding | date: 'HH:mm'}} |
- {{::ticket.practicalHour | date: 'HH:mm'}} |
- {{::ticket.shipped | date: 'HH:mm'}} |
- {{::ticket.province}} |
+ {{ticket.zoneLanding | date: 'HH:mm'}} |
+ {{ticket.practicalHour | date: 'HH:mm'}} |
+ {{ticket.shipped | date: 'HH:mm'}} |
+ {{ticket.province}} |
- {{::ticket.refFk}}
+ {{ticket.refFk}}
- {{::ticket.state}}
+ ng-show="!ticket.refFk"
+ class="chip {{ticket.classColor}}">
+ {{ticket.state}}
|
- {{::ticket.zoneName | dashIfEmpty}}
+ {{ticket.zoneName | dashIfEmpty}}
|
-
- {{::(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}}
+
+ {{(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}}
|
{
let params = controller.fetchParams({
scopeDays: 2
});
- const from = new Date();
+ const from = Date.vnNew();
from.setHours(0, 0, 0, 0);
const to = new Date(from.getTime());
to.setDate(to.getDate() + params.scopeDays);
@@ -66,14 +66,14 @@ describe('Component vnMonitorSalesTickets', () => {
describe('compareDate()', () => {
it('should return warning when the date is the present', () => {
- let today = new Date();
+ let today = Date.vnNew();
let result = controller.compareDate(today);
expect(result).toEqual('warning');
});
it('should return sucess when the date is in the future', () => {
- let futureDate = new Date();
+ let futureDate = Date.vnNew();
futureDate = futureDate.setDate(futureDate.getDate() + 10);
let result = controller.compareDate(futureDate);
@@ -81,7 +81,7 @@ describe('Component vnMonitorSalesTickets', () => {
});
it('should return undefined when the date is in the past', () => {
- let pastDate = new Date();
+ let pastDate = Date.vnNew();
pastDate = pastDate.setDate(pastDate.getDate() - 10);
let result = controller.compareDate(pastDate);
@@ -99,7 +99,7 @@ describe('Component vnMonitorSalesTickets', () => {
describe('dateRange()', () => {
it('should return two dates with the hours at the start and end of the given date', () => {
- const now = new Date();
+ const now = Date.vnNew();
const today = now.getDate();
diff --git a/modules/order/back/methods/order/specs/new.spec.js b/modules/order/back/methods/order/specs/new.spec.js
index 5873189f8..f11367579 100644
--- a/modules/order/back/methods/order/specs/new.spec.js
+++ b/modules/order/back/methods/order/specs/new.spec.js
@@ -9,7 +9,7 @@ describe('order new()', () => {
try {
const options = {transaction: tx};
- const landed = new Date();
+ const landed = Date.vnNew();
const addressFk = 6;
const agencyModeFk = 1;
@@ -30,7 +30,7 @@ describe('order new()', () => {
try {
const options = {transaction: tx};
- const landed = new Date();
+ const landed = Date.vnNew();
const addressFk = 121;
const agencyModeFk = 1;
diff --git a/modules/order/front/basic-data/index.spec.js b/modules/order/front/basic-data/index.spec.js
index 01009d085..21dee0765 100644
--- a/modules/order/front/basic-data/index.spec.js
+++ b/modules/order/front/basic-data/index.spec.js
@@ -46,7 +46,7 @@ describe('Order', () => {
it('should set agencyModeFk to null and get the available agencies if the order has landed and client', async() => {
controller.order.agencyModeFk = 999;
controller.order.addressFk = 999;
- controller.order.landed = new Date();
+ controller.order.landed = Date.vnNew();
const expectedAgencies = [{id: 1}, {id: 2}];
diff --git a/modules/order/front/catalog/index.js b/modules/order/front/catalog/index.js
index 5fdd2e238..c0777ebc9 100644
--- a/modules/order/front/catalog/index.js
+++ b/modules/order/front/catalog/index.js
@@ -157,7 +157,7 @@ class Controller extends Section {
* Apply order to model
*/
applyOrder() {
- if (this.typeId || this.tagGroups.length > 0)
+ if (this.typeId || this.tagGroups.length > 0 || this.itemName)
this.$.model.addFilter(null, {orderBy: this.getOrderBy()});
}
diff --git a/modules/order/front/index/index.js b/modules/order/front/index/index.js
index a8e6e977e..750f2e226 100644
--- a/modules/order/front/index/index.js
+++ b/modules/order/front/index/index.js
@@ -8,7 +8,7 @@ export default class Controller extends Section {
}
compareDate(date) {
- let today = new Date();
+ let today = Date.vnNew();
today.setHours(0, 0, 0, 0);
date = new Date(date);
diff --git a/modules/order/front/index/index.spec.js b/modules/order/front/index/index.spec.js
index 5b85b3333..abe336478 100644
--- a/modules/order/front/index/index.spec.js
+++ b/modules/order/front/index/index.spec.js
@@ -26,14 +26,14 @@ describe('Component vnOrderIndex', () => {
describe('compareDate()', () => {
it('should return warning when the date is the present', () => {
- let curDate = new Date();
+ let curDate = Date.vnNew();
let result = controller.compareDate(curDate);
expect(result).toEqual('warning');
});
it('should return sucess when the date is in the future', () => {
- let futureDate = new Date();
+ let futureDate = Date.vnNew();
futureDate = futureDate.setDate(futureDate.getDate() + 10);
let result = controller.compareDate(futureDate);
@@ -41,7 +41,7 @@ describe('Component vnOrderIndex', () => {
});
it('should return undefined when the date is in the past', () => {
- let pastDate = new Date();
+ let pastDate = Date.vnNew();
pastDate = pastDate.setDate(pastDate.getDate() - 10);
let result = controller.compareDate(pastDate);
diff --git a/modules/route/back/methods/agency-term/filter.js b/modules/route/back/methods/agency-term/filter.js
index 0ecec7e88..9d1268958 100644
--- a/modules/route/back/methods/agency-term/filter.js
+++ b/modules/route/back/methods/agency-term/filter.js
@@ -74,35 +74,35 @@ module.exports = Self => {
filter = mergeFilters(filter, {where});
- const date = new Date();
+ const date = Date.vnNew();
date.setHours(0, 0, 0, 0);
const stmts = [];
const stmt = new ParameterizedSQL(
`SELECT *
FROM (
- SELECT r.id routeFk,
- r.created,
- r.agencyModeFk,
+ SELECT r.id routeFk,
+ r.created,
+ r.agencyModeFk,
am.name agencyModeName,
- am.agencyFk,
+ am.agencyFk,
a.name agencyAgreement,
SUM(t.packages) packages,
r.m3,
- r.kmEnd - r.kmStart kmTotal,
- CAST(IFNULL(sat.routePrice,
- (sat.kmPrice * (GREATEST(r.kmEnd - r.kmStart , sat.minimumKm))
- + GREATEST(r.m3 , sat.minimumM3) * sat.m3Price)
- + sat.packagePrice * SUM(t.packages) )
+ r.kmEnd - r.kmStart kmTotal,
+ CAST(IFNULL(sat.routePrice,
+ (sat.kmPrice * (GREATEST(r.kmEnd - r.kmStart , sat.minimumKm))
+ + GREATEST(r.m3 , sat.minimumM3) * sat.m3Price)
+ + sat.packagePrice * SUM(t.packages) )
AS DECIMAL(10,2)) price,
r.invoiceInFk,
sat.supplierFk,
s.name supplierName
FROM vn.route r
- LEFT JOIN vn.agencyMode am ON r.agencyModeFk = am.id
+ LEFT JOIN vn.agencyMode am ON r.agencyModeFk = am.id
LEFT JOIN vn.agency a ON am.agencyFk = a.id
LEFT JOIN vn.ticket t ON t.routeFk = r.id
LEFT JOIN vn.supplierAgencyTerm sat ON sat.agencyFk = a.id
- LEFT JOIN vn.supplier s ON s.id = sat.supplierFk
+ LEFT JOIN vn.supplier s ON s.id = sat.supplierFk
WHERE r.created > DATE_ADD(?, INTERVAL -2 MONTH) AND sat.supplierFk IS NOT NULL
GROUP BY r.id
) a`
diff --git a/modules/route/back/methods/agency-term/specs/filter.spec.js b/modules/route/back/methods/agency-term/specs/filter.spec.js
index d6c00e585..41e696157 100644
--- a/modules/route/back/methods/agency-term/specs/filter.spec.js
+++ b/modules/route/back/methods/agency-term/specs/filter.spec.js
@@ -3,7 +3,7 @@ const models = require('vn-loopback/server/server').models;
describe('AgencyTerm filter()', () => {
const authUserId = 9;
- const today = new Date();
+ const today = Date.vnNew();
today.setHours(2, 0, 0, 0);
it('should return all results matching the filter', async() => {
@@ -57,10 +57,10 @@ describe('AgencyTerm filter()', () => {
const options = {transaction: tx};
try {
- const from = new Date();
+ const from = Date.vnNew();
from.setHours(0, 0, 0, 0);
- const to = new Date();
+ const to = Date.vnNew();
to.setHours(23, 59, 59, 999);
const ctx = {
diff --git a/modules/route/back/methods/route/downloadZip.js b/modules/route/back/methods/route/downloadZip.js
new file mode 100644
index 000000000..597f1d1f6
--- /dev/null
+++ b/modules/route/back/methods/route/downloadZip.js
@@ -0,0 +1,62 @@
+const JSZip = require('jszip');
+
+module.exports = Self => {
+ Self.remoteMethodCtx('downloadZip', {
+ description: 'Download a zip file with multiple routes pdfs',
+ accessType: 'READ',
+ accepts: [
+ {
+ arg: 'id',
+ type: 'string',
+ description: 'The routes ids',
+ }
+ ],
+ returns: [
+ {
+ arg: 'body',
+ type: 'file',
+ root: true
+ }, {
+ arg: 'Content-Type',
+ type: 'string',
+ http: {target: 'header'}
+ }, {
+ arg: 'Content-Disposition',
+ type: 'string',
+ http: {target: 'header'}
+ }
+ ],
+ http: {
+ path: '/downloadZip',
+ verb: 'GET'
+ }
+ });
+
+ Self.downloadZip = async function(ctx, id, options) {
+ const models = Self.app.models;
+ const myOptions = {};
+ const zip = new JSZip();
+
+ if (typeof options == 'object')
+ Object.assign(myOptions, options);
+
+ const ids = id.split(',');
+ for (let id of ids) {
+ ctx.args.id = id;
+ const routePdf = await models.Route.driverRoutePdf(ctx, id);
+ const fileName = extractFileName(routePdf[2]);
+ const body = routePdf[0];
+
+ zip.file(fileName, body);
+ }
+
+ const stream = zip.generateNodeStream({streamFiles: true});
+
+ return [stream, 'application/zip', `filename="download.zip"`];
+ };
+
+ function extractFileName(str) {
+ const matches = str.match(/"(.*?)"/);
+ return matches ? matches[1] : str;
+ }
+};
diff --git a/modules/route/back/methods/route/getTickets.js b/modules/route/back/methods/route/getTickets.js
index 708644c1a..1eb9e27f5 100644
--- a/modules/route/back/methods/route/getTickets.js
+++ b/modules/route/back/methods/route/getTickets.js
@@ -50,14 +50,17 @@ module.exports = Self => {
am.name AS agencyModeName,
u.nickname AS userNickname,
vn.ticketTotalVolume(t.id) AS volume,
- tob.description
+ tob.description,
+ GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt
FROM vn.route r
JOIN ticket t ON t.routeFk = r.id
+ JOIN vn.sale s ON s.ticketFk = t.id
+ JOIN vn.item i ON i.id = s.itemFk
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
LEFT JOIN state st ON st.id = ts.stateFk
LEFT JOIN warehouse wh ON wh.id = t.warehouseFk
LEFT JOIN observationType ot ON ot.code = 'delivery'
- LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id
+ LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id
AND tob.observationTypeFk = ot.id
LEFT JOIN address a ON a.id = t.addressFk
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
@@ -70,7 +73,9 @@ module.exports = Self => {
const where = filter.where;
where['r.id'] = filter.id;
- stmt.merge(conn.makeSuffix(filter));
+ stmt.merge(conn.makeWhere(filter.where));
+ stmt.merge(conn.makeGroupBy('t.id'));
+ stmt.merge(conn.makeOrderBy(filter.order));
const tickets = await conn.executeStmt(stmt, myOptions);
diff --git a/modules/route/back/methods/route/specs/clone.spec.js b/modules/route/back/methods/route/specs/clone.spec.js
index d1fc6b297..9192854f8 100644
--- a/modules/route/back/methods/route/specs/clone.spec.js
+++ b/modules/route/back/methods/route/specs/clone.spec.js
@@ -1,7 +1,7 @@
const app = require('vn-loopback/server/server');
describe('route clone()', () => {
- const createdDate = new Date();
+ const createdDate = Date.vnNew();
it('should throw an error if the amount of ids pased to the clone function do no match the database', async() => {
const ids = [996, 997, 998, 999];
diff --git a/modules/route/back/methods/route/specs/filter.spec.js b/modules/route/back/methods/route/specs/filter.spec.js
index 9d481f21e..18c0ca04f 100644
--- a/modules/route/back/methods/route/specs/filter.spec.js
+++ b/modules/route/back/methods/route/specs/filter.spec.js
@@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
const models = require('vn-loopback/server/server').models;
describe('Route filter()', () => {
- const today = new Date();
+ const today = Date.vnNew();
today.setHours(2, 0, 0, 0);
it('should return the routes matching "search"', async() => {
@@ -23,10 +23,10 @@ describe('Route filter()', () => {
const options = {transaction: tx};
try {
- const from = new Date();
+ const from = Date.vnNew();
from.setHours(0, 0, 0, 0);
- const to = new Date();
+ const to = Date.vnNew();
to.setHours(23, 59, 59, 999);
const ctx = {
args: {
diff --git a/modules/route/back/methods/route/specs/getSuggestedTickets.spec.js b/modules/route/back/methods/route/specs/getSuggestedTickets.spec.js
index bb38cb50e..0acc6c1a7 100644
--- a/modules/route/back/methods/route/specs/getSuggestedTickets.spec.js
+++ b/modules/route/back/methods/route/specs/getSuggestedTickets.spec.js
@@ -23,7 +23,7 @@ describe('route getSuggestedTickets()', () => {
await ticketInRoute.updateAttributes({
routeFk: null,
- landed: new Date()
+ landed: Date.vnNew()
}, options);
const result = await models.Route.getSuggestedTickets(routeID, options);
diff --git a/modules/route/back/methods/route/specs/insertTicket.spec.js b/modules/route/back/methods/route/specs/insertTicket.spec.js
index 7c60e755f..19d02e1ef 100644
--- a/modules/route/back/methods/route/specs/insertTicket.spec.js
+++ b/modules/route/back/methods/route/specs/insertTicket.spec.js
@@ -23,7 +23,7 @@ describe('route insertTicket()', () => {
const ticketInRoute = await app.models.Ticket.findById(ticketId, null, options);
await ticketInRoute.updateAttributes({
routeFk: null,
- landed: new Date()
+ landed: Date.vnNew()
}, options);
const result = await app.models.Route.insertTicket(routeId, ticketId, options);
diff --git a/modules/route/back/methods/route/updateWorkCenter.js b/modules/route/back/methods/route/updateWorkCenter.js
index 7796fba41..75169ce7e 100644
--- a/modules/route/back/methods/route/updateWorkCenter.js
+++ b/modules/route/back/methods/route/updateWorkCenter.js
@@ -33,12 +33,13 @@ module.exports = Self => {
}
try {
+ const date = Date.vnNew();
const [result] = await Self.rawSql(`
SELECT IFNULL(wl.workCenterFk, r.defaultWorkCenterFk) AS commissionWorkCenter
FROM vn.routeConfig r
LEFT JOIN vn.workerLabour wl ON wl.workerFk = ?
- AND CURDATE() BETWEEN wl.started AND IFNULL(wl.ended, CURDATE());
- `, [userId], myOptions);
+ AND ? BETWEEN wl.started AND IFNULL(wl.ended, ?);
+ `, [userId, date, date], myOptions);
const route = await models.Route.findById(id, null, myOptions);
await route.updateAttribute('commissionWorkCenterFk', result.commissionWorkCenter, myOptions);
diff --git a/modules/route/back/models/route.js b/modules/route/back/models/route.js
index 08cabd30e..883f4597e 100644
--- a/modules/route/back/models/route.js
+++ b/modules/route/back/models/route.js
@@ -13,6 +13,7 @@ module.exports = Self => {
require('../methods/route/driverRoutePdf')(Self);
require('../methods/route/driverRouteEmail')(Self);
require('../methods/route/sendSms')(Self);
+ require('../methods/route/downloadZip')(Self);
Self.validate('kmStart', validateDistance, {
message: 'Distance must be lesser than 1000'
diff --git a/modules/route/front/index/index.js b/modules/route/front/index/index.js
index 9258c8fac..7c19a26cd 100644
--- a/modules/route/front/index/index.js
+++ b/modules/route/front/index/index.js
@@ -34,17 +34,27 @@ export default class Controller extends Section {
}
showRouteReport() {
- const routes = [];
+ const routesIds = [];
for (let route of this.checked)
- routes.push(route.id);
- const routesId = routes.join(',');
+ routesIds.push(route.id);
+ const stringRoutesIds = routesIds.join(',');
- this.vnReport.show(`Routes/${routesId}/driver-route-pdf`);
+ if (this.checked.length <= 1) {
+ const url = `api/Routes/${stringRoutesIds}/driver-route-pdf?access_token=${this.vnToken.token}`;
+ window.open(url, '_blank');
+ } else {
+ const serializedParams = this.$httpParamSerializer({
+ access_token: this.vnToken.token,
+ id: stringRoutesIds
+ });
+ const url = `api/Routes/downloadZip?${serializedParams}`;
+ window.open(url, '_blank');
+ }
}
openClonationDialog() {
this.$.clonationDialog.show();
- this.createdDate = new Date();
+ this.createdDate = Date.vnNew();
}
cloneSelectedRoutes() {
diff --git a/modules/route/front/index/index.spec.js b/modules/route/front/index/index.spec.js
index 05dd56433..399ece714 100644
--- a/modules/route/front/index/index.spec.js
+++ b/modules/route/front/index/index.spec.js
@@ -44,23 +44,21 @@ describe('Component vnRouteIndex', () => {
describe('showRouteReport()', () => {
it('should call to the vnReport show method', () => {
- controller.vnReport.show = jest.fn();
+ jest.spyOn(window, 'open').mockReturnThis();
const data = controller.$.model.data;
data[0].checked = true;
data[2].checked = true;
- const routeIds = '1,3';
-
controller.showRouteReport();
- expect(controller.vnReport.show).toHaveBeenCalledWith(`Routes/${routeIds}/driver-route-pdf`);
+ expect(window.open).toHaveBeenCalled();
});
});
describe('cloneSelectedRoutes()', () => {
it('should perform an http request to Routes/clone', () => {
- controller.createdDate = new Date();
+ controller.createdDate = Date.vnNew();
$httpBackend.expect('POST', 'Routes/clone').respond();
controller.cloneSelectedRoutes();
diff --git a/modules/route/front/main/index.js b/modules/route/front/main/index.js
index 938f81bcc..8c57bbad6 100644
--- a/modules/route/front/main/index.js
+++ b/modules/route/front/main/index.js
@@ -3,11 +3,11 @@ import ModuleMain from 'salix/components/module-main';
export default class Route extends ModuleMain {
$postLink() {
- const to = new Date();
+ const to = Date.vnNew();
to.setDate(to.getDate() + 1);
to.setHours(0, 0, 0, 0);
- const from = new Date();
+ const from = Date.vnNew();
from.setDate(from.getDate());
from.setHours(0, 0, 0, 0);
@@ -21,7 +21,7 @@ export default class Route extends ModuleMain {
$params.scopeDays = 1;
if (typeof $params.scopeDays === 'number') {
- const from = new Date();
+ const from = Date.vnNew();
from.setHours(0, 0, 0, 0);
const to = new Date(from.getTime());
diff --git a/modules/route/front/main/index.spec.js b/modules/route/front/main/index.spec.js
index e5724b493..0c16a7b1f 100644
--- a/modules/route/front/main/index.spec.js
+++ b/modules/route/front/main/index.spec.js
@@ -15,7 +15,7 @@ describe('Route Component vnRoute', () => {
let params = controller.fetchParams({
scopeDays: 2
});
- const from = new Date();
+ const from = Date.vnNew();
from.setHours(0, 0, 0, 0);
const to = new Date(from.getTime());
to.setDate(to.getDate() + params.scopeDays);
diff --git a/modules/route/front/search-panel/index.spec.js b/modules/route/front/search-panel/index.spec.js
index 16e1a5cfc..ae15e16e4 100644
--- a/modules/route/front/search-panel/index.spec.js
+++ b/modules/route/front/search-panel/index.spec.js
@@ -15,7 +15,7 @@ describe('Route Component vnRouteSearchPanel', () => {
it('should clear the scope days when setting the from property', () => {
controller.filter.scopeDays = 1;
- controller.from = new Date();
+ controller.from = Date.vnNew();
expect(controller.filter.scopeDays).toBeNull();
expect(controller.from).toBeDefined();
@@ -26,7 +26,7 @@ describe('Route Component vnRouteSearchPanel', () => {
it('should clear the scope days when setting the to property', () => {
controller.filter.scopeDays = 1;
- controller.to = new Date();
+ controller.to = Date.vnNew();
expect(controller.filter.scopeDays).toBeNull();
expect(controller.to).toBeDefined();
@@ -35,8 +35,8 @@ describe('Route Component vnRouteSearchPanel', () => {
describe('scopeDays() setter', () => {
it('should clear the date range when setting the scopeDays property', () => {
- controller.filter.from = new Date();
- controller.filter.to = new Date();
+ controller.filter.from = Date.vnNew();
+ controller.filter.to = Date.vnNew();
controller.scopeDays = 1;
diff --git a/modules/route/front/sms/index.js b/modules/route/front/sms/index.js
index d8b1fc134..f466adea7 100644
--- a/modules/route/front/sms/index.js
+++ b/modules/route/front/sms/index.js
@@ -26,7 +26,7 @@ class Controller extends Component {
throw new Error(`The message it's too long`);
this.$http.post(`Routes/sendSms`, this.sms).then(res => {
- this.vnApp.showMessage(this.$t('SMS sent!'));
+ this.vnApp.showMessage(this.$t('SMS sent'));
if (res.data) this.emit('send', {response: res.data});
});
diff --git a/modules/route/front/sms/index.spec.js b/modules/route/front/sms/index.spec.js
index 42bf30931..8bf35e673 100644
--- a/modules/route/front/sms/index.spec.js
+++ b/modules/route/front/sms/index.spec.js
@@ -30,7 +30,7 @@ describe('Route', () => {
controller.onResponse();
$httpBackend.flush();
- expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent!');
+ expect(controller.vnApp.showMessage).toHaveBeenCalledWith('SMS sent');
});
it('should call onResponse without the destination and show an error snackbar', () => {
diff --git a/modules/route/front/summary/index.html b/modules/route/front/summary/index.html
index 86f558634..a64ad4ff7 100644
--- a/modules/route/front/summary/index.html
+++ b/modules/route/front/summary/index.html
@@ -10,26 +10,26 @@
-
-
-
-
-
{{$ctrl.summary.route.worker.user.name}}
-
@@ -40,35 +40,35 @@
-
-
-
-
-
Ticket
@@ -77,45 +77,49 @@
Order
- Ticket id
- Alias
+ Street
+ City
+ PC
+ Client
+ Warehouse
Packages
m³
- Warehouse
- PC
- Street
+ Packaging
+ Ticket
{{ticket.priority | dashIfEmpty}}
+ {{ticket.street}}
+ {{ticket.city}}
+ {{ticket.postalCode}}
+
+
+ {{ticket.nickname}}
+
+
+ {{ticket.warehouseName}}
+ {{ticket.packages}}
+ {{ticket.volume}}
+ {{ticket.ipt}}
-
{{ticket.id}}
-
- {{ticket.nickname}}
-
-
- {{ticket.packages}}
- {{ticket.volume}}
- {{ticket.warehouseName}}
- {{ticket.postalCode}}
- {{ticket.street}}
-
-
-
+
+
@@ -123,12 +127,12 @@
-
-
diff --git a/modules/route/front/tickets/index.html b/modules/route/front/tickets/index.html
index dae894ac7..18d6fb160 100644
--- a/modules/route/front/tickets/index.html
+++ b/modules/route/front/tickets/index.html
@@ -6,9 +6,9 @@
data="$ctrl.tickets"
auto-load="true">
-
-
-
-
@@ -160,7 +164,7 @@
-
-
-
\ No newline at end of file
+
diff --git a/modules/shelving/front/routes.json b/modules/shelving/front/routes.json
index 09a8e389b..4059e5095 100644
--- a/modules/shelving/front/routes.json
+++ b/modules/shelving/front/routes.json
@@ -1,12 +1,12 @@
{
"module": "shelving",
"name": "Shelvings",
- "icon" : "contact_support",
+ "icon" : "icon-inventory",
"dependencies": ["worker"],
"validations" : true,
"menus": {
"main": [
- {"state": "shelving.index", "icon": "contact_support"}
+ {"state": "shelving.index", "icon": "icon-inventory"}
],
"card": [
{"state": "shelving.card.basicData", "icon": "settings"},
@@ -20,7 +20,7 @@
"abstract": true,
"component": "vn-shelving",
"description": "Shelvings"
- },
+ },
{
"url": "/index?q",
"state": "shelving.index",
@@ -32,13 +32,13 @@
"state": "shelving.create",
"component": "vn-shelving-create",
"description": "New shelving"
- },
+ },
{
"url": "/:id",
"state": "shelving.card",
"abstract": true,
"component": "vn-shelving-card"
- },
+ },
{
"url": "/summary",
"state": "shelving.card.summary",
@@ -47,7 +47,7 @@
"params": {
"shelving": "$ctrl.shelving"
}
- },
+ },
{
"url": "/basic-data",
"state": "shelving.card.basicData",
@@ -56,7 +56,7 @@
"params": {
"shelving": "$ctrl.shelving"
}
- },
+ },
{
"url" : "/log",
"state": "shelving.card.log",
@@ -64,4 +64,4 @@
"description": "Log"
}
]
-}
\ No newline at end of file
+}
diff --git a/modules/supplier/back/models/supplier.js b/modules/supplier/back/models/supplier.js
index 44549c65c..4e509aafc 100644
--- a/modules/supplier/back/models/supplier.js
+++ b/modules/supplier/back/models/supplier.js
@@ -16,10 +16,6 @@ module.exports = Self => {
message: 'The social name cannot be empty'
});
- Self.validatesUniquenessOf('name', {
- message: 'The supplier name must be unique'
- });
-
if (this.city) {
Self.validatesPresenceOf('city', {
message: 'City cannot be empty'
@@ -117,6 +113,27 @@ module.exports = Self => {
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) {
const changes = ctx.data || ctx.instance;
const orgData = ctx.currentInstance;
diff --git a/modules/supplier/front/agency-term/index/index.html b/modules/supplier/front/agency-term/index/index.html
index 9d53226c5..44c6deba9 100644
--- a/modules/supplier/front/agency-term/index/index.html
+++ b/modules/supplier/front/agency-term/index/index.html
@@ -24,36 +24,42 @@
diff --git a/modules/supplier/front/consumption/index.js b/modules/supplier/front/consumption/index.js
index 8de6a1e71..9af0d1747 100644
--- a/modules/supplier/front/consumption/index.js
+++ b/modules/supplier/front/consumption/index.js
@@ -11,11 +11,11 @@ class Controller extends Section {
}
setDefaultFilter() {
- const minDate = new Date();
+ const minDate = Date.vnNew();
minDate.setHours(0, 0, 0, 0);
minDate.setMonth(minDate.getMonth() - 2);
- const maxDate = new Date();
+ const maxDate = Date.vnNew();
maxDate.setHours(23, 59, 59, 59);
this.filterParams = {
diff --git a/modules/supplier/front/consumption/index.spec.js b/modules/supplier/front/consumption/index.spec.js
index ebf19ccec..0ac531a68 100644
--- a/modules/supplier/front/consumption/index.spec.js
+++ b/modules/supplier/front/consumption/index.spec.js
@@ -28,7 +28,7 @@ describe('Supplier', () => {
it('should call the window.open function', () => {
jest.spyOn(window, 'open').mockReturnThis();
- const now = new Date();
+ const now = Date.vnNew();
controller.$.model.userParams = {
from: now,
to: now
@@ -86,7 +86,7 @@ describe('Supplier', () => {
{id: 1, email: 'batman@gothamcity.com'}
]);
- const now = new Date();
+ const now = Date.vnNew();
controller.$.model.userParams = {
from: now,
to: now
diff --git a/modules/supplier/front/descriptor/index.js b/modules/supplier/front/descriptor/index.js
index a26d9c510..9f23ce68c 100644
--- a/modules/supplier/front/descriptor/index.js
+++ b/modules/supplier/front/descriptor/index.js
@@ -13,7 +13,7 @@ class Controller extends Descriptor {
get entryFilter() {
if (!this.supplier) return null;
- const date = new Date();
+ const date = Date.vnNew();
date.setHours(0, 0, 0, 0);
const from = new Date(date.getTime());
diff --git a/modules/ticket/back/methods/expedition/specs/moveExpeditions.spec.js b/modules/ticket/back/methods/expedition/specs/moveExpeditions.spec.js
index 67919e76c..ac397d38e 100644
--- a/modules/ticket/back/methods/expedition/specs/moveExpeditions.spec.js
+++ b/modules/ticket/back/methods/expedition/specs/moveExpeditions.spec.js
@@ -14,7 +14,7 @@ describe('ticket moveExpeditions()', () => {
const options = {transaction: tx};
myCtx.args = {
clientId: 1101,
- landed: new Date(),
+ landed: Date.vnNew(),
warehouseId: 1,
addressId: 121,
agencyModeId: 1,
diff --git a/modules/ticket/back/methods/sale-tracking/listSaleTracking.js b/modules/ticket/back/methods/sale-tracking/listSaleTracking.js
index c0d63ef62..98743d8cc 100644
--- a/modules/ticket/back/methods/sale-tracking/listSaleTracking.js
+++ b/modules/ticket/back/methods/sale-tracking/listSaleTracking.js
@@ -36,7 +36,7 @@ module.exports = Self => {
st.originalQuantity,
st.created,
st.workerFk,
- u.nickname userNickname,
+ u.name,
ste.name AS state
FROM saleTracking st
JOIN sale s ON s.id = st.saleFk
@@ -48,24 +48,6 @@ module.exports = Self => {
const trackings = await Self.rawStmt(stmt, myOptions);
- const salesFilter = {
- include: [
- {
- relation: 'item'
- }
- ],
- where: {ticketFk: filter.where.ticketFk}
- };
-
- const sales = await Self.app.models.Sale.find(salesFilter, myOptions);
-
- for (const tracking of trackings) {
- for (const sale of sales) {
- if (tracking.itemFk == sale.itemFk)
- tracking.item = sale.item();
- }
- }
-
return trackings;
};
};
diff --git a/modules/ticket/back/methods/sale/canEdit.js b/modules/ticket/back/methods/sale/canEdit.js
index f44bd6743..3091ebca7 100644
--- a/modules/ticket/back/methods/sale/canEdit.js
+++ b/modules/ticket/back/methods/sale/canEdit.js
@@ -56,6 +56,13 @@ module.exports = Self => {
const shouldEditCloned = canEditCloned || !hasSaleCloned;
const shouldEditFloramondo = canEditFloramondo || !hasSaleFloramondo;
- return shouldEditTracked && shouldEditCloned && shouldEditFloramondo;
+ if (!shouldEditTracked)
+ throw new UserError('It is not possible to modify tracked sales');
+ if (!shouldEditCloned)
+ throw new UserError('It is not possible to modify cloned sales');
+ if (!shouldEditFloramondo)
+ throw new UserError('It is not possible to modify sales that their articles are from Floramondo');
+
+ return true;
};
};
diff --git a/modules/ticket/back/methods/sale/deleteSales.js b/modules/ticket/back/methods/sale/deleteSales.js
index c045b9197..5d1463a66 100644
--- a/modules/ticket/back/methods/sale/deleteSales.js
+++ b/modules/ticket/back/methods/sale/deleteSales.js
@@ -43,9 +43,7 @@ module.exports = Self => {
try {
const saleIds = sales.map(sale => sale.id);
- const canEditSales = await models.Sale.canEdit(ctx, saleIds, myOptions);
- if (!canEditSales)
- throw new UserError(`Sale(s) blocked, please contact production`);
+ await models.Sale.canEdit(ctx, saleIds, myOptions);
const ticket = await models.Ticket.findById(ticketId, {
include: {
diff --git a/modules/ticket/back/methods/sale/getClaimableFromTicket.js b/modules/ticket/back/methods/sale/getClaimableFromTicket.js
index ecbc52b94..c51781f59 100644
--- a/modules/ticket/back/methods/sale/getClaimableFromTicket.js
+++ b/modules/ticket/back/methods/sale/getClaimableFromTicket.js
@@ -24,24 +24,24 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
- const date = new Date();
+ const date = Date.vnNew();
date.setHours(0, 0, 0, 0);
const query = `
- SELECT
- s.id AS saleFk,
- t.id AS ticketFk,
+ SELECT
+ s.id AS saleFk,
+ t.id AS ticketFk,
t.landed,
- s.concept,
- s.itemFk,
- s.quantity,
- s.price,
- s.discount,
+ s.concept,
+ s.itemFk,
+ s.quantity,
+ s.price,
+ s.discount,
t.nickname
- FROM vn.ticket t
+ FROM vn.ticket t
INNER JOIN vn.sale s ON s.ticketFk = t.id
LEFT JOIN vn.claimBeginning cb ON cb.saleFk = s.id
- WHERE (t.landed) >= TIMESTAMPADD(DAY, -7, ?)
+ WHERE (t.landed) >= TIMESTAMPADD(DAY, -7, ?)
AND t.id = ? AND cb.id IS NULL
ORDER BY t.landed DESC, t.id DESC`;
diff --git a/modules/ticket/back/methods/sale/recalculatePrice.js b/modules/ticket/back/methods/sale/recalculatePrice.js
index 38c68d7f6..2c8e6768b 100644
--- a/modules/ticket/back/methods/sale/recalculatePrice.js
+++ b/modules/ticket/back/methods/sale/recalculatePrice.js
@@ -37,9 +37,7 @@ module.exports = Self => {
try {
const salesIds = sales.map(sale => sale.id);
- const canEditSale = await models.Sale.canEdit(ctx, salesIds, myOptions);
- if (!canEditSale)
- throw new UserError(`Sale(s) blocked, please contact production`);
+ await models.Sale.canEdit(ctx, salesIds, myOptions);
const query = `
DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales;
diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js
index c0c431636..febef9730 100644
--- a/modules/ticket/back/methods/sale/refund.js
+++ b/modules/ticket/back/methods/sale/refund.js
@@ -64,7 +64,7 @@ module.exports = Self => {
const refundTickets = [];
- const now = new Date();
+ const now = Date.vnNew();
const mappedTickets = new Map();
for (let ticketId of ticketsIds) {
diff --git a/modules/ticket/back/methods/sale/reserve.js b/modules/ticket/back/methods/sale/reserve.js
index 648e6de23..2dc368af6 100644
--- a/modules/ticket/back/methods/sale/reserve.js
+++ b/modules/ticket/back/methods/sale/reserve.js
@@ -51,9 +51,7 @@ module.exports = Self => {
try {
const salesIds = sales.map(sale => sale.id);
- const canEditSale = await models.Sale.canEdit(ctx, salesIds, myOptions);
- if (!canEditSale)
- throw new UserError(`Sale(s) blocked, please contact production`);
+ await models.Sale.canEdit(ctx, salesIds, myOptions);
let changesMade = '';
const promises = [];
diff --git a/modules/ticket/back/methods/sale/salePreparingList.js b/modules/ticket/back/methods/sale/salePreparingList.js
new file mode 100644
index 000000000..e6e7d5164
--- /dev/null
+++ b/modules/ticket/back/methods/sale/salePreparingList.js
@@ -0,0 +1,33 @@
+module.exports = Self => {
+ Self.remoteMethodCtx('salePreparingList', {
+ description: 'Returns a list with the lines of a ticket and its different states of preparation',
+ accessType: 'READ',
+ accepts: [{
+ arg: 'id',
+ type: 'number',
+ required: true,
+ description: 'The ticket id',
+ http: {source: 'path'}
+ }],
+ returns: {
+ type: ['object'],
+ root: true
+ },
+ http: {
+ path: `/:id/salePreparingList`,
+ verb: 'GET'
+ }
+ });
+
+ Self.salePreparingList = async(ctx, id, options) => {
+ const myOptions = {};
+
+ if (typeof options == 'object')
+ Object.assign(myOptions, options);
+
+ query = `CALL vn.salePreparingList(?)`;
+ const [sales] = await Self.rawSql(query, [id], myOptions);
+
+ return sales;
+ };
+};
diff --git a/modules/ticket/back/methods/sale/specs/canEdit.spec.js b/modules/ticket/back/methods/sale/specs/canEdit.spec.js
index 2aa873df5..58d8f0635 100644
--- a/modules/ticket/back/methods/sale/specs/canEdit.spec.js
+++ b/modules/ticket/back/methods/sale/specs/canEdit.spec.js
@@ -50,7 +50,7 @@ describe('sale canEdit()', () => {
it('should return false if any of the sales has a saleTracking record', async() => {
const tx = await models.Sale.beginTransaction({});
-
+ let error;
try {
const options = {transaction: tx};
@@ -59,15 +59,15 @@ describe('sale canEdit()', () => {
const sales = [31];
- const result = await models.Sale.canEdit(ctx, sales, options);
-
- expect(result).toEqual(false);
-
+ await models.Sale.canEdit(ctx, sales, options);
await tx.rollback();
} catch (e) {
await tx.rollback();
- throw e;
+ error = e;
}
+
+ expect(error).toEqual(
+ new Error('It is not possible to modify tracked sales'));
});
});
@@ -75,22 +75,22 @@ describe('sale canEdit()', () => {
const saleCloned = [29];
it('should return false if any of the sales is cloned', async() => {
const tx = await models.Sale.beginTransaction({});
-
+ let error;
try {
const options = {transaction: tx};
const buyerId = 35;
const ctx = {req: {accessToken: {userId: buyerId}}};
- const result = await models.Sale.canEdit(ctx, saleCloned, options);
-
- expect(result).toEqual(false);
-
+ await models.Sale.canEdit(ctx, saleCloned, options);
await tx.rollback();
} catch (e) {
await tx.rollback();
- throw e;
+ error = e;
}
+
+ expect(error).toEqual(
+ new Error('It is not possible to modify cloned sales'));
});
it('should return true if any of the sales is cloned and has the correct role', async() => {
@@ -130,7 +130,7 @@ describe('sale canEdit()', () => {
it('should return false if any of the sales isFloramondo', async() => {
const tx = await models.Sale.beginTransaction({});
const sales = [26];
-
+ let error;
try {
const options = {transaction: tx};
@@ -140,15 +140,15 @@ describe('sale canEdit()', () => {
const saleToEdit = await models.Sale.findById(sales[0], null, options);
await saleToEdit.updateAttribute('itemFk', 9, options);
- const result = await models.Sale.canEdit(ctx, sales, options);
-
- expect(result).toEqual(false);
-
+ await models.Sale.canEdit(ctx, sales, options);
await tx.rollback();
} catch (e) {
await tx.rollback();
- throw e;
+ error = e;
}
+
+ expect(error).toEqual(
+ new Error('It is not possible to modify sales that their articles are from Floramondo'));
});
it('should return true if any of the sales is of isFloramondo and has the correct role', async() => {
diff --git a/modules/ticket/back/methods/sale/updateConcept.js b/modules/ticket/back/methods/sale/updateConcept.js
index 0730f85e2..dcd25dcbb 100644
--- a/modules/ticket/back/methods/sale/updateConcept.js
+++ b/modules/ticket/back/methods/sale/updateConcept.js
@@ -40,10 +40,7 @@ module.exports = Self => {
try {
const currentLine = await models.Sale.findById(id, null, myOptions);
- const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions);
-
- if (!canEditSale)
- throw new UserError(`Sale(s) blocked, please contact production`);
+ await models.Sale.canEdit(ctx, [id], myOptions);
const line = await currentLine.updateAttributes({concept: newConcept}, myOptions);
diff --git a/modules/ticket/back/methods/sale/updatePrice.js b/modules/ticket/back/methods/sale/updatePrice.js
index 8f27e1af5..505de5180 100644
--- a/modules/ticket/back/methods/sale/updatePrice.js
+++ b/modules/ticket/back/methods/sale/updatePrice.js
@@ -66,9 +66,7 @@ module.exports = Self => {
const sale = await models.Sale.findById(id, filter, myOptions);
- const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions);
- if (!canEditSale)
- throw new UserError(`Sale(s) blocked, please contact production`);
+ await models.Sale.canEdit(ctx, [id], myOptions);
const oldPrice = sale.price;
const userId = ctx.req.accessToken.userId;
diff --git a/modules/ticket/back/methods/sale/updateQuantity.js b/modules/ticket/back/methods/sale/updateQuantity.js
index 8cf0720ce..d2927c65c 100644
--- a/modules/ticket/back/methods/sale/updateQuantity.js
+++ b/modules/ticket/back/methods/sale/updateQuantity.js
@@ -41,9 +41,7 @@ module.exports = Self => {
}
try {
- const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions);
- if (!canEditSale)
- throw new UserError(`Sale(s) blocked, please contact production`);
+ await models.Sale.canEdit(ctx, [id], myOptions);
const filter = {
include: {
diff --git a/modules/ticket/back/methods/sale/usesMana.js b/modules/ticket/back/methods/sale/usesMana.js
index 093057dca..3f55293bf 100644
--- a/modules/ticket/back/methods/sale/usesMana.js
+++ b/modules/ticket/back/methods/sale/usesMana.js
@@ -24,6 +24,8 @@ module.exports = Self => {
const salesDepartment = await models.Department.findOne({where: {code: 'VT'}, fields: 'id'}, myOptions);
const departments = await models.Department.getLeaves(salesDepartment.id, null, myOptions);
const workerDepartment = await models.WorkerDepartment.findById(userId, null, myOptions);
+ if (!workerDepartment) return false;
+
const usesMana = departments.find(department => department.id == workerDepartment.departmentFk);
return usesMana ? true : false;
diff --git a/modules/ticket/back/methods/state/editableStates.js b/modules/ticket/back/methods/state/editableStates.js
index 2c90ac43b..115876f26 100644
--- a/modules/ticket/back/methods/state/editableStates.js
+++ b/modules/ticket/back/methods/state/editableStates.js
@@ -24,7 +24,7 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
- let statesList = await models.State.find({where: filter.where}, myOptions);
+ let statesList = await models.State.find(filter, myOptions);
const isProduction = await models.Account.hasRole(userId, 'production', myOptions);
const isSalesPerson = await models.Account.hasRole(userId, 'salesPerson', myOptions);
const isAdministrative = await models.Account.hasRole(userId, 'administrative', myOptions);
diff --git a/modules/ticket/back/methods/ticket-tracking/specs/changeState.spec.js b/modules/ticket/back/methods/ticket-tracking/specs/changeState.spec.js
index 746e1b7fc..175bc4e4b 100644
--- a/modules/ticket/back/methods/ticket-tracking/specs/changeState.spec.js
+++ b/modules/ticket/back/methods/ticket-tracking/specs/changeState.spec.js
@@ -9,7 +9,7 @@ describe('ticket changeState()', () => {
accessToken: {userId: 9},
};
const ctx = {req: activeCtx};
- const now = new Date();
+ const now = Date.vnNew();
const sampleTicket = {
shipped: now,
landed: now,
diff --git a/modules/ticket/back/methods/ticket/canBeInvoiced.js b/modules/ticket/back/methods/ticket/canBeInvoiced.js
index a009d63cf..6b8f9e71a 100644
--- a/modules/ticket/back/methods/ticket/canBeInvoiced.js
+++ b/modules/ticket/back/methods/ticket/canBeInvoiced.js
@@ -43,7 +43,7 @@ module.exports = function(Self) {
ticketBases => ticketBases.hasSomeNegativeBase
);
- const today = new Date();
+ const today = Date.vnNew();
const invalidTickets = tickets.some(ticket => {
const shipped = new Date(ticket.shipped);
diff --git a/modules/ticket/back/methods/ticket/closeAll.js b/modules/ticket/back/methods/ticket/closeAll.js
index 327278c2b..3726d85b7 100644
--- a/modules/ticket/back/methods/ticket/closeAll.js
+++ b/modules/ticket/back/methods/ticket/closeAll.js
@@ -17,14 +17,14 @@ module.exports = Self => {
});
Self.closeAll = async() => {
- const toDate = new Date();
+ const toDate = Date.vnNew();
toDate.setHours(0, 0, 0, 0);
toDate.setDate(toDate.getDate() - 1);
- const todayMinDate = new Date();
+ const todayMinDate = Date.vnNew();
todayMinDate.setHours(0, 0, 0, 0);
- const todayMaxDate = new Date();
+ const todayMaxDate = Date.vnNew();
todayMaxDate.setHours(23, 59, 59, 59);
// Prevent closure for current day
@@ -32,7 +32,7 @@ module.exports = Self => {
throw new UserError('You cannot close tickets for today');
const tickets = await Self.rawSql(`
- SELECT
+ SELECT
t.id,
t.clientFk,
t.companyFk,
@@ -53,7 +53,7 @@ module.exports = Self => {
JOIN country co ON co.id = p.countryFk
LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk
WHERE al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered')
- AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY)
+ AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY)
AND util.dayEnd(?)
AND t.refFk IS NULL
GROUP BY t.id
diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js
index a2add2e82..262b3fd74 100644
--- a/modules/ticket/back/methods/ticket/filter.js
+++ b/modules/ticket/back/methods/ticket/filter.js
@@ -137,7 +137,7 @@ module.exports = Self => {
Self.filter = async(ctx, filter, options) => {
const userId = ctx.req.accessToken.userId;
const conn = Self.dataSource.connector;
- const date = new Date();
+ const date = Date.vnNew();
date.setHours(0, 0, 0, 0);
const models = Self.app.models;
const args = ctx.args;
@@ -295,10 +295,10 @@ module.exports = Self => {
stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.sale_getProblems');
stmt = new ParameterizedSQL(`
- CREATE TEMPORARY TABLE tmp.sale_getProblems
+ CREATE TEMPORARY TABLE tmp.sale_getProblems
(INDEX (ticketFk))
ENGINE = MEMORY
- SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped
+ SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped
FROM tmp.filter f
LEFT JOIN alertLevel al ON al.id = f.alertLevel
WHERE (al.code = 'FREE' OR f.alertLevel IS NULL)
@@ -350,7 +350,7 @@ module.exports = Self => {
const ticketsIndex = stmts.push(stmt) - 1;
stmts.push(
- `DROP TEMPORARY TABLE
+ `DROP TEMPORARY TABLE
tmp.filter,
tmp.ticket_problems`);
diff --git a/modules/ticket/back/methods/ticket/getTicketsAdvance.js b/modules/ticket/back/methods/ticket/getTicketsAdvance.js
index 19571bb51..1e1646cba 100644
--- a/modules/ticket/back/methods/ticket/getTicketsAdvance.js
+++ b/modules/ticket/back/methods/ticket/getTicketsAdvance.js
@@ -50,14 +50,14 @@ module.exports = Self => {
required: false
},
{
- arg: 'state',
- type: 'string',
+ arg: 'isNotValidated',
+ type: 'boolean',
description: 'Origin state',
required: false
},
{
- arg: 'futureState',
- type: 'string',
+ arg: 'futureIsNotValidated',
+ type: 'boolean',
description: 'Destination state',
required: false
},
@@ -92,13 +92,23 @@ module.exports = Self => {
case 'futureId':
return {'f.futureId': value};
case 'ipt':
- return {'f.ipt': value};
+ return {or:
+ [
+ {'f.ipt': {like: `%${value}%`}},
+ {'f.ipt': null}
+ ]
+ };
case 'futureIpt':
- return {'f.futureIpt': value};
- case 'state':
- return {'f.stateCode': {like: `%${value}%`}};
- case 'futureState':
- return {'f.futureStateCode': {like: `%${value}%`}};
+ return {or:
+ [
+ {'f.futureIpt': {like: `%${value}%`}},
+ {'f.futureIpt': null}
+ ]
+ };
+ case 'isNotValidated':
+ return {'f.isNotValidated': value};
+ case 'futureIsNotValidated':
+ return {'f.futureIsNotValidated': value};
}
});
diff --git a/modules/ticket/back/methods/ticket/getTicketsFuture.js b/modules/ticket/back/methods/ticket/getTicketsFuture.js
index 6798df513..901e546f7 100644
--- a/modules/ticket/back/methods/ticket/getTicketsFuture.js
+++ b/modules/ticket/back/methods/ticket/getTicketsFuture.js
@@ -108,16 +108,26 @@ module.exports = Self => {
switch (param) {
case 'id':
return {'f.id': value};
- case 'lines':
+ case 'linesMax':
return {'f.lines': {lte: value}};
- case 'liters':
+ case 'litersMax':
return {'f.liters': {lte: value}};
case 'futureId':
return {'f.futureId': value};
case 'ipt':
- return {'f.ipt': value};
+ return {or:
+ [
+ {'f.ipt': {like: `%${value}%`}},
+ {'f.ipt': null}
+ ]
+ };
case 'futureIpt':
- return {'f.futureIpt': value};
+ return {or:
+ [
+ {'f.futureIpt': {like: `%${value}%`}},
+ {'f.futureIpt': null}
+ ]
+ };
case 'state':
return {'f.stateCode': {like: `%${value}%`}};
case 'futureState':
@@ -203,7 +213,6 @@ module.exports = Self => {
tmp.ticket_problems`);
const sql = ParameterizedSQL.join(stmts, ';');
-
const result = await conn.executeStmt(sql, myOptions);
return result[ticketsIndex];
diff --git a/modules/ticket/back/methods/ticket/makeInvoice.js b/modules/ticket/back/methods/ticket/makeInvoice.js
index 4e9c22a24..9739f5985 100644
--- a/modules/ticket/back/methods/ticket/makeInvoice.js
+++ b/modules/ticket/back/methods/ticket/makeInvoice.js
@@ -26,7 +26,7 @@ module.exports = function(Self) {
Self.makeInvoice = async(ctx, ticketsIds, options) => {
const userId = ctx.req.accessToken.userId;
const models = Self.app.models;
- const date = new Date();
+ const date = Date.vnNew();
date.setHours(0, 0, 0, 0);
const myOptions = {};
diff --git a/modules/ticket/back/methods/ticket/restore.js b/modules/ticket/back/methods/ticket/restore.js
index c9bb126fd..722c3294e 100644
--- a/modules/ticket/back/methods/ticket/restore.js
+++ b/modules/ticket/back/methods/ticket/restore.js
@@ -38,7 +38,7 @@ module.exports = Self => {
}]
}, myOptions);
- const now = new Date();
+ const now = Date.vnNew();
const maxDate = new Date(ticket.updated);
maxDate.setHours(maxDate.getHours() + 1);
@@ -56,7 +56,7 @@ module.exports = Self => {
await models.Chat.sendCheckingPresence(ctx, salesPersonId, message);
}
- const fullYear = new Date().getFullYear();
+ const fullYear = Date.vnNew().getFullYear();
const newShipped = ticket.shipped;
const newLanded = ticket.landed;
newShipped.setFullYear(fullYear);
diff --git a/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js b/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js
index 8b7e1685d..806f80227 100644
--- a/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js
+++ b/modules/ticket/back/methods/ticket/specs/canBeInvoiced.spec.js
@@ -61,7 +61,7 @@ describe('ticket canBeInvoiced()', () => {
const ticket = await models.Ticket.findById(ticketId, null, options);
- const shipped = new Date();
+ const shipped = Date.vnNew();
shipped.setDate(shipped.getDate() + 1);
await ticket.updateAttribute('shipped', shipped, options);
diff --git a/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js b/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js
index 3a9c2db50..d65c87654 100644
--- a/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js
+++ b/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js
@@ -4,8 +4,8 @@ const LoopBackContext = require('loopback-context');
describe('ticket componentUpdate()', () => {
const userID = 1101;
const ticketID = 11;
- const today = new Date();
- const tomorrow = new Date();
+ const today = Date.vnNew();
+ const tomorrow = Date.vnNew();
tomorrow.setDate(tomorrow.getDate() + 1);
@@ -19,11 +19,11 @@ describe('ticket componentUpdate()', () => {
beforeAll(async() => {
const deliveryComponenet = await models.Component.findOne({where: {code: 'delivery'}});
deliveryComponentId = deliveryComponenet.id;
- componentOfSaleSeven = `SELECT value
- FROM vn.saleComponent
+ componentOfSaleSeven = `SELECT value
+ FROM vn.saleComponent
WHERE saleFk = 7 AND componentFk = ${deliveryComponentId}`;
- componentOfSaleEight = `SELECT value
- FROM vn.saleComponent
+ componentOfSaleEight = `SELECT value
+ FROM vn.saleComponent
WHERE saleFk = 8 AND componentFk = ${deliveryComponentId}`;
[componentValue] = await models.SaleComponent.rawSql(componentOfSaleSeven);
firstvalueBeforeChange = componentValue.value;
diff --git a/modules/ticket/back/methods/ticket/specs/filter.spec.js b/modules/ticket/back/methods/ticket/specs/filter.spec.js
index 688b0de61..6cc1a3ad2 100644
--- a/modules/ticket/back/methods/ticket/specs/filter.spec.js
+++ b/modules/ticket/back/methods/ticket/specs/filter.spec.js
@@ -26,9 +26,9 @@ describe('ticket filter()', () => {
try {
const options = {transaction: tx};
- const yesterday = new Date();
+ const yesterday = Date.vnNew();
yesterday.setHours(0, 0, 0, 0);
- const today = new Date();
+ const today = Date.vnNew();
today.setHours(23, 59, 59, 59);
const ctx = {req: {accessToken: {userId: 9}}, args: {
@@ -54,10 +54,10 @@ describe('ticket filter()', () => {
try {
const options = {transaction: tx};
- const yesterday = new Date();
+ const yesterday = Date.vnNew();
yesterday.setDate(yesterday.getDate() - 1);
yesterday.setHours(0, 0, 0, 0);
- const today = new Date();
+ const today = Date.vnNew();
today.setHours(23, 59, 59, 59);
const ctx = {req: {accessToken: {userId: 9}}, args: {
diff --git a/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js b/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js
index aab053127..11571bede 100644
--- a/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js
+++ b/modules/ticket/back/methods/ticket/specs/getTicketsAdvance.spec.js
@@ -1,9 +1,9 @@
const models = require('vn-loopback/server/server').models;
describe('TicketFuture getTicketsAdvance()', () => {
- const today = new Date();
+ const today = Date.vnNew();
today.setHours(0, 0, 0, 0);
- let tomorrow = new Date();
+ let tomorrow = Date.vnNew();
tomorrow.setDate(today.getDate() + 1);
it('should return the tickets passing the required data', async() => {
@@ -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({});
try {
@@ -39,7 +39,7 @@ describe('TicketFuture getTicketsAdvance()', () => {
dateFuture: tomorrow,
dateToAdvance: today,
warehouseFk: 1,
- state: 'OK'
+ futureIsNotValidated: true
};
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({});
try {
@@ -64,13 +64,13 @@ describe('TicketFuture getTicketsAdvance()', () => {
dateFuture: tomorrow,
dateToAdvance: today,
warehouseFk: 1,
- futureState: 'FREE'
+ isNotValidated: true
};
const ctx = {req: {accessToken: {userId: 9}}, args};
const result = await models.Ticket.getTicketsAdvance(ctx, options);
- expect(result.length).toBeGreaterThan(0);
+ expect(result.length).toEqual(0);
await tx.rollback();
} catch (e) {
@@ -89,7 +89,7 @@ describe('TicketFuture getTicketsAdvance()', () => {
dateFuture: tomorrow,
dateToAdvance: today,
warehouseFk: 1,
- ipt: 'Vertical'
+ ipt: 'V'
};
const ctx = {req: {accessToken: {userId: 9}}, args};
@@ -114,7 +114,7 @@ describe('TicketFuture getTicketsAdvance()', () => {
dateFuture: tomorrow,
dateToAdvance: today,
warehouseFk: 1,
- tfIpt: 'Vertical'
+ tfIpt: 'V'
};
const ctx = {req: {accessToken: {userId: 9}}, args};
diff --git a/modules/ticket/back/methods/ticket/specs/getTicketsFuture.spec.js b/modules/ticket/back/methods/ticket/specs/getTicketsFuture.spec.js
index c05ba764d..44896493f 100644
--- a/modules/ticket/back/methods/ticket/specs/getTicketsFuture.spec.js
+++ b/modules/ticket/back/methods/ticket/specs/getTicketsFuture.spec.js
@@ -1,7 +1,7 @@
const models = require('vn-loopback/server/server').models;
describe('ticket getTicketsFuture()', () => {
- const today = new Date();
+ const today = Date.vnNew();
today.setHours(0, 0, 0, 0);
it('should return the tickets passing the required data', async() => {
@@ -19,7 +19,7 @@ describe('ticket getTicketsFuture()', () => {
const ctx = {req: {accessToken: {userId: 9}}, args};
const result = await models.Ticket.getTicketsFuture(ctx, options);
- expect(result.length).toEqual(4);
+ expect(result.length).toBeGreaterThan(0);
await tx.rollback();
} catch (e) {
await tx.rollback();
@@ -43,7 +43,7 @@ describe('ticket getTicketsFuture()', () => {
const ctx = {req: {accessToken: {userId: 9}}, args};
const result = await models.Ticket.getTicketsFuture(ctx, options);
- expect(result.length).toEqual(4);
+ expect(result.length).toBeGreaterThan(0);
await tx.rollback();
} catch (e) {
@@ -93,7 +93,7 @@ describe('ticket getTicketsFuture()', () => {
const ctx = {req: {accessToken: {userId: 9}}, args};
const result = await models.Ticket.getTicketsFuture(ctx, options);
- expect(result.length).toEqual(4);
+ expect(result.length).toBeGreaterThan(0);
await tx.rollback();
} catch (e) {
@@ -118,7 +118,7 @@ describe('ticket getTicketsFuture()', () => {
const ctx = {req: {accessToken: {userId: 9}}, args};
const result = await models.Ticket.getTicketsFuture(ctx, options);
- expect(result.length).toEqual(1);
+ expect(result.length).toBeGreaterThan(0);
await tx.rollback();
} catch (e) {
@@ -143,7 +143,7 @@ describe('ticket getTicketsFuture()', () => {
const ctx = {req: {accessToken: {userId: 9}}, args};
const result = await models.Ticket.getTicketsFuture(ctx, options);
- expect(result.length).toEqual(4);
+ expect(result.length).toBeGreaterThan(0);
await tx.rollback();
} catch (e) {
@@ -168,7 +168,7 @@ describe('ticket getTicketsFuture()', () => {
const ctx = {req: {accessToken: {userId: 9}}, args};
const result = await models.Ticket.getTicketsFuture(ctx, options);
- expect(result.length).toEqual(4);
+ expect(result.length).toBeGreaterThan(0);
await tx.rollback();
} catch (e) {
@@ -187,13 +187,13 @@ describe('ticket getTicketsFuture()', () => {
originDated: today,
futureDated: today,
warehouseFk: 1,
- ipt: 0
+ ipt: 'H'
};
const ctx = {req: {accessToken: {userId: 9}}, args};
const result = await models.Ticket.getTicketsFuture(ctx, options);
- expect(result.length).toEqual(0);
+ expect(result.length).toBeGreaterThan(0);
await tx.rollback();
} catch (e) {
@@ -218,7 +218,7 @@ describe('ticket getTicketsFuture()', () => {
const ctx = {req: {accessToken: {userId: 9}}, args};
const result = await models.Ticket.getTicketsFuture(ctx, options);
- expect(result.length).toEqual(4);
+ expect(result.length).toBeGreaterThan(0);
await tx.rollback();
} catch (e) {
@@ -237,13 +237,13 @@ describe('ticket getTicketsFuture()', () => {
originDated: today,
futureDated: today,
warehouseFk: 1,
- futureIpt: 0
+ futureIpt: 'H'
};
const ctx = {req: {accessToken: {userId: 9}}, args};
const result = await models.Ticket.getTicketsFuture(ctx, options);
- expect(result.length).toEqual(0);
+ expect(result.length).toBeGreaterThan(0);
await tx.rollback();
} catch (e) {
@@ -268,7 +268,7 @@ describe('ticket getTicketsFuture()', () => {
const ctx = {req: {accessToken: {userId: 9}}, args};
const result = await models.Ticket.getTicketsFuture(ctx, options);
- expect(result.length).toEqual(1);
+ expect(result.length).toBeGreaterThan(0);
await tx.rollback();
} catch (e) {
@@ -293,7 +293,7 @@ describe('ticket getTicketsFuture()', () => {
const ctx = {req: {accessToken: {userId: 9}}, args};
const result = await models.Ticket.getTicketsFuture(ctx, options);
- expect(result.length).toEqual(4);
+ expect(result.length).toBeGreaterThan(0);
await tx.rollback();
} catch (e) {
diff --git a/modules/ticket/back/methods/ticket/specs/merge.spec.js b/modules/ticket/back/methods/ticket/specs/merge.spec.js
index 275484f67..6b533e47c 100644
--- a/modules/ticket/back/methods/ticket/specs/merge.spec.js
+++ b/modules/ticket/back/methods/ticket/specs/merge.spec.js
@@ -5,8 +5,8 @@ describe('ticket merge()', () => {
const tickets = [{
originId: 13,
destinationId: 12,
- originShipped: new Date(),
- destinationShipped: new Date(),
+ originShipped: Date.vnNew(),
+ destinationShipped: Date.vnNew(),
workerFk: 1
}];
diff --git a/modules/ticket/back/methods/ticket/specs/new.spec.js b/modules/ticket/back/methods/ticket/specs/new.spec.js
index fce7cdceb..0a2f93bc4 100644
--- a/modules/ticket/back/methods/ticket/specs/new.spec.js
+++ b/modules/ticket/back/methods/ticket/specs/new.spec.js
@@ -2,7 +2,7 @@ const models = require('vn-loopback/server/server').models;
let UserError = require('vn-loopback/util/user-error');
describe('ticket new()', () => {
- const today = new Date();
+ const today = Date.vnNew();
const ctx = {req: {accessToken: {userId: 1}}};
it('should throw an error if the client isnt frozen and isnt active', async() => {
diff --git a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js
index 5470382f9..1db1b6eaa 100644
--- a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js
+++ b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js
@@ -8,7 +8,7 @@ describe('sale priceDifference()', () => {
try {
const options = {transaction: tx};
- const tomorrow = new Date();
+ const tomorrow = Date.vnNew();
tomorrow.setDate(tomorrow.getDate() + 1);
const ctx = {req: {accessToken: {userId: 1106}}};
@@ -45,8 +45,8 @@ describe('sale priceDifference()', () => {
const ctx = {req: {accessToken: {userId: 1106}}};
ctx.args = {
id: 1,
- landed: new Date(),
- shipped: new Date(),
+ landed: Date.vnNew(),
+ shipped: Date.vnNew(),
addressId: 121,
zoneId: 3,
warehouseId: 1
@@ -68,7 +68,7 @@ describe('sale priceDifference()', () => {
try {
const options = {transaction: tx};
- const tomorrow = new Date();
+ const tomorrow = Date.vnNew();
tomorrow.setDate(tomorrow.getDate() + 1);
const ctx = {req: {accessToken: {userId: 1106}}};
diff --git a/modules/ticket/back/methods/ticket/specs/restore.spec.js b/modules/ticket/back/methods/ticket/specs/restore.spec.js
index bd976d124..3b35ae2b4 100644
--- a/modules/ticket/back/methods/ticket/specs/restore.spec.js
+++ b/modules/ticket/back/methods/ticket/specs/restore.spec.js
@@ -24,8 +24,8 @@ describe('ticket restore()', () => {
let error;
const tx = await app.models.Ticket.beginTransaction({});
- const now = new Date();
- now.setHours(now.getHours() - 1);
+ const now = Date.vnNew();
+ now.setHours(now.getHours() - 1.1);
try {
const options = {transaction: tx};
@@ -46,7 +46,7 @@ describe('ticket restore()', () => {
it('should restore the ticket making its state no longer deleted', async() => {
const tx = await app.models.Ticket.beginTransaction({});
- const now = new Date();
+ const now = Date.vnNew();
try {
const options = {transaction: tx};
diff --git a/modules/ticket/back/model-config.json b/modules/ticket/back/model-config.json
index 50cfbd08a..62e763c8f 100644
--- a/modules/ticket/back/model-config.json
+++ b/modules/ticket/back/model-config.json
@@ -26,6 +26,9 @@
"PackingSiteConfig": {
"dataSource": "vn"
},
+ "ExpeditionMistake": {
+ "dataSource": "vn"
+ },
"PrintServerQueue": {
"dataSource": "vn"
},
diff --git a/modules/ticket/back/models/expeditionMistake.json b/modules/ticket/back/models/expeditionMistake.json
new file mode 100644
index 000000000..43033194a
--- /dev/null
+++ b/modules/ticket/back/models/expeditionMistake.json
@@ -0,0 +1,33 @@
+{
+ "name": "ExpeditionMistake",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "expeditionMistake"
+ }
+ },
+ "properties": {
+ "created": {
+ "type": "date"
+ }
+ },
+ "relations": {
+ "expedition": {
+ "type": "belongsTo",
+ "model": "Expedition",
+ "foreignKey": "expeditionFk"
+ },
+ "worker": {
+ "type": "belongsTo",
+ "model": "Worker",
+ "foreignKey": "workerFk"
+ },
+ "type": {
+ "type": "belongsTo",
+ "model": "MistakeType",
+ "foreignKey": "typeFk"
+ }
+ }
+
+ }
+
\ No newline at end of file
diff --git a/modules/ticket/back/models/sale.js b/modules/ticket/back/models/sale.js
index ae247fc24..bab201fdd 100644
--- a/modules/ticket/back/models/sale.js
+++ b/modules/ticket/back/models/sale.js
@@ -1,5 +1,6 @@
module.exports = Self => {
require('../methods/sale/getClaimableFromTicket')(Self);
+ require('../methods/sale/salePreparingList')(Self);
require('../methods/sale/reserve')(Self);
require('../methods/sale/deleteSales')(Self);
require('../methods/sale/updatePrice')(Self);
diff --git a/modules/ticket/front/advance-search-panel/index.html b/modules/ticket/front/advance-search-panel/index.html
index e8d5dc60d..dfe1f6b08 100644
--- a/modules/ticket/front/advance-search-panel/index.html
+++ b/modules/ticket/front/advance-search-panel/index.html
@@ -39,26 +39,18 @@
-
-
- {{name}}
-
-
-
-
- {{name}}
-
-
+
+
+
+
{
- for (let state of res.data) {
- groupedStates.push({
- id: state.id,
- code: state.code,
- name: this.$t(state.code)
- });
- }
- this.groupedStates = groupedStates;
- });
- }
-
getItemPackingTypes() {
let itemPackingTypes = [];
- this.$http.get('ItemPackingTypes').then(res => {
+ const filter = {
+ where: {isActive: true}
+ };
+ this.$http.get('ItemPackingTypes', {filter}).then(res => {
for (let ipt of res.data) {
itemPackingTypes.push({
code: ipt.code,
diff --git a/modules/ticket/front/advance-search-panel/locale/es.yml b/modules/ticket/front/advance-search-panel/locale/es.yml
index 3dce7dae5..4ea2fc737 100644
--- a/modules/ticket/front/advance-search-panel/locale/es.yml
+++ b/modules/ticket/front/advance-search-panel/locale/es.yml
@@ -1 +1,3 @@
Advance tickets: Adelantar tickets
+Pending Origin: Pendiente origen
+Pending Destination: Pendiente destino
diff --git a/modules/ticket/front/advance/index.html b/modules/ticket/front/advance/index.html
index f63c0fbf7..3dd52b909 100644
--- a/modules/ticket/front/advance/index.html
+++ b/modules/ticket/front/advance/index.html
@@ -32,8 +32,8 @@
|
- Origin |
- Destination |
+ Origin |
+ Destination |
@@ -43,19 +43,30 @@
check-field="checked">
|
+
+ |
ID
|
Date
|
-
+ |
IPT
|
State
|
-
+ |
+ Liters
+ |
+
+ Stock
+ |
+
+ Lines
+ |
+
Import
|
@@ -64,7 +75,7 @@
|
Date
|
-
+ |
IPT
|
@@ -73,13 +84,10 @@
|
Liters
|
-
- Stock
- |
Lines
|
-
+ |
Import
|
@@ -92,6 +100,13 @@
vn-click-stop>
+
+
+
+ |
|
+ {{::ticket.futureLiters | dashIfEmpty}} |
+ {{::ticket.hasStock | dashIfEmpty}} |
+ {{::ticket.futureLines | dashIfEmpty}} |
{{::(ticket.futureTotalWithVat ? ticket.futureTotalWithVat : 0) | currency: 'EUR': 2}}
@@ -136,7 +154,6 @@
|
{{::ticket.liters | dashIfEmpty}} |
- {{::ticket.hasStock | dashIfEmpty}} |
{{::ticket.lines | dashIfEmpty}} |
diff --git a/modules/ticket/front/advance/index.js b/modules/ticket/front/advance/index.js
index 1404f9472..779ada81a 100644
--- a/modules/ticket/front/advance/index.js
+++ b/modules/ticket/front/advance/index.js
@@ -1,5 +1,6 @@
import ngModule from '../module';
import Section from 'salix/components/section';
+import './style.scss';
export default class Controller extends Section {
constructor($element, $) {
@@ -39,6 +40,7 @@ export default class Controller extends Section {
field: 'ipt',
autocomplete: {
url: 'ItemPackingTypes',
+ where: `{isActive: true}`,
showField: 'description',
valueField: 'code'
}
@@ -47,6 +49,7 @@ export default class Controller extends Section {
field: 'futureIpt',
autocomplete: {
url: 'ItemPackingTypes',
+ where: `{isActive: true}`,
showField: 'description',
valueField: 'code'
}
@@ -60,7 +63,7 @@ export default class Controller extends Section {
}
setDefaultFilter() {
- let today = new Date();
+ let today = Date.vnNew();
const tomorrow = new Date(today);
tomorrow.setDate(tomorrow.getDate() + 1);
this.filterParams = {
@@ -72,7 +75,7 @@ export default class Controller extends Section {
}
compareDate(date) {
- let today = new Date();
+ let today = Date.vnNew();
today.setHours(0, 0, 0, 0);
let timeTicket = new Date(date);
timeTicket.setHours(0, 0, 0, 0);
@@ -126,6 +129,11 @@ export default class Controller extends Section {
});
}
+ agencies(futureAgency, agency) {
+ return this.$t(`Origin agency`, {agency: futureAgency}) +
+ ' ' + this.$t(`Destination agency`, {agency: agency});
+ }
+
moveTicketsAdvance() {
let ticketsToMove = [];
this.checked.forEach(ticket => {
@@ -155,6 +163,10 @@ export default class Controller extends Section {
return {'liters': value};
case 'lines':
return {'lines': value};
+ case 'futureLiters':
+ return {'futureLiters': value};
+ case 'futureLines':
+ return {'futureLines': value};
case 'ipt':
return {'ipt': value};
case 'futureIpt':
diff --git a/modules/ticket/front/advance/index.spec.js b/modules/ticket/front/advance/index.spec.js
index c5a04daee..6874f914b 100644
--- a/modules/ticket/front/advance/index.spec.js
+++ b/modules/ticket/front/advance/index.spec.js
@@ -26,14 +26,14 @@ describe('Component vnTicketAdvance', () => {
describe('compareDate()', () => {
it('should return warning when the date is the present', () => {
- let today = new Date();
+ let today = Date.vnNew();
let result = controller.compareDate(today);
expect(result).toEqual('warning');
});
it('should return sucess when the date is in the future', () => {
- let futureDate = new Date();
+ let futureDate = Date.vnNew();
futureDate = futureDate.setDate(futureDate.getDate() + 10);
let result = controller.compareDate(futureDate);
@@ -41,7 +41,7 @@ describe('Component vnTicketAdvance', () => {
});
it('should return undefined when the date is in the past', () => {
- let pastDate = new Date();
+ let pastDate = Date.vnNew();
pastDate = pastDate.setDate(pastDate.getDate() - 10);
let result = controller.compareDate(pastDate);
@@ -81,7 +81,7 @@ describe('Component vnTicketAdvance', () => {
describe('dateRange()', () => {
it('should return two dates with the hours at the start and end of the given date', () => {
- const now = new Date();
+ const now = Date.vnNew();
const today = now.getDate();
diff --git a/modules/ticket/front/advance/locale/es.yml b/modules/ticket/front/advance/locale/es.yml
index b444fbdd3..da22cd433 100644
--- a/modules/ticket/front/advance/locale/es.yml
+++ b/modules/ticket/front/advance/locale/es.yml
@@ -4,3 +4,6 @@ Advance confirmation: ¿Desea adelantar {{checked}} tickets?
Success: Tickets movidos correctamente
Lines: Líneas
Liters: Litros
+Item Packing Type: Encajado
+Origin agency: "Agencia origen: {{agency}}"
+Destination agency: "Agencia destino: {{agency}}"
diff --git a/modules/ticket/front/advance/style.scss b/modules/ticket/front/advance/style.scss
new file mode 100644
index 000000000..8fa9de438
--- /dev/null
+++ b/modules/ticket/front/advance/style.scss
@@ -0,0 +1,7 @@
+@import "variables";
+
+vn-ticket-advance{
+ vn-icon {
+ color: #f7931e
+ }
+}
diff --git a/modules/ticket/front/basic-data/step-one/index.js b/modules/ticket/front/basic-data/step-one/index.js
index f532265e2..99782de44 100644
--- a/modules/ticket/front/basic-data/step-one/index.js
+++ b/modules/ticket/front/basic-data/step-one/index.js
@@ -75,8 +75,10 @@ class Controller extends Component {
}
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.setHours(0, 0, 0, 0);
this.getLanded({
shipped: value,
addressFk: this.ticket.addressFk,
diff --git a/modules/ticket/front/basic-data/step-one/index.spec.js b/modules/ticket/front/basic-data/step-one/index.spec.js
index 2b14c18cc..30946dab0 100644
--- a/modules/ticket/front/basic-data/step-one/index.spec.js
+++ b/modules/ticket/front/basic-data/step-one/index.spec.js
@@ -67,7 +67,7 @@ describe('Ticket', () => {
jest.spyOn(controller, 'getShipped');
controller.ticket.addressFk = 99;
controller.addressId = 100;
- const landed = new Date();
+ const landed = Date.vnNew();
const expectedResult = {
landed: landed,
addressFk: 100,
@@ -101,7 +101,7 @@ describe('Ticket', () => {
describe('shipped() getter', () => {
it('should return the shipped property', () => {
- const shipped = new Date();
+ const shipped = Date.vnNew();
controller.ticket.shipped = shipped;
expect(controller.shipped).toEqual(shipped);
@@ -111,7 +111,7 @@ describe('Ticket', () => {
describe('shipped() setter', () => {
it('should set shipped property and call getLanded() method ', () => {
jest.spyOn(controller, 'getLanded');
- const shipped = new Date();
+ const shipped = Date.vnNew();
const expectedResult = {
shipped: shipped,
addressFk: 121,
@@ -126,7 +126,7 @@ describe('Ticket', () => {
describe('landed() getter', () => {
it('should return the landed property', () => {
- const landed = new Date();
+ const landed = Date.vnNew();
controller.ticket.landed = landed;
expect(controller.landed).toEqual(landed);
@@ -136,7 +136,7 @@ describe('Ticket', () => {
describe('landed() setter', () => {
it('should set shipped property and call getShipped() method ', () => {
jest.spyOn(controller, 'getShipped');
- const landed = new Date();
+ const landed = Date.vnNew();
const expectedResult = {
landed: landed,
addressFk: 121,
@@ -161,7 +161,7 @@ describe('Ticket', () => {
it('should set agencyModeId property and call getLanded() method', () => {
jest.spyOn(controller, 'getLanded');
controller.$.agencyMode = {selection: {warehouseFk: 1}};
- const shipped = new Date();
+ const shipped = Date.vnNew();
const agencyModeId = 8;
const expectedResult = {
shipped: shipped,
@@ -177,7 +177,7 @@ describe('Ticket', () => {
it('should do nothing if attempting to set the same agencyMode id', () => {
jest.spyOn(controller, 'getShipped');
- const landed = new Date();
+ const landed = Date.vnNew();
const agencyModeId = 7;
const expectedResult = {
landed: landed,
@@ -278,8 +278,8 @@ describe('Ticket', () => {
agencyModeFk: 1,
companyFk: 442,
warehouseFk: 1,
- shipped: new Date(),
- landed: new Date()
+ shipped: Date.vnNew(),
+ landed: Date.vnNew()
};
expect(controller.isFormInvalid()).toBeFalsy();
@@ -288,7 +288,7 @@ describe('Ticket', () => {
describe('onStepChange()', () => {
it('should call onStepChange method and return a NO_AGENCY_AVAILABLE signal error', async() => {
- let landed = new Date();
+ let landed = Date.vnNew();
landed.setHours(0, 0, 0, 0);
controller._ticket = {
@@ -299,7 +299,7 @@ describe('Ticket', () => {
agencyModeFk: 1,
companyFk: 442,
warehouseFk: 1,
- shipped: new Date(),
+ shipped: Date.vnNew(),
landed: landed
};
@@ -314,8 +314,8 @@ describe('Ticket', () => {
describe('getLanded()', () => {
it('should return an available landed date', async() => {
- const shipped = new Date();
- const expectedResult = {landed: new Date()};
+ const shipped = Date.vnNew();
+ const expectedResult = {landed: Date.vnNew()};
const params = {
shipped: shipped,
addressFk: 121,
@@ -336,8 +336,8 @@ describe('Ticket', () => {
describe('getShipped()', () => {
it('should return an available shipped date', async() => {
- const landed = new Date();
- const expectedResult = {shipped: new Date()};
+ const landed = Date.vnNew();
+ const expectedResult = {shipped: Date.vnNew()};
const params = {
landed: landed,
addressFk: 121,
@@ -358,7 +358,7 @@ describe('Ticket', () => {
describe('zoneWhere() getter', () => {
it('should return an object containing filter properties', async() => {
- const shipped = new Date();
+ const shipped = Date.vnNew();
controller.ticket.shipped = shipped;
const expectedResult = {
diff --git a/modules/ticket/front/descriptor-menu/index.html b/modules/ticket/front/descriptor-menu/index.html
index 805e0b391..c2ebc3e3a 100644
--- a/modules/ticket/front/descriptor-menu/index.html
+++ b/modules/ticket/front/descriptor-menu/index.html
@@ -21,30 +21,28 @@
Add turn
Show Delivery Note...
as PDF
-
- as PDF
-
as PDF without prices
+
+ as PDF signed
+
@@ -54,7 +52,7 @@
Send Delivery Note...
@@ -64,6 +62,11 @@
translate>
Send PDF
+
+ Send PDF to tablet
+
@@ -323,3 +326,18 @@
question="Are you sure you want to refund all?"
message="Refund all">
+
+
+
+
+
+
+
+
diff --git a/modules/ticket/front/descriptor-menu/index.js b/modules/ticket/front/descriptor-menu/index.js
index 168002d07..ff029db78 100644
--- a/modules/ticket/front/descriptor-menu/index.js
+++ b/modules/ticket/front/descriptor-menu/index.js
@@ -85,7 +85,6 @@ class Controller extends Section {
.then(res => this.ticket = res.data)
.then(() => {
this.isTicketEditable();
- this.hasDocuware();
});
}
@@ -134,15 +133,6 @@ class Controller extends Section {
});
}
- hasDocuware() {
- const params = {
- fileCabinet: 'deliveryClient',
- dialog: 'findTicket'
- };
- this.$http.post(`Docuwares/${this.id}/checkFile`, params)
- .then(res => this.hasDocuwareFile = res.data);
- }
-
showPdfDeliveryNote(type) {
this.vnReport.show(`tickets/${this.id}/delivery-note-pdf`, {
recipientId: this.ticket.client.id,
@@ -151,7 +141,10 @@ class Controller extends Section {
}
sendPdfDeliveryNote($data) {
- return this.vnEmail.send(`tickets/${this.id}/delivery-note-email`, {
+ let query = `tickets/${this.id}/delivery-note-email`;
+ if (this.hasDocuwareFile) query = `docuwares/${this.id}/delivery-note-email`;
+
+ return this.vnEmail.send(query, {
recipientId: this.ticket.client.id,
recipient: $data.email
});
@@ -184,7 +177,7 @@ class Controller extends Section {
get canRestoreTicket() {
const isDeleted = this.ticket.isDeleted;
- const now = new Date();
+ const now = Date.vnNew();
const maxDate = new Date(this.ticket.updated);
maxDate.setHours(maxDate.getHours() + 1);
@@ -267,8 +260,15 @@ class Controller extends Section {
if (client.hasElectronicInvoice) {
this.$http.post(`NotificationQueues`, {
- notificationFk: 'invoiceElectronic',
+ notificationFk: 'invoice-electronic',
authorFk: client.id,
+ params: JSON.stringify(
+ {
+ 'name': client.name,
+ 'email': client.email,
+ 'ticketId': this.id,
+ 'url': window.location.href
+ })
}).then(() => {
this.vnApp.showSuccess(this.$t('Invoice sent'));
});
@@ -312,6 +312,24 @@ class Controller extends Section {
return this.$http.post(`Tickets/${this.id}/sendSms`, sms)
.then(() => this.vnApp.showSuccess(this.$t('SMS sent')));
}
+
+ hasDocuware() {
+ this.$http.post(`Docuwares/${this.id}/checkFile`, {fileCabinet: 'deliveryNote', signed: true})
+ .then(res => {
+ this.hasDocuwareFile = res.data;
+ });
+ }
+
+ uploadDocuware(force) {
+ if (!force)
+ return this.$.pdfToTablet.show();
+
+ return this.$http.post(`Docuwares/${this.id}/upload`, {fileCabinet: 'deliveryNote'})
+ .then(() => {
+ this.vnApp.showSuccess(this.$t('PDF sent!'));
+ this.$.balanceCreate.show();
+ });
+ }
}
Controller.$inject = ['$element', '$scope', 'vnReport', 'vnEmail'];
diff --git a/modules/ticket/front/descriptor-menu/index.spec.js b/modules/ticket/front/descriptor-menu/index.spec.js
index 48b64f4a0..babc22038 100644
--- a/modules/ticket/front/descriptor-menu/index.spec.js
+++ b/modules/ticket/front/descriptor-menu/index.spec.js
@@ -43,7 +43,7 @@ describe('Ticket Component vnTicketDescriptorMenu', () => {
describe('canRestoreTicket() getter', () => {
it('should return true for a ticket deleted within the last hour', () => {
controller.ticket.isDeleted = true;
- controller.ticket.updated = new Date();
+ controller.ticket.updated = Date.vnNew();
const result = controller.canRestoreTicket;
@@ -51,7 +51,7 @@ describe('Ticket Component vnTicketDescriptorMenu', () => {
});
it('should return false for a ticket deleted more than one hour ago', () => {
- const pastHour = new Date();
+ const pastHour = Date.vnNew();
pastHour.setHours(pastHour.getHours() - 2);
controller.ticket.isDeleted = true;
@@ -286,9 +286,34 @@ describe('Ticket Component vnTicketDescriptorMenu', () => {
describe('hasDocuware()', () => {
it('should call hasDocuware method', () => {
- $httpBackend.whenPOST(`Docuwares/${ticket.id}/checkFile`).respond();
+ $httpBackend.whenPOST(`Docuwares/${ticket.id}/checkFile`).respond(true);
controller.hasDocuware();
$httpBackend.flush();
+
+ expect(controller.hasDocuwareFile).toBe(true);
+ });
+ });
+
+ describe('uploadDocuware()', () => {
+ it('should open dialog if not force', () => {
+ controller.$.pdfToTablet = {show: () => {}};
+ jest.spyOn(controller.$.pdfToTablet, 'show');
+ controller.uploadDocuware(false);
+
+ expect(controller.$.pdfToTablet.show).toHaveBeenCalled();
+ });
+
+ it('should make a query and show balance create', () => {
+ controller.$.balanceCreate = {show: () => {}};
+ jest.spyOn(controller.$.balanceCreate, 'show');
+ jest.spyOn(controller.vnApp, 'showSuccess');
+
+ $httpBackend.whenPOST(`Docuwares/${ticket.id}/upload`).respond(true);
+ controller.uploadDocuware(true);
+ $httpBackend.flush();
+
+ expect(controller.vnApp.showSuccess).toHaveBeenCalled();
+ expect(controller.$.balanceCreate.show).toHaveBeenCalled();
});
});
diff --git a/modules/ticket/front/descriptor-menu/locale/es.yml b/modules/ticket/front/descriptor-menu/locale/es.yml
index a2725f485..b51637524 100644
--- a/modules/ticket/front/descriptor-menu/locale/es.yml
+++ b/modules/ticket/front/descriptor-menu/locale/es.yml
@@ -1,9 +1,11 @@
Show Delivery Note...: Ver albarán...
Send Delivery Note...: Enviar albarán...
as PDF: como PDF
+as PDF signed: como PDF firmado
as CSV: como CSV
as PDF without prices: como PDF sin precios
Send PDF: Enviar PDF
+Send PDF to tablet: Enviar PDF a tablet
Send CSV: Enviar CSV
Send CSV Delivery Note: Enviar albarán en CSV
Send PDF Delivery Note: Enviar albarán en PDF
@@ -13,3 +15,6 @@ Invoice sent: Factura enviada
The following refund ticket have been created: "Se ha creado siguiente ticket de abono: {{ticketId}}"
Transfer client: Transferir cliente
SMS Notify changes: SMS Notificar cambios
+PDF sent!: ¡PDF enviado!
+Already exist signed delivery note: Ya existe albarán de entrega firmado
+Are you sure you want to replace this delivery note?: ¿Seguro que quieres reemplazar este albarán de entrega?
diff --git a/modules/ticket/front/expedition/index.js b/modules/ticket/front/expedition/index.js
index 7ffe2fe5e..2d4432fe8 100644
--- a/modules/ticket/front/expedition/index.js
+++ b/modules/ticket/front/expedition/index.js
@@ -4,7 +4,7 @@ import Section from 'salix/components/section';
class Controller extends Section {
constructor($element, $scope) {
super($element, $scope);
- this.landed = new Date();
+ this.landed = Date.vnNew();
this.newRoute = null;
}
diff --git a/modules/ticket/front/expedition/index.spec.js b/modules/ticket/front/expedition/index.spec.js
index 5a538b1c8..71e32151c 100644
--- a/modules/ticket/front/expedition/index.spec.js
+++ b/modules/ticket/front/expedition/index.spec.js
@@ -76,7 +76,7 @@ describe('Ticket', () => {
it('should make a query and then call to the $state go() method', () => {
jest.spyOn(controller.$state, 'go').mockReturnThis();
- const landed = new Date();
+ const landed = Date.vnNew();
const ticket = {
clientFk: 1101,
landed: landed,
diff --git a/modules/ticket/front/future-search-panel/index.js b/modules/ticket/front/future-search-panel/index.js
index d7e7b3a5e..8a75420df 100644
--- a/modules/ticket/front/future-search-panel/index.js
+++ b/modules/ticket/front/future-search-panel/index.js
@@ -25,7 +25,10 @@ class Controller extends SearchPanel {
getItemPackingTypes() {
let itemPackingTypes = [];
- this.$http.get('ItemPackingTypes').then(res => {
+ const filter = {
+ where: {isActive: true}
+ };
+ this.$http.get('ItemPackingTypes', {filter}).then(res => {
for (let ipt of res.data) {
itemPackingTypes.push({
description: this.$t(ipt.description),
diff --git a/modules/ticket/front/future/index.html b/modules/ticket/front/future/index.html
index 1af1fb9ba..c0e1decc2 100644
--- a/modules/ticket/front/future/index.html
+++ b/modules/ticket/front/future/index.html
@@ -129,12 +129,12 @@
class="link">
{{::ticket.id}}
|
-
+ |
- {{::ticket.shipped | date: 'dd/MM/yyyy'}}
+ {{::ticket.shipped | date: 'dd/MM/yyyy HH:mm'}}
|
- {{::ticket.ipt}} |
+ {{::ticket.ipt | dashIfEmpty}} |
@@ -150,12 +150,12 @@
{{::ticket.futureId}}
|
-
+ |
- {{::ticket.futureShipped | date: 'dd/MM/yyyy'}}
+ {{::ticket.futureShipped | date: 'dd/MM/yyyy HH:mm'}}
|
- {{::ticket.futureIpt}} |
+ {{::ticket.futureIpt | dashIfEmpty}} |
diff --git a/modules/ticket/front/future/index.js b/modules/ticket/front/future/index.js
index 56ba1608e..81ef08825 100644
--- a/modules/ticket/front/future/index.js
+++ b/modules/ticket/front/future/index.js
@@ -34,6 +34,7 @@ export default class Controller extends Section {
field: 'ipt',
autocomplete: {
url: 'ItemPackingTypes',
+ where: `{isActive: true}`,
showField: 'description',
valueField: 'code'
}
@@ -42,6 +43,7 @@ export default class Controller extends Section {
field: 'futureIpt',
autocomplete: {
url: 'ItemPackingTypes',
+ where: `{isActive: true}`,
showField: 'description',
valueField: 'code'
}
@@ -55,7 +57,7 @@ export default class Controller extends Section {
}
setDefaultFilter() {
- const today = new Date();
+ const today = Date.vnNew();
this.filterParams = {
originDated: today,
@@ -66,7 +68,7 @@ export default class Controller extends Section {
}
compareDate(date) {
- let today = new Date();
+ let today = Date.vnNew();
today.setHours(0, 0, 0, 0);
let timeTicket = new Date(date);
timeTicket.setHours(0, 0, 0, 0);
diff --git a/modules/ticket/front/future/index.spec.js b/modules/ticket/front/future/index.spec.js
index c609a4891..188421298 100644
--- a/modules/ticket/front/future/index.spec.js
+++ b/modules/ticket/front/future/index.spec.js
@@ -2,7 +2,7 @@ import './index.js';
import crudModel from 'core/mocks/crud-model';
describe('Component vnTicketFuture', () => {
- const today = new Date();
+ const today = Date.vnNew();
let controller;
let $httpBackend;
@@ -32,7 +32,7 @@ describe('Component vnTicketFuture', () => {
});
it('should return sucess when the date is in the future', () => {
- let futureDate = new Date();
+ let futureDate = Date.vnNew();
futureDate = futureDate.setDate(futureDate.getDate() + 10);
let result = controller.compareDate(futureDate);
@@ -40,7 +40,7 @@ describe('Component vnTicketFuture', () => {
});
it('should return undefined when the date is in the past', () => {
- let pastDate = new Date();
+ let pastDate = Date.vnNew();
pastDate = pastDate.setDate(pastDate.getDate() - 10);
let result = controller.compareDate(pastDate);
diff --git a/modules/ticket/front/index/index.js b/modules/ticket/front/index/index.js
index 3039a2a03..42332ccc8 100644
--- a/modules/ticket/front/index/index.js
+++ b/modules/ticket/front/index/index.js
@@ -90,7 +90,7 @@ export default class Controller extends Section {
}
compareDate(date) {
- let today = new Date();
+ let today = Date.vnNew();
today.setHours(0, 0, 0, 0);
let timeTicket = new Date(date);
timeTicket.setHours(0, 0, 0, 0);
diff --git a/modules/ticket/front/index/index.spec.js b/modules/ticket/front/index/index.spec.js
index 03071654e..5046387b0 100644
--- a/modules/ticket/front/index/index.spec.js
+++ b/modules/ticket/front/index/index.spec.js
@@ -31,14 +31,14 @@ describe('Component vnTicketIndex', () => {
describe('compareDate()', () => {
it('should return warning when the date is the present', () => {
- let today = new Date();
+ let today = Date.vnNew();
let result = controller.compareDate(today);
expect(result).toEqual('warning');
});
it('should return sucess when the date is in the future', () => {
- let futureDate = new Date();
+ let futureDate = Date.vnNew();
futureDate = futureDate.setDate(futureDate.getDate() + 10);
let result = controller.compareDate(futureDate);
@@ -46,7 +46,7 @@ describe('Component vnTicketIndex', () => {
});
it('should return undefined when the date is in the past', () => {
- let pastDate = new Date();
+ let pastDate = Date.vnNew();
pastDate = pastDate.setDate(pastDate.getDate() - 10);
let result = controller.compareDate(pastDate);
diff --git a/modules/ticket/front/main/index.js b/modules/ticket/front/main/index.js
index 1b807216b..3f9482fc4 100644
--- a/modules/ticket/front/main/index.js
+++ b/modules/ticket/front/main/index.js
@@ -22,7 +22,7 @@ export default class Ticket extends ModuleMain {
$params.scopeDays = 1;
if (typeof $params.scopeDays === 'number') {
- const from = new Date();
+ const from = Date.vnNew();
from.setHours(0, 0, 0, 0);
const to = new Date(from.getTime());
diff --git a/modules/ticket/front/package/index.js b/modules/ticket/front/package/index.js
index ed13f12d8..fd67ce583 100644
--- a/modules/ticket/front/package/index.js
+++ b/modules/ticket/front/package/index.js
@@ -6,7 +6,7 @@ class Controller extends Section {
this.$.model.insert({
packagingFk: null,
quantity: null,
- created: new Date(),
+ created: Date.vnNew(),
ticketFk: this.$params.id
});
}
diff --git a/modules/ticket/front/sale-tracking/index.html b/modules/ticket/front/sale-tracking/index.html
index fc585650a..c21eaa46a 100644
--- a/modules/ticket/front/sale-tracking/index.html
+++ b/modules/ticket/front/sale-tracking/index.html
@@ -1,10 +1,11 @@
@@ -12,33 +13,29 @@
-
+ Is checked
Item
- Description
+ Description
Quantity
- Original
- Worker
- State
- Created
+
-
-
-
-
+
+
+
+
+
+
+
-
- {{sale.itemFk | zeroFill:6}}
+ {{::sale.item.id}}
-
+
{{::sale.item.name}}
@@ -53,16 +50,18 @@
{{::sale.quantity}}
- {{::sale.originalQuantity}}
-
-
- {{::sale.userNickname | dashIfEmpty}}
-
+
+
+
+
+
- {{::sale.state}}
- {{::sale.created | date: 'dd/MM/yyyy HH:mm'}}
@@ -70,8 +69,95 @@
+ warehouse-fk="$ctrl.ticket.warehouseFk"
+ ticket-fk="$ctrl.ticket.id">
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+ Quantity
+ Original
+ Worker
+ State
+ Created
+
+
+
+
+ {{::saleTracking.quantity}}
+ {{::saleTracking.originalQuantity}}
+
+
+ {{::saleTracking.name | dashIfEmpty}}
+
+
+ {{::saleTracking.state}}
+ {{::saleTracking.created | date: 'dd/MM/yyyy HH:mm'}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Quantity
+ Worker
+ Shelving
+ Parking
+ Created
+
+
+
+
+ {{::itemShelvingSale.quantity}}
+
+
+ {{::itemShelvingSale.name | dashIfEmpty}}
+
+
+ {{::itemShelvingSale.shelvingFk}}
+ {{::itemShelvingSale.code}}
+ {{::itemShelvingSale.created | date: 'dd/MM/yyyy HH:mm'}}
+
+
+
+
+
+
+
+
diff --git a/modules/ticket/front/sale-tracking/index.js b/modules/ticket/front/sale-tracking/index.js
index 394ef4f1e..d1c80f30f 100644
--- a/modules/ticket/front/sale-tracking/index.js
+++ b/modules/ticket/front/sale-tracking/index.js
@@ -1,12 +1,100 @@
import ngModule from '../module';
import Section from 'salix/components/section';
+import './style.scss';
-class Controller extends Section {}
+class Controller extends Section {
+ constructor($element, $) {
+ super($element, $);
+ this.filter = {
+ include: [
+ {
+ relation: 'item'
+ }, {
+ relation: 'saleTracking',
+ scope: {
+ fields: ['isChecked']
+ }
+ }
+ ]
+ };
+ }
+
+ get sales() {
+ return this._sales;
+ }
+
+ set sales(value) {
+ this._sales = value;
+ if (value) {
+ const query = `Sales/${this.$params.id}/salePreparingList`;
+ this.$http.get(query)
+ .then(res => {
+ this.salePreparingList = res.data;
+ for (const salePreparing of this.salePreparingList) {
+ for (const sale of this.sales) {
+ if (salePreparing.saleFk == sale.id)
+ sale.preparingList = salePreparing;
+ }
+ }
+ });
+ }
+ }
+
+ showItemDescriptor(event, sale) {
+ this.quicklinks = {
+ btnThree: {
+ icon: 'icon-transaction',
+ state: `item.card.diary({
+ id: ${sale.item.id},
+ warehouseFk: ${this.ticket.warehouseFk},
+ lineFk: ${sale.id}
+ })`,
+ tooltip: 'Item diary'
+ }
+ };
+ this.$.itemDescriptor.show(event.target, sale.item.id);
+ }
+
+ chipHasSaleGroupDetail(hasSaleGroupDetail) {
+ if (hasSaleGroupDetail) return 'pink';
+ else return 'message';
+ }
+
+ chipIsPreviousSelected(isPreviousSelected) {
+ if (isPreviousSelected) return 'notice';
+ else return 'message';
+ }
+
+ chipIsPrevious(isPrevious) {
+ if (isPrevious) return 'dark-notice';
+ else return 'message';
+ }
+
+ chipIsPrepared(isPrepared) {
+ if (isPrepared) return 'warning';
+ else return 'message';
+ }
+
+ chipIsControled(isControled) {
+ if (isControled) return 'yellow';
+ else return 'message';
+ }
+
+ showSaleTracking(sale) {
+ this.saleId = sale.id;
+ this.$.saleTracking.show();
+ }
+
+ showItemShelvingSale(sale) {
+ this.saleId = sale.id;
+ this.$.itemShelvingSale.show();
+ }
+}
ngModule.vnComponent('vnTicketSaleTracking', {
template: require('./index.html'),
controller: Controller,
bindings: {
- ticket: '<',
- },
+ ticket: '<'
+ }
});
diff --git a/modules/ticket/front/sale-tracking/locale/es.yml b/modules/ticket/front/sale-tracking/locale/es.yml
new file mode 100644
index 000000000..eabc0a04d
--- /dev/null
+++ b/modules/ticket/front/sale-tracking/locale/es.yml
@@ -0,0 +1,6 @@
+ItemShelvings sale: Carros línea
+has saleGroupDetail: tiene detalle grupo lineas
+is previousSelected: es previa seleccionada
+is previous: es previa
+is prepared: esta preparado
+is controled: esta controlado
diff --git a/modules/ticket/front/sale-tracking/style.scss b/modules/ticket/front/sale-tracking/style.scss
new file mode 100644
index 000000000..6d8b3db69
--- /dev/null
+++ b/modules/ticket/front/sale-tracking/style.scss
@@ -0,0 +1,7 @@
+@import "variables";
+
+.chip {
+ display: inline-block;
+ min-width: 15px;
+ min-height: 25px;
+}
diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html
index c624b1a95..fe259cf87 100644
--- a/modules/ticket/front/sale/index.html
+++ b/modules/ticket/front/sale/index.html
@@ -22,6 +22,7 @@
disabled="!$ctrl.isEditable"
label="State"
value-field="code"
+ fields="['id', 'name', 'alertLevel', 'code']"
url="States/editableStates"
on-change="$ctrl.changeState(value)">
@@ -30,7 +31,7 @@
ng-click="moreOptions.show($event)"
ng-show="$ctrl.hasSelectedSales()">
-
-
@@ -68,6 +69,7 @@
Disc
Amount
Packaging
+
@@ -84,13 +86,13 @@
vn-tooltip="{{::$ctrl.$t('Claim')}}: {{::sale.claim.claimFk}}">
-
-
@@ -108,21 +110,21 @@
-
-
{{::sale.visible}}
-
{{::sale.available}}
@@ -195,7 +197,7 @@
translate-attr="{title: !$ctrl.isLocked ? 'Edit discount' : ''}"
ng-click="$ctrl.showEditDiscountPopover($event, sale)"
ng-if="sale.id">
- {{(sale.discount / 100) | percentage}}
+ {{(sale.discount / 100) | percentage}}
@@ -204,6 +206,22 @@
{{::sale.item.itemPackingTypeFk | dashIfEmpty}}
+
+
+
+
+
+
+
@@ -383,8 +401,8 @@
|
-
{{::ticket.id}} |
@@ -392,22 +410,22 @@
{{::ticket.agencyName}} |
{{::ticket.address}}
- {{::ticket.nickname}}
- {{::ticket.name}}
- {{::ticket.street}}
- {{::ticket.postalCode}}
+ {{::ticket.nickname}}
+ {{::ticket.name}}
+ {{::ticket.street}}
+ {{::ticket.postalCode}}
{{::ticket.city}}
|
@@ -441,10 +459,11 @@
-
-
+ sms="$ctrl.newSMS"
+ on-send="$ctrl.onSmsSend($sms)">
+
Refund
-
\ No newline at end of file
+
diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js
index f64d0b61b..f3fb89d04 100644
--- a/modules/ticket/front/sale/index.js
+++ b/modules/ticket/front/sale/index.js
@@ -51,7 +51,7 @@ class Controller extends Section {
const hasClaimManagerRole = this.aclService.hasAny(['claimManager']);
- return landedPlusWeek >= new Date() || hasClaimManagerRole;
+ return landedPlusWeek >= Date.vnNew() || hasClaimManagerRole;
}
return false;
}
@@ -389,6 +389,11 @@ class Controller extends Section {
this.$.sms.open();
}
+ onSmsSend(sms) {
+ return this.$http.post(`Tickets/${this.ticket.id}/sendSms`, sms)
+ .then(() => this.vnApp.showSuccess(this.$t('SMS sent')));
+ }
+
/**
* Inserts a new instance
*/
diff --git a/modules/ticket/front/sale/index.spec.js b/modules/ticket/front/sale/index.spec.js
index fbee966fd..8585503cc 100644
--- a/modules/ticket/front/sale/index.spec.js
+++ b/modules/ticket/front/sale/index.spec.js
@@ -15,9 +15,9 @@ describe('Ticket', () => {
const ticket = {
id: 1,
clientFk: 1101,
- shipped: new Date(),
- landed: new Date(),
- created: new Date(),
+ shipped: Date.vnNew(),
+ landed: Date.vnNew(),
+ created: Date.vnNew(),
client: {salesPersonFk: 1},
address: {mobile: 111111111}
};
diff --git a/modules/ticket/front/sale/locale/es.yml b/modules/ticket/front/sale/locale/es.yml
index 072e57534..2668b7811 100644
--- a/modules/ticket/front/sale/locale/es.yml
+++ b/modules/ticket/front/sale/locale/es.yml
@@ -13,9 +13,9 @@ New ticket: Nuevo ticket
Edit price: Editar precio
You are going to delete lines of the ticket: Vas a eliminar lineas del ticket
This ticket will be removed from current route! Continue anyway?: ¡Se eliminará el ticket de la ruta actual! ¿Continuar de todas formas?
-You have to allow pop-ups in your web browser to use this functionality:
+You have to allow pop-ups in your web browser to use this functionality:
Debes permitir los pop-pups en tu navegador para que esta herramienta funcione correctamente
-Disc: Dto
+Disc: Dto
Available: Disponible
What is the day of receipt of the ticket?: ¿Cual es el día de preparación del pedido?
Add claim: Crear reclamación
@@ -39,3 +39,4 @@ Packaging: Encajado
Refund: Abono
Promotion mana: Maná promoción
Claim mana: Maná reclamación
+History: Historial
diff --git a/modules/ticket/front/search-panel/index.spec.js b/modules/ticket/front/search-panel/index.spec.js
index 41c32c047..df320b55b 100644
--- a/modules/ticket/front/search-panel/index.spec.js
+++ b/modules/ticket/front/search-panel/index.spec.js
@@ -38,7 +38,7 @@ describe('Ticket Component vnTicketSearchPanel', () => {
it('should clear the scope days when setting the from property', () => {
controller.filter.scopeDays = 1;
- controller.from = new Date();
+ controller.from = Date.vnNew();
expect(controller.filter.scopeDays).toBeNull();
expect(controller.from).toBeDefined();
@@ -49,7 +49,7 @@ describe('Ticket Component vnTicketSearchPanel', () => {
it('should clear the scope days when setting the to property', () => {
controller.filter.scopeDays = 1;
- controller.to = new Date();
+ controller.to = Date.vnNew();
expect(controller.filter.scopeDays).toBeNull();
expect(controller.to).toBeDefined();
@@ -58,8 +58,8 @@ describe('Ticket Component vnTicketSearchPanel', () => {
describe('scopeDays() setter', () => {
it('should clear the date range when setting the scopeDays property', () => {
- controller.filter.from = new Date();
- controller.filter.to = new Date();
+ controller.filter.from = Date.vnNew();
+ controller.filter.to = Date.vnNew();
controller.scopeDays = 1;
diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html
index fe49a301f..af44ed67c 100644
--- a/modules/ticket/front/summary/index.html
+++ b/modules/ticket/front/summary/index.html
@@ -1,6 +1,6 @@
-
- Ticket #{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}}
+ Ticket #{{$ctrl.summary.id}} - {{$ctrl.summary.client.name}}
({{$ctrl.summary.client.id}}) - {{$ctrl.summary.nickname}}
-
-
-
-
{{$ctrl.summary.client.salesPersonUser.name}}
-
@@ -47,11 +48,11 @@
{{$ctrl.summary.zone.name}}
-
-
{{$ctrl.summary.routeFk}}
@@ -66,17 +67,17 @@
-
-
-
+
\ No newline at end of file
diff --git a/modules/ticket/front/weekly/index.js b/modules/ticket/front/weekly/index.js
index 71365c4b3..a10ff7184 100644
--- a/modules/ticket/front/weekly/index.js
+++ b/modules/ticket/front/weekly/index.js
@@ -1,3 +1,4 @@
+
import ngModule from '../module';
import Section from 'salix/components/section';
@@ -15,6 +16,44 @@ export default class Controller extends Section {
{id: 5, name: 'Saturday'},
{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) {
diff --git a/modules/travel/back/methods/thermograph/createThermograph.js b/modules/travel/back/methods/thermograph/createThermograph.js
index 23d9d6037..75d967628 100644
--- a/modules/travel/back/methods/thermograph/createThermograph.js
+++ b/modules/travel/back/methods/thermograph/createThermograph.js
@@ -40,7 +40,7 @@ module.exports = Self => {
const models = Self.app.models;
let tx;
const myOptions = {};
- const date = new Date();
+ const date = Date.vnNew();
if (typeof options == 'object')
Object.assign(myOptions, options);
diff --git a/modules/travel/back/methods/travel/cloneWithEntries.js b/modules/travel/back/methods/travel/cloneWithEntries.js
index 611f4e429..e5b6b1580 100644
--- a/modules/travel/back/methods/travel/cloneWithEntries.js
+++ b/modules/travel/back/methods/travel/cloneWithEntries.js
@@ -39,8 +39,8 @@ module.exports = Self => {
'ref'
]
});
- const started = new Date();
- const ended = new Date();
+ const started = Date.vnNew();
+ const ended = Date.vnNew();
if (!travel)
throw new UserError('Travel not found');
diff --git a/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js b/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js
index 2e79ff193..0e434e048 100644
--- a/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js
+++ b/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js
@@ -49,7 +49,7 @@ describe('Travel cloneWithEntries()', () => {
pending('#2687 - Cannot make a data rollback because of the triggers');
const warehouseThree = 3;
const agencyModeOne = 1;
- const yesterday = new Date();
+ const yesterday = Date.vnNew();
yesterday.setDate(yesterday.getDate() - 1);
travelBefore = await models.Travel.findById(travelId);
diff --git a/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js b/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js
index 3693aae82..599851b55 100644
--- a/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js
+++ b/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js
@@ -95,10 +95,10 @@ describe('Travel extraCommunityFilter()', () => {
});
it('should return the routes matching "shipped from" and "landed to"', async() => {
- const from = new Date();
+ const from = Date.vnNew();
from.setDate(from.getDate() - 2);
from.setHours(0, 0, 0, 0);
- const to = new Date();
+ const to = Date.vnNew();
to.setHours(23, 59, 59, 999);
to.setDate(to.getDate() + 7);
const ctx = {
diff --git a/modules/travel/back/methods/travel/specs/filter.spec.js b/modules/travel/back/methods/travel/specs/filter.spec.js
index c739866a0..1a6ee895c 100644
--- a/modules/travel/back/methods/travel/specs/filter.spec.js
+++ b/modules/travel/back/methods/travel/specs/filter.spec.js
@@ -54,8 +54,8 @@ describe('Travel filter()', () => {
});
it('should return the routes matching "shipped from" and "shipped to"', async() => {
- const from = new Date();
- const to = new Date();
+ const from = Date.vnNew();
+ const to = Date.vnNew();
from.setHours(0, 0, 0, 0);
to.setHours(23, 59, 59, 999);
to.setDate(to.getDate() + 1);
diff --git a/modules/travel/front/create/index.spec.js b/modules/travel/front/create/index.spec.js
index e3f85d9ae..cdff8cfb9 100644
--- a/modules/travel/front/create/index.spec.js
+++ b/modules/travel/front/create/index.spec.js
@@ -53,7 +53,7 @@ describe('Travel Component vnTravelCreate', () => {
it(`should do nothing if there's no response data.`, () => {
controller.travel = {agencyModeFk: 4};
- const tomorrow = new Date();
+ const tomorrow = Date.vnNew();
const query = `travels/getAverageDays?agencyModeFk=${controller.travel.agencyModeFk}`;
$httpBackend.expectGET(query).respond(undefined);
@@ -67,7 +67,7 @@ describe('Travel Component vnTravelCreate', () => {
it(`should fill the fields when it's selected a date and agency.`, () => {
controller.travel = {agencyModeFk: 1};
- const tomorrow = new Date();
+ const tomorrow = Date.vnNew();
tomorrow.setDate(tomorrow.getDate() + 9);
const expectedResponse = {
id: 8,
diff --git a/modules/travel/front/extra-community/index.html b/modules/travel/front/extra-community/index.html
index 5174f8da2..ee8dcdf98 100644
--- a/modules/travel/front/extra-community/index.html
+++ b/modules/travel/front/extra-community/index.html
@@ -27,7 +27,7 @@
diff --git a/modules/travel/front/extra-community/index.js b/modules/travel/front/extra-community/index.js
index a4ac487e6..920339469 100644
--- a/modules/travel/front/extra-community/index.js
+++ b/modules/travel/front/extra-community/index.js
@@ -25,12 +25,12 @@ class Controller extends Section {
this.droppableElement = 'tbody[vn-droppable]';
const twoDays = 2;
- const shippedFrom = new Date();
+ const shippedFrom = Date.vnNew();
shippedFrom.setDate(shippedFrom.getDate() - twoDays);
shippedFrom.setHours(0, 0, 0, 0);
const sevenDays = 7;
- const landedTo = new Date();
+ const landedTo = Date.vnNew();
landedTo.setDate(landedTo.getDate() + sevenDays);
landedTo.setHours(23, 59, 59, 59);
@@ -43,16 +43,6 @@ class Controller extends Section {
this.smartTableOptions = {};
}
- get hasDateRange() {
- const userParams = this.$.model.userParams;
- const hasLanded = userParams.landedTo;
- const hasShipped = userParams.shippedFrom;
- const hasContinent = userParams.continent;
- const hasWarehouseOut = userParams.warehouseOutFk;
-
- return hasLanded || hasShipped || hasContinent || hasWarehouseOut;
- }
-
onDragInterval() {
if (this.dragClientY > 0 && this.dragClientY < 75)
this.$window.scrollTo(0, this.$window.scrollY - 10);
diff --git a/modules/travel/front/extra-community/index.spec.js b/modules/travel/front/extra-community/index.spec.js
index ae48b9ca1..18ddee665 100644
--- a/modules/travel/front/extra-community/index.spec.js
+++ b/modules/travel/front/extra-community/index.spec.js
@@ -14,17 +14,6 @@ describe('Travel Component vnTravelExtraCommunity', () => {
controller.$.model.refresh = jest.fn();
}));
- describe('hasDateRange()', () => {
- it('should return truthy when shippedFrom or landedTo are set as userParams', () => {
- const now = new Date();
- controller.$.model.userParams = {shippedFrom: now, landedTo: now};
-
- const result = controller.hasDateRange;
-
- expect(result).toBeTruthy();
- });
- });
-
describe('findDraggable()', () => {
it('should find the draggable element', () => {
const draggable = document.createElement('tr');
diff --git a/modules/travel/front/index/index.js b/modules/travel/front/index/index.js
index 50036831f..7701289b7 100644
--- a/modules/travel/front/index/index.js
+++ b/modules/travel/front/index/index.js
@@ -20,7 +20,7 @@ export default class Controller extends Section {
}
compareDate(date) {
- let today = new Date();
+ let today = Date.vnNew();
today.setHours(0, 0, 0, 0);
date = new Date(date);
diff --git a/modules/travel/front/index/index.spec.js b/modules/travel/front/index/index.spec.js
index 9abe46a64..9083c4519 100644
--- a/modules/travel/front/index/index.spec.js
+++ b/modules/travel/front/index/index.spec.js
@@ -50,7 +50,7 @@ describe('Travel Component vnTravelIndex', () => {
describe('compareDate()', () => {
it('should return warning if the date passed to compareDate() is todays', () => {
- const today = new Date();
+ const today = Date.vnNew();
const result = controller.compareDate(today);
@@ -58,7 +58,7 @@ describe('Travel Component vnTravelIndex', () => {
});
it('should return success if the date passed to compareDate() is in the future', () => {
- const tomorrow = new Date();
+ const tomorrow = Date.vnNew();
tomorrow.setDate(tomorrow.getDate() + 1);
const result = controller.compareDate(tomorrow);
@@ -67,7 +67,7 @@ describe('Travel Component vnTravelIndex', () => {
});
it('should return undefined if the date passed to compareDate() is in the past', () => {
- const yesterday = new Date();
+ const yesterday = Date.vnNew();
yesterday.setDate(yesterday.getDate() - 1);
const result = controller.compareDate(yesterday);
diff --git a/modules/travel/front/main/index.js b/modules/travel/front/main/index.js
index d6f103033..fbaf78c16 100644
--- a/modules/travel/front/main/index.js
+++ b/modules/travel/front/main/index.js
@@ -15,7 +15,7 @@ export default class Travel extends ModuleMain {
$params.scopeDays = 1;
if (typeof $params.scopeDays === 'number') {
- const shippedFrom = new Date();
+ const shippedFrom = Date.vnNew();
shippedFrom.setHours(0, 0, 0, 0);
const shippedTo = new Date(shippedFrom.getTime());
diff --git a/modules/travel/front/main/index.spec.js b/modules/travel/front/main/index.spec.js
index 6d9db4dc8..bf5a27b41 100644
--- a/modules/travel/front/main/index.spec.js
+++ b/modules/travel/front/main/index.spec.js
@@ -15,7 +15,7 @@ describe('Travel Component vnTravel', () => {
let params = controller.fetchParams({
scopeDays: 2
});
- const shippedFrom = new Date();
+ const shippedFrom = Date.vnNew();
shippedFrom.setHours(0, 0, 0, 0);
const shippedTo = new Date(shippedFrom.getTime());
shippedTo.setDate(shippedTo.getDate() + params.scopeDays);
diff --git a/modules/travel/front/search-panel/index.spec.js b/modules/travel/front/search-panel/index.spec.js
index a1f3c36b3..884f4fb17 100644
--- a/modules/travel/front/search-panel/index.spec.js
+++ b/modules/travel/front/search-panel/index.spec.js
@@ -15,7 +15,7 @@ describe('Travel Component vnTravelSearchPanel', () => {
it('should clear the scope days when setting the from property', () => {
controller.filter.scopeDays = 1;
- controller.shippedFrom = new Date();
+ controller.shippedFrom = Date.vnNew();
expect(controller.filter.scopeDays).toBeNull();
expect(controller.shippedFrom).toBeDefined();
@@ -26,7 +26,7 @@ describe('Travel Component vnTravelSearchPanel', () => {
it('should clear the scope days when setting the to property', () => {
controller.filter.scopeDays = 1;
- controller.shippedTo = new Date();
+ controller.shippedTo = Date.vnNew();
expect(controller.filter.scopeDays).toBeNull();
expect(controller.shippedTo).toBeDefined();
@@ -35,8 +35,8 @@ describe('Travel Component vnTravelSearchPanel', () => {
describe('scopeDays() setter', () => {
it('should clear the date range when setting the scopeDays property', () => {
- controller.filter.shippedFrom = new Date();
- controller.filter.shippedTo = new Date();
+ controller.filter.shippedFrom = Date.vnNew();
+ controller.filter.shippedTo = Date.vnNew();
controller.scopeDays = 1;
diff --git a/modules/worker/back/methods/calendar/absences.js b/modules/worker/back/methods/calendar/absences.js
index ddf38a604..8420ed770 100644
--- a/modules/worker/back/methods/calendar/absences.js
+++ b/modules/worker/back/methods/calendar/absences.js
@@ -35,12 +35,12 @@ module.exports = Self => {
Self.absences = async(ctx, workerFk, businessFk, year, options) => {
const models = Self.app.models;
- const started = new Date();
+ const started = Date.vnNew();
started.setFullYear(year);
started.setMonth(0);
started.setDate(1);
- const ended = new Date();
+ const ended = Date.vnNew();
ended.setFullYear(year);
ended.setMonth(12);
ended.setDate(0);
diff --git a/modules/worker/back/methods/calendar/specs/absences.spec.js b/modules/worker/back/methods/calendar/specs/absences.spec.js
index 2180a5312..365773182 100644
--- a/modules/worker/back/methods/calendar/specs/absences.spec.js
+++ b/modules/worker/back/methods/calendar/specs/absences.spec.js
@@ -6,7 +6,7 @@ describe('Worker absences()', () => {
const workerId = 1106;
const businessId = 1106;
- const now = new Date();
+ const now = Date.vnNew();
const year = now.getFullYear();
const [absences] = await app.models.Calendar.absences(ctx, workerId, businessId, year);
@@ -22,7 +22,7 @@ describe('Worker absences()', () => {
const businessId = 1106;
const ctx = {req: {accessToken: {userId: 9}}};
- const now = new Date();
+ const now = Date.vnNew();
const year = now.getFullYear();
const tx = await app.models.Calendar.beginTransaction({});
@@ -55,15 +55,15 @@ describe('Worker absences()', () => {
const workerId = 1106;
const userId = 1106;
- const today = new Date();
+ const today = Date.vnNew();
// getting how many days in a year
- const yearStart = new Date();
+ const yearStart = Date.vnNew();
yearStart.setHours(0, 0, 0, 0);
yearStart.setMonth(0);
yearStart.setDate(1);
- const yearEnd = new Date();
+ const yearEnd = Date.vnNew();
const currentYear = yearEnd.getFullYear();
yearEnd.setFullYear(currentYear + 1);
yearEnd.setHours(0, 0, 0, 0);
@@ -92,7 +92,7 @@ describe('Worker absences()', () => {
// normal test begins
const contract = await app.models.WorkerLabour.findById(businessId, null, options);
- const startingContract = new Date();
+ const startingContract = Date.vnNew();
startingContract.setHours(0, 0, 0, 0);
startingContract.setMonth(today.getMonth());
startingContract.setDate(1);
diff --git a/modules/worker/back/methods/holiday/getByWarehouse.js b/modules/worker/back/methods/holiday/getByWarehouse.js
index 093885d13..50029e62b 100644
--- a/modules/worker/back/methods/holiday/getByWarehouse.js
+++ b/modules/worker/back/methods/holiday/getByWarehouse.js
@@ -17,7 +17,7 @@ module.exports = Self => {
});
Self.getByWarehouse = async warehouseFk => {
- let beginningYear = new Date();
+ let beginningYear = Date.vnNew();
beginningYear.setMonth(0);
beginningYear.setDate(1);
beginningYear.setHours(0, 0, 0, 0);
diff --git a/modules/worker/back/methods/worker-time-control-mail/checkInbox.js b/modules/worker/back/methods/worker-time-control-mail/checkInbox.js
index 7825f38b8..4d9f98cc3 100644
--- a/modules/worker/back/methods/worker-time-control-mail/checkInbox.js
+++ b/modules/worker/back/methods/worker-time-control-mail/checkInbox.js
@@ -93,7 +93,7 @@ module.exports = Self => {
};
async function emailConfirm(buffer) {
- const now = new Date();
+ const now = Date.vnNew();
const from = JSON.stringify(Imap.parseHeader(buffer).from);
const subject = JSON.stringify(Imap.parseHeader(buffer).subject);
@@ -121,7 +121,7 @@ module.exports = Self => {
}
async function emailReply(buffer, emailBody) {
- const now = new Date();
+ const now = Date.vnNew();
const from = JSON.stringify(Imap.parseHeader(buffer).from);
const subject = JSON.stringify(Imap.parseHeader(buffer).subject);
diff --git a/modules/worker/back/methods/worker-time-control/sendMail.js b/modules/worker/back/methods/worker-time-control/sendMail.js
index b38405c1d..579a83112 100644
--- a/modules/worker/back/methods/worker-time-control/sendMail.js
+++ b/modules/worker/back/methods/worker-time-control/sendMail.js
@@ -32,94 +32,87 @@ module.exports = Self => {
const models = Self.app.models;
const conn = Self.dataSource.connector;
const args = ctx.args;
- const $t = ctx.req.__; // $translate
let tx;
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
- if (!myOptions.transaction) {
- tx = await Self.beginTransaction({});
- myOptions.transaction = tx;
- }
-
const stmts = [];
let stmt;
- try {
- if (!args.week || !args.year) {
- const from = new Date();
- const to = new Date();
+ if (!args.week || !args.year) {
+ const from = Date.vnNew();
+ const to = Date.vnNew();
- const time = await models.Time.findOne({
- where: {
- dated: {between: [from.setDate(from.getDate() - 10), to.setDate(to.getDate() - 4)]}
- },
- order: 'week ASC'
- }, myOptions);
+ const time = await models.Time.findOne({
+ where: {
+ dated: {between: [from.setDate(from.getDate() - 10), to.setDate(to.getDate() - 4)]}
+ },
+ order: 'week ASC'
+ }, myOptions);
- args.week = time.week;
- args.year = time.year;
- }
+ args.week = time.week;
+ args.year = time.year;
+ }
- const started = getStartDateOfWeekNumber(args.week, args.year);
- started.setHours(0, 0, 0, 0);
+ const started = getStartDateOfWeekNumber(args.week, args.year);
+ started.setHours(0, 0, 0, 0);
- const ended = new Date(started);
- ended.setDate(started.getDate() + 6);
- ended.setHours(23, 59, 59, 999);
+ const ended = new Date(started);
+ ended.setDate(started.getDate() + 6);
+ ended.setHours(23, 59, 59, 999);
- stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate');
- stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate');
+ stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate');
+ stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate');
- if (args.workerId) {
- await models.WorkerTimeControl.destroyAll({
- userFk: args.workerId,
- timed: {between: [started, ended]},
- isSendMail: true
- }, myOptions);
+ if (args.workerId) {
+ await models.WorkerTimeControl.destroyAll({
+ userFk: args.workerId,
+ timed: {between: [started, ended]},
+ isSendMail: true
+ }, myOptions);
- const where = {
- workerFk: args.workerId,
- year: args.year,
- week: args.week
- };
- await models.WorkerTimeControlMail.updateAll(where, {
- updated: new Date(), state: 'SENDED'
- }, myOptions);
+ const where = {
+ workerFk: args.workerId,
+ year: args.year,
+ week: args.week
+ };
+ await models.WorkerTimeControlMail.updateAll(where, {
+ updated: Date.vnNew(), state: 'SENDED'
+ }, myOptions);
- stmt = new ParameterizedSQL(
- `CALL vn.timeControl_calculateByUser(?, ?, ?)
+ stmt = new ParameterizedSQL(
+ `CALL vn.timeControl_calculateByUser(?, ?, ?)
`, [args.workerId, started, ended]);
- stmts.push(stmt);
+ stmts.push(stmt);
- stmt = new ParameterizedSQL(
- `CALL vn.timeBusiness_calculateByUser(?, ?, ?)
+ stmt = new ParameterizedSQL(
+ `CALL vn.timeBusiness_calculateByUser(?, ?, ?)
`, [args.workerId, started, ended]);
- stmts.push(stmt);
- } else {
- await models.WorkerTimeControl.destroyAll({
- timed: {between: [started, ended]},
- isSendMail: true
- }, myOptions);
+ stmts.push(stmt);
+ } else {
+ await models.WorkerTimeControl.destroyAll({
+ timed: {between: [started, ended]},
+ isSendMail: true
+ }, myOptions);
- const where = {
- year: args.year,
- week: args.week
- };
- await models.WorkerTimeControlMail.updateAll(where, {
- updated: new Date(), state: 'SENDED'
- }, myOptions);
+ const where = {
+ year: args.year,
+ week: args.week
+ };
+ await models.WorkerTimeControlMail.updateAll(where, {
+ updated: Date.vnNew(), state: 'SENDED'
+ }, myOptions);
- stmt = new ParameterizedSQL(`CALL vn.timeControl_calculateAll(?, ?)`, [started, ended]);
- stmts.push(stmt);
+ stmt = new ParameterizedSQL(`CALL vn.timeControl_calculateAll(?, ?)`, [started, ended]);
+ stmts.push(stmt);
- stmt = new ParameterizedSQL(`CALL vn.timeBusiness_calculateAll(?, ?)`, [started, ended]);
- stmts.push(stmt);
- }
+ stmt = new ParameterizedSQL(`CALL vn.timeBusiness_calculateAll(?, ?)`, [started, ended]);
+ stmts.push(stmt);
+ }
- stmt = new ParameterizedSQL(`
+ stmt = new ParameterizedSQL(`
SELECT CONCAT(u.name, '@verdnatura.es') receiver,
u.id workerFk,
tb.dated,
@@ -154,25 +147,33 @@ module.exports = Self => {
AND w.businessFk
ORDER BY u.id, tb.dated
`, [args.workerId]);
- const index = stmts.push(stmt) - 1;
+ const index = stmts.push(stmt) - 1;
- const sql = ParameterizedSQL.join(stmts, ';');
- const days = await conn.executeStmt(sql, myOptions);
+ stmts.push('DROP TEMPORARY TABLE tmp.timeControlCalculate');
+ stmts.push('DROP TEMPORARY TABLE tmp.timeBusinessCalculate');
- let previousWorkerFk = days[index][0].workerFk;
- let previousReceiver = days[index][0].receiver;
+ const sql = ParameterizedSQL.join(stmts, ';');
+ const days = await conn.executeStmt(sql, myOptions);
- const workerTimeControlConfig = await models.WorkerTimeControlConfig.findOne(null, myOptions);
+ let previousWorkerFk = days[index][0].workerFk;
+ let previousReceiver = days[index][0].receiver;
- for (let day of days[index]) {
+ const workerTimeControlConfig = await models.WorkerTimeControlConfig.findOne(null, myOptions);
+
+ for (let day of days[index]) {
+ if (!myOptions.transaction) {
+ tx = await Self.beginTransaction({});
+ myOptions.transaction = tx;
+ }
+ try {
workerFk = day.workerFk;
if (day.timeWorkDecimal > 0 && day.timeWorkedDecimal == null
- && (day.permissionRate ? day.permissionRate : true)) {
+ && (day.permissionRate == null ? true : day.permissionRate)) {
if (day.timeTable == null) {
const timed = new Date(day.dated);
await models.WorkerTimeControl.create({
userFk: day.workerFk,
- timed: timed.setHours(8),
+ timed: timed.setHours(workerTimeControlConfig.teleworkingStart / 3600),
manual: true,
direction: 'in',
isSendMail: true
@@ -181,7 +182,7 @@ module.exports = Self => {
if (day.timeWorkDecimal >= workerTimeControlConfig.timeToBreakTime / 3600) {
await models.WorkerTimeControl.create({
userFk: day.workerFk,
- timed: timed.setHours(9),
+ timed: timed.setHours(workerTimeControlConfig.teleworkingStartBreakTime / 3600),
manual: true,
direction: 'middle',
isSendMail: true
@@ -189,7 +190,10 @@ module.exports = Self => {
await models.WorkerTimeControl.create({
userFk: day.workerFk,
- timed: timed.setHours(9, 20),
+ timed: timed.setHours(
+ workerTimeControlConfig.teleworkingStartBreakTime / 3600,
+ workerTimeControlConfig.breakTime / 60
+ ),
manual: true,
direction: 'middle',
isSendMail: true
@@ -199,7 +203,11 @@ module.exports = Self => {
const [hoursWork, minutesWork, secondsWork] = getTime(day.timeWorkSexagesimal);
await models.WorkerTimeControl.create({
userFk: day.workerFk,
- timed: timed.setHours(8 + hoursWork, minutesWork, secondsWork),
+ timed: timed.setHours(
+ workerTimeControlConfig.teleworkingStart / 3600 + hoursWork,
+ minutesWork,
+ secondsWork
+ ),
manual: true,
direction: 'out',
isSendMail: true
@@ -215,11 +223,11 @@ module.exports = Self => {
let timeTableDecimalInSeconds = 0;
for (let journey of journeys) {
- const start = new Date();
+ const start = Date.vnNew();
const [startHours, startMinutes, startSeconds] = getTime(journey.start);
start.setHours(startHours, startMinutes, startSeconds, 0);
- const end = new Date();
+ const end = Date.vnNew();
const [endHours, endMinutes, endSeconds] = getTime(journey.end);
end.setHours(endHours, endMinutes, endSeconds, 0);
@@ -307,7 +315,7 @@ module.exports = Self => {
}, myOptions);
if (firstWorkerTimeControl)
- firstWorkerTimeControl.updateAttribute('direction', 'in', myOptions);
+ await firstWorkerTimeControl.updateAttribute('direction', 'in', myOptions);
const lastWorkerTimeControl = await models.WorkerTimeControl.findOne({
where: {
@@ -318,7 +326,7 @@ module.exports = Self => {
}, myOptions);
if (lastWorkerTimeControl)
- lastWorkerTimeControl.updateAttribute('direction', 'out', myOptions);
+ await lastWorkerTimeControl.updateAttribute('direction', 'out', myOptions);
}
}
@@ -339,15 +347,18 @@ module.exports = Self => {
previousWorkerFk = day.workerFk;
previousReceiver = day.receiver;
}
+
+ if (tx) {
+ await tx.commit();
+ delete myOptions.transaction;
+ }
+ } catch (e) {
+ if (tx) await tx.rollback();
+ throw e;
}
-
- if (tx) await tx.commit();
-
- return true;
- } catch (e) {
- if (tx) await tx.rollback();
- throw e;
}
+
+ return true;
};
function getStartDateOfWeekNumber(week, year) {
diff --git a/modules/worker/back/methods/worker-time-control/specs/filter.spec.js b/modules/worker/back/methods/worker-time-control/specs/filter.spec.js
index 927d83df3..0c4d229f2 100644
--- a/modules/worker/back/methods/worker-time-control/specs/filter.spec.js
+++ b/modules/worker/back/methods/worker-time-control/specs/filter.spec.js
@@ -3,9 +3,9 @@ const models = require('vn-loopback/server/server').models;
describe('workerTimeControl filter()', () => {
it('should return 1 result filtering by id', async() => {
const ctx = {req: {accessToken: {userId: 1106}}, args: {workerFk: 1106}};
- const firstHour = new Date();
+ const firstHour = Date.vnNew();
firstHour.setHours(7, 0, 0, 0);
- const lastHour = new Date();
+ const lastHour = Date.vnNew();
lastHour.setDate(lastHour.getDate() + 1);
lastHour.setHours(15, 0, 0, 0);
@@ -21,9 +21,9 @@ describe('workerTimeControl filter()', () => {
it('should return a privilege error for a non subordinate worker', async() => {
const ctx = {req: {accessToken: {userId: 1107}}, args: {workerFk: 1106}};
- const firstHour = new Date();
+ const firstHour = Date.vnNew();
firstHour.setHours(7, 0, 0, 0);
- const lastHour = new Date();
+ const lastHour = Date.vnNew();
lastHour.setDate(lastHour.getDate() + 1);
lastHour.setHours(15, 0, 0, 0);
diff --git a/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js b/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js
index 5b2436be9..24bfd6904 100644
--- a/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js
+++ b/modules/worker/back/methods/worker-time-control/specs/sendMail.spec.js
@@ -10,7 +10,6 @@ describe('workerTimeControl sendMail()', () => {
const ctx = {req: activeCtx, args: {}};
it('should fill time control of a worker without records in Journey and with rest', async() => {
- pending('https://redmine.verdnatura.es/issues/4903');
const tx = await models.WorkerTimeControl.beginTransaction({});
try {
@@ -35,7 +34,6 @@ describe('workerTimeControl sendMail()', () => {
});
it('should fill time control of a worker without records in Journey and without rest', async() => {
- pending('https://redmine.verdnatura.es/issues/4903');
const workdayOf20Hours = 3;
const tx = await models.WorkerTimeControl.beginTransaction({});
@@ -63,7 +61,6 @@ describe('workerTimeControl sendMail()', () => {
});
it('should fill time control of a worker with records in Journey and with rest', async() => {
- pending('https://redmine.verdnatura.es/issues/4903');
const tx = await models.WorkerTimeControl.beginTransaction({});
try {
@@ -95,7 +92,6 @@ describe('workerTimeControl sendMail()', () => {
});
it('should fill time control of a worker with records in Journey and without rest', async() => {
- pending('https://redmine.verdnatura.es/issues/4903');
const tx = await models.WorkerTimeControl.beginTransaction({});
try {
diff --git a/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js b/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js
index e9924c67b..e90c849b7 100644
--- a/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js
+++ b/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js
@@ -35,7 +35,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
let error;
try {
- ctx.args = {timed: new Date(), direction: 'in'};
+ ctx.args = {timed: Date.vnNew(), direction: 'in'};
await models.WorkerTimeControl.addTimeEntry(ctx, workerId);
} catch (e) {
error = e;
@@ -52,7 +52,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
let error;
try {
- ctx.args = {timed: new Date(), direction: 'in'};
+ ctx.args = {timed: Date.vnNew(), direction: 'in'};
await models.WorkerTimeControl.addTimeEntry(ctx, workerId);
} catch (e) {
error = e;
@@ -71,7 +71,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
try {
const options = {transaction: tx};
- const todayAtOne = new Date();
+ const todayAtOne = Date.vnNew();
todayAtOne.setHours(1, 0, 0, 0);
ctx.args = {timed: todayAtOne, direction: 'in'};
@@ -95,7 +95,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
try {
const options = {transaction: tx};
- const todayAtOne = new Date();
+ const todayAtOne = Date.vnNew();
todayAtOne.setHours(1, 0, 0, 0);
ctx.args = {timed: todayAtOne, direction: 'in'};
@@ -123,7 +123,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
try {
const options = {transaction: tx};
- const todayAtOne = new Date();
+ const todayAtOne = Date.vnNew();
todayAtOne.setHours(1, 0, 0, 0);
ctx.args = {timed: todayAtOne, direction: 'in'};
@@ -151,7 +151,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
try {
const options = {transaction: tx};
- const todayAtOne = new Date();
+ const todayAtOne = Date.vnNew();
todayAtOne.setHours(1, 0, 0, 0);
ctx.args = {timed: todayAtOne, direction: 'in'};
@@ -179,7 +179,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
try {
const options = {transaction: tx};
- const todayAtOne = new Date();
+ const todayAtOne = Date.vnNew();
todayAtOne.setHours(1, 0, 0, 0);
ctx.args = {timed: todayAtOne, direction: 'in'};
@@ -204,7 +204,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
pending('https://redmine.verdnatura.es/issues/4707');
activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId;
- const date = new Date();
+ const date = Date.vnNew();
date.setDate(date.getDate() - 16);
date.setHours(8, 0, 0);
let error;
@@ -227,7 +227,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
it('should fail to add a time entry for a worker without an existing contract', async() => {
activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId;
- const date = new Date();
+ const date = Date.vnNew();
date.setFullYear(date.getFullYear() - 2);
let error;
@@ -252,7 +252,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId;
- let date = new Date();
+ let date = Date.vnNew();
date.setDate(date.getDate() - 21);
date = weekDay(date, monday);
let error;
@@ -282,7 +282,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId;
- let date = new Date();
+ let date = Date.vnNew();
date.setDate(date.getDate() - 21);
date = weekDay(date, monday);
let error;
@@ -316,7 +316,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId;
- let date = new Date();
+ let date = Date.vnNew();
date.setDate(date.getDate() - 21);
date = weekDay(date, monday);
let error;
@@ -350,7 +350,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId;
- let date = new Date();
+ let date = Date.vnNew();
date.setDate(date.getDate() - 21);
date = weekDay(date, monday);
let error;
@@ -384,7 +384,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId;
- let date = new Date();
+ let date = Date.vnNew();
date.setDate(date.getDate() - 21);
date = weekDay(date, monday);
let error;
@@ -421,7 +421,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId;
- let date = new Date();
+ let date = Date.vnNew();
date.setDate(date.getDate() - 21);
date = weekDay(date, monday);
let error;
@@ -456,7 +456,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId;
- let date = new Date();
+ let date = Date.vnNew();
date.setDate(date.getDate() - 21);
date = weekDay(date, monday);
let error;
@@ -493,7 +493,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
activeCtx.accessToken.userId = salesBossId;
const workerId = jessicaJonesId;
- let date = new Date();
+ let date = Date.vnNew();
date.setDate(date.getDate() - 21);
date = weekDay(date, monday);
let error;
@@ -528,7 +528,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
activeCtx.accessToken.userId = salesBossId;
const workerId = jessicaJonesId;
- let date = new Date();
+ let date = Date.vnNew();
date.setDate(date.getDate() - 21);
date = weekDay(date, monday);
let error;
@@ -565,7 +565,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId;
- let date = new Date();
+ let date = Date.vnNew();
date.setMonth(date.getMonth() - 2);
date.setDate(1);
let error;
@@ -600,7 +600,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId;
- let date = new Date();
+ let date = Date.vnNew();
date.setMonth(date.getMonth() - 2);
date.setDate(1);
let error;
@@ -634,7 +634,7 @@ describe('workerTimeControl add/delete timeEntry()', () => {
activeCtx.accessToken.userId = salesBossId;
const workerId = hankPymId;
- let date = new Date();
+ let date = Date.vnNew();
date.setMonth(date.getMonth() - 2);
date.setDate(1);
let error;
diff --git a/modules/worker/back/methods/worker-time-control/weeklyHourRecordEmail.js b/modules/worker/back/methods/worker-time-control/weeklyHourRecordEmail.js
index 0cf614e57..6feadb936 100644
--- a/modules/worker/back/methods/worker-time-control/weeklyHourRecordEmail.js
+++ b/modules/worker/back/methods/worker-time-control/weeklyHourRecordEmail.js
@@ -2,7 +2,7 @@ const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('weeklyHourRecordEmail', {
- description: 'Sends the buyer waste email',
+ description: 'Sends the weekly hour record',
accessType: 'WRITE',
accepts: [
{
diff --git a/modules/worker/back/methods/worker/activeContract.js b/modules/worker/back/methods/worker/activeContract.js
index 05dcee6b5..d3d439cd0 100644
--- a/modules/worker/back/methods/worker/activeContract.js
+++ b/modules/worker/back/methods/worker/activeContract.js
@@ -27,7 +27,7 @@ module.exports = Self => {
if (!isSubordinate)
throw new UserError(`You don't have enough privileges`);
- const now = new Date();
+ const now = Date.vnNew();
return models.WorkerLabour.findOne({
where: {
diff --git a/modules/worker/back/methods/worker/createAbsence.js b/modules/worker/back/methods/worker/createAbsence.js
index 1467d6d6b..43a9f4d23 100644
--- a/modules/worker/back/methods/worker/createAbsence.js
+++ b/modules/worker/back/methods/worker/createAbsence.js
@@ -80,8 +80,8 @@ module.exports = Self => {
if (hasHoursRecorded && isNotHalfAbsence)
throw new UserError(`The worker has hours recorded that day`);
- const date = new Date();
- const now = new Date();
+ const date = Date.vnNew();
+ const now = Date.vnNew();
date.setHours(0, 0, 0, 0);
const [result] = await Self.rawSql(
`SELECT COUNT(*) halfHolidayCounter
diff --git a/modules/worker/back/methods/worker/holidays.js b/modules/worker/back/methods/worker/holidays.js
index 7f093a330..9c214e0f7 100644
--- a/modules/worker/back/methods/worker/holidays.js
+++ b/modules/worker/back/methods/worker/holidays.js
@@ -45,13 +45,13 @@ module.exports = Self => {
if (!isSubordinate)
throw new UserError(`You don't have enough privileges`);
- const started = new Date();
+ const started = Date.vnNew();
started.setFullYear(args.year);
started.setMonth(0);
started.setDate(1);
started.setHours(0, 0, 0, 0);
- const ended = new Date();
+ const ended = Date.vnNew();
ended.setFullYear(args.year);
ended.setMonth(12);
ended.setDate(0);
diff --git a/modules/worker/back/methods/worker/new.js b/modules/worker/back/methods/worker/new.js
new file mode 100644
index 000000000..a7bb883cd
--- /dev/null
+++ b/modules/worker/back/methods/worker/new.js
@@ -0,0 +1,256 @@
+/* eslint max-len: ["error", { "code": 130 }]*/
+const UserError = require('vn-loopback/util/user-error');
+
+module.exports = Self => {
+ Self.remoteMethodCtx('new', {
+ description: 'Creates a new worker and returns the id',
+ accessType: 'WRITE',
+ accepts: [
+ {
+ arg: 'fi',
+ type: 'string',
+ description: `The worker fi`,
+ required: true,
+ },
+ {
+ arg: 'name',
+ type: 'string',
+ description: `The user name`,
+ required: true,
+ },
+ {
+ arg: 'firstName',
+ type: 'string',
+ description: `The worker firstname`,
+ required: true,
+ },
+ {
+ arg: 'lastNames',
+ type: 'string',
+ description: `The worker lastnames`,
+ required: true,
+ },
+ {
+ arg: 'email',
+ type: 'string',
+ description: `The worker email`,
+ required: true,
+ },
+ {
+ arg: 'street',
+ type: 'string',
+ description: `The worker address`,
+ required: true,
+ },
+ {
+ arg: 'city',
+ type: 'string',
+ description: `The worker city`,
+ required: true,
+ },
+ {
+ arg: 'provinceFk',
+ type: 'number',
+ description: `The worker province`,
+ required: true,
+ },
+ {
+ arg: 'iban',
+ type: 'string',
+ description: `The worker iban`,
+ required: true,
+ },
+ {
+ arg: 'bankEntityFk',
+ type: 'number',
+ description: `The worker bank entity`,
+ required: true,
+ },
+ {
+ arg: 'companyFk',
+ type: 'number',
+ description: `The worker company`,
+ required: true,
+ },
+ {
+ arg: 'postcode',
+ type: 'string',
+ description: `The worker postcode`,
+ required: true,
+ },
+ {
+ arg: 'phone',
+ type: 'string',
+ description: `The worker phone`,
+ required: true,
+ },
+ {
+ arg: 'code',
+ type: 'string',
+ description: `The worker code`,
+ required: true,
+ },
+ {
+ arg: 'bossFk',
+ type: 'number',
+ description: `The worker boss`,
+ required: true,
+ },
+ {
+ arg: 'birth',
+ type: 'date',
+ description: `The worker birth`,
+ required: true,
+ }
+ ],
+ returns: {
+ type: 'number',
+ root: true,
+ },
+ http: {
+ path: `/new`,
+ verb: 'POST',
+ },
+ });
+
+ Self.new = async(ctx, options) => {
+ const models = Self.app.models;
+ const myOptions = {};
+ const args = ctx.args;
+
+ let tx;
+
+ if (typeof options == 'object') Object.assign(myOptions, options);
+
+ if (!myOptions.transaction) {
+ tx = await Self.beginTransaction({});
+ myOptions.transaction = tx;
+ }
+
+ let client;
+
+ try {
+ client = await models.Client.findOne(
+ {
+ where: {fi: args.fi},
+ },
+ myOptions
+ );
+
+ if (!client) {
+ const nickname = args.firstName.concat(' ', args.lastNames);
+ const workerConfig = await models.WorkerConfig.findOne({fields: ['roleFk']});
+ const [randomPassword] = await models.Worker.rawSql(
+ 'SELECT account.passwordGenerate() as password;'
+ );
+
+ const user = await models.Account.create(
+ {
+ name: args.name,
+ nickname,
+ password: randomPassword.password,
+ email: args.email,
+ roleFk: workerConfig.roleFk,
+ },
+ myOptions
+ );
+
+ await models.UserAccount.create(
+ {
+ id: user.id,
+ },
+ myOptions
+ );
+
+ await models.Worker.rawSql(
+ 'CALL vn.clientCreate(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
+ [
+ args.firstName,
+ args.lastNames,
+ args.fi,
+ args.street,
+ args.postalCode,
+ args.city,
+ args.provinceFk,
+ args.companyFk,
+ args.phone,
+ args.email,
+ user.id,
+ ],
+ myOptions
+ );
+
+ const address = await models.Address.create(
+ {
+ clientFk: user.id,
+ street: args.street,
+ city: args.city,
+ provinceFk: args.provinceFk,
+ postalCode: args.postalCode,
+ mobile: args.phone,
+ nickname: nickname,
+ isDefaultAddress: true,
+ },
+ myOptions
+ );
+
+ client = await models.Client.findById(
+ user.id,
+ {fields: ['id', 'name', 'socialName', 'street', 'city', 'iban', 'bankEntityFk', 'defaultAddressFk']},
+ myOptions
+ );
+
+ await client.updateAttributes(
+ {
+ iban: args.iban,
+ bankEntityFk: args.bankEntityFk,
+ defaultAddressFk: address.id,
+ },
+ myOptions
+ );
+ }
+
+ const user = await models.Account.findById(client.id, null, myOptions);
+ await user.updateAttribute('email', args.email, myOptions);
+
+ await models.Worker.rawSql(
+ 'CALL vn.workerCreate(?, ?, ?, ?, ?, ?, ?)',
+ [
+ args.firstName,
+ args.lastNames,
+ args.code,
+ args.bossFk,
+ client.id,
+ args.fi,
+ args.birth,
+ ],
+ myOptions
+ );
+
+ if (tx) await tx.commit();
+ } catch (error) {
+ if (tx) await tx.rollback();
+ const code = error.code;
+ const message = error.sqlMessage;
+
+ if (code === 'ER_DUP_ENTRY' && message.includes(`for key 'mail'`))
+ throw new UserError(`This personal mail already exists`);
+
+ if (code === 'ER_DUP_ENTRY' && message.includes(`CodigoTrabajador_UNIQUE`))
+ throw new UserError(`This worker code already exists`);
+
+ if (code === 'ER_DUP_ENTRY' && message.includes(`PRIMARY`))
+ throw new UserError(`This worker already exists`);
+
+ throw error;
+ }
+
+ await models.user.resetPassword({
+ email: args.email,
+ emailTemplate: 'worker-welcome',
+ id: client.id
+ });
+
+ return {id: client.id};
+ };
+};
diff --git a/modules/worker/back/methods/worker/specs/createAbsence.spec.js b/modules/worker/back/methods/worker/specs/createAbsence.spec.js
index 7214e815e..346e43c51 100644
--- a/modules/worker/back/methods/worker/specs/createAbsence.spec.js
+++ b/modules/worker/back/methods/worker/specs/createAbsence.spec.js
@@ -10,7 +10,7 @@ describe('Worker createAbsence()', () => {
args: {
businessFk: 18,
absenceTypeId: 1,
- dated: new Date()
+ dated: Date.vnNew()
}
};
@@ -45,7 +45,7 @@ describe('Worker createAbsence()', () => {
args: {
businessFk: 18,
absenceTypeId: 1,
- dated: new Date()
+ dated: Date.vnNew()
}
};
ctx.req.__ = value => {
@@ -82,7 +82,7 @@ describe('Worker createAbsence()', () => {
id: 1,
businessFk: 1,
absenceTypeId: 6,
- dated: new Date()
+ dated: Date.vnNew()
}
};
const workerId = 1;
@@ -111,7 +111,7 @@ describe('Worker createAbsence()', () => {
id: 1106,
businessFk: 1106,
absenceTypeId: 1,
- dated: new Date()
+ dated: Date.vnNew()
}
};
const workerId = 1106;
diff --git a/modules/worker/back/methods/worker/specs/deleteAbsence.spec.js b/modules/worker/back/methods/worker/specs/deleteAbsence.spec.js
index a105669cf..0f3f913dc 100644
--- a/modules/worker/back/methods/worker/specs/deleteAbsence.spec.js
+++ b/modules/worker/back/methods/worker/specs/deleteAbsence.spec.js
@@ -28,7 +28,7 @@ describe('Worker deleteAbsence()', () => {
const createdAbsence = await app.models.Calendar.create({
businessFk: businessId,
dayOffTypeFk: 1,
- dated: new Date()
+ dated: Date.vnNew()
}, options);
ctx.args = {absenceId: createdAbsence.id};
@@ -59,7 +59,7 @@ describe('Worker deleteAbsence()', () => {
const createdAbsence = await app.models.Calendar.create({
businessFk: businessId,
dayOffTypeFk: 1,
- dated: new Date()
+ dated: Date.vnNew()
}, options);
ctx.args = {absenceId: createdAbsence.id};
diff --git a/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js b/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js
index 054a829e5..f5b06cc9e 100644
--- a/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js
+++ b/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js
@@ -3,10 +3,10 @@ const models = require('vn-loopback/server/server').models;
describe('Worker getWorkedHours()', () => {
it(`should return the expected hours and the worked hours of a given date`, async() => {
const workerID = 1106;
- const started = new Date();
+ const started = Date.vnNew();
started.setHours(0, 0, 0, 0);
- const ended = new Date();
+ const ended = Date.vnNew();
ended.setHours(23, 59, 59, 999);
const [result] = await models.Worker.getWorkedHours(workerID, started, ended);
diff --git a/modules/worker/back/methods/worker/specs/holidays.spec.js b/modules/worker/back/methods/worker/specs/holidays.spec.js
index d8310b738..f23b247ca 100644
--- a/modules/worker/back/methods/worker/specs/holidays.spec.js
+++ b/modules/worker/back/methods/worker/specs/holidays.spec.js
@@ -17,7 +17,7 @@ describe('Worker holidays()', () => {
});
it('should now get the absence calendar for a full year contract', async() => {
- const now = new Date();
+ const now = Date.vnNew();
const year = now.getFullYear();
ctx.args = {businessFk: businessId, year: year};
@@ -29,7 +29,7 @@ describe('Worker holidays()', () => {
});
it('should now get the payed holidays calendar for a worker', async() => {
- const now = new Date();
+ const now = Date.vnNew();
const year = now.getFullYear();
ctx.args = {businessFk: businessId, year: year};
diff --git a/modules/worker/back/methods/worker/specs/new.spec.js b/modules/worker/back/methods/worker/specs/new.spec.js
new file mode 100644
index 000000000..f695ab80e
--- /dev/null
+++ b/modules/worker/back/methods/worker/specs/new.spec.js
@@ -0,0 +1,139 @@
+const models = require('vn-loopback/server/server').models;
+const LoopBackContext = require('loopback-context');
+
+describe('Worker new', () => {
+ beforeAll(async() => {
+ const activeCtx = {
+ accessToken: {userId: 9},
+ http: {
+ req: {
+ headers: {origin: 'http://localhost'}
+ }
+ }
+ };
+
+ spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
+ active: activeCtx
+ });
+ });
+
+ const employeeId = 1;
+ const defaultWorker = {
+ fi: '78457139E',
+ name: 'defaultWorker',
+ firstName: 'default',
+ lastNames: 'worker',
+ email: 'defaultWorker@mydomain.com',
+ street: 'S/ defaultWorkerStreet',
+ city: 'defaultWorkerCity',
+ provinceFk: 1,
+ iban: 'ES8304879798578129532677',
+ bankEntityFk: 128,
+ companyFk: 442,
+ postcode: '46680',
+ phone: '123456789',
+ code: 'DWW',
+ bossFk: 9,
+ birth: '2022-12-11T23:00:00.000Z'
+ };
+
+ it('should return error if personal mail already exists', async() => {
+ const user = await models.Account.findById(employeeId, {fields: ['email']});
+
+ const tx = await models.Worker.beginTransaction({});
+
+ let error;
+ try {
+ const options = {transaction: tx};
+ const ctx = {
+ args: Object.assign({}, defaultWorker, {email: user.email})
+ };
+
+ await models.Worker.new(ctx, options);
+
+ await tx.rollback();
+ } catch (e) {
+ error = e;
+ await tx.rollback();
+ }
+
+ expect(error.message).toEqual('This personal mail already exists');
+ });
+
+ it('should return error if worker code already exists', async() => {
+ const worker = await models.Worker.findById(employeeId, {fields: ['code']});
+
+ const tx = await models.Worker.beginTransaction({});
+
+ let error;
+ try {
+ const options = {transaction: tx};
+ const ctx = {
+ args: Object.assign({}, defaultWorker, {code: worker.code})
+ };
+
+ await models.Worker.new(ctx, options);
+
+ await tx.rollback();
+ } catch (e) {
+ error = e;
+ await tx.rollback();
+ }
+
+ expect(error.message).toEqual('This worker code already exists');
+ });
+
+ it('should return error if worker already exists', async() => {
+ const worker = await models.Client.findById(employeeId, {fields: ['fi']});
+
+ const tx = await models.Worker.beginTransaction({});
+
+ let error;
+ try {
+ const options = {transaction: tx};
+ const ctx = {
+ args: Object.assign({}, defaultWorker, {fi: worker.fi})
+ };
+ await models.Worker.new(ctx, options);
+
+ await tx.rollback();
+ } catch (e) {
+ error = e;
+ await tx.rollback();
+ }
+
+ expect(error.message).toEqual('This worker already exists');
+ });
+
+ it('should create a new worker', async() => {
+ const newWorker = await models.Worker.new({args: defaultWorker});
+
+ await models.Worker.destroyById(newWorker.id);
+ await models.Address.destroyAll({clientFk: newWorker.id});
+ await models.Mandate.destroyAll({clientFk: newWorker.id});
+ await models.Client.destroyById(newWorker.id);
+ await models.Account.destroyById(newWorker.id);
+
+ expect(newWorker.id).toBeDefined();
+ });
+
+ it('should create a new worker in client', async() => {
+ const bruceWayneId = 1101;
+ const client = await models.Client.findById(bruceWayneId, {fields: ['fi', 'email']});
+
+ const newWorkerData = {
+ args: Object.assign(
+ {},
+ defaultWorker,
+ {
+ fi: client.fi,
+ email: client.email
+ })
+ };
+ const newWorker = await models.Worker.new(newWorkerData);
+
+ await models.Worker.destroyById(newWorker.id);
+
+ expect(newWorker.id).toEqual(bruceWayneId);
+ });
+});
diff --git a/modules/worker/back/methods/worker/specs/updateAbsence.spec.js b/modules/worker/back/methods/worker/specs/updateAbsence.spec.js
index 6339b3163..a624fc1d3 100644
--- a/modules/worker/back/methods/worker/specs/updateAbsence.spec.js
+++ b/modules/worker/back/methods/worker/specs/updateAbsence.spec.js
@@ -21,7 +21,7 @@ describe('Worker updateAbsence()', () => {
createdAbsence = await app.models.Calendar.create({
businessFk: businessId,
dayOffTypeFk: 1,
- dated: new Date()
+ dated: Date.vnNew()
});
});
diff --git a/modules/worker/back/model-config.json b/modules/worker/back/model-config.json
index 3f3416504..7e03c8a23 100644
--- a/modules/worker/back/model-config.json
+++ b/modules/worker/back/model-config.json
@@ -1,7 +1,7 @@
{
"AbsenceType": {
"dataSource": "vn"
- },
+ },
"Calendar": {
"dataSource": "vn"
},
@@ -16,13 +16,19 @@
},
"Department": {
"dataSource": "vn"
- },
+ },
+ "Device": {
+ "dataSource": "vn"
+ },
"EducationLevel": {
"dataSource": "vn"
},
"Journey": {
"dataSource": "vn"
},
+ "ProfileType":{
+ "dataSource": "vn"
+ },
"Time": {
"dataSource": "vn"
},
@@ -32,39 +38,42 @@
"WorkCenterHoliday": {
"dataSource": "vn"
},
- "WorkerDms": {
+ "Worker": {
"dataSource": "vn"
},
- "Worker": {
+ "WorkerConfig": {
+ "dataSource": "vn"
+ },
+ "WorkerDepartment": {
+ "dataSource": "vn"
+ },
+ "WorkerDisableExcluded": {
+ "dataSource": "vn"
+ },
+ "WorkerDms": {
"dataSource": "vn"
},
"WorkerLabour": {
"dataSource": "vn"
},
+ "WorkerLog": {
+ "dataSource": "vn"
+ },
"WorkerMana": {
"dataSource": "vn"
},
+ "WorkerMedia": {
+ "dataSource": "vn"
+ },
"WorkerTeam": {
"dataSource": "vn"
},
"WorkerTeamCollegues": {
"dataSource": "vn"
},
- "WorkerMedia": {
- "dataSource": "vn"
- },
- "WorkerDepartment": {
- "dataSource": "vn"
- },
"WorkerTimeControl": {
"dataSource": "vn"
},
- "Device": {
- "dataSource": "vn"
- },
- "WorkerLog": {
- "dataSource": "vn"
- },
"WorkerTimeControlConfig": {
"dataSource": "vn"
},
@@ -73,9 +82,6 @@
},
"WorkerTimeControlMail": {
"dataSource": "vn"
- },
- "WorkerDisableExcluded": {
- "dataSource": "vn"
}
}
diff --git a/modules/worker/back/models/profile-type.json b/modules/worker/back/models/profile-type.json
new file mode 100644
index 000000000..d1d750de8
--- /dev/null
+++ b/modules/worker/back/models/profile-type.json
@@ -0,0 +1,19 @@
+{
+ "name": "ProfileType",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "profileType"
+ }
+ },
+ "properties": {
+ "id": {
+ "type": "number",
+ "id": true,
+ "description": "Identifier"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+}
diff --git a/modules/worker/back/models/worker-config.json b/modules/worker/back/models/worker-config.json
new file mode 100644
index 000000000..05cdfef42
--- /dev/null
+++ b/modules/worker/back/models/worker-config.json
@@ -0,0 +1,27 @@
+{
+ "name": "WorkerConfig",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "workerConfig"
+ }
+ },
+ "properties": {
+ "id": {
+ "type": "number",
+ "id": true,
+ "description": "Identifier"
+ },
+ "roleFk": {
+ "type": "number"
+ }
+ },
+ "acls": [
+ {
+ "accessType": "READ",
+ "principalType": "ROLE",
+ "principalId": "$everyone",
+ "permission": "ALLOW"
+ }
+ ]
+}
diff --git a/modules/worker/back/models/worker-time-control-config.json b/modules/worker/back/models/worker-time-control-config.json
index 4c12ce5d7..b96e2ae3b 100644
--- a/modules/worker/back/models/worker-time-control-config.json
+++ b/modules/worker/back/models/worker-time-control-config.json
@@ -11,8 +11,17 @@
"id": true,
"type": "number"
},
+ "breakTime": {
+ "type": "number"
+ },
"timeToBreakTime": {
"type": "number"
+ },
+ "teleworkingStart": {
+ "type": "number"
+ },
+ "teleworkingStartBreakTime": {
+ "type": "number"
}
}
-}
\ No newline at end of file
+}
diff --git a/modules/worker/back/models/worker.js b/modules/worker/back/models/worker.js
index ec6c4af28..e66259cd0 100644
--- a/modules/worker/back/models/worker.js
+++ b/modules/worker/back/models/worker.js
@@ -13,4 +13,5 @@ module.exports = Self => {
require('../methods/worker/contracts')(Self);
require('../methods/worker/holidays')(Self);
require('../methods/worker/activeContract')(Self);
+ require('../methods/worker/new')(Self);
};
diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json
index 3d41707ce..e3a941dd3 100644
--- a/modules/worker/back/models/worker.json
+++ b/modules/worker/back/models/worker.json
@@ -52,6 +52,9 @@
},
"mobileExtension": {
"type" : "number"
+ },
+ "code": {
+ "type" : "string"
}
},
"relations": {
@@ -91,4 +94,4 @@
"foreignKey": "sectorFk"
}
}
-}
\ No newline at end of file
+}
diff --git a/modules/worker/front/calendar/index.js b/modules/worker/front/calendar/index.js
index 95e1fc134..4ca0fc929 100644
--- a/modules/worker/front/calendar/index.js
+++ b/modules/worker/front/calendar/index.js
@@ -5,7 +5,7 @@ import './style.scss';
class Controller extends Section {
constructor($element, $) {
super($element, $);
- this.date = new Date();
+ this.date = Date.vnNew();
this.events = {};
this.buildYearFilter();
}
@@ -15,7 +15,7 @@ class Controller extends Section {
}
set year(value) {
- const newYear = new Date();
+ const newYear = Date.vnNew();
newYear.setFullYear(value);
this.date = newYear;
@@ -76,7 +76,7 @@ class Controller extends Section {
}
buildYearFilter() {
- const now = new Date();
+ const now = Date.vnNew();
now.setFullYear(now.getFullYear() + 1);
const maxYear = now.getFullYear();
diff --git a/modules/worker/front/calendar/index.spec.js b/modules/worker/front/calendar/index.spec.js
index 1da4066d9..586a7223d 100644
--- a/modules/worker/front/calendar/index.spec.js
+++ b/modules/worker/front/calendar/index.spec.js
@@ -6,7 +6,7 @@ describe('Worker', () => {
let $httpParamSerializer;
let $scope;
let controller;
- let year = new Date().getFullYear();
+ let year = Date.vnNew().getFullYear();
beforeEach(ngModule('worker'));
@@ -67,7 +67,7 @@ describe('Worker', () => {
controller.getIsSubordinate = jest.fn();
controller.getActiveContract = jest.fn();
- let today = new Date();
+ let today = Date.vnNew();
let tomorrow = new Date(today.getTime());
tomorrow.setDate(tomorrow.getDate() + 1);
@@ -105,7 +105,7 @@ describe('Worker', () => {
describe('getContractHolidays()', () => {
it(`should return the worker holidays amount and then set the contractHolidays property`, () => {
- const today = new Date();
+ const today = Date.vnNew();
const year = today.getFullYear();
const serializedParams = $httpParamSerializer({year});
@@ -119,7 +119,7 @@ describe('Worker', () => {
describe('formatDay()', () => {
it(`should set the day element style`, () => {
- const today = new Date();
+ const today = Date.vnNew();
controller.events[today.getTime()] = {
name: 'Holiday',
@@ -170,7 +170,7 @@ describe('Worker', () => {
it(`should call to the create() method`, () => {
jest.spyOn(controller, 'create').mockReturnThis();
- const selectedDay = new Date();
+ const selectedDay = Date.vnNew();
const $event = {
target: {
closest: () => {
@@ -188,7 +188,7 @@ describe('Worker', () => {
it(`should call to the delete() method`, () => {
jest.spyOn(controller, 'delete').mockReturnThis();
- const selectedDay = new Date();
+ const selectedDay = Date.vnNew();
const expectedEvent = {
dated: selectedDay,
type: 'holiday',
@@ -212,7 +212,7 @@ describe('Worker', () => {
it(`should call to the edit() method`, () => {
jest.spyOn(controller, 'edit').mockReturnThis();
- const selectedDay = new Date();
+ const selectedDay = Date.vnNew();
const expectedEvent = {
dated: selectedDay,
type: 'leaveOfAbsence',
@@ -238,7 +238,7 @@ describe('Worker', () => {
it(`should make a HTTP POST query and then call to the repaintCanceller() method`, () => {
jest.spyOn(controller, 'repaintCanceller').mockReturnThis();
- const dated = new Date();
+ const dated = Date.vnNew();
const calendarElement = {};
const expectedResponse = {id: 10};
@@ -287,7 +287,7 @@ describe('Worker', () => {
const expectedParams = {absenceId: 10};
const calendarElement = {};
- const selectedDay = new Date();
+ const selectedDay = Date.vnNew();
const expectedEvent = {
dated: selectedDay,
type: 'leaveOfAbsence',
diff --git a/modules/worker/front/create/index.html b/modules/worker/front/create/index.html
new file mode 100644
index 000000000..5f5ab9d07
--- /dev/null
+++ b/modules/worker/front/create/index.html
@@ -0,0 +1,194 @@
+
+
+
+
+
+
diff --git a/modules/worker/front/create/index.js b/modules/worker/front/create/index.js
new file mode 100644
index 000000000..7e837fe02
--- /dev/null
+++ b/modules/worker/front/create/index.js
@@ -0,0 +1,127 @@
+import ngModule from '../module';
+import Section from 'salix/components/section';
+
+export default class Controller extends Section {
+ constructor($element, $) {
+ super($element, $);
+ this.worker = {companyFk: this.vnConfig.user.companyFk};
+ }
+
+ onSubmit() {
+ return this.$.watcher.submit().then(json => {
+ this.$state.go('worker.card.basicData', {id: json.data.id});
+ });
+ }
+
+ autofillBic() {
+ if (!this.worker || !this.worker.iban) return;
+
+ let bankEntityId = parseInt(this.worker.iban.substr(4, 4));
+ let filter = {where: {id: bankEntityId}};
+
+ if (this.ibanCountry != 'ES') return;
+
+ this.$http.get(`BankEntities`, {filter}).then(response => {
+ const hasData = response.data && response.data[0];
+
+ if (hasData)
+ this.worker.bankEntityFk = response.data[0].id;
+ else if (!hasData)
+ this.worker.bankEntityFk = null;
+ });
+ }
+
+ generateCodeUser() {
+ if (!this.worker.firstName || !this.worker.lastNames) return;
+
+ const totalName = this.worker.firstName.concat(' ' + this.worker.lastNames).toLowerCase();
+ const totalNameArray = totalName.split(' ');
+ let newCode = '';
+
+ for (let part of totalNameArray)
+ newCode += part.charAt(0);
+
+ this.worker.code = newCode.toUpperCase().slice(0, 3);
+ this.worker.name = totalNameArray[0] + newCode.slice(1);
+
+ if (!this.worker.companyFk)
+ this.worker.companyFk = this.vnConfig.user.companyFk;
+ }
+
+ get province() {
+ return this._province;
+ }
+
+ // Province auto complete
+ set province(selection) {
+ this._province = selection;
+
+ if (!selection) return;
+
+ const country = selection.country;
+
+ if (!this.worker.countryFk)
+ this.worker.countryFk = country.id;
+ }
+
+ get town() {
+ return this._town;
+ }
+
+ // Town auto complete
+ set town(selection) {
+ this._town = selection;
+
+ if (!selection) return;
+
+ const province = selection.province;
+ const country = province.country;
+ const postcodes = selection.postcodes;
+
+ if (!this.worker.provinceFk)
+ this.worker.provinceFk = province.id;
+
+ if (!this.worker.countryFk)
+ this.worker.countryFk = country.id;
+
+ if (postcodes.length === 1)
+ this.worker.postcode = postcodes[0].code;
+ }
+
+ get postcode() {
+ return this._postcode;
+ }
+
+ // Postcode auto complete
+ set postcode(selection) {
+ this._postcode = selection;
+
+ if (!selection) return;
+
+ const town = selection.town;
+ const province = town.province;
+ const country = province.country;
+
+ if (!this.worker.city)
+ this.worker.city = town.name;
+
+ if (!this.worker.provinceFk)
+ this.worker.provinceFk = province.id;
+
+ if (!this.worker.countryFk)
+ this.worker.countryFk = country.id;
+ }
+
+ onResponse(response) {
+ this.worker.postcode = response.code;
+ this.worker.city = response.city;
+ this.worker.provinceFk = response.provinceFk;
+ }
+}
+
+Controller.$inject = ['$element', '$scope'];
+
+ngModule.vnComponent('vnWorkerCreate', {
+ template: require('./index.html'),
+ controller: Controller
+});
diff --git a/modules/worker/front/create/index.spec.js b/modules/worker/front/create/index.spec.js
new file mode 100644
index 000000000..c2e9acce0
--- /dev/null
+++ b/modules/worker/front/create/index.spec.js
@@ -0,0 +1,133 @@
+import './index';
+
+describe('Worker', () => {
+ describe('Component vnWorkerCreate', () => {
+ let $scope;
+ let $state;
+ let controller;
+
+ beforeEach(ngModule('worker'));
+
+ beforeEach(inject(($componentController, $rootScope, _$state_) => {
+ $scope = $rootScope.$new();
+ $state = _$state_;
+ $scope.watcher = {
+ submit: () => {
+ return {
+ then: callback => {
+ callback({data: {id: '1234'}});
+ }
+ };
+ }
+ };
+ const $element = angular.element('');
+ controller = $componentController('vnWorkerCreate', {$element, $scope});
+ controller.worker = {};
+ controller.vnConfig = {user: {companyFk: 1}};
+ }));
+
+ describe('onSubmit()', () => {
+ it(`should call submit() on the watcher then expect a callback`, () => {
+ jest.spyOn($state, 'go');
+ controller.onSubmit();
+
+ expect(controller.$state.go).toHaveBeenCalledWith('worker.card.basicData', {id: '1234'});
+ });
+ });
+
+ describe('province() setter', () => {
+ it(`should set countryFk property`, () => {
+ controller.worker.countryFk = null;
+ controller.province = {
+ id: 1,
+ name: 'New york',
+ country: {
+ id: 2,
+ name: 'USA'
+ }
+ };
+
+ expect(controller.worker.countryFk).toEqual(2);
+ });
+ });
+
+ describe('town() setter', () => {
+ it(`should set provinceFk property`, () => {
+ controller.town = {
+ provinceFk: 1,
+ code: 46001,
+ province: {
+ id: 1,
+ name: 'New york',
+ country: {
+ id: 2,
+ name: 'USA'
+ }
+ },
+ postcodes: []
+ };
+
+ expect(controller.worker.provinceFk).toEqual(1);
+ });
+
+ it(`should set provinceFk property and fill the postalCode if there's just one`, () => {
+ controller.town = {
+ provinceFk: 1,
+ code: 46001,
+ province: {
+ id: 1,
+ name: 'New york',
+ country: {
+ id: 2,
+ name: 'USA'
+ }
+ },
+ postcodes: [{code: '46001'}]
+ };
+
+ expect(controller.worker.provinceFk).toEqual(1);
+ expect(controller.worker.postcode).toEqual('46001');
+ });
+ });
+
+ describe('postcode() setter', () => {
+ it(`should set the town, provinceFk and contryFk properties`, () => {
+ controller.postcode = {
+ townFk: 1,
+ code: 46001,
+ town: {
+ id: 1,
+ name: 'New York',
+ province: {
+ id: 1,
+ name: 'New york',
+ country: {
+ id: 2,
+ name: 'USA'
+ }
+ }
+ }
+ };
+
+ expect(controller.worker.city).toEqual('New York');
+ expect(controller.worker.provinceFk).toEqual(1);
+ expect(controller.worker.countryFk).toEqual(2);
+ });
+ });
+
+ describe('generateCodeUser()', () => {
+ it(`should generate worker code, name and company `, () => {
+ controller.worker = {
+ firstName: 'default',
+ lastNames: 'generate worker'
+ };
+
+ controller.generateCodeUser();
+
+ expect(controller.worker.code).toEqual('DGW');
+ expect(controller.worker.name).toEqual('defaultgw');
+ expect(controller.worker.companyFk).toEqual(controller.vnConfig.user.companyFk);
+ });
+ });
+ });
+});
diff --git a/modules/worker/front/create/locale/es.yml b/modules/worker/front/create/locale/es.yml
new file mode 100644
index 000000000..8c79d770c
--- /dev/null
+++ b/modules/worker/front/create/locale/es.yml
@@ -0,0 +1,12 @@
+Firstname: Nombre
+Lastname: Apellidos
+Fi: DNI/NIF/NIE
+Birth: Fecha de nacimiento
+Code: Código de trabajador
+Province: Provincia
+City: Población
+ProfileType: Tipo de perfil
+Street: Dirección
+Postcode: Código postal
+Web user: Usuario Web
+Access permission: Permiso de acceso
diff --git a/modules/worker/front/descriptor/index.js b/modules/worker/front/descriptor/index.js
index 2ff032def..ef2f64e85 100644
--- a/modules/worker/front/descriptor/index.js
+++ b/modules/worker/front/descriptor/index.js
@@ -82,7 +82,7 @@ class Controller extends Descriptor {
}
onUploadResponse() {
- const timestamp = new Date().getTime();
+ 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}`;
diff --git a/modules/worker/front/index.js b/modules/worker/front/index.js
index f703e7c21..97126407c 100644
--- a/modules/worker/front/index.js
+++ b/modules/worker/front/index.js
@@ -4,6 +4,7 @@ import './main';
import './index/';
import './summary';
import './card';
+import './create';
import './descriptor';
import './descriptor-popover';
import './search-panel';
diff --git a/modules/worker/front/index/index.html b/modules/worker/front/index/index.html
index 98df416b4..7044ca551 100644
--- a/modules/worker/front/index/index.html
+++ b/modules/worker/front/index/index.html
@@ -6,23 +6,23 @@
class="vn-w-sm">
+
+
+
-
\ No newline at end of file
+
diff --git a/modules/worker/front/index/locale/es.yml b/modules/worker/front/index/locale/es.yml
new file mode 100644
index 000000000..df6383273
--- /dev/null
+++ b/modules/worker/front/index/locale/es.yml
@@ -0,0 +1 @@
+New worker: Nuevo trabajador
diff --git a/modules/worker/front/routes.json b/modules/worker/front/routes.json
index ca33eaa76..dad55512b 100644
--- a/modules/worker/front/routes.json
+++ b/modules/worker/front/routes.json
@@ -16,7 +16,7 @@
{"state": "worker.card.timeControl", "icon": "access_time"},
{"state": "worker.card.dms.index", "icon": "cloud_upload"},
{
- "icon": "icon-wiki",
+ "icon": "icon-wiki",
"external":true,
"url": "http://wiki.verdnatura.es",
"description": "Wikipedia"
@@ -134,6 +134,13 @@
"worker": "$ctrl.worker"
},
"acl": ["hr"]
+ },
+ {
+ "url": "/create",
+ "state": "worker.create",
+ "component": "vn-worker-create",
+ "description": "New worker",
+ "acl": ["hr"]
}
]
-}
\ No newline at end of file
+}
diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js
index c3d3e5eab..f7379fea0 100644
--- a/modules/worker/front/time-control/index.js
+++ b/modules/worker/front/time-control/index.js
@@ -16,7 +16,7 @@ class Controller extends Section {
$postLink() {
const timestamp = this.$params.timestamp;
- let initialDate = new Date();
+ let initialDate = Date.vnNew();
if (timestamp) {
initialDate = new Date(timestamp * 1000);
@@ -199,7 +199,7 @@ class Controller extends Section {
getFinishTime() {
if (!this.weekDays) return;
- let today = new Date();
+ let today = Date.vnNew();
today.setHours(0, 0, 0, 0);
let todayInWeek = this.weekDays.find(day => day.dated.getTime() === today.getTime());
diff --git a/modules/worker/front/time-control/index.spec.js b/modules/worker/front/time-control/index.spec.js
index 4f317a5e6..b68162d39 100644
--- a/modules/worker/front/time-control/index.spec.js
+++ b/modules/worker/front/time-control/index.spec.js
@@ -18,7 +18,7 @@ describe('Component vnWorkerTimeControl', () => {
describe('date() setter', () => {
it(`should set the weekDays, the date in the controller and call fetchHours`, () => {
- let today = new Date();
+ let today = Date.vnNew();
jest.spyOn(controller, 'fetchHours').mockReturnThis();
controller.date = today;
@@ -33,7 +33,7 @@ describe('Component vnWorkerTimeControl', () => {
describe('hours() setter', () => {
it(`should set hours data at it's corresponding week day`, () => {
- let today = new Date();
+ let today = Date.vnNew();
jest.spyOn(controller, 'fetchHours').mockReturnThis();
controller.date = today;
@@ -64,7 +64,7 @@ describe('Component vnWorkerTimeControl', () => {
describe('getWorkedHours() ', () => {
it('should set the weekdays expected and worked hours plus the total worked hours', () => {
- let today = new Date();
+ let today = Date.vnNew();
jest.spyOn(controller, 'fetchHours').mockReturnThis();
controller.date = today;
@@ -117,7 +117,7 @@ describe('Component vnWorkerTimeControl', () => {
describe('save() ', () => {
it(`should make a query an then call to the fetchHours() method`, () => {
controller.fetchHours = jest.fn();
- controller.selectedRow = {id: 1, timed: new Date(), direction: 'in'};
+ controller.selectedRow = {id: 1, timed: Date.vnNew(), direction: 'in'};
controller.$.editEntry = {
hide: () => {}
};
diff --git a/modules/zone/back/methods/agency/specs/getAgenciesWithWarehouse.spec.js b/modules/zone/back/methods/agency/specs/getAgenciesWithWarehouse.spec.js
index bc7aa1ed9..4f79b2315 100644
--- a/modules/zone/back/methods/agency/specs/getAgenciesWithWarehouse.spec.js
+++ b/modules/zone/back/methods/agency/specs/getAgenciesWithWarehouse.spec.js
@@ -1,7 +1,7 @@
const app = require('vn-loopback/server/server');
describe('Agency getAgenciesWithWarehouse()', () => {
- const today = new Date();
+ const today = Date.vnNew();
it('should return the agencies that can handle the given delivery request', async() => {
const tx = await app.models.Zone.beginTransaction({});
diff --git a/modules/zone/back/methods/agency/specs/getLanded.spec.js b/modules/zone/back/methods/agency/specs/getLanded.spec.js
index c199b2ba6..e2e6b3eb3 100644
--- a/modules/zone/back/methods/agency/specs/getLanded.spec.js
+++ b/modules/zone/back/methods/agency/specs/getLanded.spec.js
@@ -3,7 +3,7 @@ const models = require('vn-loopback/server/server').models;
describe('agency getLanded()', () => {
it('should return a landing date', async() => {
const ctx = {req: {accessToken: {userId: 1}}};
- const shipped = new Date();
+ const shipped = Date.vnNew();
shipped.setDate(shipped.getDate() + 1);
const addressFk = 121;
const agencyModeFk = 7;
diff --git a/modules/zone/back/methods/agency/specs/getShipped.spec.js b/modules/zone/back/methods/agency/specs/getShipped.spec.js
index f2b36fc94..43e2c1208 100644
--- a/modules/zone/back/methods/agency/specs/getShipped.spec.js
+++ b/modules/zone/back/methods/agency/specs/getShipped.spec.js
@@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
describe('agency getShipped()', () => {
it('should return a shipment date', async() => {
- const landed = new Date();
+ const landed = Date.vnNew();
landed.setDate(landed.getDate() + 1);
const addressFk = 121;
const agencyModeFk = 7;
@@ -25,7 +25,7 @@ describe('agency getShipped()', () => {
});
it('should not return a shipment date', async() => {
- const newDate = new Date();
+ const newDate = Date.vnNew();
newDate.setMonth(newDate.getMonth() - 1);
const landed = newDate;
const addressFk = 121;
diff --git a/modules/zone/back/methods/agency/specs/landsThatDay.spec.js b/modules/zone/back/methods/agency/specs/landsThatDay.spec.js
index 7d207b383..ea10e708f 100644
--- a/modules/zone/back/methods/agency/specs/landsThatDay.spec.js
+++ b/modules/zone/back/methods/agency/specs/landsThatDay.spec.js
@@ -1,7 +1,7 @@
const app = require('vn-loopback/server/server');
describe('Agency landsThatDay()', () => {
- const today = new Date();
+ const today = Date.vnNew();
it('should return a list of agencies that can land a shipment on a day for an address', async() => {
const tx = await app.models.Agency.beginTransaction({});
diff --git a/modules/zone/back/methods/zone/deleteZone.js b/modules/zone/back/methods/zone/deleteZone.js
index fb228bcf4..e3846132b 100644
--- a/modules/zone/back/methods/zone/deleteZone.js
+++ b/modules/zone/back/methods/zone/deleteZone.js
@@ -22,7 +22,7 @@ module.exports = Self => {
const models = Self.app.models;
const token = ctx.req.accessToken;
const userId = token.userId;
- const today = new Date();
+ const today = Date.vnNew();
today.setHours(0, 0, 0, 0);
let tx;
diff --git a/modules/zone/back/methods/zone/getZoneClosing.js b/modules/zone/back/methods/zone/getZoneClosing.js
index 2a0088203..76706b55c 100644
--- a/modules/zone/back/methods/zone/getZoneClosing.js
+++ b/modules/zone/back/methods/zone/getZoneClosing.js
@@ -31,7 +31,7 @@ module.exports = Self => {
Object.assign(myOptions, options);
query = `
- SELECT *
+ SELECT *
FROM (
SELECT
DISTINCT z.id,
@@ -40,18 +40,21 @@ module.exports = Self => {
IFNULL(ze.hour, z.hour) as hour,
IFNULL(ze.price, z.price) as price
FROM vn.zone z
- JOIN agencyMode am ON am.id = z.agencyModeFk
- LEFT JOIN zoneEvent ze ON ze.zoneFk = z.id
- WHERE
- (
- dated = ?
- OR ? BETWEEN started AND ended
- OR INSTR(weekDays, SUBSTRING(DAYNAME(?), 1, 3) ) > 0
- )
+ JOIN vn.agencyMode am ON am.id = z.agencyModeFk
+ LEFT JOIN vn.zoneEvent ze ON ze.zoneFk = z.id
+ WHERE ((
+ ze.type = 'day'
+ AND ze.dated = ?
+ ) OR (
+ ze.type != 'day'
+ AND ze.weekDays & (1 << WEEKDAY(?))
+ AND (ze.started IS NULL OR ? >= ze.started)
+ AND (ze.ended IS NULL OR ? <= ze.ended)
+ ))
AND z.id IN (?)
ORDER BY type='day' DESC, type='range' DESC, type='indefinitely' DESC) z
GROUP BY z.id`;
- return Self.rawSql(query, [date, date, date, zoneIds], myOptions);
+ return Self.rawSql(query, [date, date, date, date, zoneIds], myOptions);
};
};
diff --git a/modules/zone/back/methods/zone/specs/exclusionGeo.spec.js b/modules/zone/back/methods/zone/specs/exclusionGeo.spec.js
index 3a345f2ce..a34132be4 100644
--- a/modules/zone/back/methods/zone/specs/exclusionGeo.spec.js
+++ b/modules/zone/back/methods/zone/specs/exclusionGeo.spec.js
@@ -2,7 +2,7 @@ const models = require('vn-loopback/server/server').models;
describe('zone exclusionGeo()', () => {
const zoneId = 1;
- const today = new Date();
+ const today = Date.vnNew();
it(`should show an error when location isn't selected`, async() => {
const tx = await models.Zone.beginTransaction({});
diff --git a/modules/zone/back/methods/zone/specs/getEventsFiltered.spec.js b/modules/zone/back/methods/zone/specs/getEventsFiltered.spec.js
index 8160ee05e..6fd6bb994 100644
--- a/modules/zone/back/methods/zone/specs/getEventsFiltered.spec.js
+++ b/modules/zone/back/methods/zone/specs/getEventsFiltered.spec.js
@@ -6,7 +6,7 @@ describe('zone getEventsFiltered()', () => {
try {
const options = {transaction: tx};
- const today = new Date();
+ const today = Date.vnNew();
const result = await models.Zone.getEventsFiltered(10, today, today, options);
@@ -26,7 +26,7 @@ describe('zone getEventsFiltered()', () => {
try {
const options = {transaction: tx};
- const today = new Date();
+ const today = Date.vnNew();
const result = await models.Zone.getEventsFiltered(9, today, today, options);
@@ -45,7 +45,7 @@ describe('zone getEventsFiltered()', () => {
try {
const options = {transaction: tx};
- const date = new Date();
+ const date = Date.vnNew();
date.setFullYear(date.getFullYear() - 2);
const dateTomorrow = new Date(date.setDate(date.getDate() + 1));
diff --git a/modules/zone/back/methods/zone/specs/getZoneClosing.spec.js b/modules/zone/back/methods/zone/specs/getZoneClosing.spec.js
index 4fb4b4e5c..cdd6fe584 100644
--- a/modules/zone/back/methods/zone/specs/getZoneClosing.spec.js
+++ b/modules/zone/back/methods/zone/specs/getZoneClosing.spec.js
@@ -6,7 +6,7 @@ describe('zone getZoneClosing()', () => {
try {
const options = {transaction: tx};
- const date = new Date();
+ const date = Date.vnNew();
const today = date.toISOString().split('T')[0];
const result = await models.Zone.getZoneClosing([1, 2, 3], today, options);
diff --git a/modules/zone/back/methods/zone/specs/includingExpired.spec.js b/modules/zone/back/methods/zone/specs/includingExpired.spec.js
index 98fdc272d..121a84887 100644
--- a/modules/zone/back/methods/zone/specs/includingExpired.spec.js
+++ b/modules/zone/back/methods/zone/specs/includingExpired.spec.js
@@ -50,7 +50,7 @@ describe('zone includingExpired()', () => {
it('should return an array containing available zones', async() => {
const ctx = {req: {accessToken: {userId: 1}}};
const where = {
- shipped: new Date(),
+ shipped: Date.vnNew(),
addressFk: addressId,
agencyModeFk: inhousePickupId,
warehouseFk: warehouseId
diff --git a/modules/zone/front/calendar/index.js b/modules/zone/front/calendar/index.js
index 3bc7158ef..288a8f328 100644
--- a/modules/zone/front/calendar/index.js
+++ b/modules/zone/front/calendar/index.js
@@ -8,7 +8,7 @@ class Controller extends Component {
this.vnWeekDays = vnWeekDays;
this.nMonths = 4;
- let date = new Date();
+ let date = Date.vnNew();
date.setDate(1);
date.setHours(0, 0, 0, 0);
this.date = date;
diff --git a/modules/zone/front/calendar/index.spec.js b/modules/zone/front/calendar/index.spec.js
index 338f47917..43280a9e8 100644
--- a/modules/zone/front/calendar/index.spec.js
+++ b/modules/zone/front/calendar/index.spec.js
@@ -22,7 +22,7 @@ describe('component vnZoneCalendar', () => {
it('should set the month property and then call the refreshEvents() method', () => {
jest.spyOn(controller, 'refreshEvents').mockReturnThis();
- controller.date = new Date();
+ controller.date = Date.vnNew();
expect(controller.refreshEvents).toHaveBeenCalledWith();
expect(controller.months.length).toEqual(4);
@@ -31,7 +31,7 @@ describe('component vnZoneCalendar', () => {
describe('step()', () => {
it('should set the date month to 4 months backwards', () => {
- const now = new Date();
+ const now = Date.vnNew();
now.setDate(15);
now.setMonth(now.getMonth() - 4);
@@ -44,7 +44,7 @@ describe('component vnZoneCalendar', () => {
});
it('should set the date month to 4 months forwards', () => {
- const now = new Date();
+ const now = Date.vnNew();
now.setDate(15);
now.setMonth(now.getMonth() + 4);
@@ -63,13 +63,13 @@ describe('component vnZoneCalendar', () => {
controller.data = {
exclusions: [{
- dated: new Date()
+ dated: Date.vnNew()
}],
events: [{
- dated: new Date()
+ dated: Date.vnNew()
}],
geoExclusions: [{
- dated: new Date()
+ dated: Date.vnNew()
}],
};
@@ -85,9 +85,9 @@ describe('component vnZoneCalendar', () => {
describe('refreshEvents()', () => {
it('should fill the days property with the events.', () => {
controller.data = [];
- controller.firstDay = new Date();
+ controller.firstDay = Date.vnNew();
- const lastDay = new Date();
+ const lastDay = Date.vnNew();
lastDay.setDate(lastDay.getDate() + 10);
controller.lastDay = lastDay;
@@ -114,7 +114,7 @@ describe('component vnZoneCalendar', () => {
jest.spyOn(controller, 'emit');
const $event = {};
- const $days = [new Date()];
+ const $days = [Date.vnNew()];
const $type = 'day';
const $weekday = 1;
@@ -136,7 +136,7 @@ describe('component vnZoneCalendar', () => {
describe('hasEvents()', () => {
it('should return true for an existing event on a date', () => {
- const dated = new Date();
+ const dated = Date.vnNew();
controller.days[dated.getTime()] = true;
@@ -148,7 +148,7 @@ describe('component vnZoneCalendar', () => {
describe('getClass()', () => {
it('should return the className "excluded" for an excluded date', () => {
- const dated = new Date();
+ const dated = Date.vnNew();
controller.exclusions = [];
controller.exclusions[dated.getTime()] = true;
@@ -159,7 +159,7 @@ describe('component vnZoneCalendar', () => {
});
it('should return the className "geoExcluded" for a date with geo excluded', () => {
- const dated = new Date();
+ const dated = Date.vnNew();
controller.geoExclusions = [];
controller.geoExclusions[dated.getTime()] = true;
diff --git a/modules/zone/front/create/index.js b/modules/zone/front/create/index.js
index 859204d8d..db337a9a3 100644
--- a/modules/zone/front/create/index.js
+++ b/modules/zone/front/create/index.js
@@ -7,7 +7,7 @@ export default class Controller extends Section {
travelingDays: 0,
price: 0.20,
bonus: 0.20,
- hour: new Date()
+ hour: Date.vnNew()
};
}
diff --git a/modules/zone/front/delivery-days/index.spec.js b/modules/zone/front/delivery-days/index.spec.js
index 63c87fbea..28705880c 100644
--- a/modules/zone/front/delivery-days/index.spec.js
+++ b/modules/zone/front/delivery-days/index.spec.js
@@ -103,7 +103,7 @@ describe('Zone Component vnZoneDeliveryDays', () => {
const target = document.createElement('div');
target.dispatchEvent(event);
- const day = new Date();
+ const day = Date.vnNew();
const events = [
{zoneFk: 1},
{zoneFk: 2},
diff --git a/modules/zone/front/descriptor/index.js b/modules/zone/front/descriptor/index.js
index 08ada0606..3f4863a60 100644
--- a/modules/zone/front/descriptor/index.js
+++ b/modules/zone/front/descriptor/index.js
@@ -28,7 +28,7 @@ class Controller extends Descriptor {
onDelete() {
const $t = this.$translate.instant;
- const today = new Date();
+ const today = Date.vnNew();
today.setHours(0, 0, 0, 0);
const filter = {where: {zoneFk: this.id, shipped: {gte: today}}};
this.$http.get(`Tickets`, {filter}).then(res => {
diff --git a/modules/zone/front/events/index.spec.js b/modules/zone/front/events/index.spec.js
index b4ff800d6..558d97b6f 100644
--- a/modules/zone/front/events/index.spec.js
+++ b/modules/zone/front/events/index.spec.js
@@ -68,7 +68,7 @@ describe('component vnZoneEvents', () => {
it('should call the createInclusion() method', () => {
jest.spyOn(controller, 'createInclusion').mockReturnThis();
- const weekday = {dated: new Date()};
+ const weekday = {dated: Date.vnNew()};
const days = [weekday];
const type = 'EventType';
const events = [];
@@ -114,7 +114,7 @@ describe('component vnZoneEvents', () => {
jest.spyOn(controller, 'createExclusion').mockReturnThis();
const weekday = {};
- const days = [{dated: new Date()}];
+ const days = [{dated: Date.vnNew()}];
const type = 'EventType';
const events = [];
const exclusions = [];
@@ -156,7 +156,7 @@ describe('component vnZoneEvents', () => {
it('shoud set the excludeSelected property and then call the excludeDialog show() method', () => {
controller.$.excludeDialog = {show: jest.fn()};
- const days = [new Date()];
+ const days = [Date.vnNew()];
controller.createExclusion(days);
expect(controller.excludeSelected).toBeDefined();
@@ -170,7 +170,7 @@ describe('component vnZoneEvents', () => {
controller.$.includeDialog = {show: jest.fn()};
const type = 'weekday';
- const days = [new Date()];
+ const days = [Date.vnNew()];
const weekday = 1;
controller.createInclusion(type, days, weekday);
@@ -187,7 +187,7 @@ describe('component vnZoneEvents', () => {
controller.$.includeDialog = {show: jest.fn()};
const type = 'nonListedType';
- const days = [new Date()];
+ const days = [Date.vnNew()];
const weekday = 1;
controller.createInclusion(type, days, weekday);
diff --git a/package-lock.json b/package-lock.json
index 550a1ec76..31820196f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,7 +9,7 @@
"version": "9.0.0",
"license": "GPL-3.0",
"dependencies": {
- "axios": "^0.25.0",
+ "axios": "^1.2.2",
"bcrypt": "^5.0.1",
"bmp-js": "^0.1.0",
"compression": "^1.7.3",
@@ -3893,10 +3893,13 @@
"license": "MIT"
},
"node_modules/axios": {
- "version": "0.25.0",
- "license": "MIT",
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.2.tgz",
+ "integrity": "sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==",
"dependencies": {
- "follow-redirects": "^1.14.7"
+ "follow-redirects": "^1.15.0",
+ "form-data": "^4.0.0",
+ "proxy-from-env": "^1.1.0"
}
},
"node_modules/babel-jest": {
@@ -8401,14 +8404,15 @@
}
},
"node_modules/follow-redirects": {
- "version": "1.14.9",
+ "version": "1.15.2",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
+ "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
- "license": "MIT",
"engines": {
"node": ">=4.0"
},
@@ -28842,9 +28846,13 @@
"version": "1.11.0"
},
"axios": {
- "version": "0.25.0",
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.2.tgz",
+ "integrity": "sha512-bz/J4gS2S3I7mpN/YZfGFTqhXTYzRho8Ay38w2otuuDR322KzFIWm/4W2K6gIwvWaws5n+mnb7D1lN9uD+QH6Q==",
"requires": {
- "follow-redirects": "^1.14.7"
+ "follow-redirects": "^1.15.0",
+ "form-data": "^4.0.0",
+ "proxy-from-env": "^1.1.0"
}
},
"babel-jest": {
@@ -31964,7 +31972,9 @@
}
},
"follow-redirects": {
- "version": "1.14.9"
+ "version": "1.15.2",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
+ "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA=="
},
"for-in": {
"version": "1.0.2",
diff --git a/package.json b/package.json
index 8cc33526d..f9828624d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "salix-back",
- "version": "9.0.0",
+ "version": "23.06.01",
"author": "Verdnatura Levante SL",
"description": "Salix backend",
"license": "GPL-3.0",
@@ -12,7 +12,7 @@
"node": ">=14"
},
"dependencies": {
- "axios": "^0.25.0",
+ "axios": "^1.2.2",
"bcrypt": "^5.0.1",
"bmp-js": "^0.1.0",
"compression": "^1.7.3",
diff --git a/print/core/mixins/vn-report.js b/print/core/mixins/vn-report.js
new file mode 100644
index 000000000..4831d8cd9
--- /dev/null
+++ b/print/core/mixins/vn-report.js
@@ -0,0 +1,23 @@
+const Component = require(`vn-print/core/component`);
+const reportHeader = new Component('report-header');
+const reportFooter = new Component('report-footer');
+const reportBody = new Component('report-body');
+const NotFoundError = require('vn-loopback/util/not-found-error');
+
+module.exports = {
+ components: {
+ 'report-body': reportBody.build(),
+ 'report-header': reportHeader.build(),
+ 'report-footer': reportFooter.build()
+ },
+ methods: {
+ checkMainEntity: function(entity) {
+ if (entity == null)
+ throw new NotFoundError();
+ },
+ formatDate: function(date, format) {
+ const filters = this.$options.filters;
+ return filters.date(date, format);
+ }
+ },
+};
diff --git a/print/package-lock.json b/print/package-lock.json
deleted file mode 100644
index 2a657269f..000000000
--- a/print/package-lock.json
+++ /dev/null
@@ -1,3588 +0,0 @@
-{
- "name": "vn-print",
- "version": "2.0.0",
- "lockfileVersion": 2,
- "requires": true,
- "packages": {
- "": {
- "name": "vn-print",
- "version": "2.0.0",
- "license": "GPL-3.0",
- "dependencies": {
- "fs-extra": "^7.0.1",
- "intl": "^1.2.5",
- "js-yaml": "^3.13.1",
- "jsbarcode": "^3.11.5",
- "jsonexport": "^3.2.0",
- "juice": "^5.2.0",
- "log4js": "^6.7.0",
- "mysql2": "^1.7.0",
- "nodemailer": "^4.7.0",
- "puppeteer-cluster": "^0.23.0",
- "qrcode": "^1.4.2",
- "strftime": "^0.10.0",
- "vue": "^2.6.10",
- "vue-i18n": "^8.15.0",
- "vue-server-renderer": "^2.6.10",
- "xmldom": "^0.6.0"
- }
- },
- "node_modules/@babel/parser": {
- "version": "7.19.3",
- "license": "MIT",
- "bin": {
- "parser": "bin/babel-parser.js"
- },
- "engines": {
- "node": ">=6.0.0"
- }
- },
- "node_modules/@types/node": {
- "version": "18.8.2",
- "license": "MIT",
- "optional": true,
- "peer": true
- },
- "node_modules/@types/yauzl": {
- "version": "2.10.0",
- "license": "MIT",
- "optional": true,
- "peer": true,
- "dependencies": {
- "@types/node": "*"
- }
- },
- "node_modules/@vue/compiler-sfc": {
- "version": "2.7.10",
- "dependencies": {
- "@babel/parser": "^7.18.4",
- "postcss": "^8.4.14",
- "source-map": "^0.6.1"
- }
- },
- "node_modules/agent-base": {
- "version": "6.0.2",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "debug": "4"
- },
- "engines": {
- "node": ">= 6.0.0"
- }
- },
- "node_modules/ajv": {
- "version": "6.12.6",
- "license": "MIT",
- "dependencies": {
- "fast-deep-equal": "^3.1.1",
- "fast-json-stable-stringify": "^2.0.0",
- "json-schema-traverse": "^0.4.1",
- "uri-js": "^4.2.2"
- },
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/epoberezkin"
- }
- },
- "node_modules/ansi-regex": {
- "version": "5.0.1",
- "license": "MIT",
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/ansi-styles": {
- "version": "3.2.1",
- "license": "MIT",
- "dependencies": {
- "color-convert": "^1.9.0"
- },
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/argparse": {
- "version": "1.0.10",
- "license": "MIT",
- "dependencies": {
- "sprintf-js": "~1.0.2"
- }
- },
- "node_modules/asn1": {
- "version": "0.2.6",
- "license": "MIT",
- "dependencies": {
- "safer-buffer": "~2.1.0"
- }
- },
- "node_modules/assert-plus": {
- "version": "1.0.0",
- "license": "MIT",
- "engines": {
- "node": ">=0.8"
- }
- },
- "node_modules/async": {
- "version": "3.2.4",
- "license": "MIT"
- },
- "node_modules/asynckit": {
- "version": "0.4.0",
- "license": "MIT"
- },
- "node_modules/aws-sign2": {
- "version": "0.7.0",
- "license": "Apache-2.0",
- "engines": {
- "node": "*"
- }
- },
- "node_modules/aws4": {
- "version": "1.11.0",
- "license": "MIT"
- },
- "node_modules/balanced-match": {
- "version": "1.0.2",
- "license": "MIT",
- "peer": true
- },
- "node_modules/base64-js": {
- "version": "1.5.1",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ],
- "license": "MIT",
- "peer": true
- },
- "node_modules/bcrypt-pbkdf": {
- "version": "1.0.2",
- "license": "BSD-3-Clause",
- "dependencies": {
- "tweetnacl": "^0.14.3"
- }
- },
- "node_modules/bl": {
- "version": "4.1.0",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "buffer": "^5.5.0",
- "inherits": "^2.0.4",
- "readable-stream": "^3.4.0"
- }
- },
- "node_modules/boolbase": {
- "version": "1.0.0",
- "license": "ISC"
- },
- "node_modules/brace-expansion": {
- "version": "1.1.11",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "balanced-match": "^1.0.0",
- "concat-map": "0.0.1"
- }
- },
- "node_modules/buffer": {
- "version": "5.7.1",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ],
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "base64-js": "^1.3.1",
- "ieee754": "^1.1.13"
- }
- },
- "node_modules/buffer-crc32": {
- "version": "0.2.13",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": "*"
- }
- },
- "node_modules/camelcase": {
- "version": "5.3.1",
- "license": "MIT",
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/caseless": {
- "version": "0.12.0",
- "license": "Apache-2.0"
- },
- "node_modules/chalk": {
- "version": "2.4.2",
- "license": "MIT",
- "dependencies": {
- "ansi-styles": "^3.2.1",
- "escape-string-regexp": "^1.0.5",
- "supports-color": "^5.3.0"
- },
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/cheerio": {
- "version": "0.22.0",
- "license": "MIT",
- "dependencies": {
- "css-select": "~1.2.0",
- "dom-serializer": "~0.1.0",
- "entities": "~1.1.1",
- "htmlparser2": "^3.9.1",
- "lodash.assignin": "^4.0.9",
- "lodash.bind": "^4.1.4",
- "lodash.defaults": "^4.0.1",
- "lodash.filter": "^4.4.0",
- "lodash.flatten": "^4.2.0",
- "lodash.foreach": "^4.3.0",
- "lodash.map": "^4.4.0",
- "lodash.merge": "^4.4.0",
- "lodash.pick": "^4.2.1",
- "lodash.reduce": "^4.4.0",
- "lodash.reject": "^4.4.0",
- "lodash.some": "^4.4.0"
- },
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/chownr": {
- "version": "1.1.4",
- "license": "ISC",
- "peer": true
- },
- "node_modules/cliui": {
- "version": "6.0.0",
- "license": "ISC",
- "dependencies": {
- "string-width": "^4.2.0",
- "strip-ansi": "^6.0.0",
- "wrap-ansi": "^6.2.0"
- }
- },
- "node_modules/color-convert": {
- "version": "1.9.3",
- "license": "MIT",
- "dependencies": {
- "color-name": "1.1.3"
- }
- },
- "node_modules/color-name": {
- "version": "1.1.3",
- "license": "MIT"
- },
- "node_modules/combined-stream": {
- "version": "1.0.8",
- "license": "MIT",
- "dependencies": {
- "delayed-stream": "~1.0.0"
- },
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/commander": {
- "version": "2.20.3",
- "license": "MIT"
- },
- "node_modules/concat-map": {
- "version": "0.0.1",
- "license": "MIT",
- "peer": true
- },
- "node_modules/core-util-is": {
- "version": "1.0.2",
- "license": "MIT"
- },
- "node_modules/cross-fetch": {
- "version": "3.1.5",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "node-fetch": "2.6.7"
- }
- },
- "node_modules/cross-spawn": {
- "version": "6.0.5",
- "license": "MIT",
- "dependencies": {
- "nice-try": "^1.0.4",
- "path-key": "^2.0.1",
- "semver": "^5.5.0",
- "shebang-command": "^1.2.0",
- "which": "^1.2.9"
- },
- "engines": {
- "node": ">=4.8"
- }
- },
- "node_modules/css-select": {
- "version": "1.2.0",
- "license": "BSD-like",
- "dependencies": {
- "boolbase": "~1.0.0",
- "css-what": "2.1",
- "domutils": "1.5.1",
- "nth-check": "~1.0.1"
- }
- },
- "node_modules/css-what": {
- "version": "2.1.3",
- "license": "BSD-2-Clause",
- "engines": {
- "node": "*"
- }
- },
- "node_modules/csstype": {
- "version": "3.1.1",
- "license": "MIT"
- },
- "node_modules/dashdash": {
- "version": "1.14.1",
- "license": "MIT",
- "dependencies": {
- "assert-plus": "^1.0.0"
- },
- "engines": {
- "node": ">=0.10"
- }
- },
- "node_modules/datauri": {
- "version": "2.0.0",
- "license": "MIT",
- "dependencies": {
- "image-size": "^0.7.3",
- "mimer": "^1.0.0"
- },
- "engines": {
- "node": ">= 4"
- }
- },
- "node_modules/date-format": {
- "version": "4.0.14",
- "resolved": "https://registry.npmjs.org/date-format/-/date-format-4.0.14.tgz",
- "integrity": "sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg==",
- "engines": {
- "node": ">=4.0"
- }
- },
- "node_modules/debug": {
- "version": "4.3.4",
- "license": "MIT",
- "dependencies": {
- "ms": "2.1.2"
- },
- "engines": {
- "node": ">=6.0"
- },
- "peerDependenciesMeta": {
- "supports-color": {
- "optional": true
- }
- }
- },
- "node_modules/decamelize": {
- "version": "1.2.0",
- "license": "MIT",
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/deep-extend": {
- "version": "0.6.0",
- "license": "MIT",
- "engines": {
- "node": ">=4.0.0"
- }
- },
- "node_modules/delayed-stream": {
- "version": "1.0.0",
- "license": "MIT",
- "engines": {
- "node": ">=0.4.0"
- }
- },
- "node_modules/denque": {
- "version": "1.5.1",
- "license": "Apache-2.0",
- "engines": {
- "node": ">=0.10"
- }
- },
- "node_modules/devtools-protocol": {
- "version": "0.0.1045489",
- "license": "BSD-3-Clause",
- "peer": true
- },
- "node_modules/dijkstrajs": {
- "version": "1.0.2",
- "license": "MIT"
- },
- "node_modules/dom-serializer": {
- "version": "0.1.1",
- "license": "MIT",
- "dependencies": {
- "domelementtype": "^1.3.0",
- "entities": "^1.1.1"
- }
- },
- "node_modules/domelementtype": {
- "version": "1.3.1",
- "license": "BSD-2-Clause"
- },
- "node_modules/domhandler": {
- "version": "2.4.2",
- "license": "BSD-2-Clause",
- "dependencies": {
- "domelementtype": "1"
- }
- },
- "node_modules/domutils": {
- "version": "1.5.1",
- "dependencies": {
- "dom-serializer": "0",
- "domelementtype": "1"
- }
- },
- "node_modules/ecc-jsbn": {
- "version": "0.1.2",
- "license": "MIT",
- "dependencies": {
- "jsbn": "~0.1.0",
- "safer-buffer": "^2.1.0"
- }
- },
- "node_modules/emoji-regex": {
- "version": "8.0.0",
- "license": "MIT"
- },
- "node_modules/encode-utf8": {
- "version": "1.0.3",
- "license": "MIT"
- },
- "node_modules/end-of-stream": {
- "version": "1.4.4",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "once": "^1.4.0"
- }
- },
- "node_modules/entities": {
- "version": "1.1.2",
- "license": "BSD-2-Clause"
- },
- "node_modules/escape-string-regexp": {
- "version": "1.0.5",
- "license": "MIT",
- "engines": {
- "node": ">=0.8.0"
- }
- },
- "node_modules/esprima": {
- "version": "4.0.1",
- "license": "BSD-2-Clause",
- "bin": {
- "esparse": "bin/esparse.js",
- "esvalidate": "bin/esvalidate.js"
- },
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/extend": {
- "version": "3.0.2",
- "license": "MIT"
- },
- "node_modules/extract-zip": {
- "version": "2.0.1",
- "license": "BSD-2-Clause",
- "peer": true,
- "dependencies": {
- "debug": "^4.1.1",
- "get-stream": "^5.1.0",
- "yauzl": "^2.10.0"
- },
- "bin": {
- "extract-zip": "cli.js"
- },
- "engines": {
- "node": ">= 10.17.0"
- },
- "optionalDependencies": {
- "@types/yauzl": "^2.9.1"
- }
- },
- "node_modules/extsprintf": {
- "version": "1.3.0",
- "engines": [
- "node >=0.6.0"
- ],
- "license": "MIT"
- },
- "node_modules/fast-deep-equal": {
- "version": "3.1.3",
- "license": "MIT"
- },
- "node_modules/fast-json-stable-stringify": {
- "version": "2.1.0",
- "license": "MIT"
- },
- "node_modules/fd-slicer": {
- "version": "1.1.0",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "pend": "~1.2.0"
- }
- },
- "node_modules/find-up": {
- "version": "4.1.0",
- "license": "MIT",
- "dependencies": {
- "locate-path": "^5.0.0",
- "path-exists": "^4.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/flatted": {
- "version": "3.2.7",
- "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz",
- "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ=="
- },
- "node_modules/forever-agent": {
- "version": "0.6.1",
- "license": "Apache-2.0",
- "engines": {
- "node": "*"
- }
- },
- "node_modules/form-data": {
- "version": "2.3.3",
- "license": "MIT",
- "dependencies": {
- "asynckit": "^0.4.0",
- "combined-stream": "^1.0.6",
- "mime-types": "^2.1.12"
- },
- "engines": {
- "node": ">= 0.12"
- }
- },
- "node_modules/fs-constants": {
- "version": "1.0.0",
- "license": "MIT",
- "peer": true
- },
- "node_modules/fs-extra": {
- "version": "7.0.1",
- "license": "MIT",
- "dependencies": {
- "graceful-fs": "^4.1.2",
- "jsonfile": "^4.0.0",
- "universalify": "^0.1.0"
- },
- "engines": {
- "node": ">=6 <7 || >=8"
- }
- },
- "node_modules/fs.realpath": {
- "version": "1.0.0",
- "license": "ISC",
- "peer": true
- },
- "node_modules/function-bind": {
- "version": "1.1.1",
- "license": "MIT"
- },
- "node_modules/generate-function": {
- "version": "2.3.1",
- "license": "MIT",
- "dependencies": {
- "is-property": "^1.0.2"
- }
- },
- "node_modules/get-caller-file": {
- "version": "2.0.5",
- "license": "ISC",
- "engines": {
- "node": "6.* || 8.* || >= 10.*"
- }
- },
- "node_modules/get-stream": {
- "version": "5.2.0",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "pump": "^3.0.0"
- },
- "engines": {
- "node": ">=8"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/getpass": {
- "version": "0.1.7",
- "license": "MIT",
- "dependencies": {
- "assert-plus": "^1.0.0"
- }
- },
- "node_modules/glob": {
- "version": "7.2.3",
- "license": "ISC",
- "peer": true,
- "dependencies": {
- "fs.realpath": "^1.0.0",
- "inflight": "^1.0.4",
- "inherits": "2",
- "minimatch": "^3.1.1",
- "once": "^1.3.0",
- "path-is-absolute": "^1.0.0"
- },
- "engines": {
- "node": "*"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
- "node_modules/graceful-fs": {
- "version": "4.2.10",
- "license": "ISC"
- },
- "node_modules/har-schema": {
- "version": "2.0.0",
- "license": "ISC",
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/har-validator": {
- "version": "5.1.5",
- "deprecated": "this library is no longer supported",
- "license": "MIT",
- "dependencies": {
- "ajv": "^6.12.3",
- "har-schema": "^2.0.0"
- },
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/has": {
- "version": "1.0.3",
- "license": "MIT",
- "dependencies": {
- "function-bind": "^1.1.1"
- },
- "engines": {
- "node": ">= 0.4.0"
- }
- },
- "node_modules/has-flag": {
- "version": "3.0.0",
- "license": "MIT",
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/hash-sum": {
- "version": "2.0.0",
- "license": "MIT"
- },
- "node_modules/he": {
- "version": "1.2.0",
- "license": "MIT",
- "bin": {
- "he": "bin/he"
- }
- },
- "node_modules/htmlparser2": {
- "version": "3.10.1",
- "license": "MIT",
- "dependencies": {
- "domelementtype": "^1.3.1",
- "domhandler": "^2.3.0",
- "domutils": "^1.5.1",
- "entities": "^1.1.1",
- "inherits": "^2.0.1",
- "readable-stream": "^3.1.1"
- }
- },
- "node_modules/http-signature": {
- "version": "1.2.0",
- "license": "MIT",
- "dependencies": {
- "assert-plus": "^1.0.0",
- "jsprim": "^1.2.2",
- "sshpk": "^1.7.0"
- },
- "engines": {
- "node": ">=0.8",
- "npm": ">=1.3.7"
- }
- },
- "node_modules/https-proxy-agent": {
- "version": "5.0.1",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "agent-base": "6",
- "debug": "4"
- },
- "engines": {
- "node": ">= 6"
- }
- },
- "node_modules/iconv-lite": {
- "version": "0.5.2",
- "license": "MIT",
- "dependencies": {
- "safer-buffer": ">= 2.1.2 < 3"
- },
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/ieee754": {
- "version": "1.2.1",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ],
- "license": "BSD-3-Clause",
- "peer": true
- },
- "node_modules/image-size": {
- "version": "0.7.5",
- "license": "MIT",
- "bin": {
- "image-size": "bin/image-size.js"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/inflight": {
- "version": "1.0.6",
- "license": "ISC",
- "peer": true,
- "dependencies": {
- "once": "^1.3.0",
- "wrappy": "1"
- }
- },
- "node_modules/inherits": {
- "version": "2.0.4",
- "license": "ISC"
- },
- "node_modules/intl": {
- "version": "1.2.5",
- "license": "MIT"
- },
- "node_modules/is-core-module": {
- "version": "2.10.0",
- "license": "MIT",
- "dependencies": {
- "has": "^1.0.3"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- },
- "node_modules/is-fullwidth-code-point": {
- "version": "3.0.0",
- "license": "MIT",
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/is-property": {
- "version": "1.0.2",
- "license": "MIT"
- },
- "node_modules/is-typedarray": {
- "version": "1.0.0",
- "license": "MIT"
- },
- "node_modules/isexe": {
- "version": "2.0.0",
- "license": "ISC"
- },
- "node_modules/isstream": {
- "version": "0.1.2",
- "license": "MIT"
- },
- "node_modules/js-yaml": {
- "version": "3.14.1",
- "license": "MIT",
- "dependencies": {
- "argparse": "^1.0.7",
- "esprima": "^4.0.0"
- },
- "bin": {
- "js-yaml": "bin/js-yaml.js"
- }
- },
- "node_modules/jsbarcode": {
- "version": "3.11.5",
- "resolved": "https://registry.npmjs.org/jsbarcode/-/jsbarcode-3.11.5.tgz",
- "integrity": "sha512-zv3KsH51zD00I/LrFzFSM6dst7rDn0vIMzaiZFL7qusTjPZiPtxg3zxetp0RR7obmjTw4f6NyGgbdkBCgZUIrA==",
- "bin": {
- "auto.js": "bin/barcodes/CODE128/auto.js",
- "Barcode.js": "bin/barcodes/Barcode.js",
- "barcodes": "bin/barcodes",
- "canvas.js": "bin/renderers/canvas.js",
- "checksums.js": "bin/barcodes/MSI/checksums.js",
- "codabar": "bin/barcodes/codabar",
- "CODE128": "bin/barcodes/CODE128",
- "CODE128_AUTO.js": "bin/barcodes/CODE128/CODE128_AUTO.js",
- "CODE128.js": "bin/barcodes/CODE128/CODE128.js",
- "CODE128A.js": "bin/barcodes/CODE128/CODE128A.js",
- "CODE128B.js": "bin/barcodes/CODE128/CODE128B.js",
- "CODE128C.js": "bin/barcodes/CODE128/CODE128C.js",
- "CODE39": "bin/barcodes/CODE39",
- "constants.js": "bin/barcodes/ITF/constants.js",
- "defaults.js": "bin/options/defaults.js",
- "EAN_UPC": "bin/barcodes/EAN_UPC",
- "EAN.js": "bin/barcodes/EAN_UPC/EAN.js",
- "EAN13.js": "bin/barcodes/EAN_UPC/EAN13.js",
- "EAN2.js": "bin/barcodes/EAN_UPC/EAN2.js",
- "EAN5.js": "bin/barcodes/EAN_UPC/EAN5.js",
- "EAN8.js": "bin/barcodes/EAN_UPC/EAN8.js",
- "encoder.js": "bin/barcodes/EAN_UPC/encoder.js",
- "ErrorHandler.js": "bin/exceptions/ErrorHandler.js",
- "exceptions": "bin/exceptions",
- "exceptions.js": "bin/exceptions/exceptions.js",
- "fixOptions.js": "bin/help/fixOptions.js",
- "GenericBarcode": "bin/barcodes/GenericBarcode",
- "getOptionsFromElement.js": "bin/help/getOptionsFromElement.js",
- "getRenderProperties.js": "bin/help/getRenderProperties.js",
- "help": "bin/help",
- "index.js": "bin/renderers/index.js",
- "index.tmp.js": "bin/barcodes/index.tmp.js",
- "ITF": "bin/barcodes/ITF",
- "ITF.js": "bin/barcodes/ITF/ITF.js",
- "ITF14.js": "bin/barcodes/ITF/ITF14.js",
- "JsBarcode.js": "bin/JsBarcode.js",
- "linearizeEncodings.js": "bin/help/linearizeEncodings.js",
- "merge.js": "bin/help/merge.js",
- "MSI": "bin/barcodes/MSI",
- "MSI.js": "bin/barcodes/MSI/MSI.js",
- "MSI10.js": "bin/barcodes/MSI/MSI10.js",
- "MSI1010.js": "bin/barcodes/MSI/MSI1010.js",
- "MSI11.js": "bin/barcodes/MSI/MSI11.js",
- "MSI1110.js": "bin/barcodes/MSI/MSI1110.js",
- "object.js": "bin/renderers/object.js",
- "options": "bin/options",
- "optionsFromStrings.js": "bin/help/optionsFromStrings.js",
- "pharmacode": "bin/barcodes/pharmacode",
- "renderers": "bin/renderers",
- "shared.js": "bin/renderers/shared.js",
- "svg.js": "bin/renderers/svg.js",
- "UPC.js": "bin/barcodes/EAN_UPC/UPC.js",
- "UPCE.js": "bin/barcodes/EAN_UPC/UPCE.js"
- }
- },
- "node_modules/jsbn": {
- "version": "0.1.1",
- "license": "MIT"
- },
- "node_modules/json-schema": {
- "version": "0.4.0",
- "license": "(AFL-2.1 OR BSD-3-Clause)"
- },
- "node_modules/json-schema-traverse": {
- "version": "0.4.1",
- "license": "MIT"
- },
- "node_modules/json-stringify-safe": {
- "version": "5.0.1",
- "license": "ISC"
- },
- "node_modules/jsonexport": {
- "version": "3.2.0",
- "license": "Apache-2.0",
- "bin": {
- "jsonexport": "bin/jsonexport.js"
- }
- },
- "node_modules/jsonfile": {
- "version": "4.0.0",
- "license": "MIT",
- "optionalDependencies": {
- "graceful-fs": "^4.1.6"
- }
- },
- "node_modules/jsprim": {
- "version": "1.4.2",
- "license": "MIT",
- "dependencies": {
- "assert-plus": "1.0.0",
- "extsprintf": "1.3.0",
- "json-schema": "0.4.0",
- "verror": "1.10.0"
- },
- "engines": {
- "node": ">=0.6.0"
- }
- },
- "node_modules/juice": {
- "version": "5.2.0",
- "license": "MIT",
- "dependencies": {
- "cheerio": "^0.22.0",
- "commander": "^2.15.1",
- "cross-spawn": "^6.0.5",
- "deep-extend": "^0.6.0",
- "mensch": "^0.3.3",
- "slick": "^1.12.2",
- "web-resource-inliner": "^4.3.1"
- },
- "bin": {
- "juice": "bin/juice"
- },
- "engines": {
- "node": ">=4.2.0"
- }
- },
- "node_modules/locate-path": {
- "version": "5.0.0",
- "license": "MIT",
- "dependencies": {
- "p-locate": "^4.1.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/lodash._reinterpolate": {
- "version": "3.0.0",
- "license": "MIT"
- },
- "node_modules/lodash.assignin": {
- "version": "4.2.0",
- "license": "MIT"
- },
- "node_modules/lodash.bind": {
- "version": "4.2.1",
- "license": "MIT"
- },
- "node_modules/lodash.defaults": {
- "version": "4.2.0",
- "license": "MIT"
- },
- "node_modules/lodash.filter": {
- "version": "4.6.0",
- "license": "MIT"
- },
- "node_modules/lodash.flatten": {
- "version": "4.4.0",
- "license": "MIT"
- },
- "node_modules/lodash.foreach": {
- "version": "4.5.0",
- "license": "MIT"
- },
- "node_modules/lodash.map": {
- "version": "4.6.0",
- "license": "MIT"
- },
- "node_modules/lodash.merge": {
- "version": "4.6.2",
- "license": "MIT"
- },
- "node_modules/lodash.pick": {
- "version": "4.4.0",
- "license": "MIT"
- },
- "node_modules/lodash.reduce": {
- "version": "4.6.0",
- "license": "MIT"
- },
- "node_modules/lodash.reject": {
- "version": "4.6.0",
- "license": "MIT"
- },
- "node_modules/lodash.some": {
- "version": "4.6.0",
- "license": "MIT"
- },
- "node_modules/lodash.template": {
- "version": "4.5.0",
- "license": "MIT",
- "dependencies": {
- "lodash._reinterpolate": "^3.0.0",
- "lodash.templatesettings": "^4.0.0"
- }
- },
- "node_modules/lodash.templatesettings": {
- "version": "4.2.0",
- "license": "MIT",
- "dependencies": {
- "lodash._reinterpolate": "^3.0.0"
- }
- },
- "node_modules/lodash.unescape": {
- "version": "4.0.1",
- "license": "MIT"
- },
- "node_modules/lodash.uniq": {
- "version": "4.5.0",
- "license": "MIT"
- },
- "node_modules/log4js": {
- "version": "6.7.0",
- "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.7.0.tgz",
- "integrity": "sha512-KA0W9ffgNBLDj6fZCq/lRbgR6ABAodRIDHrZnS48vOtfKa4PzWImb0Md1lmGCdO3n3sbCm/n1/WmrNlZ8kCI3Q==",
- "dependencies": {
- "date-format": "^4.0.14",
- "debug": "^4.3.4",
- "flatted": "^3.2.7",
- "rfdc": "^1.3.0",
- "streamroller": "^3.1.3"
- },
- "engines": {
- "node": ">=8.0"
- }
- },
- "node_modules/long": {
- "version": "4.0.0",
- "license": "Apache-2.0"
- },
- "node_modules/lru-cache": {
- "version": "5.1.1",
- "license": "ISC",
- "dependencies": {
- "yallist": "^3.0.2"
- }
- },
- "node_modules/mensch": {
- "version": "0.3.4",
- "license": "MIT"
- },
- "node_modules/mime-db": {
- "version": "1.52.0",
- "license": "MIT",
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/mime-types": {
- "version": "2.1.35",
- "license": "MIT",
- "dependencies": {
- "mime-db": "1.52.0"
- },
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/mimer": {
- "version": "1.1.1",
- "license": "MIT",
- "bin": {
- "mimer": "bin/mimer"
- },
- "engines": {
- "node": ">= 6.0"
- }
- },
- "node_modules/minimatch": {
- "version": "3.1.2",
- "license": "ISC",
- "peer": true,
- "dependencies": {
- "brace-expansion": "^1.1.7"
- },
- "engines": {
- "node": "*"
- }
- },
- "node_modules/mkdirp-classic": {
- "version": "0.5.3",
- "license": "MIT",
- "peer": true
- },
- "node_modules/ms": {
- "version": "2.1.2",
- "license": "MIT"
- },
- "node_modules/mysql2": {
- "version": "1.7.0",
- "license": "MIT",
- "dependencies": {
- "denque": "^1.4.1",
- "generate-function": "^2.3.1",
- "iconv-lite": "^0.5.0",
- "long": "^4.0.0",
- "lru-cache": "^5.1.1",
- "named-placeholders": "^1.1.2",
- "seq-queue": "^0.0.5",
- "sqlstring": "^2.3.1"
- },
- "engines": {
- "node": ">= 8.0"
- }
- },
- "node_modules/named-placeholders": {
- "version": "1.1.2",
- "license": "MIT",
- "dependencies": {
- "lru-cache": "^4.1.3"
- },
- "engines": {
- "node": ">=6.0.0"
- }
- },
- "node_modules/named-placeholders/node_modules/lru-cache": {
- "version": "4.1.5",
- "license": "ISC",
- "dependencies": {
- "pseudomap": "^1.0.2",
- "yallist": "^2.1.2"
- }
- },
- "node_modules/named-placeholders/node_modules/yallist": {
- "version": "2.1.2",
- "license": "ISC"
- },
- "node_modules/nanoid": {
- "version": "3.3.4",
- "license": "MIT",
- "bin": {
- "nanoid": "bin/nanoid.cjs"
- },
- "engines": {
- "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
- }
- },
- "node_modules/nice-try": {
- "version": "1.0.5",
- "license": "MIT"
- },
- "node_modules/node-fetch": {
- "version": "2.6.7",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "whatwg-url": "^5.0.0"
- },
- "engines": {
- "node": "4.x || >=6.0.0"
- },
- "peerDependencies": {
- "encoding": "^0.1.0"
- },
- "peerDependenciesMeta": {
- "encoding": {
- "optional": true
- }
- }
- },
- "node_modules/nodemailer": {
- "version": "4.7.0",
- "license": "MIT",
- "engines": {
- "node": ">=6.0.0"
- }
- },
- "node_modules/nth-check": {
- "version": "1.0.2",
- "license": "BSD-2-Clause",
- "dependencies": {
- "boolbase": "~1.0.0"
- }
- },
- "node_modules/oauth-sign": {
- "version": "0.9.0",
- "license": "Apache-2.0",
- "engines": {
- "node": "*"
- }
- },
- "node_modules/once": {
- "version": "1.4.0",
- "license": "ISC",
- "peer": true,
- "dependencies": {
- "wrappy": "1"
- }
- },
- "node_modules/p-limit": {
- "version": "2.3.0",
- "license": "MIT",
- "dependencies": {
- "p-try": "^2.0.0"
- },
- "engines": {
- "node": ">=6"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/p-locate": {
- "version": "4.1.0",
- "license": "MIT",
- "dependencies": {
- "p-limit": "^2.2.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/p-try": {
- "version": "2.2.0",
- "license": "MIT",
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/path-exists": {
- "version": "4.0.0",
- "license": "MIT",
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/path-is-absolute": {
- "version": "1.0.1",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/path-key": {
- "version": "2.0.1",
- "license": "MIT",
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/path-parse": {
- "version": "1.0.7",
- "license": "MIT"
- },
- "node_modules/pend": {
- "version": "1.2.0",
- "license": "MIT",
- "peer": true
- },
- "node_modules/performance-now": {
- "version": "2.1.0",
- "license": "MIT"
- },
- "node_modules/picocolors": {
- "version": "1.0.0",
- "license": "ISC"
- },
- "node_modules/pngjs": {
- "version": "5.0.0",
- "license": "MIT",
- "engines": {
- "node": ">=10.13.0"
- }
- },
- "node_modules/postcss": {
- "version": "8.4.17",
- "funding": [
- {
- "type": "opencollective",
- "url": "https://opencollective.com/postcss/"
- },
- {
- "type": "tidelift",
- "url": "https://tidelift.com/funding/github/npm/postcss"
- }
- ],
- "license": "MIT",
- "dependencies": {
- "nanoid": "^3.3.4",
- "picocolors": "^1.0.0",
- "source-map-js": "^1.0.2"
- },
- "engines": {
- "node": "^10 || ^12 || >=14"
- }
- },
- "node_modules/progress": {
- "version": "2.0.3",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=0.4.0"
- }
- },
- "node_modules/proxy-from-env": {
- "version": "1.1.0",
- "license": "MIT",
- "peer": true
- },
- "node_modules/pseudomap": {
- "version": "1.0.2",
- "license": "ISC"
- },
- "node_modules/psl": {
- "version": "1.9.0",
- "license": "MIT"
- },
- "node_modules/pump": {
- "version": "3.0.0",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "end-of-stream": "^1.1.0",
- "once": "^1.3.1"
- }
- },
- "node_modules/punycode": {
- "version": "2.1.1",
- "license": "MIT",
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/puppeteer": {
- "version": "18.2.0",
- "hasInstallScript": true,
- "license": "Apache-2.0",
- "peer": true,
- "dependencies": {
- "https-proxy-agent": "5.0.1",
- "progress": "2.0.3",
- "proxy-from-env": "1.1.0",
- "puppeteer-core": "18.2.0"
- },
- "engines": {
- "node": ">=14.1.0"
- }
- },
- "node_modules/puppeteer-cluster": {
- "version": "0.23.0",
- "resolved": "https://registry.npmjs.org/puppeteer-cluster/-/puppeteer-cluster-0.23.0.tgz",
- "integrity": "sha512-108terIWDzPrQopmoYSPd5yDoy3FGJ2dNnoGMkGYPs6xtkdhgaECwpfZkzaRToMQPZibUOz0/dSSGgPEdXEhkQ==",
- "dependencies": {
- "debug": "^4.3.3"
- },
- "peerDependencies": {
- "puppeteer": ">=1.5.0"
- }
- },
- "node_modules/puppeteer-core": {
- "version": "18.2.0",
- "license": "Apache-2.0",
- "peer": true,
- "dependencies": {
- "cross-fetch": "3.1.5",
- "debug": "4.3.4",
- "devtools-protocol": "0.0.1045489",
- "extract-zip": "2.0.1",
- "https-proxy-agent": "5.0.1",
- "proxy-from-env": "1.1.0",
- "rimraf": "3.0.2",
- "tar-fs": "2.1.1",
- "unbzip2-stream": "1.4.3",
- "ws": "8.9.0"
- },
- "engines": {
- "node": ">=14.1.0"
- }
- },
- "node_modules/qrcode": {
- "version": "1.5.1",
- "license": "MIT",
- "dependencies": {
- "dijkstrajs": "^1.0.1",
- "encode-utf8": "^1.0.3",
- "pngjs": "^5.0.0",
- "yargs": "^15.3.1"
- },
- "bin": {
- "qrcode": "bin/qrcode"
- },
- "engines": {
- "node": ">=10.13.0"
- }
- },
- "node_modules/qs": {
- "version": "6.5.3",
- "license": "BSD-3-Clause",
- "engines": {
- "node": ">=0.6"
- }
- },
- "node_modules/randombytes": {
- "version": "2.1.0",
- "license": "MIT",
- "dependencies": {
- "safe-buffer": "^5.1.0"
- }
- },
- "node_modules/readable-stream": {
- "version": "3.6.0",
- "license": "MIT",
- "dependencies": {
- "inherits": "^2.0.3",
- "string_decoder": "^1.1.1",
- "util-deprecate": "^1.0.1"
- },
- "engines": {
- "node": ">= 6"
- }
- },
- "node_modules/request": {
- "version": "2.88.2",
- "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142",
- "license": "Apache-2.0",
- "dependencies": {
- "aws-sign2": "~0.7.0",
- "aws4": "^1.8.0",
- "caseless": "~0.12.0",
- "combined-stream": "~1.0.6",
- "extend": "~3.0.2",
- "forever-agent": "~0.6.1",
- "form-data": "~2.3.2",
- "har-validator": "~5.1.3",
- "http-signature": "~1.2.0",
- "is-typedarray": "~1.0.0",
- "isstream": "~0.1.2",
- "json-stringify-safe": "~5.0.1",
- "mime-types": "~2.1.19",
- "oauth-sign": "~0.9.0",
- "performance-now": "^2.1.0",
- "qs": "~6.5.2",
- "safe-buffer": "^5.1.2",
- "tough-cookie": "~2.5.0",
- "tunnel-agent": "^0.6.0",
- "uuid": "^3.3.2"
- },
- "engines": {
- "node": ">= 6"
- }
- },
- "node_modules/require-directory": {
- "version": "2.1.1",
- "license": "MIT",
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/require-main-filename": {
- "version": "2.0.0",
- "license": "ISC"
- },
- "node_modules/resolve": {
- "version": "1.22.1",
- "license": "MIT",
- "dependencies": {
- "is-core-module": "^2.9.0",
- "path-parse": "^1.0.7",
- "supports-preserve-symlinks-flag": "^1.0.0"
- },
- "bin": {
- "resolve": "bin/resolve"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- },
- "node_modules/rfdc": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz",
- "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA=="
- },
- "node_modules/rimraf": {
- "version": "3.0.2",
- "license": "ISC",
- "peer": true,
- "dependencies": {
- "glob": "^7.1.3"
- },
- "bin": {
- "rimraf": "bin.js"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
- "node_modules/safe-buffer": {
- "version": "5.2.1",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ],
- "license": "MIT"
- },
- "node_modules/safer-buffer": {
- "version": "2.1.2",
- "license": "MIT"
- },
- "node_modules/semver": {
- "version": "5.7.1",
- "license": "ISC",
- "bin": {
- "semver": "bin/semver"
- }
- },
- "node_modules/seq-queue": {
- "version": "0.0.5"
- },
- "node_modules/serialize-javascript": {
- "version": "6.0.0",
- "license": "BSD-3-Clause",
- "dependencies": {
- "randombytes": "^2.1.0"
- }
- },
- "node_modules/set-blocking": {
- "version": "2.0.0",
- "license": "ISC"
- },
- "node_modules/shebang-command": {
- "version": "1.2.0",
- "license": "MIT",
- "dependencies": {
- "shebang-regex": "^1.0.0"
- },
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/shebang-regex": {
- "version": "1.0.0",
- "license": "MIT",
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/slick": {
- "version": "1.12.2",
- "license": "MIT (http://mootools.net/license.txt)",
- "engines": {
- "node": "*"
- }
- },
- "node_modules/source-map": {
- "version": "0.6.1",
- "license": "BSD-3-Clause",
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/source-map-js": {
- "version": "1.0.2",
- "license": "BSD-3-Clause",
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/sprintf-js": {
- "version": "1.0.3",
- "license": "BSD-3-Clause"
- },
- "node_modules/sqlstring": {
- "version": "2.3.3",
- "license": "MIT",
- "engines": {
- "node": ">= 0.6"
- }
- },
- "node_modules/sshpk": {
- "version": "1.17.0",
- "license": "MIT",
- "dependencies": {
- "asn1": "~0.2.3",
- "assert-plus": "^1.0.0",
- "bcrypt-pbkdf": "^1.0.0",
- "dashdash": "^1.12.0",
- "ecc-jsbn": "~0.1.1",
- "getpass": "^0.1.1",
- "jsbn": "~0.1.0",
- "safer-buffer": "^2.0.2",
- "tweetnacl": "~0.14.0"
- },
- "bin": {
- "sshpk-conv": "bin/sshpk-conv",
- "sshpk-sign": "bin/sshpk-sign",
- "sshpk-verify": "bin/sshpk-verify"
- },
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/streamroller": {
- "version": "3.1.3",
- "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-3.1.3.tgz",
- "integrity": "sha512-CphIJyFx2SALGHeINanjFRKQ4l7x2c+rXYJ4BMq0gd+ZK0gi4VT8b+eHe2wi58x4UayBAKx4xtHpXT/ea1cz8w==",
- "dependencies": {
- "date-format": "^4.0.14",
- "debug": "^4.3.4",
- "fs-extra": "^8.1.0"
- },
- "engines": {
- "node": ">=8.0"
- }
- },
- "node_modules/streamroller/node_modules/fs-extra": {
- "version": "8.1.0",
- "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
- "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
- "dependencies": {
- "graceful-fs": "^4.2.0",
- "jsonfile": "^4.0.0",
- "universalify": "^0.1.0"
- },
- "engines": {
- "node": ">=6 <7 || >=8"
- }
- },
- "node_modules/strftime": {
- "version": "0.10.1",
- "license": "MIT",
- "engines": {
- "node": ">=0.2.0"
- }
- },
- "node_modules/string_decoder": {
- "version": "1.3.0",
- "license": "MIT",
- "dependencies": {
- "safe-buffer": "~5.2.0"
- }
- },
- "node_modules/string-width": {
- "version": "4.2.3",
- "license": "MIT",
- "dependencies": {
- "emoji-regex": "^8.0.0",
- "is-fullwidth-code-point": "^3.0.0",
- "strip-ansi": "^6.0.1"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/strip-ansi": {
- "version": "6.0.1",
- "license": "MIT",
- "dependencies": {
- "ansi-regex": "^5.0.1"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/supports-color": {
- "version": "5.5.0",
- "license": "MIT",
- "dependencies": {
- "has-flag": "^3.0.0"
- },
- "engines": {
- "node": ">=4"
- }
- },
- "node_modules/supports-preserve-symlinks-flag": {
- "version": "1.0.0",
- "license": "MIT",
- "engines": {
- "node": ">= 0.4"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- },
- "node_modules/tar-fs": {
- "version": "2.1.1",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "chownr": "^1.1.1",
- "mkdirp-classic": "^0.5.2",
- "pump": "^3.0.0",
- "tar-stream": "^2.1.4"
- }
- },
- "node_modules/tar-stream": {
- "version": "2.2.0",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "bl": "^4.0.3",
- "end-of-stream": "^1.4.1",
- "fs-constants": "^1.0.0",
- "inherits": "^2.0.3",
- "readable-stream": "^3.1.1"
- },
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/through": {
- "version": "2.3.8",
- "license": "MIT",
- "peer": true
- },
- "node_modules/tough-cookie": {
- "version": "2.5.0",
- "license": "BSD-3-Clause",
- "dependencies": {
- "psl": "^1.1.28",
- "punycode": "^2.1.1"
- },
- "engines": {
- "node": ">=0.8"
- }
- },
- "node_modules/tr46": {
- "version": "0.0.3",
- "license": "MIT",
- "peer": true
- },
- "node_modules/tunnel-agent": {
- "version": "0.6.0",
- "license": "Apache-2.0",
- "dependencies": {
- "safe-buffer": "^5.0.1"
- },
- "engines": {
- "node": "*"
- }
- },
- "node_modules/tweetnacl": {
- "version": "0.14.5",
- "license": "Unlicense"
- },
- "node_modules/unbzip2-stream": {
- "version": "1.4.3",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "buffer": "^5.2.1",
- "through": "^2.3.8"
- }
- },
- "node_modules/universalify": {
- "version": "0.1.2",
- "license": "MIT",
- "engines": {
- "node": ">= 4.0.0"
- }
- },
- "node_modules/uri-js": {
- "version": "4.4.1",
- "license": "BSD-2-Clause",
- "dependencies": {
- "punycode": "^2.1.0"
- }
- },
- "node_modules/util-deprecate": {
- "version": "1.0.2",
- "license": "MIT"
- },
- "node_modules/uuid": {
- "version": "3.4.0",
- "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
- "license": "MIT",
- "bin": {
- "uuid": "bin/uuid"
- }
- },
- "node_modules/valid-data-url": {
- "version": "2.0.0",
- "license": "MIT",
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/verror": {
- "version": "1.10.0",
- "engines": [
- "node >=0.6.0"
- ],
- "license": "MIT",
- "dependencies": {
- "assert-plus": "^1.0.0",
- "core-util-is": "1.0.2",
- "extsprintf": "^1.2.0"
- }
- },
- "node_modules/vue": {
- "version": "2.7.10",
- "license": "MIT",
- "dependencies": {
- "@vue/compiler-sfc": "2.7.10",
- "csstype": "^3.1.0"
- }
- },
- "node_modules/vue-i18n": {
- "version": "8.27.2",
- "license": "MIT"
- },
- "node_modules/vue-server-renderer": {
- "version": "2.7.10",
- "license": "MIT",
- "dependencies": {
- "chalk": "^4.1.2",
- "hash-sum": "^2.0.0",
- "he": "^1.2.0",
- "lodash.template": "^4.5.0",
- "lodash.uniq": "^4.5.0",
- "resolve": "^1.22.0",
- "serialize-javascript": "^6.0.0",
- "source-map": "0.5.6"
- }
- },
- "node_modules/vue-server-renderer/node_modules/ansi-styles": {
- "version": "4.3.0",
- "license": "MIT",
- "dependencies": {
- "color-convert": "^2.0.1"
- },
- "engines": {
- "node": ">=8"
- },
- "funding": {
- "url": "https://github.com/chalk/ansi-styles?sponsor=1"
- }
- },
- "node_modules/vue-server-renderer/node_modules/chalk": {
- "version": "4.1.2",
- "license": "MIT",
- "dependencies": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/chalk/chalk?sponsor=1"
- }
- },
- "node_modules/vue-server-renderer/node_modules/color-convert": {
- "version": "2.0.1",
- "license": "MIT",
- "dependencies": {
- "color-name": "~1.1.4"
- },
- "engines": {
- "node": ">=7.0.0"
- }
- },
- "node_modules/vue-server-renderer/node_modules/color-name": {
- "version": "1.1.4",
- "license": "MIT"
- },
- "node_modules/vue-server-renderer/node_modules/has-flag": {
- "version": "4.0.0",
- "license": "MIT",
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/vue-server-renderer/node_modules/source-map": {
- "version": "0.5.6",
- "license": "BSD-3-Clause",
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/vue-server-renderer/node_modules/supports-color": {
- "version": "7.2.0",
- "license": "MIT",
- "dependencies": {
- "has-flag": "^4.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/web-resource-inliner": {
- "version": "4.3.4",
- "license": "MIT",
- "dependencies": {
- "async": "^3.1.0",
- "chalk": "^2.4.2",
- "datauri": "^2.0.0",
- "htmlparser2": "^4.0.0",
- "lodash.unescape": "^4.0.1",
- "request": "^2.88.0",
- "safer-buffer": "^2.1.2",
- "valid-data-url": "^2.0.0",
- "xtend": "^4.0.2"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
- "node_modules/web-resource-inliner/node_modules/dom-serializer": {
- "version": "1.4.1",
- "license": "MIT",
- "dependencies": {
- "domelementtype": "^2.0.1",
- "domhandler": "^4.2.0",
- "entities": "^2.0.0"
- },
- "funding": {
- "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1"
- }
- },
- "node_modules/web-resource-inliner/node_modules/dom-serializer/node_modules/domhandler": {
- "version": "4.3.1",
- "license": "BSD-2-Clause",
- "dependencies": {
- "domelementtype": "^2.2.0"
- },
- "engines": {
- "node": ">= 4"
- },
- "funding": {
- "url": "https://github.com/fb55/domhandler?sponsor=1"
- }
- },
- "node_modules/web-resource-inliner/node_modules/domelementtype": {
- "version": "2.3.0",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/fb55"
- }
- ],
- "license": "BSD-2-Clause"
- },
- "node_modules/web-resource-inliner/node_modules/domhandler": {
- "version": "3.3.0",
- "license": "BSD-2-Clause",
- "dependencies": {
- "domelementtype": "^2.0.1"
- },
- "engines": {
- "node": ">= 4"
- },
- "funding": {
- "url": "https://github.com/fb55/domhandler?sponsor=1"
- }
- },
- "node_modules/web-resource-inliner/node_modules/domutils": {
- "version": "2.8.0",
- "license": "BSD-2-Clause",
- "dependencies": {
- "dom-serializer": "^1.0.1",
- "domelementtype": "^2.2.0",
- "domhandler": "^4.2.0"
- },
- "funding": {
- "url": "https://github.com/fb55/domutils?sponsor=1"
- }
- },
- "node_modules/web-resource-inliner/node_modules/domutils/node_modules/domhandler": {
- "version": "4.3.1",
- "license": "BSD-2-Clause",
- "dependencies": {
- "domelementtype": "^2.2.0"
- },
- "engines": {
- "node": ">= 4"
- },
- "funding": {
- "url": "https://github.com/fb55/domhandler?sponsor=1"
- }
- },
- "node_modules/web-resource-inliner/node_modules/entities": {
- "version": "2.2.0",
- "license": "BSD-2-Clause",
- "funding": {
- "url": "https://github.com/fb55/entities?sponsor=1"
- }
- },
- "node_modules/web-resource-inliner/node_modules/htmlparser2": {
- "version": "4.1.0",
- "license": "MIT",
- "dependencies": {
- "domelementtype": "^2.0.1",
- "domhandler": "^3.0.0",
- "domutils": "^2.0.0",
- "entities": "^2.0.0"
- }
- },
- "node_modules/webidl-conversions": {
- "version": "3.0.1",
- "license": "BSD-2-Clause",
- "peer": true
- },
- "node_modules/whatwg-url": {
- "version": "5.0.0",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "tr46": "~0.0.3",
- "webidl-conversions": "^3.0.0"
- }
- },
- "node_modules/which": {
- "version": "1.3.1",
- "license": "ISC",
- "dependencies": {
- "isexe": "^2.0.0"
- },
- "bin": {
- "which": "bin/which"
- }
- },
- "node_modules/which-module": {
- "version": "2.0.0",
- "license": "ISC"
- },
- "node_modules/wrap-ansi": {
- "version": "6.2.0",
- "license": "MIT",
- "dependencies": {
- "ansi-styles": "^4.0.0",
- "string-width": "^4.1.0",
- "strip-ansi": "^6.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/wrap-ansi/node_modules/ansi-styles": {
- "version": "4.3.0",
- "license": "MIT",
- "dependencies": {
- "color-convert": "^2.0.1"
- },
- "engines": {
- "node": ">=8"
- },
- "funding": {
- "url": "https://github.com/chalk/ansi-styles?sponsor=1"
- }
- },
- "node_modules/wrap-ansi/node_modules/color-convert": {
- "version": "2.0.1",
- "license": "MIT",
- "dependencies": {
- "color-name": "~1.1.4"
- },
- "engines": {
- "node": ">=7.0.0"
- }
- },
- "node_modules/wrap-ansi/node_modules/color-name": {
- "version": "1.1.4",
- "license": "MIT"
- },
- "node_modules/wrappy": {
- "version": "1.0.2",
- "license": "ISC",
- "peer": true
- },
- "node_modules/ws": {
- "version": "8.9.0",
- "license": "MIT",
- "peer": true,
- "engines": {
- "node": ">=10.0.0"
- },
- "peerDependencies": {
- "bufferutil": "^4.0.1",
- "utf-8-validate": "^5.0.2"
- },
- "peerDependenciesMeta": {
- "bufferutil": {
- "optional": true
- },
- "utf-8-validate": {
- "optional": true
- }
- }
- },
- "node_modules/xmldom": {
- "version": "0.6.0",
- "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.6.0.tgz",
- "integrity": "sha512-iAcin401y58LckRZ0TkI4k0VSM1Qg0KGSc3i8rU+xrxe19A/BN1zHyVSJY7uoutVlaTSzYyk/v5AmkewAP7jtg==",
- "engines": {
- "node": ">=10.0.0"
- }
- },
- "node_modules/xtend": {
- "version": "4.0.2",
- "license": "MIT",
- "engines": {
- "node": ">=0.4"
- }
- },
- "node_modules/y18n": {
- "version": "4.0.3",
- "license": "ISC"
- },
- "node_modules/yallist": {
- "version": "3.1.1",
- "license": "ISC"
- },
- "node_modules/yargs": {
- "version": "15.4.1",
- "license": "MIT",
- "dependencies": {
- "cliui": "^6.0.0",
- "decamelize": "^1.2.0",
- "find-up": "^4.1.0",
- "get-caller-file": "^2.0.1",
- "require-directory": "^2.1.1",
- "require-main-filename": "^2.0.0",
- "set-blocking": "^2.0.0",
- "string-width": "^4.2.0",
- "which-module": "^2.0.0",
- "y18n": "^4.0.0",
- "yargs-parser": "^18.1.2"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/yargs-parser": {
- "version": "18.1.3",
- "license": "ISC",
- "dependencies": {
- "camelcase": "^5.0.0",
- "decamelize": "^1.2.0"
- },
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/yauzl": {
- "version": "2.10.0",
- "license": "MIT",
- "peer": true,
- "dependencies": {
- "buffer-crc32": "~0.2.3",
- "fd-slicer": "~1.1.0"
- }
- }
- },
- "dependencies": {
- "@babel/parser": {
- "version": "7.19.3"
- },
- "@types/node": {
- "version": "18.8.2",
- "optional": true,
- "peer": true
- },
- "@types/yauzl": {
- "version": "2.10.0",
- "optional": true,
- "peer": true,
- "requires": {
- "@types/node": "*"
- }
- },
- "@vue/compiler-sfc": {
- "version": "2.7.10",
- "requires": {
- "@babel/parser": "^7.18.4",
- "postcss": "^8.4.14",
- "source-map": "^0.6.1"
- }
- },
- "agent-base": {
- "version": "6.0.2",
- "peer": true,
- "requires": {
- "debug": "4"
- }
- },
- "ajv": {
- "version": "6.12.6",
- "requires": {
- "fast-deep-equal": "^3.1.1",
- "fast-json-stable-stringify": "^2.0.0",
- "json-schema-traverse": "^0.4.1",
- "uri-js": "^4.2.2"
- }
- },
- "ansi-regex": {
- "version": "5.0.1"
- },
- "ansi-styles": {
- "version": "3.2.1",
- "requires": {
- "color-convert": "^1.9.0"
- }
- },
- "argparse": {
- "version": "1.0.10",
- "requires": {
- "sprintf-js": "~1.0.2"
- }
- },
- "asn1": {
- "version": "0.2.6",
- "requires": {
- "safer-buffer": "~2.1.0"
- }
- },
- "assert-plus": {
- "version": "1.0.0"
- },
- "async": {
- "version": "3.2.4"
- },
- "asynckit": {
- "version": "0.4.0"
- },
- "aws-sign2": {
- "version": "0.7.0"
- },
- "aws4": {
- "version": "1.11.0"
- },
- "balanced-match": {
- "version": "1.0.2",
- "peer": true
- },
- "base64-js": {
- "version": "1.5.1",
- "peer": true
- },
- "bcrypt-pbkdf": {
- "version": "1.0.2",
- "requires": {
- "tweetnacl": "^0.14.3"
- }
- },
- "bl": {
- "version": "4.1.0",
- "peer": true,
- "requires": {
- "buffer": "^5.5.0",
- "inherits": "^2.0.4",
- "readable-stream": "^3.4.0"
- }
- },
- "boolbase": {
- "version": "1.0.0"
- },
- "brace-expansion": {
- "version": "1.1.11",
- "peer": true,
- "requires": {
- "balanced-match": "^1.0.0",
- "concat-map": "0.0.1"
- }
- },
- "buffer": {
- "version": "5.7.1",
- "peer": true,
- "requires": {
- "base64-js": "^1.3.1",
- "ieee754": "^1.1.13"
- }
- },
- "buffer-crc32": {
- "version": "0.2.13",
- "peer": true
- },
- "camelcase": {
- "version": "5.3.1"
- },
- "caseless": {
- "version": "0.12.0"
- },
- "chalk": {
- "version": "2.4.2",
- "requires": {
- "ansi-styles": "^3.2.1",
- "escape-string-regexp": "^1.0.5",
- "supports-color": "^5.3.0"
- }
- },
- "cheerio": {
- "version": "0.22.0",
- "requires": {
- "css-select": "~1.2.0",
- "dom-serializer": "~0.1.0",
- "entities": "~1.1.1",
- "htmlparser2": "^3.9.1",
- "lodash.assignin": "^4.0.9",
- "lodash.bind": "^4.1.4",
- "lodash.defaults": "^4.0.1",
- "lodash.filter": "^4.4.0",
- "lodash.flatten": "^4.2.0",
- "lodash.foreach": "^4.3.0",
- "lodash.map": "^4.4.0",
- "lodash.merge": "^4.4.0",
- "lodash.pick": "^4.2.1",
- "lodash.reduce": "^4.4.0",
- "lodash.reject": "^4.4.0",
- "lodash.some": "^4.4.0"
- }
- },
- "chownr": {
- "version": "1.1.4",
- "peer": true
- },
- "cliui": {
- "version": "6.0.0",
- "requires": {
- "string-width": "^4.2.0",
- "strip-ansi": "^6.0.0",
- "wrap-ansi": "^6.2.0"
- }
- },
- "color-convert": {
- "version": "1.9.3",
- "requires": {
- "color-name": "1.1.3"
- }
- },
- "color-name": {
- "version": "1.1.3"
- },
- "combined-stream": {
- "version": "1.0.8",
- "requires": {
- "delayed-stream": "~1.0.0"
- }
- },
- "commander": {
- "version": "2.20.3"
- },
- "concat-map": {
- "version": "0.0.1",
- "peer": true
- },
- "core-util-is": {
- "version": "1.0.2"
- },
- "cross-fetch": {
- "version": "3.1.5",
- "peer": true,
- "requires": {
- "node-fetch": "2.6.7"
- }
- },
- "cross-spawn": {
- "version": "6.0.5",
- "requires": {
- "nice-try": "^1.0.4",
- "path-key": "^2.0.1",
- "semver": "^5.5.0",
- "shebang-command": "^1.2.0",
- "which": "^1.2.9"
- }
- },
- "css-select": {
- "version": "1.2.0",
- "requires": {
- "boolbase": "~1.0.0",
- "css-what": "2.1",
- "domutils": "1.5.1",
- "nth-check": "~1.0.1"
- }
- },
- "css-what": {
- "version": "2.1.3"
- },
- "csstype": {
- "version": "3.1.1"
- },
- "dashdash": {
- "version": "1.14.1",
- "requires": {
- "assert-plus": "^1.0.0"
- }
- },
- "datauri": {
- "version": "2.0.0",
- "requires": {
- "image-size": "^0.7.3",
- "mimer": "^1.0.0"
- }
- },
- "date-format": {
- "version": "4.0.14",
- "resolved": "https://registry.npmjs.org/date-format/-/date-format-4.0.14.tgz",
- "integrity": "sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg=="
- },
- "debug": {
- "version": "4.3.4",
- "requires": {
- "ms": "2.1.2"
- }
- },
- "decamelize": {
- "version": "1.2.0"
- },
- "deep-extend": {
- "version": "0.6.0"
- },
- "delayed-stream": {
- "version": "1.0.0"
- },
- "denque": {
- "version": "1.5.1"
- },
- "devtools-protocol": {
- "version": "0.0.1045489",
- "peer": true
- },
- "dijkstrajs": {
- "version": "1.0.2"
- },
- "dom-serializer": {
- "version": "0.1.1",
- "requires": {
- "domelementtype": "^1.3.0",
- "entities": "^1.1.1"
- }
- },
- "domelementtype": {
- "version": "1.3.1"
- },
- "domhandler": {
- "version": "2.4.2",
- "requires": {
- "domelementtype": "1"
- }
- },
- "domutils": {
- "version": "1.5.1",
- "requires": {
- "dom-serializer": "0",
- "domelementtype": "1"
- }
- },
- "ecc-jsbn": {
- "version": "0.1.2",
- "requires": {
- "jsbn": "~0.1.0",
- "safer-buffer": "^2.1.0"
- }
- },
- "emoji-regex": {
- "version": "8.0.0"
- },
- "encode-utf8": {
- "version": "1.0.3"
- },
- "end-of-stream": {
- "version": "1.4.4",
- "peer": true,
- "requires": {
- "once": "^1.4.0"
- }
- },
- "entities": {
- "version": "1.1.2"
- },
- "escape-string-regexp": {
- "version": "1.0.5"
- },
- "esprima": {
- "version": "4.0.1"
- },
- "extend": {
- "version": "3.0.2"
- },
- "extract-zip": {
- "version": "2.0.1",
- "peer": true,
- "requires": {
- "@types/yauzl": "^2.9.1",
- "debug": "^4.1.1",
- "get-stream": "^5.1.0",
- "yauzl": "^2.10.0"
- }
- },
- "extsprintf": {
- "version": "1.3.0"
- },
- "fast-deep-equal": {
- "version": "3.1.3"
- },
- "fast-json-stable-stringify": {
- "version": "2.1.0"
- },
- "fd-slicer": {
- "version": "1.1.0",
- "peer": true,
- "requires": {
- "pend": "~1.2.0"
- }
- },
- "find-up": {
- "version": "4.1.0",
- "requires": {
- "locate-path": "^5.0.0",
- "path-exists": "^4.0.0"
- }
- },
- "flatted": {
- "version": "3.2.7",
- "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz",
- "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ=="
- },
- "forever-agent": {
- "version": "0.6.1"
- },
- "form-data": {
- "version": "2.3.3",
- "requires": {
- "asynckit": "^0.4.0",
- "combined-stream": "^1.0.6",
- "mime-types": "^2.1.12"
- }
- },
- "fs-constants": {
- "version": "1.0.0",
- "peer": true
- },
- "fs-extra": {
- "version": "7.0.1",
- "requires": {
- "graceful-fs": "^4.1.2",
- "jsonfile": "^4.0.0",
- "universalify": "^0.1.0"
- }
- },
- "fs.realpath": {
- "version": "1.0.0",
- "peer": true
- },
- "function-bind": {
- "version": "1.1.1"
- },
- "generate-function": {
- "version": "2.3.1",
- "requires": {
- "is-property": "^1.0.2"
- }
- },
- "get-caller-file": {
- "version": "2.0.5"
- },
- "get-stream": {
- "version": "5.2.0",
- "peer": true,
- "requires": {
- "pump": "^3.0.0"
- }
- },
- "getpass": {
- "version": "0.1.7",
- "requires": {
- "assert-plus": "^1.0.0"
- }
- },
- "glob": {
- "version": "7.2.3",
- "peer": true,
- "requires": {
- "fs.realpath": "^1.0.0",
- "inflight": "^1.0.4",
- "inherits": "2",
- "minimatch": "^3.1.1",
- "once": "^1.3.0",
- "path-is-absolute": "^1.0.0"
- }
- },
- "graceful-fs": {
- "version": "4.2.10"
- },
- "har-schema": {
- "version": "2.0.0"
- },
- "har-validator": {
- "version": "5.1.5",
- "requires": {
- "ajv": "^6.12.3",
- "har-schema": "^2.0.0"
- }
- },
- "has": {
- "version": "1.0.3",
- "requires": {
- "function-bind": "^1.1.1"
- }
- },
- "has-flag": {
- "version": "3.0.0"
- },
- "hash-sum": {
- "version": "2.0.0"
- },
- "he": {
- "version": "1.2.0"
- },
- "htmlparser2": {
- "version": "3.10.1",
- "requires": {
- "domelementtype": "^1.3.1",
- "domhandler": "^2.3.0",
- "domutils": "^1.5.1",
- "entities": "^1.1.1",
- "inherits": "^2.0.1",
- "readable-stream": "^3.1.1"
- }
- },
- "http-signature": {
- "version": "1.2.0",
- "requires": {
- "assert-plus": "^1.0.0",
- "jsprim": "^1.2.2",
- "sshpk": "^1.7.0"
- }
- },
- "https-proxy-agent": {
- "version": "5.0.1",
- "peer": true,
- "requires": {
- "agent-base": "6",
- "debug": "4"
- }
- },
- "iconv-lite": {
- "version": "0.5.2",
- "requires": {
- "safer-buffer": ">= 2.1.2 < 3"
- }
- },
- "ieee754": {
- "version": "1.2.1",
- "peer": true
- },
- "image-size": {
- "version": "0.7.5"
- },
- "inflight": {
- "version": "1.0.6",
- "peer": true,
- "requires": {
- "once": "^1.3.0",
- "wrappy": "1"
- }
- },
- "inherits": {
- "version": "2.0.4"
- },
- "intl": {
- "version": "1.2.5"
- },
- "is-core-module": {
- "version": "2.10.0",
- "requires": {
- "has": "^1.0.3"
- }
- },
- "is-fullwidth-code-point": {
- "version": "3.0.0"
- },
- "is-property": {
- "version": "1.0.2"
- },
- "is-typedarray": {
- "version": "1.0.0"
- },
- "isexe": {
- "version": "2.0.0"
- },
- "isstream": {
- "version": "0.1.2"
- },
- "js-yaml": {
- "version": "3.14.1",
- "requires": {
- "argparse": "^1.0.7",
- "esprima": "^4.0.0"
- }
- },
- "jsbarcode": {
- "version": "3.11.5",
- "resolved": "https://registry.npmjs.org/jsbarcode/-/jsbarcode-3.11.5.tgz",
- "integrity": "sha512-zv3KsH51zD00I/LrFzFSM6dst7rDn0vIMzaiZFL7qusTjPZiPtxg3zxetp0RR7obmjTw4f6NyGgbdkBCgZUIrA=="
- },
- "jsbn": {
- "version": "0.1.1"
- },
- "json-schema": {
- "version": "0.4.0"
- },
- "json-schema-traverse": {
- "version": "0.4.1"
- },
- "json-stringify-safe": {
- "version": "5.0.1"
- },
- "jsonexport": {
- "version": "3.2.0"
- },
- "jsonfile": {
- "version": "4.0.0",
- "requires": {
- "graceful-fs": "^4.1.6"
- }
- },
- "jsprim": {
- "version": "1.4.2",
- "requires": {
- "assert-plus": "1.0.0",
- "extsprintf": "1.3.0",
- "json-schema": "0.4.0",
- "verror": "1.10.0"
- }
- },
- "juice": {
- "version": "5.2.0",
- "requires": {
- "cheerio": "^0.22.0",
- "commander": "^2.15.1",
- "cross-spawn": "^6.0.5",
- "deep-extend": "^0.6.0",
- "mensch": "^0.3.3",
- "slick": "^1.12.2",
- "web-resource-inliner": "^4.3.1"
- }
- },
- "locate-path": {
- "version": "5.0.0",
- "requires": {
- "p-locate": "^4.1.0"
- }
- },
- "lodash._reinterpolate": {
- "version": "3.0.0"
- },
- "lodash.assignin": {
- "version": "4.2.0"
- },
- "lodash.bind": {
- "version": "4.2.1"
- },
- "lodash.defaults": {
- "version": "4.2.0"
- },
- "lodash.filter": {
- "version": "4.6.0"
- },
- "lodash.flatten": {
- "version": "4.4.0"
- },
- "lodash.foreach": {
- "version": "4.5.0"
- },
- "lodash.map": {
- "version": "4.6.0"
- },
- "lodash.merge": {
- "version": "4.6.2"
- },
- "lodash.pick": {
- "version": "4.4.0"
- },
- "lodash.reduce": {
- "version": "4.6.0"
- },
- "lodash.reject": {
- "version": "4.6.0"
- },
- "lodash.some": {
- "version": "4.6.0"
- },
- "lodash.template": {
- "version": "4.5.0",
- "requires": {
- "lodash._reinterpolate": "^3.0.0",
- "lodash.templatesettings": "^4.0.0"
- }
- },
- "lodash.templatesettings": {
- "version": "4.2.0",
- "requires": {
- "lodash._reinterpolate": "^3.0.0"
- }
- },
- "lodash.unescape": {
- "version": "4.0.1"
- },
- "lodash.uniq": {
- "version": "4.5.0"
- },
- "log4js": {
- "version": "6.7.0",
- "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.7.0.tgz",
- "integrity": "sha512-KA0W9ffgNBLDj6fZCq/lRbgR6ABAodRIDHrZnS48vOtfKa4PzWImb0Md1lmGCdO3n3sbCm/n1/WmrNlZ8kCI3Q==",
- "requires": {
- "date-format": "^4.0.14",
- "debug": "^4.3.4",
- "flatted": "^3.2.7",
- "rfdc": "^1.3.0",
- "streamroller": "^3.1.3"
- }
- },
- "long": {
- "version": "4.0.0"
- },
- "lru-cache": {
- "version": "5.1.1",
- "requires": {
- "yallist": "^3.0.2"
- }
- },
- "mensch": {
- "version": "0.3.4"
- },
- "mime-db": {
- "version": "1.52.0"
- },
- "mime-types": {
- "version": "2.1.35",
- "requires": {
- "mime-db": "1.52.0"
- }
- },
- "mimer": {
- "version": "1.1.1"
- },
- "minimatch": {
- "version": "3.1.2",
- "peer": true,
- "requires": {
- "brace-expansion": "^1.1.7"
- }
- },
- "mkdirp-classic": {
- "version": "0.5.3",
- "peer": true
- },
- "ms": {
- "version": "2.1.2"
- },
- "mysql2": {
- "version": "1.7.0",
- "requires": {
- "denque": "^1.4.1",
- "generate-function": "^2.3.1",
- "iconv-lite": "^0.5.0",
- "long": "^4.0.0",
- "lru-cache": "^5.1.1",
- "named-placeholders": "^1.1.2",
- "seq-queue": "^0.0.5",
- "sqlstring": "^2.3.1"
- }
- },
- "named-placeholders": {
- "version": "1.1.2",
- "requires": {
- "lru-cache": "^4.1.3"
- },
- "dependencies": {
- "lru-cache": {
- "version": "4.1.5",
- "requires": {
- "pseudomap": "^1.0.2",
- "yallist": "^2.1.2"
- }
- },
- "yallist": {
- "version": "2.1.2"
- }
- }
- },
- "nanoid": {
- "version": "3.3.4"
- },
- "nice-try": {
- "version": "1.0.5"
- },
- "node-fetch": {
- "version": "2.6.7",
- "peer": true,
- "requires": {
- "whatwg-url": "^5.0.0"
- }
- },
- "nodemailer": {
- "version": "4.7.0"
- },
- "nth-check": {
- "version": "1.0.2",
- "requires": {
- "boolbase": "~1.0.0"
- }
- },
- "oauth-sign": {
- "version": "0.9.0"
- },
- "once": {
- "version": "1.4.0",
- "peer": true,
- "requires": {
- "wrappy": "1"
- }
- },
- "p-limit": {
- "version": "2.3.0",
- "requires": {
- "p-try": "^2.0.0"
- }
- },
- "p-locate": {
- "version": "4.1.0",
- "requires": {
- "p-limit": "^2.2.0"
- }
- },
- "p-try": {
- "version": "2.2.0"
- },
- "path-exists": {
- "version": "4.0.0"
- },
- "path-is-absolute": {
- "version": "1.0.1",
- "peer": true
- },
- "path-key": {
- "version": "2.0.1"
- },
- "path-parse": {
- "version": "1.0.7"
- },
- "pend": {
- "version": "1.2.0",
- "peer": true
- },
- "performance-now": {
- "version": "2.1.0"
- },
- "picocolors": {
- "version": "1.0.0"
- },
- "pngjs": {
- "version": "5.0.0"
- },
- "postcss": {
- "version": "8.4.17",
- "requires": {
- "nanoid": "^3.3.4",
- "picocolors": "^1.0.0",
- "source-map-js": "^1.0.2"
- }
- },
- "progress": {
- "version": "2.0.3",
- "peer": true
- },
- "proxy-from-env": {
- "version": "1.1.0",
- "peer": true
- },
- "pseudomap": {
- "version": "1.0.2"
- },
- "psl": {
- "version": "1.9.0"
- },
- "pump": {
- "version": "3.0.0",
- "peer": true,
- "requires": {
- "end-of-stream": "^1.1.0",
- "once": "^1.3.1"
- }
- },
- "punycode": {
- "version": "2.1.1"
- },
- "puppeteer": {
- "version": "18.2.0",
- "peer": true,
- "requires": {
- "https-proxy-agent": "5.0.1",
- "progress": "2.0.3",
- "proxy-from-env": "1.1.0",
- "puppeteer-core": "18.2.0"
- }
- },
- "puppeteer-cluster": {
- "version": "0.23.0",
- "resolved": "https://registry.npmjs.org/puppeteer-cluster/-/puppeteer-cluster-0.23.0.tgz",
- "integrity": "sha512-108terIWDzPrQopmoYSPd5yDoy3FGJ2dNnoGMkGYPs6xtkdhgaECwpfZkzaRToMQPZibUOz0/dSSGgPEdXEhkQ==",
- "requires": {
- "debug": "^4.3.3"
- }
- },
- "puppeteer-core": {
- "version": "18.2.0",
- "peer": true,
- "requires": {
- "cross-fetch": "3.1.5",
- "debug": "4.3.4",
- "devtools-protocol": "0.0.1045489",
- "extract-zip": "2.0.1",
- "https-proxy-agent": "5.0.1",
- "proxy-from-env": "1.1.0",
- "rimraf": "3.0.2",
- "tar-fs": "2.1.1",
- "unbzip2-stream": "1.4.3",
- "ws": "8.9.0"
- }
- },
- "qrcode": {
- "version": "1.5.1",
- "requires": {
- "dijkstrajs": "^1.0.1",
- "encode-utf8": "^1.0.3",
- "pngjs": "^5.0.0",
- "yargs": "^15.3.1"
- }
- },
- "qs": {
- "version": "6.5.3"
- },
- "randombytes": {
- "version": "2.1.0",
- "requires": {
- "safe-buffer": "^5.1.0"
- }
- },
- "readable-stream": {
- "version": "3.6.0",
- "requires": {
- "inherits": "^2.0.3",
- "string_decoder": "^1.1.1",
- "util-deprecate": "^1.0.1"
- }
- },
- "request": {
- "version": "2.88.2",
- "requires": {
- "aws-sign2": "~0.7.0",
- "aws4": "^1.8.0",
- "caseless": "~0.12.0",
- "combined-stream": "~1.0.6",
- "extend": "~3.0.2",
- "forever-agent": "~0.6.1",
- "form-data": "~2.3.2",
- "har-validator": "~5.1.3",
- "http-signature": "~1.2.0",
- "is-typedarray": "~1.0.0",
- "isstream": "~0.1.2",
- "json-stringify-safe": "~5.0.1",
- "mime-types": "~2.1.19",
- "oauth-sign": "~0.9.0",
- "performance-now": "^2.1.0",
- "qs": "~6.5.2",
- "safe-buffer": "^5.1.2",
- "tough-cookie": "~2.5.0",
- "tunnel-agent": "^0.6.0",
- "uuid": "^3.3.2"
- }
- },
- "require-directory": {
- "version": "2.1.1"
- },
- "require-main-filename": {
- "version": "2.0.0"
- },
- "resolve": {
- "version": "1.22.1",
- "requires": {
- "is-core-module": "^2.9.0",
- "path-parse": "^1.0.7",
- "supports-preserve-symlinks-flag": "^1.0.0"
- }
- },
- "rfdc": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz",
- "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA=="
- },
- "rimraf": {
- "version": "3.0.2",
- "peer": true,
- "requires": {
- "glob": "^7.1.3"
- }
- },
- "safe-buffer": {
- "version": "5.2.1"
- },
- "safer-buffer": {
- "version": "2.1.2"
- },
- "semver": {
- "version": "5.7.1"
- },
- "seq-queue": {
- "version": "0.0.5"
- },
- "serialize-javascript": {
- "version": "6.0.0",
- "requires": {
- "randombytes": "^2.1.0"
- }
- },
- "set-blocking": {
- "version": "2.0.0"
- },
- "shebang-command": {
- "version": "1.2.0",
- "requires": {
- "shebang-regex": "^1.0.0"
- }
- },
- "shebang-regex": {
- "version": "1.0.0"
- },
- "slick": {
- "version": "1.12.2"
- },
- "source-map": {
- "version": "0.6.1"
- },
- "source-map-js": {
- "version": "1.0.2"
- },
- "sprintf-js": {
- "version": "1.0.3"
- },
- "sqlstring": {
- "version": "2.3.3"
- },
- "sshpk": {
- "version": "1.17.0",
- "requires": {
- "asn1": "~0.2.3",
- "assert-plus": "^1.0.0",
- "bcrypt-pbkdf": "^1.0.0",
- "dashdash": "^1.12.0",
- "ecc-jsbn": "~0.1.1",
- "getpass": "^0.1.1",
- "jsbn": "~0.1.0",
- "safer-buffer": "^2.0.2",
- "tweetnacl": "~0.14.0"
- }
- },
- "streamroller": {
- "version": "3.1.3",
- "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-3.1.3.tgz",
- "integrity": "sha512-CphIJyFx2SALGHeINanjFRKQ4l7x2c+rXYJ4BMq0gd+ZK0gi4VT8b+eHe2wi58x4UayBAKx4xtHpXT/ea1cz8w==",
- "requires": {
- "date-format": "^4.0.14",
- "debug": "^4.3.4",
- "fs-extra": "^8.1.0"
- },
- "dependencies": {
- "fs-extra": {
- "version": "8.1.0",
- "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
- "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
- "requires": {
- "graceful-fs": "^4.2.0",
- "jsonfile": "^4.0.0",
- "universalify": "^0.1.0"
- }
- }
- }
- },
- "strftime": {
- "version": "0.10.1"
- },
- "string_decoder": {
- "version": "1.3.0",
- "requires": {
- "safe-buffer": "~5.2.0"
- }
- },
- "string-width": {
- "version": "4.2.3",
- "requires": {
- "emoji-regex": "^8.0.0",
- "is-fullwidth-code-point": "^3.0.0",
- "strip-ansi": "^6.0.1"
- }
- },
- "strip-ansi": {
- "version": "6.0.1",
- "requires": {
- "ansi-regex": "^5.0.1"
- }
- },
- "supports-color": {
- "version": "5.5.0",
- "requires": {
- "has-flag": "^3.0.0"
- }
- },
- "supports-preserve-symlinks-flag": {
- "version": "1.0.0"
- },
- "tar-fs": {
- "version": "2.1.1",
- "peer": true,
- "requires": {
- "chownr": "^1.1.1",
- "mkdirp-classic": "^0.5.2",
- "pump": "^3.0.0",
- "tar-stream": "^2.1.4"
- }
- },
- "tar-stream": {
- "version": "2.2.0",
- "peer": true,
- "requires": {
- "bl": "^4.0.3",
- "end-of-stream": "^1.4.1",
- "fs-constants": "^1.0.0",
- "inherits": "^2.0.3",
- "readable-stream": "^3.1.1"
- }
- },
- "through": {
- "version": "2.3.8",
- "peer": true
- },
- "tough-cookie": {
- "version": "2.5.0",
- "requires": {
- "psl": "^1.1.28",
- "punycode": "^2.1.1"
- }
- },
- "tr46": {
- "version": "0.0.3",
- "peer": true
- },
- "tunnel-agent": {
- "version": "0.6.0",
- "requires": {
- "safe-buffer": "^5.0.1"
- }
- },
- "tweetnacl": {
- "version": "0.14.5"
- },
- "unbzip2-stream": {
- "version": "1.4.3",
- "peer": true,
- "requires": {
- "buffer": "^5.2.1",
- "through": "^2.3.8"
- }
- },
- "universalify": {
- "version": "0.1.2"
- },
- "uri-js": {
- "version": "4.4.1",
- "requires": {
- "punycode": "^2.1.0"
- }
- },
- "util-deprecate": {
- "version": "1.0.2"
- },
- "uuid": {
- "version": "3.4.0"
- },
- "valid-data-url": {
- "version": "2.0.0"
- },
- "verror": {
- "version": "1.10.0",
- "requires": {
- "assert-plus": "^1.0.0",
- "core-util-is": "1.0.2",
- "extsprintf": "^1.2.0"
- }
- },
- "vue": {
- "version": "2.7.10",
- "requires": {
- "@vue/compiler-sfc": "2.7.10",
- "csstype": "^3.1.0"
- }
- },
- "vue-i18n": {
- "version": "8.27.2"
- },
- "vue-server-renderer": {
- "version": "2.7.10",
- "requires": {
- "chalk": "^4.1.2",
- "hash-sum": "^2.0.0",
- "he": "^1.2.0",
- "lodash.template": "^4.5.0",
- "lodash.uniq": "^4.5.0",
- "resolve": "^1.22.0",
- "serialize-javascript": "^6.0.0",
- "source-map": "0.5.6"
- },
- "dependencies": {
- "ansi-styles": {
- "version": "4.3.0",
- "requires": {
- "color-convert": "^2.0.1"
- }
- },
- "chalk": {
- "version": "4.1.2",
- "requires": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
- }
- },
- "color-convert": {
- "version": "2.0.1",
- "requires": {
- "color-name": "~1.1.4"
- }
- },
- "color-name": {
- "version": "1.1.4"
- },
- "has-flag": {
- "version": "4.0.0"
- },
- "source-map": {
- "version": "0.5.6"
- },
- "supports-color": {
- "version": "7.2.0",
- "requires": {
- "has-flag": "^4.0.0"
- }
- }
- }
- },
- "web-resource-inliner": {
- "version": "4.3.4",
- "requires": {
- "async": "^3.1.0",
- "chalk": "^2.4.2",
- "datauri": "^2.0.0",
- "htmlparser2": "^4.0.0",
- "lodash.unescape": "^4.0.1",
- "request": "^2.88.0",
- "safer-buffer": "^2.1.2",
- "valid-data-url": "^2.0.0",
- "xtend": "^4.0.2"
- },
- "dependencies": {
- "dom-serializer": {
- "version": "1.4.1",
- "requires": {
- "domelementtype": "^2.0.1",
- "domhandler": "^4.2.0",
- "entities": "^2.0.0"
- },
- "dependencies": {
- "domhandler": {
- "version": "4.3.1",
- "requires": {
- "domelementtype": "^2.2.0"
- }
- }
- }
- },
- "domelementtype": {
- "version": "2.3.0"
- },
- "domhandler": {
- "version": "3.3.0",
- "requires": {
- "domelementtype": "^2.0.1"
- }
- },
- "domutils": {
- "version": "2.8.0",
- "requires": {
- "dom-serializer": "^1.0.1",
- "domelementtype": "^2.2.0",
- "domhandler": "^4.2.0"
- },
- "dependencies": {
- "domhandler": {
- "version": "4.3.1",
- "requires": {
- "domelementtype": "^2.2.0"
- }
- }
- }
- },
- "entities": {
- "version": "2.2.0"
- },
- "htmlparser2": {
- "version": "4.1.0",
- "requires": {
- "domelementtype": "^2.0.1",
- "domhandler": "^3.0.0",
- "domutils": "^2.0.0",
- "entities": "^2.0.0"
- }
- }
- }
- },
- "webidl-conversions": {
- "version": "3.0.1",
- "peer": true
- },
- "whatwg-url": {
- "version": "5.0.0",
- "peer": true,
- "requires": {
- "tr46": "~0.0.3",
- "webidl-conversions": "^3.0.0"
- }
- },
- "which": {
- "version": "1.3.1",
- "requires": {
- "isexe": "^2.0.0"
- }
- },
- "which-module": {
- "version": "2.0.0"
- },
- "wrap-ansi": {
- "version": "6.2.0",
- "requires": {
- "ansi-styles": "^4.0.0",
- "string-width": "^4.1.0",
- "strip-ansi": "^6.0.0"
- },
- "dependencies": {
- "ansi-styles": {
- "version": "4.3.0",
- "requires": {
- "color-convert": "^2.0.1"
- }
- },
- "color-convert": {
- "version": "2.0.1",
- "requires": {
- "color-name": "~1.1.4"
- }
- },
- "color-name": {
- "version": "1.1.4"
- }
- }
- },
- "wrappy": {
- "version": "1.0.2",
- "peer": true
- },
- "ws": {
- "version": "8.9.0",
- "peer": true,
- "requires": {}
- },
- "xmldom": {
- "version": "0.6.0",
- "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.6.0.tgz",
- "integrity": "sha512-iAcin401y58LckRZ0TkI4k0VSM1Qg0KGSc3i8rU+xrxe19A/BN1zHyVSJY7uoutVlaTSzYyk/v5AmkewAP7jtg=="
- },
- "xtend": {
- "version": "4.0.2"
- },
- "y18n": {
- "version": "4.0.3"
- },
- "yallist": {
- "version": "3.1.1"
- },
- "yargs": {
- "version": "15.4.1",
- "requires": {
- "cliui": "^6.0.0",
- "decamelize": "^1.2.0",
- "find-up": "^4.1.0",
- "get-caller-file": "^2.0.1",
- "require-directory": "^2.1.1",
- "require-main-filename": "^2.0.0",
- "set-blocking": "^2.0.0",
- "string-width": "^4.2.0",
- "which-module": "^2.0.0",
- "y18n": "^4.0.0",
- "yargs-parser": "^18.1.2"
- }
- },
- "yargs-parser": {
- "version": "18.1.3",
- "requires": {
- "camelcase": "^5.0.0",
- "decamelize": "^1.2.0"
- }
- },
- "yauzl": {
- "version": "2.10.0",
- "peer": true,
- "requires": {
- "buffer-crc32": "~0.2.3",
- "fd-slicer": "~1.1.0"
- }
- }
- }
-}
diff --git a/print/templates/email/buyer-week-waste/buyer-week-waste.js b/print/templates/email/buyer-week-waste/buyer-week-waste.js
index 9d4fe1ce1..1ae40cd98 100755
--- a/print/templates/email/buyer-week-waste/buyer-week-waste.js
+++ b/print/templates/email/buyer-week-waste/buyer-week-waste.js
@@ -13,7 +13,7 @@ module.exports = {
dated: function() {
const filters = this.$options.filters;
- return filters.date(new Date(), '%d-%m-%Y');
+ return filters.date(Date.vnNew(), '%d-%m-%Y');
}
},
methods: {
diff --git a/print/templates/email/email-verify/email-verify.js b/print/templates/email/email-verify/email-verify.js
index 7f0b80a13..4f2b29266 100755
--- a/print/templates/email/email-verify/email-verify.js
+++ b/print/templates/email/email-verify/email-verify.js
@@ -10,7 +10,7 @@ module.exports = {
},
props: {
url: {
- type: [String],
+ type: String,
required: true
}
}
diff --git a/print/templates/email/invoice-electronic/invoice-electronic.html b/print/templates/email/invoice-electronic/invoice-electronic.html
new file mode 100644
index 000000000..fc96e0970
--- /dev/null
+++ b/print/templates/email/invoice-electronic/invoice-electronic.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+ {{ $t('subject') }}
+
+
+ {{ $t('title') }} {{name}}
+ {{ $t('clientMail') }} {{email}}
+ {{ $t('ticketId') }} {{ticketId}}
+
+
diff --git a/print/templates/email/invoice-electronic/invoice-electronic.js b/print/templates/email/invoice-electronic/invoice-electronic.js
new file mode 100644
index 000000000..2e1e739ac
--- /dev/null
+++ b/print/templates/email/invoice-electronic/invoice-electronic.js
@@ -0,0 +1,21 @@
+module.exports = {
+ name: 'invoice-electronic',
+ props: {
+ name: {
+ type: [String],
+ required: true
+ },
+ email: {
+ type: [String],
+ required: true
+ },
+ ticketId: {
+ type: [Number],
+ required: true
+ },
+ url: {
+ type: [String],
+ required: true
+ }
+ },
+};
diff --git a/print/templates/email/invoice-electronic/locale/en.yml b/print/templates/email/invoice-electronic/locale/en.yml
new file mode 100644
index 000000000..5523a2fa3
--- /dev/null
+++ b/print/templates/email/invoice-electronic/locale/en.yml
@@ -0,0 +1,4 @@
+subject: A electronic invoice has been created
+title: A new electronic invoice has been created for the client
+clientMail: The client's email is
+ticketId: The invoice's ticket is
\ No newline at end of file
diff --git a/print/templates/email/invoice-electronic/locale/es.yml b/print/templates/email/invoice-electronic/locale/es.yml
new file mode 100644
index 000000000..2cbcfbb36
--- /dev/null
+++ b/print/templates/email/invoice-electronic/locale/es.yml
@@ -0,0 +1,4 @@
+subject: Se ha creado una factura electrónica
+title: Se ha creado una nueva factura electrónica para el cliente
+clientMail: El correo del cliente es
+ticketId: El ticket de la factura es
\ No newline at end of file
diff --git a/print/templates/email/invoiceIn/locale/en.yml b/print/templates/email/invoiceIn/locale/en.yml
index 47ebc3966..e238ecf61 100644
--- a/print/templates/email/invoiceIn/locale/en.yml
+++ b/print/templates/email/invoiceIn/locale/en.yml
@@ -1,5 +1,5 @@
-subject: Your agricultural invoice
-title: Your agricultural invoice
+subject: Your agricultural receipt
+title: Your agricultural receipt
dear: Dear supplier
description: Attached you can find agricultural receipt generated from your last deliveries. Please return a signed and stamped copy to our administration department.
conclusion: Thanks for your attention!
diff --git a/print/templates/email/invoiceIn/locale/es.yml b/print/templates/email/invoiceIn/locale/es.yml
index 2698763cf..456122c75 100644
--- a/print/templates/email/invoiceIn/locale/es.yml
+++ b/print/templates/email/invoiceIn/locale/es.yml
@@ -1,5 +1,5 @@
-subject: Tu factura agrícola
-title: Tu factura agrícola
+subject: Tu recibo agrícola
+title: Tu recibo agrícola
dear: Estimado proveedor
description: Adjunto puede encontrar recibo agrícola generado de sus últimas entregas. Por favor, devuelva una copia firmada y sellada a nuestro de departamento de administración.
conclusion: ¡Gracias por tu atención!
diff --git a/print/templates/email/invoiceIn/locale/fr.yml b/print/templates/email/invoiceIn/locale/fr.yml
index 1c38f3c25..dd35631e5 100644
--- a/print/templates/email/invoiceIn/locale/fr.yml
+++ b/print/templates/email/invoiceIn/locale/fr.yml
@@ -1,5 +1,5 @@
-subject: Votre facture agricole
-title: Votre facture agricole
+subject: Votre reçu agricole
+title: Votre reçu agricole
dear: Cher Fournisseur
description: Vous trouverez en pièce jointe le reçu agricole généré à partir de vos dernières livraisons. Veuillez retourner une copie signée et tamponnée à notre service administratif.
conclusion: Merci pour votre attention!
diff --git a/print/templates/email/invoiceIn/locale/pt.yml b/print/templates/email/invoiceIn/locale/pt.yml
index a43e3a79d..5dffc7acf 100644
--- a/print/templates/email/invoiceIn/locale/pt.yml
+++ b/print/templates/email/invoiceIn/locale/pt.yml
@@ -1,5 +1,5 @@
-subject: A sua fatura agrícola
-title: A sua fatura agrícola
+subject: A sua recibo agrícola
+title: A sua recibo agrícola
dear: Caro Fornecedor
description: Em anexo encontra-se o recibo agrícola gerado a partir das suas últimas entregas. Por favor, devolva uma cópia assinada e carimbada ao nosso departamento de administração.
conclusion: Obrigado pela atenção.
diff --git a/print/templates/email/osticket-report/osticket-report.js b/print/templates/email/osticket-report/osticket-report.js
index eb9c76a89..0d39947d5 100755
--- a/print/templates/email/osticket-report/osticket-report.js
+++ b/print/templates/email/osticket-report/osticket-report.js
@@ -37,7 +37,7 @@ module.exports = {
dated: function() {
const filters = this.$options.filters;
- return filters.date(new Date(), '%d-%m-%Y');
+ return filters.date(Date.vnNew(), '%d-%m-%Y');
},
startedTime: function() {
return new Date(this.started).getTime();
diff --git a/print/templates/email/printer-setup/locale/es.yml b/print/templates/email/printer-setup/locale/es.yml
index 77a3a7299..7361e5ed3 100644
--- a/print/templates/email/printer-setup/locale/es.yml
+++ b/print/templates/email/printer-setup/locale/es.yml
@@ -8,8 +8,8 @@ description:
https://www.youtube.com/watch?v=qhb0kgQF3o8. También
necesitarás el QLabel, el programa para imprimir las cintas.
- downloadFrom: Puedes descargarlo desde este enlace https://godex.s3-accelerate.amazonaws.com/gGnOPoojkP6vC1lgmrbEqQ.file?v01
+ downloadFrom: Puedes descargarlo desde este enlace https://cdn.verdnatura.es/public/QLabel_IV_V1.37_Install_en.exe
downloadDriver: En este enlace puedes descargar el driver de la impresora https://es.seagullscientific.com/support/downloads/drivers/godex/download/
sections:
diff --git a/print/templates/email/recover-password/recover-password.js b/print/templates/email/recover-password/recover-password.js
index b589411a9..d8448f370 100755
--- a/print/templates/email/recover-password/recover-password.js
+++ b/print/templates/email/recover-password/recover-password.js
@@ -10,7 +10,7 @@ module.exports = {
},
props: {
url: {
- type: [String],
+ type: String,
required: true
}
}
diff --git a/print/templates/email/worker-welcome/assets/css/import.js b/print/templates/email/worker-welcome/assets/css/import.js
new file mode 100644
index 000000000..4b4bb7086
--- /dev/null
+++ b/print/templates/email/worker-welcome/assets/css/import.js
@@ -0,0 +1,11 @@
+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`])
+ .mergeStyles();
diff --git a/print/templates/email/worker-welcome/locale/es.yml b/print/templates/email/worker-welcome/locale/es.yml
new file mode 100644
index 000000000..d53a4e1f0
--- /dev/null
+++ b/print/templates/email/worker-welcome/locale/es.yml
@@ -0,0 +1,8 @@
+subject: Bienvenido a Verdnatura
+title: "¡Te damos la bienvenida!"
+dearWorker: Estimado trabajador
+workerData: 'Estos son los datos de tu usuario de Verdnatura.
+ Usuario: {0}. Haz click aquí para
+ establecer tu contraseña
+ .'
diff --git a/print/templates/email/worker-welcome/sql/worker.sql b/print/templates/email/worker-welcome/sql/worker.sql
new file mode 100644
index 000000000..f75d135d9
--- /dev/null
+++ b/print/templates/email/worker-welcome/sql/worker.sql
@@ -0,0 +1,7 @@
+SELECT
+ u.id,
+ u.name,
+ e.email
+FROM account.user u
+ LEFT JOIN account.emailUser e ON e.userFk = u.id
+WHERE u.id = ?;
diff --git a/print/templates/email/worker-welcome/worker-welcome.html b/print/templates/email/worker-welcome/worker-welcome.html
new file mode 100644
index 000000000..fbb05d149
--- /dev/null
+++ b/print/templates/email/worker-welcome/worker-welcome.html
@@ -0,0 +1,9 @@
+
+
+
+ {{ $t('title', [id]) }}
+ {{ $t('dearWorker') }},
+
+
+
+
diff --git a/print/templates/email/worker-welcome/worker-welcome.js b/print/templates/email/worker-welcome/worker-welcome.js
new file mode 100755
index 000000000..043a172a1
--- /dev/null
+++ b/print/templates/email/worker-welcome/worker-welcome.js
@@ -0,0 +1,27 @@
+const Component = require(`vn-print/core/component`);
+const emailBody = new Component('email-body');
+
+module.exports = {
+ name: 'worker-welcome',
+ async serverPrefetch() {
+ this.worker = await this.fetchWorker(this.id);
+ },
+ methods: {
+ fetchWorker(id) {
+ return this.findOneFromDef('worker', [id]);
+ },
+ },
+ components: {
+ 'email-body': emailBody.build(),
+ },
+ props: {
+ id: {
+ type: Number,
+ required: true
+ },
+ url: {
+ type: String,
+ required: true
+ }
+ }
+};
diff --git a/print/templates/reports/balance-compensation/balance-compensation.html b/print/templates/reports/balance-compensation/balance-compensation.html
index 59af1bd11..1e9aa5661 100644
--- a/print/templates/reports/balance-compensation/balance-compensation.html
+++ b/print/templates/reports/balance-compensation/balance-compensation.html
@@ -3,7 +3,7 @@
- {{$t('Place')}} {{currentDate()}}
+ {{$t('Place')}} {{formatDate(new Date(), '%d-%m-%Y')}}
{{$t('Compensation') | uppercase}}
{{$t('In one hand')}}:
@@ -17,7 +17,7 @@
{{$t('Agree') | uppercase}}
- {{$t('Date')}} {{client.payed | date('%d-%m-%Y')}} {{$t('Compensate')}} {{client.amountPaid}} €
+ {{$t('Date')}} {{formatDate(client.payed, '%d-%m-%Y')}} {{$t('Compensate')}} {{client.amountPaid}} €
{{$t('From client')}} {{client.name}} {{$t('Toclient')}} {{company.name}}.
diff --git a/print/templates/reports/balance-compensation/balance-compensation.js b/print/templates/reports/balance-compensation/balance-compensation.js
index 98a9cf577..bae7c5c3c 100644
--- a/print/templates/reports/balance-compensation/balance-compensation.js
+++ b/print/templates/reports/balance-compensation/balance-compensation.js
@@ -1,28 +1,12 @@
-const Component = require(`vn-print/core/component`);
-const reportBody = new Component('report-body');
+const vnReport = require('../../../core/mixins/vn-report.js');
module.exports = {
name: 'balance-compensation',
+ mixins: [vnReport],
async serverPrefetch() {
- this.client = await this.fetchClient(this.id);
- this.company = await this.fetchCompany(this.id);
- },
- methods: {
- fetchClient(id) {
- return this.findOneFromDef('client', [id]);
- },
- fetchCompany(id) {
- return this.findOneFromDef('company', [id]);
- },
-
- currentDate() {
- const current = new Date();
- const date = `${current.getDate()}/${current.getMonth() + 1}/${current.getFullYear()}`;
- return date;
- }
- },
- components: {
- 'report-body': reportBody.build()
+ this.client = await this.findOneFromDef('client', [this.id]);
+ this.checkMainEntity(this.client);
+ this.company = await this.findOneFromDef('company', [this.id]);
},
props: {
id: {
diff --git a/print/templates/reports/campaign-metrics/campaign-metrics.html b/print/templates/reports/campaign-metrics/campaign-metrics.html
index e86d4cd3b..57d616a29 100644
--- a/print/templates/reports/campaign-metrics/campaign-metrics.html
+++ b/print/templates/reports/campaign-metrics/campaign-metrics.html
@@ -13,11 +13,11 @@
|
{{$t('From')}} |
- {{from | date('%d-%m-%Y')}} |
+ {{formatDate(from, '%d-%m-%Y')}} |
{{$t('To')}} |
- {{to | date('%d-%m-%Y')}} |
+ {{formatDate(to, '%d-%m-%Y')}} |
diff --git a/print/templates/reports/campaign-metrics/campaign-metrics.js b/print/templates/reports/campaign-metrics/campaign-metrics.js
index 14a4b6a9b..45bca88dc 100755
--- a/print/templates/reports/campaign-metrics/campaign-metrics.js
+++ b/print/templates/reports/campaign-metrics/campaign-metrics.js
@@ -1,27 +1,12 @@
-const Component = require(`vn-print/core/component`);
-const reportBody = new Component('report-body');
-const reportFooter = new Component('report-footer');
+const vnReport = require('../../../core/mixins/vn-report.js');
module.exports = {
name: 'campaign-metrics',
+ mixins: [vnReport],
async serverPrefetch() {
- this.client = await this.fetchClient(this.id);
- this.sales = await this.fetchSales(this.id, this.from, this.to);
-
- if (!this.client)
- throw new Error('Something went wrong');
- },
- methods: {
- fetchClient(id) {
- return this.findOneFromDef('client', [id]);
- },
- fetchSales(id, from, to) {
- return this.rawSqlFromDef('sales', [id, from, to]);
- },
- },
- components: {
- 'report-body': reportBody.build(),
- 'report-footer': reportFooter.build()
+ this.client = await this.findOneFromDef('client', [this.id]);
+ this.checkMainEntity(this.client);
+ this.sales = await this.rawSqlFromDef('sales', [this.id, this.from, this.to]);
},
props: {
id: {
diff --git a/print/templates/reports/claim-pickup-order/claim-pickup-order.html b/print/templates/reports/claim-pickup-order/claim-pickup-order.html
index b14f5410c..000568ef2 100644
--- a/print/templates/reports/claim-pickup-order/claim-pickup-order.html
+++ b/print/templates/reports/claim-pickup-order/claim-pickup-order.html
@@ -20,7 +20,7 @@
|
{{$t('date')}} |
- {{dated}} |
+ {{formatDate(new Date(), '%d-%m-%Y')}} |
diff --git a/print/templates/reports/claim-pickup-order/claim-pickup-order.js b/print/templates/reports/claim-pickup-order/claim-pickup-order.js
index 5c7002e47..cc5cec1ea 100755
--- a/print/templates/reports/claim-pickup-order/claim-pickup-order.js
+++ b/print/templates/reports/claim-pickup-order/claim-pickup-order.js
@@ -1,34 +1,12 @@
-const Component = require(`vn-print/core/component`);
-const reportBody = new Component('report-body');
-const reportFooter = new Component('report-footer');
+const vnReport = require('../../../core/mixins/vn-report.js');
module.exports = {
name: 'claim-pickup-order',
+ mixins: [vnReport],
async serverPrefetch() {
- this.client = await this.fetchClient(this.id);
- this.sales = await this.fetchSales(this.id);
-
- if (!this.client)
- throw new Error('Something went wrong');
- },
- computed: {
- dated: function() {
- const filters = this.$options.filters;
-
- return filters.date(new Date(), '%d-%m-%Y');
- }
- },
- methods: {
- fetchClient(id) {
- return this.findOneFromDef('client', [id]);
- },
- fetchSales(id) {
- return this.rawSqlFromDef('sales', [id]);
- }
- },
- components: {
- 'report-body': reportBody.build(),
- 'report-footer': reportFooter.build()
+ this.client = await this.findOneFromDef('client', [this.id]);
+ this.checkMainEntity(this.client);
+ this.sales = await this.rawSqlFromDef('sales', [this.id]);
},
props: {
id: {
@@ -36,5 +14,5 @@ module.exports = {
required: true,
description: 'The claim id'
}
- }
+ },
};
diff --git a/print/templates/reports/client-debt-statement/client-debt-statement.html b/print/templates/reports/client-debt-statement/client-debt-statement.html
index 962af021d..fb7bfd625 100644
--- a/print/templates/reports/client-debt-statement/client-debt-statement.html
+++ b/print/templates/reports/client-debt-statement/client-debt-statement.html
@@ -13,7 +13,7 @@
|