{"version":3,"sources":["webpack:///./src/components/Settings/Yield/ModalEditYieldGroupSize.vue","webpack:///src/components/Settings/Yield/ModalEditYieldGroupSize.vue","webpack:///./src/components/Settings/Yield/ModalEditYieldGroupSize.vue?67ce","webpack:///./src/components/Settings/Yield/ModalEditYieldGroupSize.vue?a222"],"names":["render","_vm","this","_c","_self","attrs","$t","isSaving","isSavingSuccess","isSavingError","onClickCancel","saveYieldSettings","showModal","on","scopedSlots","_u","key","fn","staticClass","sortedGroupSizes","length","_v","_s","_e","_l","groupSize","index","getPreviousGroupSize","directives","name","rawName","value","MaxSize","expression","domProps","$event","target","composing","$set","Percentage","modifiers","_n","$forceUpdate","removeGroupSize","newGroupSize","mYieldSettings","GroupSizes","class","isMaxGreaterThenMin","isMaxSizeEmpty","isPercentageEmpty","type","indexOf","keyCode","addGroupSize","apply","arguments","actionLabel","proxy","slot","staticRenderFns","props","Boolean","default","Function","required","data","computed","_objectSpread","mapState","self","groupsizes","label","isGreater","existingGroupSizes","previousMaxSize","isEmpty","created","JSON","parse","stringify","yieldSettingsState","yieldSettings","setNewGroupSizeDefaults","methods","mapMutations","previousGroupSize","size","Number","maxSize","ChannelId","LocationId","push","splice","yieldProvider","updateLocationYieldSettings","then","response","status","setYieldSettingsState","setTimeout","catch","error","finally","component"],"mappings":"yHAAA,IAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,qBAAqB,CAACE,MAAM,CAAC,WAAaJ,EAAIK,GAAG,oEAAoE,SAAWL,EAAIM,SAAS,gBAAkBN,EAAIO,gBAAgB,cAAgBP,EAAIQ,cAAc,cAAgBR,EAAIS,cAAc,YAAcT,EAAIU,kBAAkB,eAAiBV,EAAIQ,eAAiBR,EAAIO,gBAAgB,kBAAoBP,EAAIQ,eAAiBR,EAAIO,gBAChc,QACAP,EAAIK,GAAG,+CAA+C,UAAYL,EAAIW,WAAWC,GAAG,CAAC,WAAaZ,EAAIS,eAAeI,Y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AAA,SAAAC,GACAhC,EAAA7D,eAAA,KAEA8F,SAAA,WACAjC,EAAA/D,UAAA,SC9T8X,I,YCO1XiG,EAAY,eACd,EACAxG,EACA4D,GACA,EACA,KACA,KACA,MAIa,aAAA4C,E","file":"js/chunk-2d0dddfb.js?id=1ac1cab016f2b0e000c7","sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return _c('ui-component-modal',{attrs:{\"modalTitle\":_vm.$t(`Components.Settings.Yield.EditYieldSettings.Title_EditGroupSizes`),\"isSaving\":_vm.isSaving,\"isSavingSuccess\":_vm.isSavingSuccess,\"isSavingError\":_vm.isSavingError,\"onClickCancel\":_vm.onClickCancel,\"onClickSave\":_vm.saveYieldSettings,\"hideSaveButton\":_vm.isSavingError || _vm.isSavingSuccess,\"buttonLabelCancel\":_vm.isSavingError || _vm.isSavingSuccess\n      ? 'Close'\n      : _vm.$t(`Components.Carts.EditCartData.Button_Cancel`),\"showModal\":_vm.showModal},on:{\"closeModal\":_vm.onClickCancel},scopedSlots:_vm._u([{key:\"content\",fn:function(){return [_c('table',{staticClass:\"table is-fullwidth is-narrow is-striped\"},[_c('tbody',[(_vm.sortedGroupSizes.length === 0)?_c('tr',[_c('td',{attrs:{\"colspan\":\"5\"}},[_c('article',{staticClass:\"message is-info is-small has-margin-bottom\"},[_c('div',{staticClass:\"message-body\"},[_vm._v(\" \"+_vm._s(_vm.$t( `Components.Settings.Yield.EditYieldSettings.Message_NoGroupSizesDefined` ))+\" \")])])])]):_vm._e(),(_vm.sortedGroupSizes.length > 0)?_vm._l((_vm.sortedGroupSizes),function(groupSize,index){return _c('tr',{key:index},[_c('td',{attrs:{\"width\":\"50\"}},[_c('span',[_vm._v(_vm._s(_vm.getPreviousGroupSize(index))+\" - \")])]),_c('td',{attrs:{\"width\":\"75\"}},[_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(groupSize.MaxSize),expression:\"groupSize.MaxSize\"}],staticClass:\"input is-small\",attrs:{\"type\":\"text\",\"maxSize\":\"4\"},domProps:{\"value\":(groupSize.MaxSize)},on:{\"input\":function($event){if($event.target.composing)return;_vm.$set(groupSize, \"MaxSize\", $event.target.value)}}})]),_c('td',{attrs:{\"width\":\"100\"}},[_c('div',{staticClass:\"field has-addons\"},[_c('p',{staticClass:\"control\"},[_c('input',{directives:[{name:\"model\",rawName:\"v-model.number\",value:(groupSize.Percentage),expression:\"groupSize.Percentage\",modifiers:{\"number\":true}}],staticClass:\"input is-small\",attrs:{\"type\":\"text\"},domProps:{\"value\":(groupSize.Percentage)},on:{\"input\":function($event){if($event.target.composing)return;_vm.$set(groupSize, \"Percentage\", _vm._n($event.target.value))},\"blur\":function($event){return _vm.$forceUpdate()}}})]),_c('p',{staticClass:\"control\"},[_c('a',{staticClass:\"button is-small is-static\"},[_vm._v(\"%\")])])])]),_c('td',[(groupSize.Percentage < 0)?_c('span',{staticClass:\"is-size-7\"},[_vm._v(_vm._s(_vm.$t( `Components.Settings.Yield.EditYieldSettings.Label_Discount` )))]):_vm._e(),(groupSize.Percentage > 0)?_c('span',{staticClass:\"is-size-7\"},[_vm._v(_vm._s(_vm.$t( `Components.Settings.Yield.EditYieldSettings.Label_Surcharge` )))]):_vm._e()]),_c('td',[_c('a',{on:{\"click\":function($event){return _vm.removeGroupSize(index)}}},[_c('span',{staticClass:\"icon has-text-danger\"},[_c('font-awesome-icon',{attrs:{\"icon\":['fas', 'times']}})],1)])])])}):_vm._e()],2),_c('tfoot',[(_vm.newGroupSize)?_c('tr',[_c('td',{attrs:{\"width\":\"50\"}},[_c('span',[_vm._v(_vm._s(_vm.getPreviousGroupSize(_vm.mYieldSettings.GroupSizes.length))+\" - \")])]),_c('td',{attrs:{\"width\":\"75\"}},[_c('input',{directives:[{name:\"model\",rawName:\"v-model.number\",value:(_vm.newGroupSize.MaxSize),expression:\"newGroupSize.MaxSize\",modifiers:{\"number\":true}}],staticClass:\"input is-small\",class:{ 'is-danger': !_vm.isMaxGreaterThenMin || _vm.isMaxSizeEmpty },attrs:{\"type\":\"text\",\"maxSize\":\"4\"},domProps:{\"value\":(_vm.newGroupSize.MaxSize)},on:{\"input\":function($event){if($event.target.composing)return;_vm.$set(_vm.newGroupSize, \"MaxSize\", _vm._n($event.target.value))},\"blur\":function($event){return _vm.$forceUpdate()}}})]),_c('td',{attrs:{\"width\":\"100\"}},[_c('div',{staticClass:\"field has-addons\"},[_c('p',{staticClass:\"control\"},[_c('input',{directives:[{name:\"model\",rawName:\"v-model.number\",value:(_vm.newGroupSize.Percentage),expression:\"newGroupSize.Percentage\",modifiers:{\"number\":true}}],staticClass:\"input is-small\",class:{ 'is-danger': _vm.isPercentageEmpty },attrs:{\"type\":\"text\"},domProps:{\"value\":(_vm.newGroupSize.Percentage)},on:{\"keyup\":function($event){if(!$event.type.indexOf('key')&&$event.keyCode!==13)return null;return _vm.addGroupSize.apply(null, arguments)},\"input\":function($event){if($event.target.composing)return;_vm.$set(_vm.newGroupSize, \"Percentage\", _vm._n($event.target.value))},\"blur\":function($event){return _vm.$forceUpdate()}}})]),_c('p',{staticClass:\"control\"},[_c('a',{staticClass:\"button is-small is-static\"},[_vm._v(\"%\")])])])]),_c('td',[_c('span',{staticClass:\"is-size-7\"},[_vm._v(_vm._s(_vm.actionLabel))])]),_c('td',{attrs:{\"width\":\"40\"}},[_c('a',{on:{\"click\":_vm.addGroupSize}},[_c('span',{staticClass:\"icon has-text-success\"},[_c('font-awesome-icon',{attrs:{\"icon\":['fas', 'plus']}})],1)])])]):_vm._e()])])]},proxy:true}])},[_c('template',{slot:\"modalTitle\"})],2)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n  <ui-component-modal\n    :modalTitle=\"\n      $t(`Components.Settings.Yield.EditYieldSettings.Title_EditGroupSizes`)\n    \"\n    :isSaving=\"isSaving\"\n    :isSavingSuccess=\"isSavingSuccess\"\n    :isSavingError=\"isSavingError\"\n    :onClickCancel=\"onClickCancel\"\n    :onClickSave=\"saveYieldSettings\"\n    :hideSaveButton=\"isSavingError || isSavingSuccess\"\n    :buttonLabelCancel=\"\n      isSavingError || isSavingSuccess\n        ? 'Close'\n        : $t(`Components.Carts.EditCartData.Button_Cancel`)\n    \"\n    :showModal=\"showModal\"\n    @closeModal=\"onClickCancel\"\n  >\n    <template slot=\"modalTitle\"></template>\n    <template v-slot:content>\n      <table class=\"table is-fullwidth is-narrow is-striped\">\n        <tbody>\n          <tr v-if=\"sortedGroupSizes.length === 0\">\n            <td colspan=\"5\">\n              <article class=\"message is-info is-small has-margin-bottom\">\n                <div class=\"message-body\">\n                  {{\n                    $t(\n                      `Components.Settings.Yield.EditYieldSettings.Message_NoGroupSizesDefined`\n                    )\n                  }}\n                </div>\n              </article>\n            </td>\n          </tr>\n          <template v-if=\"sortedGroupSizes.length > 0\">\n            <tr v-for=\"(groupSize, index) in sortedGroupSizes\" :key=\"index\">\n              <td width=\"50\">\n                <span>{{ getPreviousGroupSize(index) }} - </span>\n              </td>\n              <td width=\"75\">\n                <input\n                  type=\"text\"\n                  maxSize=\"4\"\n                  v-model=\"groupSize.MaxSize\"\n                  class=\"input is-small\"\n                />\n              </td>\n              <td width=\"100\">\n                <div class=\"field has-addons\">\n                  <p class=\"control\">\n                    <input\n                      type=\"text\"\n                      v-model.number=\"groupSize.Percentage\"\n                      class=\"input is-small\"\n                    />\n                  </p>\n                  <p class=\"control\">\n                    <a class=\"button is-small is-static\">%</a>\n                  </p>\n                </div>\n              </td>\n              <td>\n                <span v-if=\"groupSize.Percentage < 0\" class=\"is-size-7\">{{\n                  $t(\n                    `Components.Settings.Yield.EditYieldSettings.Label_Discount`\n                  )\n                }}</span>\n                <span v-if=\"groupSize.Percentage > 0\" class=\"is-size-7\">{{\n                  $t(\n                    `Components.Settings.Yield.EditYieldSettings.Label_Surcharge`\n                  )\n                }}</span>\n              </td>\n              <td>\n                <a @click=\"removeGroupSize(index)\">\n                  <span class=\"icon has-text-danger\">\n                    <font-awesome-icon :icon=\"['fas', 'times']\" />\n                  </span>\n                </a>\n              </td>\n            </tr>\n          </template>\n        </tbody>\n        <tfoot>\n          <tr v-if=\"newGroupSize\">\n            <td width=\"50\">\n              <span\n                >{{ getPreviousGroupSize(mYieldSettings.GroupSizes.length) }}\n                -\n              </span>\n            </td>\n            <td width=\"75\">\n              <input\n                type=\"text\"\n                maxSize=\"4\"\n                v-model.number=\"newGroupSize.MaxSize\"\n                class=\"input is-small\"\n                :class=\"{ 'is-danger': !isMaxGreaterThenMin || isMaxSizeEmpty }\"\n              />\n            </td>\n            <td width=\"100\">\n              <div class=\"field has-addons\">\n                <p class=\"control\">\n                  <input\n                    type=\"text\"\n                    v-on:keyup.13=\"addGroupSize\"\n                    v-model.number=\"newGroupSize.Percentage\"\n                    class=\"input is-small\"\n                    :class=\"{ 'is-danger': isPercentageEmpty }\"\n                  />\n                </p>\n                <p class=\"control\">\n                  <a class=\"button is-small is-static\">%</a>\n                </p>\n              </div>\n            </td>\n            <td>\n              <span class=\"is-size-7\">{{ actionLabel }}</span>\n            </td>\n            <td width=\"40\">\n              <a @click=\"addGroupSize\">\n                <span class=\"icon has-text-success\">\n                  <font-awesome-icon :icon=\"['fas', 'plus']\" />\n                </span>\n              </a>\n            </td>\n          </tr>\n        </tfoot>\n      </table>\n    </template>\n  </ui-component-modal>\n</template>\n\n<script>\nimport { mapMutations, mapState } from 'vuex'\nimport yieldProvider from '@/providers/yield'\n\nexport default {\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      mYieldSettings: null,\n      newGroupSize: null,\n    }\n  },\n\n  computed: {\n    ...mapState('yieldStore', ['yieldSettingsState']),\n\n    sortedGroupSizes() {\n      let self = this\n      let groupsizes = []\n      if (self.mYieldSettings && self.mYieldSettings.GroupSizes.length > 0) {\n        // groupsizes = self.mYieldSettings.GroupSizes.sort(function(a, b) {\n        //   return a.MaxSize - b.MaxSize\n        // })\n        groupsizes = self.mYieldSettings.GroupSizes\n      }\n      return groupsizes\n    },\n\n    actionLabel() {\n      let label = ''\n\n      if (this.newGroupSize && this.newGroupSize.Percentage) {\n        if (this.newGroupSize.Percentage < 0) {\n          label = 'discount'\n        }\n        if (this.newGroupSize.Percentage > 0) {\n          label = 'surcharge'\n        }\n      }\n\n      return label\n    },\n\n    isMaxGreaterThenMin() {\n      let isGreater = false\n\n      if (this.mYieldSettings && this.newGroupSize) {\n        let existingGroupSizes = this.mYieldSettings.GroupSizes.length\n        let previousMaxSize = this.getPreviousGroupSize(existingGroupSizes)\n        if (this.newGroupSize.MaxSize >= previousMaxSize) {\n          isGreater = true\n        }\n      }\n\n      return isGreater\n    },\n\n    isMaxSizeEmpty() {\n      let isEmpty = false\n\n      if (this.mYieldSettings && this.newGroupSize) {\n        if (\n          this.newGroupSize.MaxSize === null ||\n          this.newGroupSize.MaxSize === ''\n        ) {\n          isEmpty = true\n        }\n      }\n\n      return isEmpty\n    },\n\n    isPercentageEmpty() {\n      let isEmpty = false\n\n      if (this.mYieldSettings && this.newGroupSize) {\n        if (\n          this.newGroupSize.Percentage === null ||\n          this.newGroupSize.Percentage === ''\n        ) {\n          isEmpty = true\n        }\n      }\n\n      return isEmpty\n    },\n  },\n\n  created() {\n    this.mYieldSettings = JSON.parse(\n      JSON.stringify(this.yieldSettingsState.yieldSettings)\n    )\n\n    this.setNewGroupSizeDefaults()\n  },\n\n  methods: {\n    ...mapMutations('yieldStore', ['setYieldSettingsState']),\n\n    getPreviousGroupSize(index) {\n      let self = this\n      let previousGroupSize = null\n      let size = 1\n\n      if (index > 0) {\n        previousGroupSize = self.mYieldSettings.GroupSizes[index - 1]\n        if (previousGroupSize) {\n          size = Number(previousGroupSize.MaxSize) + 1\n        }\n      }\n      return size\n    },\n\n    setNewGroupSizeDefaults() {\n      let self = this\n      let existingGroupSizes = self.mYieldSettings.GroupSizes.length\n      let maxSize = 1\n      if (existingGroupSizes > 0) {\n        let previousMaxSize = self.getPreviousGroupSize(existingGroupSizes)\n        maxSize = Number(previousMaxSize) + 5 - 1\n      }\n\n      this.newGroupSize = {\n        ChannelId: self.mYieldSettings.ChannelId,\n        LocationId: self.mYieldSettings.LocationId,\n        MaxSize: maxSize,\n        Percentage: 0,\n      }\n    },\n\n    addGroupSize() {\n      let self = this\n      if (\n        this.isMaxGreaterThenMin &&\n        !this.isMaxSizeEmpty &&\n        !this.isPercentageEmpty\n      ) {\n        self.mYieldSettings.GroupSizes.push(this.newGroupSize)\n        self.setNewGroupSizeDefaults()\n      }\n    },\n\n    removeGroupSize(index) {\n      let self = this\n      self.mYieldSettings.GroupSizes.splice(index, 1)\n    },\n\n    saveYieldSettings() {\n      let self = this\n      self.isSaving = true\n\n      self.yieldSettingsState.yieldSettings = self.mYieldSettings\n\n      yieldProvider.methods\n        .updateLocationYieldSettings(self.mYieldSettings)\n        .then((response) => {\n          if (response.status === 200) {\n            self.isSavingSuccess = true\n            self.setYieldSettingsState(self.yieldSettingsState)\n\n            setTimeout(() => {\n              self.onClickCancel()\n            }, 1500)\n          }\n        })\n        .catch((error) => {\n          self.isSavingError = true\n        })\n        .finally(() => {\n          self.isSaving = false\n        })\n    },\n  },\n}\n</script>\n","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!./ModalEditYieldGroupSize.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!./ModalEditYieldGroupSize.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./ModalEditYieldGroupSize.vue?vue&type=template&id=4ec38ce1\"\nimport script from \"./ModalEditYieldGroupSize.vue?vue&type=script&lang=js\"\nexport * from \"./ModalEditYieldGroupSize.vue?vue&type=script&lang=js\"\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  null,\n  null\n  \n)\n\nexport default component.exports"],"sourceRoot":""}