filtro de items

This commit is contained in:
Daniel Herrero 2017-12-20 12:20:59 +01:00
parent dc03c5f453
commit 75c77fcdc6
7 changed files with 87 additions and 6 deletions

View File

@ -0,0 +1,58 @@
<div pad-large style="min-width: 30em">
<form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<vn-textfield vn-one label="Id" model="$ctrl.filter.id" vn-focus></vn-textfield>
<vn-textfield vn-three label="Description" model="$ctrl.filter.description"></vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-one label="Category" type="number" model="$ctrl.filter.category"></vn-textfield>
<vn-textfield vn-one label="Size" type="number" model="$ctrl.filter.itemSize"></vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete vn-one
url="/item/api/ItemTypes"
label="Type"
show-field="name"
value-field="id"
field="$ctrl.filter.typeFk"
>
</vn-autocomplete>
<vn-autocomplete vn-one
url="/item/api/Inks"
label="Ink"
show-field="name"
value-field="id"
field="$ctrl.filter.inkFk"
>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete vn-one
url="/item/api/Origins"
label="Origin"
show-field="name"
value-field="id"
field="$ctrl.filter.originFk"
>
</vn-autocomplete>
<vn-autocomplete vn-one
url="/item/api/Producers"
label="Producer"
show-field="name"
value-field="id"
field="$ctrl.filter.producerFk"
>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal margin-large-top>
<vn-submit label="Search"></vn-submit>
</vn-horizontal>
</form>
</div>

View File

@ -0,0 +1,16 @@
import ngModule from '../module';
class ItemFilterPanel {
constructor() {
this.onSubmit = () => {};
}
onSearch() {
this.onSubmit(this.filter);
}
}
ngModule.component('vnItemFilterPanel', {
template: require('./filter-panel.html'),
controller: ItemFilterPanel
});

View File

@ -0,0 +1,5 @@
{
"Ink": "Tinta",
"Origin": "Origen",
"Producer": "Productor"
}

View File

@ -1,3 +1,4 @@
export * from './module';
import './list/list';
import './filter-panel/filter-panel';

View File

@ -7,7 +7,7 @@
index="index"
on-search="$ctrl.search(index)"
advanced="true"
popover="vn-item-search-panel"
popover="vn-item-filter-panel"
ignore-keys = "['page', 'size', 'search']"
>
</vn-searchbar>

View File

@ -15,6 +15,12 @@ module.exports = Self => {
}
};
delete params.page;
delete params.size;
delete params.order;
Object.assign(filter.where, params);
return filter;
}
};

View File

@ -16,11 +16,6 @@
"name": {
"type": "String"
},
"picture": {
"mysql": {
"dataType": "blob"
}
},
"showOrder": {
"type": "number"
}