PageSourceSearch

https://ocn-production.up.railway.app/assets/OrderDetail-K99E5sjL.js

js ocn-production.up.railway.app collected 2026-10-03 12:13:17 UTC 11,577 bytes, 1 lines download raw bytes

1import{j as e}from"./motion-5l-h5bh-.js";import{e as W,L as d}from"./react-BR8zwAvh.js";import{d as Y,P as K,F as Q,t as x,w as H,x as J,y as X,J as G,z as u,o as T,p as l,N as q,q as p,O as V,Q as Z,U as ee,M as te,s as A,h as D}from"./index-CQw4MaZD.js";import{u as se}from"./useMutation-jxKtqqRd.js";import{C as ae}from"./ChatPanel-CWJdHS29.js";import{P as ne,a as o}from"./index-ChMEbGMs.js";import{F as ie}from"./file-text-CTcP7krW.js";const I=[{key:"pending",label:"Order placed",hint:"We have your order and the brief that came with it."},{key:"confirmed",label:"Confirmed",hint:"Payment cleared and the scope is agreed."},{key:"in_progress",label:"In progress",hint:"The team is building it — updates land in the chat."},{key:"completed",label:"Delivered",hint:"Files handed over and the invoice is closed."}],re={paid:"Paid in full",unpaid:"Nothing received yet",awaiting_verification:"Transfer awaiting verification",failed:"Last payment attempt failed",refunded:"Payment refunded"};function le(a){var n,t;const i=(a.url||a.title||"").split(/[?#]/)[0];return(((n=/\.([a-z0-9]{1,5})$/i.exec(i))==null?void 0:n[1])||((t=a.mime)==null?void 0:t.split("/").pop())||"file").slice(0,4).toUpperCase()}function oe(a){var c;const i={pending:a.createdAt};for(const n of a.history||[]){const t=(c=/→\s*([a-z_]+)/.exec(n.message||""))==null?void 0:c[1];t&&!i[t]&&(i[t]=n.at)}return i}function je(){var v,w,P,S,C,$,M,F;const{id:a}
1=W(),{data:i,isLoading:c}=Y({queryKey:["customer","order",a],queryFn:async()=>(await D.get(`/customer/orders/${a}`)).data,enabled:!!a}),n=se({mutationFn:async()=>(await D.post(`/customer/orders/${a}/pay`)).data,onSuccess:({paymentUrl:s})=>{window.location.href=s},onError:s=>u.error(T(s,"Could not reopen the payment."))});if(c)return e.jsx(K,{label:"Loading order…"});if(!i)return e.jsx(Q,{icon:"SearchX",title:"Order not found",description:"It may belong to a different account.",action:e.jsx(d,{to:"/dashboard/orders",className:"btn-primary btn-sm",children:"Back to orders"})});const{order:t,conversationId:_}=i,h=t.status==="cancelled",j=h?-1:I.findIndex(s=>s.key===t.status),z=oe(t),y=t.paymentStatus==="paid",b=y?t.total:0,g=t.paymentStatus==="refunded"?0:t.total-b,f=t.paymentMethod==="crypto"?`Crypto${(v=t.crypto)!=null&&v.coin?` · ${t.crypto.coin}`:""}`:"aamarPay",E=t.paymentMethod==="crypto"&&!y,R=!h&&(t.paymentStatus==="unpaid"||t.paymentStatus==="failed"||!!((w=t.crypto)!=null&&w.rejectionReason)),m=t.deliverables||[],N=t.history||[],k=`/track-order?orderNo=${t.orderNo}&email=${encodeURIComponent(t.customer.email)}`,B=[t.items.length>1?`${t.items.length} items`:(P=t.items[0])==null?void 0:P.packageName,`ordered ${x(t.createdAt)}`].filter(Boolean).join(" · ");return e.jsxs(ne,{title:((S=t.items[0])==null?void 0:S.title)||t.orderNo,description:e.jsxs("span",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1.5",children:[e.jsx(d,{to:"/dashboard/orders",className:"font-mono text-[11px] uppercase tracking-[0.12em] text-ink-400 transition-colors hover:text-ink-700",children:"My orders"}),e.jsx("span",{"aria-hidden":!0,className:"font-mono text-[11px] text-ink-300",children:"/"}),e.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.12em] text-brand-600",children:t.orderNo}),e.jsx("span",{children:B}),e.jsx("span",{className:`badge ${A(t.status)}`,children:p(t.status)}),e.jsx("span",{className:`badge ${A(t.paymentStatus)}`,children:p(t.paymentStatus)})]}),actions:e.jsxs(e.Fragment,{children:[e.jsxs(d,{to:`/dashboard/orders/${t._id}/invoice`,className:"btn-secondary btn-sm",children:[e.jsx(ie,{className:"h-4 w-4"})," Invoice"]}),e.jsxs("a",{href:"#order-chat",className:"btn-primary btn-sm",children:[e.jsx(te,{className:"h-4 w-4"})," Message the team"]})]}),children:[e.jsx(o,{title:"Progress",children:h?e.jsx("p",{className:"rounded-lg border border-red-200 bg-red-50 p-4 text-sm leading-6 text-red-800",children:"This order was cancelled. Talk to us below if that was not expected."}):e.jsx(H,{as:"ol",className:"grid gap-5 sm:grid-cols-2 lg:grid-cols-4",children:I.map((s,r)=>{const L=r<=j,U=r===j,O=z[s.key];return e.jsxs(J,{as:"li",children:[e.jsx("div",{className:`h-1 rounded-full ${L?"bg-brand-600":"bg-ink-200"}`}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e.jsx("p",{className:`text-[15px] font-semibold ${L?"text-ink-900":"text-ink-400"}`,children:s.label}),U&&e.jsx("span",{className:"rounded-sm border border-brand-200 bg-brand-50 px-1.5 py-px font-mono text-[10px] uppercase tracking-[0.12em] text-brand-600",children:"Now"})]}),O&&e.jsx("p",{className:"mt-1 font-mono text-[10px] text-ink-400",children:x(O)}),e.jsx("p",{className:"mt-2 text-[13px] leading-5 text-ink-500",children:s.hint})]},s.key)})})}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"space-y-6 lg:col-span-2",children:[e.jsx("div",{id:"order-chat",className:"scroll-mt-24",children:e.jsx(ae,{conversationId:_,as:"customer",title:"Project chat"})}),e.jsx(o,{title:"Deliverables",bodyClassName:"p-0",actions:e.jsxs("span",{className:"font-mono text-[11px] text-ink-400",children:[m.length," file",m.length===1?"":"s"," delivered"]}),children:m.length?e.jsx("ul",{className:"divide-y divide-ink-100",children:m.map(s=>e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3.5 gap-y-2 px-5 py-3.5",children:[e.jsx("span",{className:"shrink-0 rounded-sm bg-ink-100 px-1.5 py-1 font-mono text-[10px] font-semibold text-ink-600",children:le(s)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm font-medium text-ink-900",children:s.title}),e.jsxs("p",{className:"mt-0.5 font-mono text-[10px] text-ink-400",children:[x(s.uploadedAt),s.size?` · ${X(s.size)}`:""]}),s.note&&e.jsx("p",{className:"mt-1 text-xs leading-5 text-ink-500",children:s.note})]}),e.jsx("button",{onClick:()=>G("customer",t._id,s._id).catch(r=>u.error(T(r))),className:"shrink-0 text-[13px] font-semibold text-brand-600 transition-colors hover:text-brand-700",children:"Download"})]},s._id))}):e.jsx("p",{className:"px-5 py-9 text-center text-sm text-ink-400",children:"Nothing here yet. Files appear as soon as the team hands them over."})}),N.length>0&&e.jsx(o,{title:"Activity",bodyClassName:"p-0",children:e.jsx("ol",{className:"divide-y divide-ink-100",children:N.map((s,r)=>e.jsxs("li",{className:"flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1 px-5 py-3",children:[e.jsx("p",{className:"text-[13px] leading-5 text-ink-700",children:s.message}),e.jsx("span",{className:"font-mono text-[10px] text-ink-400",children:x(s.at,!0)})]},r))})})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(o,{title:"Order summary",bodyClassName:"p-0",children:[e.jsx("ul",{className:"divide-y divide-ink-100",children:t.items.map((s,r)=>e.jsxs("li",{className:"flex items-start justify-between gap-3 px-5 py-3.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-ink-900",children:s.title}),e.jsxs("p",{className:"mt-0.5 text-xs text-ink-500",children:[s.packageName," × ",s.quantity,s.kind==="pos"&&e.jsx("span",{className:"text-brand-600",children:" · POS"})]})]}),e.jsxs("p",{className:"shrink-0 text-right font-mono text-[13px] text-ink-900",children:[l(s.price*s.quantity),q(s.billingCycle)&&e.jsx("span",{className:"block text-[10px] text-ink-400",children:q(s.billingCycle)})]})]},r))}),e.jsxs("div",{className:"space-y-2.5 px-5 py-4 text-[13px]",children:[t.discount>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 text-ink-600",children:[e.jsx("span",{children:"Subtotal"}),e.jsx("span",{className:"font-mono text-ink-900",children:l(t.subtotal)})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 text-ink-600",children:[e.jsx("span",{children:"Discount"}),e.jsxs("span",{className:"font-mono text-brand-600",children:["-",l(t.discount)]})]})]}),(t.discount>0||t.items.length>1)&&e.jsxs("div",{className:"flex items-center justify-between gap-3 text-ink-600",children:[e.jsx("span",{children:"Order total"}),e.jsx("span",{className:"font-mono text-ink-900",children:l(t.total)})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-ink-600",children:[e.jsxs("span",{children:[re[t.paymentStatus]||p(t.paymentStatus),e.jsxs("span",{className:"text-ink-400",children:[" · ",f]})]}),e.jsx("span",{className:"font-mono text-ink-900",children:l(b)})]}),e.jsxs("div",{className:"flex items-baseline justify-between gap-3 border-t border-ink-100 pt-3",children:[e.jsx("span",{className:"text-sm font-semibold text-ink-900",children:"Balance"}),e.jsx("span",{className:"font-display text-2xl text-ink-900",children:l(g)})]})]})]}),e.jsxs(o,{title:"Payment",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-brand-50 text-brand-600 ring-1 ring-brand-100",children:t.paymentMethod==="crypto"?e.jsx(V,{className:"h-4 w-4"}):e.jsx(Z,{className:"h-4 w-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-ink-900",children:f}),e.jsx("p",{className:"mt-0.5 font-mono text-[10px] uppercase tracking-[0.14em] text-ink-400",children:p(t.paymentStatus)})]})]}),E&&((C=t.crypto)==null?void 0:C.address)&&e.jsxs("div",{className:"mt-4 border-t border-ink-100 pt-4",children:[e.jsxs("p",{className:"label",children:["Send ",t.crypto.expectedAmount," ",t.crypto.coin," on ",t.crypto.network]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 break-all rounded-lg bg-ink-100 px-3 py-2 font-mono text-[11px] leading-5 text-ink-800",children:t.crypto.address}),e.jsx("button",{className:"btn-secondary btn-sm shrink-0","aria-label":"Copy wallet address",onClick:()=>{navigator.clipboard.writeText(t.crypto.address),u.success("Address copied")},children:e.jsx(ee,{className:"h-4 w-4"})})]}),e.jsx(d,{to:k,className:"btn-primary btn-sm mt-3 w-full",children:"Submit transaction hash"})]}),(($=t.crypto)==null?void 0:$.rejectionReason)&&e.jsx("p",{className:"mt-4 rounded-lg border border-red-200 bg-red-50 p-3 text-[13px] leading-5 text-red-800",children:t.crypto.rejectionReason})]}),R&&e.jsxs("div",{className:"rounded-xl border border-amber-200 bg-amber-50 p-5",children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.16em] text-amber-700",children:"Waiting on you"}),e.jsx("p",{className:"mt-2.5 text-[15px] font-semibold text-amber-900",children:(M=t.crypto)!=null&&M.rejectionReason?"Your transfer needs another look":"Payment is still open"}),e.jsx("p",{className:"mt-1.5 text-[13px] leading-5 text-amber-800",children:(F=t.crypto)!=null&&F.rejectionReason?"The last transaction hash did not check out. Send the right one and we pick the work straight back up.":`${l(g)} is outstanding. Work starts the moment the payment clears.`}),t.paymentMethod==="crypto"?e.jsx(d,{to:k,className:"btn-primary btn-sm mt-4",children:"Submit transaction hash"}):e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",className:"btn-primary btn-sm",disabled:n.isPending,onClick:()=>n.mutate(),children:n.isPending?"Opening…":"Pay now"}),e.jsx("a",{href:"#order-chat",className:"btn-secondary btn-sm",children:"Message the team"})]})]}),t.requirements&&e.jsx(o,{title:"Your brief",children:e.jsx("p",{className:"whitespace-pre-line text-sm leading-6 text-ink-600",children:t.requirements})})]})]})]})}export{je 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.