This commit is contained in:
Bryan Mauger 2025-02-13 15:56:07 -05:00
parent 61abcbb5d8
commit f4d8cd3f4f
8 changed files with 57 additions and 33 deletions

View file

@ -65,6 +65,7 @@ export default {
name: "donationBlock", name: "donationBlock",
props: { props: {
cmsWidgetName: String, cmsWidgetName: String,
modelValue: String,
}, },
computed: { computed: {
DonationHeadline() { DonationHeadline() {
@ -91,6 +92,14 @@ export default {
LogoImage() { LogoImage() {
return this.getCmsContent("DonationWidget", "Image"); return this.getCmsContent("DonationWidget", "Image");
}, },
selectedValue: {
get: function () {
return this.modelValue?.toString();
},
set: function (newValue) {
this.$emit("update:modelValue", newValue);
},
},
}, },
data() { data() {
return { return {

View file

@ -65,12 +65,17 @@
:isNoComp="isNoComp" /> :isNoComp="isNoComp" />
<div class="mt-3"> <div class="mt-3">
<donationBlock cmsWidgetName="DonationWidget" /> <donationBlock
cmsWidgetName="DonationWidget"
v-model="donationAmount"
:donationValues="donationValues" />
</div> </div>
<h3>donationAdded: {{ donationAdded }}</h3> <h3>donationAmount: {{ donationAmount }}</h3>
<button type="button" @click="addDonation(3)">Add Donation of $3</button> <!-- <button type="button" @click="addDonation(3)">
Add Donation of $3
</button> -->
<hr class="mb-5" /> <hr class="mb-5" />
@ -456,7 +461,10 @@ export default {
); );
} }
}, },
donationAdded() { donationValues() {
return [1,3,5];
},
donationAmount() {
const donationItems = this.submittedOrder?.lineItems?.supportingItems?.filter( const donationItems = this.submittedOrder?.lineItems?.supportingItems?.filter(
(item) => item.partNumber === "DONATION" (item) => item.partNumber === "DONATION"
); );
@ -507,13 +515,22 @@ export default {
forwardButtonAction() { forwardButtonAction() {
window.location.assign(location.protocol + "//" + location.host); window.location.assign(location.protocol + "//" + location.host);
}, },
addDonation(amount) { async addDonation(amount) {
baseMixin.methods.dispatchStoreAction( // try to call API to add donation to order
// TODO - change the following to check the response from the call
const donationResponse = await baseMixin.methods.dispatchStoreAction(
storeActions.ADD_DONATION_TO_SUBMITTED_ORDER, storeActions.ADD_DONATION_TO_SUBMITTED_ORDER,
amount, amount,
false false
); );
} },
},
watch: {
donationAmount(newValue) {
console.log("WATCHED donationAmount changed: ", newValue)
this.addDonation(newValue);
},
}, },
components: { components: {
funnelHeader, funnelHeader,

View file

@ -22,7 +22,7 @@
linkType="text" linkType="text"
:text="payWithCashButtonCopy" :text="payWithCashButtonCopy"
href="javascript:void(0)" href="javascript:void(0)"
@click-event="backButtonAction(foreceCashSelectionOnQuote = true)" /> @click-event="backButtonAction((foreceCashSelectionOnQuote = true))" />
<navbar <navbar
cmsWidgetName="FunnelFooterWidget" cmsWidgetName="FunnelFooterWidget"
@ -102,7 +102,7 @@ export default {
}, },
payWithCashButtonCopy() { payWithCashButtonCopy() {
return this.getCmsContent("PayWithCashWidget", "Text"); return this.getCmsContent("PayWithCashWidget", "Text");
} },
}, },
methods: { methods: {
isCashParentAccountNumber() { isCashParentAccountNumber() {
@ -123,10 +123,14 @@ export default {
backButtonAction(forceCashSelectionOnQuote) { backButtonAction(forceCashSelectionOnQuote) {
// Go back to Quote page // Go back to Quote page
if (forceCashSelectionOnQuote) { if (forceCashSelectionOnQuote) {
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route, {"isCashSelected": true}); this.$router.navigateWithoutSaving(
this.navigationScenarios.CLICKED_BACK,
this.$route,
{ isCashSelected: true }
);
return; return;
} }
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
}, },
async forwardButtonAction() { async forwardButtonAction() {

View file

@ -93,7 +93,7 @@ export default {
false false
); );
} }
baseMixin.methods.ResetExternalParamsAndHideModal(); baseMixin.methods.ResetExternalParamsAndHideModal();
} }
}); });

