{"version":3,"sources":["webpack:///./src/components/Vouchers/ModalEditSpacePercentage.vue?cefd","webpack:///./src/components/Vouchers/ModalEditSpacePercentage.vue","webpack:///src/components/Vouchers/ModalEditSpacePercentage.vue","webpack:///./src/components/Vouchers/ModalEditSpacePercentage.vue?c626","webpack:///./src/components/Vouchers/ModalEditSpacePercentage.vue?cfbf"],"names":["render","_vm","this","_c","_self","attrs","$t","isSaving","isSavingSuccess","isSavingError","onClickCancel","saveVoucherSpacePercentage","showModal","on","scopedSlots","_u","key","fn","voucher","staticClass","domProps","_s","textPercentageType","formatter","model","value","mSpacePercentage","SpacePercentage","callback","$$v","$set","expression","_v","directives","name","rawName","IgnoreSpacePriceLimits","_defineProperty","Array","isArray","_i","$event","$$a","$$el","target","$$c","checked","$$i","concat","slice","_e","proxy","slot","staticRenderFns","components","VueSlider","Message","props","type","Boolean","default","Function","required","data","v","computed","_objectSpread","mapState","n","bold","endBold","created","setupSpacePercentage","methods","mapMutations","_this","_asyncToGenerator","_regenerator","m","_callee","self","w","_context","ApplySeatRebate","setApplySeatRebate","voucherProvider","then","response","status","setVoucher","setTimeout","$emit","catch","error","finally","a","VoucherId","Id","LocationId","locationState","mVoucher","saveVoucher","component"],"mappings":"kHAAA,W,kFCAIA,G,oBAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,qBAAqB,CAACE,MAAM,CAAC,WAAaJ,EAAIK,GAAG,0EAA0E,SAAWL,EAAIM,SAAS,gBAAkBN,EAAIO,gBAAgB,cAAgBP,EAAIQ,cAAc,kBAAoBR,EAAIQ,eAAiBR,EAAIO,gBAAgB,cAAgBP,EAAIS,cAAc,YAAcT,EAAIU,2BAA2B,UAAYV,EAAIW,WAAWC,GAAG,CAAC,WAAaZ,EAAIS,eAAeI,YAAYb,EAAIc,GAAG,CAAC,CAACC,IAAI,UAAUC,GAAG,WAAW,MAAO,CAAEhB,EAAIiB,QAASf,EAAG,MAAM,CAACA,EAAG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A/D,2BAAA,eAAAgE,EAAA,YAAAC,eAAAC,iBAAAC,GAAA,SAAAC,IAAA,IAAAC,EAAA,OAAAH,iBAAAI,GAAA,SAAAC,GAAA,eAAAA,EAAAd,GAAA,OACA,GAAAY,EAAAL,EAEAK,EAAAzE,SAAA,CAAA2E,EAAAd,EAAA,QACA,GAAAY,EAAAzE,UAAA,EAEAoE,EAAAzD,QAAAiE,gBAAA,CAAAD,EAAAd,EAAA,eAAAc,EAAAd,EAAA,EACAO,EAAAS,qBAAA,OAGAC,OAAAZ,QACA9D,2BAAAgE,EAAAjD,kBACA4D,MAAA,SAAAC,GACA,MAAAA,EAAAC,SACAb,EAAAc,WAAAF,EAAAxB,MACAY,EAAAnE,iBAAA,EAEAkF,YAAA,WACAf,EAAAgB,MAAA,gBAAAJ,EAAAxB,MACAY,EAAAjE,kBACA,UAGAkF,OAAA,SAAAC,GACAlB,EAAAlE,eAAA,KAEAqF,SAAA,WACAnB,EAAApE,UAAA,KACA,cAAA2E,EAAAa,EAAA,MAAAhB,MA5BAH,IAgCAJ,qBAAA,WACA,KAAA9C,iBAAA,CACAsE,UAAA,KAAA9E,QAAA+E,GACAC,WAAA,KAAAC,cAAAF,GACAtE,gBAAA,KAAAT,QAAAS,gBACA,KAAAT,QAAAS,gCACA,EACAS,yBAAA,KAAAlB,QAAAS,iBAAA,KAAAT,QAAAS,gBAAAS,yBAIAgD,mBAAA,WAEA,IAAAgB,EAAAlC,eAAA,QAAAhD,SAEAkF,EAAAjB,kBACAiB,EAAAjB,iBAAA,GAGAE,OAAAZ,QACA4B,YAAAD,GACAR,OAAA,mBCzKgX,I,wBCQ5WU,EAAY,eACd,EACA,EACAjD,GACA,EACA,KACA,WACA,MAIa,aAAAiD,E","file":"js/chunk-6e307837.js?id=0eef59927628e25f57ae","sourcesContent":["export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--9-oneOf-1-0!../../../node_modules/css-loader/dist/cjs.js??ref--9-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--9-oneOf-1-2!../../../node_modules/sass-loader/dist/cjs.js??ref--9-oneOf-1-3!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ModalEditSpacePercentage.vue?vue&type=style&index=0&id=01844278&prod&lang=scss&scoped=true\"","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('ui-component-modal',{attrs:{\"modalTitle\":_vm.$t(`Components.Vouchers.SpacePriceDiscountSettings.Title_SeatPriceDiscount`),\"isSaving\":_vm.isSaving,\"isSavingSuccess\":_vm.isSavingSuccess,\"isSavingError\":_vm.isSavingError,\"hideFooterButtons\":_vm.isSavingError || _vm.isSavingSuccess,\"onClickCancel\":_vm.onClickCancel,\"onClickSave\":_vm.saveVoucherSpacePercentage,\"showModal\":_vm.showModal},on:{\"closeModal\":_vm.onClickCancel},scopedSlots:_vm._u([{key:\"content\",fn:function(){return [(_vm.voucher)?_c('div',[_c('Message',{attrs:{\"message\":_vm.$t(`Components.Vouchers.SpacePriceDiscountSettings.Message_EditSeatDiscount`)}}),_c('table',{staticClass:\"table is-fullwidth\"},[_c('thead',[_c('tr',[_c('th',{domProps:{\"textContent\":_vm._s(_vm.$t(`Components.Vouchers.SpacePriceDiscountSettings.TabeHeader_PercentageDescription`))}}),_c('th',{domProps:{\"textContent\":_vm._s(_vm.$t(`Components.Vouchers.SpacePriceDiscountSettings.TabeHeader_Percentage`))}})])]),_c('tbody',[_c('tr',{staticClass:\"has-text-vertical-middle\"},[_c('td',{domProps:{\"innerHTML\":_vm._s(_vm.textPercentageType)}}),_c('td',[_c('VueSlider',{attrs:{\"min\":-100,\"max\":100,\"interval\":1,\"tooltip-formatter\":_vm.formatter},model:{value:(_vm.mSpacePercentage.SpacePercentage),callback:function ($$v) {_vm.$set(_vm.mSpacePercentage, \"SpacePercentage\", $$v)},expression:\"mSpacePercentage.SpacePercentage\"}})],1)]),_c('tr',[_c('td',[_vm._v(_vm._s(_vm.$t(`Components.Vouchers.SpacePriceDiscountSettings.Label_IgnoreSpacePricelimits`)))]),_c('td',[_c('label',{staticClass:\"checkbox\"},[_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.mSpacePercentage.IgnoreSpacePriceLimits),expression:\"mSpacePercentage.IgnoreSpacePriceLimits\"}],attrs:{\"type\":\"checkbox\"},domProps:{\"checked\":_vm.mSpacePercentage.IgnoreSpacePriceLimits,\"checked\":Array.isArray(_vm.mSpacePercentage.IgnoreSpacePriceLimits)?_vm._i(_vm.mSpacePercentage.IgnoreSpacePriceLimits,null)>-1:(_vm.mSpacePercentage.IgnoreSpacePriceLimits)},on:{\"change\":function($event){var $$a=_vm.mSpacePercentage.IgnoreSpacePriceLimits,$$el=$event.target,$$c=$$el.checked?(true):(false);if(Array.isArray($$a)){var $$v=null,$$i=_vm._i($$a,$$v);if($$el.checked){$$i<0&&(_vm.$set(_vm.mSpacePercentage, \"IgnoreSpacePriceLimits\", $$a.concat([$$v])))}else{$$i>-1&&(_vm.$set(_vm.mSpacePercentage, \"IgnoreSpacePriceLimits\", $$a.slice(0,$$i).concat($$a.slice($$i+1))))}}else{_vm.$set(_vm.mSpacePercentage, \"IgnoreSpacePriceLimits\", $$c)}}}})])])])])])],1):_vm._e()]},proxy:true}])},[_c('template',{slot:\"modalTitle\"})],2)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n  <ui-component-modal\n    :modalTitle=\"$t(`Components.Vouchers.SpacePriceDiscountSettings.Title_SeatPriceDiscount`)\"\n    :isSaving=\"isSaving\"\n    :isSavingSuccess=\"isSavingSuccess\"\n    :isSavingError=\"isSavingError\"\n    :hideFooterButtons=\"isSavingError || isSavingSuccess\"\n    :onClickCancel=\"onClickCancel\"\n    :onClickSave=\"saveVoucherSpacePercentage\"\n    :showModal=\"showModal\"\n    @closeModal=\"onClickCancel\"\n  >\n    <template slot=\"modalTitle\"></template>\n    <template v-slot:content>\n      <div v-if=\"voucher\">\n        <Message :message=\"$t(`Components.Vouchers.SpacePriceDiscountSettings.Message_EditSeatDiscount`)\" />\n        <table class=\"table is-fullwidth\">\n          <thead>\n            <tr>\n              <th v-text=\"$t(`Components.Vouchers.SpacePriceDiscountSettings.TabeHeader_PercentageDescription`)\"></th>\n              <th v-text=\"$t(`Components.Vouchers.SpacePriceDiscountSettings.TabeHeader_Percentage`)\"></th>\n            </tr>\n          </thead>\n          <tbody>\n            <tr class=\"has-text-vertical-middle\">\n              <td v-html=\"textPercentageType\"></td>\n              <td>\n                <VueSlider\n                  v-model=\"mSpacePercentage.SpacePercentage\"\n                  :min=\"-100\"\n                  :max=\"100\"\n                  :interval=\"1\"\n                  :tooltip-formatter=\"formatter\"\n                />\n              </td>\n            </tr>\n            <tr>\n              <td>{{ $t(`Components.Vouchers.SpacePriceDiscountSettings.Label_IgnoreSpacePricelimits`) }}</td>\n              <td>\n                <label class=\"checkbox\">\n                  <input\n                    v-model=\"mSpacePercentage.IgnoreSpacePriceLimits\"\n                    type=\"checkbox\"\n                    :checked=\"mSpacePercentage.IgnoreSpacePriceLimits\"\n                  >\n\n                </label>\n              </td>\n            </tr>\n          </tbody>\n        </table>\n      </div>\n    </template>\n  </ui-component-modal>\n</template>\n\n<script>\nimport { mapState, mapMutations } from 'vuex'\nimport VueSlider from 'vue-slider-component'\nimport 'vue-slider-component/theme/default.css'\nimport voucherProvider from '@/providers/voucher'\nimport Message from '../UI/Message.vue'\n\nexport default {\n  components: {\n    VueSlider,\n    Message,\n  },\n\n  props: {\n    showModal: {\n      type: Boolean,\n      default: false,\n    },\n\n    onClickCancel: {\n      type: Function,\n      required: true,\n    },\n  },\n\n  data() {\n    return {\n      isSaving: false,\n      isSavingSuccess: false,\n      isSavingError: false,\n      formatter: (v) => `${v}%`,\n      mSpacePercentage: null,\n    }\n  },\n\n  computed: {\n    ...mapState('locationStore', ['locationState']),\n    ...mapState('voucherStore', ['voucher']),\n\n    textPercentageType() {\n      if (this.mSpacePercentage.SpacePercentage === 0) {\n        return this.$t('Components.Vouchers.SpacePriceDiscountSettings.Text_NoDiscountSet', { n: this.mSpacePercentage.SpacePercentage, bold: '<b>', endBold: '</b>' })\n      }\n      if (this.mSpacePercentage.SpacePercentage < 0) {\n        return this.$t('Components.Vouchers.SpacePriceDiscountSettings.Text_SeatPriceDiscount', { n: this.mSpacePercentage.SpacePercentage, bold: '<b>', endBold: '</b>' })\n      }\n      if (this.mSpacePercentage.SpacePercentage > 0) {\n        return this.$t('Components.Vouchers.SpacePriceDiscountSettings.Text_SeatPriceSurcharge', { n: this.mSpacePercentage.SpacePercentage, bold: '<b>', endBold: '</b>' })\n      }\n      return ''\n    }\n  },\n\n  created() {\n    this.setupSpacePercentage()\n  },\n\n  methods: {\n    ...mapMutations('voucherStore', ['setVoucher']),\n\n    async saveVoucherSpacePercentage() {\n      let self = this\n\n      if (!self.isSaving) {\n        self.isSaving = true\n\n        if (!this.voucher.ApplySeatRebate) {\n          await this.setApplySeatRebate()\n        }\n\n        voucherProvider.methods\n          .saveVoucherSpacePercentage(this.mSpacePercentage)\n          .then((response) => {\n            if (response.status === 200) {\n              this.setVoucher(response.data)\n              this.isSavingSuccess = true\n\n              setTimeout(() => {\n                this.$emit('voucherEdited', response.data)\n                this.onClickCancel()\n              }, 1500)\n            }\n          })\n          .catch((error) => {\n            this.isSavingError = true\n          })\n          .finally(() => {\n            this.isSaving = false\n          })\n      }\n    },\n\n    setupSpacePercentage() {\n      this.mSpacePercentage = {\n        VoucherId: this.voucher.Id,\n        LocationId: this.locationState.Id,\n        SpacePercentage: this.voucher.SpacePercentage\n          ? this.voucher.SpacePercentage.SpacePercentage\n          : 0,\n        IgnoreSpacePriceLimits: this.voucher.SpacePercentage ? this.voucher.SpacePercentage.IgnoreSpacePriceLimits : false\n      }\n    },\n\n    setApplySeatRebate() {\n      //Checking if ApplySeatRebate is not turned off (by clicking 'trash' icon in table view), if it's turned off it will be turned on again.\n      let mVoucher = { ...this.voucher }\n\n      if (!mVoucher.ApplySeatRebate) {\n        mVoucher.ApplySeatRebate = true\n      }\n\n      voucherProvider.methods\n        .saveVoucher(mVoucher)\n        .catch(() => { })\n    },\n  },\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.table {\n  tr {\n    td:nth-child(2) {\n      width: 240px;\n    }\n  }\n}\n</style>","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ModalEditSpacePercentage.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ModalEditSpacePercentage.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./ModalEditSpacePercentage.vue?vue&type=template&id=01844278&scoped=true\"\nimport script from \"./ModalEditSpacePercentage.vue?vue&type=script&lang=js\"\nexport * from \"./ModalEditSpacePercentage.vue?vue&type=script&lang=js\"\nimport style0 from \"./ModalEditSpacePercentage.vue?vue&type=style&index=0&id=01844278&prod&lang=scss&scoped=true\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  \"01844278\",\n  null\n  \n)\n\nexport default component.exports"],"sourceRoot":""}