CSR-2005 save parent account number before transition to heritage
This commit is contained in:
CarlNation 2024-03-08 10:33:40 -05:00
parent 9aaf807273
commit 43c1b1c18b

View file

@ -48,7 +48,6 @@ import baseMixin from "@/mixins/base-mixin.js";
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
import store from "@/store";
import vinPagesMixin from "@/mixins/vin-pages-mixin";
import $ from "jquery";
// DEFINE VALIDATION RULES
@ -67,7 +66,6 @@ defineRule("vin-format", regex(/^[a-hA-Hj-nJ-NpPr-zR-Z0-9]{17}$/, errorMessages.
export default {
name: "insurance-company",
mixins: [vinPagesMixin],
async beforeRouteEnter(to, from, next) {
// Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
@ -99,6 +97,7 @@ export default {
data() {
return {
insuranceCompanyList: [],
selectedParentAccount: "",
};
},
computed: {
@ -120,15 +119,37 @@ export default {
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
},
forwardButtonAction() {
this.dispatchStoreAction(
this.storeActions.SAVE_PARENT_ACCOUNT_NUMBER,
this.selectedParentAccount,
false
);
navigateToHeritageFunnel({
shouldSaveSession: true,
pageNameToLog: "insurance-company",
loadingModal: this.$refs.loadingModal,
});
},
selectParentAccountNumber(parentAccountName) {
if (!this.insuranceCompanyList) {
console.error("No insurance companies found");
return;
}
var selectedItem = this.insuranceCompanyList.filter((item) => {
return item.accountName === parentAccountName;
});
if (selectedItem) {
this.selectedParentAccount = selectedItem[0].parentAccountNumber;
} else {
console.error("Error locating " + parentAccountName);
}
},
},
mounted() {
const select = this.handleAutocompleteSelect;
const select = this.selectParentAccountNumber;
$("#autocomplete").autocomplete({
source: this.insuranceCompanyListTags,
@ -144,6 +165,9 @@ export default {
w.html((i, html) => html.replace(re, "<span>$1</span>"));
}, 5);
},
select: function (event, ui) {
select(ui.item.value);
},
});
},
watch: {