{"version":3,"sources":["webpack:///./src/modules/billing/api/billing.ts","webpack:///./src/modules/billing/components/Billing.vue?f450","webpack:///./src/modules/billing/components/Billing.vue?ce41","webpack:///./src/modules/billing/components/Billing.vue?6442","webpack:///./src/modules/billing/components/Billing.vue","webpack:///./src/modules/billing/components/Billing.vue?eee5","webpack:///./src/modules/billing/classes/billing.ts"],"names":["this","MasterAccountId","state","auth","user","getUser","Promise","get","response","appResponse","data","IsSuccess","Result","Error","ErrorCodes","join","updateUser","profile","UpdateStripeCustomer","post","Name","Vatnr","Address","Postcode","City","Country","render","_vm","_h","$createElement","_c","_self","directives","name","rawName","value","expression","staticClass","attrs","slot","_v","_s","$t","ref","billingForm","billingFormRules","nativeOn","$event","_k","keyCode","key","submitForm","model","callback","$$v","$set","_l","item","label","loading","on","staticRenderFns","countries","phoneModel","phone","code","billingApi","created","required","message","trigger","mounted","Object","keys","push","$refs","validate","valid","then","show","catch","error","msg","finally","Billing","components","PhoneInput","component"],"mappings":"4LAMA,aAGE,aACEA,KAAKC,gBAAkB,OAAMC,MAAMC,MAAQ,OAAMD,MAAMC,KAAKC,KAC1D,OAAMF,MAAMC,KAAKC,KAAKH,gBACtB,KAsCN,OAnCe,YAAAI,QAAb,W,kCAAwBC,SAAO,W,yEAE8B,OADnCN,KAAKC,gBAC8B,GAAM,OAAoBM,IAAI,+B,OAGzF,GAHMC,EAAqD,SACrDC,EAAyCD,EAASE,KAEpDD,EAAYE,UAEd,OADMP,EAAqBK,EAAYG,OAChC,CAAP,EAAOR,GAEP,MAAM,IAAIS,MAAMJ,EAAYK,WAAWC,KAAK,cAInC,YAAAC,WAAb,SAAwBC,EAAuBC,G,kCAAgCZ,SAAO,W,yEAIhF,OAHEL,EAAkBD,KAAKC,gBAGzB,GAAM,OAAoBkB,KAAK,8BAA+B,CAChEC,KAAMH,EAAQG,KAEdC,MAAOJ,EAAQI,MACfC,QAASL,EAAQK,QACjBC,SAAUN,EAAQM,SAClBC,KAAMP,EAAQO,KACdC,QA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esContent":["import { BillingModel } from '../classes/billing';\nimport { AxiosResponse } from 'axios';\nimport AuthorizedApiClient from 'modules/auth/models/authorizedApiClient';\nimport { AppResponse } from 'modules/core/interfaces/appResponse';\nimport store from '@/store/index';\n\nexport class BillingApi {\n public MasterAccountId: string;\n\n public constructor() {\n this.MasterAccountId = store.state.auth && store.state.auth.user\n ? store.state.auth.user.MasterAccountId\n : null;\n }\n\n public async getUser(): Promise {\n const MasterAccountId = this.MasterAccountId;\n const response: AxiosResponse> = await AuthorizedApiClient.get('/AccountBillingDetails/Get');\n const appResponse: AppResponse = response.data;\n\n if (appResponse.IsSuccess) {\n const user: BillingModel = appResponse.Result;\n return user;\n } else {\n throw new Error(appResponse.ErrorCodes.join(','));\n }\n }\n\n public async updateUser(profile: BillingModel, UpdateStripeCustomer: boolean): Promise {\n const MasterAccountId = this.MasterAccountId;\n const response: AxiosResponse<\n AppResponse\n > = await AuthorizedApiClient.post('/AccountBillingDetails/Save', {\n Name: profile.Name,\n // PhoneNumber: profile.PhoneNumber,\n Vatnr: profile.Vatnr,\n Address: profile.Address,\n Postcode: profile.Postcode,\n City: profile.City,\n Country: profile.Country,\n MasterAccountId,\n UpdateStripeCustomer,\n });\n const appResponse: AppResponse = response.data;\n if (appResponse.IsSuccess) {\n return true;\n } else {\n throw new Error(appResponse.ErrorCodes.join(','));\n }\n }\n}\n","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:\"loading\",rawName:\"v-loading\",value:(_vm.loading),expression:\"loading\"}],staticClass:\"page-billing\"},[_c('el-card',{staticClass:\"box-card\"},[_c('div',{attrs:{\"slot\":\"header\"},slot:\"header\"},[_c('span',{staticClass:\"card-title\"},[_vm._v(_vm._s(_vm.$t('billing.title')))])]),_c('div',{staticClass:\"billing-form\"},[_c('el-form',{ref:\"billingForm\",staticClass:\"login-form\",attrs:{\"model\":_vm.billingForm,\"rules\":_vm.billingFormRules,\"label-position\":\"right\",\"label-width\":\"120px\"},nativeOn:{\"keyup\":function($event){if(!('button' in $event)&&_vm._k($event.keyCode,\"enter\",13,$event.key,\"Enter\")){ return null; }return _vm.submitForm($event)}}},[_c('el-form-item',{attrs:{\"label\":_vm.$t('billing.name'),\"prop\":\"Name\"}},[_c('el-input',{attrs:{\"type\":\"text\",\"placeholder\":_vm.$t('billing.name')},model:{value:(_vm.billingForm.Name),callback:function ($$v) {_vm.$set(_vm.billingForm, \"Name\", $$v)},expression:\"billingForm.Name\"}})],1),_c('el-form-item',{attrs:{\"label\":_vm.$t('billing.address'),\"prop\":\"Address\"}},[_c('el-input',{attrs:{\"type\":\"text\",\"placeholder\":_vm.$t('billing.address')},model:{value:(_vm.billingForm.Address),callback:function ($$v) {_vm.$set(_vm.billingForm, \"Address\", $$v)},expression:\"billingForm.Address\"}})],1),_c('el-form-item',{attrs:{\"label\":_vm.$t('billing.postcode'),\"prop\":\"Postcode\"}},[_c('el-input',{attrs:{\"type\":\"text\",\"placeholder\":_vm.$t('billing.postcode')},model:{value:(_vm.billingForm.Postcode),callback:function ($$v) {_vm.$set(_vm.billingForm, \"Postcode\", $$v)},expression:\"billingForm.Postcode\"}})],1),_c('el-form-item',{attrs:{\"label\":_vm.$t('billing.city'),\"prop\":\"City\"}},[_c('el-input',{attrs:{\"type\":\"text\",\"placeholder\":_vm.$t('billing.city')},model:{value:(_vm.billingForm.City),callback:function ($$v) {_vm.$set(_vm.billingForm, \"City\", $$v)},expression:\"billingForm.City\"}})],1),_c('el-form-item',{attrs:{\"label\":_vm.$t('billing.country'),\"prop\":\"Country\"}},[_c('el-select',{attrs:{\"filterable\":\"\",\"placeholder\":_vm.$t('billing.country')},model:{value:(_vm.billingForm.Country),callback:function ($$v) {_vm.$set(_vm.billingForm, \"Country\", $$v)},expression:\"billingForm.Country\"}},_vm._l((_vm.countries),function(item){return _c('el-option',{key:item.value,attrs:{\"label\":item.label,\"value\":item.value}})}),1)],1),_c('el-form-item',{attrs:{\"label\":_vm.$t('billing.vatnr'),\"prop\":\"Vatnr\"}},[_c('el-input',{attrs:{\"type\":\"text\",\"placeholder\":_vm.$t('billing.vatnr')},model:{value:(_vm.billingForm.Vatnr),callback:function ($$v) {_vm.$set(_vm.billingForm, \"Vatnr\", $$v)},expression:\"billingForm.Vatnr\"}})],1),_c('el-form-item',[_c('el-button',{attrs:{\"type\":\"primary\",\"loading\":_vm.loading},on:{\"click\":_vm.submitForm}},[_vm._v(_vm._s(_vm.$t('general.save')))])],1)],1)],1)])],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport { Component, Vue, Watch } from 'vue-property-decorator';\nimport { BillingModel } from '../classes/billing';\nimport { SelectOptions } from 'modules/core/interfaces/selectOptions';\nimport { BillingApi } from '../api/billing';\nimport { ElForm } from 'element-ui/types/form';\nimport AppMessage from 'modules/core/models/appMessage';\nimport Countries from '@/i18n/en/countries';\nimport PhoneInput from 'modules/core/components/forms/PhoneInput.vue';\n\n@Component({\n components: {\n PhoneInput,\n },\n})\nexport default class Billing extends Vue {\n public loading: boolean = false;\n\n public billingFormRules!: any;\n\n public countries: Array> = [];\n\n private billingApi: BillingApi;\n\n private billingForm: BillingModel;\n\n private phoneModel = {\n phone: '',\n code: '',\n };\n\n constructor() {\n super();\n this.billingApi = new BillingApi();\n this.billingForm = new BillingModel();\n }\n\n public created() {\n this.billingFormRules = {\n Name: [\n { required: true, message: this.$t('forms.required'), trigger: 'blur' },\n ],\n Address: [\n { required: true, message: this.$t('forms.required'), trigger: 'blur' },\n ],\n Postcode: [\n { required: true, message: this.$t('forms.required'), trigger: 'blur' },\n ],\n City: [\n { required: true, message: this.$t('forms.required'), trigger: 'blur' },\n ],\n Country: [\n { required: true, message: this.$t('forms.required'), trigger: 'blur' },\n ],\n // PhoneNumber: [\n // {\n // trigger: 'blur',\n // validator: (rule: any, value: string, callback: (error?: Error) => void) => {\n // if ((this.$refs.phoneInput as PhoneInput).validate()) {\n // callback();\n // } else {\n // callback(new Error(this.$t('forms.wrongPhone') as string));\n // }\n // },\n // },\n // ],\n };\n }\n\n public async mounted() {\n this.loading = true;\n\n const user: BillingModel = await this.billingApi.getUser();\n\n this.billingForm = user;\n // if (user.PhoneNumber) {\n // this.insertPhoneNumber();\n // }\n\n for (const item of Object.keys(Countries)) {\n this.countries.push({\n value: item,\n label: this.$t('forms.options.langs.' + item) as string,\n });\n }\n\n this.loading = false;\n }\n\n public submitForm() {\n this.loading = true;\n (this.$refs.billingForm as ElForm).validate((valid: boolean) => {\n if (valid) {\n this.billingApi.updateUser(this.billingForm, true).then((data: any) => {\n AppMessage.show(this.$t('billing.success'));\n }).catch((error: Error) => {\n AppMessage.show(this.$t('forms.error', { msg: error }), 'error');\n }).finally(() => {\n this.loading = false;\n });\n } else {\n this.loading = false;\n return false;\n }\n });\n }\n\n // public updatePhoneNumber(val: any) {\n // this.billingForm.PhoneNumber = val.code + val.phone;\n // this.phoneModel = val;\n // }\n\n // public insertPhoneNumber() {\n // const phoneNumberLenght = this.billingForm.PhoneNumber.length;\n // this.phoneModel = {\n // phone: this.billingForm.PhoneNumber.substr(-9),\n // code: this.billingForm.PhoneNumber.slice(0, phoneNumberLenght - 9),\n // };\n // }\n}\n","import mod from \"-!../../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../../node_modules/thread-loader/dist/cjs.js!../../../../node_modules/ts-loader/index.js??ref--12-2!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Billing.vue?vue&type=script&lang=ts\"; export default mod; export * from \"-!../../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../../node_modules/thread-loader/dist/cjs.js!../../../../node_modules/ts-loader/index.js??ref--12-2!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Billing.vue?vue&type=script&lang=ts\"","import { render, staticRenderFns } from \"./Billing.vue?vue&type=template&id=343e1f1a&scoped=true\"\nimport script from \"./Billing.vue?vue&type=script&lang=ts\"\nexport * from \"./Billing.vue?vue&type=script&lang=ts\"\nimport style0 from \"./Billing.vue?vue&type=style&index=0&id=343e1f1a&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 \"343e1f1a\",\n null\n \n)\n\nexport default component.exports","export * from \"-!../../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../../node_modules/css-loader/index.js??ref--8-oneOf-1-1!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Billing.vue?vue&type=style&index=0&id=343e1f1a&prod&lang=scss&scoped=true\"","export class BillingModel {\n public Name: string;\n public Vatnr: string;\n // public PhoneNumber: string;\n public Address: string;\n public Postcode: string;\n public City: string;\n public Country: string;\n\n public constructor(data?: BillingModel) {\n this.Name = (data && data.Name) ? data.Name : '';\n this.Vatnr = (data && data.Vatnr) ? data.Vatnr : '';\n // this.PhoneNumber = (data && data.PhoneNumber) ? data.PhoneNumber : '';\n this.Address = (data && data.Address) ? data.Address : '';\n this.Postcode = (data && data.Postcode) ? data.Postcode : '';\n this.City = (data && data.City) ? data.City : '';\n this.Country = (data && data.Country) ? data.Country : '';\n }\n}\n"],"sourceRoot":""}