Merge pull request #1797 from Safelite/feature/CSR-2005
Feature/csr 2005
This commit is contained in:
commit
0c48e4e5ed
1 changed files with 27 additions and 3 deletions
|
|
@ -48,7 +48,6 @@ import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
||||||
|
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
|
||||||
import $ from "jquery";
|
import $ from "jquery";
|
||||||
|
|
||||||
// DEFINE VALIDATION RULES
|
// DEFINE VALIDATION RULES
|
||||||
|
|
@ -67,7 +66,6 @@ defineRule("vin-format", regex(/^[a-hA-Hj-nJ-NpPr-zR-Z0-9]{17}$/, errorMessages.
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "insurance-company",
|
name: "insurance-company",
|
||||||
mixins: [vinPagesMixin],
|
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
// Call APIs
|
// Call APIs
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
||||||
|
|
@ -99,6 +97,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
insuranceCompanyList: [],
|
insuranceCompanyList: [],
|
||||||
|
selectedParentAccount: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -120,15 +119,37 @@ export default {
|
||||||
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||||
},
|
},
|
||||||
forwardButtonAction() {
|
forwardButtonAction() {
|
||||||
|
this.dispatchStoreAction(
|
||||||
|
this.storeActions.SAVE_PARENT_ACCOUNT_NUMBER,
|
||||||
|
this.selectedParentAccount,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
navigateToHeritageFunnel({
|
navigateToHeritageFunnel({
|
||||||
shouldSaveSession: true,
|
shouldSaveSession: true,
|
||||||
pageNameToLog: "insurance-company",
|
pageNameToLog: "insurance-company",
|
||||||
loadingModal: this.$refs.loadingModal,
|
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() {
|
mounted() {
|
||||||
const select = this.handleAutocompleteSelect;
|
const select = this.selectParentAccountNumber;
|
||||||
|
|
||||||
$("#autocomplete").autocomplete({
|
$("#autocomplete").autocomplete({
|
||||||
source: this.insuranceCompanyListTags,
|
source: this.insuranceCompanyListTags,
|
||||||
|
|
@ -144,6 +165,9 @@ export default {
|
||||||
w.html((i, html) => html.replace(re, "<span>$1</span>"));
|
w.html((i, html) => html.replace(re, "<span>$1</span>"));
|
||||||
}, 5);
|
}, 5);
|
||||||
},
|
},
|
||||||
|
select: function (event, ui) {
|
||||||
|
select(ui.item.value);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue