{"version":3,"sources":["webpack:///./src/components/Vouchers/ModalEditProfiles.vue?679c","webpack:///./src/components/Vouchers/ModalEditProfiles.vue","webpack:///src/components/Vouchers/ModalEditProfiles.vue","webpack:///./src/components/Vouchers/ModalEditProfiles.vue?7985","webpack:///./src/components/Vouchers/ModalEditProfiles.vue?bee9"],"names":["render","_vm","this","_c","_self","attrs","$t","onClickCancel","showModal","saveVoucher","isSaving","isSavingSuccess","isSavingError","on","scopedSlots","_u","key","fn","staticClass","locationId","excludedProfileIds","addProfile","_v","_s","mVoucher","Profiles","length","_l","profile","index","Image","ProfileName","ProfileEmail","$event","deleteProfile","staticStyle","_e","proxy","staticRenderFns","components","SearchCustomer","props","type","Boolean","default","Function","required","data","Number","$route","params","profiles","searchTerm","list","isLoading","searchCounter","computed","_objectSpread","mapState","filteredItems","_this","result","_loop","i","profileIndex","findIndex","p","ProfileId","Id","push","created","self","JSON","parse","stringify","voucher","methods","mapMutations","customer","VoucherId","FullName","Email","Vue","delete","excludedIndex","splice","_this2","LocationId","voucherProvider","then","response","status","setVoucher","setTimeout","$emit","catch","error","finally","component"],"mappings":"kHAAA,W,2CCAA,IAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,MAAM,CAACA,EAAG,qBAAqB,CAACE,MAAM,CAAC,WAAaJ,EAAIK,GAAG,mDAAmD,cAAgBL,EAAIM,cAAc,UAAYN,EAAIO,UAAU,YAAcP,EAAIQ,YAAY,SAAWR,EAAIS,SAAS,gBAAkBT,EAAIU,gBAAgB,cAAgBV,EAAIW,cAAc,kBAAoBX,EAAIW,eAAiBX,EAAIU,gBAAgB,UAAY,SAASE,GAAG,CAAC,WAAaZ,EAAIM,eAAeO,YAAYb,EAAIc,GAAG,CAAC,CAACC,IAAI,UAAUC,GAAG,WAAW,MAAO,CAACd,EAAG,MAAM,CAACe,YAAY,0BAA0B,CAACf,EAAG,MAAM,CAACe,YAAY,mCAAmC,CAACf,E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A,KAAA3D,SAAAC,SAAAI,GAEA,IAAAuD,EAAA,KAAAhE,mBAAA6C,WACA,SAAAC,GAAA,OAAAA,IAAAtC,EAAAuC,aAEAiB,GAAA,GACA,KAAAhE,mBAAAiE,OAAAD,EAAA,IAIA3E,YAAA,eAAA6E,EAAA,KACA,KAAA5E,UAAA,EACA,KAAAc,SAAA+D,WAAA,KAAApE,WAEAqE,OAAAZ,QACAnE,YAAA,KAAAe,UACAiE,MAAA,SAAAC,GACA,MAAAA,EAAAC,SACAL,EAAAM,WAAAF,EAAA3C,MACAuC,EAAA3E,iBAAA,EAEAkF,YAAA,WACAP,EAAAQ,MAAA,gBAAAJ,EAAA3C,MACAuC,EAAA/E,kBACA,UAGAwF,OAAA,SAAAC,GAEAV,EAAA1E,eAAA,KAEAqF,SAAA,WACAX,EAAA5E,UAAA,SCzLyW,I,wBCQrWwF,EAAY,eACd,EACAlG,EACAsC,GACA,EACA,KACA,WACA,MAIa,aAAA4D,E","file":"js/chunk-1316af55.js?id=2d3f777097609d0304ab","sourcesContent":["export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--9-oneOf-1-0!../../../node_modules/css-loader/dist/cjs.js??ref--9-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--9-oneOf-1-2!../../../node_modules/sass-loader/dist/cjs.js??ref--9-oneOf-1-3!../../../node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ModalEditProfiles.vue?vue&type=style&index=0&id=230109d5&prod&lang=scss&scoped=true\"","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',[_c('ui-component-modal',{attrs:{\"modalTitle\":_vm.$t('Components.Vouchers.Profiles.Title_EditProfiles'),\"onClickCancel\":_vm.onClickCancel,\"showModal\":_vm.showModal,\"onClickSave\":_vm.saveVoucher,\"isSaving\":_vm.isSaving,\"isSavingSuccess\":_vm.isSavingSuccess,\"isSavingError\":_vm.isSavingError,\"hideFooterButtons\":_vm.isSavingError || _vm.isSavingSuccess,\"modalSize\":\"large\"},on:{\"closeModal\":_vm.onClickCancel},scopedSlots:_vm._u([{key:\"content\",fn:function(){return [_c('div',{staticClass:\"form-companies columns\"},[_c('div',{staticClass:\"search-add column-search column\"},[_c('div',{staticClass:\"search-wrapper has-padding\"},[_c('SearchCustomer',{attrs:{\"locationId\":_vm.locationId,\"excludedProfileIds\":_vm.excludedProfileIds},on:{\"customerSelected\":_vm.addProfile}})],1)]),_c('div',{staticClass:\"menu-options column\"},[_c('div',{staticClass:\"selected-options-wrapper\"},[_c('div',{staticClass:\"title is-3 has-margin-top\"},[_vm._v(\" \"+_vm._s(_vm.$t('Components.Vouchers.Profiles.Sub_Title_SelectedProfiles'))+\" \")]),(_vm.mVoucher.Profiles.length > 0)?_c('div',{staticClass:\"list\"},_vm._l((_vm.mVoucher.Profiles),function(profile,index){return _c('div',{key:index,staticClass:\"row\"},[_c('div',{staticClass:\"card\"},[_c('div',{staticClass:\"card-content\"},[_c('div',{staticClass:\"image-wrapper\"},[_c('img',{staticClass:\"image\",attrs:{\"src\":profile.Image,\"alt\":\"\"}})]),_c('div',{staticClass:\"info-wrapper\"},[_c('div',{staticClass:\"item\"},[_vm._v(_vm._s(profile.ProfileName))]),_c('div',{staticClass:\"item\"},[_vm._v(_vm._s(profile.ProfileEmail))])]),_c('div',{staticClass:\"button-group\"},[_c('a',{on:{\"click\":function($event){return _vm.deleteProfile(profile, index)}}},[_c('span',{staticClass:\"icon\"},[_c('font-awesome-icon',{staticStyle:{\"color\":\"red\"},attrs:{\"icon\":['fas', 'trash-alt']}})],1)])])])])])}),0):_vm._e()])])])]},proxy:true}])})],1)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n  <div>\n    <ui-component-modal\n      :modalTitle=\"$t('Components.Vouchers.Profiles.Title_EditProfiles')\"\n      :onClickCancel=\"onClickCancel\"\n      :showModal=\"showModal\"\n      :onClickSave=\"saveVoucher\"\n      :isSaving=\"isSaving\"\n      :isSavingSuccess=\"isSavingSuccess\"\n      :isSavingError=\"isSavingError\"\n      :hideFooterButtons=\"isSavingError || isSavingSuccess\"\n      modalSize=\"large\"\n      @closeModal=\"onClickCancel\"\n    >\n      <template v-slot:content>\n        <div class=\"form-companies columns\">\n          <div class=\"search-add column-search column\">\n            <div class=\"search-wrapper has-padding\">\n              <SearchCustomer\n                :locationId=\"locationId\"\n                @customerSelected=\"addProfile\"\n                :excludedProfileIds=\"excludedProfileIds\"\n              />\n            </div>\n          </div>\n          <div class=\"menu-options column\">\n            <div class=\"selected-options-wrapper\">\n              <div class=\"title is-3 has-margin-top\">\n                {{\n                  $t('Components.Vouchers.Profiles.Sub_Title_SelectedProfiles')\n                }}\n              </div>\n              <div v-if=\"mVoucher.Profiles.length > 0\" class=\"list\">\n                <div\n                  class=\"row\"\n                  v-for=\"(profile, index) in mVoucher.Profiles\"\n                  :key=\"index\"\n                >\n                  <div class=\"card\">\n                    <div class=\"card-content\">\n                      <div class=\"image-wrapper\">\n                        <img class=\"image\" :src=\"profile.Image\" alt=\"\" />\n                      </div>\n                      <div class=\"info-wrapper\">\n                        <div class=\"item\">{{ profile.ProfileName }}</div>\n                        <div class=\"item\">{{ profile.ProfileEmail }}</div>\n                      </div>\n                      <div class=\"button-group\">\n                        <a @click=\"deleteProfile(profile, index)\">\n                          <span class=\"icon\">\n                            <font-awesome-icon\n                              :icon=\"['fas', 'trash-alt']\"\n                              style=\"color: red\"\n                            />\n                          </span>\n                        </a>\n                      </div>\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n      </template>\n    </ui-component-modal>\n  </div>\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { mapMutations, mapState } from 'vuex'\n//import customerProvider from '@/providers/customer'\nimport voucherProvider from '@/providers/voucher'\n\nexport default {\n  components: {\n    SearchCustomer: () => import('@/components/Customers/SearchCustomer'),\n  },\n\n  props: {\n    showModal: {\n      type: Boolean,\n      default: false,\n    },\n    onClickCancel: {\n      type: Function,\n      required: true,\n    },\n  },\n\n  data() {\n    return {\n      locationId: Number(this.$route.params.locationId),\n      profiles: [],\n      searchTerm: '',\n      list: [],\n      isLoading: false,\n      isSaving: false,\n      isSavingError: false,\n      isSavingSuccess: false,\n      mVoucher: null,\n      searchCounter: 0,\n      excludedProfileIds: [],\n    }\n  },\n\n  computed: {\n    ...mapState('voucherStore', ['voucher']),\n\n    filteredItems() {\n      let result = []\n      if (this.profiles.length > 0) {\n        for (let i = 0; i < this.profiles.length; i++) {\n          let profileIndex = this.mVoucher.Profiles.findIndex(\n            (p) => p.ProfileId === this.profiles[i].Id\n          )\n          if (profileIndex === -1) {\n            result.push(this.profiles[i])\n          }\n        }\n      }\n      return result\n    },\n  },\n\n  created() {\n    let self = this\n\n    self.mVoucher = JSON.parse(JSON.stringify(self.voucher))\n\n    for (let i = 0; i < self.voucher.Profiles.length; i++) {\n      self.excludedProfileIds.push(self.voucher.Profiles[i].ProfileId)\n    }\n  },\n\n  methods: {\n    ...mapMutations('voucherStore', ['setVoucher']),\n\n    addProfile(customer) {\n      if (customer.ProfileId > 0) {\n        this.excludedProfileIds.push(customer.ProfileId)\n\n        this.mVoucher.Profiles.push({\n          VoucherId: this.voucher.Id,\n          ProfileId: customer.ProfileId,\n          ProfileName: customer.FullName,\n          ProfileEmail: customer.Email,\n        })\n      }\n    },\n\n    deleteProfile(profile, index) {\n      Vue.delete(this.mVoucher.Profiles, index)\n\n      let excludedIndex = this.excludedProfileIds.findIndex(\n        (p) => p === profile.ProfileId\n      )\n      if (excludedIndex > -1) {\n        this.excludedProfileIds.splice(excludedIndex, 1)\n      }\n    },\n\n    saveVoucher() {\n      this.isSaving = true\n      this.mVoucher.LocationId = this.locationId\n\n      voucherProvider.methods\n        .saveVoucher(this.mVoucher)\n        .then((response) => {\n          if (response.status === 200) {\n            this.setVoucher(response.data)\n            this.isSavingSuccess = true\n\n            setTimeout(() => {\n              this.$emit('voucherEdited', response.data)\n              this.onClickCancel()\n            }, 1500)\n          }\n        })\n        .catch((error) => {\n          //console.log(error)\n          this.isSavingError = true\n        })\n        .finally(() => {\n          this.isSaving = false\n        })\n    },\n  },\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.form-companies {\n  .search-add {\n    display: flex;\n    flex-direction: column;\n    &.column-search {\n      width: 33%;\n    }\n    .search-wrapper {\n      // display: flex;\n      height: 60vh;\n      overflow-y: scroll;\n      overflow-x: hidden;\n      .button {\n        margin-left: 5px;\n        &.green {\n          background-color: $green;\n        }\n      }\n    }\n    .add-list {\n      display: flex;\n      flex-direction: column;\n      overflow-y: scroll;\n      border: 1px solid $grey-lighter;\n      border-radius: 6px;\n      height: 300px;\n      .row {\n        display: flex;\n        align-items: center;\n        padding: 10px;\n        .card {\n          width: 100%;\n          .card-content {\n            position: relative;\n            display: flex;\n            align-items: center;\n            .image-wrapper {\n              height: 50px;\n              width: 50px;\n              margin-right: 25px;\n              .image {\n                height: 100%;\n                width: 100%;\n                border-radius: 25px;\n                background-repeat: no-repeat;\n                background-position: center;\n                background-size: cover;\n              }\n            }\n            .info-wrapper {\n              display: flex;\n              flex-direction: column;\n            }\n            .button-group {\n              position: absolute;\n              top: 15px;\n              right: 15px;\n              width: 21px;\n              height: 21px;\n              .button {\n                padding: 0;\n                width: 100%;\n                height: 100%;\n                font-size: 12px;\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n  .selected-options-wrapper {\n    display: flex;\n    flex-direction: column;\n    overflow-y: scroll;\n    height: 100%;\n    .title {\n      flex-grow: 0;\n    }\n    .list {\n      flex-grow: 1;\n      .row {\n        position: relative;\n        display: flex;\n        padding: 10px;\n        .card {\n          width: 100%;\n          .card-content {\n            position: relative;\n            display: flex;\n            align-items: center;\n            .image-wrapper {\n              height: 50px;\n              width: 50px;\n              margin-right: 25px;\n              .image {\n                height: 100%;\n                width: 100%;\n                border-radius: 25px;\n                background-repeat: no-repeat;\n                background-position: center;\n                background-size: cover;\n              }\n            }\n            .info-wrapper {\n              display: flex;\n              flex-direction: column;\n            }\n            .button-group {\n              position: absolute;\n              top: 15px;\n              right: 15px;\n              width: 21px;\n              height: 21px;\n              .button {\n                padding: 0;\n                width: 100%;\n                height: 100%;\n                font-size: 12px;\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n</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!./ModalEditProfiles.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!./ModalEditProfiles.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./ModalEditProfiles.vue?vue&type=template&id=230109d5&scoped=true\"\nimport script from \"./ModalEditProfiles.vue?vue&type=script&lang=js\"\nexport * from \"./ModalEditProfiles.vue?vue&type=script&lang=js\"\nimport style0 from \"./ModalEditProfiles.vue?vue&type=style&index=0&id=230109d5&prod&lang=scss&scoped=true\"\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  \"230109d5\",\n  null\n  \n)\n\nexport default component.exports"],"sourceRoot":""}