salix/modules/item/front/index/index.js

80 lines
2.0 KiB
JavaScript
Raw Normal View History

2017-12-19 10:05:07 +00:00
import ngModule from '../module';
2020-03-17 13:43:46 +00:00
import Section from 'salix/components/section';
2018-02-22 07:18:57 +00:00
import './style.scss';
2017-12-19 10:05:07 +00:00
2020-03-17 13:43:46 +00:00
class Controller extends Section {
constructor($element, $) {
super($element, $);
2021-11-08 13:46:23 +00:00
/* this.showFields = {
2019-02-13 08:27:11 +00:00
id: false,
actions: false
2021-11-08 13:46:23 +00:00
}; */
this.smartTableOptions = {
activeButtons: {
search: true,
shownColumns: true,
},
columns: [
{
field: 'category',
autocomplete: {
url: 'ItemCategories',
}
},
{
field: 'origin',
autocomplete: {
url: 'Origins',
}
},
]
2019-02-13 08:27:11 +00:00
};
}
2021-02-22 15:43:40 +00:00
exprBuilder(param, value) {
switch (param) {
case 'category':
return {'ic.name': value};
case 'salesPersonFk':
2021-02-24 13:49:58 +00:00
return {'it.workerFk': value};
2021-02-22 15:43:40 +00:00
case 'grouping':
return {'b.grouping': value};
case 'packing':
return {'b.packing': value};
case 'origin':
return {'ori.code': value};
2021-02-24 13:49:58 +00:00
case 'typeFk':
2021-02-22 15:43:40 +00:00
return {'i.typeFk': value};
case 'intrastat':
return {'intr.description': value};
case 'id':
case 'size':
case 'name':
case 'subname':
case 'isActive':
case 'density':
case 'stemMultiplier':
case 'stems':
return {[`i.${param}`]: value};
}
}
2020-04-25 09:50:04 +00:00
onCloneAccept(itemFk) {
return this.$http.post(`Items/${itemFk}/clone`)
.then(res => {
this.$state.go('item.card.tags', {id: res.data.id});
2020-04-25 09:50:04 +00:00
});
2018-02-22 12:40:23 +00:00
}
2020-04-25 09:50:04 +00:00
preview(item) {
2018-02-22 07:18:57 +00:00
this.itemSelected = item;
this.$.preview.show();
2018-02-22 07:18:57 +00:00
}
2017-12-19 10:05:07 +00:00
}
2020-03-17 13:43:46 +00:00
ngModule.vnComponent('vnItemIndex', {
template: require('./index.html'),
controller: Controller
2017-12-19 10:05:07 +00:00
});