PageSourceSearch

https://shippingliyo.com/assets/AdminDashboardPage-CmfUttcX.js

js shippingliyo.com collected 2026-10-09 21:48:56 UTC 10,648 bytes, 1 lines download raw bytes

1import{a as D,j as s}from"./index-BLv5m_TH.js";import{r as i}from"./vendor-router-BdFSjfUf.js";import{D as $}from"./DashboardLayout-Dpurc7ra.js";import{ah as O,y as L,ab as E,T as b,s as U,f,r as B,q as I,b9 as w,z as M,c as F,F as q,K as W,aj as Z,ak as H,W as K,X}from"./vendor-icons-ByltlpZk.js";import"./vendor-react-BSeQcPOp.js";import"./vendor-toast-Sr3kDNTh.js";import"./logo-wbla0dgu.js";const Y=[{key:"today",label:"Today"},{key:"this-week",label:"This Week"},{key:"this-month",label:"This Month"},{key:"this-year",label:"This Year"},{key:"custom",label:"Custom"}];function t(a,c=0){return a==null?"—":Number(a).toLocaleString("en-US",{minimumFractionDigits:c,maximumFractionDigits:c})}function _(a){return a?new Date(a).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function G(a){const c=String(a||"").trim();return c?c.replace(/[_-]+/g," ").replace(/\b\w/g,g=>g.toUpperCase()):"Other"}function ls(){const[a,c]=i.useState(null),[g,v]=i.useState(!0),[r,A]=i.useState("today"),[h,C]=i.useState(""),[o,T]=i.useState(""),[p,R]=i.useState(!1),y=i.useCallback(()=>{v(!0);let e="";r==="custom"&&h&&o?e=`?startDate=${h}&endDate=${o}`:r!=="custom"&&(e=`?period=${r}`),D(`/admin/dashboard/summary${e}`).then(d=>c(d)).catch(()=>c(null)).finally(()=>v(!1))},[r,h,o]);i.useEffect(()=>{r==="custom"&&(!h||!o)||y()},[y,r,h,o]);const l=a?.orders||{},N=a?.stores||{},k=a?.labels||{},x=a?.printhouses||{},S=a?.users||{},z=a?.appointments||{},j=a?.support||{},n=a?.wallet||{},m=i.useMemo(()=>Object.entries(N.byMarketplace||{}).map(([d,u])=>({mp:d,count:Number(u)||0,label:G(d)})).sort((d,u)=>u.count-d.count||d.label.localeCompare(u.label)),[N.byMarketplace]),P=[{key:"total",label:"Total Orders",value:l.total??0,icon:O,tone:"stat-indigo"},{key:"awaiting",label:"Awaiting Shipment",value:l.awaitingShipmentTotal??0,icon:L,tone:"stat-amber",note:"All time"},{key:"assign",label:"Pending Assignment",value:l.pendingAssignment??0,icon:E,tone:"stat-blue",note:"All time"},{key:"expired",label:"Acceptance Expired",value:l.expiredAssignments??0,icon:b,tone:"stat-amber",note:"Reassign needed"},{key:"assigned",label:"Assigned to Printhouse",value:l.assigned??0,icon:U,tone:"stat-blue"},{key:"accepted",label:"Accepted by Printhouse",value:l.acceptedAssignments??0,icon:f,tone:"stat-green"},{key:"rejected",label:"Rejected",value:l.rejected??0,icon:b,tone:"stat-red"},{key:"shipped",label:"Shipped",value:l.shipped??0,icon:B,tone:"stat-green"},{key:"cancelled",label:"Cancelled",value:l.cancelled??0,icon:I,tone:"stat-red"},{key:"cases",label:"Opened Cases",value:l.openedCases??0,icon:w,tone:"stat-amber"}];return s.jsx($,{children:s.jsxs("div",{className:"adash-page",children:[s.jsx("section",{className:"hero-panel hero-panel-compact adash-hero",children:s.jsxs("div",{children:[s.jsx("p",{className:"eyebrow",children:"Admin Control"}),s.jsx("h1",{children:"Operations Snapshot"}),s.jsx("p",{children:"Platform health, order flow, and assignment balance."})]})}),s.jsxs("div",{className:"adash-period-bar",children:[Y.map(e=>s.jsx("button",{type:"button",className:`period-btn${r===e.key?" active":""}`,onClick:()=>A(e.key),children:e.label},e.key)),r==="custom"&&s.jsxs("div",{className:"adash-custom-range",children:[s.jsx("input",{type:"date",value:h,onChange:e=>C(e.target.value)}),s.jsx("span",{children:"to"}),s.jsx("input",{type:"date",value:o,onChange:e=>T(e.target.value)})]})]}),g?s.jsxs("div",{className:"adash-loading",children:[s.jsx("span",{className:"adash-spinner"}),"Loading…"]}):s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"adash-section",children:[s.jsx("h2",{className:"adash-section-title",children:"Order Summary"}),s.jsx("div",{className:"adash-kpi-grid",children:P.map(e=>s.jsxs("article",{className:"adash-kpi-card",children:[s.jsx("div",{className:`adash-kpi-icon ${e.tone}`,children:s.jsx(e.icon,{size:16})}),s.jsxs("div",{className:"adash-kpi-body",children:[s.jsx("span",{className:"adash-kpi-label",children:e.label}),e.note&&s.jsx("span",{className:"adash-kpi-note",children:e.note}),s.jsx("strong",{className:"adash-kpi-value",children:t(e.value)})]})]},e.key))})]}),s.jsxs("div",{className:"adash-row-3",children:[s.jsxs("article",{className:"panel adash-panel",children:[s.jsxs("h2",{className:"panel-title",children:[s.jsx(M,{size:14,style:{marginRight:"0.4rem"}}),"Stores"]}),s.jsx("div",{className:"adash-big-number",children:t(N.total)}),s.jsx("p",{className:"adash-sublabel",children:"total stores"}),m.length>0?s.jsxs("div",{className:"adash-stores-summary",children:[s.jsxs("div",{className:"adash-mp-chips",children:[m.slice(0,3).map(e=>s.jsxs("span",{className:"adash-mp-chip",children:[s.jsx("span",{children:e.label}),s.jsx("strong",{children:e.count})]},e.mp)),m.length>3&&!p&&s.jsxs("span",{className:"adash-mp-chip adash-mp-chip-more",children:["+",m.length-3," more"]})]}),s.jsxs("button",{type:"button",className:`adash-stores-toggle${p?" open":""}`,onClick:()=>R(e=>!e),"aria-expanded":p,children:[s.jsx("span",{children:p?"Hide marketplace breakdown":`All marketplaces (${m.length})`}),s.jsx(F,{size:14})]}),p&&s.jsx("div",{className:"adash-mp-list",children:m.map(e=>s.jsxs("div",{className:"adash-mp-row",children:[s.jsx("span",{className:"adash-mp-name",children:e.label}),s.jsx("strong",{children:e.count})]},e.mp))})]}):s.jsx("p",{className:"muted",style:{fontSize:"0.8rem",margin:0},children:"No marketplace data."})]}),s.jsxs("article",{className:"panel adash-panel",children:[s.jsxs("h2",{className:"panel-title",children:[s.jsx(q,{size:14,style:{marginRight:"0.4rem"}}),"Labels & Print ",s.jsx("span",{className:"adash-today-badge",children:"Today"})]}),s.jsxs("div",{className:"adash-metric-pair",children:[s.jsxs("div",{className:"adash-metric",children:[s.jsx("span",{className:"adash-metric-label",children:"Labels Created"}),s.jsx("strong",{className:"adash-metric-val",children:t(k.todayLabelsCreated)})]}),s.jsxs("div",{className:"adash-metric",children:[s.jsxs("span",{className:"adash-metric-label",children:[s.jsx(W,{size:12,style:{marginRight:4}}),"Shipped Height"]}),s.jsxs("strong",{className:"adash-metric-val",children:[t(k.todayShippedHeightInch,1),'"']})]})]})]}),s.jsxs("article",{className:"panel adash-panel",children:[s.jsxs("h2",{className:"panel-title",children:[s.jsx(Z,{size:14,style:{marginRight:"0.4rem"}}),"Users & Appointments"]}),s.jsxs("div",{className:"adash-metric-pair",children:[s.jsxs("div",{className:"adash-metric",children:[s.jsx("span",{className:"adash-metric-label",children:"Active Users"}),s.jsx("strong",{className:"adash-metric-val",children:t(S.active)}),s.jsxs("span",{className:"adash-metric-sub",children:["of ",t(S.total)," total"]})]}),s.jsxs("div",{className:"adash-metric",children:[s.jsxs("span",{className:"adash-metric-label",children:[s.jsx(H,{size:12,style:{marginRight:4}}),"Upcoming Appts"]}),s.jsx("strong",{className:"adash-metric-val",children:t(z.upcoming)})]})]})]})]}),s.jsxs("div",{className:"adash-row-3",children:[s.jsxs("article",{className:"panel adash-panel",children:[s.jsxs("h2",{className:"panel-title",children:[s.jsx(K,{size:14,style:{marginRight:"0.4rem"}}),"Wallet Overview"]}),s.jsxs("div",{className:"adash-big-number",children:["$",t(n.totalSystemBalance,2)]}),s.jsx("p",{className:"adash-sublabel",children:"total system balance"}),s.jsxs("div",{className:"adash-wallet-warnings",children:[(n.usersBelow50??0)>0&&s.jsxs("div",{className:"adash-wallet-warn",children:[s.jsx(b,{size:13}),s.jsxs("span",{children:[n.usersBelow50," user",n.usersBelow50!==1?"s":""," below $50"]})]}),(n.usersAtZero??0)>0&&s.jsxs("div",{className:"adash-wallet-warn adash-wallet-danger",children:[s.jsx(X,{size:13}),s.jsxs("span",{children:[n.usersAtZero," user",n.usersAtZero!==1?"s":""," at $0"]})]}),!n.usersBelow50&&!n.usersAtZero&&s.jsxs("div",{className:"adash-wallet-ok",children:[s.jsx(f,{size:13}),s.jsx("span",{children:"All balances healthy"})]})]})]}),s.jsxs("article",{className:"panel adash-panel adash-panel-span2",children:[s.jsxs("h2",{className:"panel-title",children:[s.jsx(w,{size:14,style:{marginRight:"0.4rem"}}),"Open Support Tickets",(j.openCount??0)>0&&s.jsx("span",{className:"adash-badge-red",children:j.openCount})]}),(j.openTickets||[]).length===0?s.jsx("p",{className:"adash-empty-note",children:"No open tickets."}):s.jsx("div",{className:"adash-ticket-list",children:j.openTickets.map(e=>s.jsxs("div",{className:"adash-ticket-row",children:[s.jsxs("div",{className:"adash-ticket-main",children:[s.jsx("span",{className:"adash-ticket-title",children:e.title}),s.jsxs("span",{className:"adash-ticket-meta",children:[e.userName," · ",e.userEmail]})]}),s.jsxs("div",{className:"adash-ticket-right",children:[e.topic&&s.jsx("span",{className:"adash-topic-pill",children:e.topic}),s.jsx("span",{className:"adash-ticket-date",children:_(e.createdAt)})]})]},e.id))})]})]}),(x.cards||[]).length>0&&s.jsxs("section",{className:"adash-section",children:[s.jsxs("h2",{className:"adash-section-title",children:["Printhouses",s.jsx("span",{className:"adash-section-count",children:x.total??x.cards.length})]}),s.jsx("div",{className:"adash-ph-grid",children:x.cards.map(e=>s.jsxs("article",{className:`panel adash-ph-card${e.isActive?"":" adash-ph-inactive"}`,children:[s.jsxs("div",{className:"adash-ph-head",children:[s.jsx("div",{className:"adash-ph-avatar",children:(e.printhouseName||e.email||"?")[0].toUpperCase()}),s.jsxs("div",{children:[s.jsx("strong",{className:"adash-ph-name",children:e.printhouseName}),s.jsx("span",{className:"adash-ph-email",children:e.email})]}),!e.isActive&&s.jsx("span",{className:"adash-ph-inactive-badge",children:"Inactive"})]}),s.jsxs("div",{className:"adash-ph-stats",children:[s.jsxs("div",{className:"adash-ph-stat",children:[s.jsx("span",{children:"Assigned"}),s.jsx("strong",{children:t(e.totalAssigned)})]}),s.jsxs("div",{className:"adash-ph-stat",children:[s.jsx("span",{children:"Accepted"}),s.jsx("strong",{className:"text-green",children:t(e.accepted)})]}),s.jsxs("div",{className:"adash-ph-stat",children:[s.jsx("span",{children:"Rejected"}),s.jsx("strong",{className:e.rejected>0?"text-red":"",children:t(e.rejected)})]}),s.jsxs("div",{className:"adash-ph-stat",children:[s.jsx("span",{children:"Shipped"}),s.jsx("strong",{children:t(e.shipped)})]}),s.jsxs("div",{className:"adash-ph-stat",children:[s.jsx("span",{children:"Printed"}),s.jsx("strong",{children:t(e.printed)})]}),s.jsxs("div",{className:"adash-ph-stat",children:[s.jsx("span",{children:"Total Inch"}),s.jsxs("strong",{children:[t(e.totalInchPrinted,1),'"']})]})]})]},e.printhouseId))})]})]})]})})}export{ls as AdminDashboardPage};

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.