(window.webpackJsonp=window.webpackJsonp||[]).push([[284],{1140:function(t,e,r){var content=r(1213);content.__esModule&&(content=content.default),"string"==typeof content&&(content=[[t.i,content,""]]),content.locals&&(t.exports=content.locals);(0,r(122).default)("532cfdb2",content,!0,{sourceMap:!1})},1212:function(t,e,r){"use strict";r(1140)},1213:function(t,e,r){var o=r(121)(!1);o.push([t.i,".bordered[data-v-4520bf1d]{border:1px solid rgba(0,0,0,.125)}.is_invalid[data-v-4520bf1d] .custom-file-label{border-color:#dc3545!important}",""]),t.exports=o},1312:function(t,e,r){"use strict";r.r(e);r(6),r(5),r(7),r(12),r(8),r(13);var o=r(2),n=(r(25),r(17),r(59),r(152),r(4),r(50),r(88),r(78));function l(object,t){var e=Object.keys(object);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(object);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(object,t).enumerable}))),e.push.apply(e,r)}return e}var c={name:"ModalImportarKMZAmbiental",data:function(){return{file:null,uploading:!1,submitted:!1,name:"",nameError:!1}},computed:function(t){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?l(Object(source),!0).forEach((function(e){Object(o.a)(t,e,source[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(source)):l(Object(source)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(source,e))}))}return t}({typeIsValid:function(){var t,e,r=null===(t=this.file)||void 0===t?void 0:t.name;if(null===(e=this.file)||void 0===e||!e.name)return!0;var o=r.split(".").pop().toLowerCase();return!!["kmz","kml"].includes(o)},inputIsValid:function(){return!!this.typeIsValid&&(!this.submitted||Boolean(this.file))}},Object(n.c)({empresa:"empresa/empresaAtual"})),methods:{handleUploadFile:function(){var t,e=this;this.submitted=!0,this.nameIsValid()&&null!==(t=this.file)&&void 0!==t&&t.name&&this.typeIsValid&&(this.uploading=!0,this.$mapaService.importarKmzMapaAmbiental(this.empresa.sigla,this.file,this.name).then((function(t){var data=t.data;e.$notify({title:"Sucesso",text:"Arquivo importado com sucesso!",type:"success"}),e.$emit("success",data),setTimeout((function(){e.resetForm()}),1e3)})).catch((function(t){e.$notifyApiError(t,"Erro ao importar arquivo")})).finally((function(){e.uploading=!1})))},nameIsValid:function(){return!!this.name.trim()||(this.nameError=!0,!1)},resetForm:function(){this.file=null,this.uploading=!1,this.submitted=!1,this.name="",this.nameError=!1},onNameChange:function(t){this.submitted&&(this.nameError=!t.trim())}}},d=c,m=(r(1212),r(42)),component=Object(m.a)(d,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("b-modal",{attrs:{id:"importarKMZAmbiental",size:"md",centered:"","hide-header-close":"","hide-footer":""},scopedSlots:t._u([{key:"modal-header",fn:function(){return[r("div",{staticClass:"d-flex"},[r("fa-icon",{staticStyle:{"font-size":"1.3rem"},attrs:{icon:"upload"}}),t._v(" "),r("h4",{staticClass:"ml-3"},[t._v("Importar KMZ")])],1)]},proxy:!0}])},[t._v(" "),r("div",[r("b-form-group",{attrs:{label:"Nome:"}},[r("b-form-input",{class:t.submitted&&t.nameError?"is_invalid":"",attrs:{state:t.submitted?!t.nameError:null,placeholder:"Insira um nome para identificar o arquivo"},on:{input:t.onNameChange},model:{value:t.name,callback:function(e){t.name=e},expression:"name"}}),t._v(" "),t.submitted&&t.nameError?r("small",{staticClass:"text-danger"},[t._v("\n        Por favor, adicione um nome para identificação do arquivo.\n      ")]):t._e()],1),t._v(" "),r("b-form-group",{attrs:{label:"Arquivo:"}},[r("b-form-file",{class:t.inputIsValid?"":"is_invalid",attrs:{name:"file",placeholder:"Escolha um arquivo ou solte-o aqui...","drop-placeholder":"Solte o arquivo aqui...","browse-text":"Escolher",accept:".kmz,.kml",disabled:t.uploading},model:{value:t.file,callback:function(e){t.file=e},expression:"file"}}),t._v(" "),t.submitted&&!t.file||!t.typeIsValid?r("small",{staticClass:"text-danger"},[t._v("\n        Por favor, selecione um arquivo válido.\n      ")]):t._e()],1)],1),t._v(" "),r("b-row",{staticClass:"mt-2 pt-3 border-top"},[r("b-col",[r("b-button",{staticClass:"rounded",attrs:{variant:"outline-secondary",size:"sm"},on:{click:function(e){return t.$bvModal.hide("importarKMZAmbiental")}}},[r("fa-icon",{staticClass:"mr-1",attrs:{icon:"times"}}),t._v(" "),r("span",[t._v("Fechar")])],1)],1),t._v(" "),r("b-col",{staticClass:"text-right"},[r("b-button",{staticClass:"rounded",attrs:{variant:"primary",size:"sm",disabled:t.uploading},on:{click:function(e){return t.handleUploadFile()}}},[r("span",{staticClass:"mr-1"},[t.uploading?r("b-spinner",{attrs:{small:""}}):r("fa-icon",{attrs:{icon:"upload"}})],1),t._v(" "),r("span",[t._v("Importar")])])],1)],1)],1)}),[],!1,null,"4520bf1d",null);e.default=component.exports}}]);
//# sourceMappingURL=65838b9-1.2.11.js.map