CASH-132: add new store action to save donation to Session storage
This commit is contained in:
parent
4eb4779b94
commit
64d49216e7
2 changed files with 25 additions and 4 deletions
|
|
@ -106,6 +106,7 @@ const storeActions = {
|
||||||
|
|
||||||
CREATE_SUBMITTED_ORDER: "createSubmittedOrder",
|
CREATE_SUBMITTED_ORDER: "createSubmittedOrder",
|
||||||
RESET_SUBMITTED_ORDER: "resetSubmittedOrder",
|
RESET_SUBMITTED_ORDER: "resetSubmittedOrder",
|
||||||
|
ADD_DONATION_TO_SUBMITTED_ORDER: "addDonationToSubmittedOrder",
|
||||||
RESET_EXTERNAL_PARAMETER_STATE: "resetExternalParameterState",
|
RESET_EXTERNAL_PARAMETER_STATE: "resetExternalParameterState",
|
||||||
UPDATE_EXTERNAL_PARAMETER_MMS: "updateExternalParameterMMS",
|
UPDATE_EXTERNAL_PARAMETER_MMS: "updateExternalParameterMMS",
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import { singleWindshieldCarIds } from "@/constants/single-windshield-carids";
|
||||||
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
||||||
import { deleteFunnelCookie } from "@/helpers/heritage-integration/cookie-helper.js";
|
import { deleteFunnelCookie } from "@/helpers/heritage-integration/cookie-helper.js";
|
||||||
import { deepEqual } from "@/helpers/object-helper";
|
import { deepEqual } from "@/helpers/object-helper";
|
||||||
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import {
|
import {
|
||||||
AppointmentTypeStrings,
|
AppointmentTypeStrings,
|
||||||
PREMIUM_FEE_PART_TYPE,
|
PREMIUM_FEE_PART_TYPE,
|
||||||
|
|
@ -3060,10 +3061,6 @@ export const actions = {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
savePageData(context, emailOrSms) {
|
|
||||||
context.commit(storeMutations.UPDATE_PAGE_DATA, emailOrSms);
|
|
||||||
},
|
|
||||||
|
|
||||||
saveVin(context, { isSelectedGlassAvailableForVehicle, vehicleInfo }) {
|
saveVin(context, { isSelectedGlassAvailableForVehicle, vehicleInfo }) {
|
||||||
//Reset dependent state when changing
|
//Reset dependent state when changing
|
||||||
if (vehicleInfo.vin !== context.state.order.vehicle.vin) {
|
if (vehicleInfo.vin !== context.state.order.vehicle.vin) {
|
||||||
|
|
@ -3146,6 +3143,29 @@ export const actions = {
|
||||||
context.commit(storeMutations.UPDATE_AFFILIATE_COOKIES, affiliateCookies);
|
context.commit(storeMutations.UPDATE_AFFILIATE_COOKIES, affiliateCookies);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
addDonationToSubmittedOrder(context, donationAmount) {
|
||||||
|
|
||||||
|
console.log("running addDonationToSubmittedOrder()... donationAmount: ", donationAmount)
|
||||||
|
|
||||||
|
const submittedOrder = deepClone(baseMixin.methods.getSubmittedOrder());
|
||||||
|
|
||||||
|
submittedOrder.lineItems.supportingItems.push({
|
||||||
|
"partNumber": "DONATION",
|
||||||
|
"description": null,
|
||||||
|
"partType": "DONATION",
|
||||||
|
"isInsurable": false,
|
||||||
|
"isChildPart": false,
|
||||||
|
"laborAmount": 0,
|
||||||
|
"sellingPrice": donationAmount,
|
||||||
|
"kitPrice": 0,
|
||||||
|
"salesTax": null,
|
||||||
|
"id": "donation-" + donationAmount,
|
||||||
|
});
|
||||||
|
|
||||||
|
// set to local storage
|
||||||
|
window.sessionStorage.setItem("submittedOrder", JSON.stringify(submittedOrder));
|
||||||
|
},
|
||||||
|
|
||||||
resetSubmittedOrder(context) {
|
resetSubmittedOrder(context) {
|
||||||
// clear from local storage
|
// clear from local storage
|
||||||
window.sessionStorage.removeItem("submittedOrder");
|
window.sessionStorage.removeItem("submittedOrder");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue