(window.webpackJsonp=window.webpackJsonp||[]).push([[1081],{2822:function(t,e,n){"use strict";n.r(e);n(137),n(4);var o={name:"Elemento",data:function(){return{fieldsElementos:[{key:"actions",label:"Ações",thStyle:{width:"5% !important"}},{key:"sigla",label:"Sigla",thStyle:{width:"10% !important"}},{key:"descricao",label:"Descrição",thStyle:{width:"25% !important"}}],elementos:[],errorMsg:null,infoMsg:null}},mounted:function(){this.empresa=this.$store.getters["empresa/empresaAtual"],this.findElementos()},methods:{findElementos:function(){var t=this;this.$elementoService.find(this.empresa.id).then((function(e){t.elementos=e.data})).catch((function(e){t.elementos=[],t.errorMsg=e}))},addElemento:function(){this.$router.push("/conservacao/inventario/elementoEdit")},editElemento:function(t){console.log(t),this.$router.push("/conservacao/inventario/elementoEdit/".concat(t.idElemento))},deleteElemento:function(t){var e=this;this.$bvModal.msgBoxConfirm("Deseja excluir o elemento ?").then((function(n){n&&e.$elementoService.delete(t.idEmpresa,t.idElemento).then((function(){e.findElementos(),e.infoMsg="Elemento excluído com sucesso."}))})).catch((function(t){e.errorMsg=t}))}}},l=n(42),component=Object(l.a)(o,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("b-row",[n("b-col",{attrs:{sm:"12"}},[n("b-card",[n("div",{attrs:{slot:"header"},slot:"header"},[n("b-row",[n("b-col",{attrs:{cols:"10"}},[n("h4",{staticClass:"primary mt-4"},[t._v("Elementos")])]),t._v(" "),n("b-col",{attrs:{cols:"2"}},[n("b-button",{staticClass:"mt-4 ml-5",attrs:{small:"",variant:"info"},on:{click:t.addElemento}},[n("fa-icon",{attrs:{icon:"file"}}),t._v(" "),n("span",{staticClass:"ml-1"},[t._v("Inserir")])],1)],1)],1)],1),t._v(" "),n("b-table",{attrs:{striped:"",hover:"",fields:t.fieldsElementos,items:t.elementos,responsive:"","show-empty":!0,"empty-text":"Não há elementos disponíveis."},scopedSlots:t._u([{key:"cell(actions)",fn:function(e){return[n("b-button",{staticClass:"mr-2",attrs:{small:"",variant:"info"},on:{click:function(n){return t.editElemento(e.item.id)}}},[n("fa-icon",{attrs:{icon:"edit"}})],1),t._v(" "),n("b-button",{staticClass:"center",attrs:{small:"",variant:"danger"},on:{click:function(n){return t.deleteElemento(e.item.id)}}},[n("fa-icon",{attrs:{icon:"trash-alt"}})],1)]}}])})],1)],1)],1),t._v(" "),n("b-alert",{staticClass:"position-fixed fixed-top m-0 rounded-0",staticStyle:{"z-index":"2000"},attrs:{show:null!=t.infoMsg,variant:"success",dismissible:"",fade:""}},[t._v(t._s(t.infoMsg))]),t._v(" "),n("b-alert",{staticClass:"position-fixed fixed-bottom m-0 rounded-0",staticStyle:{"z-index":"2000"},attrs:{show:null!=t.errorMsg,variant:"danger",dismissible:"",fade:""}},[t._v(t._s(t.errorMsg))])],1)}),[],!1,null,null,null);e.default=component.exports}}]);
//# sourceMappingURL=40ef8c3-1.2.11.js.map