save endorsement questions, update navigation

(cherry picked from commit f78e32a94e)
This commit is contained in:
Katie Kroell 2023-10-11 15:55:46 -04:00
parent 8fbb991989
commit 5a603f3b2c

View file

@ -117,13 +117,14 @@ export default {
? vehicle?.coverages[0].deductible
: 0;
},
selectedVehicleHasEndorsements() {
endorsementsForSelectedVehicle() {
const vehicle = this.policyVehicles.find((policyVehicle) =>
policyVehicle?.vin === this.selectedVehicleVin);
if (!vehicle) {
return false;
if (vehicle?.endorsements?.length > 0) {
return vehicle.endorsements;
}
return vehicle.endorsements?.length > 0;
return [];
},
repairWaivedForSelectedVehicle() {
const vehicle = this.policyVehicles.find((policyVehicle) =>
@ -182,7 +183,8 @@ export default {
vin: this.selectedVehicleVin,
noCoverage: this.noCoverageForSelectedVehicle,
deductible: this.deductibleForSelectedVehicle,
repairWaived: this.repairWaivedForSelectedVehicle
repairWaived: this.repairWaivedForSelectedVehicle,
endorsements: this.endorsementsForSelectedVehicle
});
useMainStore().updateVehicle(this.vehicleFromLookup);
@ -205,7 +207,7 @@ export default {
{},
{}
);
} else if (this.selectedVehicleHasEndorsements) {
} else if (this.endorsementsForSelectedVehicle?.length > 0) {
this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD_WITH_ENDORSEMENTS,
this.$route