1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f9f747c6-cbfb-5b73-a4d5-ca0d340f8059")}catch(e){}}(); 3import{a as Q,b as Nt,c as Y,d as ie,f as Ve,g as ye,h as jt,i as qt,j as zt}from"./chunk-ZZUA267R.js";import{a as W}from"./chunk-YGPNGMFS.js";import{a as Bt}from"./chunk-OPQ7PRFO.js";import"./chunk-T2W4342Q.js";import"./chunk-JRHQOV6G.js";import{a as te,b as Rt}from"./chunk-FMAAPPZH.js";import{a as ft,b as gt}from"./chunk-PQCQPMTF.js";import{a as yt}from"./chunk-WRXC5ORK.js";import{a as xt,c as bt,e as vt,f as wt}from"./chunk-6ESVMRDE.js";import{a as St,b as kt,c as Tt,e as Pt,f as Et,h as Vt,i as Mt,k as Ft,l as It,n as Dt,o as Ot,p as $t}from"./chunk-IZJQTZVB.js";import"./chunk-77KO6I45.js";import"./chunk-R7MSJQOC.js";import"./chunk-6HTRP6U7.js";import"./chunk-BSKHYKXK.js";import"./chunk-I5X7DE55.js";import"./chunk-ETZRMDHS.js";import"./chunk-NPR23P7I.js";import"./chunk-BVS47MGJ.js";import"./chunk-WDJPTZC5.js";import"./chunk-XZFXRJRY.js";import"./chunk-AAFBOZHS.js";import"./chunk-T5Q4IEHB.js";import"./chunk-A7W5NRHC.js";import"./chunk-NTJ4CINI.js";import"./chunk-6UNLROVI.js";import{a as he,b as xe}from"./chunk-XBHOMARE.js";import{a as ht,c as be,d as ve,e as we}from"./chunk-C5T7GUT6.js";import"./chunk-DSHWJW7U.js";import{a as Ct}from"./chunk-FLZNG7WM.js";import{b as _t}from"./chunk-Y53ZYOIU.js";import"./chunk-3YM57F2T.js";import"./chunk-4OKMPB3H.js";import"./chunk-I664YVIA.js";import{b as Ee,c as ut}from"./chunk-YSTTJCSR.js";import{c as pt}from"./chunk-CN4EGA4I.js";import"./chunk-Z5M2FKAZ.js";import"./chunk-5NDSS4DO.js";import"./chunk-TTUVP5SZ.js";import"./chunk-5CMUHLSG.js";import"./chunk-TNAGEFXD.js";import"./chunk-YH4N3M4B.js";import"./chunk-BHOSW24E.js";import"./chunk-56LBQIQP.js";import"./chunk-IKWIL4NU.js";import"./chunk-5K5PYV5V.js";import"./chunk-TDGVUJZJ.js";import{a as Ke,d as We,f as Qe,g as Ye,h as Ze,i as Je}from"./chunk-MWF7JXGK.js";import"./chunk-UJXOZNZV.js";import{a as fe,b as ge}from"./chunk-KS3Q7H57.js";import"./chunk-DAOAKQM2.js";import{a as ee}from"./chunk-MGCQ5S6F.js";import"./chunk-MJXNRHWH.js";import"./chunk-BUOPWRDV.js";import{d as G,e as K}from"./chunk-UQU3EU23.js";import"./chunk-346ISJSG.js";import{b as _e,d as Ce}from"./chunk-CNRKNNWP.js";import{d as ce}from"./chunk-L6Z7ZO7O.js";import"./chunk-TLCCWCNW.js";import{a as $}from"./chunk-5SJALNJN.js";import{a as D,b as mt,d as me,e as de,i as O}from"./chunk-XEY266ER.js";import"./chunk-SEDEP525.js";import"./chunk-SECBI6OV.js";import"./chunk-LXBG4CPT.js";import{c as dt}from"./chunk-56KVT3OQ.js";import{G as ct,I,b as U,d as Xe,g as M,h as et,l as tt,m as F,o as it,p as nt,q as H,r as ot,u as rt,v as lt,w as at,x as st}from"./chunk-MF7VZYLI.js";import{a as se,b as L,e as V}from"./chunk-NFMDOWTR.js";import"./chunk-QE6DXY66.js";import{a as pe,b as ue}from"./chunk-B5YZVWIB.js";import"./chunk-HCSN2NMS.js";import"./chunk-FDIRDMLL.js";import"./chunk-XQLUXGKM.js";import"./chunk-3JHJJCIF.js";import"./chunk-J4X36CU5.js";import"./chunk-X3ZU2Z3D.js";import"./chunk-QZXCI4ZV.js";import"./chunk-VO633UWN.js";import{e as Ge}from"./chunk-XIKGSSI2.js";import"./chunk-MNZQGPDO.js";import{b as Le,g as le,h as Ue,j as ae,p as He}from"./chunk-NK2KZLT6.js";import"./chunk-MU5APV2L.js";import"./chunk-KRFZY2QT.js";import"./chunk-DFSGG2NH.js";import"./chunk-MREDPIUE.js";import"./chunk-BWICLBYB.js";import"./chunk-TYTNPDEC.js";import"./chunk-WAPZ5LEW.js";import"./chunk-746D4QTP.js";import{$ as Re,Ac as u,Dc as o,Dd as J,Ed as X,Fd as E,I as $e,Ib as k,Lc as P,M as j,Ma as Ne,Mc as re,Nc as B,Ob as R,Pc as A,R as oe,Rc as qe,Sc as p,Tc as v,Uc as Z,a as N,ac as Te,bc as Pe,cc as h,dc as x,dd as ze,f as De,g as Oe,gc as y,hc as S,hd as Ae,ic as _,jc as r,kc as l,la as Be,lb as je,lc as C,pc as q,qa as b,qb as d,qc as z,uc as f,va as c,wa as m}from"./chunk-BZJI6Z2X.js";import{a as T,b as ke}from"./chunk-CS7K6LXP.js";var Se=(()=>{class n{webStorageService=b(ut);
3columnsSubject=new Oe(this.loadColumns());columns$=this.columnsSubject.asObservable();getColumnItems(){return this.columnsSubject.value}addColumnItem(e){let i=this.columnsSubject.value;i.includes(e)||(this.columnsSubject.next(this.normalize([...i,e])),this.persist())}removeColumnItem(e){let i=this.columnsSubject.value;this.columnsSubject.next(this.normalize(i.filter(t=>t!==e))),this.persist()}setColumnItems(e){this.columnsSubject.next(this.normalize(e)),this.persist()}normalize(e){let i=new Set(["select",...Y.map(g=>g.columnId||g.key)]),t=["select"],s=new Set(t);for(let g of e){let w=g==="annual_contract_value"?"annual_licensing_fee":g;s.has(w)||!i.has(w)||(s.add(w),t.push(w))}return t}persist(){this.webStorageService.setLocalStorageData(Ee.PlatformClientColumns,JSON.stringify(this.getColumnItems()))}loadColumns(){let e=this.webStorageService.getLocalStorageData(Ee.PlatformClientColumns);if(e)try{return this.normalize(JSON.parse(e))}catch{return this.normalize(Ve)}return this.normalize(Ve)}static \u0275fac=function(i){return new(i||n)};static \u0275prov=Be({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var Zt=(n,a)=>a.value;function Jt(n,a){n&1&&(r(0,"mat-error"),p(1,"Organization name is required"),l())}function Xt(n,a){if(n&1&&(r(0,"mat-option",5),p(1),l()),n&2){let e=a.$implicit;_("value",e.value),d(),v(e.label)}}function ei(n,a){n&1&&(r(0,"mat-error"),p(1,"Website URL is invalid"),l())}function ti(n,a){n&1&&C(0,"mat-spinner",13)}function ii(n,a){n&1&&p(0," Create Client ")}var Lt=(()=>{class n{fb=b(ct);dialogRef=b(Ke);platformClientService=b(Q);form;statusOptions=ye;saving=!1;constructor(){this.form=this.fb.group({organization_name:["",Xe.required],status:["prospect"],account_manager_user_id:[null],sales_rep_user_id:[null],primary_giving_event_name:[""],website_url:["",ee.urlValidator]})}submit(){if(this.form.invalid||this.saving)return;this.saving=!0;let e=T({},this.form.value);e.website_url&&(e.website_url=ee.normalizeUrl(e.website_url)??e.website_url),Object.keys(e).forEach(i=>{(e[i]===""||e[i]==null)&&delete e[i]}),this.platformClientService.createClient(e).subscribe({next:i=>{this.saving=!1,this.dialogRef.close(i)},error:()=>{this.saving=!1}})}cancel(){this.dialogRef.close()}static \u0275fac=function(i){return new(i||n)};static \u0275cmp=k({type:n,selectors:[["app-create-client"]],decls:32,vars:5,consts:[["mat-dialog-title",""],[1,"d-flex","flex-column","pt-2",3,"formGroup"],["appearance","outline",1,"sm","w-100"],["matInput","","formControlName","organization_name"],["formControlName","status"],[3,"value"],["formControlName","account_manager_user_id","label","Account Manager","appearance","outline"],["formControlName","sales_rep_user_id","label","Sales Rep","appearance","outline"],["matInput","","formControlName","primary_giving_event_name"],["matInput","","formControlName","website_url","appNormalizeUrl",""],["align","end"],["mat-button","",1,"custom","secondary","sm",3,"click"],["mat-button","",1,"custom","sm","auto","success",3,"click","disabled"],["diameter","18"]],template:function(i,t){if(i&1&&(r(0,"h2",0),p(1,"New Platform Client"),l(),r(2,"mat-dialog-content")(3,"form",1)(4,"mat-form-field",2)(5,"mat-label"),p(6,"Organization Name"),l(),C(7,"input",3),h(8,Jt,2,0,"mat-error"),l(),r(9,"mat-form-field",2)(10,"mat-label"),p(11,"Status"),l(),r(12,"mat-select",4),y(13,Xt,2,2,"mat-option",5,Zt),l()(),C(15,"app-mighty-admin-picker",6)(16,"app-mighty-admin-picker",7),r(17,"mat-form-field",2)(18,"mat-label"),p(19,"Primary Giving Event Name"),l(),C(20,"input",8),l(),r(21,"mat-form-field",2)(22,"mat-label"),p(23,"Website URL"),l(),C(24,"input",9),h(25,ei,2,0,"mat-error"),l()()(),r(26,"mat-dialog-actions",10)(27,"button",11),u("click",function(){return t.cancel()}),p(28,"Cancel"),l(),r(29,"button",12),u("click",function(){return t.submit()}),h(30,ti,1,0,"mat-spinner",13)(31,ii,1,0),l()()),i&2){let s,g;d(3),_("formGroup",t.form),d(5),x((s=t.form.get("organization_name"))!=null&&s.hasError("required")?8:-1),d(5),S(t.statusOptions),d(12),x((g=t.form.get("website_url"))!=null&&g.hasError("invalidUrl")?25:-1),d(4),_("disabled",t.form.invali
3d||t.saving),d(),x(t.saving?30:31)}},dependencies:[I,it,U,M,et,ot,rt,V,L,Je,Qe,Ze,Ye,$,O,D,mt,K,G,ge,fe,Ce,_e,ce,W,yt],encapsulation:2})}return n})();var Ut=(n,a)=>a.value;function oi(n,a){if(n&1){let e=f();r(0,"button",19),u("click",function(){c(e);let t=o();return m(t.clearFilters())}),p(1," Clear all "),l()}}function ri(n,a){if(n&1&&(r(0,"mat-option",12),p(1),l()),n&2){let e=a.$implicit;_("value",e.value),d(),v(e.label)}}function li(n,a){if(n&1&&(r(0,"mat-option",12),p(1),l()),n&2){let e=a.$implicit;_("value",e.value),d(),v(e.label)}}var Ht=(()=>{class n{route=b(le);router=b(ae);statusOptions=ye;yearRoundCategoryOptions=Nt.filter(e=>e.value);statusControl=new F([]);accountManagerControl=new F("");salesRepControl=new F("");yearRoundCategoryControl=new F("");hasBrandControl=new F("");activeFilterCount=0;subscriptions=new N;ngOnInit(){this.restoreFromParams(this.route.snapshot.queryParams),[this.statusControl,this.accountManagerControl,this.salesRepControl,this.yearRoundCategoryControl,this.hasBrandControl].forEach(e=>{this.subscriptions.add(e.valueChanges.pipe(j(300)).subscribe(()=>this.applyFilters()))})}ngOnDestroy(){this.subscriptions.unsubscribe()}clearFilters(){this.statusControl.setValue([],{emitEvent:!1}),this.accountManagerControl.setValue("",{emitEvent:!1}),this.salesRepControl.setValue("",{emitEvent:!1}),this.yearRoundCategoryControl.setValue("",{emitEvent:!1}),this.hasBrandControl.setValue("",{emitEvent:!1}),this.applyFilters()}applyFilters(){let e={page:1};Object.keys(this.route.snapshot.queryParams).forEach(t=>{t.startsWith("q[")&&t!=="q[s]"&&t!=="q[organization_name_cont]"&&(e[t]=null)});let i=this.statusControl.value;i?.length&&(e["q[status_in][]"]=i),this.accountManagerControl.value&&(e["q[account_manager_user_id_eq]"]=this.accountManagerControl.value),this.salesRepControl.value&&(e["q[sales_rep_user_id_eq]"]=this.salesRepControl.value),this.yearRoundCategoryControl.value&&(e["q[year_round_category_eq]"]=this.yearRoundCategoryControl.value),this.hasBrandControl.value==="yes"?e["q[brand_id_not_null]"]="1":this.hasBrandControl.value==="no"&&(e["q[brand_id_null]"]="1"),this.updateFilterCount(),this.router.navigate([],{relativeTo:this.route,queryParams:e,queryParamsHandling:"merge"})}restoreFromParams(e){if(e["q[status_in][]"]){let i=Array.isArray(e["q[status_in][]"])?e["q[status_in][]"]:[e["q[status_in][]"]];this.statusControl.setValue(i,{emitEvent:!1})}e["q[account_manager_user_id_eq]"]&&this.accountManagerControl.setValue(e["q[account_manager_user_id_eq]"],{emitEvent:!1}),e["q[sales_rep_user_id_eq]"]&&this.salesRepControl.setValue(e["q[sales_rep_user_id_eq]"],{emitEvent:!1}),e["q[year_round_category_eq]"]&&this.yearRoundCategoryControl.setValue(e["q[year_round_category_eq]"],{emitEvent:!1}),e["q[brand_id_not_null]"]?this.hasBrandControl.setValue("yes",{emitEvent:!1}):e["q[brand_id_null]"]&&this.hasBrandControl.setValue("no",{emitEvent:!1}),this.updateFilterCount()}updateFilterCount(){let e=0;this.statusControl.value?.length&&e++,this.accountManagerControl.value&&e++,this.salesRepControl.value&&e++,this.yearRoundCategoryControl.value&&e++,this.hasBrandControl.value&&e++,this.activeFilterCount=e}static \u0275fac=function(i){return new(i||n)};static \u0275cmp=k({type:n,selectors:[["app-platform-client-filters"]],decls:43,vars:10,consts:[["filterMenu","matMenu"],["mat-button","","type","button",1,"custom","auto","sm","secondary",3,"matMenuTriggerFor"],["matBadgePosition","above after","matBadgeOverlap","true","matBadgeSize","small",1,"left-icon","custom","hide-badge-text","primary-badge",3,"matBadge"],[1,"fa-solid","fa-bars-filter"],[1,"filter-menu-panel"],["role","presentation","tabindex","0",1,"filter-menu-content",3,"click","keydown.enter"],[1,"d-flex","align-items-center","justify-content-between","mb-3"],[1,"fw-semibold"],["mat-button","",1,"custom","sm","secondary"],[1,"filter-group"],["appearance","outline",1,"sm","w-100"],["multiple","","placeholder","All statuses",3,"formControl"],[3,"value"],["label","Account Manager","appearance","outline",3,"formControl","includeNone"],["label","Sales Rep","appearance","outline",3,"formControl","includeNone"],["placeholder","All",3,"formControl"],["value",""],["value","yes"],["value","no"],["mat-button","",1,"custom","sm","secondary",3,"click"]],template:function(i,t){if(i&1){let s=f(
3);r(0,"button",1)(1,"span",2),C(2,"i",3),l(),r(3,"span"),p(4,"Filter"),l()(),r(5,"mat-menu",4,0)(7,"div",5),u("click",function(w){return c(s),m(w.stopPropagation())})("keydown.enter",function(w){return c(s),m(w.stopPropagation())}),r(8,"div",6)(9,"span",7),p(10,"Filters"),l(),h(11,oi,2,0,"button",8),l(),r(12,"div",9)(13,"mat-form-field",10)(14,"mat-label"),p(15,"Status"),l(),r(16,"mat-select",11),y(17,ri,2,2,"mat-option",12,Ut),l()()(),r(19,"div",9),C(20,"app-mighty-admin-picker",13),l(),r(21,"div",9),C(22,"app-mighty-admin-picker",14),l(),r(23,"div",9)(24,"mat-form-field",10)(25,"mat-label"),p(26,"Year Round Category"),l(),r(27,"mat-select",15)(28,"mat-option",16),p(29,"All"),l(),y(30,li,2,2,"mat-option",12,Ut),l()()(),r(32,"div",9)(33,"mat-form-field",10)(34,"mat-label"),p(35,"Has Brand"),l(),r(36,"mat-select",15)(37,"mat-option",16),p(38,"All"),l(),r(39,"mat-option",17),p(40,"Yes"),l(),r(41,"mat-option",18),p(42,"No"),l()()()()()()}if(i&2){let s=B(6);_("matMenuTriggerFor",s),d(),_("matBadge",t.activeFilterCount>0?t.activeFilterCount:null),d(10),x(t.activeFilterCount>0?11:-1),d(5),_("formControl",t.statusControl),d(),S(t.statusOptions),d(3),_("formControl",t.accountManagerControl)("includeNone",!0),d(2),_("formControl",t.salesRepControl)("includeNone",!0),d(5),_("formControl",t.yearRoundCategoryControl),d(3),S(t.yearRoundCategoryOptions),d(6),_("formControl",t.hasBrandControl)}},dependencies:[I,M,H,gt,ft,V,L,$,O,D,we,be,ve,Ce,_e,ce,W],styles:[".filter-menu-panel{max-width:320px!important}.filter-menu-content[_ngcontent-%COMP%]{padding:16px;min-width:280px}.filter-group[_ngcontent-%COMP%]{margin-bottom:12px}.filter-group[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{display:block;font-size:var(--mc-body-3);line-height:var(--mc-body-xs-line-height);font-weight:500;color:var(--mc-neutral-700);margin-bottom:4px}"]})}return n})();var ci=(n,a)=>a.name,mi=(n,a)=>a.colId;function di(n,a){if(n&1){let e=f();r(0,"button",12),u("click",function(){c(e);let t=o();return m(t.clearFilter())}),C(1,"mat-icon",13),l()}}function pi(n,a){if(n&1){let e=f();r(0,"div",16),u("click",function(){let t=c(e).$implicit,s=o(2);return m(s.onToggle(t))})("keydown.enter",function(){let t=c(e).$implicit,s=o(2);return m(s.onToggle(t))})("keydown.space",function(){let t=c(e).$implicit,s=o(2);return m(s.onToggle(t))}),r(1,"mat-checkbox",17),u("click",function(t){return c(e),m(t.stopPropagation())})("change",function(){let t=c(e).$implicit,s=o(2);return m(s.onToggle(t))}),p(2),l()()}if(n&2){let e=a.$implicit;d(),_("checked",e.active),d(),Z(" ",e.label," ")}}function ui(n,a){if(n&1&&(r(0,"div",11)(1,"p",14),p(2),l(),y(3,pi,3,2,"div",15,mi),l()),n&2){let e=a.$implicit;d(2),v(e.name),d(),S(e.columns)}}var Gt=(()=>{class n{columnsService=b(Se);closePanel=J();groups=[];filteredGroups=[];filterInput=new tt("");activeColumns=[];subscriptions=new N;ngOnInit(){this.subscriptions.add(this.columnsService.columns$.subscribe(e=>{this.activeColumns=e,this.buildGroups()})),this.subscriptions.add(this.filterInput.valueChanges.pipe(j(200),oe()).subscribe(e=>{this.filterGroups(e||"")}))}ngOnDestroy(){this.subscriptions.unsubscribe()}onToggle(e){e.active=!e.active,e.active?this.columnsService.addColumnItem(e.colId):this.columnsService.removeColumnItem(e.colId)}close(){this.closePanel.emit()}clearFilter(){this.filterInput.setValue("")}buildGroups(){let e=new Map;for(let i of Y){let t=i.columnId||i.key;e.has(i.section)||e.set(i.section,[]),e.get(i.section).push(ke(T({},i),{colId:t,active:this.activeColumns.includes(t)}))}this.groups=Array.from(e.entries()).map(([i,t])=>({name:i,columns:t})),this.filteredGroups=this.groups}filterGroups(e){if(!e){this.buildGroups();return}let i=e.toLowerCase();this.filteredGroups=this.groups.map(t=>ke(T({},t),{columns:t.columns.filter(s=>s.label.toLowerCase().includes(i))})).filter(t=>t.columns.length>0)}static \u0275fac=function(i){return new(i||n)};static \u0275cmp=k({type:n,selectors:[["app-column-selector"]],outputs:{closePanel:"closePanel"},decls:16,vars:2,consts:[[1,"column-selector-panel"],[1,"d-flex","align-items-center","justify-content-between","px-3","pt-3","pb-2"],[1,"mb-0"],["mat-icon-button","","aria-label","Close column selector",1,"custom","sm","secondary",3,"click"],[1,"fa-regular","fa-xmark"],[1,"px-3","pb-2"],["appearance","outline","subscriptSizing","dynamic",1,"sm","w-100"],["matPrefix","","fontSet","fa-solid","fontIcon","fa-magnifying-glass"],["matInput","","placeholder","Search columns...",3,"formControl"],["mat-icon-button","","aria-label","Clear filter","matSuffix",""],[1,"groups-container","px-3","pb-3"],[1,"mb-3"],["mat-icon-button","","aria-label","Clear filter","matSuffix","",3,"click"],["fontSet","fas","fontIcon","fa-times-circle"],[1,"overline","mb-1","text-muted","fw-semibold"],["role","button","tabindex","0",1,"column-item"],["role","button","tabindex","0",1,"column-item",3,"click","keydown.enter","keydown.space"],[3,"click","change","checked"]],template:function(i,t){i&1&&(r(0,"div",0)(1,"div",1)(2,"h6",2),p(3,"Columns"),l(),r(4,"button",3),u("click",function(){return t.close()}),C(5,"i",4),l()(),r(6,"div",5)(7,"mat-form-field",6)(8,"mat-label"),p(9,"Search"),l(),C(10,"mat-icon",7)(11,"input",8),h(12,di,2,0,"button",9),l()(),r(13,"div",10),y(14,ui,5,1,"div",11,ci),l()()),i&2&&(d(11),_("formControl",t.filterInput),d(),x(t.filterInput.value?12:-1),d(2),S(t.filteredGroups))},dependencies:[I,U,M,H,V,se,xe,he,$,O,D,me,de,ue,pe,K,G],styles:[".column-selector-panel[_ngcontent-%COMP%]{height:100%;display:flex;flex-direction:column}.groups-container[_ngcontent-%COMP%]{flex:1;overflow-y:auto}.column-item[_ngcontent-%COMP%]{padding:4px 0;cursor:pointer;border-radius:var(--mc-radius-5)}.column-item[_ngcontent-%COMP%]:hover{background-color:var(--mc-neutral-200)}"]})}return n})();var _i=["inlineInput"],Ci=["adminPicker"],fi=["orgPicker"],gi=["brandPicker"],hi=["processingEntityPicker"],xi=(n,a)=>a.value;function bi(n,a){if(n&1&&(r(0,"option",16),p(1),l()),n&2){let e=a.$implicit;_("value",e.value),d(),v(e.label)}}function vi(n,a){if(n&1){let e=f();r(0,"select",15,0),u("change",function(){c(e);
3let t=o(2);return m(t.saveInline())})("keydown.escape",function(){c(e);let t=o(2);return m(t.cancelInline())}),y(2,bi,2,2,"option",16,xi),l()}if(n&2){let e=o(2);_("formControl",e.formControl),d(2),S(e.colDef().selectOptions)}}function wi(n,a){if(n&1){let e=f();r(0,"input",17,0),u("blur",function(){c(e);let t=o(2);return m(t.saveInline())})("keydown.enter",function(t){return c(e),m(t.target.blur())})("keydown.escape",function(t){return c(e),o(2).cancelInline(),m(t.target.blur())}),l()}if(n&2){let e=o(2);_("formControl",e.formControl)}}function yi(n,a){if(n&1){let e=f();r(0,"app-mighty-admin-picker",18,1),u("blurred",function(){c(e);let t=o(2);return m(t.onPickerBlur())})("escaped",function(){c(e);let t=o(2);return m(t.cancelInline())}),l()}if(n&2){let e=o(2);_("formControl",e.formControl)("includeNone",!0)("inline",!0)}}function Si(n,a){if(n&1){let e=f();r(0,"app-brand-picker",19,2),u("blurred",function(){c(e);let t=o(2);return m(t.onPickerBlur())})("escaped",function(){c(e);let t=o(2);return m(t.cancelInline())}),l()}if(n&2){let e=o(2);_("formControl",e.formControl)("inline",!0)}}function ki(n,a){if(n&1){let e=f();r(0,"app-org-picker",19,3),u("blurred",function(){c(e);let t=o(2);return m(t.onPickerBlur())})("escaped",function(){c(e);let t=o(2);return m(t.cancelInline())}),l()}if(n&2){let e=o(2);_("formControl",e.formControl)("inline",!0)}}function Ti(n,a){if(n&1){let e=f();r(0,"app-processing-entity-picker",19,4),u("blurred",function(){c(e);let t=o(2);return m(t.onPickerBlur())})("escaped",function(){c(e);let t=o(2);return m(t.cancelInline())}),l()}if(n&2){let e=o(2);_("formControl",e.formControl)("inline",!0)}}function Pi(n,a){if(n&1){let e=f();r(0,"input",20,0),u("blur",function(){c(e);let t=o(2);return m(t.saveInline())})("keydown.enter",function(t){return c(e),m(t.target.blur())})("keydown.escape",function(t){return c(e),o(2).cancelInline(),m(t.target.blur())}),l()}if(n&2){let e=o(2);_("formControl",e.formControl)}}function Ei(n,a){if(n&1){let e=f();r(0,"input",21,0),u("blur",function(){c(e);let t=o(2);return m(t.saveInline())})("keydown.enter",function(t){return c(e),m(t.target.blur())})("keydown.escape",function(t){return c(e),o(2).cancelInline(),m(t.target.blur())}),l()}if(n&2){let e=o(2);_("formControl",e.formControl)("type",e.inlineInputType)}}function Vi(n,a){if(n&1){let e=f();r(0,"div",8),u("click",function(t){return c(e),m(t.stopPropagation())})("keydown",function(t){return c(e),m(t.stopPropagation())}),h(1,vi,4,1,"select",9)(2,wi,2,1,"input",10)(3,yi,2,3,"app-mighty-admin-picker",11)(4,Si,2,2,"app-brand-picker",12)(5,ki,2,2,"app-org-picker",12)(6,Ti,2,2,"app-processing-entity-picker",12)(7,Pi,2,1,"input",13)(8,Ei,2,2,"input",14),l()}if(n&2){let e,i=o();A("currency-field",i.fieldType==="currency"),d(),x((e=i.fieldType)==="select"?1:e==="date"?2:e==="mighty_admin"?3:e==="brand"?4:e==="org"?5:e==="processing_entity"?6:e==="currency"?7:8)}}function Mi(n,a){if(n&1&&(r(0,"span",7),p(1),l()),n&2){let e=o();d(),v(e.displayValue())}}var Kt=(()=>{class n{platformClientService=b(Q);snackBar=b(pt);client=X(void 0);colDef=X(void 0);displayValue=X(void 0);editing=X(!1);updated=J();editEnded=J();inlineInput=E("inlineInput");adminPicker=E("adminPicker");orgPicker=E("orgPicker");brandPicker=E("brandPicker");processingEntityPicker=E("processingEntityPicker");formControl=new F;saving=!1;previousRawValue;cancelledByEscape=!1;valueChangeSub;pickerBlurTimer;get fieldKey(){return this.colDef().key}get fieldType(){return this.colDef().type}get isUrlField(){return this.fieldKey.endsWith("_url")}get inlineInputType(){return this.fieldType==="number"||this.fieldType==="percentage"?"number":"text"}get isCentsField(){return this.fieldType==="currency"&&this.fieldKey.includes("_cents")}get isPickerType(){return["mighty_admin","brand","org","processing_entity"].includes(this.fieldType)}ngOnChanges(e){e.editing?.currentValue===!0&&!e.editing?.previousValue&&this.activateEdit(),e.editing?.currentValue===!1&&e.editing?.previousValue===!0&&(this.valueChangeSub?.unsubscribe(),clearTimeout(this.pickerBlurTimer))}ngOnDestroy(){this.valueChangeSub?.unsubscribe(),clearTimeout(this.pickerBlurTimer)}activateEdit(){let e=this.client()[this.fieldKey];this.previousRawValue=e;let i;this.isCentsField&&e!=null&&e!==""?i=e/100:i=e??"",this.formControl.setValue(i),this.cancelledByEscape=!1,this.valueChangeSub?.unsubscribe(),this.isPickerType&&(this.valueChangeSub=this.formControl.valueChanges.pipe(Re(1)).subscribe(()=>{clearTimeout(this.pickerBlurTimer),this.saveInline()})),setTimeout(()=>{this.fieldType==="mighty_admin"?this.adminPicker()?.focusInput():this.fieldType==="org"?this.orgPicker()?.focusInput():this.fieldType==="brand"?this.brandPicker()?.focusInput():this.fieldType==="processing_entity"?this.processingEntityPicker()?.focusInput():this.inl
3ineInput()?.nativeElement?.focus()},0)}saveInline(){if(this.cancelledByEscape){this.cancelledByEscape=!1;return}if(this.saving||!this.editing())return;let e=this.formControl.value;this.isCentsField&&e!==""&&e!=null?e=Math.round(parseFloat(String(e))*100):this.fieldType==="currency"&&e!==""&&e!=null?e=parseFloat(String(e)):e===""&&(e=null);let i=ee.resolveFieldEdit(e,this.previousRawValue,this.isUrlField);if("invalid"in i){this.snackBar.open("Please enter a valid URL","Ok",{duration:3e3});return}if(e=i.value,this.isUrlField&&e!=null&&this.formControl.setValue(e),i.unchanged){this.editEnded.emit();return}this.saving=!0;let t={[this.fieldKey]:e};this.platformClientService.updateClient(this.client().id,t).subscribe({next:s=>{this.saving=!1,this.valueChangeSub?.unsubscribe(),this.updated.emit(s),this.editEnded.emit(),this.showUndoToast()},error:()=>{this.saving=!1,this.valueChangeSub?.unsubscribe(),this.editEnded.emit(),this.snackBar.open("Failed to save changes","Dismiss",{duration:3e3})}})}onPickerBlur(){clearTimeout(this.pickerBlurTimer),this.pickerBlurTimer=setTimeout(()=>{this.editing()&&!this.saving&&this.saveInline()},200)}cancelInline(){this.cancelledByEscape=!0,this.valueChangeSub?.unsubscribe(),this.editEnded.emit()}showUndoToast(){this.snackBar.open(`"${this.colDef().label}" updated`,"Undo",{duration:5e3}).onAction().subscribe(()=>this.undo())}undo(){let e={[this.fieldKey]:this.previousRawValue??null};this.platformClientService.updateClient(this.client().id,e).subscribe({next:i=>{this.updated.emit(i)},error:()=>{this.snackBar.open("Failed to undo changes","Dismiss",{duration:3e3})}})}static \u0275fac=function(i){return new(i||n)};static \u0275cmp=k({type:n,selectors:[["app-table-cell-edit"]],viewQuery:function(i,t){i&1&&(P(t.inlineInput,_i,5),P(t.adminPicker,Ci,5),P(t.orgPicker,fi,5),P(t.brandPicker,g
3i,5),P(t.processingEntityPicker,hi,5)),i&2&&re(5)},inputs:{client:[1,"client"],colDef:[1,"colDef"],displayValue:[1,"displayValue"],editing:[1,"editing"]},outputs:{updated:"updated",editEnded:"editEnded"},features:[Ne],decls:3,vars:1,consts:[["inlineInput",""],["adminPicker",""],["brandPicker",""],["orgPicker",""],["processingEntityPicker",""],[1,"table-cell-edit"],["role","presentation",1,"cell-edit-wrap",3,"currency-field"],[1,"cell-content"],["role","presentation",1,"cell-edit-wrap",3,"click","keydown"],[1,"cell-edit-input",3,"formControl"],["type","date",1,"cell-edit-input",3,"formControl"],[3,"formControl","includeNone","inline"],[3,"formControl","inline"],["type","number",1,"cell-edit-input","cell-edit-input--currency",3,"formControl"],[1,"cell-edit-input",3,"formControl","type"],[1,"cell-edit-input",3,"change","keydown.escape","formControl"],[3,"value"],["type","date",1,"cell-edit-input",3,"blur","keydown.enter","keydown.escape","formControl"],[3,"blurred","escaped","formControl","includeNone","inline"],[3,"blurred","escaped","formControl","inline"],["type","number",1,"cell-edit-input","cell-edit-input--currency",3,"blur","keydown.enter","keydown.escape","formControl"],[1,"cell-edit-input",3,"blur","keydown.enter","keydown.escape","formControl","type"]],template:function(i,t){i&1&&(r(0,"div",5),h(1,Vi,9,3,"div",6)(2,Mi,2,1,"span",7),l()),i&2&&(d(),x(t.editing()?1:2))},dependencies:[I,at,st,U,nt,lt,M,H,W,qt,Bt,zt],styles:['.table-cell-edit[_ngcontent-%COMP%]{display:block;width:100%}.cell-edit-wrap[_ngcontent-%COMP%]{position:relative}.cell-edit-input[_ngcontent-%COMP%]{width:100%;padding:4px;font-size:inherit;font-family:inherit;line-height:inherit;border:none;border-bottom:1px solid var(--mc-neutral-400, #adb5bd);border-radius:0;background:transparent;outline:none;-webkit-appearance:none;appearance:none;color:inherit}.cell-edit-input[_ngcontent-%COMP%]:focus{border-bottom-color:var(--mc-primary, #007bff);border-bottom-width:2px;padding-bottom:3px}select.cell-edit-input[_ngcontent-%COMP%]{cursor:pointer}.currency-field[_ngcontent-%COMP%]{position:relative}.currency-field[_ngcontent-%COMP%]:before{content:"$";position:absolute;left:4px;top:4px;color:var(--mc-neutral-600, #6c757d);font-size:inherit;line-height:inherit;pointer-events:none;z-index:1}.cell-edit-input--currency[_ngcontent-%COMP%]{padding-left:16px}.cell-content[_ngcontent-%COMP%]{display:block;width:100%;cursor:default}']})}return n})();var Fi=()=>[10,20,50,100];function Ii(n,a){return this.colId(a)}function Di(n,a){if(n&1&&(r(0,"span",13),p(1),l()),n&2){let e=o();d(),v(e.clientObj.total)}}function Oi(n,a){n&1&&(r(0,"div",21),C(1,"mat-spinner",41),l())}function $i(n,a){if(n&1){let e=f();r(0,"button",45),u("click",function(){c(e);let t=o(2);return m(t.clearSearch())}),C(1,"mat-icon",46),l()}}function Ri(n,a){if(n&1){let e=f();r(0,"mat-form-field",24)(1,"mat-label"),p(2,"Search"),l(),r(3,"input",42),u("input",function(t){c(e);let s=o();return m(s.searchInput.next(t.target.value))}),l(),C(4,"mat-icon",43),h(5,$i,2,0,"button",44),l()}if(n&2){let e=o();d(3),_("value",e.searchTerm),d(2),x(e.searchTerm?5:-1)}}function Bi(n,a){if(n&1){let e=f();r(0,"button",47),u("click",function(){c(e);let t=o();return m(t.openSearchField())}),r(1,"span",16),C(2,"i",48),l(),r(3,"span"),p(4,"Search"),l()()}}function Ni(n,a){if(n&1){let e=f();r(0,"th",49)(1,"mat-checkbox",50),u("change",function(t){c(e);let s=o();return m(t?s.toggleAllRows():null)}),l()()}if(n&2){let e=o();d(),_("checked",e.selection.hasValue()&&e.isAllSelected())("indeterminate",e.selection.hasValue()&&!e.isAllSelected()),Te("aria-label",`${e.isAllSelected()?"deselect":"select"} all`)}}function ji(n,a){if(n&1){let e=f();r(0,"td",51)(1,"mat-checkbox",52),u("click",function(t){return c(e),m(t.stopPropagation())})("change",function(t){let s=c(e).$implicit,g=o();return m(t?g.selection.toggle(s):null)}),l()()}if(n&2){let e=a.$implicit,i=a.index,t=o();d(),_("checked",t.selection.isSelected(e)),Te("aria-label",`${t.selection.isSelected(e)?"deselect":"select"} row ${i+1}`)}}function qi(n,a){if(n&1){let e=f();r(0,"th",53)(1,"span",10),p(2," Platform Name "),r(3,"button",54),C(4,"i",55),l()(),r(5,"mat-menu",null,0)(7,"button",56),u("click",function(){c(e);
3let t=o();return m(t.hideColumn("platform_name"))}),C(8,"i",57),p(9," Hide Column "),l()()()}if(n&2){let e=B(6);d(3),_("matMenuTriggerFor",e)}}function zi(n,a){if(n&1){let e=f();r(0,"app-table-cell-edit",61),u("updated",function(t){c(e);let s=o(2);return m(s.onCellUpdated(t))})("editEnded",function(){c(e);let t=o().$implicit,s=o();return m(s.onCellEditEnded(t,"platform_name"))}),l()}if(n&2){let e=o().$implicit,i=o();_("client",e)("colDef",i.columnsById.get("platform_name"))("displayValue",e.platform_name||"--")("editing",!0)}}function Ai(n,a){if(n&1&&(r(0,"span",60),p(1),l()),n&2){let e=o().$implicit;d(),v(e.platform_name||"--")}}function Li(n,a){if(n&1){let e=f();r(0,"td",58),u("click",function(t){let s=c(e).$implicit,g=o();return m(g.onCellClick(t,s,"platform_name"))})("dblclick",function(t){let s=c(e).$implicit,g=o();return m(g.onCellDblClick(t,s,"platform_name"))}),h(1,zi,1,4,"app-table-cell-edit",59)(2,Ai,2,1,"span",60),l()}if(n&2){let e=a.$implicit,i=o();d(),x(i.isEditing(e,"platform_name")?1:2)}}function Ui(n,a){if(n&1){let e=f();r(0,"th",53)(1,"span",10),p(2," Organization Name "),r(3,"button",62),C(4,"i",55),l()(),r(5,"mat-menu",null,1)(7,"button",56),u("click",function(){c(e);let t=o();return m(t.onSortChange("organization_name","asc"))}),C(8,"i",63),p(9," Sort A \u2192 Z "),l(),r(10,"button",56),u("click",function(){c(e);let t=o();return m(t.onSortChange("organization_name","desc"))}),C(11,"i",64),p(12," Sort Z \u2192 A "),l(),r(13,"button",56),u("click",function(){c(e);let t=o();return m(t.hideColumn("organization_name"))}),C(14,"i",57),p(15," Hide Column "),l()()()}if(n&2){let e=B(6);d(3),_("matMenuTriggerFor",e)}}function Hi(n,a){if(n&1){let e=f();r(0,"app-table-cell-edit",61),u("updated",function(t){c(e);let s=o(2);return m(s.onCellUpdated(t))})("editEnded",function(){c(e);let t=o().$implicit,s=o();return m(s.onCellEditEnded(t,"organization_name"))}),l()}if(n&2){let e=o().$implicit,i=o();_("client",e)("colDef",i.columnsById.get("organization_name"))("displayValue",e.organization_name||"--")("editing",!0)}}function Gi(n,a){if(n&1&&(r(0,"span",60),p(1),l()),n&2){let e=o().$implicit;d(),v(e.organization_name)}}function Ki(n,a){if(n&1){let e=f();r(0,"td",58),u("click",function(t){let s=c(e).$implicit,g=o();return m(g.onCellClick(t,s,"organization_name"))})("dblclick",function(t){let s=c(e).$implicit,g=o();return m(g.onCellDblClick(t,s,"organization_name"))}),h(1,Hi,1,4,"app-table-cell-edit",59)(2,Gi,2,1,"span",60),l()}if(n&2){let e=a.$implicit,i=o();d(),x(i.isEditing(e,"organization_name")?1:2)}}function Wi(n,a){if(n&1){let e=f();r(0,"th",53)(1,"span",10),p(2," Status "),r(3,"button",65),C(4,"i",55),l()(),r(5,"mat-menu",null,2)(7,"button",56),u("click",function(){c(e);let t=o();return m(t.onSortChange("status","asc"))}),C(8,"i",63),p(9," Sort A \u2192 Z "),l(),r(10,"button",56),u("click",function(){c(e);let t=o();return m(t.onSortChange("status","desc"))}),C(11,"i",64),p(12," Sort Z \u2192 A "),l(),r(13,"button",56),u("click",function(){c(e);let t=o();return m(t.hideColumn("status"))}),C(14,"i",57),p(15," Hide Column "),l()()()}if(n&2){let e=B(6);d(3),_("matMenuTriggerFor",e)}}function Qi(n,a){if(n&1){let e=f();r(0,"app-table-cell-edit",61),u("updated",function(t){c(e);let s=o(2);return m(s.onCellUpdated(t))})("editEnded",function(){c(e);let t=o().$implicit,s=o();return m(s.onCellEditEnded(t,"status"))}),l()}if(n&2){let e,i=o().$implicit,t=o();_("client",i)("colDef",t.columnsById.get("status"))("displayValue",((e=t.getStatusConfig(i.status))==null?null:e.label)||"--")("editing",!0)}}function Yi(n,a){if(n&1&&(r(0,"span"),p(1),l()),n&2){let e=a;qe(ze("status-box sm ",e.cssClass)),d(),v(e.label)}}function Zi(n,a){if(n&1&&h(0,Yi,2,4,"span",66),n&2){let e,i=o().$implicit,t=o();x((e=t.getStatusConfig(i.status))?0:-1,e)}}function Ji(n,a){if(n&1){let e=f();r(0,"td",58),u("click",function(t){let s=c(e).$implicit,g=o();return m(g.onCellClick(t,s,"status"))})("dblclick",function(t){let s=c(e).$implicit,g=o();return m(g.onCellDblClick(t,s,"status"))}),h(1,Qi,1,4,"app-table-cell-edit",59)(2,Zi,1,1),l()}if(n&2){let e=a.$implicit,i=o();d(),x(i.isEditing(e,"status")?1:2)}}function Xi(n,a){if(n&1){let e=f();r(0,"button",56),u("click",function(){c(e);
3let t=o(3).$implicit,s=o();return m(s.onSortChange(t.sortKey,"asc"))}),C(1,"i",71),p(2," Sort Ascending "),l(),r(3,"button",56),u("click",function(){c(e);let t=o(3).$implicit,s=o();return m(s.onSortChange(t.sortKey,"desc"))}),C(4,"i",72),p(5," Sort Descending "),l()}}function en(n,a){if(n&1){let e=f();r(0,"th",53)(1,"span",10),p(2),r(3,"button",70),C(4,"i",55),l()(),r(5,"mat-menu",null,3),h(7,Xi,6,0),r(8,"button",56),u("click",function(){c(e);let t=o(2).$implicit,s=o();return m(s.hideColumn(s.colId(t)))}),C(9,"i",57),p(10," Hide Column "),l()()()}if(n&2){let e=B(6),i=o(2).$implicit;A("text-end",i.alignEnd),d(),A("justify-content-end",i.alignEnd),d(),Z(" ",i.label," "),d(),_("matMenuTriggerFor",e),Pe("aria-label",`${i.label} column options`),d(4),x(i.sortKey?7:-1)}}function tn(n,a){if(n&1){let e=f();r(0,"a",76),u("click",function(t){return c(e),m(t.stopPropagation())}),p(1),l()}if(n&2){let e=o(3).$implicit;_("href",e.website_url,je),d(),Z(" ",e.website_url," ")}}function nn(n,a){n&1&&(r(0,"span",74),p(1,"--"),l())}function on(n,a){if(n&1&&h(0,tn,2,2,"a",75)(1,nn,2,0,"span",74),n&2){let e=o(2).$implicit;x(e.website_url?0:1)}}function rn(n,a){if(n&1&&(r(0,"span",74),p(1),l()),n&2){let e=o(2).$implicit,i=o(2).$implicit,t=o();d(),v(t.getCellValue(e,t.colId(i)))}}function ln(n,a){if(n&1&&h(0,on,2,1)(1,rn,2,1,"span",74),n&2){let e=o(3).$implicit;x(e.key==="website_url"?0:1)}}function an(n,a){if(n&1){let e=f();r(0,"app-table-cell-edit",61),u("updated",function(t){c(e);let s=o(4);return m(s.onCellUpdated(t))})("editEnded",function(){c(e);let t=o().$implicit,s=o(2).$implicit,g=o();return m(g.onCellEditEnded(t,g.colId(s)))}),l()}if(n&2){let e=o().$implicit,i=o(2).$implicit,t=o();_("client",e)("colDef",i)("displayValue",t.getCellValue(e,t.colId(i)))("editing",t.isEditing(e,t.colId(i)))}}function sn(n,a){if(n&1){let e=f();r(0,"td",73),u("click",function(t){let s=c(e).$implicit,g=o(2).$implicit,w=o();return m(w.onCellClick(t,s,w.colId(g)))})("dblclick",function(t){let s=c(e).$implicit,g=o(2).$implicit,w=o();return m(w.onCellDblClick(t,s,w.colId(g)))}),h(1,ln,2,1)(2,an,1,4,"app-table-cell-edit",59),l()}if(n&2){let e=o(2).$implicit;A("text-end",e.alignEnd)("editable-cell",!e.readonly&&!e.tableReadonly&&e.type),d(),x(e.readonly||e.tableReadonly?1:2)}}function cn(n,a){if(n&1&&(q(0,67),R(1,en,11,8,"th",68)(2,sn,3,5,"td",69),z()),n&2){let e=o().$implicit,i=o();_("matColumnDef",i.colId(e))}}function mn(n,a){if(n&1&&h(0,cn,3,1,"ng-container",67),n&2){let e=a.$implicit,i=o();x(i.colId(e)!=="platform_name"&&i.colId(e)!=="organization_name"&&i.colId(e)!=="status"?0:-1)}}function dn(n,a){n&1&&C(0,"tr",77)}function pn(n,a){if(n&1){let e=f();r(0,"tr",78),u("click",function(){let t=c(e).$implicit,s=o();return m(s.onRowClick(t))}),l()}}function un(n,a){n&1&&(r(0,"p",81),p(1,"No platform clients found."),l())}function _n(n,a){if(n&1&&(r(0,"tr",79)(1,"td",80),h(2,un,2,0,"p",81),l()()),n&2){let e=o();d(),Pe("colspan",e.displayedColumns.length),d(),x(e.clientObj.loading?-1:2)}}function Cn(n,a){if(n&1){let e=f();r(0,"div",82),u("click",function(){c(e);let t=o();return m(t.closeDetail())})("keydown.escape",function(){c(e);let t=o();return m(t.closeDetail())}),l()}}function fn(n,a){if(n&1){let e=f();r(0,"div",83),u("click",function(){c(e);let t=o();return m(t.closeColumnSelector())})("keydown.enter",function(){c(e);let t=o();return m(t.closeColumnSelector())})("keydown.escape",function(){c(e);let t=o();return m(t.closeColumnSelector())}),l(),r(1,"div",84)(2,"app-column-selector",85),u("closePanel",function(){c(e);let t=o();return m(t.closeColumnSelector())}),l()()}}var ir=(()=>{class n{platformClientService=b(Q);columnsService=b(Se);route=b(le);router=b(ae);dialog=b(We);paginator=E(te);clientObj={data:[],total:0,page:1,perPage:20,sortBy:"organization_name",sortOrder:"asc",loading:!1};displayedColumns=[];allColumns=Y;selection=new dt(!0,[]);searchInput=new De;searchTerm="";getStatusConfig=jt;showColumnSelector=!1;showSearch=!1;editingCell=null;columnsById=ie;detailOpen=!1;subscriptions=new N;cellClickTimer;colId(e){return e.columnId||e.key}ngOnInit(){this.subscriptions.add(this.columnsService.columns$.subscribe(e=>{this.displayedColumns=e})),this.subscriptions.add(this.route.queryParams.subscribe(e=>{this.restoreStateFromParams(e),this.loadClients()})),this.subscriptions.add(this.searchInput.pipe(j(500),oe()).subscribe(e=>{this.searchTerm=e,this.navigateWithParams({page:1})})),this.subscriptions.add(this.platformClientService.selectedClient$.subscribe(e=>{if(!e)return;let i=this.clientObj.data.findIndex(t=>t.id===e.id);i!==-1&&(this.clientObj.data[i]=e,this.clientObj.data=[...this.clientObj.data])})),this.detailOpen=!!this.route.firstChild,this.subscriptions.add(this.router.events.pipe($e(e=>e instanceof Le)).subscribe(()=>{this.detailOpen=!!this.route.firstChild}))}ngOnDestroy(){this.subscriptions.unsubscribe(),clearTimeout(this.cellClickTimer)}loadClients(){this.clientObj.loading=!0;let e=this.buildApiParams();this.subscriptions.add(this.platformClientService.getClients(e).subscribe({next:i=>{this.clientObj.data=i.data,i.total!==void 0&&(this.clientObj.total=i.total),this.clientObj.loading=!1},error:()=>{this.clientObj.loading=!1}}))}onPageChange(e){this.navigateWithParams({page:e.pageIndex+1,per_page:e.pageSize})}onSortChange(e,i){let t={page:1};t["q[s]"]=`${e} ${i}`,this.navigateWithParams(t)}hideColumn(e){this.columnsService.removeColumnItem(e)}onColumnDrop(e){let i=this.displayedColumns.filter(t=>t!=="select");xt(i,e.previousIndex,e.currentIndex),this.columnsService.setColumnItems(i)}closeDetail(){this.router.navigate(["."],{relativeTo:this.route,queryParamsHandling:"preserve"})}onRowClick(e){this.editingCell||this.router.navigate(["./",e.id],{relativeTo:this.route,queryParamsHandling:"preserve"})}openColumnSelector(){this.showColumnSelector=!this.showColumnSelector}closeColumnSelector(){this.showColumnSelector=!1}openSearchField(){this.showSearch=!0}clearSearch(){this.searchTerm="",this.showSearch=!1,this.searchInput.next("")}openCreateDialog(){this.dialog.open(Lt,{width:Ge.md}).afterClosed().subscribe(i=>{i&&(this.loadClients(),this.router.navigate(["./",i.id],{relativeTo:this.route,queryParamsHandling:"preserve"}))})}isAllSelected(){return this.selection.selected.length===this.clientObj.data.length}toggleAllRows(){this.isAllSelected()?this.selection.clear():this.selection.select(...this.clientObj.data)}isEditing(e,i){return this.editingCell?.clientId===e.id&&this.editingCell?.columnId===i}isColumnEditable(e){let i=ie.get(e);return!!i?.type&&!i.readonly&&!i.tableReadonly}onCellClick(e,i,t){this.isColumnEditable(t)&&(e.stopPropagation(),clearTimeout(this.cellClickTimer),this.cellClickTimer=setTimeout(()=>this.onRowClick(i),400))}onCellDblClick(e,i,t){this.isColumnEditable(t)&&(e.stopPropagation(),clearTimeout(this.cellClickTimer),this.detailOpen&&this.closeDetail(),this.editingCell={clientId:i.id,columnId:t})}onCellUpdated(e){let i=this.clientObj.data.findIndex(t=>t.id===e.id);i!==-1&&(this.clientObj.data[i]=e,this.clientObj.data=[...this.clientObj.data]),this.platformClientService.setSelectedClient(e)}onCellEditEnded(e,i){this.editingCell?.clientId===e.id&&this.editingCell?.columnId===i&&(this.editingCell=null)}getCellValue(e,i){let t=ie.get(i);if(!t)return e[i]??"--";if(t.displayKey){let g=e[t.displayKey];return t.type==="mighty_admin"?g?.name||"--":g??"--"}let s=e[i];return t.type==="currency"?this.formatCurrency(s,t.key):t.type==="percentage"?this.formatPercentage(s):s??"--"}formatCurrency(e,i=""){return e==null?"--":"$"+(i.includes("_cents")?e/100:e).toLocaleStr
3ing("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}formatPercentage(e){return e==null?"--":Number(e).toFixed(2)+"%"}buildApiParams(){let e={page:this.clientObj.page,per_page:this.clientObj.perPage},i=this.route.snapshot.queryParams;return Object.keys(i).forEach(t=>{t.startsWith("q[")&&(e[t]=i[t])}),this.searchTerm&&!e["q[organization_name_cont]"]&&(e["q[organization_name_cont]"]=this.searchTerm),e["q[s]"]||(e["q[s]"]=`${this.clientObj.sortBy} ${this.clientObj.sortOrder}`),e}restoreStateFromParams(e){if(this.clientObj.page=e.page?+e.page:1,this.clientObj.perPage=e.per_page?+e.per_page:20,this.searchTerm=e["q[organization_name_cont]"]||"",this.showSearch=!!this.searchTerm,e["q[s]"]){let i=e["q[s]"].split(" ");this.clientObj.sortBy=i[0]||"organization_name",this.clientObj.sortOrder=i[1]||"asc"}}navigateWithParams(e){let i=T(T({},this.route.snapshot.queryParams),e);this.router.navigate([],{relativeTo:this.route,queryParams:i,queryParamsHandling:"merge"})}static \u0275fac=function(i){return new(i||n)};static \u0275cmp=k({type:n,selectors:[["app-platform-clients"]],viewQuery:function(i,t){i&1&&P(t.paginator,te,5),i&2&&re()},decls:57,vars:15,consts:[["platformNameMenu","matMenu"],["orgNameMenu","matMenu"],["statusMenu","matMenu"],["colMenu","matMenu"],[1,"min-vh-100","pb-4","position-relative"],[1,"dashboard-container-fluid"],[1,"row"],[1,"col-12"],[1,"d-flex","flex-wrap","justify-content-between","align-items-center"],[1,"dashboard-heading","mb-2"],[1,"d-flex","align-items-center"],[1,"me-1"],[1,"fa-solid","fa-handshake"],[1,"ms-1","badge","bg-dark"],[1,"actions"],["mat-button","",1,"custom","sm","secondary","auto",3,"click"],[1,"left-icon"],[1,"fa-regular","fa-table-list"],[1,"ms-1"],[1,"fa-solid","fa-plus"],[1,"table-wrapper","mt-2","position-relative"],[1,"text-center","py-5"],[1,"action-bar","d-md-flex","align-items-start","justify-content-between"],[1,"d-flex","align-items-center","justify-content-end"],[1,"sm"],["mat-button","",1,"custom","auto","sm","secondary"],[1,"table-responsive"],["mat-table","","cdkDropList","","cdkDropListOrientation","horizontal",1,"w-100",3,"cdkDropListDropped","dataSource"],["matColumnDef","select",3,"sticky"],["mat-header-cell","","class","select-col",4,"matHeaderCellDef"],["mat-cell","","class","select-col",4,"matCellDef"],["matColumnDef","platform_name"],["mat-header-cell","","cdkDrag","",4,"matHeaderCellDef"],["mat-cell","","class","editable-cell",3,"click","dblclick",4,"matCellDef"],["matColumnDef","organization_name"],["matColumnDef","status"],["mat-header-row","",4,"matHeaderRowDef","matHeaderRowDefSticky"],["mat-row","","class","cursor-pointer",3,"click",4,"matRowDef","matRowDefColumns"],["class","mat-row",4,"matNoDataRow"],["showFirstLastButtons","",3,"page","length","pageSize","pageIndex","pageSizeOptions"],["role","button","tabindex","-1",1,"detail-backdrop"],["diameter","36",1,"mx-auto"],["matInput","","type","text","placeholder","Search by name...",3,"input","value"],["matPrefix","","fontSet","fa-solid","fontIcon","fa-search"],["mat-icon-button","","aria-label","Clear search","matSuffix",""],["mat-icon-button","","aria-label","Clear search","matSuffix","",3,"click"],["fontSet","fas","fontIcon","fa-times-circle"],["mat-button","",1,"custom","auto","sm","secondary",3,"click"],[1,"fa-solid","fa-magnifying-glass"],["mat-header-cell","",1,"select-col"],[3,"change","checked","indeterminate","aria-label"],["mat-cell","",1,"select-col"],[3,"click","change","checked","aria-label"],["mat-header-cell","","cdkDrag",""],["mat-icon-button","","aria-label","Platform Name column options","matTooltip","Options",1,"custom","sm","ms-1","column-menu-trigger",3,"matMenuTriggerFor"],[1,"fa-solid","fa-ellipsis-vertical"],["mat-menu-item","",3,"click"],[1,"fa-regular","fa-eye-slash","me-2"],["mat-cell","",1,"editable-cell",3,"click","dblclick"],[3,"client","colDef","displayValue","editing"],[1,"cell-content","fw-medium"],[3,"updated","editEnded","client","colDef","displayValue","editing"],["mat-icon-button","","aria-label","Organization Name column options","matTooltip","Options",1,"custom","sm","ms-1","column-menu-trigger",3,"matMenuTriggerFor"],[1,"fa-regular","fa-arrow-up-a-z","me-2"],[1,"fa-regular","fa-arrow-down-z-a","me-2"],["mat-icon-button","","aria-label","Status column options","matTooltip","Options",1,"custom","sm","ms-1","column-menu-trigger",3,"matMenuTriggerFor"],[3,"class"],[3,"matColumnDef"],["mat-header-cell","","cdkDrag","",3,"text-end",4,"matHeaderCellDef"],["mat-cell","",3,"text-end","editable-cell","click","dblclick",4,"matCellDef"],["mat-icon-button","","matTooltip","Options",1,"custom","sm","ms-1","column-menu-trigger",3,"matMenuTriggerFor"],[1,"fa-regular","fa-arrow-up","me-2"],[1,"fa-regular","fa-arrow-down","me-2"],["mat-cell","",3,"click","dblclick"],[1,"cell-content"],["target","_blank",1,"cell-content",3,"href"],["target","_blank",1,"cell-content",3,"click","href"],["mat-header-row",""],["mat-row","",1,"curs
3or-pointer",3,"click"],[1,"mat-row"],[1,"mat-cell","text-center","py-5"],[1,"mb-0","text-muted"],["role","button","tabindex","-1",1,"detail-backdrop",3,"click","keydown.escape"],["role","button","tabindex","0",1,"column-selector-backdrop",3,"click","keydown.enter","keydown.escape"],[1,"column-selector-sheet"],[3,"closePanel"]],template:function(i,t){i&1&&(r(0,"div",4)(1,"div",5)(2,"div",6)(3,"div",7)(4,"div",8)(5,"h1",9)(6,"span",10)(7,"span",11),C(8,"i",12),l(),p(9," Platform Clients "),h(10,Di,2,1,"span",13),l()(),r(11,"div",14)(12,"span",11)(13,"button",15),u("click",function(){return t.openColumnSelector()}),r(14,"span",16),C(15,"i",17),l(),r(16,"span"),p(17,"Columns"),l()()(),r(18,"span",18)(19,"button",15),u("click",function(){return t.openCreateDialog()}),r(20,"span",16),C(21,"i",19),l(),r(22,"span"),p(23,"New Client"),l()()()()(),r(24,"div",20),h(25,Oi,2,0,"div",21),r(26,"div",22),C(27,"div",10),r(28,"div",23)(29,"span",18),C(30,"app-platform-client-filters"),l(),r(31,"span",18),h(32,Ri,6,2,"mat-form-field",24)(33,Bi,5,0,"button",25),l()()(),r(34,"div",26)(35,"table",27),u("cdkDropListDropped",function(g){return t.onColumnDrop(g)}),q(36,28),R(37,Ni,2,3,"th",29)(38,ji,2,2,"td",30),z(),q(39,31),R(40,qi,10,1,"th",32)(41,Li,3,1,"td",33),z(),q(42,34),R(43,Ui,16,1,"th",32)(44,Ki,3,1,"td",33),z(),q(45,35),R(46,Wi,16,1,"th",32)(47,Ji,3,1,"td",33),z(),y(48,mn,1,1,null,null,Ii,!0),R(50,dn,1,0,"tr",36)(51,pn,1,0,"tr",37)(52,_n,3,2,"tr",38),l()(),r(53,"mat-paginator",39),u("page",function(g){return t.onPageChange(g)}),l()()()()(),h(54,Cn,1,0,"div",40),l(),h(55,fn,3,0),C(56,"router-outlet")),i&2&&(d(10),x(t.clientObj.total>0?10:-1),d(15),x(t.clientObj.loading?25:-1),d(7),x(t.showSearch?32:33),d(3),_("dataSource",t.clientObj.data),d(),_("sticky",!0),d(12),S(t.allColumns),d(2),_("matHeaderRowDef",t.displayedColumns)("matHeaderRowDefSticky",!0),d(),_("matRowDefColumns",t.displayedColumns),d(2),_("length",t.clientObj.total)("pageSize",t.clientObj.perPage)("pageIndex",t.clientObj.page-1)("pageSizeOptions",Ae(14,Fi)),d(),x(t.detailOpen?54:-1),d(),x(t.showColumnSelector?55:-1))},dependencies:[He,Ue,wt,vt,bt,V,L,se,xe,he,$,O,D,me,de,ue,pe,K,G,we,be,ht,ve,Rt,te,ge,fe,$t,St,Tt,Mt,Pt,kt,Ft,Et,Vt,It,Dt,Ot,Ct,_t,Ht,Gt,Kt],styles:[".column-menu-trigger[_ngcontent-%COMP%]{opacity:0;transition:opacity .15s}th[_ngcontent-%COMP%]:hover .column-menu-trigger[_ngcontent-%COMP%]{opacity:1}.column-selector-backdrop[_ngcontent-%COMP%]{position:fixed;inset:0;z-index:999}.column-selector-sheet[_ngcontent-%COMP%]{position:fixed;top:0;right:0;bottom:0;width:320px;z-index:1000;background:var(--mc-neutral-min);box-shadow:-4px 0 16px #0000001f;overflow-y:auto}.detail-backdrop[_ngcontent-%COMP%]{position:absolute;inset:0;z-index:2}td.editable-cell[_ngcontent-%COMP%]{cursor:default;transition:background-color .15s}td.editable-cell[_ngcontent-%COMP%]:hover{background-color:var(--mc-neutral-100, #f8f9fa)}"]})}return n})();export{ir as PlatformClientsComponent}; 4 5//# debugId=f9f747c6-cbfb-5b73-a4d5-ca0d340f8059
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.