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/components/Forms/Sidebars/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/vreg/components/Forms/Sidebars/PromoCode.vue
<template>
  <div>
    <div class="promo-code-wrapper" style="margin-bottom: 10px">
      <div class="form-group">
        <input type="text" class="form-control promo-input" placeholder="Promo code" v-model="promoCode">
      </div>
      <button type="submit"
              @click.prevent="validatePromoCode"
              class="btn btn-form-green" :disabled="!promoCode || validating">
        <b-spinner class="mr-1" small v-if="validating"></b-spinner>
        Apply
      </button>


    </div>

    <div>
      <p class="text-danger" v-if="msg" v-html="msg"></p>
    </div>

  </div>

</template>

<script>
export default {
  name: "PromoCode",
  data() {

    return {
      promoCode: '',
      validating: false,
      msg: ''
    }
  },

  mounted() {
    if (this.discountObject) {
      this.promoCode = this.discountObject.code;
    }
  },
  methods: {
    validatePromoCode() {

      this.validating = true;

      this.$axios.post(`orders/validate-and-store-promo-code/${this.$store.state.orderId}?code=${this.promoCode}`)
        .then(({data: {data: response}}) => {
          let textClass = response.valid ? 'text-success' : 'text-danger';

          this.$store.commit('SET_DISCOUNT_OBJECT', response.object);

          this.msg = `<span class="${textClass}"><b>${response.message}</b></span>`;

        }).catch(err => {
        //
      }).finally(() => {
        this.validating = false
      })
    }
  }
}
</script>

<style scoped>

</style>

Spamworldpro Mini