diff --git a/src/helpers/order-helper.js b/src/helpers/order-helper.js index 449f79b6..c37ca5f9 100644 --- a/src/helpers/order-helper.js +++ b/src/helpers/order-helper.js @@ -42,6 +42,14 @@ export async function submitWorkOrder({ submitType }) { submitAfterSave: true, bailoutOnError: true }); + const shouldRegisterClaimAfterSubmission = store.isPolicyLookupSuccessful + && store.vehicle.policyVehicleId != null + && store.vehicle.policyVehicleId >= 0 + && store.isClaimRegistrationRequired + && store.issConfig.callClaimRegistrationAtEnd; + if (shouldRegisterClaimAfterSubmission) { + await store.registerClaim(); + } await store.createSubmittedOrder(submitType); } diff --git a/src/layouts/coverage-statement/coverage-statement.vue b/src/layouts/coverage-statement/coverage-statement.vue index 6576f745..6de884ba 100644 --- a/src/layouts/coverage-statement/coverage-statement.vue +++ b/src/layouts/coverage-statement/coverage-statement.vue @@ -331,7 +331,8 @@ export default { vehicle, isClaimRegistrationRequired, isPolicyLookupSuccessful, - isPendingClaimRegistration + isPendingClaimRegistration, + issConfig } = useMainStore(); const { policyVehicleId } = vehicle; return ( @@ -340,6 +341,7 @@ export default { && policyVehicleId >= 0 && isClaimRegistrationRequired && isPendingClaimRegistration + && !issConfig.callClaimRegistrationAtEnd ); }, isRepair() { @@ -453,7 +455,7 @@ export default { async initializeComponent() { if (this.shouldRegisterClaim) { await this.mainStore.registerClaim(); - } else if (!this.mainStore.isClaimRegistrationRequired && this.mainStore.order.insuranceCoverage.coverageType !== coverageType.NONE) { + } else if ((!this.mainStore.isClaimRegistrationRequired || this.mainStore.issConfig.callClaimRegistrationAtEnd) && this.mainStore.order.insuranceCoverage.coverageType !== coverageType.NONE) { this.mainStore.updateCoverageStatus(coverageStatuses.VERIFIED); }