import{a as N}from"./chunk-QJECG27R.js";import{a as Ae}from"./chunk-OHGYCSRE.js";import{b as ie}from"./chunk-5OZTUYJC.js";import{b as we}from"./chunk-VLPXNKU4.js";import{c as Ge}from"./chunk-TFQ3RBKD.js";import{a as Be}from"./chunk-GFXONX4P.js";import{a as ee}from"./chunk-RU43IR5J.js";import{a as te}from"./chunk-6JC3FZFK.js";import{a as O}from"./chunk-Y7IP5WLG.js";import{I as ke,a as Re}from"./chunk-SLGBXDUF.js";import{a as Z}from"./chunk-LY6HB4BL.js";import{T as Le,d as X}from"./chunk-FBI7JGZC.js";import{a as M}from"./chunk-ILYMG6ZI.js";import{f as Se,r as D,t as Ue,x as J}from"./chunk-MXUIPT66.js";import{c as Ee,f as Te,l as Fe}from"./chunk-DX7LHTFF.js";import{$b as $,Aa as E,Ab as a,Ba as T,Bb as g,Cb as C,Db as y,Dc as R,E as me,Eb as j,Fb as S,Ka as fe,Kb as U,Kd as A,Lb as s,Og as z,Ua as r,Va as h,Vc as q,Wc as H,Wg as V,Xb as b,Xc as k,Yb as d,Zb as ge,_b as f,a as le,ad as Y,bd as w,cc as ve,dc as he,ec as Ce,gd as Ie,ib as _,ic as pe,jc as x,kc as ye,lc as Q,nb as xe,ob as c,rc as u,rg as K,s as ue,sc as m,ta as B,tc as be,vc as W,wa as _e,wc as I,yh as P,za as de,zb as l}from"./chunk-N6B2OJOY.js";var Ve=(()=>{let i=class i{transform(n,o){return n.approvalProcessType!==X.No_Approval&&o.get(n.uid)&&o.get(n.uid).length?o.get(n.uid).join(", "):"-"}};i.\u0275fac=function(o){return new(o||i)},i.\u0275pipe=_e({name:"foerchGetCustomerApprover",type:i,pure:!0});let e=i;return e})();var Ze=function(e,i,t,n){var o=arguments.length,p=o<3?i:n===null?n=Object.getOwnPropertyDescriptor(i,t):n,v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,i,t,n);else for(var F=e.length-1;F>=0;F--)(v=e[F])&&(p=(o<3?v(p):o>3?v(i,t,p):v(i,t))||p);return o>3&&p&&Object.defineProperty(i,t,p),p},et=function(e,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,i)},tt=(e,i)=>({currencyCode:e,locale:i}),ne=e=>({uid:e}),re=e=>({cxRoute:"customers",params:e}),ce=(e,i,t)=>[e,i,"symbol","1.0",t],Ne=e=>({"text-body-secondary":e});function it(e,i){e&1&&j(0)}function nt(e,i){if(e&1&&(C(0),_(1,it,1,0,"ng-container",5),u(2,"async"),u(3,"async"),y()),e&2){let t=s(),n=b(2),o=b(4);r(),c("ngTemplateOutlet",t.isMobile?n:o)("ngTemplateOutletContext",ye(6,tt,m(2,2,t.currencyCode$),m(3,4,t.locale$)))}}function rt(e,i){e&1&&(l(0,"small",17),d(1),u(2,"cxTranslate"),a()),e&2&&(r(),f(" ",m(2,1,"userGroups.userList.disabled")," "))}function ot(e,i){if(e&1){let t=S();l(0,"button",18),u(1,"cxTranslate"),U("click",function(){E(t);let o=s().$implicit,p=s(2);return T(p.deleteDialog(o))}),g(2,"cx-icon",14),a()}if(e&2){let t=s().$implicit,n=s(2);c("disabled",t.uid===n.currentUserId)("title",m(1,3,"userGroups.userList.icons.deleteUser")),r(2),c("type",n.iconTypes.DELETE)}}function ct(e,i){if(e&1&&(C(0),d(1),u(2,"currency"),y()),e&2){let t=s(2).$implicit,n=s(),o=n.currencyCode,p=n.locale;r(),f(" ",W(2,1,Q(7,ce,t.approvalProcessValue,o,p))," ")}}function st(e,i){e&1&&(d(0),u(1,"cxTranslate")),e&2&&f(" ",m(1,1,"userGroups.userList.unlimited")," ")}function pt(e,i){if(e&1&&(l(0,"div",7)(1,"div",20),d(2),u(3,"cxTranslate"),a(),l(4,"div",21),d(5),u(6,"currency"),a()()),e&2){let t=s(2).$implicit,n=s(),o=n.currencyCode,p=n.locale;r(2),f(" ",m(3,2,"userGroups.userList.remaining")," "),r(3),f(" ",W(6,4,Q(10,ce,t.remainingBudget?t.remainingBudget:0,o,p))," ")}}function at(e,i){if(e&1&&(l(0,"small",19)(1,"strong",7)(2,"div",20),d(3),u(4,"cxTranslate"),a(),l(5,"div",21),_(6,ct,3,11,"ng-container",4)(7,st,2,3,"ng-template",null,3,I),a()(),_(9,pt,7,14,"div",22),l(10,"div",7)(11,"div",20)(12,"strong"),d(13),u(14,"cxTranslate"),a()(),l(15,"div",21),d(16),a()()()),e&2){let t=b(8),n=s().$implicit,o=s(2);c("ngClass",n.active?"col-12 mt-1 p-0":"col-12 mt-1 p-0 text-body-secondary"),r(3),f(" ",m(4,7,"userGroups.userList.budget")," "),r(3),c("ngIf",n.approvalProcessValue)("ngIfElse",t),r(3),c("ngIf",n.approvalProcessValue),r(4),f(" ",m(14,9,"userGroups.userList.approver")," "),r(3),f(" ",o.approversMap.get(n.uid).length?o.approversMap.get(n.uid).join(", "):"-"," ")}}function lt(e,i){if(e&1&&(C(0),l(1,"div",7)(2,"div",8)(3,"a",9),u(4,"cxUrl"),d(5),_(6,rt,3,3,"small",10),a()(),l(7,"div",11)(8,"div",12)(9,"a",13),u(10,"cxUrl"),u(11,"cxTranslate"),g(12,"cx-icon",14),a(),_(13,ot,3,5,"button",15),a()(),_(14,at,17,11,"small",16),a(),y()),e&2){let t=i.$implicit,n=s(2);r(3),c("routerLink",m(4,8,x(16,re,x(14,ne,t.uid)))),r(2),f(" ",t.name," "),r(),c("ngIf",!t.active),r(3),c("routerLink",m(10,10,x(20,re,x(18,ne,t.uid))))("title",m(11,12,"userGroups.userList.icons.editUser")),r(3),c("type",n.iconTypes.EDIT),r(),c("ngIf",n.userDeletable),r(),c("ngIf",n.showApprover)}}function ut(e,i){if(e&1&&_(0,lt,15,22,"ng-container",6),e&2){let t=s();c("ngForOf",t.customers)("ngForTrackBy",t.trackByIndex)}}function mt(e,i){e&1&&(C(0),l(1,"th"),d(2),u(3,"cxTranslate"),a(),l(4,"th"),d(5),u(6,"cxTranslate"),a(),y()),e&2&&(r(2),f(" ",m(3,2,"userGroups.userList.budget")," "),r(3),f(" ",m(6,4,"userGroups.userList.approver")," "))}function _t(e,i){e&1&&(l(0,"div",29),d(1),u(2,"cxTranslate"),a()),e&2&&(r(),f(" ",m(2,1,"userGroups.userList.disabled")," "))}function dt(e,i){if(e&1&&(C(0),d(1),u(2,"currency"),y()),e&2){let t=s(2).$implicit,n=s(),o=n.currencyCode,p=n.locale,v=s();r(),$(" ",W(2,2,Q(8,ce,t.approvalProcessValue,o,p))," / ",v.getApprovalReferenceValueText(t.approvalProcessReferenceValue)," ")}}function ft(e,i){e&1&&(d(0),u(1,"cxTranslate")),e&2&&f(" ",m(1,1,"userGroups.userList.unlimited")," ")}function xt(e,i){if(e&1&&(l(0,"div",29),d(1),u(2,"cxTranslate"),u(3,"currency"),a()),e&2){let t=s(2).$implicit,n=s(),o=n.currencyCode,p=n.locale;r(),$(" ",m(2,2,"userGroups.userList.remaining"),": ",W(3,4,Q(10,ce,t.remainingBudget?t.remainingBudget:0,o,p))," ")}}function gt(e,i){if(e&1&&(C(0),l(1,"td",19)(2,"strong"),_(3,dt,3,12,"ng-container",4)(4,ft,2,3,"ng-template",null,3,I),a(),_(6,xt,4,14,"div",25),a(),l(7,"td")(8,"span",30),d(9),u(10,"foerchGetCustomerApprover"),a()(),y()),e&2){let t=b(5),n=s().$implicit,o=s(2);r(),c("ngClass",x(8,Ne,!n.active)),r(2),c("ngIf",n.approvalProcessValue&&n.approvalProcessType===o.approvalTypes.Approval_With_Value)("ngIfElse",t),r(3),c("ngIf",n.approvalProcessValue),r(3),f(" ",be(10,5,n,o.approversMap)," ")}}function vt(e,i){if(e&1){let t=S();l(0,"button",31),u(1,"cxTranslate"),U("click",function(){E(t);let o=s().$implicit,p=s(2);return T(p.deleteDialog(o))}),g(2,"cx-icon",14),a()}if(e&2){let t=s().$implicit,n=s(2);c("disabled",t.uid===n.currentUserId)("title",m(1,3,"userGroups.userList.icons.deleteUser")),r(2),c("type",n.iconTypes.DELETE)}}function ht(e,i){if(e&1&&(l(0,"tr")(1,"td",19)(2,"a",9),u(3,"cxUrl"),d(4),a(),_(5,_t,3,3,"div",25),a(),_(6,gt,11,10,"ng-container",24),l(7,"td")(8,"div",26)(9,"a",27),u(10,"cxUrl"),u(11,"cxTranslate"),g(12,"cx-icon",14),a(),_(13,vt,3,5,"button",28),a()()()),e&2){let t=i.$implicit,n=s(2);r(),c("ngClass",x(15,Ne,!t.active)),r(),c("routerLink",m(3,9,x(19,re,x(17,ne,t.uid)))),r(2),f(" ",t.name," "),r(),c("ngIf",!t.active),r(),c("ngIf",n.showApprover),r(3),c("routerLink",m(10,11,x(23,re,x(21,ne,t.uid))))("title",m(11,13,"userGroups.userList.icons.editUser")),r(3),c("type",n.iconTypes.EDIT),r(),c("ngIf",n.userDeletable)}}function Ct(e,i){if(e&1&&(l(0,"table",23)(1,"thead")(2,"tr")(3,"th"),d(4),u(5,"cxTranslate"),a(),_(6,mt,7,6,"ng-container",24),l(7,"th"),d(8,"\xA0"),a()()(),l(9,"tbody"),_(10,ht,14,25,"tr",6),a()()),e&2){let t=s();r(4),ge(m(5,4,"userGroups.userList.name")),r(2),c("ngIf",t.showApprover),r(4),c("ngForOf",t.customers)("ngForTrackBy",t.trackByIndex)}}function yt(e,i){e&1&&(l(0,"div",32)(1,"div",33)(2,"div",34),d(3),u(4,"cxTranslate"),a()()()),e&2&&(r(3),f(" ",m(4,1,"userGroups.userList.noResults")," "))}var G,oe=(G=class{constructor(i,t,n){this.modalService=i,this._currencyService=t,this._currencyLocaleService=n,this.isMobile=!1,this.userDeletable=!0,this.showApprover=!1,this.approvalRefValues=[],this.deleteUser=new fe,this.iconTypes=M,this.currencyCode$=this._currencyService.getActive(),this.locale$=this._currencyLocaleService.getActiveLocaleForCurrencyPipe(),this.approversMap=new Map,this.approvalTypes=X}ngOnInit(){this.setApproversMap()}ngOnDestroy(){}trackByIndex(i){return i}deleteDialog(i){if(i.uid===this.currentUserId)return;let t={centered:!0},n=this.modalService.open(te,t);if(n){let o=n.componentInstance;o.name=i.name,o.description="userGroups.userList.deleteConfirmation",o.title="userGroups.userList.deleteCustomer",n.result.then(p=>{p&&this.deleteUser.emit({uid:i.uid,currentUserId:this.currentUserId})}).catch(()=>{})}}setApproversMap(){this.customers.forEach(i=>{let t=i.approvers.map(n=>n.name);this.approversMap.set(i.uid,t)})}getApprovalReferenceValueText(i){if(!i||!this.approvalRefValues)return"n/a";let t=this.approvalRefValues.find(n=>n.code===i);return t?t.name:"n/a"}},G.\u0275fac=function(t){return new(t||G)(h(O),h(K),h(ie))},G.\u0275cmp=B({type:G,selectors:[["foerch-user-list"]],inputs:{customers:"customers",isMobile:"isMobile",userDeletable:"userDeletable",currentUserId:"currentUserId",showApprover:"showApprover",approvalRefValues:"approvalRefValues"},outputs:{deleteUser:"deleteUser"},decls:7,vars:2,consts:[["mobileView",""],["desktopView",""],["noCustomer",""],["noApprovalProcessValue",""],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[4,"ngFor","ngForOf","ngForTrackBy"],[1,"row"],[1,"col-8","ps-0"],[1,"userList-name",3,"routerLink"],["class","d-block text-body-secondary mt-small",4,"ngIf"],[1,"col-4","pe-0"],[1,"orderTemplateActions","float-end"],[1,"btn-icon","pe-2","ps-0",3,"routerLink","title"],[3,"type"],["class","btn-icon pe-0 ps-2","id","deleteBtnMobile","type","button",3,"disabled","title","click",4,"ngIf"],[3,"ngClass",4,"ngIf"],[1,"d-block","text-body-secondary","mt-small"],["id","deleteBtnMobile","type","button",1,"btn-icon","pe-0","ps-2",3,"click","disabled","title"],[3,"ngClass"],[1,"col-5"],[1,"col"],["class","row",4,"ngIf"],[1,"cartTable"],[4,"ngIf"],["class","mt-small",4,"ngIf"],[1,"orderTemplateActions"],[1,"btn-icon","ps-0",3,"routerLink","title"],["class","btn-icon pe-0","id","deleteBtn","type","button",3,"disabled","title","click",4,"ngIf"],[1,"mt-small"],[1,"text-small"],["id","deleteBtn","type","button",1,"btn-icon","pe-0",3,"click","disabled","title"],[1,"row","emptyState_insideBox"],[1,"col-12"],[1,"emptyState-text"]],template:function(t,n){if(t&1&&_(0,nt,4,9,"ng-container",4)(1,ut,1,2,"ng-template",null,0,I)(3,Ct,11,6,"ng-template",null,1,I)(5,yt,5,3,"ng-template",null,2,I),t&2){let o=b(6);c("ngIf",n.customers.length>0)("ngIfElse",o)}},dependencies:[q,H,k,Y,D,A,w,Ie,P,V,Ve],encapsulation:2,changeDetection:0}),G);oe=Ze([Z(),et("design:paramtypes",[O,K,ie])],oe);var je=e=>({uid:"new",roleId:e}),$e=e=>({cxRoute:"customers",params:e}),Qe=e=>({uid:e}),We=e=>({cxRoute:"role",params:e});function Et(e,i){if(e&1&&(l(0,"div",13),d(1),a()),e&2){let t=s();r(),$(" ",t.userGroup.name," (",t.countCustomers,") ")}}function Tt(e,i){if(e&1&&(l(0,"button",15),g(1,"cx-icon",16),a()),e&2){s();let t=b(3),n=s();c("ngbPopover",t),r(),c("type",n.icons.MENU_VERTICAL)}}function Ft(e,i){if(e&1&&(l(0,"a",19),u(1,"cxUrl"),g(2,"cx-icon",16),d(3),u(4,"cxTranslate"),a()),e&2){let t=s(3);c("routerLink",m(1,3,x(9,$e,x(7,je,t.userGroup.uid)))),r(2),c("type",t.icons.ADD_USER),r(),f(" ",m(4,5,"common.addPerson")," ")}}function St(e,i){if(e&1&&(l(0,"a",19),u(1,"cxUrl"),g(2,"cx-icon",16),d(3),u(4,"cxTranslate"),a()),e&2){let t=s(3);c("routerLink",m(1,3,x(9,We,x(7,Qe,t.userGroup.uid)))),r(2),c("type",t.icons.EDIT),r(),f(" ",m(4,5,"common.edit")," ")}}function Ut(e,i){if(e&1){let t=S();l(0,"button",20),U("click",function(){E(t);let o=s(3);return T(o.deleteRole())}),g(1,"cx-icon",16),d(2),u(3,"cxTranslate"),a()}if(e&2){let t=s(3);r(),c("type",t.icons.DELETE),r(),f(" ",m(3,2,"common.delete")," ")}}function Gt(e,i){if(e&1&&_(0,Ft,5,11,"a",17)(1,St,5,11,"a",17)(2,Ut,4,4,"button",18),e&2){let t=s(2);c("ngIf",t.userGroup.canAddUser),r(),c("ngIf",t.userGroup.editable),r(),c("ngIf",t.userGroup.deletable)}}function Lt(e,i){if(e&1&&(C(0),_(1,Tt,2,2,"button",14)(2,Gt,3,3,"ng-template",null,2,I),y()),e&2){let t=s();r(),c("ngIf",t.userGroup.canAddUser||t.userGroup.editable||t.userGroup.deletable)}}function Bt(e,i){if(e&1&&(l(0,"a",23),u(1,"cxUrl"),u(2,"cxTranslate"),g(3,"cx-icon",16),a()),e&2){let t=s(2);c("routerLink",m(1,3,x(9,$e,x(7,je,t.userGroup.uid))))("title",m(2,5,"userGroups.userList.icons.addUser")),r(3),c("type",t.icons.ADD_USER)}}function Rt(e,i){if(e&1&&(l(0,"a",23),u(1,"cxUrl"),u(2,"cxTranslate"),g(3,"cx-icon",16),a()),e&2){let t=s(2);c("routerLink",m(1,3,x(9,We,x(7,Qe,t.userGroup.uid))))("title",m(2,5,"userGroups.userList.icons.editRole")),r(3),c("type",t.icons.EDIT)}}function kt(e,i){if(e&1){let t=S();l(0,"button",24),u(1,"cxTranslate"),U("click",function(){E(t);let o=s(2);return T(o.deleteRole())}),g(2,"cx-icon",16),a()}if(e&2){let t=s(2);c("title",m(1,2,"userGroups.userList.icons.deleteRole")),r(2),c("type",t.icons.DELETE)}}function wt(e,i){if(e&1&&_(0,Bt,4,11,"a",21)(1,Rt,4,11,"a",21)(2,kt,3,4,"button",22),e&2){let t=s();c("ngIf",t.userGroup.canAddUser),r(),c("ngIf",t.userGroup.editable),r(),c("ngIf",t.userGroup.deletable)}}function At(e,i){if(e&1&&(C(0),g(1,"cx-icon",16),y()),e&2){let t=s();r(),c("type",t.icons.ARROW_UP)}}function Vt(e,i){if(e&1&&g(0,"cx-icon",16),e&2){let t=s();c("type",t.icons.ARROW_DOWN)}}function Pt(e,i){if(e&1){let t=S();C(0),l(1,"foerch-user-list",26),u(2,"async"),u(3,"async"),U("deleteUser",function(o){E(t);let p=s(2);return T(p.deleteCustomer(o))}),a(),y()}if(e&2){let t=s(2);r(),c("approvalRefValues",m(2,6,t.approvalRefValues$))("currentUserId",m(3,8,t.currentUserId$))("customers",t.visibleCustomers)("isMobile",t.isMobile)("showApprover",t.showApprover)("userDeletable",t.userGroup.canRemoveUser)}}function Dt(e,i){e&1&&(l(0,"div",27)(1,"div",28)(2,"div",29),d(3),u(4,"cxTranslate"),a()()()),e&2&&(r(3),f(" ",m(4,1,"userGroups.userList.noEntries")," "))}function Mt(e,i){if(e&1&&(l(0,"div",25),_(1,Pt,4,10,"ng-container",9)(2,Dt,5,3,"ng-template",null,3,I),a()),e&2){let t=b(3),n=s();r(),c("ngIf",n.userGroup.customers&&n.userGroup.customers.length>0)("ngIfElse",t)}}var qe=(()=>{let i=class i{set userGroup(n){n&&(this._userGroup=n,this.visibleCustomers=n.customers||[],this.countCustomers=this.visibleCustomers.length)}get userGroup(){return this._userGroup}constructor(n,o,p,v,F,Ke,ze){this.modalService=n,this._userGroupService=o,this._userAccountService=p,this._userProfileService=v,this._customerService=F,this._approvalRefValService=Ke,this._cd=ze,this.isMobile=!1,this.isExpanded=!1,this.showApprover=!1,this.icons=M,this._userGroup=null,this.currentUserId$=this._userAccountService.get().pipe(ue(se=>se.uid)),this.approvalRefValues$=this._approvalRefValService.getApprovalReferenceValues().pipe(me(se=>se.length!=0))}ngOnChanges(n){n.searchQuery&&n.searchQuery.currentValue!==void 0&&this.filterGroup()}toggleDetails(){this.isExpanded=!this.isExpanded}groupContainsCustomer(){return this.userGroup.customers&&this.userGroup.customers.length>0}deleteRole(){this.groupContainsCustomer()?this._userGroupService.showDeletionImpossibleModal(this.userGroup.name):this.deleteRoleWithoutUser()}filterGroup(){let n=this.searchQuery.toLowerCase();this.visibleCustomers=n===""?this.userGroup.customers:(this.userGroup.customers||[]).filter(o=>o.name.toLowerCase().indexOf(n)!==-1),this.countCustomers=(this.visibleCustomers||[]).length,this.countCustomers>0&&(this.isExpanded=!0),n===""&&(this.isExpanded=!1)}deleteRoleWithoutUser(){let n={centered:!0},o=this.modalService.open(te,n);if(o){let p=o.componentInstance;p.name=this.userGroup.name,p.description="userGroups.role.deleteConfirmation",p.title="userGroups.role.delete",o.result.then(v=>{v&&this._userGroupService.delete(this.userGroup.uid),this._cd.detectChanges()}).catch(()=>{})}}deleteCustomer(n){n.uid===n.currentUserId?this._userProfileService.close().subscribe():this._customerService.delete(n.uid)}};i.\u0275fac=function(o){return new(o||i)(h(O),h(N),h(Ge),h(we),h(Ae),h(Be),h(R))},i.\u0275cmp=B({type:i,selectors:[["foerch-user-group"]],inputs:{userGroup:"userGroup",isMobile:"isMobile",searchQuery:"searchQuery",isExpanded:"isExpanded",showApprover:"showApprover"},features:[de],decls:14,vars:7,consts:[["isDesktop",""],["notExpanded",""],["popoverContent",""],["noCustomer",""],[1,"costCenterNode","mb-3"],[1,"costCenterNode-head"],[1,"row"],["class","col",4,"ngIf"],[1,"col-auto","ms-auto"],[4,"ngIf","ngIfElse"],[1,"btn-icon","costCenterNode-quickBtn",3,"click"],[1,"costCenterNode-body",3,"ngbCollapse"],["class","col p-md-0",4,"ngIf"],[1,"col"],["class","btn-icon costCenterNode-quickBtn","container","body","placement","bottom","popoverClass","costCenterManagement-popover","type","button",3,"ngbPopover",4,"ngIf"],["container","body","placement","bottom","popoverClass","costCenterManagement-popover","type","button",1,"btn-icon","costCenterNode-quickBtn",3,"ngbPopover"],[3,"type"],["class","btn btn-link btn-block",3,"routerLink",4,"ngIf"],["class","btn btn-link btn-block",3,"click",4,"ngIf"],[1,"btn","btn-link","btn-block",3,"routerLink"],[1,"btn","btn-link","btn-block",3,"click"],["class","btn-icon costCenterNode-quickBtn",3,"routerLink","title",4,"ngIf"],["class","btn-icon costCenterNode-quickBtn",3,"title","click",4,"ngIf"],[1,"btn-icon","costCenterNode-quickBtn",3,"routerLink","title"],[1,"btn-icon","costCenterNode-quickBtn",3,"click","title"],[1,"col","p-md-0"],[3,"deleteUser","approvalRefValues","currentUserId","customers","isMobile","showApprover","userDeletable"],[1,"row","emptyState_insideBox"],[1,"col-12"],[1,"emptyState-text"]],template:function(o,p){if(o&1){let v=S();l(0,"div",4)(1,"div",5)(2,"div",6),_(3,Et,2,2,"div",7),l(4,"div",8),_(5,Lt,4,1,"ng-container",9)(6,wt,3,3,"ng-template",null,0,I),l(8,"button",10),U("click",function(){return E(v),T(p.toggleDetails())}),_(9,At,2,1,"ng-container",9)(10,Vt,1,1,"ng-template",null,1,I),a()()()(),l(12,"div",11),_(13,Mt,4,2,"div",12),a()()}if(o&2){let v=b(7),F=b(11);r(3),c("ngIf",p.userGroup.name),r(2),c("ngIf",p.isMobile)("ngIfElse",v),r(4),c("ngIf",p.isExpanded)("ngIfElse",F),r(3),c("ngbCollapse",!p.isExpanded),r(),c("ngIf",p.isExpanded)}},dependencies:[k,D,A,Re,ke,oe,w,P,V],encapsulation:2,changeDetection:0});let e=i;return e})();var Nt=function(e,i,t,n){var o=arguments.length,p=o<3?i:n===null?n=Object.getOwnPropertyDescriptor(i,t):n,v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,i,t,n);else for(var F=e.length-1;F>=0;F--)(v=e[F])&&(p=(o<3?v(p):o>3?v(i,t,p):v(i,t))||p);return o>3&&p&&Object.defineProperty(i,t,p),p},jt=function(e,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,i)},$t=e=>({isMobile:e}),Qt=e=>({"btn-block":e}),Ye=()=>({uid:"new"}),Wt=e=>({cxRoute:"customers",params:e}),qt=e=>({cxRoute:"role",params:e});function Ht(e,i){e&1&&j(0)}function Yt(e,i){if(e&1){let t=S();l(0,"cx-icon",22),U("click",function(){E(t);let o=s(3);return T(o.clearSearch())}),a()}if(e&2){let t=s(3);c("type",t.icons.CLEAR)}}function Kt(e,i){if(e&1){let t=S();C(0),l(1,"div",13)(2,"div",14)(3,"div",15)(4,"div",16),g(5,"cx-icon",9),a(),l(6,"input",17),u(7,"cxTranslate"),Ce("ngModelChange",function(o){E(t);let p=s(2);return he(p.searchQuery,o)||(p.searchQuery=o),T(o)}),a(),l(8,"div",18),_(9,Yt,1,1,"cx-icon",19),a()()(),l(10,"div",20)(11,"button",21),U("click",function(){E(t);let o=s(2);return T(o.toggleAll())}),d(12),u(13,"cxTranslate"),a()()(),y()}if(e&2){let t=s(2);r(5),c("type",t.icons.SEARCH),r(),ve("ngModel",t.searchQuery),xe("placeholder",m(7,5,"userGroups.searchUser")),r(3),c("ngIf",t.searchQuery.length!==0),r(3),f(" ",m(13,7,t.getLabel())," ")}}function zt(e,i){if(e&1&&(C(0),g(1,"foerch-user-group",24),y()),e&2){let t=i.$implicit,n=s(2).ngIf,o=s();r(),c("isExpanded",o.expandAll)("isMobile",n.isMobile)("searchQuery",o.searchQuery)("showApprover",o.showApprovers)("userGroup",t)}}function Jt(e,i){if(e&1&&(C(0),_(1,zt,2,5,"ng-container",23),y()),e&2){let t=s(2);r(),c("ngForOf",t.userGroups)("ngForTrackBy",t.trackByUserGroup)}}function Xt(e,i){if(e&1){let t=S();C(0),l(1,"div",25)(2,"button",26),U("click",function(){E(t);let o=s(2);return T(o.toggleAll())}),d(3),u(4,"cxTranslate"),a()(),y()}if(e&2){let t=s(2);r(3),f(" ",m(4,1,t.getLabel())," ")}}function Zt(e,i){e&1&&j(0)}function ei(e,i){e&1&&(l(0,"div",28)(1,"div",29)(2,"div",30),d(3),u(4,"cxTranslate"),a()()()),e&2&&(r(3),f(" ",m(4,1,"userGroups.empty")," "))}function ti(e,i){if(e&1&&_(0,ei,5,3,"div",27),e&2){let t=s(2);c("ngIf",t.isLoaded)}}function ii(e,i){if(e&1&&(l(0,"button",8),u(1,"cxUrl"),g(2,"cx-icon",9),d(3),u(4,"cxTranslate"),a()),e&2){let t=s().ngIf,n=s();c("ngClass",t.isMobile?"btn-block":"me-md-2")("routerLink",m(1,4,x(9,qt,pe(8,Ye)))),r(2),c("type",n.icons.PLUS),r(),f(" ",m(4,6,"userGroups.createRole")," ")}}function ni(e,i){e&1&&g(0,"cx-spinner")}function ri(e,i){e&1&&_(0,ni,1,0,"ng-template")}function oi(e,i){if(e&1&&(C(0),l(1,"div",3)(2,"div",4)(3,"div",5),d(4),u(5,"cxTranslate"),a()(),l(6,"div",4)(7,"div",6),_(8,Ht,1,0,"ng-container",7),l(9,"button",8),u(10,"cxUrl"),g(11,"cx-icon",9),d(12),u(13,"cxTranslate"),a()()()(),l(14,"div",3)(15,"div",10),g(16,"cx-icon",9),d(17),u(18,"cxTranslate"),a()(),_(19,Kt,14,9,"ng-container",2)(20,Jt,2,2,"ng-container",11),l(21,"div",12),_(22,Xt,5,3,"ng-container",2),l(23,"div",4)(24,"div",6),_(25,Zt,1,0,"ng-container",7),a()()(),_(26,ti,1,1,"ng-template",null,0,I)(28,ii,5,11,"ng-template",null,1,I)(30,ri,1,0,null,2),y()),e&2){let t=i.ngIf,n=b(27),o=b(29),p=s();r(4),f(" ",m(5,14,"userGroups.pageTitle")," "),r(4),c("ngTemplateOutlet",o),r(),c("ngClass",x(22,Qt,t.isMobile))("routerLink",m(10,16,x(25,Wt,pe(24,Ye)))),r(2),c("type",p.icons.PLUS),r(),f(" ",m(13,18,"userGroups.createUser")," "),r(4),c("type",p.icons.INFO),r(),f(" ",m(18,20,"userGroups.infoText")," "),r(2),c("ngIf",!p.isEmptyUserGroups),r(),c("ngIf",!p.isEmptyUserGroups)("ngIfElse",n),r(2),c("ngIf",!p.isEmptyUserGroups),r(3),c("ngTemplateOutlet",o),r(5),c("ngIf",p.isLoading)}}var L,He=(L=class{constructor(i,t,n,o,p){this.userGroupsService=i,this.translationService=t,this._breakPointService=n,this._permissionService=o,this._cd=p,this.isEmptyUserGroups=!0,this.icons=M,this.isLoaded=!1,this.isLoading=!1,this.expandAll=!1,this.showApprovers=!1,this.isMobile$=this._breakPointService.isEqual(Se.xs),this.searchQuery="",this._subs$=new le}ngOnInit(){this._subs$.add(this.userGroupsService.get().subscribe(i=>{i.userGroups&&(this.handleUserGroupsResult(i),this._cd.detectChanges())})),this.userGroupsService.load(),this._subs$.add(this._permissionService.getPermissionValueAsBoolean(Le.ACTIVATE_WEBSHOP_APPROVAL_WORKFLOW).subscribe(i=>this.showApprovers=i))}ngOnDestroy(){}trackByUserGroup(i,t){return t.uid}handleUserGroupsResult(i){this.userGroups=i.userGroups,this.visibleCustomerGroups=i.userGroups,this.isLoaded=i.loaded,this.isLoading=i.loading,this.isEmptyUserGroups=i.userGroups.length===0}toggleAll(){this.clearSearch(),this.expandAll=!this.expandAll}getLabel(){return this.expandAll?"common.closeAll":"common.openAll"}clearSearch(){this.searchQuery=""}},L.\u0275fac=function(t){return new(t||L)(h(N),h(z),h(J),h(ee),h(R))},L.\u0275cmp=B({type:L,selectors:[["foerch-user-groups-list"]],decls:2,vars:5,consts:[["emptyList",""],["createRollButton",""],[4,"ngIf"],[1,"row","justify-content-between","mb-2","mb-md-4"],[1,"col-md-auto"],[1,"h3","mb-0"],[1,"mt-3","mt-md-0","mw-sm-only-400"],[4,"ngTemplateOutlet"],["type","button",1,"btn","btn-primary","btn-icon_left",3,"ngClass","routerLink"],[3,"type"],[1,"col","infotext"],[4,"ngIf","ngIfElse"],[1,"row","mt-0","mt-md-4"],[1,"row"],[1,"col-md-4","pe-md-1"],[1,"form-group","form-group_simple","has-prefix","has-appendix","mb-0","mw-sm-only-400"],[1,"form-group-prepend"],["id","cartDialog_search","name","cartDialog_search","type","text",1,"form-control",3,"ngModelChange","ngModel"],[1,"form-group-append"],[3,"type","click",4,"ngIf"],[1,"col","text-end"],[1,"btn","btn-link_secondary","py-3",3,"click"],[3,"click","type"],[4,"ngFor","ngForOf","ngForTrackBy"],[3,"isExpanded","isMobile","searchQuery","showApprover","userGroup"],[1,"col-md-auto","order-md-last","ms-auto","text-end"],[1,"btn","btn-link_secondary","p-0",3,"click"],["class","row emptyState",4,"ngIf"],[1,"row","emptyState"],[1,"col-12"],[1,"emptyState-text"]],template:function(t,n){t&1&&(_(0,oi,31,27,"ng-container",2),u(1,"async")),t&2&&c("ngIf",x(3,$t,m(1,1,n.isMobile$)))},dependencies:[q,H,k,Y,D,A,Ee,Te,Fe,Ue,qe,w,P,V],encapsulation:2,changeDetection:0}),L);He=Nt([Z(),jt("design:paramtypes",[N,z,J,ee,R])],He);export{He as a};