(window.webpackJsonp=window.webpackJsonp||[]).push([[320],{1207:function(e,t,o){"use strict";o.r(t);o(6),o(5),o(7),o(4),o(12),o(8),o(13);var r=o(2),n=o(78);function l(object,e){var t=Object.keys(object);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(object);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(object,e).enumerable}))),t.push.apply(t,o)}return t}function c(e){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?l(Object(source),!0).forEach((function(t){Object(r.a)(e,t,source[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(source)):l(Object(source)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(source,t))}))}return e}var d={props:{areaAux:{type:Object,default:function(){return null}},tipoUsuario:{type:String,default:function(){return null}}},data:function(){return{pesquisa:"",usuario:{},usuarios:[],fields:[{key:"nome",label:"Nome",sortable:!0},{key:"login",label:"Login",sortable:!0}],busy:!1,perPage:5,currentPage:1}},computed:c(c({},Object(n.c)({empresa:"empresa/empresaAtual",empresas:"empresa/empresas"})),{},{dadosComputados:{get:function(){return this.areaAux},set:function(e){this.$emit("update:areaAux",e)}}}),mounted:function(){var e=this;this.$root.$on("bv::modal::show",(function(t,o){"modalUsuario"===o&&(e.usuarios=[],e.pesquisa="",e.findUsuarios())}))},methods:{findUsuarios:function(){var e=this;this.busy=!0,this.$usuarioService.getAllByEmpresa(this.empresa.sigla).then((function(t){e.usuarios=t.data,e.busy=!1})).catch((function(t){e.$notify({title:"Erro",text:t.response?t.response.data.message:t,type:"error"})}))},getTitulo:function(){var text="";return"R"===this.tipoUsuario?text="Selecine o responsável":"S"===this.tipoUsuario?text="Selecione o substituto":"G"===this.tipoUsuario&&(text="Selecione o gerente"),text},confirmModal:function(){"R"===this.tipoUsuario?(this.dadosComputados.responsavel=this.usuario,this.dadosComputados.idResponsavel=this.usuario.id):"S"===this.tipoUsuario?(this.dadosComputados.substituto=this.usuario,this.dadosComputados.idSubstituto=this.usuario.id):"G"===this.tipoUsuario&&(this.dadosComputados.gerente=this.usuario,this.dadosComputados.idGerente=this.usuario.id),console.log(this.dadosComputados),this.$bvModal.hide("modalUsuario")},closeModal:function(){this.$bvModal.hide("modalUsuario")}}},m=o(42),component=Object(m.a)(d,(function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("b-modal",{attrs:{id:"modalUsuario",scrollable:"",centered:"","hide-header-close":"","hide-footer":""},scopedSlots:e._u([{key:"modal-header",fn:function(){return[o("div",{staticClass:"d-flex"},[o("h4",{},[e._v(e._s(e.getTitulo()))])])]},proxy:!0}])},[e._v(" "),o("b-row",[o("b-col",[o("b-form-group",{attrs:{label:"Pesquisa"}},[o("b-form-input",{model:{value:e.pesquisa,callback:function(t){e.pesquisa=t},expression:"pesquisa"}})],1)],1)],1),e._v(" "),o("b-table",{attrs:{striped:"",hover:"",selectable:"","select-mode":"single",items:e.usuarios,fields:e.fields,"per-page":e.perPage,filter:e.pesquisa,"current-page":e.currentPage,busy:e.busy,"busy-empty":!0},on:{"row-clicked":function(t){e.usuario=t}},scopedSlots:e._u([{key:"table-busy",fn:function(){return[o("div",{staticClass:"text-center text-primary my-2"},[o("b-spinner",{staticClass:"align-middle"}),e._v(" "),o("strong",[e._v("Carregando...")])],1)]},proxy:!0}])}),e._v(" "),e.usuarios.length>e.perPage?o("b-pagination",{attrs:{"total-rows":e.usuarios.length,"per-page":e.perPage,align:"center",pills:""},model:{value:e.currentPage,callback:function(t){e.currentPage=t},expression:"currentPage"}}):e._e(),e._v(" "),o("b-row",{staticClass:"mt-2 pt-3 border-top"},[o("b-col",{staticClass:"pl-2"},[o("b-button",{staticClass:"my-2 ml-2 rounded",attrs:{size:"sm",variant:"primary",type:"submit"},on:{click:e.confirmModal}},[o("fa-icon",{attrs:{icon:"save"}}),e._v(" "),o("span",{staticClass:"ml-1"},[e._v("Confirmar")])],1),e._v(" "),o("b-button",{staticClass:"my-2 ml-2 rounded",attrs:{size:"sm",variant:"outline-primary"},on:{click:e.closeModal}},[o("fa-icon",{attrs:{icon:"times"}}),e._v(" "),o("span",{staticClass:"ml-1"},[e._v("Cancelar")])],1)],1)],1)],1)}),[],!1,null,null,null);t.default=component.exports}}]);
//# sourceMappingURL=5a103c3-1.2.11.js.map