This commit is contained in:
parent
3c77f24462
commit
720803facb
|
@ -7,7 +7,7 @@ describe('Item Create botanical path', () => {
|
|||
beforeAll(() => {
|
||||
nightmare
|
||||
.loginAndModule('buyer', 'item')
|
||||
.accessToSearchResult('Object5 Weapon 50')
|
||||
.accessToSearchResult('Object5 Weapon 50 hasVisible:false')
|
||||
.accessToSection('item.card.botanical');
|
||||
});
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ describe('Item Create/Clone path', () => {
|
|||
|
||||
it(`should search for the item Infinity Gauntlet`, async() => {
|
||||
const result = await nightmare
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet hasVisible:false')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
||||
.countElement(selectors.itemsIndex.searchResult);
|
||||
|
@ -117,7 +117,7 @@ describe('Item Create/Clone path', () => {
|
|||
it('should search for the item Infinity Gauntlet and find two', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.itemTags.goToItemIndexButton)
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet')
|
||||
.write(selectors.itemsIndex.searchItemInput, 'Infinity Gauntlet hasVisible:false')
|
||||
.waitToClick(selectors.itemsIndex.searchButton)
|
||||
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2)
|
||||
.countElement(selectors.itemsIndex.searchResult);
|
||||
|
|
|
@ -13,9 +13,6 @@ class Controller {
|
|||
id: false,
|
||||
actions: false
|
||||
};
|
||||
|
||||
if (!$stateParams.q)
|
||||
this.filter = {hasVisible: true, isActive: true};
|
||||
}
|
||||
|
||||
stopEvent(event) {
|
||||
|
@ -24,6 +21,9 @@ class Controller {
|
|||
}
|
||||
|
||||
onSearch(params) {
|
||||
if (params && params.hasVisible === undefined && params.isActive === undefined)
|
||||
Object.assign(params, {hasVisible: true, isActive: true});
|
||||
|
||||
if (params)
|
||||
this.$.model.applyFilter(null, params);
|
||||
else
|
||||
|
|
|
@ -9,18 +9,6 @@
|
|||
vn-focus>
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Id"
|
||||
model="filter.id">
|
||||
</vn-textfield>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Name"
|
||||
model="filter.name">
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
|
@ -41,11 +29,6 @@
|
|||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Description"
|
||||
model="filter.description">
|
||||
</vn-textfield>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
disabled="false"
|
||||
|
@ -113,6 +96,47 @@
|
|||
ng-click="filter.tags.push({})">
|
||||
</vn-icon-button>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal margin-medium-v>
|
||||
<span
|
||||
ng-click="$ctrl.initializeMoreFields()"
|
||||
vn-one translate
|
||||
class="unselectable"
|
||||
tabindex="-1"
|
||||
ng-class="{link: !filter.moreFields || !filter.moreFields.length}">
|
||||
More fields
|
||||
</span>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal ng-repeat="field in filter.moreFields">
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
field="field.field"
|
||||
data="$ctrl.moreFields"
|
||||
value-field="field"
|
||||
show-field="field"
|
||||
label="Field"
|
||||
on-change="field.value = null">
|
||||
</vn-autocomplete>
|
||||
<vn-textfield
|
||||
vn-two
|
||||
label="Value"
|
||||
model="field.value">
|
||||
</vn-textfield>
|
||||
<vn-icon-button
|
||||
vn-none
|
||||
vn-tooltip="Remove field"
|
||||
icon="delete"
|
||||
ng-click="filter.moreFields.splice($index, 1)"
|
||||
tabindex="-1">
|
||||
</vn-icon-button>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal ng-show="filter.moreFields && filter.moreFields.length">
|
||||
<vn-icon-button
|
||||
vn-bind="+"
|
||||
vn-tooltip="Add field"
|
||||
icon="add_circle"
|
||||
ng-click="filter.moreFields.push({})">
|
||||
</vn-icon-button>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal margin-large-top>
|
||||
<vn-submit label="Search"></vn-submit>
|
||||
</vn-horizontal>
|
||||
|
|
|
@ -2,6 +2,21 @@ import ngModule from '../module';
|
|||
import SearchPanel from 'core/components/searchbar/search-panel';
|
||||
|
||||
class Controller extends SearchPanel {
|
||||
constructor($scope) {
|
||||
super();
|
||||
this.$ = $scope;
|
||||
this.moreFields = [
|
||||
{field: 'id'},
|
||||
{field: 'description'},
|
||||
{field: 'name'}
|
||||
];
|
||||
}
|
||||
|
||||
initializeMoreFields() {
|
||||
if (!this.$.filter.moreFields || !this.$.filter.moreFields.length)
|
||||
this.$.filter.moreFields = [{}];
|
||||
}
|
||||
|
||||
set filter(value) {
|
||||
if (!value)
|
||||
value = {};
|
||||
|
@ -20,7 +35,14 @@ class Controller extends SearchPanel {
|
|||
}
|
||||
|
||||
get filter() {
|
||||
return this.$.filter;
|
||||
if (this.$.filter.moreFields) {
|
||||
this.$.filter.moreFields.forEach(element => {
|
||||
this.$.filter[element.field] = element.value;
|
||||
});
|
||||
}
|
||||
let filter = Object.assign({}, this.$.filter);
|
||||
delete filter.moreFields;
|
||||
return filter;
|
||||
}
|
||||
|
||||
getSourceTable(selection) {
|
||||
|
@ -36,6 +58,8 @@ class Controller extends SearchPanel {
|
|||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$scope'];
|
||||
|
||||
ngModule.component('vnItemSearchPanel', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
Ink: Tinta
|
||||
Origin: Origen
|
||||
Producer: Productor
|
||||
Producer: Productor.
|
||||
With visible: Con visible
|
||||
Field: Campo
|
||||
More fields: Mas campos
|
||||
Add field: Añadir campo
|
||||
Remove field: Quitar campo
|
Loading…
Reference in New Issue