(window.webpackJsonp=window.webpackJsonp||[]).push([[278],{1130:function(e,t,o){"use strict";o.r(t);o(6),o(5),o(7),o(4),o(12),o(8),o(13);var n=o(2),r=(o(25),o(78));function c(object,e){var t=Object.keys(object);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(object);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(object,e).enumerable}))),t.push.apply(t,o)}return t}function l(e){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?c(Object(source),!0).forEach((function(t){Object(n.a)(e,t,source[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(source)):c(Object(source)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(source,t))}))}return e}var d={name:"ModalAnexo",props:{findAnexosLicencaById:{type:Function,default:function(){return[]}},findDocumentosCondicionante:{type:Function,default:function(){return[]}},findDocumentosPlanoAcao:{type:Function,default:function(){return[]}},parametroAnexo:{type:String,default:function(){return""}}},data:function(){return{anexo:{},idParametro:0}},computed:l(l({},Object(r.c)({empresa:"empresa/empresaAtual"})),{},{busy:{get:function(){return this.busyAnexo},set:function(e){this.$emit("update:busyAnexo",e)}}}),mounted:function(){var e=this;this.$root.$on("bv::modal::show",(function(t,o){"modalAnexo"===o&&(e.anexo={})}))},methods:{cancelModalAnexo:function(){this.anexo={},this.$bvModal.hide("modalAnexo")},save:function(){var e=this;if(this.anexo.arquivo){var t=new FormData;t.append("files",this.anexo.arquivo),t.append("name",this.anexo.arquivo.name),console.log("formData=>",t),"licenca"===this.parametroAnexo?this.$licencaService.saveAnexoLicenca(this.empresa.sigla,this.$route.params.licenca,this.$auth.strategy.token.get(),t).then((function(){e.anexo={},e.$bvModal.hide("modalAnexo"),e.$notify({title:"Confirmação",text:"Anexo incluido com sucesso.",type:"success"}),e.findAnexosLicencaById()})).catch((function(t){e.$notifyApiError(t,"Erro")})):"condicionante"===this.parametroAnexo?this.$licencaService.saveAnexoCondicionante(this.empresa.sigla,this.$route.params.licenca,this.$route.params.condicionante,this.$auth.strategy.token.get(),t).then((function(){e.anexo={},e.$bvModal.hide("modalAnexo"),e.$notify({title:"Confirmação",text:"Anexo incluido com sucesso.",type:"success"}),e.findDocumentosCondicionante()})).catch((function(t){e.$notifyApiError(t,"Erro")})):"planoAcao"===this.parametroAnexo&&this.$licencaService.saveDocumentosPlanoAcao(this.empresa.sigla,this.$route.params.licenca,this.$route.params.condicionante,this.$route.params.planoAcao,this.$auth.strategy.token.get(),t).then((function(){e.anexo={},e.$bvModal.hide("modalAnexo"),e.$notify({title:"Confirmação",text:"Anexo incluido com sucesso.",type:"success"}),e.findDocumentosPlanoAcao()})).catch((function(t){e.$notifyApiError(t,"Erro")}))}else this.$notify({title:"Erro",text:"Adicione um anexo!",type:"error"})}}},m=o(42),component=Object(m.a)(d,(function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("b-modal",{attrs:{id:"modalAnexo",centered:"","hide-header-close":"","hide-footer":""},scopedSlots:e._u([{key:"modal-title",fn:function(){return[o("div",{staticClass:"d-flex"},[o("fa-icon",{staticStyle:{"font-size":"1.5rem","margin-top":"15px"},attrs:{icon:"folder"}}),e._v(" "),o("h4",{staticClass:"ml-3 mt-3"},[e._v("Adicionar anexo")])],1)]},proxy:!0}])},[e._v(" "),o("b-form",{on:{submit:function(t){return t.stopPropagation(),t.preventDefault(),e.save.apply(null,arguments)}}},[o("b-row",[o("b-col",{attrs:{md:"12",xl:"12"}},[o("b-form-group",{attrs:{label:"Anexo"}},[o("b-form-file",{attrs:{name:"anexo",placeholder:"Escolha um arquivo ou solte-o aqui...","drop-placeholder":"Solte o arquivo aqui...","browse-text":"Escolher"},model:{value:e.anexo.arquivo,callback:function(t){e.$set(e.anexo,"arquivo",t)},expression:"anexo.arquivo"}})],1)],1),e._v(" "),o("b-col",{staticClass:"pl-2",attrs:{md:"12"}},[o("b-button",{staticClass:"my-2 ml-2 rounded",attrs:{size:"sm",variant:"success",type:"submit"}},[o("fa-icon",{attrs:{icon:"save"}}),e._v(" "),o("span",{staticClass:"ml-1"},[e._v("Salvar")])],1),e._v(" "),o("b-button",{staticClass:"my-2 ml-2 rounded",attrs:{size:"sm",variant:"outline-secondary"},on:{click:function(t){return e.cancelModalAnexo()}}},[o("fa-icon",{attrs:{icon:"times"}}),e._v(" "),o("span",{staticClass:"ml-1"},[e._v("Cancelar")])],1)],1)],1)],1)],1)}),[],!1,null,null,null);t.default=component.exports}}]);
//# sourceMappingURL=51d50d5-1.2.11.js.map