updates
This commit is contained in:
parent
874250ac61
commit
4290f21175
4 changed files with 47 additions and 34 deletions
|
|
@ -11,7 +11,7 @@ export function isRecalPartOrHasChildRecalPart(glassPart) {
|
|||
const isGlassPartRecalPart = isRecalPart(glassPart);
|
||||
|
||||
if (!isGlassPartRecalPart && glassPart.childParts && glassPart.childParts.length > 0) {
|
||||
return glassPart.childParts.filter((cp) => isRecalPartOrHasChildRecalPart(cp));
|
||||
return glassPart.childParts.some((cp) => isRecalPartOrHasChildRecalPart(cp));
|
||||
}
|
||||
|
||||
return isGlassPartRecalPart;
|
||||
|
|
@ -64,8 +64,9 @@ export function containsRecalParts(lineItems) {
|
|||
const flattened = [
|
||||
...(lineItems.glassParts ?? []),
|
||||
...(lineItems.supportingItems ?? []),
|
||||
...(lineItems.otherParts ?? []),
|
||||
...(lineItems.feeItems ?? []),
|
||||
...(lineItems.vaps ?? []),
|
||||
...(lineItems.promos ?? []),
|
||||
];
|
||||
|
||||
return flattened.some((li) => isRecalPartOrHasChildRecalPart(li));
|
||||
|
|
@ -77,6 +78,6 @@ export function anyPartWithRequiresRecalFlag(lineItems) {
|
|||
return false;
|
||||
}
|
||||
|
||||
return lineItems.glassParts?.some((li) => li.requiresRecalibration === true);
|
||||
return lineItems.some((li) => li.requiresRecalibration === true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,33 +1,33 @@
|
|||
<template>
|
||||
<div id="recal-ack-modal-container">
|
||||
<modal
|
||||
:ref="ModalName"
|
||||
:modalId="ModalName"
|
||||
:footerButtonText="ModalCloseButtonText"
|
||||
:ref="modalName"
|
||||
:modalId="modalName"
|
||||
:footerButtonText="modalCloseButtonText"
|
||||
:isButtonDisabled="isButtonDisabled"
|
||||
@footerButtonEvent="footerButtonClick"
|
||||
:displayCloseButton="false"
|
||||
:displayCloseLink="true">
|
||||
<div class="form-test-invalid">
|
||||
<h5>{{ ModalHeadline }}</h5>
|
||||
<h5>{{ modalHeadline }}</h5>
|
||||
<div>
|
||||
<div
|
||||
class="mb-4"
|
||||
v-html="ModalBodyText"></div>
|
||||
v-html="modalBodyText"></div>
|
||||
<recalAckToggle
|
||||
class="mb-5"
|
||||
cmsWidgetName="RecalAckModalToggle" />
|
||||
<checkBox
|
||||
ref="recalAcknowledgement"
|
||||
v-model="acknowledged"
|
||||
v-model="isAcknowledged"
|
||||
class="mb-2 mt-4"
|
||||
:class="showAcknowledgementError && ' has-error'"
|
||||
:validationRules="rules.optionRequired"
|
||||
checkboxName="recalAcknowledgement"
|
||||
buttonID="recalAcknowledgement"
|
||||
:tabIndex="0"
|
||||
:checkboxLabel="ModalSubBodyText"
|
||||
:screenReaderOnlyText="ModalSubBodyText"
|
||||
:checkboxLabel="modalSubBodyText"
|
||||
:screenReaderOnlyText="modalSubBodyText"
|
||||
isRequired />
|
||||
<div
|
||||
v-if="showAcknowledgementError"
|
||||
|
|
@ -59,7 +59,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
acknowledged: false,
|
||||
isAcknowledged: false,
|
||||
showAcknowledgementError: false,
|
||||
rules: {
|
||||
optionRequired: globalRules.OPTION_REQUIRED
|
||||
|
|
@ -67,23 +67,23 @@ export default {
|
|||
};
|
||||
},
|
||||
computed: {
|
||||
ModalName() {
|
||||
modalName() {
|
||||
return this.cmsWidgetName;
|
||||
},
|
||||
ModalHeadline() {
|
||||
modalHeadline() {
|
||||
return this.getCmsContent(this.cmsWidgetName, 'HeaderText');
|
||||
},
|
||||
ModalBodyText() {
|
||||
modalBodyText() {
|
||||
return this.getCmsContent(this.cmsWidgetName, 'BodyText');
|
||||
},
|
||||
ModalSubBodyText() {
|
||||
modalSubBodyText() {
|
||||
return this.getCmsContent(this.cmsWidgetName, 'BodyText2');
|
||||
},
|
||||
ModalCloseButtonText() {
|
||||
modalCloseButtonText() {
|
||||
return this.getCmsContent(this.cmsWidgetName, 'FooterText');
|
||||
},
|
||||
isButtonDisabled() {
|
||||
return !this.acknowledged;
|
||||
return !this.isAcknowledged;
|
||||
},
|
||||
errorMessage() {
|
||||
if (this.showAcknowledgementError) {
|
||||
|
|
@ -93,24 +93,23 @@ export default {
|
|||
},
|
||||
},
|
||||
watch: {
|
||||
acknowledged() {
|
||||
isAcknowledged() {
|
||||
this.showAcknowledgementError = false;
|
||||
this.$emit('recalAcknowledged', this.acknowledged);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openModal() {
|
||||
this.$refs[this.ModalName].openModal();
|
||||
this.$refs[this.modalName].openModal();
|
||||
},
|
||||
footerButtonClick() {
|
||||
if (this.acknowledged) {
|
||||
this.$refs[this.ModalName]?.closeModal();
|
||||
if (this.isAcknowledged) {
|
||||
this.$emit('recalAcknowledged', this.isAcknowledged);
|
||||
this.$refs[this.modalName]?.closeModal();
|
||||
} else {
|
||||
this.showAcknowledgementError = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@
|
|||
ref="recalAckModal"
|
||||
cmsWidgetName="RecalAckModalWidget"
|
||||
:ackError="ackError"
|
||||
@recalAcknowledged="updateRecalAcknowledged()"/>
|
||||
@recalAcknowledged="updateIsRecalAcknowledged"/>
|
||||
</Form>
|
||||
</template>
|
||||
<script>
|
||||
|
|
@ -93,7 +93,6 @@ import datePicker from '@/digital-components/date-picker/date-picker.vue';
|
|||
import serviceLocation from '@/layouts/schedule-page/service-location/service-location.vue';
|
||||
import siteFooter from '@/iss-components/site-footer/site-footer.vue';
|
||||
import suggestTimeslotModal from '@/layouts/schedule-page/suggest-timeslot-modal/suggest-timeslot-modal.vue';
|
||||
import modal from '@/digital-components/modal/modal.vue';
|
||||
import recalAckModal from '@/layouts/schedule-page/recal-ack-modal/recal-ack-modal.vue';
|
||||
|
||||
// Supporting files
|
||||
|
|
@ -393,7 +392,7 @@ export default {
|
|||
selectedTimeSlotInfo: this.getSelectedTimeSlotInfo(),
|
||||
showDatePickerError: false,
|
||||
SUGGEST_TIMESLOT_MODAL_REF_NAME,
|
||||
isAcknowledged: false
|
||||
isRecalAcknowledged: this.getIsRecalAcknowledgedForScheduling()
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -443,7 +442,7 @@ export default {
|
|||
const containsRecalPart = containsRecalParts(glassParts);
|
||||
const hasPartWithRecalRequirement = anyPartWithRequiresRecalFlag(glassParts);
|
||||
|
||||
if (!containsRecalPart && hasPartWithRecalRequirement && !this.isAcknowledged) {
|
||||
if (!containsRecalPart && hasPartWithRecalRequirement) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -478,6 +477,7 @@ export default {
|
|||
this.mql = window.matchMedia('(min-width: 1200px)');
|
||||
this.isMobileView = !this.mql.matches;
|
||||
this.mql.addEventListener('change', this.handleMqlChange);
|
||||
this.mainStore.updateIsRecalAcknowledgedForScheduling(false);
|
||||
},
|
||||
unmounted() {
|
||||
if (this.mql) {
|
||||
|
|
@ -960,12 +960,12 @@ export default {
|
|||
this.showDatePickerError = false;
|
||||
},
|
||||
async forwardButtonAction() {
|
||||
if (this.displayRecalAckModal) {
|
||||
if (this.displayRecalAckModal && this.isRecalAcknowledged === false) {
|
||||
showIssLoadingModal(false);
|
||||
this.$refs.recalAckModal.openModal();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!this.isFormValid) {
|
||||
this.showDatePickerError = true;
|
||||
return;
|
||||
|
|
@ -983,9 +983,14 @@ export default {
|
|||
this.$route
|
||||
);
|
||||
},
|
||||
updateRecalAcknowledged() {
|
||||
this.isAcknowledged = true;
|
||||
}
|
||||
updateIsRecalAcknowledged(isAcknowledged) {
|
||||
this.isRecalAcknowledged = isAcknowledged;
|
||||
this.mainStore.saveIsRecalAcknowledgedForScheduling(this.isRecalAcknowledged);
|
||||
},
|
||||
getIsRecalAcknowledgedForScheduling() {
|
||||
console.log(this.mainStore.order.isRecalAcknowledgedForScheduling, 'isRecalAcknowledgedForScheduling from store');
|
||||
return this.mainStore.order.isRecalAcknowledgedForScheduling;
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -225,7 +225,8 @@ export const getDefaultState = () => ({
|
|||
loadedFromDupeCheck: null,
|
||||
loadedSessionClearedPreviousData: null,
|
||||
availableVaps: null,
|
||||
visitedDuplicateCheckPage: false
|
||||
visitedDuplicateCheckPage: false,
|
||||
isRecalAcknowledgedForScheduling: false
|
||||
},
|
||||
applicationUser: {
|
||||
experiments: [],
|
||||
|
|
@ -3125,6 +3126,13 @@ export const useMainStore = defineStore({
|
|||
resetSubmittedOrder() {
|
||||
// clear from sessionStorage
|
||||
window.sessionStorage.removeItem(webStorageConstants.SUBMITTED_ORDER);
|
||||
},
|
||||
|
||||
saveIsRecalAcknowledgedForScheduling(isRecalAcknowledged) {
|
||||
this.updateIsRecalAcknowledgedForScheduling(isRecalAcknowledged);
|
||||
},
|
||||
updateIsRecalAcknowledgedForScheduling(isRecalAcknowledged) {
|
||||
this.order.isRecalAcknowledgedForScheduling = isRecalAcknowledged;
|
||||
}
|
||||
},
|
||||
persist: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue