(window.webpackJsonp=window.webpackJsonp||[]).push([[1069],{2818:function(t,e,r){"use strict";r.r(e);r(137),r(4);var o={name:"Servico",data:function(){return{busyApi:!1,empresa:null,filter:null,servicos:[],fieldsServico:[{key:"actions",label:"Ações",thStyle:{width:"2% !important"}},{key:"descricao",label:"Descrição",thStyle:{width:"5% !important"}},{key:"grupoServico.descricao",label:"Grupo serviço",thStyle:{width:"5% !important"}},{key:"unidade.descricao",label:"Unidade Medida",thStyle:{width:"5% !important"}}],perPage:10,currentPage:1,errorMsg:null,infoMsg:null,dismissSecs:5,dismissCountDown:0,showDismissibleAlert:!1}},computed:{rows:function(){return this.servicos.length}},mounted:function(){this.empresa=this.$store.getters["empresa/empresaAtual"],this.findServicos()},methods:{addServico:function(){this.$router.push("/conservacao/cadastros/servicoEdit")},editServico:function(t){this.$router.push("/conservacao/cadastros/servicoEdit/".concat(t.idServico))},findServicos:function(){var t=this;this.busyApi=!0,this.$servicoService.find(this.empresa.id).then((function(e){t.servicos=e.data,t.busyApi=!1})).catch((function(e){t.busyApi=!1,t.servico=[],t.errorMsg=e,t.showAlert()}))},deleteServico:function(t){var e=this;this.$bvModal.msgBoxConfirm("Deseja excluir o servico ?").then((function(r){r&&e.$servicoService.delete(t.idEmpresa,t.idServico).then((function(){e.findServicos(),e.infoMsg="Serviço excluído com sucesso.",e.showAlert()}))})).catch((function(t){e.servico=[],e.errorMsg=t.masseger,e.showAlert()}))},countDownChanged:function(t){this.dismissCountDown=t},showAlert:function(){this.dismissCountDown=this.dismissSecs}}},n=r(42),component=Object(n.a)(o,(function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"animated fadeIn"},[r("b-row",[r("b-col",{attrs:{sm:"12"}},[r("b-card",[r("div",{attrs:{slot:"header"},slot:"header"},[r("b-row",[r("b-col",{attrs:{cols:"10"}},[r("h4",{staticClass:"primary mt-4"},[t._v("Serviços")])]),t._v(" "),r("b-col",{attrs:{cols:"2"}},[r("b-button",{staticClass:"mt-4 ml-5",attrs:{small:"",variant:"info"},on:{click:t.addServico}},[r("fa-icon",{attrs:{icon:"file"}}),t._v(" "),r("span",{staticClass:"ml-1"},[t._v("Inserir")])],1)],1)],1)],1),t._v(" "),r("b-col",{staticClass:"my-1",attrs:{lg:"6"}},[r("b-form-group",{staticClass:"mb-0",attrs:{"label-cols-sm":"3","label-align-sm":"right","label-size":"sm","label-for":"filterInput"}},[r("b-input-group",{attrs:{size:"sm"}},[r("b-form-input",{attrs:{id:"filterInput",type:"search",placeholder:"Digite o filtro desejado"},model:{value:t.filter,callback:function(e){t.filter=e},expression:"filter"}}),t._v(" "),r("b-input-group-append",[r("b-button",{attrs:{disabled:!t.filter},on:{click:function(e){t.filter=""}}},[t._v("Clear")])],1)],1)],1)],1),t._v(" "),r("b-pagination",{attrs:{align:"center","total-rows":t.rows,"per-page":t.perPage,"aria-controls":"my-table"},model:{value:t.currentPage,callback:function(e){t.currentPage=e},expression:"currentPage"}}),t._v(" "),r("b-table",{attrs:{striped:"",hover:"",fields:t.fieldsServico,filter:t.filter,items:t.servicos,responsive:"","per-page":t.perPage,"current-page":t.currentPage,"show-empty":!0,"empty-text":"Não há serviços disponíveis.",busy:t.busyApi},scopedSlots:t._u([{key:"table-busy",fn:function(){return[r("div",{staticClass:"text-center text-info my-2"},[r("b-spinner",{staticClass:"align-middle"}),t._v(" "),r("strong",[t._v("Carregando...")])],1)]},proxy:!0},{key:"cell(actions)",fn:function(e){return[r("b-button",{staticClass:"mr-2",attrs:{small:"",variant:"info"},on:{click:function(r){return t.editServico(e.item.id)}}},[r("fa-icon",{attrs:{icon:"edit"}})],1),t._v(" "),r("b-button",{staticClass:"center",attrs:{small:"",variant:"danger"},on:{click:function(r){return t.deleteServico(e.item.id)}}},[r("fa-icon",{attrs:{icon:"trash-alt"}})],1)]}}])})],1)],1)],1),t._v(" "),r("b-alert",{staticClass:"position-fixed fixed-top m-0 rounded-0",staticStyle:{"z-index":"2000"},attrs:{show:t.dismissCountDown,variant:"success",dismissible:"",fade:""},on:{"dismiss-count-down":t.countDownChanged}},[t._v(t._s(t.infoMsg))]),t._v(" "),r("b-alert",{staticClass:"position-fixed fixed-bottom m-0 rounded-0",staticStyle:{"z-index":"2000"},attrs:{show:t.dismissCountDown,variant:"danger",dismissible:"",fade:""},on:{"dismiss-count-down":t.countDownChanged}},[t._v(t._s(t.errorMsg))])],1)}),[],!1,null,null,null);e.default=component.exports}}]);
//# sourceMappingURL=ed0b42a-1.2.11.js.map