salix/modules/claim/front/index/index.js

88 lines
2.4 KiB
JavaScript
Raw Normal View History

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
class Controller extends Section {
constructor($element, $) {
super($element, $);
this.smartTableOptions = {
activeButtons: {
search: true
},
columns: [
{
field: 'clientFk',
autocomplete: {
url: 'Clients',
showField: 'socialName',
valueField: 'socialName'
}
},
{
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 'clientFk':
return {['cl.socialName']: value};
case 'id':
case 'workerFk':
case 'claimStateFk':
case 'priority':
return {[`cl.${param}`]: value};
case 'attenderFk':
return {'cl.workerFk': value};
case 'created':
value.setHours(0, 0, 0, 0);
to = new Date(value);
to.setHours(23, 59, 59, 999);
return {'cl.created': {between: [value, to]}};
}
}
2019-02-10 21:52:35 +00:00
stateColor(claim) {
2019-04-15 09:06:42 +00:00
switch (claim.description) {
2019-02-10 21:52:35 +00:00
case 'Pendiente':
return 'warning';
case 'Gestionado':
return 'notice';
case 'Resuelto':
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
}
2018-08-07 09:57:11 +00:00
}
ngModule.vnComponent('vnClaimIndex', {
2018-08-07 09:57:11 +00:00
template: require('./index.html'),
controller: Controller
});