(window.webpackJsonp=window.webpackJsonp||[]).push([[150],{1461: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);function l(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 c(t){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?l(Object(source),!0).forEach((function(e){Object(r.a)(t,e,source[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(source)):l(Object(source)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(source,e))}))}return t}var d={props:{areaAux:{type:Object,default:function(){return null}},tipoUsuario:{type:String,default:function(){return null}},item:{type:Object,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(t){this.$emit("update:areaAux",t)}}}),mounted:function(){var t=this;this.$root.$on("bv::modal::show",(function(e,o){"modalUsuario"===o&&(t.usuarios=[],t.pesquisa="",t.findUsuariosEmpresa())}))},methods:{findUsuariosEmpresa:function(){var t=this;this.busy=!0,this.$usuarioService.getUsuarioByEmpresa(this.item.sigla,void 0).then((function(e){t.usuarios=e.data,t.busy=!1})).catch((function(e){t.$notifyApiError(e,"Erro ao buscar usuários")}))},getTitulo:function(){var text="";return"R"===this.tipoUsuario?text="Selecione 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),this.$bvModal.hide("modalUsuario")},closeModal:function(){this.$bvModal.hide("modalUsuario")}}},m=o(42),component=Object(m.a)(d,(function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("b-modal",{attrs:{id:"modalUsuario",scrollable:"",centered:"","hide-header-close":"","hide-footer":""},scopedSlots:t._u([{key:"modal-header",fn:function(){return[o("div",{staticClass:"d-flex"},[o("h4",{},[t._v(t._s(t.getTitulo()))])])]},proxy:!0}])},[t._v(" "),o("b-row",[o("b-col",[o("b-form-group",{attrs:{label:"Pesquisa"}},[o("b-form-input",{model:{value:t.pesquisa,callback:function(e){t.pesquisa=e},expression:"pesquisa"}})],1)],1)],1),t._v(" "),o("b-table",{attrs:{striped:"",hover:"",selectable:"","select-mode":"single",items:t.usuarios,fields:t.fields,"per-page":t.perPage,filter:t.pesquisa,"current-page":t.currentPage,busy:t.busy,"busy-empty":!0},on:{"row-clicked":function(e){t.usuario=e}},scopedSlots:t._u([{key:"table-busy",fn:function(){return[o("div",{staticClass:"text-center text-primary my-2"},[o("b-spinner",{staticClass:"align-middle"}),t._v(" "),o("strong",[t._v("Carregando...")])],1)]},proxy:!0}])}),t._v(" "),t.usuarios.length>t.perPage?o("b-pagination",{attrs:{"total-rows":t.usuarios.length,"per-page":t.perPage,align:"center",pills:""},model:{value:t.currentPage,callback:function(e){t.currentPage=e},expression:"currentPage"}}):t._e(),t._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:"success",type:"submit"},on:{click:t.confirmModal}},[o("fa-icon",{attrs:{icon:"save"}}),t._v(" "),o("span",{staticClass:"ml-1"},[t._v("Confirmar")])],1),t._v(" "),o("b-button",{staticClass:"my-2 ml-2 rounded",attrs:{size:"sm",variant:"outline-primary"},on:{click:t.closeModal}},[o("fa-icon",{attrs:{icon:"times"}}),t._v(" "),o("span",{staticClass:"ml-1"},[t._v("Cancelar")])],1)],1)],1)],1)}),[],!1,null,null,null);e.default=component.exports}}]);
//# sourceMappingURL=4aeeb44-1.2.11.js.map