{"version":3,"sources":["webpack:///./src/components/Settings/Notifications/ModalEditNotificationRules.vue","webpack:///src/components/Settings/Notifications/ModalEditNotificationRules.vue","webpack:///./src/components/Settings/Notifications/ModalEditNotificationRules.vue?2cd9","webpack:///./src/components/Settings/Notifications/ModalEditNotificationRules.vue?38ad"],"names":["render","_vm","this","_c","_self","attrs","$t","isSaving","isSavingSuccess","isSavingError","onClickCancel","saveNotificationRules","showModal","on","scopedSlots","_u","key","fn","staticClass","_v","_s","_l","mNotificationRules","filter","n","MeetingtypeId","meetingtypeId","notificationRule","index","ChangeType","class","IsActive","$event","SendMail","proxy","slot","staticRenderFns","components","props","type","Boolean","default","Function","required","Number","notificationRules","Array","data","actionTypes","locationId","$route","params","JSON","parse","stringify","computed","_objectSpread","mapState","created","length","getProfileLocationNotificationRules","methods","_this","self","isLoading","notificationProvider","then","response","status","_loop","i","_loop2","meetingtype","locationState","Meetingtypes","j","isActive","sendMail","storedRule","find","r","MeetingTypeId","push","LocationId","finally","saveProfileLocationNotificationRules","$emit","setTimeout","catch","error","component"],"mappings":"qKAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,qBAAqB,CAACE,MAAM,CAAC,WAAaJ,EAAIK,GAC9G,4EACA,SAAWL,EAAIM,SAAS,gBAAkBN,EAAIO,gBAAgB,cAAgBP,EAAIQ,cAAc,kBAAoBR,EAAIQ,eAAiBR,EAAIO,gBAAgB,cAAgBP,EAAIS,cAAc,YAAcT,EAAIU,sBAAsB,UAAYV,EAAIW,WAAWC,GAAG,CAAC,WAAaZ,EAAIS,eAAeI,YAAYb,EAAIc,GAAG,CAAC,CAACC,IAAI,UAAUC,GAAG,WAAW,MAAO,CAACd,EAAG,QAAQ,CAACe,YAAY,wDAAwD,CAACf,EAAG,QAAQ,CAACA,EAAG,KAAK,CAACA,EAAG,KAAK,CAACF,EAAIkB,GAAG,IAAIlB,EAAImB,GAAGnB,EAAIK,GAAI,qFA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AU,EAAAC,gBAAAT,EAAA/C,iBAGAqD,IACAF,EAAAE,EAAA/C,SACA8C,EAAAC,EAAA7C,UAGA8B,EAAAzC,mBAAA4D,KAAA,CACAC,WAAArB,EAAAb,WACAxB,cAAA+C,EAAA/C,cACAI,WAAAiC,EAAAd,YAAAsB,GACAvC,SAAA6C,EACA3C,SAAA4C,KAzBAF,EAAA,EACAA,EAAAb,EAAAW,cAAAC,aAAAf,OACAgB,IAAAJ,KAJAD,EAAA,EAAAA,EAAAR,EAAAd,YAAAW,OAAAW,IAAAD,EAAAC,MAiCAc,SAAA,WACArB,EAAAC,WAAA,OAKArD,sBAAA,WACA,IAAAoD,EAAA,KAEAA,EAAAxD,WACAwD,EAAAxD,UAAA,EAEA0D,OAAAJ,QACAwB,qCACAtB,EAAAd,WACAc,EAAAzC,oBAEA4C,MAAA,SAAAC,GACA,MAAAA,EAAAC,SACAL,EAAAvD,iBAAA,EAEAuD,EAAAuB,MAAA,2BAAAnB,EAAApB,MAEAwC,YAAA,WACAxB,EAAArD,kBACA,SAGA8E,OAAA,SAAAC,GACA1B,EAAAtD,eAAA,KAEA2E,SAAA,WACArB,EAAAxD,UAAA,SCjPiY,I,YCO7XmF,EAAY,eACd,EACA1F,EACAoC,GACA,EACA,KACA,KACA,MAIa,aAAAsD,E","file":"js/chunk-2d0c5796.js?id=2d298c31a63ced1bfab7","sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return _c('ui-component-modal',{attrs:{\"modalTitle\":_vm.$t(\n      'Components.Settings.Notifications.ModalEditNotificationRules.Modal_Title'\n    ),\"isSaving\":_vm.isSaving,\"isSavingSuccess\":_vm.isSavingSuccess,\"isSavingError\":_vm.isSavingError,\"hideFooterButtons\":_vm.isSavingError || _vm.isSavingSuccess,\"onClickCancel\":_vm.onClickCancel,\"onClickSave\":_vm.saveNotificationRules,\"showModal\":_vm.showModal},on:{\"closeModal\":_vm.onClickCancel},scopedSlots:_vm._u([{key:\"content\",fn:function(){return [_c('table',{staticClass:\"table is-narrow is-fullwidth is-striped is-hoverable\"},[_c('thead',[_c('tr',[_c('th',[_vm._v(\" \"+_vm._s(_vm.$t( 'Components.Settings.Notifications.ModalEditNotificationRules.Header_Notification' ))+\" \")]),_c('th',[_vm._v(\" \"+_vm._s(_vm.$t( 'Components.Settings.Notifications.ModalEditNotificationRules.Header_Active' ))+\" \")]),_c('th',[_vm._v(\" \"+_vm._s(_vm.$t( 'Components.Settings.Notifications.ModalEditNotificationRules.Header_SendMail' ))+\" \")])])]),_c('tbody',_vm._l((_vm.mNotificationRules.filter(\n            (n) => n.MeetingtypeId === _vm.meetingtypeId\n          )),function(notificationRule,index){return _c('tr',{key:index,staticClass:\"has-text-vertical-middle\"},[_c('td',[_vm._v(\" \"+_vm._s(_vm.$t( 'Components.Settings.Notifications.NotificationRules.Type_' + notificationRule.ChangeType ))+\" \")]),_c('td',[_c('div',{staticClass:\"tabs is-toggle is-small\"},[_c('ul',[_c('li',{class:{ 'is-active': notificationRule.IsActive }},[_c('a',{on:{\"click\":function($event){notificationRule.IsActive = true}}},[_c('span',[_vm._v(_vm._s(_vm.$t('Form.Control.Yes')))])])]),_c('li',{class:{ 'is-active': !notificationRule.IsActive }},[_c('a',{on:{\"click\":function($event){notificationRule.IsActive = false}}},[_c('span',[_vm._v(_vm._s(_vm.$t('Form.Control.No')))])])])])])]),_c('td',[_c('div',{staticClass:\"tabs is-toggle is-small\"},[_c('ul',[_c('li',{class:{ 'is-active': notificationRule.SendMail }},[_c('a',{on:{\"click\":function($event){notificationRule.SendMail = true}}},[_c('span',[_vm._v(_vm._s(_vm.$t('Form.Control.Yes')))])])]),_c('li',{class:{ 'is-active': !notificationRule.SendMail }},[_c('a',{on:{\"click\":function($event){notificationRule.SendMail = false}}},[_c('span',[_vm._v(_vm._s(_vm.$t('Form.Control.No')))])])])])])])])}),0)])]},proxy:true}])},[_c('template',{slot:\"modalTitle\"})],2)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n  <ui-component-modal\n    :modalTitle=\"\n      $t(\n        'Components.Settings.Notifications.ModalEditNotificationRules.Modal_Title'\n      )\n    \"\n    :isSaving=\"isSaving\"\n    :isSavingSuccess=\"isSavingSuccess\"\n    :isSavingError=\"isSavingError\"\n    :hideFooterButtons=\"isSavingError || isSavingSuccess\"\n    :onClickCancel=\"onClickCancel\"\n    :onClickSave=\"saveNotificationRules\"\n    :showModal=\"showModal\"\n    @closeModal=\"onClickCancel\"\n  >\n    <template slot=\"modalTitle\"></template>\n    <template v-slot:content>\n      <table class=\"table is-narrow is-fullwidth is-striped is-hoverable\">\n        <thead>\n          <tr>\n            <th>\n              {{\n                $t(\n                  'Components.Settings.Notifications.ModalEditNotificationRules.Header_Notification'\n                )\n              }}\n            </th>\n            <th>\n              {{\n                $t(\n                  'Components.Settings.Notifications.ModalEditNotificationRules.Header_Active'\n                )\n              }}\n            </th>\n            <th>\n              {{\n                $t(\n                  'Components.Settings.Notifications.ModalEditNotificationRules.Header_SendMail'\n                )\n              }}\n            </th>\n          </tr>\n        </thead>\n        <tbody>\n          <tr\n            v-for=\"(notificationRule, index) in mNotificationRules.filter(\n              (n) => n.MeetingtypeId === meetingtypeId\n            )\"\n            :key=\"index\"\n            class=\"has-text-vertical-middle\"\n          >\n            <td>\n              {{\n                $t(\n                  'Components.Settings.Notifications.NotificationRules.Type_' +\n                    notificationRule.ChangeType\n                )\n              }}\n            </td>\n            <td>\n              <div class=\"tabs is-toggle is-small\">\n                <ul>\n                  <li :class=\"{ 'is-active': notificationRule.IsActive }\">\n                    <a @click=\"notificationRule.IsActive = true\">\n                      <span>{{ $t('Form.Control.Yes') }}</span>\n                    </a>\n                  </li>\n                  <li :class=\"{ 'is-active': !notificationRule.IsActive }\">\n                    <a @click=\"notificationRule.IsActive = false\">\n                      <span>{{ $t('Form.Control.No') }}</span>\n                    </a>\n                  </li>\n                </ul>\n              </div>\n            </td>\n            <td>\n              <div class=\"tabs is-toggle is-small\">\n                <ul>\n                  <li :class=\"{ 'is-active': notificationRule.SendMail }\">\n                    <a @click=\"notificationRule.SendMail = true\">\n                      <span>{{ $t('Form.Control.Yes') }}</span>\n                    </a>\n                  </li>\n                  <li :class=\"{ 'is-active': !notificationRule.SendMail }\">\n                    <a @click=\"notificationRule.SendMail = false\">\n                      <span>{{ $t('Form.Control.No') }}</span>\n                    </a>\n                  </li>\n                </ul>\n              </div>\n            </td>\n          </tr>\n        </tbody>\n      </table>\n    </template>\n  </ui-component-modal>\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { mapState, mapMutations } from 'vuex'\nimport notificationProvider from '@/providers/notification'\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    meetingtypeId: {\n      type: Number,\n      default: 0,\n    },\n\n    notificationRules: {\n      type: Array,\n      default: function() {\n        return []\n      },\n    },\n  },\n\n  data() {\n    return {\n      actionTypes: [\n        'NewReservation',\n        'EditReservation',\n        'CancelReservation',\n        'NewReservationComment',\n        'NewReview',\n        'NewReviewComment',\n        'NewInvoice',\n        'CreditInvoice',\n        'NewProposalRequest',\n        'ProposalAccepted',\n        'ProposalRejected',\n        'ProposalChangeRequest',\n      ],\n      isSaving: false,\n      isSavingSuccess: false,\n      isSavingError: false,\n      locationId: Number(this.$route.params.locationId),\n      mNotificationRules: JSON.parse(JSON.stringify(this.notificationRules)),\n    }\n  },\n\n  computed: {\n    ...mapState('locationStore', ['locationState']),\n  },\n\n  created() {\n    if (this.mNotificationRules.length === 0) {\n      this.getProfileLocationNotificationRules()\n    }\n  },\n\n  methods: {\n    getProfileLocationNotificationRules() {\n      let self = this\n\n      if (!self.isLoading) {\n        self.isLoading = true\n\n        notificationProvider.methods\n          .getProfileLocationNotificationRules(self.locationId)\n          .then((response) => {\n            if (response.status === 200) {\n              for (let i = 0; i < this.actionTypes.length; i++) {\n                for (\n                  let j = 0;\n                  j < this.locationState.Meetingtypes.length;\n                  j++\n                ) {\n                  let meetingtype = this.locationState.Meetingtypes[j]\n\n                  let isActive = false\n                  let sendMail = false\n\n                  let storedRule = response.data.find(\n                    (r) =>\n                      r.ChangeType === this.actionTypes[i] &&\n                      r.MeetingTypeId === meetingtype.MeetingtypeId\n                  )\n\n                  if (storedRule) {\n                    isActive = storedRule.IsActive\n                    sendMail = storedRule.SendMail\n                  }\n\n                  self.mNotificationRules.push({\n                    LocationId: this.locationId,\n                    MeetingtypeId: meetingtype.MeetingtypeId,\n                    ChangeType: this.actionTypes[i],\n                    IsActive: isActive,\n                    SendMail: sendMail,\n                  })\n                }\n              }\n            }\n          })\n          .finally(() => {\n            self.isLoading = false\n          })\n      }\n    },\n\n    saveNotificationRules() {\n      let self = this\n\n      if (!self.isSaving) {\n        self.isSaving = true\n\n        notificationProvider.methods\n          .saveProfileLocationNotificationRules(\n            self.locationId,\n            self.mNotificationRules\n          )\n          .then((response) => {\n            if (response.status === 200) {\n              self.isSavingSuccess = true\n\n              self.$emit('notificationRulesUpdates', response.data)\n\n              setTimeout(() => {\n                self.onClickCancel()\n              }, 1000)\n            }\n          })\n          .catch((error) => {\n            self.isSavingError = true\n          })\n          .finally(() => {\n            self.isSaving = false\n          })\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!./ModalEditNotificationRules.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!./ModalEditNotificationRules.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./ModalEditNotificationRules.vue?vue&type=template&id=653d8006\"\nimport script from \"./ModalEditNotificationRules.vue?vue&type=script&lang=js\"\nexport * from \"./ModalEditNotificationRules.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":""}