Spamworldpro Mini Shell
Spamworldpro


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/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/vreg/mixins/savedSessions.js
export default {
  data() {
    return {
      stepsStoreMap: {}
    }
  },
  mounted() {
    this.stepsStoreMap = {
      'step-1': {
        storeKey: 'SET_STEP1_FORM',
        nextPath: `/${this.currentStateCode}/step-2`
      },
      'step-2': {
        storeKey: 'SET_STEP2_FORM',
        nextPath: `/${this.currentStateCode}/step-3`,
      },
      'step-3': {
        storeKey: 'SET_STEP3_FORM',
        nextPath: `/${this.currentStateCode}/verify`,
      },
      'select-offline-plates': {
        storeKey: 'SET_BULK_OFFLINE_FORM_STEP',
        nextPath: `/${this.currentStateCode}/step-4`
      },
      'offline-step': {
        storeKey: 'SET_BULK_OFFLINE_FORM_STEP',
        nextPath: `/${this.currentStateCode}/step-5`
      },
      'renewal-details': {
        storeKey: 'SET_BULK_OFFLINE_FORM_STEP',
        nextPath: `/${this.currentStateCode}/step-6`
      }
    };
  },
  methods: {
    handleSavedOrder() {
      let {email, phone} = this.$route.query;

      this.checkProspectsOrderRequest({
        create_new_order: false
        , email
        , phone
      })
    },
    checkProspectsOrderRequest(data) {
      this.$axios.post(`orders/check-prospects-orders`, data)
        .then(({data}) => {
          this.successProspectsOrderResponse(data)
        })
    },
    successProspectsOrderResponse(data) {
      let order = data.data;

      if (!Object.keys(order).length) {
        return;
      }

      this.$store.commit('SET_ORDER_ID', order.id);
      this.$store.commit('SET_CLIENT_IP_ADDRESS', order.ip_address);

      this.handleSavedSession(order);

    },
    handleSavedSession(order) {

      if (!order.saved_session) {
        return false;
      }

      this.$router.push({
        path: this.determineLastActiveStep(order)
      });
    },
    determineLastActiveStep(order) {
      let savedSession = order.saved_session,
        nextPath = `/${this.currentStateCode}/step-2`;

      this.$store.commit('SET_STEP1_FORM', {
        first_name: order.first_name,
        middle_name: order.middle_name,
        company_name: order.middle_name,
        last_name: order.last_name,
        email: order.email,
        phone: order.phone,
      });

      for (let step in this.stepsStoreMap) {
        if (savedSession[step]) {
          this.$store.commit(this.stepsStoreMap[step].storeKey, savedSession[step]);
          nextPath = this.stepsStoreMap[step].nextPath;

          if (nextPath === `/${this.currentStateCode}/step-4`) {
            this.$store.commit('SET_FORM_FLOW', 'offline');
          }

        }
      }

      if (savedSession['verify']) {
        this.$store.commit('SET_FORM_FLOW', savedSession['verify'].form_flow);
        this.$store.commit('SET_EMPTY_ESTIMATES', savedSession['verify'].empty_estimates);
        this.$store.commit('SET_OFFLINE_API_PLATES', savedSession['verify'].prices);
        this.$store.commit('SET_ORIGINAL_ORDER_TYPE', savedSession['verify'].original_order_type);
      }


      return nextPath;
    }
  }
}

Spamworldpro Mini