{"version":3,"sources":["webpack:///./src/components/Reservations/ModalAddComment.vue","webpack:///src/components/Reservations/ModalAddComment.vue","webpack:///./src/components/Reservations/ModalAddComment.vue?cfb5","webpack:///./src/components/Reservations/ModalAddComment.vue?c6e8"],"names":["render","_vm","this","_c","_self","attrs","$t","isSaving","isSavingError","onClickCancel","saveNewComment","showModal","noText","on","scopedSlots","_u","key","fn","newComment","ItemId","directives","name","rawName","value","Text","expression","staticClass","domProps","$event","target","composing","$set","_e","proxy","slot","staticRenderFns","components","props","type","Boolean","default","Function","required","data","computed","_objectSpread","mapState","result","created","setNewComment","methods","mapMutations","_this","self","ReservationId","reservation","Id","Comment","$options","filters","stripHtml","reservationProvider","addReservationComment","Key","then","response","status","setReservation","EventBus","$emit","message","catch","error","finally","comment","component"],"mappings":"yHAAA,IAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,qBAAqB,CAACE,MAAM,CAAC,WAAaJ,EAAIK,GAAG,qDAAqD,SAAWL,EAAIM,SAAS,cAAgBN,EAAIO,cAAc,kBAAoBP,EAAIO,cAAc,cAAgBP,EAAIQ,cAAc,YAAcR,EAAIS,eAAe,UAAYT,EAAIU,UAAU,kBAAoBV,EAAIW,QAAQC,GAAG,CAAC,WAAaZ,EAAIQ,eAAeK,YAAYb,EAAIc,GAAG,CAAC,CAACC,IAAI,UAAUC,GAAG,WAAW,MAAO,CAAEhB,EAAIiB,WAAWC,OAAQhB,EAAG,MAAM,CAACA,EAAG,WAAW,CAACiB,WAAW,CAAC,CAACC,KAAK,QAAQC,QAAQ,UAAUC,MAAOtB,EAAIiB,WAAWM,KAAMC,WAAW,oBAAoBC,YAAY,WAAWC,SAAS,CAAC,MAAS1B,EAAIiB,WAAWM,MAAOX,GAAG,CAAC,MAAQ,SAASe,GAAWA,EAAOC,OAAOC,WAAiB7B,EAAI8B,KAAK9B,EAAIiB,WAAY,OAAQU,EAAOC,OAAON,aAAatB,EAAI+B,OAAOC,OAAM,MAAS,CAAC9B,EAAG,WAAW,CAAC+B,KAAK,gBAAgB,IAEp3BC,EAAkB,G,4DC4BP,GACfC,WAAA,GAEAC,MAAA,CACA1B,UAAA,CACA2B,KAAAC,QACAC,SAAA,GAGA/B,cAAA,CACA6B,KAAAG,SACAC,UAAA,IAIAC,KAAA,WACA,OACApC,UAAA,EACAC,eAAA,EACAU,WAAA,KAIA0B,SAAAC,8BAAA,GACAC,eAAA,yCAEAlC,OAAA,WACA,IAAAmC,GAAA,EAKA,MAHA,UAAA7B,WAAAM,OACAuB,GAAA,GAEAA,KAIAC,QAAA,WACA,KAAA9B,WAAA,KAAA+B,iBAGAC,QAAAL,8BAAA,GACAM,eAAA,4CAEAzC,eAAA,eAAA0C,EAAA,KACAC,EAAA,KACAA,EAAA9C,WACA8C,EAAA9C,UAAA,GAGA,IAAAoC,EAAA,CACAW,cAAA,KAAAC,YAAAC,GACAC,QAAA,KAAAC,SAAAC,QAAAC,UAAA,KAAA1C,WAAAM,OAGAqC,OAAAX,QACAY,sBAAA,KAAAP,YAAAQ,IAAApB,GACAqB,MAAA,SAAAC,GACA,MAAAA,EAAAC,SACAd,EAAAe,eAAAF,EAAAtB,MAEAyB,OAAAC,MAAA,aACA/B,KAAA,OACAgC,QAAAlB,EAAA9C,GACA,+DAIA+C,EAAA5C,oBAGA8D,OAAA,SAAAC,GAEAnB,EAAA7C,eAAA,KAEAiE,SAAA,WACApB,EAAA9C,UAAA,MAIA0C,cAAA,WACA,IAAAyB,EAAA,CACAvD,OAAA,KAAAoC,YAAAC,GACAhC,KAAA,IAEA,OAAAkD,MClHuW,I,YCOnWC,EAAY,eACd,EACA3E,EACAmC,GACA,EACA,KACA,KACA,MAIa,aAAAwC,E","file":"js/chunk-2d0bd39a.js?id=481435815b209c113ae0","sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return _c('ui-component-modal',{attrs:{\"modalTitle\":_vm.$t('Components.Reservation.ModalAddComment.Main_Title'),\"isSaving\":_vm.isSaving,\"isSavingError\":_vm.isSavingError,\"hideFooterButtons\":_vm.isSavingError,\"onClickCancel\":_vm.onClickCancel,\"onClickSave\":_vm.saveNewComment,\"showModal\":_vm.showModal,\"disableSaveButton\":_vm.noText},on:{\"closeModal\":_vm.onClickCancel},scopedSlots:_vm._u([{key:\"content\",fn:function(){return [(_vm.newComment.ItemId)?_c('div',[_c('textarea',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.newComment.Text),expression:\"newComment.Text\"}],staticClass:\"textarea\",domProps:{\"value\":(_vm.newComment.Text)},on:{\"input\":function($event){if($event.target.composing)return;_vm.$set(_vm.newComment, \"Text\", $event.target.value)}}})]):_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.Reservation.ModalAddComment.Main_Title')\"\n    :isSaving=\"isSaving\"\n    :isSavingError=\"isSavingError\"\n    :hideFooterButtons=\"isSavingError\"\n    :onClickCancel=\"onClickCancel\"\n    :onClickSave=\"saveNewComment\"\n    :showModal=\"showModal\"\n    @closeModal=\"onClickCancel\"\n    :disableSaveButton=\"noText\"\n  >\n    <template slot=\"modalTitle\"></template>\n    <template v-slot:content>\n      <div v-if=\"newComment.ItemId\">\n        <textarea\n          v-model=\"newComment.Text\"\n          class=\"textarea\"\n        ></textarea>\n      </div>\n    </template>\n  </ui-component-modal>\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { mapState, mapMutations } from 'vuex'\nimport { EventBus } from '@/eventbus/event-bus'\nimport reservationProvider from '@/providers/reservation'\n\nexport default {\n  components: {},\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      isSavingError: false,\n      newComment: {},\n    }\n  },\n\n  computed: {\n    ...mapState('reservationStore', ['reservation']),\n\n    noText() {\n      let result = true\n\n      if (this.newComment.Text !== '') {\n        result = false\n      }\n      return result\n    },\n  },\n\n  created() {\n    this.newComment = this.setNewComment()\n  },\n\n  methods: {\n    ...mapMutations('reservationStore', ['setReservation']),\n\n    saveNewComment() {\n      let self = this\n      if (!self.isSaving) {\n        self.isSaving = true\n      }\n\n      let data = {\n        ReservationId: this.reservation.Id,\n        Comment: this.$options.filters.stripHtml(this.newComment.Text)\n      }\n\n      reservationProvider.methods\n        .addReservationComment(this.reservation.Key, data)\n        .then((response) => {\n          if (response.status === 200) {\n            this.setReservation(response.data);\n\n            EventBus.$emit('showToast', {\n              type: 'info',\n              message: this.$t(\n                'Components.Reservation.ModalAddComment.Toast_CommentAdded'\n              ),\n            })\n\n            self.onClickCancel();\n          }\n        })\n        .catch((error) => {\n          //console.log(error.response)\n          self.isSavingError = true\n        })\n        .finally(() => {\n          self.isSaving = false\n        })\n    },\n\n    setNewComment() {\n      let comment = {\n        ItemId: this.reservation.Id,\n        Text: '',\n      }\n      return comment\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!./ModalAddComment.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!./ModalAddComment.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./ModalAddComment.vue?vue&type=template&id=270d12de\"\nimport script from \"./ModalAddComment.vue?vue&type=script&lang=js\"\nexport * from \"./ModalAddComment.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":""}