2018-08-24 11:16:11 +00:00
|
|
|
import ngModule from '../module';
|
2020-04-25 09:50:04 +00:00
|
|
|
import Descriptor from 'salix/components/descriptor';
|
2018-08-24 11:16:11 +00:00
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
class Controller extends Descriptor {
|
2018-10-03 06:00:19 +00:00
|
|
|
get claim() {
|
2020-04-30 10:48:52 +00:00
|
|
|
return this.entity;
|
2018-10-03 06:00:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set claim(value) {
|
2020-04-30 10:48:52 +00:00
|
|
|
this.entity = value;
|
2018-08-24 11:16:11 +00:00
|
|
|
}
|
|
|
|
|
2019-02-12 06:42:19 +00:00
|
|
|
showPickupOrder() {
|
2020-06-12 12:28:29 +00:00
|
|
|
this.vnReport.show('claim-pickup-order', {
|
2020-05-22 13:20:55 +00:00
|
|
|
recipientId: this.claim.clientFk,
|
2020-04-30 10:48:52 +00:00
|
|
|
claimId: this.claim.id
|
|
|
|
});
|
2019-01-25 14:08:11 +00:00
|
|
|
}
|
2019-09-06 09:06:44 +00:00
|
|
|
|
2020-04-30 10:48:52 +00:00
|
|
|
sendPickupOrder() {
|
2020-06-12 12:28:29 +00:00
|
|
|
return this.vnEmail.send('claim-pickup-order', {
|
2020-04-30 10:48:52 +00:00
|
|
|
recipient: this.claim.client.email,
|
2020-05-22 13:20:55 +00:00
|
|
|
recipientId: this.claim.clientFk,
|
2020-04-30 10:48:52 +00:00
|
|
|
claimId: this.claim.id
|
|
|
|
});
|
2019-09-06 09:06:44 +00:00
|
|
|
}
|
|
|
|
|
2020-04-30 10:48:52 +00:00
|
|
|
deleteClaim() {
|
|
|
|
return this.$http.delete(`Claims/${this.claim.id}`)
|
|
|
|
.then(() => {
|
|
|
|
this.vnApp.showSuccess(this.$t('Claim deleted!'));
|
2019-06-14 07:29:23 +00:00
|
|
|
this.$state.go('claim.index');
|
|
|
|
});
|
|
|
|
}
|
2018-08-24 11:16:11 +00:00
|
|
|
}
|
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
ngModule.vnComponent('vnClaimDescriptor', {
|
2018-08-24 11:16:11 +00:00
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
bindings: {
|
2020-04-30 10:48:52 +00:00
|
|
|
claim: '<'
|
2018-08-24 11:16:11 +00:00
|
|
|
}
|
|
|
|
});
|