diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js
index e6250a8a2..3f021c910 100644
--- a/e2e/helpers/extensions.js
+++ b/e2e/helpers/extensions.js
@@ -185,7 +185,7 @@ let actions = {
let element = selectorMatches[0];
if (selectorMatches.length > 1)
- throw new Error(`multiple matches of ${elementSelector} found`);
+ throw new Error(`Multiple matches of ${elementSelector} found`);
let isVisible = false;
if (element) {
diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js
index f03e57962..c83db3b33 100644
--- a/e2e/helpers/selectors.js
+++ b/e2e/helpers/selectors.js
@@ -221,7 +221,7 @@ export default {
moreMenuRegularizeButton: '.vn-drop-down.shown li[name="Regularize stock"]',
regularizeQuantityInput: '.vn-dialog.shown tpl-body > div > vn-textfield input',
regularizeWarehouseAutocomplete: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.warehouseFk"]',
- editButton: 'vn-item-card vn-item-descriptor vn-float-button[icon="edit"]',
+ editButton: 'vn-item-descriptor vn-float-button[icon="edit"]',
regularizeSaveButton: '.vn-dialog.shown tpl-buttons > button',
inactiveIcon: 'vn-item-descriptor vn-icon[icon="icon-unavailable"]',
navigateBackToIndex: 'vn-item-descriptor vn-icon[icon="chevron_left"]'
diff --git a/e2e/paths/05-ticket-module/11_diary.spec.js b/e2e/paths/05-ticket-module/11_diary.spec.js
index aeec780e7..c64c0ba7b 100644
--- a/e2e/paths/05-ticket-module/11_diary.spec.js
+++ b/e2e/paths/05-ticket-module/11_diary.spec.js
@@ -1,5 +1,4 @@
import selectors from '../../helpers/selectors.js';
-import config from '../../helpers/config.js';
import createNightmare from '../../helpers/nightmare';
describe('Ticket diary path', () => {
@@ -31,12 +30,9 @@ describe('Ticket diary path', () => {
});
it(`should navigate to the item diary from the 1st sale item id descriptor popover`, async() => {
- const itemId = 2;
const url = await nightmare
.waitToClick(selectors.ticketSummary.firstSaleItemId)
.waitToClick(selectors.ticketSummary.popoverDiaryButton)
- .waitForLogin('employee')
- .goto(`${config.url}#!/item/${itemId}/diary?warehouseFk=1&ticketFk=1`)
.parsedUrl();
expect(url.hash).toContain('/diary');
diff --git a/front/salix/components/index.js b/front/salix/components/index.js
index 5d51c7231..af8380498 100644
--- a/front/salix/components/index.js
+++ b/front/salix/components/index.js
@@ -9,6 +9,7 @@ import './main-menu/main-menu';
import './module-card';
import './module-main';
import './side-menu/side-menu';
+import './section';
import './summary';
import './topbar/topbar';
import './user-popover';
diff --git a/front/salix/components/section/index.js b/front/salix/components/section/index.js
new file mode 100644
index 000000000..a0c7484b4
--- /dev/null
+++ b/front/salix/components/section/index.js
@@ -0,0 +1,14 @@
+import ngModule from '../../module';
+import Component from 'core/lib/component';
+import './style.scss';
+
+export default class Section extends Component {
+ constructor($element, $) {
+ super($element, $);
+ this.element.classList.add('vn-section');
+ }
+}
+
+ngModule.vnComponent('vnSection', {
+ controller: Section
+});
diff --git a/front/salix/components/section/style.scss b/front/salix/components/section/style.scss
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/item/front/diary/index.js b/modules/item/front/diary/index.js
index e128369a2..6d9f80641 100644
--- a/modules/item/front/diary/index.js
+++ b/modules/item/front/diary/index.js
@@ -115,7 +115,7 @@ class Controller {
balance.classList.add('message');
balance.title = this.$translate.instant('Visible quantity');
- let headerOffset = body.querySelector('header').getBoundingClientRect();
+ let headerOffset = body.querySelector('vn-topbar').getBoundingClientRect();
let headerHeight = headerOffset.height;
let offsetTop;
diff --git a/modules/order/back/methods/order/specs/updateBasicData.spec.js b/modules/order/back/methods/order/specs/updateBasicData.spec.js
index 9b92e69ca..5e83d69a0 100644
--- a/modules/order/back/methods/order/specs/updateBasicData.spec.js
+++ b/modules/order/back/methods/order/specs/updateBasicData.spec.js
@@ -5,7 +5,7 @@ describe('Order updateBasicData', () => {
afterAll(async done => {
let validparams = {note: null};
- await app.models.Order.updateBasicData(validparams, orderId);
+ await app.models.Order.updateBasicData(orderId, validparams);
done();
});
@@ -16,7 +16,7 @@ describe('Order updateBasicData', () => {
let params = [];
let orderConfirmed = 1;
- await app.models.Order.updateBasicData(params, orderConfirmed)
+ await app.models.Order.updateBasicData(orderConfirmed, params)
.catch(e => {
error = e;
});
@@ -30,7 +30,7 @@ describe('Order updateBasicData', () => {
let params = [];
let orderWithRows = 16;
- await app.models.Order.updateBasicData(params, orderWithRows)
+ await app.models.Order.updateBasicData(orderWithRows, params)
.catch(e => {
error = e;
});
@@ -38,17 +38,15 @@ describe('Order updateBasicData', () => {
expect(error.toString()).toContain(`You can't make changes on the basic data of an confirmed order or with rows`);
});
- it('should return an error if the current user is administrative and the isTaxDataChecked value is true BUT the params aint valid', async() => {
- let error;
+ it('should skip invalid params', async() => {
+ let success;
let invalidparams = {invalid: 'param for update'};
- await app.models.Order.updateBasicData(invalidparams, orderId)
- .catch(e => {
- error = e;
- });
+ await app.models.Order.updateBasicData(orderId, invalidparams)
+ .then(() => success = true);
- expect(error.toString()).toContain(`You don't have enough privileges to do that`);
+ expect(success).toBeTruthy();
});
it('should update the client fiscal data and return the count if changes made', async() => {
@@ -58,7 +56,7 @@ describe('Order updateBasicData', () => {
expect(order.note).toEqual(null);
- let result = await app.models.Order.updateBasicData(validparams, orderId);
+ let result = await app.models.Order.updateBasicData(orderId, validparams);
expect(result.note).toEqual('test note');
});
diff --git a/modules/order/back/methods/order/updateBasicData.js b/modules/order/back/methods/order/updateBasicData.js
index 6a8148a21..8f4393c04 100644
--- a/modules/order/back/methods/order/updateBasicData.js
+++ b/modules/order/back/methods/order/updateBasicData.js
@@ -1,22 +1,25 @@
let UserError = require('vn-loopback/util/user-error');
+let pick = require('object.pick');
module.exports = Self => {
Self.remoteMethod('updateBasicData', {
description: 'Updates basic data of an order',
accessType: 'WRITE',
- accepts: [{
- arg: 'data',
- type: 'Object',
- required: true,
- description: 'Params to update',
- http: {source: 'body'}
- }, {
- arg: 'id',
- type: 'string',
- required: true,
- description: 'Model id',
- http: {source: 'path'}
- }],
+ accepts: [
+ {
+ arg: 'id',
+ type: 'string',
+ required: true,
+ description: 'Model id',
+ http: {source: 'path'}
+ }, {
+ arg: 'data',
+ type: 'Object',
+ required: true,
+ description: 'Params to update',
+ http: {source: 'body'}
+ }
+ ],
returns: {
arg: 'order',
type: 'Object',
@@ -28,25 +31,25 @@ module.exports = Self => {
}
});
- Self.updateBasicData = async(params, id) => {
- let order = await Self.app.models.Order.findById(id);
- let orderRows = await Self.app.models.OrderRow.find({where: {orderFk: id}});
+ Self.updateBasicData = async(id, params) => {
+ let models = Self.app.models;
+
+ let order = await models.Order.findById(id);
+ let orderRows = await models.OrderRow.find({where: {orderFk: id}});
if (order.isConfirmed || orderRows.length != 0)
throw new UserError(`You can't make changes on the basic data of an confirmed order or with rows`);
- let validUpdateParams = [
+ let updateParams = pick(params, [
'clientFk',
'addressFk',
'landed',
'agencyModeFk',
'note',
- ];
+ ]);
+ if (Object.keys(updateParams).length)
+ await order.updateAttributes(updateParams);
- for (const key in params) {
- if (validUpdateParams.indexOf(key) === -1)
- throw new UserError(`You don't have enough privileges to do that`);
- }
- return await order.updateAttributes(params);
+ return await order;
};
};
diff --git a/modules/order/front/basic-data/index.js b/modules/order/front/basic-data/index.js
index e82d6a591..81aef8304 100644
--- a/modules/order/front/basic-data/index.js
+++ b/modules/order/front/basic-data/index.js
@@ -4,7 +4,7 @@ import './style.scss';
class Controller {
constructor($scope) {
let isDirty = false;
- $scope.$watch('$ctrl.selection', newValue=>{
+ $scope.$watch('$ctrl.selection', newValue => {
if (newValue) {
$scope.addressModel.where = {clientFk: newValue.id};
$scope.addressModel.refresh();
diff --git a/modules/order/front/line/index.html b/modules/order/front/line/index.html
index dddeade46..72d019fe9 100644
--- a/modules/order/front/line/index.html
+++ b/modules/order/front/line/index.html
@@ -1,7 +1,3 @@
-
-