"use strict";(self["webpackChunkcarabi_x2"]=self["webpackChunkcarabi_x2"]||[]).push([[9726],{1387:function(t,r,e){e.r(r),e.d(r,{default:function(){return f}});var i=function(){var t=this,r=t._self._c;return r("Modal",{ref:"modal",attrs:{title:"Сменить роль",autoOpen:!0,fullHeight:!1},on:{closed:function(r){return t.$emit("closed")}}},[r("div",{staticClass:"flex-row flex-grow uk-padding-small"},[r("ul",{staticClass:"uk-nav"},t._l(t.roles,(function(e){return r("li",{key:e.ROLE_ID,on:{click:function(r){r.preventDefault(),t.curRoleId=e.ROLE_ID}}},[r("a",{class:{"uk-text-bold":e.ROLE_ID===t.curRoleId}},[r("img",{staticClass:"uk-margin-small-right",attrs:{src:"img/icons/user_profile.svg","uk-svg":"",width:"16",height:"16"}}),t._v(" "+t._s(e.EMPNAME)+" ")])])})),0)]),r("div",{staticClass:"flex-row uk-padding-small",staticStyle:{"border-top":"1px solid #d5e1e6"}},[r("div",{staticClass:"flex-grow"},[r("button",{staticClass:"uk-margin-small-right uk-button uk-button-primary",attrs:{type:"button",disabled:t.changing},on:{click:function(r){return r.preventDefault(),t.change.apply(null,arguments)}}},[t._v("Сменить")])]),r("div",{staticClass:"uk-text-right",staticStyle:{"line-height":"40px"}},[t.canRunConfigurator?r("label",[r("input",{directives:[{name:"model",rawName:"v-model",value:t.configurator,expression:"configurator"}],staticClass:"pos-checkbox",attrs:{type:"checkbox"},domProps:{checked:Array.isArray(t.configurator)?t._i(t.configurator,null)>-1:t.configurator},on:{change:function(r){var e=t.configurator,i=r.target,o=!!i.checked;if(Array.isArray(e)){var a=null,n=t._i(e,a);i.checked?n<0&&(t.configurator=e.concat([a])):n>-1&&(t.configurator=e.slice(0,n).concat(e.slice(n+1)))}else t.configurator=o}}}),t._v(" конфигуратор роли ")]):t._e()])])])},o=[],a=e(3216),n=e(5512),s={name:"ChangeRole",components:{Modal:()=>e.e(8362).then(e.bind(e,2215))},props:{},data(){return{curRoleId:null,changing:!1,configurator:!1}},computed:{user_info(){return this.$store.state.profile.user_info},profile(){return this.$store.state.profile.profile},roles(){return this.$store.state.profile.employee_list},canRunConfigurator(){return"0"!==this.profile.CAN_CHANGE_ROLE_DM}},async mounted(){this.curRoleId=this.user_info.ROLE_ID,this.configurator=this.profile.CONFIGURATOR_MODE},methods:{async change(){this.changing=!0;try{let t=this.roles.find((t=>t.ROLE_ID===this.curRoleId));this.canRunConfigurator||(this.configurator=!1),await a.FH.auth.changeRole(t.EMPLOYEE_ID,t.ROLE_ID,this.configurator),n.A.clear(),location.reload()}catch(t){throw this.changing=!1,t}}}},l=s,c=e(1656),u=(0,c.A)(l,i,o,!1,null,null,null),f=u.exports}}]);
//# sourceMappingURL=ModalChangeRole.f134136b.js.map