1import{u as w,s as I,r as m,j as a,k as f,bf as n,q as u,F as M,ae as W,a_ as j,S as N,aW as z}from"./elements-5kxJS_4j.js";import{K as B,L as S,Y as q,P as J,a0 as F,q as P,aP as y,aT as T,_ as R}from"./index-CtCeyryw.js";import{A as h,M as D}from"./MakeAPayment-Cku-Ygqz.js";import{M as H}from"./ManagePayment-Dmr654v8.js";import{S as k,a as _}from"./StatementDownloadModal-BtrP3kqE.js";import{U as E}from"./UpcomingCharges-Cx9oTqGU.js";import{u as $}from"./useIsMobile-DE0QDUth.js";import{u as V}from"./usePaymentProviders-Dq8U2NWu.js";import{A as Q}from"./authorization-DRCBMAi9.js";import{u as K}from"./useRedesign-xeayEwR4.js";import"./grids-DGmfp9GI.js";import"./startOfDay-AazlW55I.js";import"./useSelectedProperty-CronaFcx.js";import"./useAuthorization-XS6cSJ0I.js";function G({account:e,ledgerData:s,currentAccount:l,onActivityToggle:i,onModalOpen:r}){const{t}=w(),{hasVantacaPay:o}=V(e),{width:c}=I(),p=$(),[x,C]=m.useState(l===e.accountWithSubCode),A=()=>{C(!x),i(e.accountWithSubCode)},v=m.useMemo(()=>({data:d})=>{if(!d)return null;const b=d.amount,L=b<0;return a.jsxs("div",{className:"flex flex-col w-full py-3 space-y-2",children:[a.jsx("div",{className:"flex justify-between items-start",children:a.jsx("div",{className:"text-sm font-medium",children:f(d.ledgerDate,{format:"numeric",naive:!0})})}),a.jsxs("div",{className:"text-smy",children:[a.jsx("p",{className:"break-words leading-4",children:`${d.description} ${d.otherDescription||""}`.trim()}),d.detailedDescription&&a.jsx("p",{className:"text-xs mt-1",children:d.detailedDescription})]}),a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:"text-text-tertiary",children:t("billing.accountOverview.amountLabel")}),a.jsx("span",{className:u(L?"text-success":""),children:n((b??0)/100)})]}),a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{children:t("billing.accountOverview.balanceLabel")}),a.jsx("span",{className:"font-medium",children:n((d.runningBalance??0)/100)})]})]})]})},[]),g=m.useMemo(()=>[{field:"ledgerDate",headerName:t("billing.accountOverview.accountActivity"),resizable:!1,floatingFilter:!1,suppressMenu:!0,flex:1,cellRenderer:({data:d})=>a.jsx(v,{data:d})}],[v]),O=m.useMemo(()=>c>=B?Z:g,[c,g]);return a.jsxs("div",{"data-qa":"account-card",className:"rounded-md border border-widget-border bg-widget-bg",style:{boxShadow:"0 2px 8px 0 rgba(0, 0, 0, 0.12)"},children:[a.jsxs("div",{className:"flex flex-col tablet:flex-row justify-start items-center h-auto tablet:min-h-[239px] px-10 py-8 text-sm",children:[a.jsxs("div",{className:"px-1 flex flex-col tablet:flex-row items-center justify-start w-full tablet:w-[1200px] h-full",children:[a.jsx(U,{account:e,t}),a.jsxs("div",{className:"w-full tablet:w-1/2 h-full-mt-2 tablet:mt-0 text-left tablet:text-left pl-0 tablet:pl-8 pt-4 tablet:pt-0 flex flex-col justify-center",children:[a.jsx(Y,{account:e,t}),a.jsx("div",{className:"mt-4",children:a.jsxs("button",{"data-qa":"acctActivity","data-qa-value":JSON.stringify({activityDisplayed:x?"shown":"hidden"}),onClick:A,className:"text-base-link font-medium hover:underline flex items-center gap-2",children:[t(x?"billing.accountOverview.hideActivity":"billing.accountOverview.showActivity"),a.jsx(M,{icon:W,className:u("transition-transform duration-300 ease-in-out",x&&"rotate-180")})]})})]})]}),a.jsx(X,{account:e,hasVantacaPay:o})]}),a.jsxs("div",{className:u("border-t border-widget-border overflow-hidden transition-all duration-300 ease-in-out",x?"max-h-[500px] opacity-100":"max-h-0 opacity-0"),children:[a.jsxs("div",{"data-qa":"activity-header",className:"flex flex-col mobile:flex-row items-start mobile:items-center px-10 py-4",children:[a.jsx("h2",{"data-qa":"activity-title",className:"text-xl font-medium mb-2 w-full",children:t("billing.accountOverview.accountActivity")}),a.jsxs("div",{"data-qa":"activity-actions",className:"flex flex-col mobile:flex-row grow justify-start items-start mobile:items-center mobile:justify-end space-y-2 mobile:space-y-0 gap-0 mobile:gap-8 w-full bg-0",children:[a.jsx(S,{"data-qa":"accountHistoryLink","data-qa-value":JSON.stringify({accountWithSubCode:e.accountWithSubCode}),to:"/billing/account-history",state:{defaultAccount:e.accountWithSubCode},className:"text-base-link",children:t("billing.accountOverview.accountHistory")}),a.jsx(k,{setIsModalOpen:()=>r(e.accountWithSubCode),isBlocked:e.blockLedger})]})]}),a.jsx("div",{"data-qa":"activity-table-container","data-qa-value":JSON.stringify({isBlocked:e==null?void 0:e.blockLedger,blockMessage:e==null?void 0:e.blockLedgerMessage}),className:u("max-h-64 overflow-auto px-10 pb-8",(e==null?void 0:e.blockLedger)&&"[&_.ag-overlay-wrapper]:text-error"),children:a.jsx(m.Suspense,{fallback:a.jsx("div",{"data-qa":"activity-loading",className:"flex items-center justify-center w-full min-h-64",children:a.jsx(N,{})}),children:a.jsx(q,{resolve:s,children:d=>{var b;return a.jsx(j,{rowData:d[e.accountWithSubCode],"data-qa":"accountTable","data-qa-value":JSON.stringify({accountWithSubCode:e.accountWithSubCode,rowCount:((b=d[e.accountWithSubCode])==null?void 0:b.length)||0,isBlocked:e==null?void 0:e.blockLedger}),columnDefs:O,rowHeight:p?85:void 0,pagination:!1,overlayNoRowsTemplate:e!=null&&e.blockLedger?e==null?void 0:e.blockLedgerMessage:"There is no data to display.",isMobile:p})}})})})]})]})}function U({account:e,t:s}){return a.jsxs("div",{"data-qa":"account-info-section",className:"w-full tablet:w-1/2 h-full flex flex-col justify-between border-b tablet:gap-4 tablet:border-b-0 tablet:border-r tablet:border-input-border pb-4 tablet:pb-0",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsx("p",{"data-qa":"balance-label",className:"font-normal whitespace-nowrap block",children:s("billing.accountOverview.accountBalance")})}),a.jsx("h2",{className:u(e.blockLedger&&"text-error","text-2xl tablet:text-[42px] mb-2 font-medium"),"aria-live":"polite","data-qa":"balance","data-qa-value":JSON.stringify({balance:n(e.balance),isBlocked:e.blockLedger}),children:e.blockLedger?s("billing.blockedLedgers.blocked"):n(e.balance)})]}),a.jsx("div",{className:"flex items-center w-full pt-2 gap-3 flex-wrap",children:a.jsx(E,{accountNumber:e.accountNumber,ownerId:e.ownerId,subLedgerId:e.subLedgerId,qaAttribute:"upcoming-charges"})}),a.jsx("div",{"data-qa":"auto-draft-status-desktop",className:"hidden tablet:flex",children:a.jsx(h,{account:e})})]})}function Y({account:e,t:s}){var l,i,r,t;return a.jsxs("div",{"data-qa":"account-details-section",className:"flex flex-col gap-2",children:[a.jsxs("p",{className:"whitespace-nowrap tablet:whitespace-nowrap font-semibold line-clamp-1","data-qa":"account-number","data-qa-value":JSON.stringify({account:e.accountNumber,subLedgerId:e.subLedgerId,accountWithSubCode:e.accountWithSubCode}),children:[s("billing.accountOverview.accountNumber"),":"," ",e.accountWithSubCode]}),a.jsx("p",{"data-qa":"assoc-name","data-qa-value":JSON.stringify({associationName:e.associationName}),className:"line-clamp-1",children:e.associationName}),a.jsxs("div",{"data-qa":"address","data-qa-value":JSON.stringify({address1:(l=e.propertyAddress)==null?void 0:l.address1,address2:(i=e.propertyAddress)==null?void 0:i.address2}),className:"line-clamp-1 flex flex-col",children:[a.jsx("span",{id:"address1",children:(r=e.propertyAddress)==null?void 0:r.address1}),a.jsx("span",{id:"address2",children:(t=e.propertyAddress)==null?void 0:t.address2})]}),a.jsx("div",{"data-qa":"auto-draft-status-mobile",className:"flex tablet:hidden",children:a.jsx(h,{account:e})})]})}function X({account:e,hasVantacaPay:s}){return a.jsx("div",{"data-qa":"payment-actions-section",className:"w-full tablet:flex-col flex tablet:justify-center items-center h-full pt-6 tablet:pt-0",children:a.jsxs("div",{"data-qa":"payment-actions-container",className:"tablet:w-[350px] w-full max-w-[400px] space-y-2 flex flex-col",children:[a.jsx(D,{account:e,className:""}),s&&a.jsx("div",{"data-qa":"manage-payment-container",children:a.jsx(H,{selectedAccount:e})})]})})}const Z=[{colId:"ledgerDate",field:"ledgerDate",headerName:"Date",valueFormatter:e=>f(e.value,{format:"numeric",naive:!0}
1),sortable:!0,suppressMenu:!0,resizable:!1,cellClass:"ledger-date-cell"},{field:"description",headerName:"Description",sortable:!0,autoHeight:!0,suppressMenu:!0,resizable:!1,valueGetter:e=>({description:e.data.description,otherDescription:e.data.otherDescription,details:e.data.detailedDescription}),cellRenderer:({value:e})=>a.jsxs("div",{"data-qa":"ledger-description","data-qa-value":JSON.stringify({description:e.description,otherDescription:e.otherDescription,details:e.details}),className:"max-w-full text-wrap break-words leading-4",children:[a.jsx("p",{children:`${e.description} ${e.otherDescription||""}`.trim()}),e.details&&a.jsx("p",{className:"text-sm opacity-75",children:e.details})]})},{field:"amount",headerName:"Amount",cellRenderer:({value:e})=>a.jsx("p",{className:u(e<0?"text-success":""),children:n((e??0)/100)}),sortable:!0,suppressMenu:!0,resizable:!1},{field:"runningBalance",headerName:"Balance",resizable:!1,valueFormatter:e=>n((e.value??0)/100),sortable:!0,suppressMenu:!0,cellStyle:{textAlign:"left"},cellClass:"ledger-balance-cell"}],ee=({accountNumber:e,ownerId:s,subLedgerId:l})=>{const i=new Date;return i.setDate(i.getDate()-30),F({queryKey:["ledger","ledgerOverview",{accountNumber:e,subLedgerId:l}],queryFn:()=>P.getLedgers({accountNumber:e,ownerId:s,subLedgerId:l,pageSize:10,"ledgerDate.after":i})})},pe={title:"Account Overview",showPropertySelector:!1,customContentId:["Billing","Homeowner_v2"],showAi:!0};async function ve(){const e=await y.fetchQuery(T);return R({accounts:e,accountInfo:(async()=>{const l={},i=e.map(async r=>{const t=await y.fetchQuery(ee({accountNumber:r.accountNumber,ownerId:r.ownerId,subLedgerId:r.subLedgerId}));l[r.accountWithSubCode]=t.member});return await Promise.allSettled(i),l})()})}function ge(){const e=J(),s=K(),[l,i]=m.useState(),[r,t]=m.useState(e.accounts[0].accountWithSubCode);return a.jsxs(Q,{controller:"Homeowner_v2",action:"Billing",children:[s?a.jsx("div",{className:"rounded-xl",children:a.jsx("div",{className:"space-y-6",children:e.accounts.map(o=>a.jsx(G,{account:o,ledgerData:e.accountInfo,currentAccount:r,onModalOpen:i,onActivityToggle:c=>{t(r===c?void 0:c)}},o.accountWithSubCode))})}):a.jsx("div",{className:"bg-base-fill rounded-xl",children:a.jsx("div",{className:"flex flex-col divide-y py-8",children:e.accounts.map(o=>a.jsx(ae,{account:o,ledgerData:e.accountInfo,currentAccount:r,onModalOpen:i,onActivityToggle:c=>{t(r===c?void 0:c)}},o.accountWithSubCode))})}),a.jsx(_,{accounts:e.accounts,isModalOpen:!!l,setIsModalOpen:()=>i(void 0),currentAccountFilter:l})]})}function ae({account:e,ledgerData:s,currentAccount:l,onActivityToggle:i,onModalOpen:r}){const{t}=w();return a.jsxs("div",{"data-qa":"account-card",className:"py-5 first:pt-0 last:pb-0",children:[a.jsxs("div",{className:"mb-5 flex items-center md:flex-nowrap md:flex-row flex-col md:mt-0 mt-7 md:px-horizontal-layout px-horizontal-layout-sm",children:[a.jsxs("div",{className:"flex md:flex-row flex-col justify-start flex-shrink w-full wrap",children:[a.jsxs("div",{className:"w-auto pr-[5vw] flex-shrink-0 md:w-64 h-full flex items-start justify-around flex-col text-base-header border-widget-border md:border-r-2",children:[a.jsxs("p",{className:"font-normal opacity-75 mb-2 whitespace-nowrap",children:[t("billing.accountOverview.accountBalance"),":"]}),a.jsx("p",{className:u(e.blockLedger&&"text-error","text-4xl mb-2"),"aria-live":"polite","data-qa":"balance","data-qa-value":JSON.stringify({balance:n(e.balance)}),children:e.blockLedger?t("billing.blockedLedgers.blocked"):n(e.balance)}),a.jsx("p",{className:"hidden md:block opacity-75 whitespace-nowrap","data-qa":"due-date","data-qa-value":JSON.stringify({dueDate:e.nextChargeDate?f(e.nextChargeDate,{format:"numeric",naive:!0}):void 0}),children:e.nextChargeDate&&a.jsxs(a.Fragment,{children:[t("billing.accountOverview.dueOn"),":"," ",f(e.nextChargeDate,{format:"numeric",naive:!0})]})})]}),a.jsxs("div",{className:"md:w-1/2 w-full flex-shrink xl:w-1/3 h-full md:mt-0 mt-3 xl:ml-10 md:ml-4 text-base-fg",children:[a.jsxs("p",{className:"font-semibold whitespace-nowrap","data-qa":"account-number","data-qa-value":JSON.stringify({account:e.accountNumber,subLedgerId:e.subLedgerId}),children:[t("billing.accountOverview.accountNumber"),":"," ",e.accountWithSubCode]}),a.jsx("p",{"data-qa":"address",children:z(e.propertyAddress,"half")}),a.jsx("p",{"data-qa":"assoc-name",children:e.associationName})]})]}),a.jsx("p",{className:"md:hidden mt-2 self-end","data-qa":"autoDraft","data-qa-value":JSON.stringify({enrolled:e.autoDraftEnrolled}),children:a.jsx(h,{account:e})}),a.jsx("div",{className:"md:ml-4 w-full md:w-56",children:a.jsx(D,{account:e,className:"my-4"})})]}),a.jsxs("div",{className:"flex md:justify-between justify-end mr-4 md:mr-0 mb-3 md:mt-0 mt-3",children:[a.jsx("button",{"data-qa":"acctActivity","data-qa-value":JSON.stringify({activityDisplayed:l===e.accountWithSubCode&&"shown"}),onClick:()=>i(e.accountWithSubCode),className:"md:ml-horizontal-layout ml-horizontal-layout-sm text-base-link",children:l===e.accountWithSubCode?t("billing.accountOverview.hideActivity"):t("billing.accountOverview.showActivity")}),a.jsx("p",{className:"mr-8 hidden md:block",children:a.jsx(h,{account:e})})]}),l===e.accountWithSubCode&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx("h2",{className:"text-base-fg text-xl ml-8 mt-8 mb-8 md:block hidden w-full",children:t("billing.accountOverview.accountActivity")}),a.jsxs("div",{className:"flex grow flex-row md:justify-end justify-between items-center xl:mt-0 mt-3 pr-2 xl:pr-8",children:[a.jsx(S,{"data-qa":"accountHistoryLink",to:"/billing/account-history",state:{defaultAccount:e.accountWithSubCode},className:"text-base-link mr-horizontal-layout xl:ml-0 ml-horizontal-layout-sm text-nowrap",children:t("billing.accountOverview.accountHistory")}),a.jsx(k,{setIsModalOpen:()=>r(e.accountWithSubCode),isBlocked:e.blockLedger})]})]}),a.jsx("div",{className:u("max-h-64 overflow-auto md:overflow-x-hidden overflow-x-auto",(e==null?void 0:e.blockLedger)&&"[&_.ag-overlay-wrapper]:text-error"),children:a.jsx(m.Suspense,{fallback:a.jsx("div",{className:"flex items-center justify-center w-full min-h-64",children:a.jsx(N,{})}),children:a.jsx(q,{resolve:s,children:o=>a.jsx(j,{rowData:o[e.accountWithSubCode],"data-qa":"accountTable",columnDefs:te,pagination:!1,overlayNoRowsTemplate:e!=null&&e.blockLedger?e==null?void 0:e.blockLedgerMessage:"There is no data to display."})})})})]})]},e.accountWithSubCode)}const te=[{colId:"ledgerDate",field:"ledgerDate",headerName:"Date",valueFormatter:e=>f(e.value,{format:"numeric",naive:!0}),sortable:!0,resizable:!0},{colId:"description",field:"description",headerName:"Description",sortable:!0,resizable:!0,autoHeight:!0,valueGetter:e=>({description:e.data.description,otherDescription:e.data.otherDescription,details:e.data.detailedDescription}),cellRenderer:({value:e})=>a.jsxs("div",{className:"py-2 max-w-full text-wrap break-words leading-4",children:[a.jsx("p",{children:`${e.description} ${e.otherDescription}`.trim()})," ",e.details&&a.jsx("p",{className:"text-sm opacity-75",children:e.details})]})},{colId:"amount",field:"amount",cellStyle:e=>{const s={};return e.value<0&&(s.color="var(--color-success)"),s.textAlign="right",s},headerName:"Amount",valueFormatter:e=>n((e.value??0)/100),sortable:!0,resizable:!0},{colId:"runningBalance",field:"runningBalance",headerName:"Balance",valueFormatter:e=>n((e.value??0)/100),sortable:!0,cellStyle:{textAlign:"right"},resizable:!0}];export{ge as Component,pe as handle,ee as ledgerQuery,ve as loader};
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.