exports.ids = [32];
exports.modules = {

/***/ 118:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/pug-plain-loader??ref--1-oneOf-0-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/add/WhereInput.vue?vue&type=template&id=a089215e&lang=pug&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('v-row',[_c('v-col',{attrs:{"cols":"12","md":"6"}},[_c('v-combobox',{ref:"place",attrs:{"rules":[_vm.$validators.required('common.where')],"label":_vm.$t('common.where'),"hint":_vm.$t('event.where_description'),"search-input":_vm.placeName,"prepend-icon":"mdi-map-marker","persistent-hint":"","value":_vm.value.name,"items":_vm.filteredPlaces,"no-filter":"","item-text":"name"},on:{"update:searchInput":function($event){_vm.placeName=$event},"update:search-input":function($event){_vm.placeName=$event},"change":_vm.selectPlace},scopedSlots:_vm._u([{key:"item",fn:function(ref){
var item = ref.item;
return [(item.create)?_c('v-list-item-content',{attrs:{"two-line":""}},[_c('v-list-item-title',[_c('v-icon',{attrs:{"color":"primary"}},[_vm._v("mdi-plus")]),_vm._v(" "+_vm._s(item.name))],1)],1):_c('v-list-item-content',{attrs:{"two-line":""}},[_c('v-list-item-title',[_vm._v(_vm._s(item.name))]),_c('v-list-item-subtitle',[_vm._v(_vm._s(item.address))])],1)]}}])})],1),_c('v-col',{attrs:{"cols":"12","md":"6"}},[_c('v-text-field',{ref:"address",attrs:{"prepend-icon":"mdi-map","disabled":_vm.disableAddress,"rules":[ function (v) { return _vm.disableAddress ? true : _vm.$validators.required('common.address')(v); }],"label":_vm.$t('common.address'),"value":_vm.value.address},on:{"change":_vm.changeAddress}})],1)],1)}
var staticRenderFns = []


// CONCATENATED MODULE: ./pages/add/WhereInput.vue?vue&type=template&id=a089215e&lang=pug&

// EXTERNAL MODULE: external "vuex"
var external_vuex_ = __webpack_require__(3);

// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--2-0!./node_modules/babel-loader/lib??ref--2-1!./node_modules/vue-loader/lib??vue-loader-options!./pages/add/WhereInput.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

/* harmony default export */ var WhereInputvue_type_script_lang_js_ = ({
  name: 'WhereInput',
  props: {
    value: {
      type: Object,
      default: () => {}
    }
  },

  data() {
    return {
      place: {},
      placeName: '',
      disableAddress: true
    };
  },

  computed: { ...Object(external_vuex_["mapState"])(['places']),

    filteredPlaces() {
      if (!this.placeName) {
        return this.places;
      }

      const placeName = this.placeName.toLowerCase();
      let nameMatch = false;
      const matches = this.places.filter(p => {
        const tmpName = p.name.toLowerCase();
        const tmpAddress = p.address.toLowerCase();

        if (tmpName.includes(placeName)) {
          if (tmpName === placeName) {
            nameMatch = true;
          }

          return true;
        }

        if (tmpAddress.includes(placeName)) {
          return true;
        }

        return false;
      });

      if (!nameMatch) {
        matches.unshift({
          create: true,
          name: this.placeName
        });
      }

      return matches;
    }

  },
  methods: {
    selectPlace(p) {
      if (!p) {
        return;
      }

      if (typeof p === 'object' && !p.create) {
        this.place.name = p.name;
        this.place.address = p.address;
        this.disableAddress = true;
      } else {
        // this is a new place
        this.place.name = p.name || p; // search for a place with the same name

        const place = this.places.find(p => p.name === this.place.name);

        if (place) {
          this.place.address = place.address;
          this.disableAddress = true;
        } else {
          this.place.address = '';
          this.disableAddress = false;
          this.$refs.place.blur();
          this.$refs.address.focus();
        }
      }

      this.$emit('input', { ...this.place
      });
    },

    changeAddress(v) {
      this.place.address = v;
      this.$emit('input', { ...this.place
      });
    }

  }
});
// CONCATENATED MODULE: ./pages/add/WhereInput.vue?vue&type=script&lang=js&
 /* harmony default export */ var add_WhereInputvue_type_script_lang_js_ = (WhereInputvue_type_script_lang_js_); 
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(1);

// CONCATENATED MODULE: ./pages/add/WhereInput.vue





/* normalize component */

var component = Object(componentNormalizer["a" /* default */])(
  add_WhereInputvue_type_script_lang_js_,
  render,
  staticRenderFns,
  false,
  null,
  null,
  "726b9d95"
  
)

/* harmony default export */ var WhereInput = __webpack_exports__["default"] = (component.exports);

/***/ })

};;
//# sourceMappingURL=WhereInput.js.map