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.vnReport.show('claim-pickup-order', {
|
|
recipientId: this.claim.clientFk,
|
|
claimId: this.claim.id
|
|
});
|
|
}
|
|
|
|
sendPickupOrder() {
|
|
return this.vnEmail.send('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: '<'
|
|
}
|
|
});
|