(window.webpackJsonp=window.webpackJsonp||[]).push([[243],{1459:function(t,e,o){"use strict";o.r(e);o(6),o(5),o(7),o(4),o(12),o(8),o(13);var n=o(2),r=o(78),c=o(307);function d(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?d(Object(source),!0).forEach((function(e){Object(n.a)(t,e,source[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(source)):d(Object(source)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(source,e))}))}return t}var f={name:"ModalLicencas",components:{ValidationProvider:c.ValidationProvider,ValidationObserver:c.ValidationObserver},props:{dados:{type:Object,default:function(){return{}}},findStatusLicencas:{type:Function,default:function(){return[]}}},data:function(){return{}},computed:l(l({},Object(r.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){"editLicencas"===o&&void 0===t.dadosComputados.id&&(t.dadosComputados={})}))},methods:{save:function(){var t=this;this.$licencaService.saveStatusLicencas(this.dadosComputados).then((function(){void 0!==t.dadosComputados.id?t.$notify({title:"Confirmação",text:"Status da Licenca alterada com sucesso.",type:"success"}):t.$notify({title:"Confirmação",text:"Status da Licenca incluída com sucesso.",type:"success"}),t.$bvModal.hide("editLicencas"),t.findStatusLicencas()})).catch((function(e){t.$notifyApiError(e,"Erro ao salvar licença")}))},closeModal:function(){this.$bvModal.hide("editLicencas")},deleteStatusLicencas:function(){var t=this;this.$licencaService.deleteStatusLicencas(this.dadosComputados.id).then((function(){t.$bvModal.hide("editLicencas"),t.findStatusLicencas(),t.$notify({title:"Confirmação",text:"Status da Licenca excluído com sucesso.",type:"success"})})).catch((function(e){t.$notifyApiError(e,"Erro ao excluir licença")}))},getValidationState:function(t){var e=t.dirty,o=t.validated,n=t.valid;return e||o?n: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:"editLicencas",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 Status das Licenças":"Editar Status das Licenças")+"\n    ")])]},proxy:!0}])},[t._v(" "),o("validation-observer",{ref:"observer",scopedSlots:t._u([{key:"default",fn:function(e){var n=e.handleSubmit;return[o("b-form",{on:{submit:function(e){return e.stopPropagation(),e.preventDefault(),n(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:"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.deleteStatusLicencas()}}},[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=4ad8694-1.2.11.js.map