46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
import ngModule from '../module';
|
|
import Descriptor from 'salix/components/descriptor';
|
|
|
|
class Controller extends Descriptor {
|
|
get claim() {
|
|
return this.entity;
|
|
}
|
|
|
|
set claim(value) {
|
|
this.entity = value;
|
|
}
|
|
|
|
showPickupOrder() {
|
|
this.vnReport.show(`Claims/${this.claim.id}/claim-pickup-pdf`, {
|
|
recipientId: this.claim.clientFk
|
|
});
|
|
}
|
|
|
|
sendPickupOrder() {
|
|
if (!this.claim.client.email) {
|
|
this.vnApp.showError(this.$t('The client does not have an email'));
|
|
return;
|
|
}
|
|
return this.vnEmail.send(`Claims/${this.claim.id}/claim-pickup-email`, {
|
|
recipient: this.claim.client.email,
|
|
recipientId: this.claim.clientFk
|
|
});
|
|
}
|
|
|
|
deleteClaim() {
|
|
return this.$http.delete(`Claims/${this.claim.id}`)
|
|
.then(async() => {
|
|
this.vnApp.showSuccess(this.$t('Claim deleted!'));
|
|
window.location.href = await this.vnApp.getUrl(`claim/`);
|
|
});
|
|
}
|
|
}
|
|
|
|
ngModule.vnComponent('vnClaimDescriptor', {
|
|
template: require('./index.html'),
|
|
controller: Controller,
|
|
bindings: {
|
|
claim: '<'
|
|
}
|
|
});
|