text: (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["SirenItem"],{"0005":function(e,t,n){},"012e":function(e,t,n){"use strict";var i=n("5bd6"),s=n.n(i);s.a},4917:function(e,t,n){"use strict";var i=n("cb7c"),s=n("9def"),a=n("0390"),o=n("5f1b");n("214f")("match",1,function(e,t,n,c){return[function(n){var i=e(this),s=void 0==n?void 0:n[t];return void 0!==s?s.call(n,i):new RegExp(n)[t](String(i))},function(e){var t=c(n,e,this);if(t.done)return t.value;var l=i(e),r=String(this);if(!l.global)return o(l,r);var u=l.unicode;l.lastIndex=0;var d,m=[],f=0;while(null!==(d=o(l,r))){var h=String(d[0]);m[f]=h,""===h&&(l.lastIndex=a(r,s(l.lastIndex),u)),f++}return 0===f?null:m}]})},"5bd6":function(e,t,n){},7234:function(e,t,n){"use strict";t["a"]={id:0,name:""}},"848b":function(e,t,n){"use strict";var i=n("0005"),s=n.n(i);s.a},"8eeb":function(e,t,n){"use strict";n.r(t);var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"container mw768"},[n("form",{attrs:{model:e.siren,id:"siren"}},[n("div",{staticClass:"columns"},[n("div",{staticClass:"column is-half"},[n("bulma-input",{attrs:{label:"",placeholder:"Серийный номер",iconLeft:"tag"},model:{value:e.siren.num_pass,callback:function(t){e.$set(e.siren,"num_pass",t)},expression:"siren.num_pass"}})],1),n("div",{staticClass:"column is-half"},[n("bulma-select",{attrs:{list:e.siren_types,"selected-item":e.siren.siren_type,label:"Тип сирены","item-name":"siren_type",iconLeft:"tag"},on:{select:e.onSelect}})],1)]),n("bulma-input",{attrs:{label:"",placeholder:"Адрес",iconLeft:"address-card"},model:{value:e.siren.address,callback:function(t){e.$set(e.siren,"address",t)},expression:"siren.address"}}),n("bulma-select",{attrs:{list:e.contacts,"selected-item":e.siren.contact,label:"Контактное лицо","item-name":"contact",iconLeft:"user"},on:{select:e.onSelect}}),n("bulma-select",{attrs:{list:e.companies,"selected-item":e.siren.company,label:"Организация","item-name":"company",iconLeft:"building"},on:{select:e.onSelect}}),n("div",{staticClass:"columns"},[n("div",{staticClass:"column is-half"},[n("bulma-input",{attrs:{label:"",placeholder:"Широта",iconLeft:"tag"},model:{value:e.siren.latitude,callback:function(t){e.$set(e.siren,"latitude",t)},expression:"siren.latitude"}})],1),n("div",{staticClass:"column is-half"},[n("bulma-input",{attrs:{label:"",placeholder:"Долгота",iconLeft:"tag"},model:{value:e.siren.longitude,callback:function(t){e.$set(e.siren,"longitude",t)},expression:"siren.longitude"}})],1)]),n("bulma-input",{attrs:{label:"",placeholder:"Заметка",iconLeft:"comment"},model:{value:e.siren.note,callback:function(t){e.$set(e.siren,"note",t)},expression:"siren.note"}}),n("div",{staticClass:"field is-grouped is-grouped-centered"},[n("div",{staticClass:"control"},[n("bulma-button",{attrs:{text:"Сохранить",color:"primary"},on:{click:e.submit}})],1),n("div",{staticClass:"control"},[n("bulma-button",{attrs:{text:"Закрыть"},on:{click:e.close}})],1),n("div",{staticClass:"control"},[n("bulma-button",{attrs:{text:"Удалить",color:"danger",onclick:"return confirm('Вы действительно хотите удалить эту запись?');"}})],1)])],1)])},s=[],a=(n("7514"),n("e653")),o=n("e04f"),c=n("ce02"),l=n("7234"),r={id:0,num_id:0,num_pass:"",siren_type_id:"",siren_type:l["a"],address:"",radio:"",desk:"",contact_id:0,contact:l["a"],company_id:0,company:l["a"],latitude:"",longitude:"",stage:"",own:"",note:""},u=n("0036"),d=n("2af4"),m=n("8daa"),f={name:"SirenItem",components:{"bulma-button":a["a"],"bulma-input":o["a"],"bulma-select":c["a"]},mixins:[d["a"],u["a"]],data:function(){return{title:"",siren:r,siren_types:[l["a"]],contacts:[l["a"]],companies:[l["a"]]}},mounted:function(){this.fetchData()},methods:{submit:function(){var e=this,t="sirens",n="POST";"0"!==this.$route.params.id&&(t="".concat(t,"/").concat(this.$route.params.id),n="PUT");var i=this.siren;Object(m["a"])({url:t,method:n,mode:"cors",data:JSON.stringify(i)}).then(function(){e.close()})},onSelect:function(e,t){this.siren[t]=e,this.siren["".concat(t,"_id")]=e.id},delete:function(){},fetchData:function(){this.fetchItem("sirens",["siren","siren_types","contacts","companies"],!0)},afterFetch:function(){this.setSelect("siren","siren_types","siren_type","siren_type_id"),this.setSelect("siren","contacts","contact","contact_id"),this.setSelect("siren","companies","company","company_id")},setSelect:function(e,t,n,i){var s=this;this[e][n]=this[t].find(function(t){return t.id===s[e][i]})}}},h=f,p=(n("848b"),n("2877")),b=Object(p["a"])(h,i,s,!1,null,"fde8cca0",null);t["default"]=b.exports},ce02:function(e,t,n){"use strict";var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"field"},[e.getLabel?n("label",{key:"SelectLabel",staticClass:"label"},[e._v(e._s(e.getLabel))]):e._e(),n("div",{class:e.classList,on:{click:e.openOptions}},[n("input",{ref:"vueSelect",class:e.inputClassList,attrs:{autocomplete:"off",tabindex:"0",placeholder:e.getPlaceholder},domProps:{value:e.isLoaded?e.searchText:this.item.name},on:{input:e.onInput,blur:e.onBlur,keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:e.onKeyUp(t)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:e.onKeyDown(t)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:e.onKeyDelete(t)}],keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.onKeyEnter(t)}}}),e.iconLeft?n("bulma-icon",{key:"SelectIconLeft",attrs:{icon:e.iconLeft,position:"left",color:e.color,size:e.size}}):e._e(),e.iconRight?n("bulma-icon",{key:"SelectIconRight",attrs:{icon:e.iconRight,position:"right",color:e.color,size:e.size}}):e._e(),e.opened?n("div",{key:"SelectOpened",staticClass:"select-box"},[n("div",{staticClass:"select-item",on:{click:function(t){return t.stopPropagation(),e.selectItem({id:0,name:""})},mousedown:e.mousedownItem}}),e._l(e.listWithFilter,function(t){return n("div",{key:t.id,staticClass:"select-item",on:{click:function(n){return n.stopPropagation(),e.selectItem(t)},mousedown:e.mousedownItem}},[e._v("\n        "+e._s(t.name)+"\n      ")])})],2):e._e()],1)])},s=[],a=(n("3b2b"),n("4917"),n("bd86")),o=(n("7f7f"),n("6762"),n("2fdb"),n("5762")),c={name:"BulmaSelect",components:{"bulma-icon":o["a"]},props:{selectedItem:{default:function(){return{id:0,name:""}}},iconLeft:{type:[String,Boolean],default:!1},iconRight:{type:[String,Boolean],default:!1},color:{type:[String,Boolean],default:!1,validator:function(e){return["primary","info","success","warning","danger"].includes(e)||!e}},size:{type:[String,Boolean],default:!1},state:{type:[String,Boolean],default:!1},label:{type:[String,Boolean],default:!1},list:{required:!0,default:[{id:0,name:""}]},itemName:{type:[String,Boolean],default:!1}},data:function(){return{opened:!1,searchText:this.selectedItem.name,mousedownState:!1,placeholder:"",isLoaded:!1}},computed:{classList:function(){return{control:!0,"is-expanded":!0,select:!0,"is-fullwidth":!0,"has-icons-left":this.iconLeft,"has-icons-right":this.iconRight}},inputClassList:function(){var e;return e={input:!0},Object(a["a"])(e,"is-".concat(this.color),this.color),Object(a["a"])(e,"is-".concat(this.size),this.size),Object(a["a"])(e,"is-".concat(this.state),this.state),e},getLabel:function(){return!1!==this.label&&!1!==this.placeholder&&""===this.label?this.placeholder:this.label},getPlaceholder:function(){return""===this.placeholder&&this.label&&""!==this.label?this.label:this.placeholder},listWithFilter:function(){var e=this;return""!==this.searchText?this.list.filter(function(t){return t.name.match(new RegExp(e.searchText,"i"))}):this.list},item:function(){return this.selectedItem?{id:this.selectedItem.id,name:this.selectedItem.name}:{id:0,name:""}}},methods:{openOptions:function(){this.isLoaded=!0,this.$refs.vueSelect.focus(),this.searchText="",this.placeholder=this.selectedItem.name,this.opened=!0,this.mousedownState=!1},closeOptions:function(){this.opened=!1},mousedownItem:function(){this.mousedownState=!0},selectItem:function(e){this.searchText=e.name,this.closeOptions(),this.itemName?this.$emit("select",e,this.itemName):this.$emit("select",e)},onBlur:function(){this.mousedownState||(this.searchText=this.selectedItem.name,this.closeOptions())},onKeyUp:function(){},onKeyDown:function(){},onKeyEnter:function(){},onKeyDelete:function(){},onInput:function(e){this.searchText=e.target.value}}},l=c,r=(n("012e"),n("2877")),u=Object(r["a"])(l,i,s,!1,null,"74b63be4",null);t["a"]=u.exports}}]);
  //# sourceMappingURL=SirenItem.fd65af1b.js.map