{"version":3,"sources":["webpack:///./src/components/Settings/Yield/ModalEditYieldSpaceUtilization.vue","webpack:///src/components/Settings/Yield/ModalEditYieldSpaceUtilization.vue","webpack:///./src/components/Settings/Yield/ModalEditYieldSpaceUtilization.vue?911b","webpack:///./src/components/Settings/Yield/ModalEditYieldSpaceUtilization.vue?1c87"],"names":["render","_vm","this","_c","_self","attrs","$t","isSaving","isSavingSuccess","isSavingError","onClickCancel","saveYieldSettings","showModal","on","scopedSlots","_u","key","fn","staticClass","mYieldSettings","MeetingtypeId","VoucherId","ApplySpaceUtilization","_v","_s","formatter","model","value","values","callback","$$v","expression","_e","proxy","staticRenderFns","components","VueSlider","props","type","Boolean","default","Function","required","data","v","concat","computed","_objectSpread","mapState","created","JSON","parse","stringify","yieldSettingsState","yieldSettings","spaceValues","methods","mapMutations","roundToZero","SpaceUtilizationBottomValue","SpaceUtilizationTopValue","self","bottomValue","topValue","yieldProvider","updateLocationYieldSettings","then","response","status","setYieldSettingsState","setTimeout","catch","error","finally","num","Math","round","roundToTwo","component"],"mappings":"+IAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,qBAAqB,CAACE,MAAM,CAAC,WAAaJ,EAAIK,GAAG,0EAEjH,SAAWL,EAAIM,SAAS,gBAAkBN,EAAIO,gBAAgB,cAAgBP,EAAIQ,cAAc,eAAiBR,EAAIQ,eAAiBR,EAAIO,gBAAgB,kBAAoBP,EAAIQ,eAAiBR,EAAIO,gBACrMP,EAAIK,GAAG,sBACPL,EAAIK,GAAG,uBAAuB,cAAgBL,EAAIS,cAAc,YAAcT,EAAIU,kBAAkB,UAAYV,EAAIW,WAAWC,GAAG,CAAC,WAAaZ,EAAIS,eAAeI,YAAYb,EAAIc,GAAG,CAAC,CAACC,IAAI,UAAUC,GAAG,WAAW,MAAO,CAACd,EAAG,MAAM,CAACe,YAAY,QAAQ,CACrN,IAArCjB,EAAIkB,eAAeC,eAAuBnB,EAAI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UAAA,EAEA,IAAAuD,EAAAD,EAAAjC,OAAA,OACAmC,EAAAF,EAAAjC,OAAA,OAEAiC,EAAA1C,eAAAwC,4BAAAG,EACAD,EAAA1C,eAAAyC,yBAAAG,EACAF,EAAAR,mBAAAC,cAAAO,EAAA1C,eAEA6C,OAAAR,QACAS,4BAAAJ,EAAA1C,gBACA+C,MAAA,SAAAC,GACA,MAAAA,EAAAC,SACAP,EAAArD,iBAAA,EACAqD,EAAAQ,sBAAAR,EAAAR,oBAEAiB,YAAA,WACAT,EAAAnD,kBACA,UAGA6D,OAAA,SAAAC,GACAX,EAAApD,eAAA,KAEAgE,SAAA,WACAZ,EAAAtD,UAAA,MAIAmD,YAAA,SAAAgB,GACA,IAAAb,EAAA,KACA,QAAAc,KAAAC,MAAAf,EAAAgB,WAAAH,GAAA,eAGAG,WAAA,SAAAH,GACA,QAAAC,KAAAC,MAAAF,EAAA,mBC/JqY,I,YCOjYI,EAAY,eACd,EACA9E,EACAkC,GACA,EACA,KACA,KACA,MAIa,aAAA4C,E","file":"js/chunk-2d207b38.js?id=7e63664142a7aff93c06","sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return _c('ui-component-modal',{attrs:{\"modalTitle\":_vm.$t(\n      `Components.Settings.Yield.EditYieldSettings.Title_EditSpaceUtilization`\n    ),\"isSaving\":_vm.isSaving,\"isSavingSuccess\":_vm.isSavingSuccess,\"isSavingError\":_vm.isSavingError,\"hideSaveButton\":_vm.isSavingError || _vm.isSavingSuccess,\"buttonLabelCancel\":_vm.isSavingError || _vm.isSavingSuccess\n      ? _vm.$t(`Form.Control.Close`)\n      : _vm.$t(`Form.Control.Cancel`),\"onClickCancel\":_vm.onClickCancel,\"onClickSave\":_vm.saveYieldSettings,\"showModal\":_vm.showModal},on:{\"closeModal\":_vm.onClickCancel},scopedSlots:_vm._u([{key:\"content\",fn:function(){return [_c('div',{staticClass:\"py-4\"},[(\n        _vm.mYieldSettings.MeetingtypeId === 1 || _vm.mYieldSettings.VoucherId > 0\n      )?_c('table',{staticClass:\"table is-fullwidth\"},[_c('tbody',[(_vm.mYieldSettings.ApplySpaceUtilization)?_c('tr',[_c('td',{attrs:{\"width\":\"100\"}},[_vm._v(\" 0% \"+_vm._s(_vm.$t( `Components.Settings.Yield.EditYieldSettings.Label_Utilization` ))+\" \")]),_c('td',[_c('vue-slider',{attrs:{\"direction\":\"rtl\",\"min\":0,\"max\":200,\"minRange\":1,\"interval\":1,\"tooltip-formatter\":_vm.formatter},model:{value:(_vm.values),callback:function ($$v) {_vm.values=$$v},expression:\"values\"}})],1),_c('td',{attrs:{\"width\":\"100\"}},[_vm._v(\" 100% \"+_vm._s(_vm.$t( `Components.Settings.Yield.EditYieldSettings.Label_Utilization` ))+\" \")])]):_vm._e()])]):_vm._e()])]},proxy:true}])})\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n  <ui-component-modal\n    :modalTitle=\"\n      $t(\n        `Components.Settings.Yield.EditYieldSettings.Title_EditSpaceUtilization`\n      )\n    \"\n    :isSaving=\"isSaving\"\n    :isSavingSuccess=\"isSavingSuccess\"\n    :isSavingError=\"isSavingError\"\n    :hideSaveButton=\"isSavingError || isSavingSuccess\"\n    :buttonLabelCancel=\"\n      isSavingError || isSavingSuccess\n        ? $t(`Form.Control.Close`)\n        : $t(`Form.Control.Cancel`)\n    \"\n    :onClickCancel=\"onClickCancel\"\n    :onClickSave=\"saveYieldSettings\"\n    :showModal=\"showModal\"\n    @closeModal=\"onClickCancel\"\n  >\n    <template v-slot:content>\n      <div class=\"py-4\">\n        <table\n          v-if=\"\n          mYieldSettings.MeetingtypeId === 1 || mYieldSettings.VoucherId > 0\n        \"\n          class=\"table is-fullwidth\"\n        >\n          <tbody>\n            <tr v-if=\"mYieldSettings.ApplySpaceUtilization\">\n              <td width=\"100\">\n                0%\n                {{\n                $t(\n                  `Components.Settings.Yield.EditYieldSettings.Label_Utilization`\n                )\n              }}\n              </td>\n              <td>\n                <vue-slider\n                  v-model=\"values\"\n                  direction=\"rtl\"\n                  :min=\"0\"\n                  :max=\"200\"\n                  :minRange=\"1\"\n                  :interval=\"1\"\n                  :tooltip-formatter=\"formatter\"\n                ></vue-slider>\n              </td>\n              <td width=\"100\">\n                100%\n                {{\n                $t(\n                  `Components.Settings.Yield.EditYieldSettings.Label_Utilization`\n                )\n              }}\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 yieldProvider from '@/providers/yield'\nimport VueSlider from 'vue-slider-component'\nimport 'vue-slider-component/theme/default.css'\n\nexport default {\n  components: {\n    VueSlider,\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      formatter: (v) => `${v - 100}%`,\n      isSaving: false,\n      isSavingSuccess: false,\n      isSavingError: false,\n      mYieldSettings: null,\n      values: [],\n    }\n  },\n\n  computed: {\n    ...mapState('yieldStore', ['yieldSettingsState']),\n  },\n\n  created() {\n    this.mYieldSettings = JSON.parse(\n      JSON.stringify(this.yieldSettingsState.yieldSettings)\n    )\n\n    this.values = this.spaceValues()\n  },\n\n  methods: {\n    ...mapMutations('yieldStore', ['setYieldSettingsState']),\n\n    spaceValues() {\n      return [\n        this.roundToZero(this.mYieldSettings.SpaceUtilizationBottomValue * 100),\n        this.roundToZero(this.mYieldSettings.SpaceUtilizationTopValue * 100),\n      ]\n    },\n\n    saveYieldSettings() {\n      let self = this\n      self.isSaving = true\n\n      let bottomValue = self.values[1] / 100\n      let topValue = self.values[0] / 100\n\n      self.mYieldSettings.SpaceUtilizationBottomValue = bottomValue\n      self.mYieldSettings.SpaceUtilizationTopValue = topValue\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    roundToZero(num) {\n      let self = this\n      return +(Math.round(self.roundToTwo(num) + 'e+0') + 'e-0')\n    },\n\n    roundToTwo(num) {\n      return +(Math.round(num + 'e+2') + 'e-2')\n    },\n  },\n}\n</script>\n\n<style></style>\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!./ModalEditYieldSpaceUtilization.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!./ModalEditYieldSpaceUtilization.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./ModalEditYieldSpaceUtilization.vue?vue&type=template&id=983229e6\"\nimport script from \"./ModalEditYieldSpaceUtilization.vue?vue&type=script&lang=js\"\nexport * from \"./ModalEditYieldSpaceUtilization.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":""}