(window.webpackJsonp=window.webpackJsonp||[]).push([[624],{1395: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:"ModalValor",components:{ValidationProvider:d.ValidationProvider,ValidationObserver:d.ValidationObserver},props:{dados:{type:Object,default:function(){return{}}},findClassesNotificacao:{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){"editClassesNotificacaoModal"===o&&void 0===t.dadosComputados.id&&(t.dadosComputados={})}))},methods:{save:function(){var t=this;void 0===this.dadosComputados.idEmpresa&&(this.dadosComputados.idEmpresa=this.empresa.id),this.$notificacaoService.saveClasses(this.empresa.sigla,this.dadosComputados).then((function(){void 0!==t.dadosComputados.id?t.$notify({title:"Confirmação",text:"Classes de Notificações alterada com sucesso.",type:"success"}):t.$notify({title:"Confirmação",text:"Classes de Notificações incluída com sucesso.",type:"success"}),t.$bvModal.hide("editClassesNotificacaoModal"),t.findClassesNotificacao()})).catch((function(e){t.$notify({title:"Erro",text:e.response?e.response.data.message:e,type:"error"})}))},closeModal:function(){this.$bvModal.hide("editClassesNotificacaoModal")},deleteClasses:function(){var t=this;this.$notificacaoService.deleteClasses(this.empresa.sigla,this.dadosComputados.id).then((function(){t.$bvModal.hide("editClassesNotificacaoModal"),t.findClassesNotificacao(),t.$notify({title:"Confirmação",text:"Classes de Notificações 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}}},m=o(42),component=Object(m.a)(f,(function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("b-modal",{attrs:{id:"editClassesNotificacaoModal",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 Classes de Notificações":"Editar Classes de Notificações")+"\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:{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:function(e){return t.deleteClasses()}}},[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=4d68ec2-1.2.11.js.map