{"version":3,"sources":["webpack:///./src/components/Companies/CreateCompany.vue","webpack:///src/components/Companies/CreateCompany.vue","webpack:///./src/components/Companies/CreateCompany.vue?0df0","webpack:///./src/components/Companies/CreateCompany.vue?4c18"],"names":["render","_vm","this","_c","_self","staticClass","attrs","$t","nameErrors","toString","on","$event","$v","company","Name","$touch","model","value","callback","$$v","$set","trim","expression","addressErrors","Address","postalCodeErrors","PostalCode","cityErrors","City","scopedSlots","_u","key","fn","directives","name","rawName","Country","$$selectedVal","Array","prototype","filter","call","target","options","o","selected","map","val","_value","multiple","_v","_l","countries","country","Id","domProps","CountryCode","toUpperCase","_s","proxy","contactNameErrors","ContactName","ContactPhone","contactEmailErrors","ContactEmail","errorMessage","_e","class","isSaving","Boolean","$error","save","staticRenderFns","Message","BaseFieldTemplate","WeakMap","props","locationId","type","Number","required","components","data","LocationId","validations","output","email","computed","errors","$dirty","push","countryErrors","largerThen","created","getAllCountries","methods","_this","countryProvider","then","response","status","catch","err","self","$invalid","companyProvider","createCompany","$emit","component"],"mappings":"iMAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,MAAM,CAACE,YAAY,sBAAsB,CAACF,EAAG,MAAM,CAACE,YAAY,QAAQ,CAACF,EAAG,sBAAsB,CAACG,MAAM,CAAC,MAAQL,EAAIM,GAAG,wDAAwD,MAAQN,EAAIO,WAAWC,WAAW,SAAW,IAAIC,GAAG,CAAC,MAAQ,SAASC,GAAQ,OAAOV,EAAIW,GAAGC,QAAQC,KAAKC,UAAU,KAAO,SAASJ,GAAQ,OAAOV,EAAIW,GAAGC,QAAQC,KAAKC,WAAWC,MAAM,CAACC,MAAOhB,EAAIY,QAAQC,KAAMI,SAAS,SAAUC,GAAMlB,EAAImB,KAAKnB,EAAIY,QAAS,OAAwB,kBAARM,EAAkBA,EAAIE,OAAQF,IAAOG,WAAW,kBAAkBnB,EAAG,sBAAsB,CAACG,MAAM,CAAC,MAAQL,E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AAnF,GAAA,8BAEAiF,GALAA,GAQA5B,kBAAA,WACA,IAAA4B,EAAA,GACA,YAAA5E,GAAAC,QAAAgD,YAAA4B,QAGA,KAAA7E,GAAAC,QAAAgD,YAAAmB,UACAQ,EAAAE,KAAA,KAAAnF,GAAA,8BAEAiF,GALAA,GAQAzB,mBAAA,WACA,IAAAyB,EAAA,GACA,YAAA5E,GAAAC,QAAAmD,aAAAyB,QAGA,KAAA7E,GAAAC,QAAAmD,aAAAgB,SAEA,KAAApE,GAAAC,QAAAmD,aAAAsB,OACAE,EAAAE,KAAA,KAAAnF,GAAA,kCAFAiF,EAAAE,KAAA,KAAAnF,GAAA,8BAIAiF,GAPAA,IAWAK,QAAA,WACA,KAAAhF,QAAAsE,WAAA,KAAAN,WAEA,KAAAiB,mBAGAC,QAAA,CACAD,gBAAA,eAAAE,EAAA,KACAC,OAAAF,QACAD,kBACAI,MAAA,SAAAC,GACA,MAAAA,EAAAC,SACAJ,EAAA5C,UAAA+C,EAAAjB,SAGAmB,OAAA,SAAAC,QAGA/B,KAAA,WACA,IAAAgC,EAAA,KACA,KAAAtC,aAAA,GACA,KAAAG,WACA,KAAAA,UAAA,EACA,KAAAxD,GAAAG,SACA,KAAAH,GAAA4F,UACA,KAAApC,UAAA,EACAmC,EAAAtC,aAAAsC,EAAAhG,GACA,8DAGAkG,OAAAV,QACAW,cAAA,KAAA7F,SACAqF,MAAA,SAAAC,GACAI,EAAAI,MAAA,aAAAR,EAAAjB,SAEAmB,OAAA,WACAE,EAAAnC,UAAA,EACAmC,EAAAtC,aAAAsC,EAAAhG,GACA,+DC/TqW,I,YCOjWqG,EAAY,eACd,EACA5G,EACAwE,GACA,EACA,KACA,WACA,MAIa,aAAAoC,E","file":"js/chunk-2d20960d.js?id=0ed90eaaa107449a4f6f","sourcesContent":["var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"has-padding-bottom\"},[_c('div',{staticClass:\"mb-6\"},[_c('ui-base-input-field',{attrs:{\"label\":_vm.$t('Components.Companies.CreateCompany.Label_CompanyName'),\"error\":_vm.nameErrors.toString(),\"required\":\"\"},on:{\"input\":function($event){return _vm.$v.company.Name.$touch()},\"blur\":function($event){return _vm.$v.company.Name.$touch()}},model:{value:(_vm.company.Name),callback:function ($$v) {_vm.$set(_vm.company, \"Name\", (typeof $$v === 'string'? $$v.trim(): $$v))},expression:\"company.Name\"}}),_c('ui-base-input-field',{attrs:{\"label\":_vm.$t('Components.Companies.CreateCompany.Label_Address'),\"error\":_vm.addressErrors,\"required\":\"\"},on:{\"input\":function($event){return _vm.$v.company.Address.$touch()},\"blur\":function($event){return _vm.$v.company.Address.$touch()}},model:{value:(_vm.company.Address),callback:function ($$v) {_vm.$set(_vm.company, \"Address\", (typeof $$v === 'string'? $$v.trim(): $$v))},expression:\"company.Address\"}}),_c('ui-base-input-field',{attrs:{\"label\":_vm.$t('Components.Companies.CreateCompany.Label_PostalCode'),\"error\":_vm.postalCodeErrors,\"required\":\"\"},on:{\"input\":function($event){return _vm.$v.company.PostalCode.$touch()},\"blur\":function($event){return _vm.$v.company.PostalCode.$touch()}},model:{value:(_vm.company.PostalCode),callback:function ($$v) {_vm.$set(_vm.company, \"PostalCode\", (typeof $$v === 'string'? $$v.trim(): $$v))},expression:\"company.PostalCode\"}}),_c('ui-base-input-field',{attrs:{\"label\":_vm.$t('Components.Companies.CreateCompany.Label_City'),\"error\":_vm.cityErrors,\"required\":\"\"},on:{\"input\":function($event){return _vm.$v.company.City.$touch()},\"blur\":function($event){return _vm.$v.company.City.$touch()}},model:{value:(_vm.company.City),callback:function ($$v) {_vm.$set(_vm.company, \"City\", (typeof $$v === 'string'? $$v.trim(): $$v))},expression:\"company.City\"}}),_c('BaseFieldTemplate',{attrs:{\"required\":false,\"label\":_vm.$t('Components.Companies.CreateCompany.Label_Country')},scopedSlots:_vm._u([{key:\"fields\",fn:function(){return [_c('div',{staticClass:\"select\"},[_c('select',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.company.Country),expression:\"company.Country\"}],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.company, \"Country\", $event.target.multiple ? $$selectedVal : $$selectedVal[0])}}},[_c('option',[_vm._v(\"Select dropdown\")]),_vm._l((_vm.countries),function(country){return _c('option',{key:country.Id,domProps:{\"value\":country.CountryCode.toUpperCase(),\"selected\":_vm.company.Country.toUpperCase() ===\n                country.CountryCode.toUpperCase()}},[_vm._v(\" \"+_vm._s(_vm.$t('CountryLabels.Country' + country.Id))+\" \")])})],2)])]},proxy:true}])})],1),_c('hr'),_c('div',{staticClass:\"has-margin-bottom\"},[_c('ui-base-input-field',{attrs:{\"label\":_vm.$t('Components.Companies.CreateCompany.Label_ContactName'),\"error\":_vm.contactNameErrors,\"required\":\"\"},on:{\"input\":function($event){return _vm.$v.company.ContactName.$touch()},\"blur\":function($event){return _vm.$v.company.ContactName.$touch()}},model:{value:(_vm.company.ContactName),callback:function ($$v) {_vm.$set(_vm.company, \"ContactName\", (typeof $$v === 'string'? $$v.trim(): $$v))},expression:\"company.ContactName\"}}),_c('ui-base-input-field',{attrs:{\"label\":_vm.$t('Components.Companies.CreateCompany.Label_ContactPhone')},model:{value:(_vm.company.ContactPhone),callback:function ($$v) {_vm.$set(_vm.company, \"ContactPhone\", (typeof $$v === 'string'? $$v.trim(): $$v))},expression:\"company.ContactPhone\"}}),_c('ui-base-input-field',{attrs:{\"label\":_vm.$t('Components.Companies.CreateCompany.Label_ContactEmail'),\"error\":_vm.contactEmailErrors,\"required\":\"\"},on:{\"input\":function($event){return _vm.$v.company.ContactEmail.$touch()},\"blur\":function($event){return _vm.$v.company.ContactEmail.$touch()}},model:{value:(_vm.company.ContactEmail),callback:function ($$v) {_vm.$set(_vm.company, \"ContactEmail\", (typeof $$v === 'string'? $$v.trim(): $$v))},expression:\"company.ContactEmail\"}})],1),(_vm.errorMessage)?_c('Message',{staticClass:\"is-danger has-margin-bottom\",attrs:{\"message\":_vm.errorMessage}}):_vm._e(),_c('div',{staticClass:\"level\"},[_c('div',{staticClass:\"level-left\"}),_c('div',{staticClass:\"level-right\"},[_c('button',{staticClass:\"button is-primary\",class:{ 'is-loading': _vm.isSaving },attrs:{\"disabled\":Boolean(_vm.$v.$error)},domProps:{\"innerHTML\":_vm._s(_vm.$t('Form.Control.Save'))},on:{\"click\":_vm.save}})])])],1)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n  <div class=\"has-padding-bottom\">\n    <div class=\"mb-6\">\n      <ui-base-input-field\n        :label=\"$t('Components.Companies.CreateCompany.Label_CompanyName')\"\n        v-model.trim=\"company.Name\"\n        :error=\"nameErrors.toString()\"\n        @input=\"$v.company.Name.$touch()\"\n        @blur=\"$v.company.Name.$touch()\"\n        required\n      />\n      <ui-base-input-field\n        :label=\"$t('Components.Companies.CreateCompany.Label_Address')\"\n        v-model.trim=\"company.Address\"\n        :error=\"addressErrors\"\n        @input=\"$v.company.Address.$touch()\"\n        @blur=\"$v.company.Address.$touch()\"\n        required\n      />\n      <ui-base-input-field\n        :label=\"$t('Components.Companies.CreateCompany.Label_PostalCode')\"\n        v-model.trim=\"company.PostalCode\"\n        :error=\"postalCodeErrors\"\n        @input=\"$v.company.PostalCode.$touch()\"\n        @blur=\"$v.company.PostalCode.$touch()\"\n        required\n      />\n      <ui-base-input-field\n        :label=\"$t('Components.Companies.CreateCompany.Label_City')\"\n        v-model.trim=\"company.City\"\n        :error=\"cityErrors\"\n        @input=\"$v.company.City.$touch()\"\n        @blur=\"$v.company.City.$touch()\"\n        required\n      />\n      <BaseFieldTemplate\n        :required=\"false\"\n        :label=\"$t('Components.Companies.CreateCompany.Label_Country')\"\n      >\n        <template v-slot:fields>\n          <!-- <div class=\"select\">\n            <select v-model=\"company.Country\">\n              <option :value=\"0\" :selected=\"Number(company.Country) === 0\">\n                {{\n                  $t('Components.Companies.CreateCompany.Option_ChooseCountry')\n                }}\n              </option>\n              <option\n                v-for=\"(country, key) in $t('CountryLabels')\"\n                :key=\"key\"\n                :selected=\"key === 'Country' + company.Country\"\n                :value=\"Number(key.split('Country')[1])\"\n              >\n                {{ country }}\n              </option>\n            </select>\n          </div> -->\n\n          <div class=\"select\">\n            <select v-model=\"company.Country\">\n              <option>Select dropdown</option>\n              <option\n                v-for=\"country in countries\"\n                :key=\"country.Id\"\n                :value=\"country.CountryCode.toUpperCase()\"\n                :selected=\"\n                  company.Country.toUpperCase() ===\n                  country.CountryCode.toUpperCase()\n                \"\n              >\n                {{ $t('CountryLabels.Country' + country.Id) }}\n              </option>\n            </select>\n          </div>\n        </template>\n      </BaseFieldTemplate>\n    </div>\n    <hr />\n    <div class=\"has-margin-bottom\">\n      <ui-base-input-field\n        :label=\"$t('Components.Companies.CreateCompany.Label_ContactName')\"\n        v-model.trim=\"company.ContactName\"\n        :error=\"contactNameErrors\"\n        @input=\"$v.company.ContactName.$touch()\"\n        @blur=\"$v.company.ContactName.$touch()\"\n        required\n      />\n\n      <ui-base-input-field\n        :label=\"$t('Components.Companies.CreateCompany.Label_ContactPhone')\"\n        v-model.trim=\"company.ContactPhone\"\n      />\n\n      <ui-base-input-field\n        :label=\"$t('Components.Companies.CreateCompany.Label_ContactEmail')\"\n        v-model.trim=\"company.ContactEmail\"\n        :error=\"contactEmailErrors\"\n        @input=\"$v.company.ContactEmail.$touch()\"\n        @blur=\"$v.company.ContactEmail.$touch()\"\n        required\n      />\n    </div>\n\n    <Message\n      class=\"is-danger has-margin-bottom\"\n      :message=\"errorMessage\"\n      v-if=\"errorMessage\"\n    />\n\n    <div class=\"level\">\n      <div class=\"level-left\"></div>\n      <div class=\"level-right\">\n        <button\n          class=\"button is-primary\"\n          @click=\"save\"\n          :class=\"{ 'is-loading': isSaving }\"\n          :disabled=\"Boolean($v.$error)\"\n          v-html=\"$t('Form.Control.Save')\"\n        ></button>\n      </div>\n    </div>\n  </div>\n</template>\n\n<script>\nconst Message = () => import('@/components/UI/Message')\nconst BaseFieldTemplate = () => import('@/components/UI/Form/BaseFieldTemplate')\n\nimport { required, email } from 'vuelidate/lib/validators'\nimport companyProvider from '@/providers/company'\nimport countryProvider from '@/providers/country'\n\nconst touchMap = new WeakMap()\n\nexport default {\n  name: 'createCompany',\n\n  props: {\n    locationId: {\n      type: Number,\n      required: true,\n    },\n  },\n\n  components: {\n    BaseFieldTemplate,\n    Message,\n  },\n\n  data() {\n    return {\n      countries: [],\n      errorMessage: '',\n      isSaving: false,\n      company: {\n        LocationId: this.locationId,\n        Name: '',\n        Address: '',\n        PostalCode: '',\n        City: '',\n        Country: 'NL',\n        ContactPhone: '',\n        ContactName: '',\n        ContactEmail: '',\n      },\n    }\n  },\n\n  /**\n   * Form validation rules\n   */\n  validations() {\n    let output = {\n      Name: {\n        required,\n      },\n      Address: {\n        required,\n      },\n      PostalCode: {\n        required,\n      },\n      City: {\n        required,\n      },\n      // Country: {\n      //   required\n      // },\n      ContactName: {\n        required,\n      },\n      ContactEmail: {\n        required,\n        email,\n      },\n    }\n    return { company: output }\n  },\n\n  computed: {\n    // Error messages\n    nameErrors() {\n      const errors = []\n      if (!this.$v.company.Name.$dirty) {\n        return errors\n      }\n      if (!this.$v.company.Name.required) {\n        errors.push(this.$t('Form.InputErrors.Required'))\n      }\n      return errors\n    },\n\n    addressErrors() {\n      const errors = []\n      if (!this.$v.company.Address.$dirty) {\n        return errors\n      }\n      if (!this.$v.company.Address.required) {\n        errors.push(this.$t('Form.InputErrors.Required'))\n      }\n      return errors\n    },\n\n    postalCodeErrors() {\n      const errors = []\n      if (!this.$v.company.PostalCode.$dirty) {\n        return errors\n      }\n      if (!this.$v.company.PostalCode.required) {\n        errors.push(this.$t('Form.InputErrors.Required'))\n      }\n      return errors\n    },\n\n    cityErrors() {\n      const errors = []\n      if (!this.$v.company.City.$dirty) {\n        return errors\n      }\n      if (!this.$v.company.City.required) {\n        errors.push(this.$t('Form.InputErrors.Required'))\n      }\n      return errors\n    },\n\n    countryErrors() {\n      const errors = []\n      if (!this.$v.company.Country.$dirty) {\n        return errors\n      }\n      if (!this.$v.company.Country.largerThen) {\n        errors.push(this.$t('Form.InputErrors.Required'))\n      }\n      return errors\n    },\n\n    contactNameErrors() {\n      const errors = []\n      if (!this.$v.company.ContactName.$dirty) {\n        return errors\n      }\n      if (!this.$v.company.ContactName.required) {\n        errors.push(this.$t('Form.InputErrors.Required'))\n      }\n      return errors\n    },\n\n    contactEmailErrors() {\n      const errors = []\n      if (!this.$v.company.ContactEmail.$dirty) {\n        return errors\n      }\n      if (!this.$v.company.ContactEmail.required) {\n        errors.push(this.$t('Form.InputErrors.Required'))\n      } else if (!this.$v.company.ContactEmail.email) {\n        errors.push(this.$t('Form.InputErrors.InvalidEmail'))\n      }\n      return errors\n    },\n  },\n\n  created() {\n    this.company.LocationId = this.locationId\n\n    this.getAllCountries()\n  },\n\n  methods: {\n    getAllCountries() {\n      countryProvider.methods\n        .getAllCountries()\n        .then((response) => {\n          if (response.status === 200) {\n            this.countries = response.data\n          }\n        })\n        .catch((err) => { })\n    },\n\n    save() {\n      let self = this\n      this.errorMessage = ''\n      if (!this.isSaving) {\n        this.isSaving = true\n        this.$v.$touch()\n        if (this.$v.$invalid) {\n          this.isSaving = false\n          self.errorMessage = self.$t(\n            'Components.Companies.CreateCompany.Message_NotAllFilledIn'\n          )\n        } else {\n          companyProvider.methods\n            .createCompany(this.company)\n            .then((response) => {\n              self.$emit('nextAction', response.data)\n            })\n            .catch(() => {\n              self.isSaving = false\n              self.errorMessage = self.$t(\n                'Components.Companies.CreateCompany.Message_Error500'\n              )\n            })\n        }\n      }\n    },\n  },\n}\n</script>\n\n<style lang=\"scss\" scoped></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!./CreateCompany.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!./CreateCompany.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./CreateCompany.vue?vue&type=template&id=449a44a2&scoped=true\"\nimport script from \"./CreateCompany.vue?vue&type=script&lang=js\"\nexport * from \"./CreateCompany.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  \"449a44a2\",\n  null\n  \n)\n\nexport default component.exports"],"sourceRoot":""}