merge
This commit is contained in:
commit
81f108fb9a
|
@ -1,6 +1,7 @@
|
||||||
|
.DS_Store
|
||||||
node_modules
|
node_modules
|
||||||
build
|
build
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
debug.log
|
debug.log
|
||||||
datasources.development.json
|
datasources.development.json
|
||||||
.idea
|
.idea
|
||||||
|
|
|
@ -53,6 +53,7 @@ export default {
|
||||||
invoiceByMailCheckboxLabel: `${components.vnCheck}[label='Invoice by mail'] > label`,
|
invoiceByMailCheckboxLabel: `${components.vnCheck}[label='Invoice by mail'] > label`,
|
||||||
invoiceByMailCheckboxInput: `${components.vnCheck}[label='Invoice by mail'] > label > label > input`,
|
invoiceByMailCheckboxInput: `${components.vnCheck}[label='Invoice by mail'] > label > label > input`,
|
||||||
addressInput: `${components.vnTextfield}[name="street"]`,
|
addressInput: `${components.vnTextfield}[name="street"]`,
|
||||||
|
cityInput: `${components.vnTextfield}[name="city"]`,
|
||||||
saveButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-fiscal-data > form > vn-button-bar > vn-submit > input'
|
saveButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-fiscal-data > form > vn-button-bar > vn-submit > input'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -132,4 +132,64 @@ describe('Edit fiscalData path', () => {
|
||||||
})
|
})
|
||||||
.catch(catchErrors(done));
|
.catch(catchErrors(done));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it(`should edit the address`, done => {
|
||||||
|
nightmare
|
||||||
|
.wait(selectors.fiscalData.addressInput)
|
||||||
|
.clearInput(selectors.fiscalData.addressInput)
|
||||||
|
.type(selectors.fiscalData.addressInput, 'Alpha Flight Low-Orbit')
|
||||||
|
.click(selectors.fiscalData.saveButton)
|
||||||
|
.wait(selectors.globalItems.snackbarIsActive)
|
||||||
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toEqual(`¡Datos guardados!`);
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
.catch(catchErrors(done));
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should confirm the address have been edited`, done => {
|
||||||
|
nightmare
|
||||||
|
.waitForSnackbarReset()
|
||||||
|
.click(selectors.basicData.basicDataButton)
|
||||||
|
.wait(selectors.basicData.nameInput)
|
||||||
|
.click(selectors.fiscalData.fiscalDataButton)
|
||||||
|
.wait(selectors.fiscalData.addressInput)
|
||||||
|
.getInputValue(selectors.fiscalData.addressInput)
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toEqual(`Alpha Flight Low-Orbit`);
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
.catch(catchErrors(done));
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should edit the city`, done => {
|
||||||
|
nightmare
|
||||||
|
.wait(selectors.fiscalData.cityInput)
|
||||||
|
.clearInput(selectors.fiscalData.cityInput)
|
||||||
|
.type(selectors.fiscalData.cityInput, 'N/A')
|
||||||
|
.click(selectors.fiscalData.saveButton)
|
||||||
|
.wait(selectors.globalItems.snackbarIsActive)
|
||||||
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toEqual(`¡Datos guardados!`);
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
.catch(catchErrors(done));
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should confirm the city have been edited`, done => {
|
||||||
|
nightmare
|
||||||
|
.waitForSnackbarReset()
|
||||||
|
.click(selectors.basicData.basicDataButton)
|
||||||
|
.wait(selectors.basicData.nameInput)
|
||||||
|
.click(selectors.fiscalData.fiscalDataButton)
|
||||||
|
.wait(selectors.fiscalData.cityInput)
|
||||||
|
.getInputValue(selectors.fiscalData.cityInput)
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toEqual(`N/A`);
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
.catch(catchErrors(done));
|
||||||
|
});
|
||||||
});
|
});
|
|
@ -45,18 +45,20 @@ module.exports = function(Self) {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.list = function(ctx, clientFilter, cb) {
|
this.list = function(ctx, clientFilter, cb) {
|
||||||
var clientFields = (clientFilter && clientFilter.fields) ? clientFilter.fields : [];
|
let clientFields = (clientFilter && clientFilter.fields) ? clientFilter.fields : [];
|
||||||
var serverFields = (serverFilter && serverFilter.fields) ? serverFilter.fields : [];
|
let serverFields = (serverFilter && serverFilter.fields) ? serverFilter.fields : [];
|
||||||
var fields = clientFields.filter(itemC => {
|
let fields = clientFields.filter(itemC => {
|
||||||
return serverFields.some(itemS => itemS === itemC);
|
return serverFields.some(itemS => itemS === itemC);
|
||||||
});
|
});
|
||||||
|
let and = [];
|
||||||
|
let order;
|
||||||
|
let limit;
|
||||||
|
let filter = {order: order, limit: limit};
|
||||||
|
|
||||||
var and = [];
|
if (clientFilter && clientFilter.where)
|
||||||
(clientFilter && clientFilter.where) && and.push(clientFilter.where);
|
and.push(clientFilter.where);
|
||||||
(serverFilter && serverFilter.where) && and.push(serverFilter.where);
|
if (serverFilter && serverFilter.where)
|
||||||
|
and.push(serverFilter.where);
|
||||||
var order;
|
|
||||||
var limit;
|
|
||||||
|
|
||||||
if (clientFilter && clientFilter.order)
|
if (clientFilter && clientFilter.order)
|
||||||
order = clientFilter.order;
|
order = clientFilter.order;
|
||||||
|
@ -68,12 +70,14 @@ module.exports = function(Self) {
|
||||||
else if (clientFilter && clientFilter.limit)
|
else if (clientFilter && clientFilter.limit)
|
||||||
limit = clientFilter.limit;
|
limit = clientFilter.limit;
|
||||||
|
|
||||||
var filter = {order: order, limit: limit};
|
|
||||||
filter.where = (and.length > 0) && {and: and};
|
filter.where = (and.length > 0) && {and: and};
|
||||||
filter.fields = fields;
|
filter.fields = fields;
|
||||||
|
|
||||||
this.find(filter, function(err, states) {
|
this.find(filter, function(err, states) {
|
||||||
(err) ? cb(err, null) : cb(null, states);
|
if (err)
|
||||||
|
cb(err, null);
|
||||||
|
else
|
||||||
|
cb(null, states);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -198,8 +202,8 @@ function removeEmpty(o) {
|
||||||
let array = [];
|
let array = [];
|
||||||
for (let item of o) {
|
for (let item of o) {
|
||||||
let i = removeEmpty(item);
|
let i = removeEmpty(item);
|
||||||
if (!isEmpty(item))
|
if (!isEmpty(i))
|
||||||
array.push(item);
|
array.push(i);
|
||||||
}
|
}
|
||||||
if (array.length > 0)
|
if (array.length > 0)
|
||||||
return array;
|
return array;
|
||||||
|
|
|
@ -2,9 +2,6 @@ module.exports = function(Self) {
|
||||||
Self.defineScope();
|
Self.defineScope();
|
||||||
|
|
||||||
Self.list = function(ctx, filter, callback) {
|
Self.list = function(ctx, filter, callback) {
|
||||||
var page = filter.page - 1;
|
|
||||||
var limit = filter.limit * page;
|
|
||||||
var offset = (page + 1) * filter.limit;
|
|
||||||
let daysTickets = 0;
|
let daysTickets = 0;
|
||||||
let warehouseFk = filter.where.warehouseFk;
|
let warehouseFk = filter.where.warehouseFk;
|
||||||
delete filter.limit;
|
delete filter.limit;
|
||||||
|
@ -80,7 +77,7 @@ module.exports = function(Self) {
|
||||||
}, this);
|
}, this);
|
||||||
obj.m3 = obj.m3.toFixed(2);
|
obj.m3 = obj.m3.toFixed(2);
|
||||||
obj.total = tickets.length;
|
obj.total = tickets.length;
|
||||||
obj.tickets = tickets.slice(limit, offset);
|
obj.tickets = tickets;
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue