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