![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/vreg/store/ |
const getDefaultState = () => { return { step1Form: {}, step2Form: {}, step3Form: {}, orderId: '', emptyEstimates: false, offlineFormPlates: [], formFlow: 'offline', originalOrderType: 'offline', apiPlates: [], prices: [], indexHref: null, paymentsKeys: [], order: null, currentStateCode: '', zipCode: '', apiAddress: {}, loggedIn: false, accessToken: null, orders: [], showCheckoutLoader: false, discountObject: {} } }; export const state = getDefaultState; export const mutations = { RESET_STORE(state) { let keys = getDefaultState(); delete keys['paymentsKeys']; Object.assign(state, keys); }, SET_API_ADDRESS(state, apiAddress) { state.apiAddress = apiAddress; }, SET_URL_INDEX_HREF(state, indexHref) { state.indexHref = indexHref; }, SET_STEP1_FORM(state, data) { state.step1Form = data; }, SET_STEP2_FORM(state, data) { state.step2Form = data; }, SET_STEP3_FORM(state, data) { state.step3Form = data; }, SET_ORDER_ID(state, orderId) { state.orderId = orderId; }, SET_CLIENT_IP_ADDRESS(state, ipAddress) { state.ipAddress = ipAddress; }, SET_OFFLINE_FORM_PLATE(state, data) { let pushNew = true, findByKey; if (!state.emptyEstimates) { findByKey = 'license_plate'; } else if (data.hasOwnProperty('index')) { findByKey = 'index'; } state.offlineFormPlates = state.offlineFormPlates.map(plate => { if (plate[findByKey] === data[findByKey]) { pushNew = false; return data; } return plate; }); if (pushNew) { state.offlineFormPlates.push(data); } }, REMOVE_OFFLINE_FORM_PLATE(state, plate) { let stepKey = 'offlineFormPlates'; // if empty estimates mean it's manual // and identify by index not by plate number if (state.emptyEstimates) { state[stepKey] = state[stepKey].filter((item, index) => { return index !== plate.index }); } else { state[stepKey] = state[stepKey].filter(item => item.license_plate !== plate.license_plate); } }, SET_OFFLINE_API_PLATES(state, apiPlates) { state.apiPlates = []; for (let plate in apiPlates) { state.apiPlates.push(apiPlates[plate]); } state.prices = apiPlates; }, SET_EMPTY_ESTIMATES(state, flag) { state.emptyEstimates = flag; }, SET_FORM_FLOW(state, formFlow) { state.formFlow = formFlow; }, SET_ORIGINAL_ORDER_TYPE(state, originalOrderType) { state.originalOrderType = originalOrderType; }, SET_BULK_OFFLINE_FORM_STEP(state, data) { state.offlineFormPlates = data; }, SET_PAYMENTS_KEYS(state, paymentsKeys) { state.paymentsKeys = paymentsKeys; }, SET_ORDER(state, order) { state.order = order; }, SET_CURRENT_STATE_CODE(state, currentStateCode) { state.currentStateCode = currentStateCode; }, SET_ZIP_CODE(state, zipCode) { state.zipCode = zipCode; }, SET_ORDERS(state, orders) { state.orders = orders; }, SET_ACCESS_TOKEN(state, accessToken) { state.accessToken = accessToken; }, SET_LOGGED_IN(state, loggedIn) { state.loggedIn = loggedIn; }, SET_SHOW_CHECKOUT_LOADER_STATE(state, flag) { state.showCheckoutLoader = flag; }, SET_DISCOUNT_OBJECT(state, object) { state.discountObject = object; } } export const getters = { getAPIPlates: state => state.apiPlates, getOfflineFormPlates: state => state.offlineFormPlates, getPaymentsKeys: state => state.paymentsKeys, getCurrentStateCode: state => state.currentStateCode, isLoggedIn: state => !!state.loggedIn && state.accessToken, accessToken: state => state.accessToken, order: state => state.order, orders: state => state.orders, showCheckoutLoader: state => state.showCheckoutLoader, getDiscountObject: state => state.discountObject };