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

46 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

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() {
return this.entity;
2018-10-03 06:00:19 +00:00
}
set claim(value) {
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
});
2019-01-25 14:08:11 +00:00
}
2019-09-06 09:06:44 +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`, {
recipient: this.claim.client.email,
2022-09-22 07:17:14 +00:00
recipientId: this.claim.clientFk
});
2019-09-06 09:06:44 +00:00
}
deleteClaim() {
return this.$http.delete(`Claims/${this.claim.id}`)
.then(() => {
this.vnApp.showSuccess(this.$t('Claim deleted!'));
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: {
claim: '<'
2018-08-24 11:16:11 +00:00
}
});