(window.webpackJsonp=window.webpackJsonp||[]).push([[185],{1201:function(o,t,l){"use strict";l.r(t);var e={props:{importFile:{type:Function,required:!0}},data:function(){return{file:null,tipoImportacao:"N",loadingDownloadPlanilhaModelo:!1}},methods:{modalOpened:function(){this.file=null},modalClosed:function(){this.$bvModal.hide("modalImportaFlorestal")},downloadPlanilhaModelo:function(){this.loadingDownloadPlanilhaModelo=!0;var link=document.createElement("a");link.href="/ambiental/fichas/importacao/modelo-importacao-florestal.xlsx",link.target="_blank",link.download="modelo-importacao-florestal.xlsx",document.body.appendChild(link),link.click(),document.body.removeChild(link),this.loadingDownloadPlanilhaModelo=!1},handleSave:function(){var o=this;null!=this.file?this.importFile({arquivos:[this.file]},this.tipoImportacao).then((function(){o.$bvModal.hide("modalImportaFlorestal")})).catch((function(t){o.$notifyApiError(t,"Erro ao importar arquivo")})):this.$notify({title:"Error",text:"Adicione um arquivo para importar.",type:"error"})}}},r=l(42),component=Object(r.a)(e,(function(){var o=this,t=o.$createElement,l=o._self._c||t;return l("b-modal",{attrs:{id:"modalImportaFlorestal",size:"md",centered:"","hide-header-close":"","hide-footer":"",scrollable:""},on:{shown:o.modalOpened},scopedSlots:o._u([{key:"modal-header",fn:function(){return[l("div",{staticClass:"d-flex"},[l("fa-icon",{staticStyle:{"font-size":"1.3rem","margin-top":"15px"},attrs:{icon:"clover"}}),o._v(" "),l("h4",{staticClass:"ml-3 mt-3"},[o._v("Importar planilha florestal")])],1)]},proxy:!0}])},[o._v(" "),l("b-form",{on:{submit:function(t){return t.stopPropagation(),t.preventDefault(),o.handleSave.apply(null,arguments)}}},[l("b-row",[l("b-col",{attrs:{cols:"12"}},[l("b-form-group",{attrs:{label:"Arquivo"}},[l("b-form-file",{attrs:{name:"anexo",placeholder:"Escolha um arquivo ou solte-o aqui...","drop-placeholder":"Solte o arquivo aqui...","browse-text":"Escolher",accept:".xlsx, .xls, .csv",multiple:!1},model:{value:o.file,callback:function(t){o.file=t},expression:"file"}})],1)],1),o._v(" "),l("b-col",{attrs:{cols:"12"}},[l("b-form-group",{attrs:{label:"Processo"}},[l("b-form-select",{staticClass:"my-2",model:{value:o.tipoImportacao,callback:function(t){o.tipoImportacao=t},expression:"tipoImportacao"}},[l("b-form-select-option",{attrs:{value:"N"}},[o._v("\n              Nova importação\n            ")]),o._v(" "),l("b-form-select-option",{attrs:{value:"A"}},[o._v("\n              Adicionar a existente\n            ")])],1)],1)],1)],1),o._v(" "),l("b-row",{staticClass:"mt-2 pt-3 border-top"},[l("b-col",{attrs:{cols:"8"}},[l("b-button",{staticClass:"my-2 mr-2 rounded",attrs:{size:"sm",variant:"success",type:"submit"}},[l("fa-icon",{attrs:{icon:"save"}}),o._v(" "),l("span",{staticClass:"ml-1"},[o._v("Importar")])],1),o._v(" "),l("b-button",{staticClass:"my-2 rounded",attrs:{size:"sm",variant:"outline-secondary"},on:{click:function(t){return o.modalClosed()}}},[l("fa-icon",{attrs:{icon:"times"}}),o._v(" "),l("span",{staticClass:"ml-1"},[o._v("Cancelar")])],1)],1),o._v(" "),l("b-col",{attrs:{cols:"4"}},[l("b-button",{staticClass:"my-2 rounded",attrs:{size:"sm",variant:"outline-secondary"},on:{click:function(t){return o.downloadPlanilhaModelo()}}},[!1===o.loadingDownloadPlanilhaModelo?l("div",[l("fa-icon",{attrs:{icon:"file-excel"}}),o._v(" "),l("span",{staticClass:"ml-1"},[o._v("Planilha Modelo")])],1):l("div",[l("b-spinner",{attrs:{small:""}}),o._v(" "),l("span",[o._v("Carregando...")])],1)])],1)],1)],1)],1)}),[],!1,null,null,null);t.default=component.exports}}]);
//# sourceMappingURL=4395f09-1.2.11.js.map