Fixed conflicts
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Joan Sanchez 2020-03-25 13:44:51 +01:00
parent 5b5d7787ee
commit c8b6c3f7f3
5 changed files with 50 additions and 54 deletions

View File

@ -81,7 +81,7 @@ describe('Order edit basic data path', () => {
await page.waitToClick(selectors.orderBasicData.saveButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
expect(result).toContain('Data saved!');
});
it('should now confirm the client have been edited', async() => {

View File

@ -69,8 +69,9 @@ describe('Order catalog', () => {
});
it('should search for an item by id', async() => {
await page.write(selectors.orderCatalog.itemId, '2');
await page.keyboard.press('Enter');
// await page.write(selectors.orderCatalog.itemId, '2');
await page.accessToSearchResult('2');
// await page.keyboard.press('Enter');
await page.waitForNumberOfElements('section.product', 1);
const result = await page.countElement('section.product');

View File

@ -12,11 +12,12 @@
data="$ctrl.items">
</vn-crud-model>
<vn-portal slot="topbar">
<vn-searchbar info="Search by item id or name"></vn-searchbar>
<vn-searchbar
auto-state="false"
info="Search by item id or name"
on-search="$ctrl.onSearch($params)">
</vn-searchbar>
</vn-portal>
<vn-auto-search
on-search="$ctrl.onSearch($params)">
</vn-auto-search>
<vn-order-catalog-view model="model"
order="$ctrl.order">
@ -83,14 +84,6 @@
</div>
</vn-vertical>
<vn-vertical class="input vn-pt-md">
<!-- <vn-textfield vn-id="itemId"
ng-keyUp="$ctrl.onSearchById($event)"
label="Item id">
<prepend>
<vn-icon icon="icon-item"></vn-icon>
</prepend>
</vn-textfield> -->
<vn-datalist vn-one
vn-id="search"
data="$ctrl.tagValues"
@ -123,10 +116,19 @@
ng-if="$ctrl.itemId"
removable="true"
translate-attr="{title: 'Item'}"
on-remove="$ctrl.itemId = null"
on-remove="$ctrl.removeItemId()"
class="colored">
<span>Id: {{$ctrl.itemId}}</span>
</vn-chip>
<vn-chip
ng-if="$ctrl.itemName"
removable="true"
translate-attr="{title: 'Item'}"
on-remove="$ctrl.removeItemName()"
class="colored">
<span translate>Name</span>
<span>: {{$ctrl.itemName}}</span>
</vn-chip>
<vn-chip
ng-if="category.selection"
removable="true"

View File

@ -109,28 +109,6 @@ class Controller extends Section {
this.applyFilters();
}
get itemId() {
return this._itemId;
}
set itemId(value) {
this._itemId = value;
this.updateStateParams();
this.applyFilters();
}
get itemName() {
return this._itemName;
}
set itemName(value) {
this._itemName = value;
this.updateStateParams();
this.applyFilters();
}
get tags() {
return this._tags;
}
@ -239,9 +217,19 @@ class Controller extends Section {
this.applyFilters();
}
applyFilters() {
removeItemId() {
this.itemId = null;
this.applyFilters();
}
removeItemName() {
this.itemName = null;
this.applyFilters();
}
applyFilters(filter = {}) {
let newParams = {};
let newFilter = {};
let newFilter = Object.assign({}, filter);
const model = this.$.model;
if (this.categoryId)
@ -250,11 +238,11 @@ class Controller extends Section {
if (this.typeId)
newFilter.typeFk = this.typeId;
if (this.itemId)
/* if (this.itemId)
newFilter = {'i.id': this.itemId};
if (this.itemName)
newFilter = {'i.name': {like: `%${this.itemName}%`}};
newFilter = {'i.name': {like: `%${this.itemName}%`}}; */
newParams = {
orderFk: this.$params.id,
@ -262,7 +250,9 @@ class Controller extends Section {
tags: this.tags,
};
model.applyFilter({where: newFilter}, newParams);
console.log(newFilter);
return model.applyFilter({where: newFilter}, newParams);
}
openPanel(event) {
@ -294,14 +284,6 @@ class Controller extends Section {
if (this.typeId)
params.typeId = this.typeId;
params.itemId = undefined;
if (this.itemId)
params.itemId = this.itemId;
params.itemName = undefined;
if (this.itemName)
params.itemName = this.itemName;
params.tags = undefined;
if (this.tags.length) {
const tags = [];
@ -362,15 +344,24 @@ class Controller extends Section {
}
onSearch(params) {
if (!params) return;
this.itemId = null;
this.itemName = null;
if (params.search) {
if (/^\d+$/.test(params.search)) {
this.itemId = params.search;
this.itemName = null;
return this.applyFilters({
'i.id': params.search
});
} else {
this.itemId = null;
this.itemName = params.search;
return this.applyFilters({
'i.name': {like: `%${params.search}%`}
});
}
}
} else return this.applyFilters();
}
}

View File

@ -0,0 +1,2 @@
Name: Nombre
Search by item id or name: Buscar por id de artículo o nombre