PageSourceSearch

https://utsniper.com/assets/Orders-C1Q-Toq7.js

js utsniper.com collected 2026-09-24 14:57:15 UTC 11,129 bytes, 1 lines download raw bytes

1import{r as t,j as e}from"./react-DmmmXvkf.js";import{bc as ie,j as oe,be as ce,L as H,a1 as E,S as V,a as q,b as G,c as M,d as Q,B as I,ai as me}from"./index-C1oWTp1R.js";import{e as xe,D as he}from"./DateRangePicker-Gmnh6dyo.js";import{Q as ue}from"./QueryError-Cs1v4noy.js";import{C as L,c as R}from"./card-BcT-hHLI.js";import{T as pe}from"./TableToolbar-Cr77tLaf.js";import{S as P}from"./skeleton-B3U8IGPm.js";import{T as ge,a as je,b as $,c as h,d as fe,e as i}from"./table-J6rnOMWM.js";import{D as be,a as Ne,d as we,b as ye,c as Se}from"./dialog-Ct9e3GOL.js";import{o as _,S as ve}from"./order-ref-CXz3wG3o.js";import{I as Oe}from"./input-CTSe_ZQa.js";import{u as ke}from"./i18n-DQg7CiDt.js";import{s as Ce}from"./startOfDay-BRYZsaos.js";import{A as Te}from"./arrow-left-CK39ymnU.js";import{S as De}from"./search-CEHipw6T.js";import{E as Ae}from"./eye-nZCt4RST.js";import{C as Ee}from"./chevron-left-fSIKIPdO.js";import{E as Ie}from"./external-link-CU7laT39.js";import{A as Le,a as Re}from"./arrow-up-C4UAkbTn.js";import{A as Pe}from"./arrow-up-down-DrOXbsWI.js";import"./query-BEXY55w7.js";import"./motion-BB-_2whf.js";import"./popover-D5T_GLpx.js";import"./triangle-alert-DBrVopfV.js";import"./refresh-cw-BrhrdZjd.js";import"./index-DYnXUCYV.js";const $e=20;function K(a){switch(a){case"completed":return"bg-green-500/20 text-green-500";case"pending":return"bg-yellow-500/20 text-yellow-500";case"refunded":return"bg-blue-500/20 text-blue-400";default:return"bg-red-500/20 text-red-500"}}const Fe=["all","pending","completed","cancelled","failed","refunded"],Ue=["all","payram","coinremitter","manual"];function ms(){const{t:a,i18n:u}=ke(),F=ie(),l=t.useMemo(()=>new URLSearchParams(F).get("user")??"",[F]),[c,d]=t.useState(1),[N,W]=t.useState(""),[p,Y]=t.useState(""),[g,Z]=t.useState("all"),[m,J]=t.useState("all"),[j,X]=t.useState("date"),[w,U]=t.useState("desc"),[x,ee]=t.useState(void 0),[r,y]=t.useState(null);t.useEffect(()=>{d(1)},[l]),t.useEffect(()=>{const s=setTimeout(()=>{Y(N.trim()),d(1)},300);return()=>clearTimeout(s)},[N]);const f=x?.from?Ce(x.from).toISOString():void 0,b=x?.to?xe(x.to).toISOString():void 0,se=s=>{ee(s),d(1)},ae=s=>{s===j?U(o=>o==="desc"?"asc":"desc"):(X(s),U("desc")),d(1)};oe({title:a("adminOrders.title"),noindex:!0});const{data:S,isLoading:re,isError:te,isFetching:ne,refetch:B}=ce({page:c,pageSize:$e,...p?{q:p}:{},sortBy:j,sortDir:w,status:g,...m!=="all"?{gateway:m}:{},...f?{from:f}:{},...b?{to:b}:{},...l?{user:l}:{}},{query:{queryKey:["admin-orders",c,p,g,m,j,w,f??"",b??"",l]}}),v=S?.orders??[],O=S?.totalPages??1,k=S?.stats,z=l?v[0]?.owner.username:void 0,le=!!(p||f||b||g!=="all"||m!=="all"),C=s=>new Intl.DateTimeFormat(u.language,{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(s)),T=s=>`€${s.toFixed(2)}`,D=s=>a(`dashOrders.status_${s}`,{defaultValue:s}),A=({col:s,label:o,className:de=""})=>e.jsx(h,{className:de,children:e.jsxs("button",{type:"button",onClick:()=>ae(s),className:"inline-flex items-center gap-1 hover:text-foreground transition-colors",children:[o,j===s?w==="desc"?e.jsx(Le,{className:"w-3.5 h-3.5 text-primary"}):e.jsx(Re,{className:"w-3.5 h-3.5 text-primary"}):e.jsx(Pe,{className:"w-3.5 h-3.5 opacity-40"})]})});return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[l&&e.jsxs(H,{href:"/admin/orders",className:"mb-2 inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-primary transition-colors",children:[e.jsx(Te,{className:"w-4 h-4"})," ",a("adminOrders.allOrders")]}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:z?a("adminOrders.userTitle",{user:z}):a("adminOrders.title")}),!l&&e.jsx("p",{className:"text-muted-foreground mt-1",children:a("adminOrders.subtitle")})]}),k&&e.jsxs("div",{className:"grid grid-cols-2 gap-4 max-w-md",children:[e.jsx(L,{className:"bg-card/40 border-white/[0.07]",children:e.jsxs(R,{className:"p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:a("adminOrders.completedCount")}),e.jsx("div",{className:"text-2xl font-black text-foreground mt-1",children:k.completedCount.toLocaleStr
1ing(u.language)})]})}),e.jsx(L,{className:"bg-card/40 border-white/[0.07]",children:e.jsxs(R,{className:"p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:a("adminOrders.revenue")}),e.jsx("div",{className:"text-2xl font-black text-primary mt-1",children:T(k.revenue)})]})})]}),e.jsxs(L,{className:"bg-card/40 border-white/[0.07] overflow-hidden",children:[e.jsx(pe,{icon:E,title:a("adminOrders.tableTitle"),onRefresh:()=>B(),refreshing:ne,refreshLabel:a("dashSnipes.refresh"),search:e.jsxs("div",{className:"relative w-full @xl:w-64",children:[e.jsx(De,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground pointer-events-none"}),e.jsx(Oe,{value:N,onChange:s=>W(s.target.value),placeholder:a("adminOrders.searchPlaceholder"),className:"h-9 pl-9 bg-background/50"})]}),actions:e.jsx(he,{value:x,onChange:se,align:"end",placeholder:`${a("dashSnipes.dateFrom")} – ${a("dashSnipes.dateTo")}`,clearLabel:a("dashSnipes.clearDates")}),filters:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(V,{value:g,onValueChange:s=>{Z(s),d(1)},children:[e.jsx(q,{className:"h-9 w-[150px] bg-background/50",children:e.jsx(G,{})}),e.jsx(M,{children:Fe.map(s=>e.jsx(Q,{value:s,children:s==="all"?a("adminOrders.statusAll"):D(s)},s))})]}),e.jsxs(V,{value:m,onValueChange:s=>{J(s),d(1)},children:[e.jsx(q,{className:"h-9 w-[150px] bg-background/50",children:e.jsx(G,{})}),e.jsx(M,{children:Ue.map(s=>e.jsx(Q,{value:s,children:s==="all"?a("adminOrders.gatewayAll"):s},s))})]})]})}),e.jsx(R,{className:"pt-6",children:te?e.jsx(ue,{onRetry:()=>B()}):re?e.jsxs("div",{className:"space-y-4",children:[e.jsx(P,{className:"h-14 w-full bg-secondary/50 rounded"}),e.jsx(P,{className:"h-14 w-full bg-secondary/50 rounded"}),e.jsx(P,{className:"h-14 w-full bg-secondary/50 rounded"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"rounded-xl border border-white/[0.07] overflow-x-auto",children:e.jsxs(ge,{children:[e.jsx(je,{className:"bg-white/[0.03]",children:e.jsxs($,{className:"border-white/[0.07] hover:bg-transparent",children:[e.jsx(h,{children:a("dashOrders.orderId")}),!l&&e.jsx(h,{children:a("adminOrders.buyer")}),e.jsx(h,{children:a("dashOrders.item")}),e.jsx(A,{col:"status",label:a("dashOrders.status")}),e.jsx(A,{col:"amount",label:a("dashOrders.amount"),className:"text-right"}),e.jsx(A,{col:"date",label:a("dashOrders.date"),className:"text-right"}),e.jsx(h,{className:"text-right",children:e.jsx("span",{className:"sr-only",children:a("dashOrders.actions")})})]})}),e.jsxs(fe,{children:[v.map(s=>e.jsxs($,{className:"border-white/5 hover:bg-white/5 cursor-pointer",onClick:()=>y(s),children:[e.jsxs(i,{className:"font-mono text-xs text-muted-foreground",children:["#",_(s.id)]}),!l&&e.jsxs(i,{children:[e.jsx(H,{href:`/admin/orders?user=${s.owner.uuid}`,onClick:o=>o.stopPropagation(),className:"text-sm font-medium text-foreground hover:text-primary transition-colors",children:s.owner.username}),e.jsx("div",{className:"text-xs text-muted-foreground truncate max-w-[200px]",children:s.owner.email})]}),e.jsx(i,{className:"font-medium",children:s.plan?.name||a("dashOrders.subscription")}),e.jsx(i,{children:e.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${K(s.status)}`,children:D(s.status)})}),e.jsx(i,{className:"text-right font-bold",children:T(s.amount)}),e.jsx(i,{className:"text-right text-muted-foreground text-xs whitespace-nowrap",children:C(s.createdAt)}),e.jsx(i,{className:"text-right",children:e.jsx(I,{variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-foreground",onClick:o=>{o.stopPropagation(),y(s)},children:e.jsx(Ae,{className:"w-4 h-4"})})})]},s.id)),v.length===0&&e.jsx($,{className:"hover:bg-transparent",children:e.jsx(i,{colSpan:l?6:7,className:"py-16",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-center text-muted-foreground",children:[e.jsx("span",{className:"flex h-12 w-12 items-center justify-center rounded-2xl bg-primary/10 border border-primary/20",children:e.jsx(E,{className:"w-6 h-6 text-primary/70"})}),e.jsx("p",{className:"max-w-xs text-sm",children:a(le?"dashSnipes.noResults":"adminOrders.empty")})]})})})]})]})}),O>1&&e.jsxs("div",{className:"flex items-center justify-end gap-3 mt-4 text-sm",children:[e.jsxs(I,{variant:"outline",size:"sm",disabled:c<=1,onClick:()=>d(s=>Math.max(1,s-1)),children:[e.jsx(Ee,{className:"w-4 h-4"})," ",a("dashSnipes.prev")]}),e.jsx("span",{className:"text-muted-foreground",children:a("dashSnipes.pageOf",{page:c,totalPages:O})}),e.jsxs(I,{variant:"outline",size:"sm",disabled:c>=O,onClick:()=>d(s=>s+1),children:[a("dashSnipes.next")," ",e.jsx(me,{className:"w-4 h-4"})]})]})]})})]}),e.jsx(be,{open:!!r,onOpenChange:s=>!s&&y(null),children:e.jsx(Ne,{className:"max-w-lg bg-card border-white/10",children:r&&e.jsxs(e.Fragment,{children:[e.jsxs(we,{children:[e.jsxs(ye,{className:"flex items-center gap-2",children:[e.jsx(E,{className:"w-5 h-5 text-primary"})," ",a("dashOrders.detailsTitle")]}),e.jsxs(Se,{className:"font-mono",children:["#",_(r.id)]})]}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(n,{label:a("adminOrders.buyer"),children:e.jsxs("span",{className:"text-right",children:[r.owner.username,e.jsx("span",{className:"block text-xs text-muted-foreground",children:r.owner.email})]})}),e.jsx(n,{label:a("dashOrders.status"),children:e.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${K(r.status)}`,children:D(r.status)})}),e.jsx(n,{label:a("dashOrders.item"),children:r.plan?.name||a("dashOrders.subscription")}),e.jsx(n,{label:a("dashOrders.amount"),children:e.jsx("span",{className:"font-bold",children:T(r.amount)})}),r.concurrents!=null&&e.jsx(n,{label:a("adminOrders.concurrents"),children:r.concurrents}),r.durationDays!=null&&e.jsx(n,{label:a("adminOrders.durationDays"),children:r.durationDays}),e.jsx(ve,{className:"bg-white/10"}
1),e.jsx(n,{label:a("adminOrders.gateway"),children:r.gateway}),r.network&&e.jsx(n,{label:a("adminOrders.network"),children:r.network.toUpperCase()}),r.transactionId&&e.jsx(n,{label:a("adminOrders.transactionId"),children:e.jsx("span",{className:"font-mono text-xs break-all text-right",children:r.transactionId})}),e.jsx(n,{label:a("dashOrders.date"),children:C(r.createdAt)}),r.updatedAt&&r.updatedAt!==r.createdAt&&e.jsx(n,{label:a("adminOrders.updatedAt"),children:C(r.updatedAt)}),r.paymentLink&&e.jsxs("a",{href:r.paymentLink,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-primary hover:text-primary/80 transition-colors",children:[e.jsx(Ie,{className:"w-4 h-4"})," ",a("adminOrders.openInvoice")]})]})]})})})]})}function n({label:a,children:u}){return e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("span",{className:"text-muted-foreground shrink-0",children:a}),e.jsx("span",{className:"text-right",children:u})]})}export{ms as AdminOrders};

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.