PageSourceSearch

https://acd.net/assets/page-cJAderne.js

js acd.net collected 2026-10-02 07:44:32 UTC 15,231 bytes, 12 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/orderSpreadsheetExport-Cg_uAYCe.js","assets/index-Fv0Y8G9v.js","assets/index-PDOZJ9Qn.css","assets/orderExport-BHbSP-32.js"])))=>i.map(i=>d[i]);
2import{h as de,j as e,r as a,E as fe,_ as ve}from"./index-Fv0Y8G9v.js";import{B as be,f as Ne,g as we,h as Se,L as Q}from"./table-CcXGJgNm.js";import{u as Ce,B as f}from"./button-s8zn25Gf.js";import{B as v}from"./badge-B91cmS9u.js";import{I as ye}from"./input-Cwmn-aYs.js";import{L as X}from"./label-QAW1u-q7.js";import{S as A,a as M,b as O,c as P,d as l}from"./select-BEQkCKDg.js";import{S as _e,f as ke,o as g,a as Ae,b as Me,c as Oe,d as Pe,e as Te,g as Ie,h as Ve,i as Fe,j as Le,k as Y,l as m,m as De,n as Ee,p as Re,q as u,r as T,s as ee,t as V,u as se,v as te,w as We}from"./store-management-feature-Dj2WZMFR.js";import{c as Be,b as ae,o as R,t as W,f as re,a as Ue}from"./presentation-DUOTBFP7.js";import{r as ze}from"./publicUrls-D7xvHmQw.js";import{d as Ze,g as ne,o as $e,a as He,A as qe}from"./orderExport-BHbSP-32.js";import{c as I,a as w,F as Ge,b as le}from"./orderStatus-CB7nDMVb.js";import{R as Je}from"./refresh-cw-Fo_Hwnh2.js";import{C as Ke}from"./chevron-left-DCpUtozC.js";import{C as Qe}from"./chevron-right-D03gvZ64.js";import"./index-CATLUnVV.js";import"./index-CIhm4SKu.js";import"./index-BnUBBEH7.js";import"./check-B8EA-nZ0.js";import"./card-Bj_uBjFo.js";import"./loader-circle-CiHnWQFx.js";import"./circle-alert-Hq02mjqh.js";import"./shield-off-C2fVq5Ht.js";import"./sliders-horizontal-DVit5ja2.js";import"./page-D4t8fuBl.js";import"./index-DQZEJAgF.js";import"./index-Djc1z9r7.js";import"./textarea-9zsTqu3i.js";import"./OrderOverview-Bw-uc3-P.js";import"./priceSchedule-DY1XN4yB.js";import"./map-pin-BSp0XVdl.js";import"./user-round-B4txPYec.js";import"./calendar-clock-CMBwC08d.js";import"./earth-DJuQr10i.js";/**
3 * @license lucide-react v0.468.0 - ISC
4 *
5 * This source code is licensed under the ISC license.
6 * See the LICENSE file in the root directory of this source tree.
7 */const Xe=de("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/**
8 * @license lucide-react v0.468.0 - ISC
9 *
10 * This source code is licensed under the ISC license.
11 * See the LICENSE file in the root directory of this source tree.
12 */const Ye=de("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]),es=[10,20,50,100],ss=ze(typeof window<"u"?window.location.href:"https://acd.net/"),ts=(x,o)=>[...x].sort((c,b)=>{if(o==="created_desc")return Date.parse(V(b))-Date.parse(V(c));const h=o.endsWith("_asc")?1:-1,S=o.startsWith("agent_")?g(c):w(c.status),N=o.startsWith("agent_")?g(b):w(b.status);return S.localeCompare(N)*h}),ie=({active:x,descending:o})=>x?o?e.jsx(He,{className:"h-3.5 w-3.5","aria-hidden":"true"}):e.jsx(qe,{className:"h-3.5 w-3.5","aria-hidden":"true"}):e.jsx(Xe,{className:"h-3.5 w-3.5","aria-hidden":"true"}),as=()=>{const[x,o]=a.useState(""),[c,b]=a.useState("all"),[h,S]=a.useState("all"),[N,oe]=a.useState(!1),[r,B]=a.useState("created_desc"),[ce,F]=a.useState(1),[C,me]=a.useState(20),[U,z]=a.useState(!1),{data:Z,error:ue,isLoading:$,isValidating:L,mutate:xe}=Ce("store-management-orders-all",()=>ke(),{revalidateOnFocus:!1}),n=a.useMemo(()=>Z??[],[Z]),he=a.useMemo(()=>{const s=new Map;for(const t of n){const d=I(t.status)??t.status.toLowerCase(),j=s.get(d);s.set(d,{label:w(t.status),count:((j==null?void 0:j.count)??0)+1})}return[...s.entries()].sort(([,t],[,d])=>t.label.localeCompare(d.label))},[n]),pe=a.useMemo(()=>[...new Set(n.map(g).filter(s=>s!=="—"))].sort((s,t)=>s.localeCompare(t)),[n]),i=a.useMemo(()=>{const s=n.filter(t=>{const d=I(t.status)??t.status.toLowerCase();return(c==="all"||d===c)&&(h==="all"||g(t)===h)&&Ae(t,x)});return ts(s,r)},[h,n,x,r,c]),y=Math.max(1,Math.ceil(i.length/C)),_=Math.min(ce,y),k=(_-1)*C,D=i.slice(k,k+C),H=i.map(Be),E=a.useMemo(()=>({total:n.length,review:n.filter(s=>I(s.status)==="awaiting_internal_review").length,completed:n.filter(s=>I(s.status)==="completed").length}),[n]),p=()=>F(1),ge=()=>Ze($e(H),ne("orders","csv")),je=async()=>{z(!0);try{const{downloadOrdersSpreadsheet:s}=await ve(async()=>{const{downloadOrdersSpreadsheet:t}=await import("./orderSpreadsheetExport-Cg_uAYCe.js");return{downloadOrdersSpreadsheet:t}},__vite__mapDeps([0,1,2,3]));await s(H,ne("orders","xlsx"))}finally{z(!1)}},q=s=>{B(t=>t===`${s}_asc`?`${s}_desc`:`${s}_asc`),p()};return e.jsxs(Me,{maxWidth:"7xl",children:[e.jsx(Oe,{title:"Orders",description:"View and manage customer orders.",refreshing:L&&!$,breadcrumbs:e.jsx(be,{children:e.jsx(Ne,{children:e.jsx(we,{children:e.jsx(Se,{children:"Orders"})})})}),actions:e.jsxs(e.Fragment,{children:[e.jsxs(f,{type:"button",variant:"outline",onClick:()=>void xe(),disabled:L,children:[e.jsx(Je,{className:`mr-2 h-4 w-4${L?" animate-spin":""}`,"aria-hidden":"true"}),"Refresh"]}),e.jsx(f,{asChild:!0,variant:"outline",children:e.jsxs("a",{href:ss,children:["Catalog and markets ",e.jsx(fe,{className:"ml-2 h-4 w-4","aria-hidden":"true"})]})})]})}),e.jsx(Pe,{stats:[{label:"Total orders",value:E.total,description:"All"},{label:"Awaiting review",value:E.review,description:"Staff action needed",tone:"warning"},{label:"Completed",value:E.completed,description:"Finished",tone:"success"}]}),e.jsx(Te,{filters:{open:N,onToggle:()=>
12oe(s=>!s),activeCount:h==="all"?0:1,onReset:()=>{S("all"),p()},label:N?"Hide filters":"Filters"},primaryControl:e.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-3",children:[e.jsx(X,{className:"text-sm text-muted-foreground",htmlFor:"store-order-status",children:"Status"}),e.jsxs(A,{value:c,onValueChange:s=>{b(s),p()},children:[e.jsx(M,{id:"store-order-status",className:"w-full sm:w-[260px]","aria-label":"Order status",children:e.jsx(O,{})}),e.jsxs(P,{children:[e.jsxs(l,{value:"all",children:["All orders (",n.length,")"]}),he.map(([s,t])=>e.jsxs(l,{value:s,children:[t.label," (",t.count,")"]},s))]})]})]}),search:e.jsx(ye,{"aria-label":"Search orders",placeholder:"Search orders...",className:"w-full sm:w-[320px]",value:x,onChange:s=>{o(s.target.value),p()}}),actions:e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[e.jsxs(f,{variant:"outline",className:"gap-2",onClick:ge,disabled:i.length===0,children:[e.jsx(Ge,{className:"h-4 w-4","aria-hidden":"true"})," Export CSV"]}),e.jsxs(f,{variant:"outline",className:"gap-2",onClick:()=>void je(),disabled:i.length===0||U,children:[e.jsx(Ye,{className:"h-4 w-4","aria-hidden":"true"})," ",U?"Exporting...":"Export Spreadsheet"]})]})}),e.jsx(Ie,{open:N,children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(X,{htmlFor:"store-order-agent",children:"Submitting agent"}),e.jsxs(A,{value:h,onValueChange:s=>{S(s),p()},children:[e.jsx(M,{id:"store-order-agent",children:e.jsx(O,{})}),e.jsxs(P,{children:[e.jsx(l,{value:"all",children:"All submitting agents"}),pe.map(s=>e.jsx(l,{value:s,children:s},s))]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Uses the canonical commerce submitting-agent field."})]})}),e.jsx(Ve,{padded:!1,children:$?e.jsx("div",{className:"space-y-3 p-6",role:"status","aria-label":"Loading orders",children:[0,1,2].map(s=>e.jsx("div",{className:"h-14 animate-pulse rounded-lg bg-muted/60"},s))}):ue?e.jsxs("div",{className:"p-8 text-center",role:"alert",children:[e.jsx("p",{className:"font-medium text-destructive",children:"Orders could not be loaded."}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Confirm the commerce gateway and ACD tenant configuration, then try again."})]}):i.length===0?e.jsxs("div",{className:"m-6 rounded-2xl border border-dashed border-border bg-muted/30 px-6 py-16 text-center",children:[e.jsx("p",{className:"font-medium text-foreground",children:"No orders found"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Try expanding your search or filters."})]}):e.jsxs("div",{className:"space-y-4 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Sort"}),e.jsxs(A,{value:r,onValueChange:s=>{B(s),p()},children:[e.jsx(M,{className:"h-9 w-[190px]","aria-label":"Sort orders",children:e.jsx(O,{})}),e.jsxs(P,{children:[e.jsx(l,{value:"created_desc",children:"Newest first"}),e.jsx(l,{value:"agent_asc",children:"Agent A–Z"}),e.jsx(l,{value:"agent_desc",children:"Agent Z–A"}),e.jsx(l,{value:"status_asc",children:"Status A–Z"}),e.jsx(l,{value:"status_desc",children:"Status Z–A"})]})]})]}),e.jsx("div",{className:"hidden overflow-hidden rounded-2xl border border-border bg-card/70 lg:block",children:e.jsxs(Fe,{className:"table-fixed",children:[e.jsx(Le,{children:e.jsxs(Y,{children:[e.jsx(m,{className:"w-[16%]",children:"Order"}),e.jsx(m,{className:"w-[18%]",children:"Customer"}),e.jsx(m,{className:"w-[10%]","aria-sort":r.startsWith("agent_")?r.endsWith("asc")?"ascending":"descending":"none",children:e.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>q("agent"),children:["Agent"," ",e.jsx(ie,{active:r.startsWith("agent_"),descending:r.endsWith("desc")})]})}),e.jsx(m,{className:"w-[12%]","aria-sort":r.startsWith("status_")?r.endsWith("asc")?"ascending":"descending":"none",children:e.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>q("status"),children:["Status"," ",e.jsx(ie,{active:r.startsWith("status_"),descending:r.endsWith("desc")})]})}),e.jsx(m,{className:"w-[14%]",children:"Signals"}),e.jsx(m,{className:"w-[8%] text-right",children:"Total"}),e.jsx(m,{className:"w-[10%]",children:"Created"}),e.jsx(m,{className:"w-[12%]",children:"Install / IP"})]})}),e.jsx(De,{children:D.map(s=>{var G,J,K;const t=((G=s.line_items_snapshot)==null?void 0:G.length)??0,d=Ee(s),j=Re(s).length;return e.jsxs(Y,{children:[e.jsxs(u,{className:"overflow-hidden",children:[e.jsx(Q,{className:"block max-w-full truncate rounded-sm font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",href:`/admin/store/orders/${encodeURIComponent(s.order_id)}`,children:ae(s)}),s.friendly_order_id?e.jsx("div",{className:"max-w-[160px] truncate text-xs text-muted-foreground",title:s.order_id,children:s.order_id}):null]}),e.jsxs(u,{className:"overflow-hidden",children:[e.jsx("div",{className:"truncate font-medium",title:R(s),children:R(s)}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",title:W((J=s.customer_snapshot)==null?void 0:J.email)||"—",children:W((K=s.customer_snapshot)==null?void 0:K.email)||"—"})]}),e.jsx(u,{className:"overflow-hidden text-muted-foreground",children:e.jsx("div",{className:"truncate",title:g(s),children:g(s)})}),e.jsx(u,{className:"overflow-hidden",children:e.jsx(v,{className:"max-w-full truncate",variant:le(s.status),children:w(s.status)})}),e.jsx(u,{children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[g(s)!=="—"?e.jsx(v,{variant:"secondary",children:"Agent"}):null,e.jsxs(v,{variant:"secondary",children:["Products ",t]}),d>0?e.jsxs(v,{variant:"secondary",children:["Discounts ",d]}):null,j>0?e.jsxs(v,{variant:"secondary",children:["Notes ",j]}):null]})}),e.jsx(u,{className:"text-right font-medium",children:T(s)>0?re(T(s)):"—"}),e.jsx(u,{className:"text-xs leading-5 text-muted-foreground",children:ee(V(s))}),e.jsxs(u,{className:"overflow-hidden",children:[e.jsx("span",{className:"block truncate text-muted-foreground",title:se(s)||"—",children:se(s)||"—"}),e.jsxs("span",{className:"block truncate text-xs text-muted-foreground",title:te(s)||"—",children:["IP ",te(s)||"—"]}
12)]})]},s.order_id)})})]})}),e.jsx("div",{className:"grid gap-4 lg:hidden",children:D.map(s=>{var t;return e.jsxs("article",{className:"rounded-2xl border border-border bg-card/70 p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(Q,{className:"block truncate rounded-sm font-semibold text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",href:`/admin/store/orders/${encodeURIComponent(s.order_id)}`,children:ae(s)}),e.jsx("p",{className:"text-sm text-muted-foreground",children:ee(V(s))})]}),e.jsx(v,{variant:le(s.status),children:w(s.status)})]}),e.jsxs("div",{className:"mt-4 grid gap-3 text-sm sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Customer"}),e.jsx("p",{className:"font-medium",children:R(s)}),e.jsx("p",{className:"text-muted-foreground",children:W((t=s.customer_snapshot)==null?void 0:t.email)||"—"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Service address"}),e.jsx("p",{className:"text-muted-foreground",children:Ue(s.service_address_snapshot)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Products"}),e.jsx("p",{children:We(s).join(", ")||"No products"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Total"}),e.jsx("p",{className:"font-semibold",children:T(s)>0?re(T(s)):"—"})]})]})]},s.order_id)})}),e.jsxs("div",{className:"flex flex-col gap-3 rounded-2xl border border-border bg-card/60 p-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",i.length===0?0:k+1,"-",k+D.length," of ",i.length," order",i.length===1?"":"s"]}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("span",{children:"Rows per page"}),e.jsxs(A,{value:String(C),onValueChange:s=>{me(Number(s)),p()},children:[e.jsx(M,{className:"h-8 w-24","aria-label":"Rows per page",children:e.jsx(O,{})}),e.jsx(P,{children:es.map(s=>e.jsx(l,{value:String(s),children:s},s))})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(f,{variant:"outline",size:"sm",className:"gap-1",onClick:()=>F(s=>Math.max(1,s-1)),disabled:_<=1,children:[e.jsx(Ke,{className:"h-4 w-4","aria-hidden":"true"})," Prev"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Page ",_," of ",y]}),e.jsxs(f,{variant:"outline",size:"sm",className:"gap-1",onClick:()=>F(s=>Math.min(y,s+1)),disabled:_>=y,children:["Next ",e.jsx(Qe,{className:"h-4 w-4","aria-hidden":"true"})]})]})]})]})]})})]})},Es=()=>e.jsx(_e,{children:e.jsx(as,{})});export{Es 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.