83 lines
2.1 KiB
JavaScript
83 lines
2.1 KiB
JavaScript
import ngModule from '../module';
|
|
import Section from 'salix/components/section';
|
|
|
|
class Controller extends Section {
|
|
constructor($element, $) {
|
|
super($element, $);
|
|
|
|
this.smartTableOptions = {
|
|
activeButtons: {
|
|
search: true
|
|
},
|
|
columns: [
|
|
{
|
|
field: 'clientName',
|
|
autocomplete: {
|
|
url: 'Clients',
|
|
showField: 'name',
|
|
valueField: 'name'
|
|
}
|
|
},
|
|
{
|
|
field: 'workerFk',
|
|
autocomplete: {
|
|
url: 'Workers/activeWithInheritedRole',
|
|
where: `{role: 'salesPerson'}`,
|
|
searchFunction: '{firstName: $search}',
|
|
showField: 'name',
|
|
valueField: 'id',
|
|
}
|
|
},
|
|
{
|
|
field: 'claimStateFk',
|
|
autocomplete: {
|
|
url: 'ClaimStates',
|
|
showField: 'description',
|
|
valueField: 'id',
|
|
}
|
|
},
|
|
{
|
|
field: 'created',
|
|
searchable: false
|
|
}
|
|
]
|
|
};
|
|
}
|
|
|
|
exprBuilder(param, value) {
|
|
switch (param) {
|
|
case 'clientName':
|
|
return {'cl.clientName': {like: `%${value}%`}};
|
|
case 'clientFk':
|
|
case 'claimStateFk':
|
|
case 'workerFk':
|
|
return {[`cl.${param}`]: value};
|
|
}
|
|
}
|
|
|
|
stateColor(code) {
|
|
switch (code) {
|
|
case 'pending':
|
|
return 'warning';
|
|
case 'managed':
|
|
return 'notice';
|
|
case 'resolved':
|
|
return 'success';
|
|
}
|
|
}
|
|
|
|
preview(claim) {
|
|
this.claimSelected = claim;
|
|
this.$.summary.show();
|
|
}
|
|
|
|
reload() {
|
|
this.$.model.refresh();
|
|
}
|
|
}
|
|
|
|
ngModule.vnComponent('vnClaimIndex', {
|
|
template: require('./index.html'),
|
|
controller: Controller
|
|
});
|