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() {
|
2022-09-22 07:17:14 +00:00
|
|
|
this.vnReport.show(`Claims/${this.claim.id}/claim-pickup-pdf`, {
|
|
|
|
recipientId: this.claim.clientFk
|
2020-04-30 10:48:52 +00:00
|
|
|
});
|
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() {
|
2023-03-27 08:00:00 +00:00
|
|
|
if (!this.claim.client.email) {
|
2023-04-20 09:33:28 +00:00
|
|
|
this.vnApp.showError(this.$t('The client does not have an email'));
|
2023-03-27 08:00:00 +00:00
|
|
|
return;
|
|
|
|
}
|
2022-09-22 07:17:14 +00:00
|
|
|
return this.vnEmail.send(`Claims/${this.claim.id}/claim-pickup-email`, {
|
2020-04-30 10:48:52 +00:00
|
|
|
recipient: this.claim.client.email,
|
2022-09-22 07:17:14 +00:00
|
|
|
recipientId: this.claim.clientFk
|
2020-04-30 10:48:52 +00:00
|
|
|
});
|
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}`)
|
2024-07-19 10:58:34 +00:00
|
|
|
.then(async() => {
|
2020-04-30 10:48:52 +00:00
|
|
|
this.vnApp.showSuccess(this.$t('Claim deleted!'));
|
2024-07-19 10:58:34 +00:00
|
|
|
window.location.href = await this.vnApp.getUrl(`claim/`);
|
2019-06-14 07:29:23 +00:00
|
|
|
});
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
});
|