diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue
index b17a91878..42a8b92ad 100644
--- a/src/layouts/service-location/service-location.vue
+++ b/src/layouts/service-location/service-location.vue
@@ -46,7 +46,7 @@
alertClass="alert-warning" />
{
- var end = this.shopIndex + n;
- var part = array.slice(this.shopIndex, end);
- this.shopIndex = end < l ? end : this.shops.length;
- return part;
+ getNextShopsFromList(numberToGet = 3) {
+ const shopIterator = (array, n) => {
+ let l = array.length;
+ return () => {
+ var end = this.shopIndex + n;
+ var part = array.slice(this.shopIndex, end);
+ this.shopIndex = end < l ? end : this.shops.length;
+ return part;
+ };
};
- },
- async getNextShopsFromList() {
- const nextShop = this.shopIterator(this.shops, 3);
+
+ const nextShop = shopIterator(this.shops, numberToGet);
// Map API result data
const mappedData = nextShop().map((shop) => {
@@ -147,70 +137,68 @@ export default {
});
}
- await this.$nextTick();
-
- if (this.shopIndex == this.shops.length) {
- this.displaySeeMoreLocationsLink = false;
- } else {
- this.displaySeeMoreLocationsLink = true;
- }
-
- await this.$nextTick();
-
- const container = document.getElementsByClassName("page-container-grouped-styles")[0];
-
- container.scrollTo({ top: container.scrollHeight, left: 0, behavior: "smooth" });
-
+ this.$nextTick().then(() => {
+ if (this.shopIndex == this.shops.length) {
+ this.displaySeeMoreLocationsLink = false;
+ } else {
+ this.displaySeeMoreLocationsLink = true;
+ }
+ this.$nextTick().then(() => {
+ this.scrollToBottom();
+ });
+ });
},
resetShopList() {
this.answers = [];
this.shopIndex = 0;
- this.getNextShopsFromList();
this.displaySeeMoreLocationsLink = true;
this.selectedValue = "";
this.$refs.buttonQuestion.resetField();
},
+ scrollToBottom() {
+ const container = document.getElementsByClassName("page-container-grouped-styles")[0];
+ container.scrollTo({ top: container.scrollHeight, left: 0, behavior: "smooth" });
+ },
},
- // mounted() {
- // console.log(this.shopQuestionData);
- // this.shops = this.shopQuestionData;
- // this.getNextShopsFromList();
- // console.log(this.shops);
- // },
watch: {
serviceZipCode: {
- async handler() {
- this.shops = await this.updateShopList();
+ handler(newValue) {
+ this.loadInitialData(newValue).then((result) => {
+ this.initializeComponent(result.data);
+ this.resetShopList();
+ });
},
},
selectedAppointmentType: {
- async handler(newValue, oldValue) {
- if (oldValue == undefined) {
- this.shops = this.shopQuestionData;
- this.getNextShopsFromList();
- this.displaySeeMoreLocationsLink = true;
- return;
+ handler(newValue) {
+ // If the validation has been previously triggered, clear it before displaying the component
+ this.$refs.buttonQuestion.resetField();
+
+ if (newValue != null) {
+ this.$nextTick().then(() => {
+ this.scrollToBottom();
+ });
}
-
- await this.$nextTick();
-
- const container = document.getElementsByClassName(
- "page-container-grouped-styles"
- )[0];
- container.scrollTo({ top: container.scrollHeight, left: 0, behavior: "smooth" });
-
- this.resetShopList();
},
},
- shopQuestionData: {
+ shops: {
handler(newValue) {
- console.log(newValue)
- this.shops = newValue;
- this.getNextShopsFromList();
+ this.$refs.buttonQuestion.resetField();
+ const selectedShopIndex = newValue.findIndex((provider) => provider.providerNumber == this.modelValue);
+ if (selectedShopIndex >= 3) {
+ this.getNextShopsFromList(selectedShopIndex + 1);
+ } else {
+ this.getNextShopsFromList();
+ }
},
- }
+ },
+ },
+ components: {
+ alert,
+ buttonQuestion,
+ textLink,
},
};
diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js
index 3fbc9501d..3779b06c5 100644
--- a/src/mixins/analytics-mixin.js
+++ b/src/mixins/analytics-mixin.js
@@ -24,38 +24,35 @@ import { applicationConfig } from "../constants/application-config";
export default {
methods: {
logPageView(pageEvent) {
- const currentPageName = getPageNameByQueryString();
- var payload = {
- userId: getDeviceIdValue(),
- sessionKey: getSessionKeyValue(),
- pageName: currentPageName,
- sessionId: getSessionIdValue(),
- action: "",
- event: pageEvent,
- shouldUseSessionId: false,
- experimentsForUser: store.getters.applicationUser.experiments,
- };
-
- baseMixin.methods.dispatchStoreAction(storeActions.LOG_PAGE_VIEW, payload, false);
+ // const currentPageName = getPageNameByQueryString();
+ // var payload = {
+ // userId: getDeviceIdValue(),
+ // sessionKey: getSessionKeyValue(),
+ // pageName: currentPageName,
+ // sessionId: getSessionIdValue(),
+ // action: "",
+ // event: pageEvent,
+ // shouldUseSessionId: false,
+ // experimentsForUser: store.getters.applicationUser.experiments,
+ // };
+ // baseMixin.methods.dispatchStoreAction(storeActions.LOG_PAGE_VIEW, payload, false);
},
logCustomEvent(category, action, label, value) {
- const currentPageName = getPageNameByQueryString();
-
- var payload = {
- userId: getDeviceIdValue(),
- sessionKey: getSessionKeyValue(),
- pageName: currentPageName,
- sessionId: getSessionIdValue(),
- category: category,
- action: action,
- label: label,
- value: value,
- shouldUseSessionId: false,
- experimentsForUser: store.getters.applicationUser.experiments,
- };
-
- baseMixin.methods.dispatchStoreAction(storeActions.LOG_CUSTOM_EVENT, payload, false);
+ // const currentPageName = getPageNameByQueryString();
+ // var payload = {
+ // userId: getDeviceIdValue(),
+ // sessionKey: getSessionKeyValue(),
+ // pageName: currentPageName,
+ // sessionId: getSessionIdValue(),
+ // category: category,
+ // action: action,
+ // label: label,
+ // value: value,
+ // shouldUseSessionId: false,
+ // experimentsForUser: store.getters.applicationUser.experiments,
+ // };
+ // baseMixin.methods.dispatchStoreAction(storeActions.LOG_CUSTOM_EVENT, payload, false);
},
pushEventToGA(category, action, label, pushToLogApp = false, valueToLogType = null) {