fixed tags sourceTable selection #764, ticket packaging fix

This commit is contained in:
Joan 2018-11-07 13:32:09 +01:00
parent ae4203ed36
commit 0e1ae9b46b
6 changed files with 16 additions and 16 deletions

View File

@ -168,12 +168,12 @@ export default class Autocomplete extends Input {
}
onSelectionRequest(data) {
if (data && data.length > 0)
if (data && data.length > 0) {
if (this.multiple)
this.selection = data;
else
this.selection = data[0];
else
} else
this.selection = null;
}
@ -181,7 +181,7 @@ export default class Autocomplete extends Input {
let display = '';
let hasTemplate = this.$transclude && this.$transclude.isSlotFilled('tplItem');
if (this._selection && this.showField)
if (this._selection && this.showField) {
if (this.multiple && Array.isArray(this._selection)) {
for (let item of this._selection) {
if (display.length > 0) display += ', ';
@ -194,12 +194,14 @@ export default class Autocomplete extends Input {
display = this.$interpolate(template)(this._selection);
}
}
}
this.input.value = display;
if (this.translateFields)
if (this.translateFields) {
if (this.translateFields.indexOf(this.showField) > -1)
this.input.value = this.$translate.instant(display);
}
this.mdlUpdate();
}

View File

@ -45,7 +45,7 @@
ng-show="tag.selection.isFree === false"
vn-three
url="{{$ctrl.getSourceTable(tag.selection)}}"
where="{name: {like: 'search%'}}"
search-function="{name: {regexp: $search}}"
label="Value"
field="itemTag.value"
show-field="name"

View File

@ -7,7 +7,7 @@ class Controller {
this.include = {
relation: 'tag',
scope: {
fields: ['id', 'name', 'isFree']
fields: ['id', 'name', 'isFree', 'sourceTable']
}
};
}
@ -31,13 +31,11 @@ class Controller {
getSourceTable(selection) {
if (!selection || selection.isFree === true)
return null;
if (selection.sourceTable) {
return '/api/' + selection.sourceTable.charAt(0).toUpperCase() +
selection.sourceTable.substring(1) + 's';
} else if (selection.sourceTable == null) {
} else if (selection.sourceTable == null)
return `/api/ItemTags/filterItemTags/${selection.id}`;
}
}
onSubmit() {

View File

@ -113,7 +113,7 @@ describe('Client Edit pay method path', () => {
it('should confirm Received LCR checkbox is checked', async () => {
const checkedBox = await nightmare
.evaluate((selector) => {
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientPayMethod.receivedCoreLCRCheckbox);
@ -122,7 +122,7 @@ describe('Client Edit pay method path', () => {
it('should confirm Received core VNL checkbox is unchecked', async () => {
const checkedBox = await nightmare
.evaluate((selector) => {
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientPayMethod.receivedCoreVNLCheckbox);
@ -131,7 +131,7 @@ describe('Client Edit pay method path', () => {
it('should confirm Received B2B VNL checkbox is unchecked', async () => {
const checkedBox = await nightmare
.evaluate((selector) => {
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientPayMethod.receivedB2BVNLCheckbox);

View File

@ -1,8 +1,7 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
// e2e path excluded ultil #764 is completed
xdescribe('Ticket Create packages path', () => {
describe('Ticket Create packages path', () => {
const nightmare = createNightmare();
beforeAll(() => {

View File

@ -23,6 +23,7 @@ module.exports = Self => {
});
Self.listPackaging = async filter => {
let conn = Self.dataSource.connector;
let stmt = new ParameterizedSQL(
`SELECT name, itemFk, packagingFk
FROM (SELECT i.name, i.id itemFk, p.id packagingFk
@ -30,7 +31,7 @@ module.exports = Self => {
JOIN packaging p ON i.id = p.itemFk) p`
);
stmt.merge(Self.buildSuffix(filter));
return Self.rawStmt(stmt);
stmt.merge(conn.makeSuffix(filter));
return conn.executeStmt(stmt);
};
};