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

59 lines
1.4 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, $);
2019-02-13 08:27:11 +00:00
this.showFields = {
id: false,
actions: false
};
}
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
});