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.smartTableOptions = {
|
|
|
|
activeButtons: {
|
|
|
|
search: true,
|
|
|
|
shownColumns: true,
|
|
|
|
},
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
field: 'category',
|
|
|
|
autocomplete: {
|
|
|
|
url: 'ItemCategories',
|
2021-11-08 16:46:40 +00:00
|
|
|
valueField: 'name',
|
2021-11-08 13:46:23 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'origin',
|
|
|
|
autocomplete: {
|
|
|
|
url: 'Origins',
|
2021-11-09 10:47:54 +00:00
|
|
|
showField: 'code',
|
2021-11-08 16:46:40 +00:00
|
|
|
valueField: 'code'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'typeFk',
|
|
|
|
autocomplete: {
|
|
|
|
url: 'ItemTypes',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'intrastat',
|
|
|
|
autocomplete: {
|
|
|
|
url: 'Intrastats',
|
|
|
|
showField: 'description',
|
|
|
|
valueField: 'description'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'buyerFk',
|
|
|
|
autocomplete: {
|
2023-06-30 10:03:26 +00:00
|
|
|
url: 'TicketRequests/getItemTypeWorker',
|
2021-11-08 16:46:40 +00:00
|
|
|
searchFunction: '{firstName: $search}',
|
|
|
|
showField: 'nickname',
|
|
|
|
valueField: 'id',
|
2021-11-08 13:46:23 +00:00
|
|
|
}
|
|
|
|
},
|
2021-11-09 10:47:54 +00:00
|
|
|
{
|
|
|
|
field: 'active',
|
|
|
|
searchable: false
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'landed',
|
|
|
|
searchable: false
|
|
|
|
},
|
2021-11-08 13:46:23 +00:00
|
|
|
]
|
2019-02-13 08:27:11 +00:00
|
|
|
};
|
2019-02-28 12:50:39 +00:00
|
|
|
}
|
|
|
|
|
2021-02-22 15:43:40 +00:00
|
|
|
exprBuilder(param, value) {
|
|
|
|
switch (param) {
|
|
|
|
case 'category':
|
|
|
|
return {'ic.name': value};
|
2021-11-08 16:46:40 +00:00
|
|
|
case 'buyerFk':
|
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};
|
2021-11-09 10:47:54 +00:00
|
|
|
case 'name':
|
|
|
|
return {'i.name': {like: `%${value}%`}};
|
2022-02-03 09:32:59 +00:00
|
|
|
case 'producer':
|
|
|
|
return {'pr.name': {like: `%${value}%`}};
|
2021-02-22 15:43:40 +00:00
|
|
|
case 'id':
|
|
|
|
case 'size':
|
|
|
|
case 'subname':
|
|
|
|
case 'isActive':
|
2022-08-24 12:13:26 +00:00
|
|
|
case 'weightByPiece':
|
2021-02-22 15:43:40 +00:00
|
|
|
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 => {
|
2018-06-07 21:47:19 +00:00
|
|
|
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
|
|
|
}
|
2018-06-07 21:47:19 +00:00
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
preview(item) {
|
2018-02-22 07:18:57 +00:00
|
|
|
this.itemSelected = item;
|
2018-06-07 21:47:19 +00:00
|
|
|
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
|
|
|
|
2020-07-24 12:22:30 +00:00
|
|
|
ngModule.vnComponent('vnItemIndex', {
|
2018-05-25 08:03:45 +00:00
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller
|
2017-12-19 10:05:07 +00:00
|
|
|
});
|