1import{r as z,M as s,aX as f,be as u,dg as w,a$ as E,bc as B,b6 as H}from"./vendor-BVFj3DJS.js";import{F as M}from"./FailedReadsNotice-Cv8zdoH5.js";import{P as S}from"./PageHeader-CecLChOu.js";import{B as U}from"./brand-panel-money-figure-DO6tEM82.js";import{H as I}from"./hub-link-card-COcjSZD1.js";import{K as o}from"./kpi-card-DbGcpydS.js";import{I as K}from"./InviteLinkPanel-sF7deQIv.js";import{m as V,fN as W,eR as q,q as h,z as X,eN as r,eO as c,T as v,V as C,C as $,H as G,B as J}from"./index-BqHVJPYg.js";import{u as Q}from"./useFormatPercent-S7L9qFU4.js";import{u as Y}from"./i18n-vendor-B3QzPf-b.js";import"./PrivacyToggleButton-B55NXv0m.js";import"./info-tip-C5qpR6uP.js";import"./popover-Bb3h0Fm7.js";import"./stellar-vendor-6c0Jq5yJ.js";import"./format-bps-oP4XycXo.js";const us=()=>{var D;const{t:e}=Y(),{formatPercent:F}=Q(),{formatCurrency:l}=V(),x=W(),{office:b,isOfficeUnconfirmed:p,refetchOffice:T,split:g,book:i,stockAum:j,commissionsReceived:t,aumAddedThisMonth:n,pendingCommission:d}=x,N=q({...i,value:(D=i.value)==null?void 0:D.totalAum},j),y=[{isError:p,refetch:T},i,j,t,n,d],[L,k]=z.useState(!1);if(!b||!g)return s.jsxs("div",{className:"space-y-6",children:[s.jsx(h,{className:"h-12 w-80"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:["skeleton-1","skeleton-2","skeleton-3"].map(a=>s.jsx(h,{className:"h-40 rounded-lg"},a))}),s.jsx(h,{className:"h-32 rounded-lg"})]});const{maxFeePercent:P,officeFeePercent:A,advisorFeePercent:R}=g,O=x.inviteUrl??"",m=a=>p?"â":F(a);return s.jsxs("div",{className:"space-y-6",children:[s.jsx(S,{"data-testid":"office-dashboard-heading",title:e("officeDashboard.greeting",{name:X(b.tradeName)||e("officeDashboard.fallbackName")}),description:e("officeDashboard.subtitle")}),s.jsx(M,{reads:y,message:e("b2bOverview.loadError")}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsx(f,{to:"/office/clients",className:"block h-full",children:s.jsx(o,{"data-testid":"office-dashboard-aum-card",tone:"brand",className:"h-full",icon:s.jsx(u,{className:"w-4 h-4 sm:w-5 sm:h-5"}),iconTone:"onBrand",label:e("officeDashboard.cards.totalAum"),value:s.jsx(U,{loading:c(N),children:r(N,a=>l(a))}),subtitle:!i.isError&&i.value!==void 0?s.jsxs("span",{className:"text-neutral-0",children:[e("officeDashboard.cards.activeAdvisors",{count:i.value.advisorCount})," â¢"," ",e("officeDashboard.cards.finalClients",{count:i.value.clientCount})]}):void 0})}),s.jsx(o,{icon:s.jsx(w,{className:"w-4 h-4 sm:w-5 sm:h-5"}),iconTone:"neutral",label:e("officeDashboard.cards.officeSplit"),value:m(P),size:"hero",subtitle:s.jsxs("div",{className:"space-y-1",children:[s.jsxs(v,{variant:"callout",muted:!0,children:[e("officeDashboard.cards.office"),":"," ",s.jsx(C,{as:"span",size:"sm",className:"text-foreground",children:m(A)})]}),s.jsxs(v,{variant:"callout",muted:!0,children:[e("officeDashboard.cards.advisor"),":"," ",s.jsx(C,{as:"span",size:"sm",className:"text-foreground",children:m(R)})]})]})}),s.jsx(o,{icon:s.jsx(w,{className:"w-4 h-4 sm:w-5 sm:h-5"}),iconTone:"success",label:e("officeDashboard.cards.commissionsReceived"),value:r(t,a=>l(a)),loading:c(t),size:"hero",sign:t.isError?void 0:"positive",subtitle:e("officeDashboard.cards.totalReceived")})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsx(f,{to:"/office/advisors",className:"block h-full",children:s.jsx(o,{className:"h-full",icon:s.jsx(E,{className:"w-4 h-4 sm:w-5 sm:h-5"}),iconTone:"neutral",label:e("officeDashboard.cards.registeredAdvisors"),value:r(i,a=>a.advisorCount),loading:c(i)})}),s.jsx(o,{icon:s.jsx(u,{className:"w-4 h-4 sm:w-5 sm:h-5"}),iconTone:"neutral",label:e("officeDashboard.cards.aumAddedMonth"),value:r(n,a=>l(a)),loading:c(n)}),s.jsx(o,{icon:s.jsx(u,{className:"w-4 h-4 sm:w-5 sm:h-5"}),iconTone:"neutral",label:e("officeDashboard.cards.commissionsToReceive"),value:r(d,a=>l(a)),loading:c(d)}),s.jsx(I,{})]}),s.jsxs($,{className:"p-6",children:[s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4 mb-4",children:[s.jsxs("div",{children:[s.jsx(G,{level:2,className:"text-foreground mb-1",children:e("officeDashboard.inviteLink.title")}),s.jsx(v,{variant:"callout",muted:!0,children:e("officeDashboard.inviteLink.description")})]}),s.jsx(J,{asChild:!0,children:s.jsxs(f,{to:"/office/links",children:[s.jsx(B,{}),e("officeDashboard.inviteLink.manageLinks")]})})]}),s.jsx(K,{tone:"bare",link:O,linkAriaLabel:e("officeDashboard.inviteLink.title"),onCopied:()=>{k(!1),H.success(e("officeDashboard.links.toasts.linkCopied"))},onCopyFailed:()=>k(!0),copyFailedMessage:L?e("officeDashboard.links.toasts.copyFailed"):null})]})]})};export{us as OfficeDashboard,us as default};
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.