122 lines
3.3 KiB
JavaScript
122 lines
3.3 KiB
JavaScript
import ngModule from '../module';
|
|
import Section from 'salix/components/section';
|
|
import './style.scss';
|
|
|
|
class Controller extends Section {
|
|
constructor($element, $) {
|
|
super($element, $);
|
|
|
|
this.smartTableOptions = {
|
|
activeButtons: {
|
|
search: false,
|
|
shownColumns: false,
|
|
},
|
|
columns: [
|
|
{
|
|
field: 'agencyFk',
|
|
autocomplete: {
|
|
url: 'ItemCategories',
|
|
valueField: 'name',
|
|
}
|
|
},
|
|
{
|
|
field: 'origin',
|
|
autocomplete: {
|
|
url: 'Origins',
|
|
showField: 'code',
|
|
valueField: 'code'
|
|
}
|
|
},
|
|
{
|
|
field: 'typeFk',
|
|
autocomplete: {
|
|
url: 'ItemTypes',
|
|
}
|
|
},
|
|
{
|
|
field: 'intrastat',
|
|
autocomplete: {
|
|
url: 'Intrastats',
|
|
showField: 'description',
|
|
valueField: 'description'
|
|
}
|
|
},
|
|
{
|
|
field: 'buyerFk',
|
|
autocomplete: {
|
|
url: 'Workers/activeWithRole',
|
|
where: `{role: {inq: ['logistic', 'buyer']}}`,
|
|
searchFunction: '{firstName: $search}',
|
|
showField: 'nickname',
|
|
valueField: 'id',
|
|
}
|
|
},
|
|
{
|
|
field: 'active',
|
|
searchable: false
|
|
},
|
|
{
|
|
field: 'landed',
|
|
searchable: false
|
|
},
|
|
]
|
|
};
|
|
}
|
|
|
|
exprBuilder(param, value) {
|
|
switch (param) {
|
|
case 'category':
|
|
return {'ic.name': value};
|
|
case 'buyerFk':
|
|
return {'it.workerFk': value};
|
|
case 'grouping':
|
|
return {'b.grouping': value};
|
|
case 'packing':
|
|
return {'b.packing': value};
|
|
case 'origin':
|
|
return {'ori.code': value};
|
|
case 'typeFk':
|
|
return {'i.typeFk': value};
|
|
case 'intrastat':
|
|
return {'intr.description': value};
|
|
case 'name':
|
|
return {'i.name': {like: `%${value}%`}};
|
|
case 'producer':
|
|
return {'pr.name': {like: `%${value}%`}};
|
|
case 'id':
|
|
case 'size':
|
|
case 'subname':
|
|
case 'isActive':
|
|
case 'density':
|
|
case 'stemMultiplier':
|
|
case 'stems':
|
|
return {[`i.${param}`]: value};
|
|
}
|
|
}
|
|
|
|
get checked() {
|
|
const routes = this.$.model.data || [];
|
|
const checkedRoutes = [];
|
|
for (let route of routes) {
|
|
if (route.checked)
|
|
checkedRoutes.push(route);
|
|
}
|
|
|
|
return checkedRoutes;
|
|
}
|
|
|
|
get totalChecked() {
|
|
return this.checked.length;
|
|
}
|
|
|
|
preview(route) {
|
|
this.routeSelected = route;
|
|
this.$.summary.show();
|
|
}
|
|
}
|
|
|
|
ngModule.vnComponent('vnAgencyTerm', {
|
|
template: require('./index.html'),
|
|
controller: Controller
|
|
});
|