View file

@ -612,14 +612,10 @@ describe("quote.vue", () => {
mockTierOnePrice = 505; mockTierOnePrice = 505;
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
//Act //Act
await quote.beforeRouteEnter.call( await quote.beforeRouteEnter.call(
wrapper.vm, wrapper.vm,
{ query: { fmgPage: "quote", { query: { fmgPage: "quote", isInsuranceSelected: true, isCashSelected: true } },
isInsuranceSelected: true,
isCashSelected: true,
} },
undefined, undefined,
(c) => c(wrapper.vm) (c) => c(wrapper.vm)
); );

View file

@ -206,8 +206,7 @@ export default {
if (!this.emailOrSms) { if (!this.emailOrSms) {
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, "", false); await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, "", false);
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, "", false); await this.dispatchStoreAction(storeActions.SAVE_EMAIL, "", false);
} } else {
else {
if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) { if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) {
const phone = this.emailOrSms.replace(/[()]/g, ""); const phone = this.emailOrSms.replace(/[()]/g, "");
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false); await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false);

View file

@ -3157,22 +3157,21 @@ export const actions = {
}, },
addDonationToSubmittedOrder(context, donationAmount) { addDonationToSubmittedOrder(context, donationAmount) {
console.log("running addDonationToSubmittedOrder()... donationAmount: ", donationAmount);
console.log("running addDonationToSubmittedOrder()... donationAmount: ", donationAmount)
const submittedOrder = deepClone(baseMixin.methods.getSubmittedOrder()); const submittedOrder = deepClone(baseMixin.methods.getSubmittedOrder());
submittedOrder.lineItems.supportingItems.push({ submittedOrder.lineItems.supportingItems.push({
"partNumber": "DONATION", partNumber: "DONATION",
"description": null, description: null,
"partType": "DONATION", partType: "DONATION",
"isInsurable": false, isInsurable: false,
"isChildPart": false, isChildPart: false,
"laborAmount": 0, laborAmount: 0,
"sellingPrice": donationAmount, sellingPrice: donationAmount,
"kitPrice": 0, kitPrice: 0,
"salesTax": null, salesTax: null,
"id": "donation-" + donationAmount, id: "donation-" + donationAmount,
}); });
// set to local storage // set to local storage

View file

@ -1,4 +1,4 @@
process.env.VUE_APP_CONSUMER_CF_DISTRO = "https://digitalapi.dev.safelite.io"; process.env.VUE_APP_CONSUMER_CF_DISTRO = "https://digitalapi.qa.safelite.io";
//process.env.VUE_APP_HERITAGE_FUNNEL = "http://localhost:38000/default.aspx"; //process.env.VUE_APP_HERITAGE_FUNNEL = "http://localhost:38000/default.aspx";
process.env.VUE_APP_HERITAGE_FUNNEL = "https://fixmyglassdev.safelite.com/default.aspx"; process.env.VUE_APP_HERITAGE_FUNNEL = "https://fixmyglassdev.safelite.com/default.aspx";
process.env.VUE_APP_GOOGLE_PLACES_API_KEY = "AIzaSyDptGCkOPgN2uWJOy4ou4M33phRD4MAoJo"; process.env.VUE_APP_GOOGLE_PLACES_API_KEY = "AIzaSyDptGCkOPgN2uWJOy4ou4M33phRD4MAoJo";