{"version":3,"sources":["webpack:///./src/components/Options/OptionTimeSelector.vue","webpack:///src/components/Options/OptionTimeSelector.vue","webpack:///./src/components/Options/OptionTimeSelector.vue?b6eb","webpack:///./src/components/Options/OptionTimeSelector.vue?efe2"],"names":["render","_vm","this","_c","_self","option","attrs","formatter","on","saveOption","model","value","values","callback","$$v","expression","_e","staticRenderFns","components","VueSlider","props","type","Object","default","data","_this","v","concat","$options","filters","minutesToTime","isSaving","mOption","computed","_objectSpread","mapState","created","Location","AvailableStart","AvailableEnd","JSON","parse","stringify","methods","mapMutations","_this2","self","optionProvider","saveLocationOptionSettings","then","response","status","index","optionsPageState","options","findIndex","o","Id","Vue","set","setOptionsPageState","EventBus","$emit","message","catch","e","isSavingError","finally","component"],"mappings":"iJAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAQF,EAAII,OAAQF,EAAG,MAAM,CAACA,EAAG,YAAY,CAACG,MAAM,CAAC,IAAM,EAAE,IAAM,KAAK,aAAc,EAAM,SAAW,GAAG,QAAU,SAAS,oBAAoBL,EAAIM,WAAWC,GAAG,CAAC,WAAWP,EAAIQ,YAAYC,MAAM,CAACC,MAAOV,EAAIW,OAAQC,SAAS,SAAUC,GAAMb,EAAIW,OAAOE,GAAKC,WAAW,aAAa,GAAGd,EAAIe,MAEzVC,EAAkB,G,iHCsBP,G,UAAA,CACfC,WAAA,CACAC,eAGAC,MAAA,CACAf,OAAA,CACAgB,KAAAC,OACAC,QAAA,OAIAC,KAAA,eAAAC,EAAA,KACA,OACAlB,UAAA,SAAAmB,GAAA,SAAAC,OAAAF,EAAAG,SAAAC,QAAAC,cAAAJ,KACAd,OAAA,GACAmB,UAAA,EACAC,QAAA,OAIAC,SAAAC,eAAA,GACAC,eAAA,qCAGAC,QAAA,WACA,KAAAxB,OAAA,CACA,KAAAP,OAAAgC,SAAAC,eACA,KAAAjC,OAAAgC,SAAAE,cAGA,KAAAP,QAAAQ,KAAAC,MAAAD,KAAAE,UAAA,KAAArC,UAGAsC,QAAAT,8BAAA,GACAU,eAAA,4CAEAnC,WAAA,eAAAoC,EAAA,KACAC,EAAA,KACAA,EAAAf,WACAe,EAAAf,UAAA,EAEA,KAAAC,QAAAQ,KAAAC,MAAAD,KAAAE,UAAA,KAAAV,UACAc,EAAAd,QAAAK,SAAAC,eAAA,KAAA1B,OAAA,GACAkC,EAAAd,QAAAK,SAAAE,aAAA,KAAA3B,OAAA,GAEAmC,OAAAJ,QACAK,2BAAA,KAAAhB,QAAAK,UACAY,MAAA,SAAAC,GACA,SAAAA,EAAAC,OAAA,CACA,IAAAC,EAAAP,EAAAQ,iBAAAC,QAAAC,WACA,SAAAC,GAAA,OAAAA,EAAAC,KAAAP,EAAA1B,KAAAiC,MAEAL,GAAA,IACAM,aAAAC,IAAAd,EAAAQ,iBAAAC,QAAAF,EAAAF,EAAA1B,MAEAqB,EAAAe,oBAAAf,EAAAQ,mBAIAQ,OAAAC,MAAA,aACAzC,KAAA,OACA0C,QAAA,0BAIAC,OAAA,SAAAC,GACAnB,EAAAoB,eAAA,KAEAC,SAAA,WACArB,EAAAf,UAAA,WC9F0W,I,YCOtWqC,EAAY,eACd,EACApE,EACAiB,GACA,EACA,KACA,KACA,MAIa,aAAAmD,E","file":"js/chunk-2d0b6384.js?id=584cee527ffc5026c818","sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return (_vm.option)?_c('div',[_c('VueSlider',{attrs:{\"min\":0,\"max\":1440,\"enableCross\":false,\"interval\":30,\"tooltip\":'always',\"tooltip-formatter\":_vm.formatter},on:{\"drag-end\":_vm.saveOption},model:{value:(_vm.values),callback:function ($$v) {_vm.values=$$v},expression:\"values\"}})],1):_vm._e()\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n  <div v-if=\"option\">\n    <VueSlider\n      v-model=\"values\"\n      :min=\"0\"\n      :max=\"1440\"\n      :enableCross=\"false\"\n      :interval=\"30\"\n      :tooltip=\"'always'\"\n      :tooltip-formatter=\"formatter\"\n      @drag-end=\"saveOption\"\n    />\n  </div>\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { mapState, mapMutations } from 'vuex'\nimport { EventBus } from '@/eventbus/event-bus'\nimport optionProvider from '@/providers/option'\n\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    option: {\n      type: Object,\n      default: null,\n    },\n  },\n\n  data() {\n    return {\n      formatter: (v) => `${this.$options.filters.minutesToTime(v)}`,\n      values: [],\n      isSaving: false,\n      mOption: null\n    }\n  },\n\n  computed: {\n    ...mapState('optionStore', ['optionsPageState']),\n  },\n\n  created() {\n    this.values = [\n      this.option.Location.AvailableStart,\n      this.option.Location.AvailableEnd,\n    ]\n\n    this.mOption = JSON.parse(JSON.stringify(this.option))\n  },\n\n  methods: {\n    ...mapMutations('optionStore', ['setOptionsPageState']),\n\n    saveOption() {\n      let self = this\n      if (!self.isSaving) {\n        self.isSaving = true\n\n        this.mOption = JSON.parse(JSON.stringify(this.mOption))\n        self.mOption.Location.AvailableStart = this.values[0]\n        self.mOption.Location.AvailableEnd = this.values[1]\n\n        optionProvider.methods\n          .saveLocationOptionSettings(this.mOption.Location)\n          .then((response) => {\n            if (response.status === 200) {\n              let index = this.optionsPageState.options.findIndex(\n                (o) => o.Id === response.data.Id\n              )\n              if (index > -1) {\n                Vue.set(this.optionsPageState.options, index, response.data)\n\n                this.setOptionsPageState(this.optionsPageState)\n              }\n\n              // Send message to display toast on screen\n              EventBus.$emit('showToast', {\n                type: 'info',\n                message: 'Time slot updated',\n              })\n            }\n          })\n          .catch((e) => {\n            self.isSavingError = true\n          })\n          .finally(() => {\n            self.isSaving = false\n          })\n      }\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!./OptionTimeSelector.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!./OptionTimeSelector.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./OptionTimeSelector.vue?vue&type=template&id=2d244a50\"\nimport script from \"./OptionTimeSelector.vue?vue&type=script&lang=js\"\nexport * from \"./OptionTimeSelector.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":""}