2018-08-07 09:57:11 +00:00
|
|
|
import ngModule from '../module';
|
2020-03-16 10:58:14 +00:00
|
|
|
import Section from 'salix/components/section';
|
2018-08-07 09:57:11 +00:00
|
|
|
|
2022-02-28 06:57:46 +00:00
|
|
|
class Controller extends Section {
|
|
|
|
constructor($element, $) {
|
|
|
|
super($element, $);
|
|
|
|
|
|
|
|
this.smartTableOptions = {
|
|
|
|
activeButtons: {
|
|
|
|
search: true
|
|
|
|
},
|
|
|
|
columns: [
|
|
|
|
{
|
2022-04-08 06:52:21 +00:00
|
|
|
field: 'clientName',
|
2022-02-28 06:57:46 +00:00
|
|
|
autocomplete: {
|
|
|
|
url: 'Clients',
|
2022-04-08 06:52:21 +00:00
|
|
|
showField: 'name',
|
|
|
|
valueField: 'name'
|
2022-02-28 06:57:46 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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) {
|
2022-04-08 06:52:21 +00:00
|
|
|
case 'clientName':
|
|
|
|
return {'cl.clientName': {like: `%${value}%`}};
|
2022-02-28 06:57:46 +00:00
|
|
|
case 'clientFk':
|
|
|
|
case 'claimStateFk':
|
2022-04-08 06:52:21 +00:00
|
|
|
case 'workerFk':
|
2022-02-28 06:57:46 +00:00
|
|
|
return {[`cl.${param}`]: value};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-24 13:32:56 +00:00
|
|
|
stateColor(code) {
|
|
|
|
switch (code) {
|
|
|
|
case 'pending':
|
2019-02-10 21:52:35 +00:00
|
|
|
return 'warning';
|
2023-02-24 13:32:56 +00:00
|
|
|
case 'managed':
|
2019-02-10 21:52:35 +00:00
|
|
|
return 'notice';
|
2023-02-24 13:32:56 +00:00
|
|
|
case 'resolved':
|
2019-02-10 21:52:35 +00:00
|
|
|
return 'success';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
preview(claim) {
|
2018-09-05 11:47:15 +00:00
|
|
|
this.claimSelected = claim;
|
2020-04-25 09:50:04 +00:00
|
|
|
this.$.summary.show();
|
2018-08-31 12:35:20 +00:00
|
|
|
}
|
2022-02-28 11:40:44 +00:00
|
|
|
|
|
|
|
reload() {
|
|
|
|
this.$.model.refresh();
|
|
|
|
}
|
2018-08-07 09:57:11 +00:00
|
|
|
}
|
|
|
|
|
2020-07-24 12:22:30 +00:00
|
|
|
ngModule.vnComponent('vnClaimIndex', {
|
2018-08-07 09:57:11 +00:00
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller
|
|
|
|
});
|