(window.webpackJsonp=window.webpackJsonp||[]).push([[474],{1191: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)),c=o(307);function l(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}var d={components:{ValidationProvider:c.ValidationProvider,ValidationObserver:c.ValidationObserver},props:{anexos:{type:Array,default:function(){return[]}},findAnexos:{type:Function,default:function(){return{}}}},data:function(){return{anexo:{}}},computed:function(e){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?l(Object(source),!0).forEach((function(t){Object(n.a)(e,t,source[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(source)):l(Object(source)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(source,t))}))}return e}({anexosComputados:{get:function(){return this.anexos},set:function(e){this.$emit("update:anexos",e)}},idRacom:function(){return this.$store.getters["racom/idRacom"]}},Object(r.c)({empresa:"empresa/empresaAtual"})),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")},saveAnexo:function(){var e=this;if(this.idRacom){var t=new FormData;t.append("files",this.anexo.arquivo),t.append("comentario",this.anexo.comentario),t.append("name",this.anexo.arquivo.name),this.$racomService.saveAnexos(this.empresa.sigla,this.idRacom,t).then((function(){e.$bvModal.hide("modalAnexo"),e.findAnexos(),e.$notify({title:"Confirmação",text:"Anexo adicionado com sucesso.",type:"success"})})).catch((function(t){e.solucoes=[],e.$notify({title:"Erro",text:t.response?t.response.data.message:t,type:"error"})}))}else{this.anexosComputados.push({id:this.anexosComputados.length+1,name:this.anexo.arquivo.name,file:this.anexo.arquivo,comentario:this.anexo.comentario}),this.$bvModal.hide("modalAnexo")}},getValidationState:function(e){var t=e.dirty,o=e.validated,n=e.valid;return t||o?void 0===n?null:n:null}}},m=d,f=o(42),component=Object(f.a)(m,(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[e._v("Adicionar Anexo")]},proxy:!0}])},[e._v(" "),o("validation-observer",{ref:"observer",scopedSlots:e._u([{key:"default",fn:function(t){var n=t.handleSubmit;return[o("b-form",{on:{submit:function(t){return t.stopPropagation(),t.preventDefault(),n(e.saveAnexo)}}},[o("b-row",[o("b-col",{attrs:{md:"12",xl:"12"}},[o("validation-provider",{attrs:{name:"anexo",rules:{required:!0}},scopedSlots:e._u([{key:"default",fn:function(t){return[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",state:e.getValidationState(t)},model:{value:e.anexo.arquivo,callback:function(t){e.$set(e.anexo,"arquivo",t)},expression:"anexo.arquivo"}})],1)]}}],null,!0)})],1),e._v(" "),o("b-col",{attrs:{md:"12",xl:"12"}},[o("validation-provider",{attrs:{name:"comentario",rules:{required:!0}},scopedSlots:e._u([{key:"default",fn:function(t){return[o("b-form-group",{attrs:{label:"Comentário"}},[o("b-form-textarea",{staticClass:"my-2",attrs:{name:"comentario",placeholder:"Comentário",rows:"3","max-rows":"6",state:e.getValidationState(t)},model:{value:e.anexo.comentario,callback:function(t){e.$set(e.anexo,"comentario",t)},expression:"anexo.comentario"}})],1)]}}],null,!0)})],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=b08b3b4-1.2.11.js.map