1import{A as ni,B as oi,C as ai,D as ri,E as li,G as Le,H as si,J as ci,K as di,L as mi,a as et,f as L,g as he,h as ht,i as $,j as Gt,k as ce,l as Yt,m as Qt,n as gt,o as Ht,p as qt,q as Kt,r as Jt,s as Xt,v as Zt,w as ei,x as ti,y as ke,z as ii}from"./chunk-VYKLDMH4.js";import{a as ut,b as V,c as Ze}from"./chunk-KQRJFPHS.js";import{a as pt}from"./chunk-4CVZBQNN.js";import{a as ge}from"./chunk-JKMNVQUA.js";import{b as Ce}from"./chunk-4D5SN44G.js";import"./chunk-6Q5DDO7R.js";import"./chunk-U22BTVEZ.js";import{$b as Et,$e as Ut,Cc as Ft,Ce as Ne,Ec as Me,Eg as zt,Gb as Ie,Gc as Pe,Gd as Ot,Hc as Be,Hd as Je,Jc as Mt,Kb as Ee,Mb as Re,Qc as Pt,Sc as Bt,Ue as Vt,Wc as ue,b as be,bf as kt,cc as Rt,d as ve,k as ye,kd as Ke,kh as Xe,lc as Fe,mb as pe,ng as $t,og as jt,pg as Wt,qe as Nt,ve as Lt,ye as Oe}from"./chunk-X5J6QTCG.js";import{$ as _e,$a as u,Ad as mt,Db as de,E as je,Fa as c,Fb as J,Gb as q,H as fe,Hb as xt,Ib as e,Jb as N,Ka as S,Kb as D,Lb as ze,Lc as Ge,Ma as A,Na as xe,Nc as yt,Ni as It,Pf as wt,Qb as w,Rb as I,Sa as y,Sb as E,Sc as Ye,Tb as St,Th as ie,U as b,Ub as bt,Vb as vt,W as We,Wc as Dt,Xa as G,_ as ee,_c as Qe,ba as te,bb as h,be as Te,bg as Ae,cc as T,d as M,db as j,dc as Ue,di as ne,eb as U,ec as me,fa as g,fb as k,fi as oe,ga as C,gb as m,hb as r,hd as Z,ib as l,jb as _,k as le,lc as X,ma as ct,mc as se,nb as Y,nc as dt,ob as Q,oh as we,pb as Se,pj as R,qb as v,qc as W,sb as x,tb as d,u as K,vd as He,wd as Tt,xb as H,xd as qe,yb as B,yd as De,zb as O,zd as At}from"./chunk-SMW7PHYX.js";import{a as $e,b as _t}from"./chunk-BMIYOSOG.js";var ae=(()=>{let a=class a{constructor(t){this.webAPI=t,this.baseUrl="admin/teams/team-accounts/club-account",this.descriptionMetadata=null}getRoutingInfo(){return this.webAPI.getData(`${this.baseUrl}/routing-info`)}getTransactions(){let t=this.buildTransactionFilterParams();return this.filters.includeCount&&(t=t.append("includeCount",this.filters.includeCount.toString())),t=t.append("page",this.filters.page.toString()),t=t.append("rows",this.filters.rows.toString()),this.webAPI.getData(`${this.baseUrl}/transactions`,t)}getTransactionsForExport(){let t=this.buildTransactionFilterParams();return this.webAPI.getContentData(`${this.baseUrl}/transactions/export`,t)}getFilterOptions(){let t=new Z;return this.filters?.startDate&&(t=t.append("startDate",this.filters.startDate)),this.filters?.endDate&&(t=t.append("endDate",this.filters.endDate)),t=t.append("activityView",this.filters.activityView.toString()),this.filters?.teamAccountID?.length&&this.filters.teamAccountID.forEach(n=>{t=t.append("teamAccountID",n.toString())}),this.webAPI.getData(`${this.baseUrl}/transactions/filter-options`,t)}getNetActivity(){return this.webAPI.getData(`${this.baseUrl}/net-activity`)}getBalance(){return this.webAPI.getData(`${this.baseUrl}/balance`)}getTransactionReceiptUrl(t,n){let s=new Z().append("transactionType",t.toString()).append("stripeObjectID",n);return this.webAPI.getData(`${this.baseUrl}/transactions/receipt-url`,s)}getTransactionDescriptionMetadata(){return this.descriptionMetadata?le(this.descriptionMetadata):this.webAPI.getData(`${this.baseUrl}/transactions/description-metadata`).pipe(We(t=>this.descriptionMetadata=t))}updateTransactionDescription(t,n,s){let p=new Z().append("transactionType",n.toString());return this.webAPI.putData(`${this.baseUrl}/transactions/${t}/description`,s,p)}buildTransactionFilterParams(){let t=new Z;return this.filters.description&&(t=t.append("description",this.filters.description)),this.filters.teamAccountTransactionDisplayStatusID?.length&&this.filters.teamAccountTransactionDisplayStatusID.forEach(n=>{t=t.append("teamAccountTransactionDisplayStatusID",n.toString())}),this.filters.teamAccountTransactionFlowDirectionID?.length&&this.filters.teamAccountTransactionFlowDirectionID.forEach(n=>{t=t.append("teamAccountTransactionFlowDirectionID",n.toString())}),this.filters.startDate&&(t=t.append("startDate",this.filters.startDate)),this.filters.endDate&&(t=t.append("endDate",this.filters.endDate)),this.filters.transactionCategoryID?.length&&this.filters.transactionCategoryID.forEac
1h(n=>{t=t.append("transactionCategoryID",n.toString())}),this.filters.counterpartyAccountType?.length&&this.filters.counterpartyAccountType.forEach(n=>{t=t.append("counterpartyAccountType",n.toString())}),this.filters.counterpartyProgramTeamAccountID?.length&&this.filters.counterpartyProgramTeamAccountID.forEach(n=>{t=t.append("counterpartyProgramTeamAccountID",n.toString())}),this.filters.includeOwnAccount&&(t=t.append("includeOwnAccount","true")),this.filters.initiatedByClubUserID?.length&&this.filters.initiatedByClubUserID.forEach(n=>{t=t.append("initiatedByClubUserID",n.toString())}),this.filters.orderBy&&(t=t.append("orderBy",this.filters.orderBy)),t=t.append("activityView",this.filters.activityView.toString()),this.filters.teamAccountID?.length&&this.filters.teamAccountID.forEach(n=>{t=t.append("teamAccountID",n.toString())}),t}};a.\u0275fac=function(n){return new(n||a)(te(oe))},a.\u0275prov=ee({token:a,factory:a.\u0275fac});let i=a;return i})();var ki=()=>["team-accounts","new"],ot=()=>({exact:!1});function $i(i,a){if(i&1&&(e(0,` 2 `),r(1,"app-split-button",5,1),e(3,` 3 `),l(),e(4,` 4 `)),i&2){let o=d(3);c(),m("menuItems",o.actionMenuItems)}}function ji(i,a){if(i&1&&(e(0,` 5 `),u(1,$i,5,1),r(2,"a",4),e(3,` 6 Open Account 7 `),l(),e(4,` 8 `)),i&2){let o=d(2);c(),h(o.actionMenuItems!=null&&o.actionMenuItems.length?1:-1),c(),m("routerLink",T(2,ki))}}function Wi(i,a){i&1&&(e(0,` 9 `),r(1,"li",8),e(2,` 10 `),r(3,"a",9),e(4,` 11 Team Accounts 12 `),l(),e(5,` 13 `),l(),e(6,` 14 `)),i&2&&(c(),m("routerLinkActiveOptions",T(1,ot)))}function zi(i,a){i&1&&(e(0,` 15 `),r(1,"li",8),e(2,` 16 `),r(3,"a",10),e(4,` 17 Club Account 18 `),l(),e(5,` 19 `),l(),e(6,` 20 `)),i&2&&(c(),m("routerLinkActiveOptions",T(1,ot)))}function Gi(i,a){i&1&&(e(0,` 21 `),r(1,"li",8),e(2,` 22 `),r(3,"a",11),e(4,` 23 Cardholders 24 `),l(),e(5,` 25 `),l(),e(6,` 26 `)),i&2&&(c(),m("routerLinkActiveOptions",T(1,ot)))}function Yi(i,a){i&1&&(e(0,` 27 `),r(1,"li",8),e(2,` 28 `),r(3,"a",12),e(4,` 29 Budgeting & Spending 30 `),l(),e(5,` 31 `),l(),e(6,` 32 `)),i&2&&(c(),m("routerLinkActiveOptions",T(1,ot)))}function Qi(i,a){if(i&1&&(e(0,` 33 `),r(1,"div",6),e(2,` 34 `),r(3,"ul",7),e(4,` 35 `),u(5,Wi,7,2),u(6,zi,7,2),u(7,Gi,7,2),u(8,Yi,7,2),l(),e(9,` 36 `),l(),e(10,` 37 `)),i&2){let o=d(2);c(5),h(o.user[o.Permission.TeamAccounts]?5:-1),c(),h(o.user[o.Permission.TeamAccountsClubAccount]?6:-1),c(),h(o.user[o.Permission.TeamAccountsCardHolders]?7:-1),c(),h(o.user[o.Permission.TeamAccountsBudgetingSpendingControls]?8:-1)}}function Hi(i,a){if(i&1&&(e(0,` 38 `),r(1,"app-admin-header",3),e(2,` 39 `),y(3,ji,5,3,"ng-template",null,0,W),e(5,` 40 `),l(),e(6,` 41 `),u(7,Qi,11,4),_(8,"router-outlet"),e(9,` 42 `),_(10,"app-team-accounts-disclosure"),e(11,` 43 `)),i&2){let o=d();c(7),h(o.user?7:-1)}}function qi(i,a){if(i&1&&(e(0,` 44 `),_(1,"app-promo-card",13),e(2,` 45 `)),i&2){let o=d();c(),m("title",o.premiumFeatureDetails.title)("description",o.premiumFeatureDetails.description)("features",o.premiumFeatureDetails.features)("image",o.premiumFeatureDetails.image)}}function Ki(i,a){if(i&1){let o=v();e(0,` 46 `),r(1,"app-transfer-funds-dialog",14),x("onClose",function(){g(o);let n=d();return C(n.showTransferDialog=!1)})("onTransferCreated",function(){g(o);let n=d();return C(n.showTransferDialog=!1)}),e(2,` 47 `),l(),e(3,` 48 `)}}function Ji(i,a){if(i&1){let o=v();e(0,` 49 `),r(1,"app-account-routing-dialog",15),x("onClose",function(){g(o);let n=d();return C(n.showRoutingInfoDialog=!1)}),e(2,` 50 `),l(),e(3,` 51 `)}if(i&2){let o=d();c(),m("accountName",o.routingInfo==null?null:o.routingInfo.accountName)("accountNumber",o.routingInfo==null?null:o.routingInfo.accountNumber)("routingNumber",o.routingInfo==null?null:o.routingInfo.routingNumber)("loading",o.loadingRoutingInfo)}}var ui=(()=>{let a=class a{constructor(t,n,s){this.authService=t,this.siteDataService=n,this.clubAccountService=s,this.Permission=ie,this.moduleEnabled=!1,this.premiumFeatureDetails={title:"Team Accounts",description:"Manage team finances including team accounts, cardholders, budgets, and spending controls.",features:["Create individual financial accounts for each team to keep team funds organized and separate from club-level finances","Collect and track team fees from families with visibility into amounts collected, outstanding balances, refunds, and payment status","Bu
51ild seasonal team budgets using income and expense categories and track actual spending against budgeted amounts","Assign debit cards to treasurers, coaches, or staff with configurable spending limits and spending category restrictions"],image:null},this.actionMenuItems=[],this.showTransferDialog=!1,this.showRoutingInfoDialog=!1,this.routingInfo=null,this.loadingRoutingInfo=!1,this.unsubscribe$=new M}ngOnInit(){this.siteDataService.getClubSettings().pipe(b(this.unsubscribe$)).subscribe({next:t=>{this.moduleEnabled=t.clubOptions.find(n=>n.optionID===It.ENABLE_TEAM_ACCOUNTS)?.boolValue,this.moduleEnabled&&this.setPageData(),this.siteDataService.hideSiteLoader()},error:()=>{this.siteDataService.showSiteErrorAlertDefaultGET()}})}setPageData(){this.actionMenuItems=[{label:"Transfer Funds",icon:"fa-regular fa-arrow-right-arrow-left",command:()=>{this.showTransferDialog=!0}},{label:"Account/Routing Info",icon:"fa-regular fa-building-columns",command:()=>this.openRoutingInfoDialog()}],this.authService.getUser().pipe(fe(1)).subscribe({next:t=>{this.user=t}})}openRoutingInfoDialog(){this.showRoutingInfoDialog=!0,this.loadingRoutingInfo=!0,this.routingInfo=null,this.clubAccountService.getRoutingInfo().pipe(b(this.unsubscribe$)).subscribe({next:t=>{this.routingInfo=t,this.loadingRoutingInfo=!1},error:()=>{this.siteDataService.showSiteErrorAlert("Unable to load account/routing info."),this.loadingRoutingInfo=!1,this.showRoutingInfoDialog=!1}})}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete()}};a.\u0275fac=function(n){return new(n||a)(S(ne),S(R),S(ae))},a.\u0275cmp=A({type:a,selectors:[["ng-component"]],standalone:!1,decls:6,vars:3,consts:[["customButtonContent",""],["actions",""],["role","main"],["pageTitle","Team Accounts","primaryBtnText","Open Account"],[1,"btn","btn-primary","btn-icon-plus","ml-3",3,"routerLink"],["buttonText","Actions",3,"menuItems"],[1,"tabs"],["role","tablist",1,"tab-nav","no-bullets","inline-list"],["routerLinkActive","active",1,"nav-item",3,"routerLinkActiveOptions"],["routerLink","team-accounts","role","tab","aria-controls","home","aria-selected","true",1,"nav-link"],["routerLink","club-account","role","tab","aria-controls","home","aria-selected","true",1,"nav-link"],["routerLink","cardholders","role","tab","aria-controls","home",1,"nav-link"],["routerLink","settings","role","tab","aria-controls","home",1,"nav-link"],[3,"title","description","features","image"],[3,"onClose","onTransferCreated"],[3,"onClose","accountName","accountNumber","routingNumber","loading"]],template:function(n,s){n&1&&(r(0,"main",2),e(1,` 52 `),u(2,Hi,12,1)(3,qi,3,4),u(4,Ki,4,0),u(5,Ji,4,4),l()),n&2&&(c(2),h(s.moduleEnabled?2:3),c(2),h(s.showTransferDialog?4:-1),c(),h(s.showRoutingInfoDialog?5:-1))},dependencies:[Tt,De,At,Lt,Vt,Ut,$t,qt,Kt],encapsulation:2});let i=a;return i})();var at=(()=>{let a=class a{constructor(t){this.webAPI=t,this.baseUrl="admin/teams/team-accounts/cardholders"}getCardholderSearch(){return this.webAPI.getData(`${this.baseUrl}/search`,this.getParams())}getProgramFilterOptions(){return this.webAPI.getData(`${this.baseUrl}/filter-options/programs`)}getTeamAccountFilterOptions(t){if(t?.length){let n=new Z;return t.forEach(s=>n=n.append("programIDs",s.toString())),this.webAPI.getData(`${this.baseUrl}/filter-options/teams`,n)}return this.webAPI.getData(`${this.baseUrl}/filter-options/teams`)}removeCardholder(t){return this.webAPI.deleteData(`${this.baseUrl}/${t}`)}pauseCard(t){return this.webAPI.putData(`${this.baseUrl}/cards/${t}/pause`,{})}resumeCard(t){return this.webAPI.putData(`${this.baseUrl}/cards/${t}/resume`,{})}getParams(){let t=new Z;return this.filters&&(t=t.append("page",this.filters.page.toString()),t=t.append("rows",this.filters.rows.toString()),t=t.append("orderBy",this.filters.orderBy||""),t=t.append("getTotalCount",this.filters.getTotalCount.toString()),t=t.append("showClosedAccounts",this.filters.showClosedAccounts.toString()),this.filters.lastName&&(t=t.append("lastName",this.filters.lastName)),this.filters.firstName&&(t=t.append("firstName",this.filters.firstName)),this.filters.teamAccountIDs?.length&&this.filters.teamAccountIDs.forEach(n=>t=t.append("teamAccountIDs",n.toString())),this.filters.programIDs?.length&&this.filters.programIDs.forEach(n=>t=t.append("programIDs",n.toString())),this.filters.roleIDs&&this.filters.roleIDs.length>0&&(t=t.append("roleIDs",this.filters.roleIDs.join(",")))),t}}
52;a.\u0275fac=function(n){return new(n||a)(te(oe))},a.\u0275prov=ee({token:a,factory:a.\u0275fac});let i=a;return i})();var hi=[{label:"Treasurer",value:et.TREASURER},{label:"Cardholder",value:et.CARDHOLDER},{label:"Reimbursement Recipient",value:et.REIMBURSEMENT_RECIPIENT}];var Zi=()=>[25,50,100],en=(i,a)=>["/admin/teams/accounts/team-accounts",i,"programs",a,"cardholders"];function tn(i,a){if(i&1&&(e(0,` 53 `),_(1,"p-sortIcon",29),e(2,` 54 `)),i&2){let o=d().$implicit;c(),m("field",o.field)}}function nn(i,a){if(i&1&&(e(0,` 55 `),r(1,"th",28),e(2),u(3,tn,3,1),l(),e(4,` 56 `)),i&2){let o=a.$implicit,t=d(3);c(),m("pSortableColumn",o.field),G("aria-label",o.field?t.AriaLabels.ACTIVATE_SORT:null),c(),D(` 57 `,o.header,` 58 `),c(),h(o.field?3:-1)}}function on(i,a){if(i&1&&(e(0,` 59 `),r(1,"tr"),e(2,` 60 `),U(3,nn,5,4,null,null,j),r(5,"th",26),e(6,` 61 `),r(7,"span",27),e(8,"Actions"),l(),e(9,` 62 `),l(),e(10,` 63 `),l(),e(11,` 64 `)),i&2){let o=d(2);c(3),k(o.columns)}}function an(i,a){if(i&1){let o=v();e(0,` 65 `),r(1,"tr"),e(2,` 66 `),r(3,"td"),e(4,` 67 `),r(5,"a",30),e(6),l(),e(7,` 68 `),l(),e(8,` 69 `),r(9,"td"),e(10),l(),e(11,` 70 `),r(12,"td"),e(13),l(),e(14,` 71 `),r(15,"td"),e(16),l(),e(17,` 72 `),r(18,"td",31),e(19,` 73 `),r(20,"app-cardholder-card-status",32),e(21,` 74 `),l(),e(22,` 75 `),l(),e(23,` 76 `),r(24,"td",33),e(25,` 77 `),_(26,"p-menu",34,0),e(28,` 78 `),r(29,"button",35),x("click",function(n){g(o);let s=de(27);return C(s.toggle(n))}),e(30,` 79 `),_(31,"i",36),e(32,` 80 `),r(33,"span",27),e(34,"Actions menu"),l(),e(35,` 81 `),l(),e(36,` 82 `),l(),e(37,` 83 `),l(),e(38,` 84 `)}if(i&2){let o=a.$implicit;c(5),m("routerLink",me(9,en,o.teamAccountID,o.programTeamAccountID)),c(),D(` 85 `,o.programTeamAccountUser.lastName,` 86 `),c(4),N(o.programTeamAccountUser.firstName),c(3),N(o.teamName),c(3),N(o.programTeamAccountUser.programTeamAccount==null||o.programTeamAccountUser.programTeamAccount.program==null?null:o.programTeamAccountUser.programTeamAccount.program.name),c(4),m("clubStripeCardholder",o.programTeamAccountUser.clubStripeCardholder),c(6),m("popup",!0)("model",o.menuItems),c(3),m("disabled",!o.menuItems||o.menuItems.length===0)}}function rn(i,a){if(i&1&&(e(0,` 87 `),r(1,"tr"),e(2,` 88 `),r(3,"td",33),e(4,` 89 No cardholders found. 90 `),l(),e(5,` 91 `),l(),e(6,` 92 `)),i&2){let o=d(2);c(3),G("colspan",o.columns.length+1)}}function ln(i,a){if(i&1){let o=v();e(0,` 93 `),r(1,"div",21),e(2,` 94 `),r(3,"p-table",22),x("onLazyLoad",function(n){g(o);let s=d();return C(s.searchData(n))}),e(4,` 95 `),y(5,on,12,0,"ng-template",23),e(6,` 96 `),y(7,an,39,12,"ng-template",24),e(8,` 97 `),y(9,rn,7,1,"ng-template",25),e(10,` 98 `),l(),e(11,` 99 `),l(),e(12,` 100 `)}if(i&2){let o=d();c(3),m("columns",o.columns)("value",o.searchResults)("lazy",!0)("paginator",!0)("totalRecords",o.totalRecords)("rows",o.cardholdersService.filters.rows)("rowsPerPageOptions",T(9,Zi))("showCurrentPageReport",!0)("loading",o.loading)}}function sn(i,a){if(i&1){let o=v();e(0,` 101`),r(1,"app-replace-card-dialog",37),x("onClose",function(){g(o);let n=d();return C(n.showReplaceCardDialog=!1)})("onCardReplaced",function(){g(o);let n=d();return C(n.onCardReplacementCompleted())}),e(2,` 102`),l(),e(3,` 103`)}if(i&2){let o=d();c(),m("existingCardDetails",o.cardDetailsForReplaceCardDialog)}}function cn(i,a){if(i&1){let o=v();e(0,` 104`),r(1,"app-yes-no-modal",38),x("onYesSelect",function(){g(o);let n=d();return C(n.confirmPauseCard())})("onNoSelect",function(){g(o);let n=d();return C(n.closePauseCardConfirm())}),e(2,` 105 `),l(),e(3,` 106`)}if(i&2){let o=d();c(),m("showHeader",!0)("modalText","Are you sure you want to pause the card for "+(o.cardholderBeingPaused==null?null:o.cardholderBeingPaused.firstName)+" "+(o.cardholderBeingPaused==null?null:o.cardholderBeingPaused.lastName)+"?")("loading",o.pausingCard)}}function dn(i,a){if(i&1){let o=v();e(0,` 107 `),r(1,"app-yes-no-modal",39),x("onYesSelect",function(){g(o);let n=d();return C(n.confirmResumeCard())})("onNoSelect",function(){g(o);let n=d();return C(n.closeResumeCardConfirm())}),e(2,` 108 `),l(),e(3,` 109`)}if(i&2){let o=d();c(),m("showHeader",!0)("modalText","Are you sure you want to resume the card for "+(o.cardholderBeingResumed==null?null:o.cardholderBeingResumed.firstName)+" "+(o.cardholderBeingResumed==null?null:o.cardholderBeingResumed.lastName)+"?")("loading",o.resuming
109Card)}}function mn(i,a){if(i&1){let o=v();e(0,` 110 `),r(1,"app-yes-no-modal",40),x("onYesSelect",function(){g(o);let n=d();return C(n.confirmRemoveCardholder())})("onNoSelect",function(){g(o);let n=d();return C(n.cancelRemoveCardholder())}),e(2,` 111 `),l(),e(3,` 112`)}if(i&2){let o=d();c(),m("showHeader",!0)("modalText","Are you sure you want to remove "+(o.cardholderBeingRemoved==null?null:o.cardholderBeingRemoved.firstName)+" "+(o.cardholderBeingRemoved==null?null:o.cardholderBeingRemoved.lastName)+" as a cardholder?")("loading",o.removingCardholder)}}var bi=(()=>{let a=class a{constructor(t,n,s,p){this.siteDataService=t,this.router=n,this.route=s,this.cardholdersService=p,this.AriaLabels=Ae,this.showClosedAccounts=!1,this.totalRecords=0,this.loading=!0,this.showTable=!1,this.roleOptions=hi,this.programOptions=[],this.programsLoading=!1,this.programsLoaded=!1,this.teamAccountOptions=[],this.teamsLoading=!1,this.showPauseCardConfirm=!1,this.pausingCard=!1,this.showResumeCardConfirm=!1,this.resumingCard=!1,this.showRemoveCardholderConfirm=!1,this.removingCardholder=!1,this.showReplaceCardDialog=!1,this.cardDetailsForReplaceCardDialog=null,this.columns=[{field:"lastName",header:"Last Name"},{field:"firstName",header:"First name"},{field:"teamName",header:"Team"},{header:"Program"},{header:"Card Status"}],this.unsubscribe$=new M}ngOnInit(){this.cardholdersService.filters&&this.cardholdersService.filters.page?(this.showTable=!0,this.siteDataService.hideSiteLoader()):(this.cardholdersService.filters={page:1,rows:25,orderBy:"lastName ASC",getTotalCount:!0,showClosedAccounts:this.showClosedAccounts,lastName:"",firstName:"",programIDs:[],teamAccountIDs:[],roleIDs:[]},this.run())}run(){this.cardholdersService.filters.page=1,this.totalRecords=0,this.showTable?this.searchData():this.showTable=!0}searchData(t=null){let n=this.cardholdersService.filters;t&&(t.sortField&&(n.orderBy=t.sortField+" "+(t.sortOrder===1?"ASC":"DESC")),n.rows=t.rows,n.page=t.first/t.rows+1),n.getTotalCount=this.totalRecords===0,this.loading=!0,this.cardholdersService.getCardholderSearch().pipe(b(this.unsubscribe$)).subscribe({next:s=>{this.searchResults=s.results,this.initializeRowMenus(),n.getTotalCount&&(this.totalRecords=s.count),this.loading=!1,this.siteDataService.hideSiteLoader()},error:()=>{this.siteDataService.showSiteErrorAlert("There was a problem getting cardholders data."),this.loading=!1,this.siteDataService.hideSiteLoader()}})}onShowClosedAccountsChange(){this.cardholdersService.filters.showClosedAccounts=this.showClosedAccounts,this.run()}openAccount(){this.router.navigate(["../new"],{relativeTo:this.route})}search(){this.run()}clearFilters(){this.cardholdersService.filters&&(this.cardholdersService.filters.lastName="",this.cardholdersService.filters.firstName="",this.cardholdersService.filters.teamAccountIDs=[],this.cardholdersService.filters.programIDs=[],this.cardholdersService.filters.teamAccountIDs=[],this.cardholdersService.filters.roleIDs=[],this.cardholdersService.filters.showClosedAccounts=!1,this.showClosedAccounts=!1,this.teamAccountOptions=[])}resetFilters(){this.clearFilters(),this.run()}onAdvancedFiltersToggled(t){!t||this.programsLoaded||(this.programsLoading=!0,this.cardholdersService.getProgramFilterOptions().pipe(b(this.unsubscribe$)).subscribe({next:n=>{this.programOptions=n.map(s=>({label:s.name,value:s.programID})),this.programsLoaded=!0,this.programsLoading=!1},error:()=>{this.programsLoading=!1}}))}onProgramSelectionChange(){let t=this.cardholdersService.filters.programIDs;if(!t?.length){this.teamAccountOptions=[],this.cardholdersService.filters.teamAccountIDs=[];return}this.teamsLoading=!0,this.cardholdersService.getTeamAccountFilterOptions(t).pipe(b(this.unsubscribe$)).subscribe({next:n=>{this.teamAccountOptions=n.map(p=>({label:p.name,value:p.teamAccountID}));let s=new Set(this.teamAccountOptions.map(p=>p.value));this.cardholdersService.filters.teamAccountIDs=(this.cardholdersService.filters.teamAccountIDs||[]).filter(p=>s.has(p)),this.teamsLoading=!1},error:()=>{this.teamsLoading=!1}})}initializeRowMenus(){this.searchResults&&this.searchResults.forEac
112h(t=>{let n=t.programTeamAccountUser.clubStripeCardholder?.clubStripeCards?.[0],s=si(t.programTeamAccountUser.clubStripeCardholder),p=s===Le.ACTIVE||s===Le.PAUSED||s===Le.AWAITING_ACTIVATION;t.menuItems=[...s===Le.ACTIVE?[{label:"Pause card",icon:"fa fa-pause fa-fw",command:()=>this.pauseCard(t.programTeamAccountUser)}]:[],...s===Le.PAUSED?[{label:"Resume card",icon:"fa fa-play fa-fw",command:()=>this.resumeCard(t.programTeamAccountUser)}]:[],...n&&p?[{label:"Replace card",icon:"fa fa-refresh fa-fw",command:()=>this.replaceCard(t.programTeamAccountUser,n)}]:[],{label:"Remove cardholder",icon:"fa fa-trash fa-fw",command:()=>this.removeCardholder(t.programTeamAccountUser)}]})}pauseCard(t){t.clubStripeCardholder?.clubStripeCards?.[0]&&(this.cardholderBeingPaused=t,this.showPauseCardConfirm=!0)}confirmPauseCard(){let t=this.cardholderBeingPaused?.clubStripeCardholder?.clubStripeCards?.[0];t&&(this.pausingCard=!0,this.cardholdersService.pauseCard(t.clubStripeCardID).pipe(b(this.unsubscribe$)).subscribe({next:()=>{this.siteDataService.showSiteSuccessAlert("Card paused successfully."),this.closePauseCardConfirm(),this.run()},error:()=>{this.siteDataService.showSiteErrorAlert("There was a problem pausing the card."),this.pausingCard=!1}}))}closePauseCardConfirm(){this.showPauseCardConfirm=!1,this.cardholderBeingPaused=null,this.pausingCard=!1}resumeCard(t){t.clubStripeCardholder?.clubStripeCards?.[0]&&(this.cardholderBeingResumed=t,this.showResumeCardConfirm=!0)}confirmResumeCard(){let t=this.cardholderBeingResumed?.clubStripeCardholder?.clubStripeCards?.[0];t&&(this.resumingCard=!0,this.cardholdersService.resumeCard(t.clubStripeCardID).pipe(b(this.unsubscribe$)).subscribe({next:()=>{this.siteDataService.showSiteSuccessAlert("Card resumed successfully."),this.closeResumeCardConfirm(),this.run()},error:()=>{this.siteDataService.showSiteErrorAlert("There was a problem resuming the card."),this.resumingCard=!1}}))}closeResumeCardConfirm(){this.showResumeCardConfirm=!1,this.cardholderBeingResumed=null,this.resumingCard=!1}replaceCard(t,n){this.cardDetailsForReplaceCardDialog={clubStripeCardId:n.clubStripeCardID,cardholderFirstName:t.firstName,cardholderLastName:t.lastName,shippingAddressLine1:n.shippingAddressLine1,shippingAddressLine2:n.shippingAddressLine2,shippingCity:n.shippingCity,shippingCountryCode:n.shippingCountryCode,shippingPostalCode:n.shippingPostalCode,shippingState:n.shippingState},this.showReplaceCardDialog=!0}onCardReplacementCompleted(){this.showReplaceCardDialog=!1,this.run()}removeCardholder(t){this.cardholderBeingRemoved=t,this.showRemoveCardholderConfirm=!0}confirmRemoveCardholder(){this.cardholderBeingRemoved&&(this.removingCardholder=!0,this.cardholdersService.removeCardholder(this.cardholderBeingRemoved.clubStripeCardholder.clubStripeCardholderID).pipe(b(this.unsubscribe$)).subscribe({next:()=>{this.siteDataService.showSiteSuccessAlert("Cardholder removed successfully."),this.cancelRemoveCardholder(),this.run()},error:()=>{this.siteDataService.showSiteErrorAlert("There was a problem removing the cardholder."),this.removingCardholder=!1}}))}cancelRemoveCardholder(){this.showRemoveCardholderConfirm=!1,this.cardholderBeingRemoved=null,this.removingCardholder=!1}createTeamAccount(){this.router.navigate(["team-accounts","new"])}ngOnDestroy(){this.clearFilters(),this.unsubscribe$.next(),this.unsubscribe$.complete()}};a.\u0275fac=function(n){return new(n||a)(S(R),S(qe),S(He),S(at))},a.\u0275cmp=A({type:a,selectors:[["app-cardholders"]],standalone:!1,decls:83,vars:25,consts:[["actionsMenu",""],[3,"adminFilterReset","adminFilterSearch","advancedFiltersToggled","showAdvanced"],["primary",""],[1,"col","pr-0"],["type","text","id","last","pInputText","","placeholder","Last Name",1,"full-width",3,"ngModelChange","ngModel"],["for","last",1,"sr-only"],["type","text","id","first","pInputText","","placeholder","First Name",1,"full-width",3,"ngModelChange","ngModel"],["for","first",1,"sr-only"],["advanced",""],[1,"row"],[1,"col-md-4"],[1,"form-group"],["for","programFilter"],["inputId","programFilter","optionLabel","label","optionValue","value","styleClass","full-width","appendTo","body","placeholder","All Programs",3,"ngModelChange","onChange","onClear","autofocusFilter","ngModel","options","showClear","filter","disabled"],["for","teamFilter"],["inputId","teamFilter","optionLabel","label","optionValue","value","styleClass","full-width","appendTo","body","placeholder","All Teams",3,"ngModelChange","autofocusFilter","ngModel","options","showClear","filter","disabled"],["for","role"],["inputId","role","optionLabel","label","optionValue","value","styleClass","full-width","appendTo","body","placeholder","All Roles",3,"ngModelChange","ngModel","options","showClear"],["inputId","showClosedAccounts",3,"ngModelChange","onChange","ngModel","binary"],[1,"ml-2"],[1,""],[1,"table-responsive"],["sortField","lastName","currentPageReportTemplate","Showing {first} to {last} of {totalRecords} cardholders",1,"table","table-striped","table-sm",3,"onLazyLoad","columns","value","lazy","paginator","totalRecords","rows","rowsPerPageOptions","showCurrentPageReport","loading"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[1,"text-center",2,"width","80px"],[1,"sr-only"],[3,"pSortableColumn"],[3,"field"],[1,"text-primary",3,"routerLink"],[1,"align-top"],[3,"clubStripeCardholder"],[1,"text-center"],["appendTo","body",3,"popup","model"],["type","button","title","Actions",1,"btn","btn-sm","btn-tertiary",3,"click","disabled"],["aria-hidden","true",1,"fa-solid","fa-ellipsis"],[3,"onClose","onCardReplaced","existingCardDetail
112s"],["headerText","Pause Card","yesButtonText","Pause","yesButtonLoadingText","Pausing...","noButtonText","Cancel","alertType","warning",3,"onYesSelect","onNoSelect","showHeader","modalText","loading"],["headerText","Resume Card","yesButtonText","Resume","yesButtonLoadingText","Resuming...","noButtonText","Cancel","alertType","warning",3,"onYesSelect","onNoSelect","showHeader","modalText","loading"],["headerText","Remove Cardholder","yesButtonText","Remove","yesButtonLoadingText","Removing...","noButtonText","Cancel","alertType","warning",3,"onYesSelect","onNoSelect","showHeader","modalText","loading"]],template:function(n,s){n&1&&(r(0,"app-admin-filter",1),x("adminFilterReset",function(){return s.resetFilters()})("adminFilterSearch",function(){return s.run()})("advancedFiltersToggled",function(f){return s.onAdvancedFiltersToggled(f)}),e(1,` 113 `),Y(2,2),e(3,` 114 `),r(4,"div",3),e(5,` 115 `),r(6,"input",4),E("ngModelChange",function(f){return I(s.cardholdersService.filters.lastName,f)||(s.cardholdersService.filters.lastName=f),f}),l(),e(7,` 116 `),r(8,"label",5),e(9,"Last Name"),l(),e(10,` 117 `),l(),e(11,` 118 `),r(12,"div",3),e(13,` 119 `),r(14,"input",6),E("ngModelChange",function(f){return I(s.cardholdersService.filters.firstName,f)||(s.cardholdersService.filters.firstName=f),f}),l(),e(15,` 120 `),r(16,"label",7),e(17,"First Name"),l(),e(18,` 121 `),l(),e(19,` 122 `),Q(),e(20,` 123 `),Y(21,8),e(22,` 124 `),r(23,"div",9),e(24,` 125 `),r(25,"div",10),e(26,` 126 `),r(27,"div",11),e(28,` 127 `),r(29,"label",12),e(30,"Program"),l(),e(31,` 128 `),r(32,"p-multiSelect",13),E("ngModelChange",function(f){return I(s.cardholdersService.filters.programIDs,f)||(s.cardholdersService.filters.programIDs=f),f}),x("onChange",function(){return s.onProgramSelectionChange()})("onClear",function(){return s.onProgramSelectionChange()}),e(33,` 129 `),l(),e(34,` 130 `),l(),e(35,` 131 `),l(),e(36,` 132 `),r(37,"div",10),e(38,` 133 `),r(39,"div",11),e(40,` 134 `),r(41,"label",14),e(42,"Team"),l(),e(43,` 135 `),r(44,"p-multiSelect",15),E("ngModelChange",function(f){return I(s.cardholdersService.filters.teamAccountIDs,f)||(s.cardholdersService.filters.teamAccountIDs=f),f}),e(45,` 136 `),l(),e(46,` 137 `),l(),e(47,` 138 `),l(),e(48,` 139 `),r(49,"div",10),e(50,` 140 `),r(51,"div",11),e(52,` 141 `),r(53,"label",16),e(54,"Role"),l(),e(55,` 142 `),r(56,"p-multiSelect",17),E("ngModelChange",function(f){return I(s.cardholdersService.filters.roleIDs,f)||(s.cardholdersService.filters.roleIDs=f),f}),e(57,` 143 `),l(),e(58,` 144 `),l(),e(59,` 145 `),l(),e(60,` 146 `),r(61,"div",10),e(62,` 147 `),r(63,"div",11),e(64,` 148 `),r(65,"p-checkbox",18),E("ngModelChange",function(f){return I(s.showClosedAccounts,f)||(s.showClosedAccounts=f),f}),x("onChange",function(){return s.onShowClosedAccountsChange()}),e(66,` 149 `),l(),r(67,"label",19),e(68,"Show Closed Accounts"),l(),e(69,` 150 `),l(),e(70,` 151 `),l(),e(71,` 152 `),l(),e(72,` 153 `),Q(),e(73,` 154`),l(),e(74,` 155 156`),r(75,"section",20),e(76,` 157 `),u(77,ln,13,10),l(),e(78,` 158 159 160`),u(79,sn,4,1),u(80,cn,4,3),u(81,dn,4,3),u(82,mn,4,3)),n&2&&(m("showAdvanced",!0),c(6),w("ngModel",s.cardholdersService.filters.lastName),c(8),w("ngModel",s.cardholdersService.filters.firstName),c(18),m("autofocusFilter",!0),w("ngModel",s.cardholdersService.filters.programIDs),m("options",s.programOptions)("showClear",!0)("filter",!0)("disabled",s.programsLoading),c(12),m("autofocusFilter",!0),w("ngModel",s.cardholdersService.filters.teamAccountIDs),m("options",s.teamAccountOptions)("showClear",!0)("filter",!0)("disabled",s.teamsLoading),c(12),w("ngModel",s.cardholdersService.filters.roleIDs),m("options",s.roleOptions)("showClear",!0),c(9),w("ngModel",s.showClosedAccounts),m("binary",!0),c(12),h(s.showTable?77:-1),c(2),h(s.showReplaceCardDialog?79:-1),c(),h(s.showPauseCardConfirm?80:-1),c(),h(s.showResumeCardConfirm?81:-1),c(),h(s.showRemoveCardholderConfirm?82:-1))},dependencies:[be,ve,ye,De,Te,Oe,Ne,Me,Pe,Be,Rt,Fe,pe,ci,di],styles:[".badge[_ngcontent-%COMP%]{font-size:.75rem;padding:.25rem .5rem;border-radius:.25rem;font-weight:400}.badge[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{margin-right:.25rem}.badge-success[_ngcontent-%COMP%]{background-color:#28a745;color:#fff}.badge-warning[_ngcontent-%COMP%]{background-color:#ffc107;color:#212529}.badge-secondary[_ngcontent-%COMP%]{background-color:#6c757d;color:#fff}"]});let i=a;return i})();var z=(function(i){return i[i.PROCESSING=1]="PROCESSING",i[i.FAILED=2]="FAILED",i[i.SUCCEEDED=3]="SUCCEEDED",i})(z||{});var yi=(()=>{let a=class a{constructor(t,n){this.clubAccountService=t,this.siteDataService=n,this.visible=!1,this.loading=!1,this.receiptUrl=null,this.unsubscribe$=new M}open(t,n){this.receiptUrl=null,this.loading=!0,this.visible=!0,this.clubAccountService.getTransactionReceiptUrl(t,n).pipe(b(this.unsubscribe$)).subscribe({next:s=>{this.receiptUrl=s?.url??null,this.loading=!1},error:()=>{this.loading=!1,this.visible=!1,this.siteDataService.showSiteErrorAlert("Unable to load receipt.")}})}close(){this.visible=!1,this.receiptUrl=null}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete()}};a.\u0275fac=function(n){return new(n||a)(S(ae),S(R))}
160,a.\u0275cmp=A({type:a,selectors:[["app-club-receipt-dialog"]],standalone:!1,decls:5,vars:5,consts:[["header","Receipt","appendTo","body","styleClass","standardWidthDialog",3,"visibleChange","onHide","visible","modal","draggable"],[3,"loading","receiptUrl"]],template:function(n,s){n&1&&(r(0,"p-dialog",0),E("visibleChange",function(f){return I(s.visible,f)||(s.visible=f),f}),x("onHide",function(){return s.close()}),e(1,` 161 `),_(2,"app-receipt-viewer",1),e(3,` 162`),l(),e(4,` 163`)),n&2&&(w("visible",s.visible),m("modal",!0)("draggable",!1),c(2),m("loading",s.loading)("receiptUrl",s.receiptUrl))},dependencies:[Ie,Jt],encapsulation:2});let i=a;return i})();var gn=["descriptionForm"];function Cn(i,a){if(i&1&&(e(0,` 164 `),r(1,"app-dynamic-form",3,0),e(3,` 165 `),r(4,"app-dynamic-form-field",4),e(5,` 166 `),l(),e(6,` 167 `),l(),e(7,` 168 `)),i&2){let o=d(2);c(),m("fields",o.metadata.fields)("entity",o.descriptionEntity)("horizontalForm",!1)("contentFieldsMode",!0)("showCancelButton",!1)("showSubmitButton",!1)}}function fn(i,a){i&1&&(e(0,` 169 `),r(1,"app-inline-alert",5),e(2,` 170 Unable to load form. 171 `),l(),e(3,` 172 `))}function _n(i,a){if(i&1&&(e(0,` 173 `),u(1,Cn,8,6)(2,fn,4,0)),i&2){let o=d();c(),h(o.metadata?1:2)}}function xn(i,a){i&1&&(e(0,` 174 `),_(1,"app-skeleton-template",6),e(2,` 175 `))}function Sn(i,a){i&1&&(e(0,` 176 `),_(1,"app-button-loader"),e(2,` 177 `),r(3,"span"),e(4,"Saving..."),l(),e(5,` 178 `))}function bn(i,a){i&1&&e(0,` 179 Save 180 `)}function vn(i,a){if(i&1){let o=v();e(0,` 181 `),r(1,"app-dialog-footer"),e(2,` 182 `),Y(3,7),e(4,` 183 184 `),r(5,"button",8),x("click",function(){g(o);let n=d();return C(n.closeModal.emit())}),e(6,` 185 Cancel 186 `),l(),e(7,` 187 188 `),Q(),e(8,` 189 `),Y(9,9),e(10,` 190 191 `),r(11,"button",10),x("click",function(){g(o);let n=d();return C(n.save())}),e(12,` 192 `),u(13,Sn,6,0)(14,bn,1,0),l(),e(15,` 193 194 `),Q(),e(16,` 195 `),l(),e(17,` 196 `)}if(i&2){let o=d();c(5),m("disabled",o.loading||o.saving||o.error),c(6),m("disabled",o.loading||o.saving||o.error),c(2),h(o.saving?13:14)}}var Ti=(()=>{let a=class a{constructor(t,n){this.clubAccountService=t,this.siteDataService=n,this.closeModal=new ct,this.saved=new ct,this.visible=!0,this.loading=!0,this.saving=!1,this.error=!1,this.metadata=null,this.unsubscribe$=new M}ngOnInit(){this.descriptionEntity={description:this.currentDescription??null},this.clubAccountService.getTransactionDescriptionMetadata().pipe(b(this.unsubscribe$)).subscribe({next:t=>{this.metadata=t,this.loading=!1},error:()=>{this.loading=!1,this.error=!0,this.siteDataService.showSiteErrorAlert("Unable to load form.")}})}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete()}save(){if(this.descriptionForm?.form.invalid){this.descriptionForm.submitForm();return}let t={description:this.descriptionForm?.form?.value?.description??null};this.saving=!0,this.clubAccountService.updateTransactionDescription(this.stripeObjectID,this.transactionType,t).pipe(b(this.unsubscribe$)).subscribe({next:()=>{this.saving=!1,this.siteDataService.showSiteSuccessAlert("Description updated successfully."),this.saved.emit(t.description),this.closeModal.emit()},error:()=>{this.saving=!1,this.siteDataService.showSiteErrorAlert("Unable to update description.")}})}};a.\u0275fac=function(n){return new(n||a)(S(ae),S(R))},a.\u0275cmp=A({type:a,selectors:[["app-club-edit-description-modal"]],viewQuery:function(n,s){if(n&1&&H(gn,5),n&2){let p;B(p=O())&&(s.descriptionForm=p.first)}},inputs:{stripeObjectID:"stripeObjectID",transactionType:"transactionType",currentDescription:"currentDescription"},outputs:{closeModal:"closeModal",saved:"saved"},standalone:!1,decls:6,vars:4,consts:[["descriptionForm",""],["header","Edit Description","appendTo","body","styleClass","standardWidthDialog",3,"visibleChange","onHide","visible","modal","draggable"],["pTemplate","footer"],["formID","club-edit-description-form",3,"fields","entity","horizontalForm","contentFieldsMode","showCancelButton","showSubmitButton"],["fieldName","description","formID","club-edit-description-form"],["alertType","error"],["height","4rem"],["slot","secondary"],["type","button",1,"btn","btn-naked","btn-lg",3,"click","disabled"],["slot","primary"],["type","button",1,"btn","btn-primary","btn-lg",3,"click","disabled"]],template:function(n,s){n&1&&(r(0,"p-dialog",1),E("visibleChange",function(f){return I(s.visible,f)||(s.visible=f),f}),x("onHide",function(){return s.closeModal.emit()}),e(1,` 197 198 `),u(2,_n,3,1)(3,xn,3,0),y(4,vn,18,3,"ng-template",2),e(5,` 199 200`),l()),n&2&&(w("visible",s.visible),m("modal",!0)("draggable",!1),c(2),h(s.loading?3:2))},dependencies:[Je,Ke,Te,ue,Re,Ot,Bt,Ie],encapsulation:2});let i=a;return i})();var Tn=["dateRangeFilter"],An=["actionsMenu"],wn=["receiptDialog"],In=["payoutDetailsDialog"],En=["teamFeeRefundDetailsDialog"],Ve=()=>({width:"100%"}),Rn=()=>[25,50,100],Fn=i=>({$implicit:i}),Mn=()=>[0,1,2];function Pn(i,a){i&1&&(e(0,` 201 `),_(1,"span",52),e(2,` 202 `))}function Bn(i,a){if(i&1){let o=v();e(0,` 203 `),r(1,"div",40),e(2,` 204 `),r(3,"label",53),e(4,"Account"),l(),e(5,` 205 `),r(6,"p-multiSelect",54),E("ngModelChange",function(n){g(o);let s=d(2);return I(s.selectedAccountFilters,n)||(s.selectedAccountFilters=n),C(n)}),e(7,`
206 `),l(),e(8,` 207 `),l(),e(9,` 208 `)}if(i&2){let o=d(2);c(6),q(T(7,Ve)),w("ngModel",o.selectedAccountFilters),m("options",o.accountFilterOptionGroups)("group",!0)("dataKey","key")("filter",!0)}}function On(i,a){if(i&1){let o=v();e(0,` 209 `),r(1,"div",40),e(2,` 210 `),r(3,"label",55),e(4,"Account"),l(),e(5,` 211 `),r(6,"p-multiSelect",56),E("ngModelChange",function(n){g(o);let s=d(2);return I(s.clubAccountService.filters.teamAccountID,n)||(s.clubAccountService.filters.teamAccountID=n),C(n)}),x("onChange",function(){g(o);let n=d(2);return C(n.onTeamAccountFilterChange())}),e(7,` 212 `),l(),e(8,` 213 `),l(),e(9,` 214 `)}if(i&2){let o=d(2);c(6),q(T(5,Ve)),m("options",o.clubTeamAccountOptions),w("ngModel",o.clubAccountService.filters.teamAccountID),m("filter",!0)}}function Nn(i,a){if(i&1&&(e(0,` 215 `),r(1,"span",57),_(2,"i"),e(3),l(),e(4,` 216 `)),i&2){let o=d().$implicit,t=d(2);c(2),xt(t.categoryIconMap[o.transactionCategoryID]+" mr-1 text-grey"),c(),N(t.categoryNameMap[o.transactionCategoryID])}}function Ln(i,a){if(i&1&&(e(0,` 217 `),u(1,Nn,5,3)),i&2){let o=a.$implicit;c(),h(o.transactionCategoryID?1:-1)}}function Vn(i,a){if(i&1&&(e(0,` 218 `),r(1,"span",61),e(2),l(),e(3,` 219 `)),i&2){let o=d(3).$implicit;c(),m("title",o.secondaryLine),c(),N(o.secondaryLine)}}function Un(i,a){if(i&1&&(e(0,` 220 `),r(1,"span",62),e(2),l(),e(3,` 221 `)),i&2){let o=d(3).$implicit;c(2),N(o.secondaryLine)}}function kn(i,a){if(i&1&&(e(0,` 222 `),u(1,Vn,4,2)(2,Un,4,1)),i&2){let o=d(2).$implicit;c(),h(o.isMerchantCategory?1:2)}}function $n(i,a){if(i&1&&(e(0,` 223 `),r(1,"div",58),e(2,` 224 `),_(3,"app-user-initials",59),e(4,` 225 `),r(5,"div",60),e(6,` 226 `),r(7,"span"),e(8),l(),e(9,` 227 `),u(10,kn,3,1),l(),e(11,` 228 `),l(),e(12,` 229 `)),i&2){let o=d().$implicit;c(3),m("firstName",o.nameParts.firstName)("lastName",o.nameParts.lastName)("showCircle",!1),c(5),N(o.name),c(2),h(o.secondaryLine?10:-1)}}function jn(i,a){if(i&1&&(e(0,` 230 `),u(1,$n,13,5)),i&2){let o=a.$implicit;c(),h(o.name?1:-1)}}function Wn(i,a){if(i&1&&(e(0,` 231 `),_(1,"p-sortIcon",65),e(2,` 232 `)),i&2){let o=d().$implicit;c(),m("field",o.field)}}function zn(i,a){if(i&1&&(e(0,` 233 `),r(1,"th",64),e(2),u(3,Wn,3,1),l(),e(4,` 234 `)),i&2){let o=a.$implicit,t=d(4);c(),m("pSortableColumn",o.field),G("aria-label",t.AriaLabels.ACTIVATE_SORT),c(),D(` 235 `,o.header,` 236 `),c(),h(o.field?3:-1)}}function Gn(i,a){if(i&1&&(e(0,` 237 `),r(1,"tr"),e(2,` 238 `),U(3,zn,5,4,null,null,j),l(),e(5,` 239 `)),i&2){let o=d(3);c(3),k(o.columns)}}function Yn(i,a){i&1&&Se(0)}function Qn(i,a){i&1&&Se(0)}function Hn(i,a){i&1&&Se(0)}function qn(i,a){if(i&1&&(e(0,` 240 `),r(1,"div",58),e(2,` 241 `),_(3,"app-user-initials",72),e(4,` 242 `),r(5,"span",73),e(6),l(),e(7,` 243 `),l(),e(8,` 244 `)),i&2){let o=d().$implicit;c(3),m("firstName",o.initiatedByNameParts.firstName)("lastName",o.initiatedByNameParts.lastName)("id",o.initiatedByClubUserID),c(3),N(o.initiatedByName)}}function Kn(i,a){if(i&1){let o=v();e(0,` 245 `),r(1,"button",74),x("click",function(n){g(o);let s=d().$implicit,p=d(3);return C(p.showActionsMenu(n,s))}),e(2,` 246 `),_(3,"i",75),e(4,` 247 `),r(5,"div",76),e(6,"Options"),l(),e(7,` 248 `),l(),e(8,` 249 `)}i&2&&(c(),G("aria-label","Actions for transaction"))}function Jn(i,a){if(i&1&&(e(0,` 250 `),r(1,"tr"),e(2,` 251 `),r(3,"td"),e(4),X(5,"date"),l(),e(6,` 252 `),r(7,"td"),e(8,` 253 `),y(9,Yn,1,0,"ng-container",66),e(10,`
254 `),l(),e(11,` 255 `),r(12,"td",67),e(13,` 256 `),_(14,"i",68),e(15),l(),e(16,` 257 `),r(17,"td"),e(18,` 258 `),y(19,Qn,1,0,"ng-container",66),e(20,` 259 `),l(),e(21,` 260 `),r(22,"td"),e(23),l(),e(24,` 261 `),r(25,"td"),e(26,` 262 `),y(27,Hn,1,0,"ng-container",66),e(28,` 263 `),l(),e(29,` 264 `),r(30,"td"),e(31,` 265 `),u(32,qn,9,4),l(),e(33,` 266 `),r(34,"td",69),e(35),X(36,"currency"),l(),e(37,` 267 `),r(38,"td",70),e(39,` 268 `),r(40,"app-pill",71),e(41),l(),e(42,` 269 `),l(),e(43,` 270 `),r(44,"td"),e(45,` 271 `),u(46,Kn,9,1),l(),e(47,` 272 `),l(),e(48,` 273 `)),i&2){let o=a.$implicit;d(2);let t=de(170),n=de(173),s=d();c(),J("opacity-75",o.teamAccountTransactionDisplayStatusID===s.TeamAccountTransactionDisplayStatus.PROCESSING)("font-italic",o.teamAccountTransactionDisplayStatusID===s.TeamAccountTransactionDisplayStatus.PROCESSING)("last-processing",o===s.lastProcessingTransaction),c(3),N(dt(5,29,o.vendorCreatedOn,"MM/dd/yyyy")),c(5),m("ngTemplateOutlet",n)("ngTemplateOutletContext",o.fromAccountContext),c(3),J("color-success",o.teamAccountTransactionFlowDirectionID===s.TeamAccountTransactionFlowDirection.INBOUND)("color-critical",o.teamAccountTransactionFlowDirectionID===s.TeamAccountTransactionFlowDirection.OUTBOUND),c(2),m("ngClass",s.flowDirectionIconMap[o.teamAccountTransactionFlowDirectionID]),c(),D("",s.flowDirectionNameMap[o.teamAccountTransactionFlowDirectionID],` 274 `),c(4),m("ngTemplateOutlet",t)("ngTemplateOutletContext",Ue(34,Fn,o)),c(4),N(o.description),c(4),m("ngTemplateOutlet",n)("ngTemplateOutletContext",o.toAccountContext),c(5),h(o.initiatedByName?32:-1),c(2),J("color-success",o.amount>0)("color-critical",o.amount<0),c(),D(` 275 `,se(36,32,o.amount),` 276 `),c(5),m("status",s.transactionStatusPillTypeMap[o.teamAccountTransactionDisplayStatusID]),c(),D(` 277 `,s.transactionStatusNameMap[o.teamAccountTransactionDisplayStatusID],` 278 `),c(5),h(o.teamAccountTransactionDisplayStatusID!==s.TeamAccountTransactionDisplayStatus.PROCESSING?46:-1)}}function Xn(i,a){if(i&1&&(e(0,` 279 `),r(1,"tr"),e(2,` 280 `),r(3,"td",77),e(4,` 281 No transactions found. 282 `),l(),e(5,` 283 `),l(),e(6,` 284 `)),i&2){let o=d(3);c(3),G("colspan",o.columns.length)}}function Zn(i,a){if(i&1){let o=v();e(0,` 285 `),r(1,"p-table",63),x("onLazyLoad",function(n){g(o);let s=d(2);return C(s.search(n))}),e(2,` 286 `),y(3,Gn,6,0,"ng-template",null,7,W),e(5,` 287 `),y(6,Jn,49,36,"ng-template",null,8,W),e(8,` 288 `),y(9,Xn,7,1,"ng-template",null,9,W),e(11,` 289 `),l(),e(12,` 290 `)}if(i&2){let o=d(2);c(),m("columns",o.columns)("value",o.transactions)("lazy",!0)("paginator",!0)("totalRecords",o.totalRecords)("rows",o.clubAccountService.filters.rows)("sortOrder",-1)("rowsPerPageOptions",T(10,Rn))("showCurrentPageReport",!0)("loading",o.loadingTransactions)}}function eo(i,a){if(i&1){let o=v();e(0,` 291`),r(1,"section",11),e(2,` 292 `),r(3,"div",12),e(4,` 293 `),e(5,` 294 `),r(6,"div",13),e(7,` 295 `),r(8,"div",14),e(9,` 296 `),r(10,"h2",15),e(11,` 297 Club Account Available Balance 298 `),l(),e(12,` 299 `),r(13,"div",16),e(14),X(15,"currency"),l(),e(16,` 300 `),r(17,"div",17),e(18,` 301 Ready to transfer or withdraw 302 `),l(),e(19,` 303 `),l(),e(20,` 304 `),l(),e(21,` 305 `),e(22,` 306 `),r(23,"div",13),e(24,` 307 `),r(25,"div",14),e(26,` 308 `),r(27,"h2",15),e(28,` 309 Club Account Pending Balance
310 `),l(),e(29,` 311 `),r(30,"div",18),e(31),X(32,"currency"),l(),e(33,` 312 `),r(34,"div",17),e(35,` 313 Payments still clearing (ex: ACH) 314 `),l(),e(36,` 315 `),l(),e(37,` 316 `),l(),e(38,` 317 `),e(39,` 318 `),r(40,"div",13),e(41,` 319 `),r(42,"div",14),e(43,` 320 `),r(44,"h2",15),e(45,` 321 Club Account Net Activity This Month 322 `),l(),e(46,` 323 `),r(47,"div",19),e(48),X(49,"currency"),l(),e(50,` 324 `),r(51,"div",17),e(52),X(53,"date"),l(),e(54,` 325 `),l(),e(55,` 326 `),l(),e(56,` 327 `),l(),e(57,` 328`),l(),e(58,` 329`),r(59,"section",20),e(60,` 330 `),r(61,"div",21),e(62,` 331 `),r(63,"div"),e(64,` 332 `),r(65,"h2",22),e(66,"Recent Activity"),l(),e(67,` 333 `),l(),e(68,` 334 `),l(),e(69,` 335 `),r(70,"div",23),e(71,` 336 `),r(72,"p-selectButton",24),x("onChange",function(n){g(o);let s=d();return C(s.onActivityViewChange(n.value))}),l(),e(73,` 337 `),l(),e(74,` 338 `),r(75,"app-admin-filter",25),x("adminFilterReset",function(){g(o);let n=d();return C(n.resetFilters())})("adminFilterSearch",function(){g(o);let n=d();return C(n.run())}),e(76,` 339 `),Y(77,26),e(78,` 340 `),r(79,"div",27),e(80,` 341 `),r(81,"span",28),e(82,` 342 `),_(83,"i",29),e(84,` 343 `),r(85,"input",30),E("ngModelChange",function(n){g(o);let s=d();return I(s.clubAccountService.filters.description,n)||(s.clubAccountService.filters.description=n),C(n)}),x("keydown.enter",function(){g(o);let n=d();return C(n.run())}),l(),e(86,` 344 `),_(87,"label",31),e(88,` 345 `),l(),e(89,` 346 `),l(),e(90,` 347 `),e(91,` 348 `),r(92,"div",32),e(93,` 349 `),r(94,"app-date-range-filter",33,3),x("rangeChange",function(n){g(o);let s=d();return C(s.onDateRangeChange(n))}),l(),e(96,` 350 `),l(),e(97,` 351 `),r(98,"div",34),e(99,` 352 `),r(100,"button",35),x("click",function(){g(o);let n=d();return C(n.exportTransactions())}),e(101,` 353 `),u(102,Pn,3,0),_(103,"i",36),e(104,` Export 354 `),l(),e(105,` 355 `),l(),e(106,` 356 `),Q(),e(107,` 357 `),Y(108,37),e(109,` 358 `),r(110,"div",38),e(111,` 359 `),r(112,"div",39),e(113,` 360 `),r(114,"div",40),e(115,` 361 `),r(116,"label",41),e(117,"Transaction Type"),l(),e(118,` 362 `),r(119,"p-multiSelect",42),E("ngModelChange",function(n){g(o);let s=d();return I(s.clubAccountService.filters.transactionCategoryID,n)||(s.clubAccountService.filters.transactionCategoryID=n),C(n)}),e(120,` 363 `),l(),e(121,` 364 `),l(),e(122,` 365 `),l(),e(123,` 366 `),r(124,"div",39),e(125,` 367 `),u(126,Bn,10,8)(127,On,10,6),l(),e(128,` 368 `),r(129,"div",39),e(130,` 369 `),r(131,"div",40),e(132,` 370 `),r(133,"label",43),e(134,"Initiated By"),l(),e(135,` 371 `),r(136,"p-multiSelect",44),E("ngModelChange",function(n){g(o);let s=d();return I(s.clubAccountService.filters.initiatedByClubUserID,n)||(s.clubAccountService.filters.initiatedByClubUserID=n),C(n)}),e(137,` 372 `),l(),e(138,` 373 `),l(),e(139,` 374 `),l(),e(140,` 375 `),r(141,"div",39),e(142,` 376 `),r(143,"div",40),e(144,` 377 `),r(145,"label",45),e(146,"Direction"),l(),e(147,` 378 `),r(148,"p-multiSelect",46),E("ngModelChange",function(n){g(o);let s=d();return I(s.clubAccountService.filters.teamAccountTransactionFlowDirectionID,n)||(s.clubAccountService.filters.teamAccountTransactionFlowDirectionID=n),C(n)}),e(149,` 379 `),l(),e(150,` 380 `),l(),e(151,` 381 `),l(),e(152,` 382 `),r(153,"div",39),e(154,` 383 `),r(155,"div",40),e(156,` 384 `),r(157,"label",47),e(158,"Status"),l(),e(159,` 385 `),r(160,"p-multiSelect",48),E("ngModelChange",function(n){g(o);let s=d();return I(s.selectedDisplayStatuses,n)||(s.selectedDisplayStatuses=n),C(n)}),e(161,`
386 `),l(),e(162,` 387 `),l(),e(163,` 388 `),l(),e(164,` 389 `),l(),e(165,` 390 `),Q(),e(166,` 391 `),l(),e(167,` 392 `),e(168,` 393 `),y(169,Ln,2,1,"ng-template",null,4,W),e(171,` 394 `),y(172,jn,2,1,"ng-template",null,5,W),e(174,` 395 `),r(175,"div",49),e(176,` 396 `),r(177,"div",50),e(178,` 397 `),u(179,Zn,13,11),_(180,"p-menu",51,6),e(182,` 398 `),l(),e(183,` 399 `),l(),e(184,` 400`),l(),e(185,` 401`)}if(i&2){let o=de(95),t=d();c(14),D(` 402 `,se(15,44,(t.balanceDetails==null?null:t.balanceDetails.availableBalance)??0),` 403 `),c(17),D(` 404 `,se(32,46,t.totalPendingBalance),` 405 `),c(16),J("color-success",((t.netActivity==null?null:t.netActivity.netActivity)??0)>=0)("color-critical",((t.netActivity==null?null:t.netActivity.netActivity)??0)<0),c(),ze(` 406 `,((t.netActivity==null?null:t.netActivity.netActivity)??0)>=0?"+":"","",se(49,48,(t.netActivity==null?null:t.netActivity.netActivity)??0),` 407 `),c(4),D(` 408 Club Account activity since `,dt(53,50,t.netActivity==null?null:t.netActivity.periodStart,"MMM d"),` 409 `),c(20),m("options",t.activityViewOptions)("ngModel",t.selectedActivityView)("allowEmpty",!1),c(3),m("showAdvanced",!0),c(4),J("min-width-0",(o==null?null:o.preset)==="custom"),c(6),w("ngModel",t.clubAccountService.filters.description),c(7),J("col-md-3",(o==null?null:o.preset)!=="custom")("col-auto",(o==null?null:o.preset)==="custom"),c(2),m("defaultPreset","last90Days"),c(6),m("disabled",t.exportingCsv||t.loadingTransactions),c(2),h(t.exportingCsv?102:-1),c(17),q(T(53,Ve)),w("ngModel",t.clubAccountService.filters.transactionCategoryID),m("options",t.transactionCategoryOptions),c(7),h(t.selectedActivityView===t.ClubAccountActivityView.CLUB_ACCOUNT?126:127),c(10),q(T(54,Ve)),w("ngModel",t.clubAccountService.filters.initiatedByClubUserID),m("options",t.initiatedByOptions)("filter",!0),c(12),q(T(55,Ve)),w("ngModel",t.clubAccountService.filters.teamAccountTransactionFlowDirectionID),m("options",t.flowDirectionOptions),c(12),q(T(56,Ve)),w("ngModel",t.selectedDisplayStatuses),m("options",t.statusOptions),c(19),h(t.showTable?179:-1),c(),m("model",t.menuItems)("popup",!0)}}function to(i,a){i&1&&(e(0,` 410 `),r(1,"div",13),e(2,` 411 `),_(3,"app-skeleton-template",78),e(4,` 412 `),l(),e(5,` 413 `))}function io(i,a){i&1&&(e(0,` 414`),r(1,"div",12),e(2,` 415 `),U(3,to,6,0,null,null,j),l(),e(5,` 416`)),i&2&&(c(3),k(T(0,Mn)))}function no(i,a){if(i&1){let o=v();r(0,"app-club-edit-description-modal",79),x("closeModal",function(){g(o);let n=d();return C(n.editDescriptionStripeObjectID=null)})("saved",function(n){g(o);let s=d();return C(s.onDescriptionSaved(n))}),e(1,` 417`),l()}if(i&2){let o=d();m("stripeObjectID",o.editDescriptionStripeObjectID)("transactionType",o.editDescriptionTransactionType)("currentDescription",o.editDescriptionCurrentValue)}}var wi=(()=>{let a=class a{get totalPendingBalance(){return(this.balanceDetails?.pendingCredits??0)+Math.abs(this.balanceDetails?.pendingDebits??0)}constructor(t,n){this.siteDataService=t,this.clubAccountService=n,this.loading=!0,this.exportingCsv=!1,this.loadingTransactions=!0,this.showTable=!1,this.transactions=[],this.lastProcessingTransaction=null,this.totalRecords=0,this.AriaLabels=Ae,this.TeamAccountTransactionDisplayStatus=L,this.TeamAccountTransactionFlowDirection=he,this.flowDirectionOptions=[{label:"Inbound",value:he.INBOUND},{label:"Outbound",value:he.OUTBOUND}],this.ClubAccountDisplayStatus=z,this.statusOptions=[{label:"Processing",value:z.PROCESSING},{label:"Failed",value:z.FAILED},{label:"Succeeded",value:z.SUCCEEDED}],this.selectedDisplayStatuses=[z.PROCESSING,z.SUCCEEDED],this.flowDirectionNameMap={[he.INBOUND]:"Inbound",[he.OUTBOUND]:"Outbound"},this.flowDirectionIconMap={[he.INBOUND]:"fa fa-arrow-trend-down",[he.OUTBOUND]:"fa fa-arrow-trend-up"},this.transactionStatusNameMap={[L.PROCESSING]:"Processing",[L.FAILED]:"Failed",[L.UNRECONCILED]:"Succeeded",[L.RECONCILED]:"Succeeded"},this.transactionStatusPillTypeMap={[L.PROCESSING]:"default",[L.FAILED]:"error",[L.UNRECONCILED]:"success",[L.RECONCILED]:"success"},this.columns=[{field:"vendorCreatedOn",header:"Date"},{header:"From Account"},{field:"teamAccountTransactionFlowDirectionID",header:"Direction"},{header:"Transaction Type"},{field:"description",header:"Description"},{header:"To Account/Merchant"},{header:"Initiated By"},{field:"amount",header:"Amount"},{header:"Status"},{header:""}],this.ClubAccountActivityView=ce,this.activityViewOptions=[{label:"Club Account",value:ce.CLUB_ACCOUNT},{label:"Team Accounts",value:ce.TEAM_ACCOUNTS}],this.selectedActivityView=ce.CLUB_ACCOUNT,this.viewStates=new Map,this.defaultDateRange=null,this.transactionCategoryOptions=Qt,this.categoryNameMap=Gt,this.accountFilterOptionGroups=[],this.selectedAccountFilters=[],this.clubTeamAccountOptions=[],this.categoryIconMap={[$.PAYOUT]:"fa-regular fa-money-bill-transfer",[$.ACCOUNT_TRANSFER]:"fa-regular fa-right-left",[$.CARD_PAYMENT]:"fa-regular fa-credit-card",[$.CARD_REFUND]:"fa-regular fa-rotate-left",[$.ACH_CREDIT]:"fa-regular fa-building-columns",[$.ACH_DEBIT]:"fa-regular fa-building-columns",[$.WIRE]:"fa-regular fa-bolt",[$.DEPOSIT]:"fa-regular fa-circle-plus",[$.REIMBURSEMENT]:"fa-regular fa-receipt",[$.REVERSAL]:"fa-regular fa-rotate-left",[$.TEAM_FEE_REFUND]:"fa-regular fa-hand-holding-dollar"},this.initiatedByOptions=[],this.editDescriptionStripeObjectID=null,this.editDescriptionTransactionType=null,this.editDescriptionCurrentValue=null,this.menuItems=[],this.unsubscribe$=new M,this.dateRangeReady=!1}
417ngOnInit(){this.siteDataService.hideSiteLoader(),this.viewStates.set(ce.CLUB_ACCOUNT,this.createViewState(ce.CLUB_ACCOUNT)),this.viewStates.set(ce.TEAM_ACCOUNTS,this.createViewState(ce.TEAM_ACCOUNTS)),this.clubAccountService.filters=this.viewStates.get(this.selectedActivityView).filters,this.loadSummaryData()}createViewState(t){let n=new Yt;return n.activityView=t,{filters:n,selectedDisplayStatuses:[z.PROCESSING,z.SUCCEEDED],selectedAccountFilters:[],dateRangeSnapshot:null}}saveCurrentViewState(){let t=this.viewStates.get(this.selectedActivityView);t&&(t.filters=this.clubAccountService.filters,t.selectedDisplayStatuses=this.selectedDisplayStatuses,t.selectedAccountFilters=this.selectedAccountFilters,t.dateRangeSnapshot=this.dateRangeFilter?.snapshot()??t.dateRangeSnapshot)}restoreViewState(t){let n=this.viewStates.get(t);this.clubAccountService.filters=n.filters,this.clubAccountService.filters.activityView=t,this.selectedDisplayStatuses=n.selectedDisplayStatuses,this.selectedAccountFilters=n.selectedAccountFilters,n.dateRangeSnapshot?this.dateRangeFilter?.restore(n.dateRangeSnapshot):this.defaultDateRange&&(this.dateRangeFilter?.restore(this.defaultDateRange.snapshot),n.filters.startDate=this.defaultDateRange.startDate,n.filters.endDate=this.defaultDateRange.endDate)}loadFilterOptions(){this.clubAccountService.getFilterOptions().pipe(b(this.unsubscribe$)).subscribe({next:t=>{this.initiatedByOptions=(t.initiatedByUsers??[]).map(n=>({label:n.name,value:n.id})),this.clubTeamAccountOptions=t.clubTeamAccounts??[],this.accountFilterOptionGroups=gt(this.clubTeamAccountOptions)},error:()=>{this.initiatedByOptions=[],this.accountFilterOptionGroups=gt([])}})}onDateRangeChange(t){let n=t.startDate?t.startDate.toISOString():void 0,s=t.endDate?t.endDate.toISOString():void 0;if(this.clubAccountService.filters.startDate=n,this.clubAccountService.filters.endDate=s,this.loadFilterOptions(),!this.dateRangeReady){this.dateRangeReady=!0,this.defaultDateRange={snapshot:{preset:t.preset,customStart:null,customEnd:null},startDate:n,endDate:s},this.run();return}t.preset!=="custom"&&this.run()}onActivityViewChange(t){t!==this.selectedActivityView&&(this.saveCurrentViewState(),this.selectedActivityView=t,this.restoreViewState(t),this.loadFilterOptions(),this.run())}onTeamAccountFilterChange(){this.totalRecords=0,this.loadFilterOptions(),this.run()}loadSummaryData(){K({netActivity:this.clubAccountService.getNetActivity(),balanceDetails:this.clubAccountService.getBalance()}).pipe(b(this.unsubscribe$)).subscribe({next:({netActivity:t,balanceDetails:n})=>{this.netActivity=t,this.balanceDetails=n,this.loading=!1},error:()=>{this.siteDataService.showSiteErrorAlert("Unable to load account summary."),this.loading=!1}})}mapDisplayStatusesToFilterIDs(t){let n=[];return t.includes(z.PROCESSING)&&n.push(L.PROCESSING),t.includes(z.FAILED)&&n.push(L.FAILED),t.includes(z.SUCCEEDED)&&(n.push(L.UNRECONCILED),n.push(L.RECONCILED)),n}applyAccountFilters(){let t=this.clubAccountService.filters;t.counterpartyAccountType=this.selectedAccountFilters.filter(n=>(n.accountTypeID??null)!==null).map(n=>n.accountTypeID),t.counterpartyProgramTeamAccountID=this.selectedAccountFilters.flatMap(n=>n.programTeamAccountIDs??[]),t.includeOwnAccount=this.selectedAccountFilters.some(n=>n.isOwnAccount)}run(){this.dateRangeFilter&&!this.dateRangeFilter.isValid||(this.clubAccountService.filters.teamAccountTransactionDisplayStatusID=this.mapDisplayStatusesToFilterIDs(this.selectedDisplayStatuses),this.applyAccountFilters(),this.clubAccountService.filters.page=1,this.totalRecords=0,this.showTable?this.search():this.showTable=!0)}search(t=null){let n=this.clubAccountService.filters;t&&(t.sortField&&(n.orderBy=t.sortField+" "+(t.sortOrder===1?"ASC":"DESC")),n.rows=t.rows,n.page=t.first/t.rows+1),n.includeCount=this.totalRecords===0,this.loadingTransactions=!0,this.clubAccountService.getTransactions().pipe(b(this.unsubscribe$)).subscribe({next:s=>{this.transactions=s.results.map(Ht),this.transactions.length>1&&(this.lastProcessingTransaction=[...this.transactions].reverse().find(p=>p.teamAccountTransactionDisplayStatusID===L.PROCESSING)??null),n.includeCount&&(this.totalRecords=s.count),this.loadingTransactions=!1},error:()=>{this.siteDataService.showSiteErrorAlert("Unable to load transactions."),this.loadingTransactions=!1}})}resetFilters(){let t=this.createViewState(this.selectedActivityView);if(this.viewStates.set(this.selectedActivityView,t),this.clubAccountService.filters=t.filters,this.selectedDisplayStatuses=t.selectedDisplayStatuses,this.selectedAccountFilters=t.selectedAccountFilters,this.dateRangeFilter){this.dateRangeFilter.reset();return}this.loadFilterOptions(),this.run()}showActionsMenu(t,n){this.selectedTransaction=n,this.buildMenuItems(),this.actionsMenu.toggle(t)}buildMenuItems(){this.menuItems=[];let t=this.selectedTransaction?.transactionTypeID;t!==ht.CREDIT_REVERSAL&&t!==ht.DEBIT_REVERSAL&&this.menuItems.push({label:"Edit Description",icon:"fal fa-pen",command:()=>this.editDescription()}),this.canViewReceipt(this.selectedTransaction)&&this.menuItems.push({label:"View Receipt",icon:"fal fa-eye",command:()=>this.viewReceipt()}),this.canViewPayoutDetails(this.selectedTransaction)&&this.menuItems.push({label:"View Payout Details",icon:"fal fa-list",command:()=>this.viewPayoutDetails()}),this.canViewRefundDetails(this.selectedTransaction)&&this.menuItems.push({label:"View Refund Details",icon:"fal fa-list",command:()=>this.viewRefundDetails()})}canViewPayoutDetails(t){return!!t&&t.transactionCategoryID===$.PAYOUT&&!!t.teamAccountPayoutID}viewPayoutDetails(){this.canViewPayoutDetails(this.selectedTransaction)&&this.payoutDetailsDialog.open(this.selectedTransaction.counterpartyProgramTeamAccountID,this.selectedTransaction.teamAccountPayoutID)}canViewRefundDetails(t){return!!t&&t.transactionCategoryID===$.TEAM_FEE_REFUND&&!!t.counterpartyProgramTeamAccountID&&!!t.teamAccountRefundID}viewRefundDetails(){this.canViewRefundDetails(this.selectedTransaction)&&this.teamFeeRefundDetailsDialog.open(this.selectedTransaction.counterpartyProgramTeamAccountID,this.selectedTransaction.teamAccountRefundID)}canViewReceipt(t){return!!t&&!!t.transactionTypeID&&!!t.stripeObjectID&&t.teamAccountTransactionDisplayStatusID!==L.PROCESSING}editDescription(){this.selectedTransaction?.stripeObjectID&&this.selectedTransaction?.transactionTypeID&&(this.editDescriptionStripeObjectID=this.selectedTransaction.stripeObjectID,this.editDescriptionTransactionType=this.selectedTransaction.transactionTypeID,this.editDescriptionCurrentValue=this.selectedTransaction.description??null)}onDescriptionSaved(t){let n=this.editDescriptionStripeObjectID,s=this.transactions.findIndex(p=>p.stripeObjectID===n);s!==-1&&(this.transactions[s]=_t($e({},this.transactions[s]),{description:t})),this.editDescriptionStripeObjectID=null,this.editDescriptionTransactionType=null,this.editDescriptionCurrentValue=null}viewReceipt(){let t=this.selectedTransaction;this.canViewReceipt(t)&&this.receiptDialog.open(t.transactionTypeID,t.stripeObjectID)}exportTransactions(){this.clubAccountService.filters.teamAccountTransactionDisplayStatusID=this.mapDisplayStatusesToFilterIDs(this.selectedDisplayStatuses),this.applyAccountFilters(),this.exportingCsv=!0,this.clubAccountService.getTransactionsForExport().pipe(b(this.unsubscribe$)).subscribe({next:t=>{wt(t),this.exportingCsv=!1},error:()=>{this.siteDataService.showSiteErrorAlert("Unable to export transactions."),this.exportingCsv=!1}})}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete()}};a.\u0275fac=function(n){return new(n||a)(S(R),S(ae))},a.\u0275cmp=A({type:a,selectors:[["app-club-account"]],viewQuery:function(n,s){if(n&1&&H(Tn,5)(An,5)(wn,5)(In,5)(En,5),n&2){let p;B(p=O())&&(s.dateRangeFilter=p.first),B(p=O())&&(s.actionsMenu=p.first),B(p=O())&&(s.receiptDialog=p.first),B(p=O())&&(s.payoutDetailsDialog=p.first),B(p=O())&&(s.teamFeeRefundDetailsDialog=p.first)}},standalone:!1,decls:14,vars:2,consts:[["receiptDialog",""],["payoutDetailsDialog",""],["teamFeeRefundDetailsDialog",""],["dateRangeFilter",""],["txnTypeTpl",""],["accountCellTpl",""],["actionsMenu",""],["header",""],["body",""],["emptymessage",""],[3,"stripeObjectID","transactionType","currentDescription","closeModal","saved",4,"ngIf"],[1,"summary-section","mb-3"],[1,"row","mb-3"],[1,"col-12","col-md-4"],[1,"card","summary-card","bg-grey-lt","club-account-details-card"],[1,"text-header-4","text-grey","m-0"],[1,"fw-600","text-largest","color-success"],[1,"text-medium","text-grey"],[1,"fw-600","text-largest","color-medium"],[1,"fw-600","text-largest"],[1,"recent-activity-section"],[1,"d-flex","align-items-center","mb-3"],[1,"m-0","p-0"],[1,"d-flex","align-items-center","border-bottom","pb-2","mb-3"],["optionLabel","label","optionValue","value",3,"onChange","options","ngModel","allowEmpty"],[3,"adminFilterReset","adminFilterSearch","showAdvanced"],["primary",""],[1,"col","pr-0"],[1,"p-input-icon-left","full-width"],[1,"fa","fa-magnifying-glass","mr-2"],["type","text","id","search","pInputText","","placeholder","Search",1,"full-width","pl-4",3,"ngModelChange","keydown.enter","ngModel"],["for","search",1,"sr-only"],[1,"pr-0"],["label","",3,"rangeChange","defaultPreset"],[1,"col-auto","pr-0"],["type","button",1,"btn",3,"click","disabled"],[1,"fal","fa-table"],["advanced",""],[1,"row"],[1,"col-md-6"],[1,"form-group"],["for","transactionType"],["id","transactionType","optionLabel","label","optionValue","value","placeholder","All Transaction Types","appendTo","body",1,"full-width",3,"ngModelChange","ngModel","options"],["for","initiatedBy"],["id","initiatedBy","optionLabel","label","optionValue","value","placeholder","Anyone","appendTo","body",1,"full-width",3,"ngModelChange","ngModel","options","filter"],["for","direction"],["id","direction","optionLabel","label","optionValue","value","placeholder","All Directions","appendTo","body",1,"full-width",3,"ngModelChange","ngModel","options"],["for","status"],["id","status","optionLabel","label","optionValue","value","placeholder","All Statuses","appendTo","body",1,"full-width",3,"ngModelChange","ngModel","options"],[1,"results-table"],[1,"table-responsive"],[3,"model","popup"],["role","status","aria-hidden","true",1,"spinner-border","spinner-border-sm"],["for","account"],["id","account","optionGroupLabel","label","optionGroupChildren","items","optionLabel","label","placeholder","All Accounts","appendTo","body",1,"full-width",3,"ngModelChange","ngModel","options","group","dataKey","filter"],["for","teamAccount"],["id","teamAccount","optionLabel","name","optionValue","id","placeholder","All Accounts","appendTo","body",1,"full-width",3,"ngModelChange","onChange","options","ngModel","filter"],[1,"nowrap"],[1,"d-flex","align-items-center"],["size","small",3,"firstName","lastName","showCircle"],[1,"ml-2","d-flex","flex-column"],[1,"text-small","text-grey","text-overflow-ellipsis","merchant-category",3,"title"],[1,"text-small","text-grey"],["sortField","vendorCreatedOn","currentPageReportTemplate","Showing {first} to {last} of {totalRecords} transactions",1,"table","table-striped","table-sm",3,"onLazyLoad","columns","value","lazy","paginator","totalRecords","rows","sortOrder","rowsPerPageOptions","showCurrentPageReport","loading"],[3,"pSortableColumn"],[3,"field"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"text-nowrap"],[1,"mr-1",3,"ngClass"],[1,"text-right"],[1,"column-status","text-right"],[3,"status"],["size","small",3,"firstName","lastName","
417id"],[1,"ml-2"],["type","button",1,"btn","btn-sm","btn-tertiary",3,"click"],[1,"fa-solid","fa-ellipsis"],[1,"sr-only"],[1,"text-center"],["height","8rem"],[3,"closeModal","saved","stripeObjectID","transactionType","currentDescription"]],template:function(n,s){n&1&&(u(0,eo,186,57)(1,io,6,1),_(2,"app-team-accounts-transactions-disclosure"),e(3,` 418`),_(4,"app-club-receipt-dialog",null,0),e(6,` 419`),_(7,"app-payout-details-dialog",null,1),e(9,` 420`),_(10,"app-team-fee-refund-details-dialog",null,2),e(12,` 421`),y(13,no,2,3,"app-club-edit-description-modal",10)),n&2&&(h(s.loading?1:0),c(13),m("ngIf",s.editDescriptionStripeObjectID))},dependencies:[Ge,yt,Ye,be,ve,ye,Ee,ue,Nt,Oe,jt,Wt,Me,Pe,Be,Fe,pe,Ft,Xt,Zt,yi,Ti,Qe,Dt],styles:[".clickable-card[_ngcontent-%COMP%]{cursor:pointer;transition:transform .2s ease,box-shadow .2s ease}.clickable-card[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 4px 12px #00000026}.color-medium[_ngcontent-%COMP%]{color:var(--dashboard-color-medium)}.color-success[_ngcontent-%COMP%]{color:var(--dashboard-color-success)}.color-critical[_ngcontent-%COMP%]{color:var(--dashboard-color-critical)}"]});let i=a;return i})();var Ii=(()=>{let a=class a{constructor(t){this.siteDataService=t}ngOnInit(){this.siteDataService.hideSiteLoader()}};a.\u0275fac=function(n){return new(n||a)(S(R))}
421,a.\u0275cmp=A({type:a,selectors:[["app-reports"]],standalone:!1,decls:2,vars:0,template:function(n,s){n&1&&(r(0,"p"),e(1,"reports works!"),l())},encapsulation:2});let i=a;return i})();var rt=(()=>{let a=class a{constructor(t){this.webAPI=t,this.baseUrl="admin/club-budget-categories"}getClubBudgetCategories(t){let n=new Z;return n=n.append("clubBudgetCategoryTypeID",t.toString()),this.webAPI.getData(`${this.baseUrl}`,n)}getClubBudgetCategoryMetadata(){return this.webAPI.getData(`${this.baseUrl}/metadata`)}getClubBudgetCategory(t){return this.webAPI.getData(`${this.baseUrl}/${t}`)}isClubBudgetCategoryNameValid(t,n,s){let p=new Z;return p=p.append("name",t),p=p.append("clubBudgetCategoryTypeID",n.toString()),s&&(p=p.append("clubBudgetCategoryID",s.toString())),this.webAPI.getData(`${this.baseUrl}/is-name-valid`,p)}saveClubBudgetCategory(t){return t.clubBudgetCategoryID?this.webAPI.putData(`${this.baseUrl}/${t.clubBudgetCategoryID}`,t):this.webAPI.postData(this.baseUrl,t)}updateClubBudgetCategoryDisabled(t,n){return this.webAPI.putData(`${this.baseUrl}/${t}/disabled`,{isDisabled:n})}deleteClubBudgetCategory(t){return this.webAPI.deleteData(`${this.baseUrl}/${t}`)}toggleClubBudgetCategoryStatus(t){return this.webAPI.putData(`${this.baseUrl}/${t}/toggle-status`,{})}};a.\u0275fac=function(n){return new(n||a)(te(oe))},a.\u0275prov=ee({token:a,factory:a.\u0275fac});let i=a;return i})();var ao=["optionsMenu"],ro=()=>({width:"auto"}),lo=()=>[1,2],so=()=>[1,2,3];function co(i,a){if(i&1&&(e(0,` 422 `),r(1,"h3"),e(2),l(),e(3,` 423 `)),i&2){let o=d().$implicit;c(2),D(` 424 `,o==null?null:o.description,` 425 `)}}function mo(i,a){if(i&1&&(e(0,` 426 `),r(1,"div",3),e(2),l(),e(3,` 427 `)),i&2){let o=d().$implicit;c(2),D(` 428 `,o.descriptionText,` 429 `)}}function po(i,a){if(i&1&&(e(0,` 430 `),r(1,"app-pill",11),e(2,` 431 `),l(),e(3,` 432 `)),i&2){let o=d().$implicit;c(),m("text",o.isDisabled?"Disabled":"Enabled")("status",o.isDisabled?"warning":"success")}}function uo(i,a){if(i&1){let o=v();e(0,` 433 `),r(1,"button",12),x("click",function(){g(o);let n=d().$implicit,s=d(4);return C(s.toggleOptionsMenu(n))}),e(2,` 434 `),_(3,"i",13),e(4,` 435 `),r(5,"div",14),e(6,"Options"),l(),e(7,` 436 `),l(),e(8,` 437 `)}}function ho(i,a){if(i&1&&(e(0,` 438 `),r(1,"li",8),e(2,` 439 `),r(3,"div",9),e(4,` 440 `),r(5,"div"),e(6),l(),e(7,` 441 `),r(8,"div",10),e(9,` 442 `),u(10,po,4,2),u(11,uo,9,0),l(),e(12,` 443 `),l(),e(13,` 444 `),l(),e(14,` 445 `)),i&2){let o=a.$implicit,t=d(4);c(6),D(` 446 `,o.name,` 447 `),c(4),h(o.isDisabled?10:-1),c(),h(o.clubID!==t.sprocketClubID?11:-1)}}function go(i,a){if(i&1&&(e(0,` 448 `),r(1,"ul",7),e(2,` 449 `),U(3,ho,15,3,null,null,j),l(),e(5,` 450 `)),i&2){let o=d().$implicit;c(3),k(o.clubBudgetCategories)}}function Co(i,a){if(i&1&&(e(0,` 451 `),r(1,"app-inline-alert",15),e(2,` 452 `),r(3,"span",16),e(4),l(),e(5,` 453 `),l(),e(6,` 454 `)),i&2){let o=d().$implicit;c(),m("isInline",!0),c(3),D(` 455 No `,o.description.toLowerCase(),` categories have been 456 created yet. 457 `)}}function fo(i,a){if(i&1){let o=v();e(0,` 458 `),r(1,"div",17),e(2,` 459 `),r(3,"button",18),x("click",function(){g(o);let n=d().$implicit,s=d(2);return C(s.addCategory(n.budgetCategoryClassificationID))}),e(4),l(),e(5,` 460 `),l(),e(6,` 461 `)}if(i&2){let o=d().$implicit;c(4),D(` 462 Add `,o.description,` Category 463 `)}}function _o(i,a){if(i&1&&(e(0,` 464 `),r(1,"app-inline-alert",19),e(2,` 465 `),r(3,"span",16),e(4),l(),e(5,` 466 `),l(),e(6,` 467 `)),i&2){let o=d().$implicit;c(),m("isInline",!0),c(3),D(` 468 Maximum of 25 `,o.description.toLowerCase(),` categories reached. 469 `)}}function xo(i,a){if(i&1&&(e(0,` 470 `),r(1,"div",6),e(2,` 471 `),u(3,co,4,1),u(4,mo,4,1),u(5,go,6,0)(6,Co,7,2),u(7,fo,7,1),y(8,_o,7,2,"ng-template",null,1,W),e(10,`
472 `),l(),e(11,` 473 `)),i&2){let o=a.$implicit;c(3),h(o!=null&&o.description?3:-1),c(),h(o!=null&&o.descriptionText?4:-1),c(),h(o.clubBudgetCategories!=null&&o.clubBudgetCategories.length?5:6),c(2),h(((o==null||o.clubBudgetCategories==null?null:o.clubBudgetCategories.length)||0)<25?7:-1)}}function So(i,a){if(i&1&&(e(0,` 474 `),U(1,xo,12,4,null,null,j)),i&2){let o=d();c(),k(o.dataSource)}}function bo(i,a){i&1&&(e(0,` 475 `),r(1,"div",21),e(2,` 476 `),_(3,"app-skeleton-template",22),e(4,` 477 `),l(),e(5,` 478 `))}function vo(i,a){i&1&&(e(0,` 479 `),r(1,"div",6),e(2,` 480 `),r(3,"div",3),e(4,` 481 `),_(5,"app-skeleton-template",20),e(6,` 482 `),l(),e(7,` 483 `),U(8,bo,6,0,null,null,j),l(),e(10,` 484 `)),i&2&&(c(8),k(T(0,so)))}function yo(i,a){i&1&&(e(0,` 485 `),U(1,vo,11,1,null,null,j)),i&2&&(c(),k(T(0,lo)))}function Do(i,a){if(i&1){let o=v();e(0,` 486 `),r(1,"app-dynamic-form",23),x("onCancel",function(){g(o);let n=d();return C(n.showEditCategoryDialog=!1)})("onSubmit",function(n){g(o);let s=d();return C(s.saveCategory(n))}),e(2,` 487 `),_(3,"app-dynamic-form-field",24),e(4,` 488 `),_(5,"app-dynamic-form-field",25),e(6,` 489 `),l(),e(7,` 490 `)}if(i&2){let o=d();c(),m("fields",o.fields)("buttonsPosition","left")("entity",o.category)("horizontalForm",!1)("contentFieldsMode",!0)("showSaveAndAddButton",!1)}}function To(i,a){i&1&&(e(0,` 491 `),_(1,"app-skeleton-template",26),e(2,` 492 `),_(3,"app-skeleton-template",26),e(4,` 493 `),_(5,"app-skeleton-template",27),e(6,` 494 `))}function Ao(i,a){if(i&1){let o=v();e(0,` 495 `),r(1,"app-yes-no-modal",28),x("onYesSelect",function(){g(o);let n=d();return C(n.deleteCategory())})("onNoSelect",function(){g(o);let n=d();return C(n.showDeleteDialog=!1)}),e(2,` 496 `),r(3,"div",29),e(4,` 497 `),r(5,"app-inline-alert",19),e(6,` 498 Are you sure you want to delete this budget category? 499 `),l(),e(7,` 500 `),l(),e(8,` 501 `),l(),e(9,` 502`)}if(i&2){let o=d();c(),m("showModalText",!1)("loading",o.loading),c(4),m("isInline",!0)}}function wo(i,a){if(i&1){let o=v();e(0,` 503 `),r(1,"app-yes-no-modal",30),x("onYesSelect",function(){g(o);let n=d();return C(n.toggleEnabled())})("onNoSelect",function(){g(o);let n=d();return C(n.showDisableDialog=!1)}),e(2,` 504 `),r(3,"div",29),e(4,` 505 `),r(5,"app-inline-alert",19),e(6,` 506 Are you sure you want to disable this budget category? Please note that disabling a category will prevent it 507 from being used in future transactions, but it will not affect existing transactions. 508 `),l(),e(7,` 509 `),l(),e(8,` 510 `),l(),e(9,` 511`)}if(i&2){let o=d();c(),m("showModalText",!1)("loading",o.loading),c(4),m("isInline",!0)}}var Ei=(()=>{let a=class a{constructor(t,n,s,p){this.siteDataService=t,this.authorizeService=n,this.budgetCategoriesService=s,this.formService=p,this.BudgetCategoryClassification=ke,this.loading=!0,this.dataSource=[],this.sprocketClubID=we,this.options=[],this.showEditCategoryDialog=!1,this.loadingCategory=!0,this.showDeleteDialog=!1,this.deleting=!1,this.showDisableDialog=!1,this.disableSaving=!1,this.saving=!1,this.unsubscribe$=new M}ngOnInit(){this.authorizeService.getUser().pipe(fe(1)).subscribe(t=>{this.clubID=+t.clubID,this.loadCategories()})}loadCategories(){this.loading=!0,this.clubBudgetCategoryTypeID?this.budgetCategoriesService.getClubBudgetCategories(this.clubBudgetCategoryTypeID).pipe(b(this.unsubscribe$)).subscribe({next:t=>{this.dataSource=t,this.loading=!1},error:()=>{this.siteDataService.showSiteErrorAlert("There was a problem loading budget categories"),this.loading=!1}}):console.error("clubBudgetCategoryTypeID is not defined")}addCategory(t){this.loadingCategory=!0,this.showEditCategoryDialog=!0,this.selectedCategoryClassificationType=this.dataSource.find(n=>n.budgetCategoryClassificationID===t)?.description,K({metadata:this.fields?le({fields:this.fields}):this.budgetCategoriesService.getClubBudgetCategoryMetadata()}).pipe(b(this.unsubscribe$)).subscribe({next:n=>{this.category=new ei,this.category.budgetCategoryClassificationID=t,this.fields=n.metadata.fields,this.loadingCategory=!1},error:()=>{this.siteDataService.showSiteErrorAlertDefaultGET(),this.loadingCategory=!1,this.showEditCategoryDialog=!1}})}editCategory(t){this.loadingCategory=!0,this.showEditCategoryDialog=!0,this.selectedCategoryClassificationType=this.dataSource.find(n=>n.budgetCategoryClassificationID===t.budgetCategoryClassificationID)?.description,K({metadata:this.fields?le({fields:this.fields}):this.budgetCategoriesService.getClubBudgetCategoryMetadata()}).pipe(b(this.unsubscribe$)).subscribe({next:n=>{this.category=$e({},t),this.loadingCategory=!1,this.fields=n.metadata.fields,this.loadingCategory=!1},error:()=>{this.siteDataService.showSiteErrorAlertDefaultGET(),this.loadingCategory=!1,this.showEditCategoryDialog=!1}})}saveCategory(t){this.saving=!0,t.clubBudgetCategoryTypeID=this.clubBudgetCategoryTypeID,t.budgetCategoryClassificationID=this.category.budgetCategoryClassificationID,t.clubBudgetCategoryID=this.category.clubBudgetCategoryID,this.budgetCategoriesService.isClubBudgetCategoryNameValid(t.name,t.clubBudgetCategoryTypeID,this.category.clubBudgetCategoryID).pipe(je(n=>n?this.budgetCategoriesService.saveClubBudgetCategory(t).pipe(We(s=>{s?s.canDelete=!0:(s=t,s.canDelete=this.category.canDelete);let p=this.dataSource.find(f=>f.budgetCategoryClassificationID===s.budgetCategoryClassificationID);if(p){let f=p.clubBudgetCategories.findIndex(P=>P.clubBudgetCategoryID===s.clubBudgetCategoryID);f>-1?p.clubBudgetCategories[f]=s:p.clubBudgetCategories.push(s),p.clubBudgetCategories.sort((P,Ui)=>P.name.localeCompare(Ui.name,void 0,{sensitivity:"base"}))}
511this.siteDataService.showSiteSuccessAlert("Budget category saved successfully"),this.showEditCategoryDialog=!1})):(this.saving=!1,this.formService.showFormErrorMessage("A budget category with this name already exists"),le(null)))).subscribe({next:()=>{this.saving=!1,this.formService.hideFormLoader()},error:()=>{this.saving=!1,this.siteDataService.showSiteErrorAlert("There was a problem saving this budget category"),this.formService.hideFormLoader()}})}toggleOptionsMenu(t){this.selectedCategory=t;let n=[];n.push({label:"Edit",icon:"fa fa-pencil",command:()=>{this.editCategory(t)}}),n.push({label:t.isDisabled?"Enable":"Disable",icon:`fa fa-toggle-${t.isDisabled?"on":"off"}`,command:()=>{t.isDisabled?this.toggleEnabled():this.showDisableDialog=!0}}),this.selectedCategory.canDelete&&n.push({label:"Delete",icon:"fa fa-trash-alt",command:()=>{this.showDeleteDialog=!0}}),this.options=[{label:"Options",items:n}],this.optionsMenu.toggle(event)}toggleEnabled(){this.disableSaving=!0,this.budgetCategoriesService.updateClubBudgetCategoryDisabled(this.selectedCategory.clubBudgetCategoryID,!this.selectedCategory.isDisabled).pipe(b(this.unsubscribe$)).subscribe({next:()=>{this.selectedCategory.isDisabled=!this.selectedCategory.isDisabled,this.disableSaving=!1,this.showDisableDialog=!1,this.siteDataService.showSiteSuccessAlert("Budget category status updated successfully"),this.formService.hideFormLoader()},error:()=>{this.siteDataService.showSiteErrorAlert("There was a problem updating this budget category status"),this.disableSaving=!1,this.showDisableDialog=!1,this.formService.hideFormLoader()}})}deleteCategory(){this.deleting=!0,this.budgetCategoriesService.deleteClubBudgetCategory(this.selectedCategory.clubBudgetCategoryID).pipe(b(this.unsubscribe$)).subscribe({next:()=>{let t=this.dataSource.find(n=>n.budgetCategoryClassificationID===this.selectedCategory.budgetCategoryClassificationID);if(t){let n=t.clubBudgetCategories.findIndex(s=>s.clubBudgetCategoryID===this.selectedCategory.clubBudgetCategoryID);n>-1&&t.clubBudgetCategories.splice(n,1)}this.showDeleteDialog=!1,this.deleting=!1,this.siteDataService.showSiteSuccessAlert("Budget category deleted successfully"),this.formService.hideFormLoader()},error:()=>{this.siteDataService.showSiteErrorAlert("There was a problem deleting this budget category"),this.deleting=!1,this.formService.hideFormLoader()}})}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete()}};a.\u0275fac=function(n){return new(n||a)(S(R),S(ne),S(rt),S(Et))},a.\u0275cmp=A({type:a,selectors:[["app-budget-categories"]],viewQuery:function(n,s){if(n&1&&H(ao,5),n&2){let p;B(p=O())&&(s.optionsMenu=p.first)}},inputs:{clubBudgetCategoryTypeID:"clubBudgetCategoryTypeID"},standalone:!1,decls:22,vars:15,consts:[["optionsMenu",""],["maxCategoriesReached",""],[1,"card","settings-card"],[1,"text-medium","mb-3"],["appendTo","body",3,"model","popup"],[3,"visibleChange","visible","header","closable","modal","draggable","styleClass"],[1,"mb-3","border-top"],[1,"no-bullets"],[1,"bg-grey-lt","py-2","px-3","mb-2"],[1,"d-flex","align-items-center"],[1,"d-flex","align-items-center","ml-auto"],[3,"text","status"],["type","button",1,"btn","btn-sm","btn-tertiary-inverted","ml-3",3,"click"],[1,"fa-solid","fa-ellipsis"],[1,"sr-only"],["alertType","note",3,"isInline"],[1,"text-small"],[1,"mt-3"],["type","button",1,"btn","btn-naked","btn-icon-plus",3,"click"],["alertType","warning",3,"isInline"],["height","5rem"],[1,"mb-1"],["height","2.5rem"],["submitButtonText","Save","formID","category-form",3,"onCancel","onSubmit","fields","buttonsPosition","entity","horizontalForm","contentFieldsMode","showSaveAndAddButton"],["fieldName","name","formID","category-form"],["fieldName","clubAccountingClassID","formID","category-form"],["skeletonType","form-single-text-input"],["skeletonType","form-buttons-only"],["headerText","Delete Category","dialogClass","standardWidthDialog","yesButtonText","Yes, Delete","yesButtonLoadingText","Deleting...","noButtonText","No, Cancel",3,"onYesSelect","onNoSelect","showModalText","loading"],[1,"text-medium","fw-600"],["headerText","Disable Category","dialogClass","standardWidthDialog","yesButtonText","Yes, Disable","yesButtonLoadingText","Disabling...","noButtonText","No, Cancel",3,"onYesSelect","onNoSelect","showModalText","loading"]],template:function(n,s){if(n&1){let p=v();r(0,"div",2),e(1,`
512 `),r(2,"h2"),e(3,"Budget Categories"),l(),e(4,` 513 `),r(5,"div",3),e(6,` 514 Budget categories help you organize and track financial activity. Revenue categories track income sources while 515 expense categories organize spending. 516 `),l(),e(7,` 517 `),u(8,So,3,0)(9,yo,3,1),l(),e(10,` 518 519`),r(11,"p-menu",4,0),e(13,` 520`),l(),e(14,` 521 522`),r(15,"p-dialog",5),E("visibleChange",function(P){return g(p),I(s.showEditCategoryDialog,P)||(s.showEditCategoryDialog=P),C(P)}),e(16,` 523 `),u(17,Do,8,6)(18,To,7,0),l(),e(19,` 524 525`),u(20,Ao,10,3),u(21,wo,10,3)}n&2&&(c(8),h(s.loading?9:8),c(3),q(T(14,ro)),m("model",s.options)("popup",!0),c(4),w("visible",s.showEditCategoryDialog),m("header",s.category!=null&&s.category.clubBudgetCategoryID?"Edit "+s.selectedCategoryClassificationType+" Category":"Add "+s.selectedCategoryClassificationType+" Category")("closable",!1)("modal",!0)("draggable",!1)("styleClass","shortWidthDialog"),c(2),h(!s.loadingCategory&&s.fields&&s.category&&s.showEditCategoryDialog?17:18),c(3),h(s.showDeleteDialog?20:-1),c(),h(s.showDisableDialog?21:-1))},dependencies:[Je,Ke,Ee,ue,Re,Ne,Ie,pe],encapsulation:2});let i=a;return i})();var lt=(()=>{let a=class a{constructor(t){this.webAPI=t,this.baseUrl="admin/club-card-spending-interval-limit-templates"}getClubCardSpendingIntervalLimitTemplate(){return this.webAPI.getData(`${this.baseUrl}`)}getClubCardSpendingIntervalLimitMetadata(){return this.webAPI.getData(`${this.baseUrl}/metadata`)}getClubCardSpendingIntervalLimitFormData(){return K({metadataResponse:this.getClubCardSpendingIntervalLimitMetadata(),template:this.getClubCardSpendingIntervalLimitTemplate()}).pipe(je(t=>{if(t.metadataResponse?.length){let n=[];return t.metadataResponse.forEach(s=>{let p=new ai;p.cardSpendingIntervalID=s.cardSpendingIntervalID,p.metadata=s.metadata,p.entity=t.template?.cardSpendingIntervalLimits?.find(f=>f.cardSpendingIntervalID===s.cardSpendingIntervalID),n.push(p)}),le(n)}return le(null)}))}createClubCardSpendingIntervalLimits(t){return this.webAPI.postData(`${this.baseUrl}`,{cardSpendingIntervalLimits:t})}updateClubCardSpendingIntervalLimits(t,n){return this.webAPI.putData(`${this.baseUrl}/${t}`,{cardSpendingIntervalLimits:n})}};a.\u0275fac=function(n){return new(n||a)(te(oe))},a.\u0275prov=ee({token:a,factory:a.\u0275fac});let i=a;return i})();var Ro=["form"],Ri=(()=>{let a=class a{constructor(t,n,s){this.spendingLimitService=t,this.siteDataService=n,this.authService=s,this.sprocketClubID=we,this.loading=!0,this.formData=[],this.unsubscribe$=new M}ngOnInit(){this.loadSpendingControls(),this.authService.getUser().pipe(b(this.unsubscribe$)).subscribe(t=>{this.clubID=+t.clubID})}loadSpendingControls(){this.loading=!0,K({metadataResponse:this.spendingLimitService.getClubCardSpendingIntervalLimitMetadata(),template:this.spendingLimitService.getClubCardSpendingIntervalLimitTemplate()}).pipe().subscribe({next:t=>{this.template=t.template,this.metadata=t.metadataResponse,this.loading=!1,console.log("loading=false")},error:t=>{this.siteDataService.showSiteErrorAlertDefaultGET(),this.loading=!1}})}save(t){let n=this.spendingLimitService.createClubCardSpendingIntervalLimits(t);this.template?.cardSpendingIntervalLimitTemplateID&&this.clubID===this.template?.clubID&&(n=this.spendingLimitService.updateClubCardSpendingIntervalLimits(this.template.cardSpendingIntervalLimitTemplateID,t)),n.pipe(b(this.unsubscribe$)).subscribe({next:s=>{this.siteDataService.showSiteSuccessAlert("Spending limits saved. Changes will be synced to all active cardholders within the hour."),s&&(this.template=s),this.form.saveSuccess()},error:s=>{this.siteDataService.showSiteErrorAlert("There was a problem saving the spending limits."),this.form.saving=!1}})}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete()}};a.\u0275fac=function(n){return new(n||a)(S(lt),S(R),S(ne))},a.\u0275cmp=A({type:a,selectors:[["app-spending-limits"]],viewQuery:function(n,s){if(n&1&&H(Ro,5),n&2){let p;B(p=O())&&(s.form=p.first)}},standalone:!1,decls:5,vars:5,consts:[["form",""],[1,"card","settings-card"],[3,"save","metadata","template","loading","programTeamAccountID","clubStripeCardholderID"]],template:function(n,s){n&1&&(r(0,"div",1),e(1,` 526 `),r(2,"app-spending-limits-form",2,0),x("save",function(f){return s.save(f)}),l(),e(4,` 527`),l()),n&2&&(c(2),m("metadata",s.metadata)("template",s.template)("loading",s.loading)("programTeamAccountID",null)("clubStripeCardholderID",null))},dependencies:[ri],encapsulation:2});let i=a;return i})();var st=(()=>{let a=class a{constructor(t){this.webAPI=t,this.baseUrl="admin/club-allowed-merchant-category-templates"}getMetadata(){return this.webAPI.getData(`${this.baseUrl}/metadata`)}getMerchantCategories(){return this.webAPI.getData(`${this.baseUrl}/merchant-categories`)}getClubAllowedMerchantCategoryTemplate(){return this.webAPI.getData(`${this.baseUrl}`)}createClubAllowedMerchantCategoryTemplate(t){return this.webAPI.postData(`${this.baseUrl}`,{allowedMerchantCategoryIDs:t})}updateClubAllowedMerchantCategoryTemplate(t,n){return this.webAPI.putData(`${this.baseUrl}/${t}`,{allowedMerchantCategoryIDs:n})}};a.\u0275fac=function(n){return new(n||a)(te(oe))},a.\u0275prov=ee({token:a,factory:a.\u0275fac});let i=a;return i})();var Po=["form"],Fi=(()=>{let a=class a{constructor(t,n,s){this.allowedMerchantCategoriesService=t,this.siteDataService=n,this.authService=s,this.allCategories=[],this.sprocketClubID=we,this.loading=!0,this.unsubscribe$=new M}ngOnInit(){this.loadAllowedCategories(),this.authService.getUser().pipe(b(this.unsubscribe$)).subscribe(t=>{this.clubID=+t.clubID})}loadAllowedCategories(){this.loading=!0,K({metadataResponse:this.allowedMerchantCategoriesService.getMetadata(),template:this.allowedMerchantCategoriesService.getClubAllowedMerchantCategoryTemplate()}).pipe(b(this.unsubscribe$)).subscribe({next:t=>{this.allCategories=this.extractCategoriesFromMetadata(t.metadataResponse),this.template=t.template,this.loading=!1},error:()=>{this.siteDataService.showSiteErrorAlertDefaultGET(),this.loading=!1}})}extractCategoriesFromMetadata(t){let n=t?.metadata?.fields?.find(s=>
527s.controlName==="allowedMerchantCategoryIDs");return n?.options?.length?n.options.map(s=>{let p=new oi;return p.merchantCategoryID=s.value,p.name=s.label,p}):[]}save(t){let n;this.template?.allowedMerchantCategoryTemplateID&&this.clubID===this.template?.clubID?n=this.allowedMerchantCategoriesService.updateClubAllowedMerchantCategoryTemplate(this.template.allowedMerchantCategoryTemplateID,t):n=this.allowedMerchantCategoriesService.createClubAllowedMerchantCategoryTemplate(t),n.pipe(b(this.unsubscribe$)).subscribe({next:s=>{this.siteDataService.showSiteSuccessAlert("Allowed merchant categories saved. Changes will be synced to all active cardholders within the hour."),s&&(this.template=s),this.form.saveSuccess(),this.loadAllowedCategories()},error:()=>{this.siteDataService.showSiteErrorAlert("There was a problem saving the allowed merchant categories."),this.form.saving=!1}})}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete()}};a.\u0275fac=function(n){return new(n||a)(S(st),S(R),S(ne))},a.\u0275cmp=A({type:a,selectors:[["app-allowed-merchant-categories"]],viewQuery:function(n,s){if(n&1&&H(Po,5),n&2){let p;B(p=O())&&(s.form=p.first)}},standalone:!1,decls:6,vars:6,consts:[["form",""],[1,"card","settings-card"],[3,"save","allCategories","template","loading","modalEditMode","programTeamAccountID","clubStripeCardholderID"]],template:function(n,s){n&1&&(r(0,"div",1),e(1,` 528 `),r(2,"app-allowed-merchant-categories-form",2,0),x("save",function(f){return s.save(f)}),l(),e(4,` 529`),l(),e(5,` 530`)),n&2&&(c(2),m("allCategories",s.allCategories)("template",s.template)("loading",s.loading)("modalEditMode",!0)("programTeamAccountID",null)("clubStripeCardholderID",null))},dependencies:[li],styles:['@charset "UTF-8";']});let i=a;return i})();var Mi=(()=>{let a=class a{};a.\u0275fac=function(n){return new(n||a)},a.\u0275cmp=A({type:a,selectors:[["app-spending-controls"]],standalone:!1,decls:3,vars:0,template:function(n,s){n&1&&(_(0,"app-spending-limits"),e(1,` 531`),_(2,"app-allowed-merchant-categories"))},dependencies:[Ri,Fi],encapsulation:2});let i=a;return i})();function No(i,a){if(i&1&&(e(0,` 532 `),r(1,"div",0),e(2,` 533 `),r(3,"div",1),e(4,` 534 `),_(5,"app-budget-categories",2),e(6,` 535 `),l(),e(7,` 536 `),r(8,"div",1),e(9,` 537 `),_(10,"app-spending-controls"),e(11,` 538 `),l(),e(12,` 539 `),l(),e(13,` 540`)),i&2){let o=d();c(5),m("clubBudgetCategoryTypeID",o.ClubBudgetCategoryType.TEAM)}}var Pi=(()=>{let a=class a{constructor(t,n){this.siteDataService=t,this.authService=n,this.Permission=ie,this.ClubBudgetCategoryType=ti}ngOnInit(){this.authService.getUser().pipe(fe(1)).subscribe({next:t=>{this.user=t,this.siteDataService.hideSiteLoader()}})}};a.\u0275fac=function(n){return new(n||a)(S(R),S(ne))},a.\u0275cmp=A({type:a,selectors:[["app-settings"]],standalone:!1,decls:1,vars:1,consts:[[1,"row"],[1,"col-md-6"],[3,"clubBudgetCategoryTypeID"]],template:function(n,s){n&1&&u(0,No,14,1),n&2&&h(s.user[s.Permission.TeamAccountsBudgetingSpendingControls]?0:-1)},dependencies:[Ei,Mi],encapsulation:2});let i=a;return i})();var Lo=["optionsMenu"],Bi=()=>({width:"auto"}),Vo=()=>[25,50,100],Uo=i=>["/","admin","teams","accounts","team-accounts",i],ko=(i,a)=>({"color-success":i,"color-critical":a}),$o=i=>({account:i}),jo=(i,a)=>[i,"programs",a],Wo=(i,a)=>[i,"programs",a,"fees"],Oi=(i,a)=>[i,"programs",a,"cardholders"],zo=(i,a)=>a.clubUserID;function Go(i,a){if(i&1&&(e(0,` 541 `),_(1,"p-sortIcon",23),e(2,` 542 `)),i&2){let o=d().$implicit;c(),m("field",o.field)}}function Yo(i,a){if(i&1&&(e(0,` 543 `),r(1,"th",22),e(2),u(3,Go,3,1),l(),e(4,` 544 `)),i&2){let o=a.$implicit,t=d(4);c(),m("pSortableColumn",o.field),G("aria-label",t.AriaLabels.ACTIVATE_SORT),c(),D(` 545 `,o.header,` 546 `),c(),h(o.field?3:-1)}}function Qo(i,a){if(i&1&&(e(0,` 547 `),r(1,"tr"),e(2,` 548 `),U(3,Yo,5,4,null,null,j),r(5,"th"),e(6,` 549 `),r(7,"span",21),e(8,"Actions"),l(
549),e(9,` 550 `),l(),e(10,` 551 `),l(),e(11,` 552 `)),i&2){let o=d(3);c(3),k(o.columns)}}function Ho(i,a){if(i&1&&(e(0,` 553 `),u(1,Qo,12,0)),i&2){let o=d(2);c(),h((o.searchResults==null?null:o.searchResults.length)>0?1:-1)}}function qo(i,a){i&1&&(e(0,` 554 `),_(1,"app-skeleton-template",30),e(2,` 555 `))}function Ko(i,a){if(i&1&&(e(0,` 556 `),r(1,"span",31),e(2),X(3,"currency"),l(),e(4,` 557 `)),i&2){d();let o=vt(14);c(),m("ngClass",me(4,ko,o>0,o<0)),c(),D(` 558 `,se(3,2,o),` 559 `)}}function Jo(i,a){i&1&&(e(0,` 560 `),r(1,"span",32),e(2,"\u2014"),l(),e(3,` 561 `))}function Xo(i,a){if(i&1&&(e(0,` 562 `),r(1,"app-pill",33),e(2,` 563 `),l(),e(3,` 564 `)),i&2){let o=d().$implicit,t=d(2);c(),m("text",o.provisioningStatusName)("status",o.provisioningStatusID===t.TeamAccountProvisioningStatus.FAILED?"error":o.provisioningStatusID===t.TeamAccountProvisioningStatus.PARTIAL?"warning":"default")("tooltipText",o.provisioningStatusID===t.TeamAccountProvisioningStatus.PENDING||o.provisioningStatusID===t.TeamAccountProvisioningStatus.IN_PROGRESS?"Account is being provisioned":null)}}function Zo(i,a){if(i&1&&(e(0,` 565 `),r(1,"app-pill",34),e(2,` 566 `),l(),e(3,` 567 `)),i&2){let o=d().$implicit;c(),m("text",o.isActive?"Active":"Inactive")("status",o.isActive?"success":"default")}}function ea(i,a){if(i&1&&(e(0,` 568 `),r(1,"button",35),e(2,` 569 `),_(3,"i",36),e(4,` 570 `),l(),e(5,` 571 `)),i&2){let o=d(),t=o.$implicit,n=o.expanded;c(),m("pRowToggler",t),c(2),m("ngClass",n?"fa-rotate-180":"")}}function ta(i,a){if(i&1){let o=v();e(0,` 572 `),r(1,"tr"),e(2,` 573 `),r(3,"td"),e(4,` 574 `),r(5,"a",24),e(6),l(),e(7,` 575 `),l(),e(8,` 576 `),r(9,"td"),e(10),l(),e(11,` 577 `),r(12,"td",25),e(13,` 578 `),St(14),e(15,` 579 `),u(16,qo,3,0)(17,Ko,5,7)(18,Jo,4,0),l(),e(19,` 580 `),r(20,"td",26),e(21),l(),e(22,` 581 `),r(23,"td",26),e(24),l(),e(25,` 582 `),r(26,"td",26),e(27,` 583 `),u(28,Xo,4,3),u(29,Zo,4,2),l(),e(30,` 584 `),r(31,"td",27),e(32,` 585 `),r(33,"button",28),x("click",function(){let n=g(o).$implicit,s=d(2);return C(s.toggleOptionsMenu(n))}),e(34,` 586 `),_(35,"i",29),e(36,` 587 `),r(37,"div",21),e(38,"Options"),l(),e(39,` 588 `),l(),e(40,` 589 `),u(41,ea,6,2),l(),e(42,` 590 `),l(),e(43,` 591 `)}if(i&2){let o=a.$implicit,t=a.expanded,n=d(2);c(),J("expanded",t),c(4),m("routerLink",Ue(13,Uo,o.teamAccountID)),c(),D(` 592 `,o.teamName,` 593 `),c(4),N(o.nickName),c(4);let s=bt(n.balances[o.clubStripeFinancialAccountID]);c(2),h(n.balancesLoading?16:s!=null?17:18),c(5),N(o.programCount),c(3),N(o.cardholderCount),c(4),h(o.provisioningStatusID&&o.provisioningStatusID!==n.TeamAccountProvisioningStatus.COMPLETED?28:-1),c(),h(!o.provisioningStatusID||o.provisioningStatusID===n.TeamAccountProvisioningStatus.COMPLETED?29:-1),c(4),G("aria-label","Options for "+o.teamName),c(8),h(o.programCount>0?41:-1)}}function ia(i,a){i&1&&Se(0)}function na(i,a){if(i&1&&(e(0,` 594 `),r(1,"tr"),e(2,` 595 `),r(3,"td",37),e(4,` 596 `),y(5,ia,1,0,"ng-container",38),e(6,`
597 `),l(),e(7,` 598 `),l(),e(8,` 599 `)),i&2){let o=a.$implicit,t=d(2),n=de(41);c(3),G("colspan",t.columns.length+1),c(2),m("ngTemplateOutlet",n)("ngTemplateOutletContext",Ue(3,$o,o))}}function oa(i,a){if(i&1){let o=v();e(0,` 600 `),r(1,"app-null-card",39),x("buttonClicked",function(){g(o);let n=d(3);return C(n.createTeamAccount())}),l(),e(2,` 601 `)}i&2&&(c(),m("text","No team accounts have been created.")("showButton",!0))}function aa(i,a){i&1&&e(0,` 602 No team accounts found. 603 `)}function ra(i,a){if(i&1&&(e(0,` 604 `),r(1,"tr"),e(2,` 605 `),r(3,"td",26),e(4,` 606 `),u(5,oa,3,2)(6,aa,1,0),l(),e(7,` 607 `),l(),e(8,` 608 `)),i&2){let o=d(2);c(3),G("colspan",o.columns.length+1),c(2),h(o.totalRecords===0?5:6)}}function la(i,a){if(i&1){let o=v();e(0,` 609 `),r(1,"div",16),e(2,` 610 `),r(3,"p-table",17),x("onLazyLoad",function(n){g(o);let s=d();return C(s.search(n))})("onRowExpand",function(n){g(o);let s=d();return C(s.expandAccountRow(n))}),e(4,` 611 `),y(5,Ho,2,1,"ng-template",18),e(6,` 612 `),y(7,ta,44,15,"ng-template",19),e(8,` 613 `),y(9,na,9,5,"ng-template",null,2,W),e(11,` 614 `),y(12,ra,9,2,"ng-template",20),e(13,` 615 `),l(),e(14,` 616 `),l(),e(15,` 617 `)}if(i&2){let o=d();c(3),m("columns",o.columns)("value",o.searchResults)("lazy",!0)("paginator",!0)("totalRecords",o.totalRecords)("rows",o.teamAccountsService.filters.rows)("loading",o.loading)("rowsPerPageOptions",T(11,Vo))("showCurrentPageReport",!0)("dataKey","teamAccountID")("expandedRowKeys",o.expandedRows)}}function sa(i,a){if(i&1&&(e(0,` 618 `),r(1,"app-tooltip",52),e(2,` 619 `),l(),e(3,` 620 `)),i&2){let o=d().$implicit;c(),m("tooltipText",o.provisioningStatusName)}}function ca(i,a){if(i&1&&(e(0,` 621 `),r(1,"app-tooltip",53),e(2,` 622 `),l(),e(3,` 623 `)),i&2){let o=d().$implicit;c(),m("tooltipText",o.provisioningStatusName)}}function da(i,a){if(i&1&&(e(0,` 624 `),r(1,"app-tooltip",54),e(2,` 625 `),l(),e(3,` 626 `)),i&2){let o=d().$implicit;c(),m("tooltipText",o.provisioningStatusName)}}function ma(i,a){if(i&1&&(e(0,` 627 `),r(1,"div",55),e(2),X(3,"currency"),l(),e(4,` 628 `)),i&2){let o=d().$implicit;c(),m("ngClass",o.overdueFeesClass),c(),D(` 629 `,se(3,2,o.totalOverdueTeamFees),` 630 `)}}function pa(i,a){i&1&&(e(0,` 631 `),r(1,"div",56),e(2),X(3,"currency"),l(),e(4,` 632 `)),i&2&&(c(2),D(` 633 `,se(3,1,0),` 634 `))}function ua(i,a){i&1&&e(0,` 635 Treasurers 636 `)}function ha(i,a){i&1&&e(0,` 637 Treasurer 638 `)}function ga(i,a){if(i&1&&(e(0,` 639 `),r(1,"a",57),e(2),l(),e(3,` 640 `)),i&2){let o=a.$implicit,t=d().$implicit,n=d(4).account;c(),m("routerLink",me(3,Oi,n.teamAccountID,t.programTeamAccountID)),c(),ze(` 641 `,o.firstName," ",o.lastName,` 642 `)}}function Ca(i,a){if(i&1&&(e(0,` 643 `),r(1,"a",24),e(2,` 644 No Treasurer Assigned
645 `),l(),e(3,` 646 `)),i&2){let o=d().$implicit,t=d(4).account;c(),m("routerLink",me(1,Oi,t.teamAccountID,o.programTeamAccountID))}}function fa(i,a){if(i&1&&(e(0,` 647 `),r(1,"div",41),e(2,` 648 `),r(3,"div",42),e(4,` 649 `),r(5,"div",43),e(6,` 650 `),r(7,"a",24),e(8),l(),e(9,` 651 `),u(10,sa,4,1),u(11,ca,4,1),u(12,da,4,1),l(),e(13,` 652 `),r(14,"div",44),e(15,` 653 `),r(16,"div",45),e(17,"Overdue Fees"),l(),e(18,` 654 `),r(19,"a",24),e(20,` 655 `),u(21,ma,5,4),u(22,pa,5,3),l(),e(23,` 656 `),l(),e(24,` 657 `),r(25,"div",46),e(26,` 658 `),r(27,"div"),e(28,` 659 `),r(29,"div"),e(30,` 660 `),r(31,"div",45),e(32,"Revenue"),l(),e(33,` 661 `),r(34,"app-budget-status-bar",47),e(35,` 662 `),l(),e(36,` 663 `),l(),e(37,` 664 `),r(38,"div"),e(39,` 665 `),r(40,"div",45),e(41,"Expenses"),l(),e(42,` 666 `),r(43,"app-budget-status-bar",47),e(44,` 667 `),l(),e(45,` 668 `),l(),e(46,` 669 `),l(),e(47,` 670 `),l(),e(48,` 671 `),r(49,"div",48),e(50,` 672 `),r(51,"div",49),e(52,` 673 `),r(53,"div",50),e(54,` 674 `),r(55,"div",51),e(56,` 675 `),u(57,ua,1,0)(58,ha,1,0),l(),e(59,` 676 `),r(60,"div"),e(61,` 677 `),U(62,ga,4,6,null,null,zo,!1,Ca,4,4),l(),e(65,` 678 `),l(),e(66,` 679 `),l(),e(67,` 680 `),l(),e(68,` 681 `),l(),e(69,` 682 `),l(),e(70,` 683 `)),i&2){let o=a.$implicit,t=a.$index,n=a.$count,s=d(4).account,p=d();c(),J("mb-0",t===n-1),c(6),m("routerLink",me(24,jo,s.teamAccountID,o.programTeamAccountID)),c(),D(` 684 `,o.programName,` 685 `),c(2),h(o.provisioningStatusID===p.TeamAccountProvisioningStatus.FAILED?10:-1),c(),h(o.provisioningStatusID===p.TeamAccountProvisioningStatus.PARTIAL?11:-1),c(),h(o.provisioningStatusID===p.TeamAccountProvisioningStatus.PENDING||o.provisioningStatusID===p.TeamAccountProvisioningStatus.IN_PROGRESS?12:-1),c(7),m("routerLink",me(27,Wo,s.teamAccountID,o.programTeamAccountID)),c(2),h(o.totalOverdueTeamFees>0?21:-1),c(),h(!o.totalOverdueTeamFees||o.totalOverdueTeamFees===0?22:-1),c(12),m("percentageUsed",o.revenuePercentageUsed)("budgetCategoryClassificationID",p.BudgetCategoryClassification.REVENUE)("budgeted",o.totalRevenueBudget)("remaining",o.revenueRemaining),c(9),m("percentageUsed",o.expensesPercentageUsed)("budgetCategoryClassificationID",p.BudgetCategoryClassification.EXPENSE)("budgeted",o.totalBudget)("remaining",o.expensesRemaining),c(8),J("bg-grey-lt",o.treasurers==null?null:o.treasurers.length)("bg-warning",!(o.treasurers!=null&&o.treasurers.length)),c(6),h((o.treasurers==null?null:o.treasurers.length)>1?57:58),c(5),k(o.treasurers)}}function _a(i,a){if(i&1&&(e(0,` 686 `),U(1,fa,71,30,null,null,j)),i&2){let o=d(3).account,t=d();c(),k(t.accountDetails[o.teamAccountID].programs)}}function xa(i,a){i&1&&(e(0,` 687 `),r(1,"div",58),e(2,` 688 No programs found for this account
689 `),l(),e(3,` 690 `))}function Sa(i,a){if(i&1&&(e(0,` 691 `),u(1,_a,3,0)(2,xa,4,0)),i&2){let o=d(2).account,t=d();c(),h((t.accountDetails[o.teamAccountID].programs==null?null:t.accountDetails[o.teamAccountID].programs.length)>0?1:2)}}function ba(i,a){i&1&&(e(0,` 692 `),_(1,"app-skeleton-template",59),e(2,` 693 `)),i&2&&(c(),m("invertBg",!0))}function va(i,a){if(i&1&&(e(0,` 694 `),r(1,"div",40),e(2,` 695 `),u(3,Sa,3,1)(4,ba,3,1),l(),e(5,` 696 `)),i&2){let o=d().account,t=d();c(3),h(t.accountDetails[o.teamAccountID].loading?4:3)}}function ya(i,a){if(i&1&&(e(0,` 697 `),u(1,va,6,1)),i&2){let o=a.account,t=d();c(),h(t.accountDetails[o.teamAccountID]?1:-1)}}function Da(i,a){if(i&1){let o=v();e(0,` 698 `),r(1,"app-yes-no-modal",60),x("onYesSelect",function(){g(o);let n=d();return C(n.confirmDelete())})("onNoSelect",function(){g(o);let n=d();return C(n.showDeleteDialog=!1)}),e(2,` 699 `),r(3,"div",61),e(4,` 700 `),r(5,"app-inline-alert",62),e(6),l(),e(7,` 701 `),l(),e(8,` 702 `),l(),e(9,` 703`)}if(i&2){let o=d();c(),m("showModalText",!1)("loading",o.deletingAccountId!==null),c(4),m("isInline",!0),c(),D(` 704 Are you sure you want to delete the financial account for `,(o.selectedAccount==null?null:o.selectedAccount.teamName)||(o.selectedAccount==null?null:o.selectedAccount.nickName),`? 705 `)}}var Ni=(()=>{let a=class a{constructor(t,n,s,p,f){this.siteDataService=t,this.teamAccountsService=n,this.router=s,this.route=p,this.budgetSharedService=f,this.totalRecords=0,this.loading=!0,this.showTable=!1,this.AriaLabels=Ae,this.TeamAccountProvisioningStatus=V,this.BudgetCategoryClassification=ke,this.deletingAccountId=null,this.options=[],this.showDeleteDialog=!1,this.accountDetails={},this.programOptions=[],this.programsLoading=!1,this.programsLoaded=!1,this.columns=[{field:"teamName",header:"Team Name"},{field:"nickName",header:"Account Nickname"},{header:"Balance"},{header:"Programs"},{header:"Cardholder Count"},{header:"Status"}],this.balancesLoading=!1,this.balances={},this.expandedRows={},this.unsubscribe$=new M}ngOnInit(){this.loadBalances(),this.teamAccountsService.filters&&this.teamAccountsService.filters.page?(this.showTable=!0,this.siteDataService.hideSiteLoader()):(this.teamAccountsService.filters=new ut,this.run(),this.siteDataService.hideSiteLoader())}run(){this.teamAccountsService.filters.page=1,this.totalRecords=0,this.showTable?this.search():this.showTable=!0}search(t=null){let n=this.teamAccountsService.filters;t&&(t.sortField&&(n.orderBy=t.sortField+" "+(t.sortOrder===1?"ASC":"DESC")),n.rows=t.rows,n.page=t.first/t.rows+1),n.getTotalCount=this.totalRecords===0,this.loading=!0,this.teamAccountsService.getData().pipe(b(this.unsubscribe$)).subscribe({next:s=>{this.searchResults=s.results,n.getTotalCount&&(this.totalRecords=s.totalCount),this.loading=!1},error:()=>{this.siteDataService.showSiteErrorAlert("There was a problem getting team accounts data."),this.loading=!1}})}loadBalances(){this.balancesLoading=!0,this.teamAccountsService.getBalances().pipe(b(this.unsubscribe$)).subscribe({next:t=>{this.balances=t.balances??{},this.balancesLoading=!1},error:()=>{this.siteDataService.showSiteErrorAlert("There was a problem getting team account balances."),this.balancesLoading=!1}})}toggleOptionsMenu(t){this.selectedAccount=t;let n=[],s=[V.COMPLETED,V.FAILED,V.PARTIAL].includes(t.provisioningStatusID);n.push({label:"Delete",icon:"fa fa-trash-alt",disabled:!s,title:s?void 0:"Cannot delete while account is being provisioned",tooltipOptions:s?void 0:{tooltipLabel:"Cannot delete while account is being provisioned",tooltipPosition:"left"},command:()=>{this.showDeleteDialog=!0}}),this.options=[{label:"Options",items:n}],this.optionsMenu.toggle(event)}confirmDelete(){if(!this.selectedAccount){this.siteDataService.showSiteErrorAlert("Only team accounts can be deleted."),this.showDeleteDialog=!1;return}this.deletingAccountId===null&&(this.deletingAccountId=this.selectedAccount.teamAccountID,this.teamAccountsService.deleteTeamAccount(this.selectedAccount.teamAccountID).pipe(b(this.unsubscribe$)).subscribe({next:()=>{this.searchResults=this.searchResults.filter(t=>t.teamAccountID!==this.selectedAccount.teamAccountID),this.totalRecords--,this.deletingAccountId=null,this.showDeleteDialog=!1},error:t=>{console.error("Error deleting team account:",t),this.siteDataService.showSiteErrorAlert("Failed to delete the team account."),this.deletingAccountId=null,this.showDeleteDialog=!1}}))}resetFilters(){this.teamAccountsService.filters=new ut(this.teamAccountsService.filters.orderBy)}onAdvancedFiltersToggled(t){!t||this.programsLoaded||(this.programsLoading=!0,this.teamAccountsService.getProgramFilterOptions().pipe(b(this.unsubscribe$)).subscribe({next:n=>{this.programOptions=n.map(s=>({label:s.name,value:s.programID})),this.programsLoaded=!0,this.programsLoading=!1},error:()=>{this.programsLoading=!1}}))}expandAccountRow(t){let n=t.data.teamAccountID;this.accountDetails[n]||this.loadAccountDetails(n)}loadAccountDetails(t){this.accountDetails[t]={loading:!0,programs:[]},this.teamAccountsService.getProgramTeamAccounts(t,1,25,!0).pipe(b(this.unsubscribe$)).subscribe({next:n=>{let s=this.budgetSharedService.budgetThresholds[ke.REVENUE];
705n.results.forEach(p=>{if(p.totalOverdueTeamFees>0){let f=p.totalRevenueBudget>0?p.totalOverdueTeamFees/p.totalRevenueBudget*100:100;p.overdueFeesClass=f>=s.critical?"color-critical":"color-warning"}}),this.accountDetails[t]={loading:!1,programs:n.results,count:n.count}},error:()=>{this.siteDataService.showSiteErrorAlert("Failed to load account details."),this.accountDetails[t].loading=!1}})}getProvisioningStatusColor(t){switch(t){case V.PENDING:return"#6c757d";case V.IN_PROGRESS:return"#007bff";case V.COMPLETED:return"#28a745";case V.FAILED:return"#dc3545";case V.PARTIAL:return"#ffc107";default:return"#000000"}}getProvisioningStatusIcon(t){switch(t){case V.PENDING:return"fa fa-clock";case V.IN_PROGRESS:return"fa fa-spinner fa-spin";case V.COMPLETED:return"fa fa-check-circle";case V.FAILED:return"fa fa-times-circle";case V.PARTIAL:return"fa fa-exclamation-triangle";default:return""}}createTeamAccount(){this.router.navigate(["new"],{relativeTo:this.route})}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete()}};a.\u0275fac=function(n){return new(n||a)(S(R),S(Ze),S(qe),S(He),S(ii))},a.\u0275cmp=A({type:a,selectors:[["app-team-accounts-search"]],viewQuery:function(n,s){if(n&1&&H(Lo,5),n&2){let p;B(p=O())&&(s.optionsMenu=p.first)}},standalone:!1,decls:48,vars:20,consts:[["optionsMenu",""],["accountDetailsTemplate",""],["expandedrow",""],[3,"adminFilterReset","adminFilterSearch","advancedFiltersToggled","showAdvanced"],["primary",""],[1,"col","pr-0"],["type","text","id","teamName","pInputText","","placeholder","Team Name",1,"full-width",3,"ngModelChange","keydown.enter","ngModel"],["for","teamName",1,"sr-only"],["advanced",""],[1,"row"],[1,"col-md-4"],[1,"form-group"],["for","programFilter"],["inputId","programFilter","optionLabel","label","optionValue","value","styleClass","full-width","appendTo","body","placeholder","All Programs",3,"ngModelChange","autofocusFilter","ngModel","options","showClear","filter","disabled"],[1,""],["appendTo","body",3,"model","popup"],[1,"table-responsive"],["sortField","teamName","currentPageReportTemplate","Showing {first} to {last} of {totalRecords} team accounts",1,"table","table-striped","table-sm",3,"onLazyLoad","onRowExpand","columns","value","lazy","paginator","totalRecords","rows","loading","rowsPerPageOptions","showCurrentPageReport","dataKey","expandedRowKeys"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[1,"sr-only"],[3,"pSortableColumn"],[3,"field"],[3,"routerLink"],[1,"text-right"],[1,"text-center"],[1,"nowrap"],["type","button","title","Options",1,"btn","btn-sm","btn-tertiary",3,"click"],[1,"fa-solid","fa-ellipsis"],["height","1rem","width","4rem"],[3,"ngClass"],["aria-label","Balance unavailable"],["tooltipPosition","top",3,"text","status","tooltipText"],[3,"text","status"],["type","button",1,"btn","btn-sm","btn-tertiary","ml-1",3,"pRowToggler"],[1,"fas","fa-chevron-down",3,"ngClass"],[1,"p-0"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["buttonText","Open Account","buttonIcon","fa fa-plus",3,"buttonClicked","text","showButton"],[1,"bg-grey-lt","border-radius","p-3","text-medium","text-left"],[1,"card"],[1,"row","no-gutters","d-flex","align-items-center"],[1,"col-md-3","text-left"],[1,"col-md-2","text-left"],[1,"text-small","text-grey","mb-1"],[1,"col-md-5","text-left","pr-3"],[3,"percentageUsed","budgetCategoryClassificationID","budgeted","remaining"],[1,"col-md-2","text-right"],[1,"card","m-0"],[1,"text-left"],[1,"text-small","text-grey","text-uppercase"],["status","error",3,"tooltipText"],["status","warn",3,"tooltipText"],["status","default",3,"tooltipText"],[1,"fw-600",3,"ngClass"],[1,"color-success","fw-600"],[1,"d-block",3,"routerLink"],[1,"text-grey","text-center","py-3"],["height","5rem",3,"invertBg"],["headerText","Delete Team Account","dialogClass","standardWidthDialog","yesButtonText","Yes, Delete","yesButtonLoadingText","Deleting...","noButtonText","No, Cancel",3,"onYesSelect","onNoSelect","showModalText","loading"],[1,"text-medium","fw-600"],["alertType","warning",3,"isInline"]],template:function(n,s){if(n&1){let p=v();r(0,"app-admin-filter",3),x("adminFilterReset",function(){return s.resetFilters()})("adminFilterSearch",function(){return s.run()})("advancedFiltersToggled",function(P){return s.onAdvancedFiltersToggled(P)}),e(1,` 706 `),Y(2,4),e(3,` 707 `),r(4,"div",5),e(5,` 708 `),r(6,"input",6),E("ngModelChange",function(P){return g(p),I(s.teamAccountsService.filters.teamName,P)||(s.teamAccountsService.filters.teamName=P),C(P)}),x("keydown.enter",function(){return s.run()}),l(),e(7,` 709 `),r(8,"label",7),e(9,"Team Name"),l(),e(10,`
710 `),l(),e(11,` 711 `),Q(),e(12,` 712 `),Y(13,8),e(14,` 713 `),r(15,"div",9),e(16,` 714 `),r(17,"div",10),e(18,` 715 `),r(19,"div",11),e(20,` 716 `),r(21,"label",12),e(22,"Program"),l(),e(23,` 717 `),r(24,"p-multiSelect",13),E("ngModelChange",function(P){return g(p),I(s.teamAccountsService.filters.programIDs,P)||(s.teamAccountsService.filters.programIDs=P),C(P)}),e(25,` 718 `),l(),e(26,` 719 `),l(),e(27,` 720 `),l(),e(28,` 721 `),l(),e(29,` 722 `),Q(),e(30,` 723`),l(),e(31,` 724 725`),r(32,"section",14),e(33,` 726 `),u(34,la,16,12),l(),e(35,` 727 728`),r(36,"p-menu",15,0),e(38,` 729`),l(),e(39,` 730 731`),y(40,ya,2,1,"ng-template",null,1,W),e(42,` 732 733`),r(43,"p-menu",15,0),e(45,` 734`),l(),e(46,` 735 736`),u(47,Da,10,4)}n&2&&(m("showAdvanced",!0),c(6),w("ngModel",s.teamAccountsService.filters.teamName),c(18),m("autofocusFilter",!0),w("ngModel",s.teamAccountsService.filters.programIDs),m("options",s.programOptions)("showClear",!0)("filter",!0)("disabled",s.programsLoading),c(10),h(s.showTable?34:-1),c(2),q(T(18,Bi)),m("model",s.options)("popup",!0),c(7),q(T(19,Bi)),m("model",s.options)("popup",!0),c(4),h(s.showDeleteDialog?47:-1))},dependencies:[Ge,Ye,be,ve,ye,De,Pt,Te,Ee,ue,Re,Oe,Ne,kt,Me,Pe,Mt,Be,Fe,pe,ni,Qe],styles:[".clickable-card[_ngcontent-%COMP%]{cursor:pointer;transition:transform .2s ease,box-shadow .2s ease}.clickable-card[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 4px 12px #00000026}.color-medium[_ngcontent-%COMP%]{color:var(--dashboard-color-medium)}.color-success[_ngcontent-%COMP%]{color:var(--dashboard-color-success)}.color-critical[_ngcontent-%COMP%]{color:var(--dashboard-color-critical)}"]});let i=a;return i})();var Ta=[{path:"",component:ui,canActivate:[pt,ge,Ce],canActivateChild:[pt],children:[{path:"cardholders",component:bi,canActivate:[ge,Ce],data:{permissions:[ie.TeamAccountsCardHolders],metaTitle:"Team Accounts Cardholders"}},{path:"club-account",component:wi,canActivate:[ge,Ce],data:{permissions:[ie.TeamAccountsClubAccount],metaTitle:"Team Accounts Club Account"}},{path:"reports",component:Ii,canActivate:[ge,Ce],data:{permissions:[ie.TeamAccountsReports],metaTitle:"Team Accounts Reports"}},{path:"settings",component:Pi,canActivate:[ge,Ce],data:{permissions:[ie.TeamAccountsBudgetingSpendingControls],metaTitle:"Team Accounts Budgeting & Spending"}},{path:"team-accounts",component:Ni,canActivate:[ge,Ce],data:{permissions:[ie.TeamAccounts],metaTitle:"Team Accounts"}},{path:"",redirectTo:"team-accounts",pathMatch:"full"}]}],Li=(()=>{let a=class a{};a.\u0275fac=function(n){return new(n||a)},a.\u0275mod=xe({type:a}),a.\u0275inj=_e({imports:[mt.forChild(Ta),mt]});let i=a;return i})();var Vi=(()=>{let a=class a{};a.\u0275fac=function(n){return new(n||a)},a.\u0275mod=xe({type:a}),a.\u0275inj=_e({providers:[rt],imports:[Xe]});let i=a;return i})();var bc=(()=>{let a=class a{};a.\u0275fac=function(n){return new(n||a)},a.\u0275mod=xe({type:a}),a.\u0275inj=_e({providers:[Ze,at,st,lt,ae],imports:[Xe,Li,Vi,mi,zt]});let i=a;return i})();export{bc as TeamAccountsModule};
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.