import{a as N}from"./chunk-MLGLFM7E.js";import{b as P}from"./chunk-AJTKPNL2.js";import{a as R}from"./chunk-F5MI6XGL.js";import"./chunk-SMMIHGJB.js";import{d as j}from"./chunk-7PKMSCVL.js";import"./chunk-WL2OYEJL.js";import{a as L}from"./chunk-RVEFR64E.js";import"./chunk-JSG72ZNQ.js";import"./chunk-JAY45DEO.js";import"./chunk-LINAD4CC.js";import"./chunk-UBQPCB4A.js";import"./chunk-RTVR37QC.js";import"./chunk-ZATDFETU.js";import"./chunk-QHAVDXDG.js";import{S as A,ba as M}from"./chunk-27KSTDMK.js";import"./chunk-RTL4XZI4.js";import"./chunk-QGNMEQRN.js";import"./chunk-F4GTCTBH.js";import"./chunk-WXQVX7WD.js";import"./chunk-OWZ5YAMH.js";import{a as T}from"./chunk-KXX3UDJ3.js";import"./chunk-PDYJ5OYY.js";import{j as I,z as C}from"./chunk-GQAU5ACB.js";import{Bb as c,Ec as _,Ib as k,Jc as U,Lc as w,Mb as S,Nb as y,S as s,Zc as x,fd as D,gd as F,hc as l,ic as f,jc as b,kc as g,kd as v,la as a,pa as u,sb as d,tc as B,yd as E}from"./chunk-ISMRT7VU.js";import"./chunk-GMHSUEGX.js";import"./chunk-M5TX2NVG.js";var p=(()=>{class t{constructor(e){this._http=e}getAll(e){return this._http.post("/api/admin/users/all",e,{headers:T})}block(e){return this._http.put(`/api/admin/users/${e}/block`,null)}unblock(e){return this._http.put(`/api/admin/users/${e}/unblock`,null)}static{this.\u0275fac=function(i){return new(i||t)(u(I))}}static{this.\u0275prov=a({token:t,factory:t.\u0275fac})}}return t})();var m=(()=>{class t{constructor(e){this._userServiceApi=e}getAll(e){return this._userServiceApi.getAll(e).pipe(s(1))}block(e){return this._userServiceApi.block(e).pipe(s(1))}unblock(e){return this._userServiceApi.unblock(e).pipe(s(1))}static{this.\u0275fac=function(i){return new(i||t)(u(p))}}static{this.\u0275prov=a({token:t,factory:t.\u0275fac})}}return t})();var O=[{caption:"\u0410\u0439\u0434\u0438",dataField:"id",width:"320px",minWidth:320},{caption:"\u0418\u043C\u044F",dataField:"fullName",showDashIfEmpty:!0,width:"25%",minWidth:130},{caption:"\u041D\u043E\u043C\u0435\u0440 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430",dataField:"login",width:"20%",minWidth:130,isCustom:!0},{caption:"\u041A\u043E\u043C\u043F\u0430\u043D\u0438\u044F",dataField:"companyNames",width:"25%",minWidth:130,showDashIfEmpty:!0},{caption:"\u0421\u0442\u0430\u0442\u0443\u0441",dataField:"isBlocked",isCustom:!0,width:"80px",minWidth:100}];var H=(t,o)=>({login:t,isBlocked:o});function G(t,o){if(t&1&&(U(0),D(1,"phoneFormat")),t&2){let e=o.$implicit;w(" ",F(1,1,e.login),`
`)}}function K(t,o){if(t&1&&(f(0,"div",5),g(1,"wk-badge",6),b()),t&2){let e=o.$implicit;d(),l("text",e.isBlocked?"\u0417\u0430\u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u043D":"\u0410\u043A\u0442\u0438\u0432\u0435\u043D")("variant",e.isBlocked?"error":"success")("stylingMode","outlined")}}var V=(()=>{class t extends P{get criteria(){return{search:{id:this.searchValue,name:this.searchValue,login:this.searchValue,company:this.searchValue},filter:null}}constructor(e,i,r){super(i,r),this._userService=e,this.columns=O,this.menuItems=[{text:"\u0417\u0430\u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u0442\u044C",action:n=>this._blockUser(n.id),visible:n=>!n.isBlocked},{text:"\u0420\u0430\u0437\u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u0442\u044C",action:n=>this._unBlockUser(n.id),visible:n=>n.isBlocked}]}getLoadMethod(e){return this._userService.getAll(e)}_blockUser(e){this._userService.block(e).pipe(C(this.destroyRef)).subscribe(()=>{this.table?.refresh()})}_unBlockUser(e){this._userService.unblock(e).pipe(C(this.destroyRef)).subscribe(()=>{this.table?.refresh()})}static{this.\u0275fac=function(i){return new(i||t)(c(m),c(E),c(M))}}static{this.\u0275cmp=k({type:t,selectors:[["tis-user-list"]],features:[S],decls:8,vars:16,consts:[["table",""],["phone",""],["isBlockedTmpl",""],["title","\u041F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u0438",1,"header",3,"showBackButton"],["searchPlaceholder","\u041F\u043E\u0438\u0441\u043A \u043F\u043E ID, \u0438\u043C\u0435\u043D\u0438, \u043D\u043E\u043C\u0435\u0440\u0443 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430 \u0438 \u043A\u043E\u043C\u043F\u0430\u043D\u0438\u0438",3,"changedSearch","allowColumnResizing","data","columns","menuItems","enableContextMenu","enablePagination","hoverable","pageNavigation","enableToolbar","enableFilters","enableSpinner","customTemplates"],[1,"status-badge"],[3,"text","variant","stylingMode"]],template:function(i,r){if(i&1&&(g(0,"tis-subheader",3),f(1,"tis-main-layout")(2,"tis-table",4,0),B("changedSearch",function(h){return r.changedSearch(h)}),b()(),y(4,G,2,3,"ng-template",null,1,v)(6,K,2,3,"ng-template",null,2,v)),i&2){let n=_(5),h=_(7);l("showBackButton",!1),d(2),l("allowColumnResizing",!0)("data",r.dataSource)("columns",r.columns)("menuItems",r.menuItems)("enableContextMenu",!0)("enablePagination",!0)("hoverable",!0)("pageNavigation",!0)("enableToolbar",!0)("enableFilters",!1)("enableSpinner",!0)("customTemplates",x(13,H,n,h))}},dependencies:[R,L,j,A,N],styles:[`[_nghost-%COMP%]{display:flex;flex-direction:column;min-height:100%}.header[_ngcontent-%COMP%]{top:0;position:sticky;z-index:10}.status-badge[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:center}
/*# sourceMappingURL=user-list.component-WYTKQDBD.css.map */`],changeDetection:0})}}return t})();var pe=[{path:"",component:V,pathMatch:"full",providers:[p,m]},{path:"**",redirectTo:""}];export{pe as routes};
//# sourceMappingURL=users.routes-3U45EAUJ.js.map
