{"version":3,"sources":["webpack:///./src/components/Settings/Payments/ModalAddPaymentProvider.vue","webpack:///src/components/Settings/Payments/ModalAddPaymentProvider.vue","webpack:///./src/components/Settings/Payments/ModalAddPaymentProvider.vue?6926","webpack:///./src/components/Settings/Payments/ModalAddPaymentProvider.vue?36c4"],"names":["render","_vm","this","_c","_self","attrs","isSaving","isSavingSuccess","isSavingError","onClickCancel","save","showModal","on","scopedSlots","_u","key","fn","staticClass","directives","name","rawName","value","newPaymentProvider","Provider","expression","$event","$$selectedVal","Array","prototype","filter","call","target","options","o","selected","map","val","_value","$set","multiple","domProps","_v","ProviderSecret","composing","IsDefault","isArray","_i","$$a","$$el","$$c","checked","$$v","$$i","concat","slice","proxy","slot","staticRenderFns","components","props","type","Boolean","default","Function","required","data","paymentProviders","computed","_objectSpread","mapState","created","resetNewPaymentProvider","methods","_this","self","merchantProvider","addLocationMerchant","locationState","Id","then","response","status","$emit","t","setTimeout","clearTimeout","catch","e","finally","ProviderId","component"],"mappings":"iMAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,qBAAqB,CAACE,MAAM,CAAC,WAAa,uBAAuB,SAAWJ,EAAIK,SAAS,gBAAkBL,EAAIM,gBAAgB,cAAgBN,EAAIO,cAAc,kBAAoBP,EAAIO,eAAiBP,EAAIM,gBAAgB,cAAgBN,EAAIQ,cAAc,YAAcR,EAAIS,KAAK,UAAYT,EAAIU,WAAWC,GAAG,CAAC,WAAaX,EAAIQ,eAAeI,YAAYZ,EAAIa,GAAG,CAAC,CAACC,IAAI,UAAUC,GAAG,WAAW,MAAO,CAACb,EAAG,MAAM,CAACc,YAAY,UAAU,CAACd,EAAG,SAAS,CAACe,WAAW,CAAC,CAACC,KAAK,QAAQC,QAAQ,UAAUC,MAAOpB,EAAIqB,mBAAmBC,SAAUC,WAAW,gCAAgCZ,GAAG,CAAC,OAAS,SAASa,GAAQ,IAAIC,EAAgBC,MAAMC,UAAU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KACA,KACA,MAIa,aAAAiC,E","file":"js/chunk-2d23714e.js?id=725ecb373757b9b41622","sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return _c('ui-component-modal',{attrs:{\"modalTitle\":\"Add payment provider\",\"isSaving\":_vm.isSaving,\"isSavingSuccess\":_vm.isSavingSuccess,\"isSavingError\":_vm.isSavingError,\"hideFooterButtons\":_vm.isSavingError || _vm.isSavingSuccess,\"onClickCancel\":_vm.onClickCancel,\"onClickSave\":_vm.save,\"showModal\":_vm.showModal},on:{\"closeModal\":_vm.onClickCancel},scopedSlots:_vm._u([{key:\"content\",fn:function(){return [_c('div',{staticClass:\"select\"},[_c('select',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.newPaymentProvider.Provider),expression:\"newPaymentProvider.Provider\"}],on:{\"change\":function($event){var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = \"_value\" in o ? o._value : o.value;return val}); _vm.$set(_vm.newPaymentProvider, \"Provider\", $event.target.multiple ? $$selectedVal : $$selectedVal[0])}}},[_c('option',{domProps:{\"value\":'Mollie',\"selected\":_vm.newPaymentProvider.Provider === 'Mollie'}},[_vm._v(\"Mollie\")])])]),_c('div',[_c('label',[_vm._v(\"Api key\")]),_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.newPaymentProvider.ProviderSecret),expression:\"newPaymentProvider.ProviderSecret\"}],staticClass:\"input\",attrs:{\"type\":\"text\"},domProps:{\"value\":(_vm.newPaymentProvider.ProviderSecret)},on:{\"input\":function($event){if($event.target.composing)return;_vm.$set(_vm.newPaymentProvider, \"ProviderSecret\", $event.target.value)}}})]),_c('div',[_c('label',[_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.newPaymentProvider.IsDefault),expression:\"newPaymentProvider.IsDefault\"}],attrs:{\"type\":\"checkbox\"},domProps:{\"checked\":Array.isArray(_vm.newPaymentProvider.IsDefault)?_vm._i(_vm.newPaymentProvider.IsDefault,null)>-1:(_vm.newPaymentProvider.IsDefault)},on:{\"change\":function($event){var $$a=_vm.newPaymentProvider.IsDefault,$$el=$event.target,$$c=$$el.checked?(true):(false);if(Array.isArray($$a)){var $$v=null,$$i=_vm._i($$a,$$v);if($$el.checked){$$i<0&&(_vm.$set(_vm.newPaymentProvider, \"IsDefault\", $$a.concat([$$v])))}else{$$i>-1&&(_vm.$set(_vm.newPaymentProvider, \"IsDefault\", $$a.slice(0,$$i).concat($$a.slice($$i+1))))}}else{_vm.$set(_vm.newPaymentProvider, \"IsDefault\", $$c)}}}}),_vm._v(\" Is default \")])])]},proxy:true}])},[_c('template',{slot:\"modalTitle\"})],2)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n  <ui-component-modal\n    modalTitle=\"Add payment provider\"\n    :isSaving=\"isSaving\"\n    :isSavingSuccess=\"isSavingSuccess\"\n    :isSavingError=\"isSavingError\"\n    :hideFooterButtons=\"isSavingError || isSavingSuccess\"\n    :onClickCancel=\"onClickCancel\"\n    :onClickSave=\"save\"\n    :showModal=\"showModal\"\n    @closeModal=\"onClickCancel\"\n  >\n    <template slot=\"modalTitle\"></template>\n    <template v-slot:content>\n      <div class=\"select\">\n        <select v-model=\"newPaymentProvider.Provider\">\n          <option\n            :value=\"'Mollie'\"\n            :selected=\"newPaymentProvider.Provider === 'Mollie'\"\n            >Mollie</option\n          >\n        </select>\n      </div>\n\n      <div>\n        <label>Api key</label>\n        <input\n          type=\"text\"\n          class=\"input\"\n          v-model=\"newPaymentProvider.ProviderSecret\"\n        />\n      </div>\n\n      <div>\n        <label>\n          <input type=\"checkbox\" v-model=\"newPaymentProvider.IsDefault\" />\n          Is default\n        </label>\n      </div>\n    </template>\n  </ui-component-modal>\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { mapState } from 'vuex'\nimport merchantProvider from '@/providers/merchant'\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      isSavingSuccess: false,\n      isSavingError: false,\n      paymentProviders: [],\n      newPaymentProvider: null,\n    }\n  },\n\n  computed: {\n    ...mapState('locationStore', ['locationState']),\n  },\n\n  created() {\n    this.resetNewPaymentProvider()\n  },\n\n  methods: {\n    save() {\n      let self = this\n\n      if (!self.isSaving) {\n        self.isSaving = true\n\n        merchantProvider.methods\n          .addLocationMerchant(this.locationState.Id, this.newPaymentProvider)\n          .then((response) => {\n            if (response.status === 200) {\n              self.isSavingSuccess = true\n\n              this.$emit('providerCreated', response.data)\n\n              let t = setTimeout(() => {\n                self.onClickCancel()\n                clearTimeout(t)\n              }, 1500)\n            }\n          })\n          .catch((e) => {\n            self.isSavingError = true\n          })\n          .finally(() => {\n            self.isSaving = false\n          })\n      }\n    },\n\n    resetNewPaymentProvider() {\n      this.newPaymentProvider = {\n        Id: 0,\n        Provider: 'Mollie',\n        ProviderId: '',\n        ProviderSecret: '',\n        IsDefault: true,\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!./ModalAddPaymentProvider.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!./ModalAddPaymentProvider.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./ModalAddPaymentProvider.vue?vue&type=template&id=d1baa77c\"\nimport script from \"./ModalAddPaymentProvider.vue?vue&type=script&lang=js\"\nexport * from \"./ModalAddPaymentProvider.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":""}