Merge pull request #1391 from Safelite/feature/CSR-1392
Feature/csr 1392
This commit is contained in:
commit
3141cadbb1
10 changed files with 168 additions and 78 deletions
|
|
@ -27,7 +27,7 @@ module.exports = {
|
||||||
testMatch: ["**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"],
|
testMatch: ["**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"],
|
||||||
coverageThreshold: {
|
coverageThreshold: {
|
||||||
global: {
|
global: {
|
||||||
statements: 78,
|
statements: 77,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// Uncomment this to avoid the massive amount of warnings we are getting for onSubmit and onInvalidSubmit
|
// Uncomment this to avoid the massive amount of warnings we are getting for onSubmit and onInvalidSubmit
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ const storeActions = {
|
||||||
SAVE_SERVICE_LOCATION_TECH_NOTES: "saveServiceLocationTechNotes",
|
SAVE_SERVICE_LOCATION_TECH_NOTES: "saveServiceLocationTechNotes",
|
||||||
SAVE_WORK_ORDER_FLAG: "saveWorkOrderFlag",
|
SAVE_WORK_ORDER_FLAG: "saveWorkOrderFlag",
|
||||||
SAVE_PIA_ERROR_CODE: "savePiaErrorCode",
|
SAVE_PIA_ERROR_CODE: "savePiaErrorCode",
|
||||||
|
SAVE_PIA_WORK_ORDER: "savePiaWorkOrder",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { storeActions };
|
export { storeActions };
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
const storeMutations = {
|
const storeMutations = {
|
||||||
UPDATE_WORK_ORDER_FLAG: "updateWorkOrderFlag",
|
UPDATE_WORK_ORDER_FLAG: "updateWorkOrderFlag",
|
||||||
UPDATE_PIA_ERROR_CODE: "updatePiaErrorCode",
|
UPDATE_PIA_ERROR_CODE: "updatePiaErrorCode",
|
||||||
|
UPDATE_PIA_WORK_ORDER: "updatePiaWorkOrder",
|
||||||
|
|
||||||
// VEHICLE MUTATIONS
|
// VEHICLE MUTATIONS
|
||||||
UPDATE_YEAR: "updateYear",
|
UPDATE_YEAR: "updateYear",
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
@click="toggleClass()">
|
@click="toggleClass()">
|
||||||
<div class="col d-flex justify-content-between">
|
<div class="col d-flex justify-content-between">
|
||||||
<span class="label">Amount Due</span
|
<span class="label">Amount Due</span
|
||||||
><span class="label amount-due">$321.00</span>
|
><span class="label amount-due">${{ amountDue }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="price-table">
|
<div class="price-table">
|
||||||
|
|
@ -84,6 +84,7 @@ export default {
|
||||||
//availableVaps: [], TO DO Do we need this?
|
//availableVaps: [], TO DO Do we need this?
|
||||||
packageWithVAPS: false,
|
packageWithVAPS: false,
|
||||||
// packageLevel: "",
|
// packageLevel: "",
|
||||||
|
amountDue: this.getAmountDue(),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -121,6 +122,9 @@ export default {
|
||||||
|
|
||||||
return price;
|
return price;
|
||||||
},
|
},
|
||||||
|
getAmountDue() {
|
||||||
|
return baseMixin.methods.getAmountDue(this.storeLineItems);
|
||||||
|
},
|
||||||
removeItem(item) {
|
removeItem(item) {
|
||||||
this.$emit("cart-remove", item);
|
this.$emit("cart-remove", item);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,54 +1,57 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="page-container-grouped-styles position-relative">
|
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm">
|
||||||
<funnelHeader cmsWidgetName="FunnelHeaderWidget" />
|
<div class="page-container-grouped-styles position-relative">
|
||||||
<div>{{ workOrderNumber }}</div>
|
<funnelHeader cmsWidgetName="FunnelHeaderWidget" />
|
||||||
<div>
|
<div>
|
||||||
<div class="container-fluid pb-2">
|
<div class="container-fluid pb-2">
|
||||||
<div class="row justify-content-md-center">
|
<div class="row justify-content-md-center">
|
||||||
<div class="col-md-6 col-xl-4">
|
<div class="col-md-6 col-xl-4">
|
||||||
<div class="header-container">
|
<div class="header-container">
|
||||||
<img :src="ScheduleConfirmationImage" />
|
<img :src="ScheduleConfirmationImage" />
|
||||||
<span v-html="ScheduleConfirmationText"></span>
|
<span v-html="ScheduleConfirmationText"></span>
|
||||||
</div>
|
|
||||||
<div class="main">
|
|
||||||
<div>
|
|
||||||
<vehicleBanner
|
|
||||||
cmsWidgetName="VehicleBannerWidget"
|
|
||||||
:displayGenericVehicleImage="false" />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="scheduleText">
|
<div class="main">
|
||||||
<p>{{ this.ScheduleDateFormatted }}</p>
|
<div>
|
||||||
<p>{{ this.ScheduleTimeFormatted }}</p>
|
<vehicleBanner
|
||||||
</div>
|
cmsWidgetName="VehicleBannerWidget"
|
||||||
|
:displayGenericVehicleImage="false" />
|
||||||
<div class="calendar-section">
|
|
||||||
<div class="add-to-calendar">
|
|
||||||
<button>
|
|
||||||
<span class="add-to-calendar-span">
|
|
||||||
<img
|
|
||||||
src="~@/assets/img/icons/add-to-calendar.svg"
|
|
||||||
class="add-to-calendar-img" />
|
|
||||||
<span class="add-to-calendar-text"
|
|
||||||
>Add to calendar</span
|
|
||||||
></span
|
|
||||||
>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="scheduleText">
|
||||||
|
<p>{{ this.ScheduleDateFormatted }}</p>
|
||||||
|
<p>{{ this.ScheduleTimeFormatted }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="calendar-section">
|
||||||
|
<div class="add-to-calendar">
|
||||||
|
<button>
|
||||||
|
<span class="add-to-calendar-span">
|
||||||
|
<img
|
||||||
|
src="~@/assets/img/icons/add-to-calendar.svg"
|
||||||
|
class="add-to-calendar-img" />
|
||||||
|
<span class="add-to-calendar-text"
|
||||||
|
>Add to calendar</span
|
||||||
|
></span
|
||||||
|
>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="appoinmenttext"
|
||||||
|
v-html="this.AppointmentWordingText"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="appoinmenttext" v-html="this.AppointmentWordingText"></div>
|
<div class="emailtext" v-html="this.ConfirmationEmailText"></div>
|
||||||
|
<navbar
|
||||||
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
|
ref="navbar"
|
||||||
|
isBackButtonHidden="true"
|
||||||
|
@ForwardClicked="forwardButtonAction"
|
||||||
|
:buttonSize="true" />
|
||||||
</div>
|
</div>
|
||||||
<div class="emailtext" v-html="this.ConfirmationEmailText"></div>
|
|
||||||
<navbar
|
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
|
||||||
ref="navbar"
|
|
||||||
isBackButtonHidden="true"
|
|
||||||
@ForwardClicked="forwardButtonAction"
|
|
||||||
:buttonSize="true" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Form>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
// Components
|
// Components
|
||||||
|
|
@ -60,6 +63,7 @@ import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
import { AppointmentTypeStrings } from "@/constants/schedule-constants";
|
import { AppointmentTypeStrings } from "@/constants/schedule-constants";
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
import { applicationConfig } from "@/constants/application-config.js";
|
import { applicationConfig } from "@/constants/application-config.js";
|
||||||
|
import { Form } from "vee-validate";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
@ -236,6 +240,7 @@ export default {
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
funnelHeader,
|
funnelHeader,
|
||||||
|
Form,
|
||||||
navbar,
|
navbar,
|
||||||
vehicleBanner,
|
vehicleBanner,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -231,32 +231,29 @@ export default {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
async ccdPayment() {
|
async ccdPayment() {
|
||||||
//leaving site, clear any save session promises that we will not be able to resolve when we return
|
this.piaSetup("cc");
|
||||||
this.$refs.loadingModal.showModal();
|
|
||||||
this.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false);
|
|
||||||
await this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
|
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_PAY_NOW_TYPE, "cc", false);
|
|
||||||
this.$router.navigateWithoutSaving(
|
|
||||||
this.navigationScenarios.CLICKED_PAY_NOW,
|
|
||||||
this.$route
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
async paypal() {
|
async paypal() {
|
||||||
//leaving site, clear any save session promises that we will not be able to resolve when we return
|
this.piaSetup("pp");
|
||||||
this.$refs.loadingModal.showModal();
|
|
||||||
this.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false);
|
|
||||||
await this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
|
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_PAY_NOW_TYPE, "pp", false);
|
|
||||||
this.$router.navigateWithoutSaving(
|
|
||||||
this.navigationScenarios.CLICKED_PAY_NOW,
|
|
||||||
this.$route
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
async afterpay() {
|
async afterpay() {
|
||||||
|
this.piaSetup("ap");
|
||||||
|
},
|
||||||
|
async piaSetup(payNowType) {
|
||||||
this.$refs.loadingModal.showModal();
|
this.$refs.loadingModal.showModal();
|
||||||
this.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false);
|
|
||||||
|
//leaving site, clear any save session promises that we will not be able to resolve when we return
|
||||||
await this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
|
await this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_PAY_NOW_TYPE, "ap", false);
|
await this.dispatchStoreAction(storeActions.SAVE_PAY_NOW_TYPE, payNowType, false);
|
||||||
|
|
||||||
|
// make sure pia error codes are reset, and get a pia work order in delete status
|
||||||
|
this.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false);
|
||||||
|
this.dispatchStoreAction(storeActions.SAVE_PIA_WORK_ORDER, true);
|
||||||
|
|
||||||
|
if (!store.getters.order.workOrderNumber) {
|
||||||
|
await submitWorkOrder({ pageNameToLog: "payment-method" });
|
||||||
|
}
|
||||||
|
|
||||||
this.$router.navigateWithoutSaving(
|
this.$router.navigateWithoutSaving(
|
||||||
this.navigationScenarios.CLICKED_PAY_NOW,
|
this.navigationScenarios.CLICKED_PAY_NOW,
|
||||||
this.$route
|
this.$route
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="confirm" ref="confirm" @click="forwardButtonAction"></div>
|
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm">
|
||||||
|
<loadingModal notFullScreen ref="loadingModal" />
|
||||||
|
</Form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -8,17 +10,20 @@ import { queryStrings } from "@/constants/query-strings";
|
||||||
import { getQuerystringParameter } from "@/helpers/querystring-helper";
|
import { getQuerystringParameter } from "@/helpers/querystring-helper";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
|
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
||||||
|
import { Form } from "vee-validate";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "payment-pia-return",
|
name: "payment-pia-return",
|
||||||
async mounted() {
|
async mounted() {
|
||||||
|
this.$refs.loadingModal.showModal();
|
||||||
const piaError = getQuerystringParameter(queryStrings.ERROR);
|
const piaError = getQuerystringParameter(queryStrings.ERROR);
|
||||||
const token = getQuerystringParameter(queryStrings.TOKEN);
|
const token = getQuerystringParameter(queryStrings.TOKEN);
|
||||||
const payerId = getQuerystringParameter(queryStrings.PAYERID);
|
const payerId = getQuerystringParameter(queryStrings.PAYERID);
|
||||||
|
|
||||||
if (piaError) {
|
if (piaError) {
|
||||||
baseMixin.methods.dispatchStoreAction(
|
baseMixin.methods.dispatchStoreAction(
|
||||||
storeActions.SAVE_PAYPAL_ERROR_CODE,
|
storeActions.SAVE_PIA_ERROR_CODE,
|
||||||
piaError,
|
piaError,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
@ -26,7 +31,7 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
if (token && payerId) {
|
if (token && payerId) {
|
||||||
baseMixin.methods.dispatchStoreAction(
|
baseMixin.methods.dispatchStoreAction(
|
||||||
storeActions.SAVE_PAYPAL_ERROR_CODE,
|
storeActions.SAVE_PIA_ERROR_CODE,
|
||||||
null,
|
null,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
@ -35,11 +40,18 @@ export default {
|
||||||
true,
|
true,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Final work order submit after returning from PIA.
|
||||||
|
await this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
|
||||||
await submitWorkOrder({ pageNameToLog: "payment-pia-return" });
|
await submitWorkOrder({ pageNameToLog: "payment-pia-return" });
|
||||||
this.$refs.confirm.click();
|
this.$refs.loadingModal.isModalVisible = false;
|
||||||
|
this.$router.navigateWithoutSaving(
|
||||||
|
this.navigationScenarios.PIA_SUCCESS,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
baseMixin.methods.dispatchStoreAction(
|
baseMixin.methods.dispatchStoreAction(
|
||||||
storeActions.SAVE_PAYPAL_ERROR_CODE,
|
storeActions.SAVE_PIA_ERROR_CODE,
|
||||||
piaError,
|
piaError,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
@ -55,7 +67,10 @@ export default {
|
||||||
this.$router.navigateWithoutSaving(this.navigationScenarios.PIA_SUCCESS, this.$route);
|
this.$router.navigateWithoutSaving(this.navigationScenarios.PIA_SUCCESS, this.$route);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {},
|
components: {
|
||||||
|
loadingModal,
|
||||||
|
Form,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@
|
||||||
|
|
||||||
<input type="hidden" name="sgtotalamount" :value="displayAmount" />
|
<input type="hidden" name="sgtotalamount" :value="displayAmount" />
|
||||||
<input type="hidden" name="totalAmountDecimal" :value="totalAmount" />
|
<input type="hidden" name="totalAmountDecimal" :value="totalAmount" />
|
||||||
<input type="hidden" name="lineItems" :value="lineItems" />
|
<input type="hidden" name="lineItems" :value="piaLineItems" />
|
||||||
|
|
||||||
<input type="hidden" name="sgdiscountstrikethruamount" value="" />
|
<input type="hidden" name="sgdiscountstrikethruamount" value="" />
|
||||||
|
|
||||||
|
|
@ -152,7 +152,7 @@
|
||||||
value="https://fixmyglasstest.safelite.com/FixMyGlass/Payment.aspx?error=ccTimeout" />
|
value="https://fixmyglasstest.safelite.com/FixMyGlass/Payment.aspx?error=ccTimeout" />
|
||||||
|
|
||||||
<input type="hidden" name="sgTransactionType" value="authorization" />
|
<input type="hidden" name="sgTransactionType" value="authorization" />
|
||||||
<input type="hidden" name="amount" :value="totalAmount" />
|
<input type="hidden" name="amount" :value="amountDue" />
|
||||||
<input type="hidden" name="ctu" :value="ctu" />
|
<input type="hidden" name="ctu" :value="ctu" />
|
||||||
<input type="hidden" name="orderNumber" :value="workOrderNumber" />
|
<input type="hidden" name="orderNumber" :value="workOrderNumber" />
|
||||||
|
|
||||||
|
|
@ -186,6 +186,7 @@ import { externalUrls } from "@/router/router-constants/externalUrl-values";
|
||||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
import { applicationConfig } from "@/constants/application-config";
|
import { applicationConfig } from "@/constants/application-config";
|
||||||
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
|
|
||||||
// Validation
|
// Validation
|
||||||
import { Form } from "vee-validate";
|
import { Form } from "vee-validate";
|
||||||
|
|
@ -213,12 +214,11 @@ export default {
|
||||||
phoneNumber: store.getters.order.customer.phoneNumber,
|
phoneNumber: store.getters.order.customer.phoneNumber,
|
||||||
ctu: store.getters.order.serviceLocation.zipCodeCtu,
|
ctu: store.getters.order.serviceLocation.zipCodeCtu,
|
||||||
referralCorrelationId: store.getters.order.referralCorrelationId,
|
referralCorrelationId: store.getters.order.referralCorrelationId,
|
||||||
// TODO: replace these
|
workOrderNumber: this.getWOrkOrderNumber(),
|
||||||
workOrderNumber: Math.floor(Math.random() * 90000) + 10000,
|
invoiceNumber: this.getInvoiceNumber(),
|
||||||
invoiceNumber: Math.floor(Math.random() * 90000) + 10000,
|
totalAmount: this.getAmountDue(),
|
||||||
totalAmount: "321.00", // TODO: get from cart?
|
displayAmount: this.getDisplayAmountDue(),
|
||||||
displayAmount: "$321.00", // TODO: get from cart?
|
piaLineItems: this.getPiaLineItems(),
|
||||||
lineItems: "Labor|189.99|1||Repair supplies|7.99|1",
|
|
||||||
sgHeaderline1: this.getHeaderLine1(),
|
sgHeaderline1: this.getHeaderLine1(),
|
||||||
sgHeaderline2: this.getHeaderLine2(),
|
sgHeaderline2: this.getHeaderLine2(),
|
||||||
paypalPayment: this.isPaypal(),
|
paypalPayment: this.isPaypal(),
|
||||||
|
|
@ -249,6 +249,25 @@ export default {
|
||||||
// TODO
|
// TODO
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
getWOrkOrderNumber() {
|
||||||
|
if (store.getters.order.workOrderNumber) {
|
||||||
|
var items = store.getters.order.workOrderNumber.split("-");
|
||||||
|
return items[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// no work order, set pia error and return
|
||||||
|
this.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, "NO WORK ORDER", false);
|
||||||
|
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||||
|
},
|
||||||
|
getInvoiceNumber() {
|
||||||
|
if (store.getters.order.workOrderNumber) {
|
||||||
|
return store.getters.order.workOrderNumber.replace("-", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
// no work order, set pia error and return
|
||||||
|
this.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, "NO WORK ORDER", false);
|
||||||
|
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||||
|
},
|
||||||
getAddress1() {
|
getAddress1() {
|
||||||
return store.getters.order.serviceLocation.address
|
return store.getters.order.serviceLocation.address
|
||||||
? store.getters.order.serviceLocation.address
|
? store.getters.order.serviceLocation.address
|
||||||
|
|
@ -289,6 +308,27 @@ export default {
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
},
|
},
|
||||||
|
getPiaLineItems() {
|
||||||
|
const itemsClone = { ...store.getters.order.lineItems };
|
||||||
|
delete itemsClone.serverData;
|
||||||
|
|
||||||
|
var itemsForPia = "";
|
||||||
|
for (var propertyName in itemsClone) {
|
||||||
|
for (var item in itemsClone[propertyName]) {
|
||||||
|
var amount =
|
||||||
|
+itemsClone[propertyName][item].laborAmount +
|
||||||
|
+itemsClone[propertyName][item].sellingPrice;
|
||||||
|
itemsForPia += itemsClone[propertyName][item].partType + "|" + amount + "|1|";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return itemsForPia;
|
||||||
|
},
|
||||||
|
getAmountDue() {
|
||||||
|
return baseMixin.methods.getAmountDue(store.getters.order.lineItems);
|
||||||
|
},
|
||||||
|
getDisplayAmountDue() {
|
||||||
|
return baseMixin.methods.getDisplayAmountDue(store.getters.order.lineItems);
|
||||||
|
},
|
||||||
isPaypal() {
|
isPaypal() {
|
||||||
if (this.getPaymentType() == "pp") {
|
if (this.getPaymentType() == "pp") {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,25 @@ export default {
|
||||||
getTotalLineItemPrice(lineItem) {
|
getTotalLineItemPrice(lineItem) {
|
||||||
return lineItem.kitPrice + lineItem.laborAmount + lineItem.sellingPrice;
|
return lineItem.kitPrice + lineItem.laborAmount + lineItem.sellingPrice;
|
||||||
},
|
},
|
||||||
|
getDisplayAmountDue(lineItems) {
|
||||||
|
return this.getAmountDue(lineItems).toLocaleString("en-US", {
|
||||||
|
style: "currency",
|
||||||
|
currency: "USD",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getAmountDue(lineItems) {
|
||||||
|
// TODO: verify tax is included in lineitems
|
||||||
|
// Price everything in lineitems except the server data string
|
||||||
|
var amountDue = 0;
|
||||||
|
const itemsClone = { ...lineItems };
|
||||||
|
delete itemsClone.serverData;
|
||||||
|
for (var propertyName in itemsClone) {
|
||||||
|
amountDue += this.getTotalPriceOfAllLineItemsAndChildParts(
|
||||||
|
itemsClone[propertyName]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return amountDue;
|
||||||
|
},
|
||||||
scrollToPageTop() {
|
scrollToPageTop() {
|
||||||
const container = document.getElementsByClassName("page-container-grouped-styles")[0];
|
const container = document.getElementsByClassName("page-container-grouped-styles")[0];
|
||||||
container.scrollTo({ top: 0, left: 0, behavior: "smooth" });
|
container.scrollTo({ top: 0, left: 0, behavior: "smooth" });
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ const getDefaultState = () => {
|
||||||
referralCorrelationId: null,
|
referralCorrelationId: null,
|
||||||
eon: null,
|
eon: null,
|
||||||
workOrderNumber: null,
|
workOrderNumber: null,
|
||||||
|
createDeleteStatusWorkOrderForPia: false,
|
||||||
},
|
},
|
||||||
applicationUser: {
|
applicationUser: {
|
||||||
eventBus: [],
|
eventBus: [],
|
||||||
|
|
@ -223,6 +224,9 @@ export const mutations = {
|
||||||
updatePiaErrorCode(state, piaErrorCode) {
|
updatePiaErrorCode(state, piaErrorCode) {
|
||||||
state.order.payment.piaErrorCode = piaErrorCode;
|
state.order.payment.piaErrorCode = piaErrorCode;
|
||||||
},
|
},
|
||||||
|
updatePiaWorkOrder(state, piaWorkOrder) {
|
||||||
|
state.order.createDeleteStatusWorkOrderForPia = piaWorkOrder;
|
||||||
|
},
|
||||||
updateWorkOrderNumber(state, workOrderNumber) {
|
updateWorkOrderNumber(state, workOrderNumber) {
|
||||||
state.order.workOrderNumber = workOrderNumber;
|
state.order.workOrderNumber = workOrderNumber;
|
||||||
},
|
},
|
||||||
|
|
@ -1618,6 +1622,7 @@ export const actions = {
|
||||||
referralNumber: order.referralNumber?.toString(),
|
referralNumber: order.referralNumber?.toString(),
|
||||||
referralSequenceNumber: order.referralSequenceNumber,
|
referralSequenceNumber: order.referralSequenceNumber,
|
||||||
eon: order.eon,
|
eon: order.eon,
|
||||||
|
createDeleteStatusWorkOrderForPia: order.createDeleteStatusWorkOrderForPia,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
logApiCall: true,
|
logApiCall: true,
|
||||||
|
|
@ -1694,6 +1699,9 @@ export const actions = {
|
||||||
savePiaErrorCode(context, piaErrorCode) {
|
savePiaErrorCode(context, piaErrorCode) {
|
||||||
context.commit(storeMutations.UPDATE_PIA_ERROR_CODE, piaErrorCode);
|
context.commit(storeMutations.UPDATE_PIA_ERROR_CODE, piaErrorCode);
|
||||||
},
|
},
|
||||||
|
savePiaWorkOrder(context, piaWorkOrder) {
|
||||||
|
context.commit(storeMutations.UPDATE_PIA_WORK_ORDER, piaWorkOrder);
|
||||||
|
},
|
||||||
|
|
||||||
// Business domain actions
|
// Business domain actions
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue