![]() 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/mixins/ |
import Vue from "vue"; export default { data() { return { appDomain: process.env.app_domain, appName: process.env.app_name, serviceFee: this.$money(process.env.service_fee), appPhone: process.env.app_phone, appEmail: process.env.app_email } }, methods: { bindInputAnimationEvents() { if (process.server) { return; } document.querySelectorAll('.form-group.with-animation .form-control:not(.v-reg-select-input)') .forEach(input => { this.inputAnimationEvent(input, 'focus'); this.inputAnimationEvent(input, 'blur'); }); }, inputAnimationEvent(inputEl, eventType) { inputEl.addEventListener(eventType, function (e) { let useMethod = eventType === 'focus' ? 'add' : 'remove', inputValueLength = this.value.trim().length; this.classList[useMethod]('with-border'); if (inputValueLength === 0) { this.parentNode.classList[useMethod]('focused'); } }) }, resetApplication() { this.$store.commit('RESET_STORE'); this.deleteAllCookies(); this.resetStorage(); this.resetSession(); }, resetSession() { window.sessionStorage.clear(); }, resetStorage() { window.localStorage.clear(); }, deleteAllCookies() { let cookies = document.cookie.split(";"); for (let i = 0; i < cookies.length; i++) { let cookie = cookies[i], eqPos = cookie.indexOf("="), name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT"; } }, loadPaymentsComponents() { if (this.hasGateway('Stripe')) { //load Stripe Vue.use(this.$stripePlugin, { pk: this.$store.getters.getPaymentsKeys[this.currentStateCode]['Stripe'].pk }); } if (this.hasGateway('Nmi')) { //load Nmi let script = document.createElement("script") script.src = "https://secure.networkmerchants.com/token/Collect.js" script.setAttribute('data-tokenization-key', this.$store.getters.getPaymentsKeys[this.currentStateCode]['Nmi'].pk); document.head.appendChild(script) } }, hasGateway(gateway) { return !!this.$store.getters.getPaymentsKeys[this.currentStateCode][gateway]; }, autoCloseDropdownOffClick() { document.querySelector('body:not(.vehicle-type-header)') .addEventListener('click', _.debounce(function (e) { if (e.target.classList.contains('vehicle-type-header')) { return; } //close all opened dropdowns! document.querySelectorAll('.vehicle-type-wrapper.opened') .forEach(function (vTypeWrapper) { vTypeWrapper.classList.remove('opened'); }); document.querySelectorAll('.vehicle-type-wrapper-menu .vehicle-type-header.open') .forEach(function (vHeader) { vHeader.classList.remove('open'); }); document.querySelectorAll('.vehicle-type-wrapper-menu .vehicle-type-options.d-block') .forEach(function (vHeader) { vHeader.classList.remove('d-block'); vHeader.classList.add('d-none'); }); })); }, showHideCheckoutLoader(flag) { this.$store.commit('SET_SHOW_CHECKOUT_LOADER_STATE', flag); } }, mounted() { this.bindInputAnimationEvents(); this.autoCloseDropdownOffClick(); }, computed: { currentStateCode() { return this.$store.getters.getCurrentStateCode; }, splittedPlateNumberComponent() { return () => import(`@/components/States/${this.currentStateCode.toUpperCase()}/SplittedPlateNumber`) }, isLoggedIn() { return this.$store.getters.isLoggedIn; }, storedOrder() { return this.$store.getters.order; }, showCheckoutLoader() { return this.$store.getters.showCheckoutLoader }, offlineFormPlates() { return this.$store.getters.getOfflineFormPlates; }, orderTotal() { let pureAmount = this.$ordersCalculator .getOrderTotals(this.currentStateCode, this.offlineFormPlates, [], false, [], this.discountObject); return Math.round(pureAmount * 100) / 100; }, getLineItems() { return this.$ordersCalculator.calculateOrderLineItems( this.currentStateCode, this.offlineFormPlates, [], this.discountObject ) }, discountObject() { return this.$store.getters.getDiscountObject; } } }