{"version":3,"sources":["webpack:///./src/components/Reservations/ModalDeletePayment.vue","webpack:///src/components/Reservations/ModalDeletePayment.vue","webpack:///./src/components/Reservations/ModalDeletePayment.vue?9466","webpack:///./src/components/Reservations/ModalDeletePayment.vue?40b2"],"names":["render","_vm","this","_c","_self","attrs","$t","isDeleting","isDeletingError","isDeleteConfirmed","onClickCancel","deletePayment","showModal","on","scopedSlots","_u","key","fn","staticClass","_v","_s","_f","payment","Amount","locationState","Settings","LanguageCulture","CurrencyIso","model","value","callback","$$v","expression","proxy","staticRenderFns","BaseCheckbox","components","props","type","Object","default","Boolean","Function","required","data","computed","_objectSpread","mapState","created","methods","mapMutations","_this","self","paymentProvider","Id","then","response","status","isDeletingSuccess","$emit","reservation","TotalOpen","TotalPaid","setReservation","EventBus","message","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,yDAAyD,sBAAwB,YAAY,mBAAqBL,EAAIK,GAAG,uBAAuB,SAAWL,EAAIM,WAAW,cAAgBN,EAAIO,gBAAgB,kBAAoBP,EAAIO,gBAAgB,mBAAqBP,EAAIQ,kBAAkB,cAAgBR,EAAIS,cAAc,YAAcT,EAAIU,cAAc,UAAYV,EAAIW,WAAWC,GAAG,CAAC,WAAaZ,EAAIS,eAAeI,YAAYb,EAAIc,GAAG,CAAC,CAACC,IAAI,UAAUC,GAAG,WAAW,MAAO,CAACd,EAAG,MAAM,CAACe,YAAY,iDAAiD,CAACjB,EAAIkB,GAAG,IAAIlB,EAAImB,GAAGnB,EAAIoB,GAAG,aAAPpB,CAAqBA,EAAIqB,QAAQC,OAAQtB,EAAIuB,cAAcC,SAASC,gBAAiBzB,EAAIqB,QAAQK,cAAe,OAAOxB,EAAG,MAAM,CAACe,YAAY,qBAAqB,CAACf,EAAG,eAAe,CAACe,YAAY,gBAAgB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('ui-component-modal',{attrs:{\"modalTitle\":_vm.$t('Components.Reservations.ModalDeletePayment.Main_Title'),\"confirmButtonCssClass\":\"is-danger\",\"buttonLabelConfirm\":_vm.$t('Form.Control.Delete'),\"isSaving\":_vm.isDeleting,\"isSavingError\":_vm.isDeletingError,\"hideFooterButtons\":_vm.isDeletingError,\"disableSaveButton\":!_vm.isDeleteConfirmed,\"onClickCancel\":_vm.onClickCancel,\"onClickSave\":_vm.deletePayment,\"showModal\":_vm.showModal},on:{\"closeModal\":_vm.onClickCancel},scopedSlots:_vm._u([{key:\"content\",fn:function(){return [_c('div',{staticClass:\"has-margin-bottom is-size-5 has-text-centered\"},[_vm._v(\" \"+_vm._s(_vm._f(\"toCurrency\")(_vm.payment.Amount, _vm.locationState.Settings.LanguageCulture, _vm.payment.CurrencyIso ))+\" \")]),_c('div',{staticClass:\"has-text-centered\"},[_c('BaseCheckbox',{staticClass:\"has-text-left\",attrs:{\"label\":_vm.$t('Components.Reservations.ModalDeletePayment.Text_YesSure')},model:{value:(_vm.isDeleteConfirmed),callback:function ($$v) {_vm.isDeleteConfirmed=$$v},expression:\"isDeleteConfirmed\"}})],1)]},proxy:true}])})\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n  <ui-component-modal\n    :modalTitle=\"$t('Components.Reservations.ModalDeletePayment.Main_Title')\"\n    confirmButtonCssClass=\"is-danger\"\n    :buttonLabelConfirm=\"$t('Form.Control.Delete')\"\n    :isSaving=\"isDeleting\"\n    :isSavingError=\"isDeletingError\"\n    :hideFooterButtons=\"isDeletingError\"\n    :disableSaveButton=\"!isDeleteConfirmed\"\n    :onClickCancel=\"onClickCancel\"\n    :onClickSave=\"deletePayment\"\n    :showModal=\"showModal\"\n    @closeModal=\"onClickCancel\"\n  >\n    <template v-slot:content>\n      <div class=\"has-margin-bottom is-size-5 has-text-centered\">\n        {{\n          payment.Amount\n            | toCurrency(\n              locationState.Settings.LanguageCulture,\n              payment.CurrencyIso\n            )\n        }}\n      </div>\n      <div class=\"has-text-centered\">\n        <BaseCheckbox\n          v-model=\"isDeleteConfirmed\"\n          class=\"has-text-left\"\n          :label=\"$t('Components.Reservations.ModalDeletePayment.Text_YesSure')\"\n        />\n      </div>\n    </template>\n  </ui-component-modal>\n</template>\n\n<script>\nimport { mapState, mapMutations } from 'vuex'\nimport { EventBus } from '@/eventbus/event-bus'\nimport paymentProvider from '@/providers/payment'\nconst BaseCheckbox = () => import('@/components/UI/Form/BaseCheckbox')\n\nexport default {\n  components: {\n    BaseCheckbox,\n  },\n\n  props: {\n    payment: {\n      type: Object,\n      default: null,\n    },\n\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      isDeleteConfirmed: false,\n      isDeleting: false,\n      isDeletingError: false,\n    }\n  },\n\n  computed: {\n    ...mapState('locationStore', ['locationState']),\n    ...mapState('reservationStore', ['reservation']),\n  },\n\n  created() { },\n\n  methods: {\n    ...mapMutations('reservationStore', ['setReservation']),\n\n    deletePayment() {\n      let self = this\n      if (!self.isDeleteConfirmed) return;\n\n      self.isDeleting = true\n\n      paymentProvider.methods\n        .deletePayment(self.payment.Id)\n        .then((response) => {\n          if (response.status === 204) {\n            self.isDeletingSuccess = true\n            self.$emit('paymentDeleted', self.payment)\n\n            self.reservation.TotalOpen =\n              self.reservation.TotalOpen + self.payment.Amount\n            self.reservation.TotalPaid =\n              self.reservation.TotalPaid - self.payment.Amount\n\n            // Update reservation store\n            self.setReservation(self.reservation)\n\n            // Send message to display toast on screen\n            EventBus.$emit('showToast', {\n              type: 'info',\n              message: this.$t(\n                'Components.Reservations.ModalDeletePayment.Toast_PaymentDeleted'\n              ),\n            })\n\n            this.onClickCancel()\n          }\n        })\n        .catch((error) => {\n          self.isDeletingError = true\n        })\n        .finally(() => {\n          self.isDeleting = 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!./ModalDeletePayment.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!./ModalDeletePayment.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./ModalDeletePayment.vue?vue&type=template&id=56c86ed0\"\nimport script from \"./ModalDeletePayment.vue?vue&type=script&lang=js\"\nexport * from \"./ModalDeletePayment.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":""}