44 lines
1.0 KiB
JavaScript
44 lines
1.0 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.showReport('claim-pickup-order', {
|
|
recipientId: this.claim.clientFk,
|
|
claimId: this.claim.id
|
|
});
|
|
}
|
|
|
|
sendPickupOrder() {
|
|
return this.sendEmail('claim-pickup-order', {
|
|
recipient: this.claim.client.email,
|
|
recipientId: this.claim.clientFk,
|
|
claimId: this.claim.id
|
|
});
|
|
}
|
|
|
|
deleteClaim() {
|
|
return this.$http.delete(`Claims/${this.claim.id}`)
|
|
.then(() => {
|
|
this.vnApp.showSuccess(this.$t('Claim deleted!'));
|
|
this.$state.go('claim.index');
|
|
});
|
|
}
|
|
}
|
|
|
|
ngModule.vnComponent('vnClaimDescriptor', {
|
|
template: require('./index.html'),
|
|
controller: Controller,
|
|
bindings: {
|
|
claim: '<'
|
|
}
|
|
});
|