(window.webpackJsonp=window.webpackJsonp||[]).push([[681],{1424:function(t,e,o){"use strict";o.r(e);o(6),o(5),o(7),o(4),o(12),o(8),o(13);var r=o(2),n=o(78),d=o(307);function c(object,t){var e=Object.keys(object);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(object);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(object,t).enumerable}))),e.push.apply(e,o)}return e}function l(t){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?c(Object(source),!0).forEach((function(e){Object(r.a)(t,e,source[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(source)):c(Object(source)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(source,e))}))}return t}var f={name:"ModalRevisoes",components:{ValidationProvider:d.ValidationProvider,ValidationObserver:d.ValidationObserver},props:{dados:{type:Object,default:function(){return{}}},findRevisoesTarifarias:{type:Function,default:function(){return[]}}},data:function(){return{}},computed:l(l({},Object(n.c)({empresa:"empresa/empresaAtual"})),{},{dadosComputados:{get:function(){return this.dados},set:function(t){this.$emit("update:dados",t)}}}),mounted:function(){var t=this;this.$root.$on("bv::modal::show",(function(e,o){"editRevisoesTarifariasModal"===o&&void 0===t.dadosComputados.id&&(t.dadosComputados={})}))},methods:{save:function(){var t=this;console.log("this.dadosComputados=>",this.dadosComputados),void 0===this.dadosComputados.id&&(this.dadosComputados.id={},this.dadosComputados.id.idEmpresa=this.empresa.id),this.$pleitosService.saveRevisoesTarifarias(this.empresa.sigla,this.dadosComputados).then((function(){void 0!==t.dadosComputados.id?t.$notify({title:"Confirmação",text:"Revisao Tarifaria alterada com sucesso.",type:"success"}):t.$notify({title:"Confirmação",text:"Revisao Tarifaria incluída com sucesso.",type:"success"}),t.$bvModal.hide("editRevisoesTarifariasModal"),t.findRevisoesTarifarias()})).catch((function(e){t.$notify({title:"Erro",text:e.response?e.response.data.message:e,type:"error"})}))},closeModal:function(){this.$bvModal.hide("editRevisoesTarifariasModal")},deleteRevisoesTarifarias:function(){var t=this;this.$pleitosService.deleteRevisoesTarifarias(this.empresa.sigla,this.dadosComputados.id.idRevisao).then((function(){t.$bvModal.hide("editRevisoesTarifariasModal"),t.findRevisoesTarifarias(),t.$notify({title:"Confirmação",text:"Revisao Tarifaria excluído com sucesso.",type:"success"})})).catch((function(e){t.$notify({title:"Erro",text:e.response?e.response.data.message:e,type:"error"})}))},getValidationState:function(t){var e=t.dirty,o=t.validated,r=t.valid;return e||o?r:null}}},v=o(42),component=Object(v.a)(f,(function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("b-modal",{attrs:{id:"editRevisoesTarifariasModal",size:"md",centered:"","hide-header-close":"","hide-footer":""},scopedSlots:t._u([{key:"modal-header",fn:function(){return[o("h4",[t._v("\n      "+t._s(null==t.dadosComputados.id?"Adicionar Revisões Tarifárias":"Editar Revisões Tarifárias")+"\n    ")])]},proxy:!0}])},[t._v(" "),o("validation-observer",{ref:"observer",scopedSlots:t._u([{key:"default",fn:function(e){var r=e.handleSubmit;return[o("b-form",{on:{submit:function(e){return e.stopPropagation(),e.preventDefault(),r(t.save)}}},[o("b-row",[o("b-col",{attrs:{sm:"12"}},[o("validation-provider",{attrs:{name:"descricao",rules:{required:!0}},scopedSlots:t._u([{key:"default",fn:function(e){return[o("b-form-group",{attrs:{label:"Descrição"}},[o("b-form-input",{attrs:{placeholder:"Descrição...",maxlength:"60",state:t.getValidationState(e)},model:{value:t.dadosComputados.descricao,callback:function(e){t.$set(t.dadosComputados,"descricao",e)},expression:"dadosComputados.descricao"}})],1)]}}],null,!0)})],1)],1),t._v(" "),o("b-row",{staticClass:"mt-4 pt-3 border-top"},[o("b-col",{staticClass:"pl-2",attrs:{md:"8"}},[o("b-button",{staticClass:"my-2 ml-2 rounded",attrs:{size:"sm",variant:"primary",type:"submit"}},[o("fa-icon",{attrs:{icon:"save"}}),t._v(" "),o("span",{staticClass:"ml-1"},[t._v("Salvar")])],1),t._v(" "),o("b-button",{staticClass:"my-2 ml-2 rounded",attrs:{size:"sm",variant:"outline-secondary"},on:{click:t.closeModal}},[o("fa-icon",{attrs:{icon:"times"}}),t._v(" "),o("span",{staticClass:"ml-1"},[t._v("Cancelar")])],1)],1),t._v(" "),o("b-col",{staticClass:"d-flex justify-content-end",attrs:{md:"4"}},[void 0!==t.dadosComputados.id?o("b-button",{staticClass:"my-2 ml-2 rounded",attrs:{size:"sm",variant:"outline-danger"},on:{click:t.deleteRevisoesTarifarias}},[o("fa-icon",{attrs:{icon:"trash-alt"}}),t._v(" "),o("span",{staticClass:"ml-1"},[t._v("Excluir")])],1):t._e()],1)],1)],1)]}}])})],1)}),[],!1,null,null,null);e.default=component.exports}}]);
//# sourceMappingURL=3ff05fd-1.2.11.js.map