PageSourceSearch

https://www.raymondmusic.com/assets/WebOrders-CTSHNtpa.js

js raymondmusic.com collected 2026-10-06 19:42:14 UTC 11,069 bytes, 1 lines download raw bytes

1import{f as g,G as A,e as O,j as e,S as b,C as B,F as d,x as P,h as E,g as F,d as T,m as r,r as V,E as I,i as k,b as D,z as M,J as q}from"./index-ChuvAvcO.js";const N=[{value:"new",label:"New"},{value:"paid",label:"Paid"},{value:"ready",label:"Ready for pickup"},{value:"shipped",label:"Shipped"},{value:"completed",label:"Completed"},{value:"cancelled",label:"Cancelled"}],L=l=>{var u;return((u=N.find(n=>n.value===l))==null?void 0:u.label)||l},R={paid:"Paid",refunded:"Refunded",unpaid:"Unpaid"},$=l=>R[l]||"Unpaid";function G(){var y,s,v;const[l,u]=g.useState(""),[n,i]=g.useState(""),[h,p]=g.useState(null),j=A(l,250),c=O(()=>k.webOrders({q:j,status:n}),[j,n]),m=((y=c.data)==null?void 0:y.orders)||[],_=((s=c.data)==null?void 0:s.counts)||{};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"page-head",children:e.jsxs("div",{children:[e.jsx("h1",{children:"Online Orders"}),e.jsx("div",{className:"sub",children:"Orders placed on your public storefront"})]})}),e.jsxs("div",{className:"grid k3",style:{marginBottom:16},children:[e.jsx(b,{label:"Needs attention",value:((v=c.data)==null?void 0:v.open)??0,accent:!0}),e.jsx(b,{label:"Awaiting payment",value:_.new??0}),e.jsx(b,{label:"Completed",value:_.completed??0})]}),e.jsx(B,{children:e.jsxs("div",{className:"filters",children:[e.jsx(d,{label:"Search",style:{flex:1,minWidth:220},children:e.jsx("input",{type:"search",value:l,onChange:a=>u(a.target.value),autoFocus:!0,placeholder:"Order number, name or email…"})}),e.jsx(d,{label:"Status",children:e.jsx(P,{value:n,onChange:a=>i(a.target.value),placeholder:"All",options:N})})]})}),e.jsxs(B,{title:`Orders (${m.length})`,tight:!0,children:[e.jsx(E,{error:c.error}),c.loading?e.jsx(F,{}):m.length?e.jsx("div",{className:"table-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Order"}),e.jsx("th",{children:"Placed"}),e.jsx("th",{children:"Customer"}),e.jsx("th",{children:"Fulfillment"}),e.jsx("th",{children:"Payment"}),e.jsx("th",{children:"Status"}),e.jsx("th",{className:"r",children:"Total"})]})}),e.jsx("tbody",{children:m.map(a=>e.jsxs("tr",{...V(()=>p(a.id),`Open order ${a.order_number}`),children:[e.jsx("td",{children:e.jsx("strong",{children:a.order_number})}),e.jsx("td",{children:T(a.created_at)}),e.jsxs("td",{children:[a.first_name," ",a.last_name,e.jsx("div",{className:"muted",style:{fontSize:12},children:a.email})]}),e.jsx("td",{children:a.fulfillment==="ship"?"Ship":"Pickup"}),e.jsx("td",{children:e.jsx("span",{className:`badge ${a.payment_status==="paid"?"ok":a.payment_status==="refunded"?"grey":"warn"}`,children:$(a.payment_status)})}),e.jsx("td",{children:L(a.status)}),e.jsx("td",{className:"r",children:r(a.total)})]},a.id))})]})}):e.jsx(I,{icon:"⊙",children:"No online orders yet."})]}),h&&e.jsx(U,{id:h,onClose:()=>p(null),onSaved:()=>{c.reload()}})]})}function U({id:l,onClose:u,onSaved:n}){const i=D(),h=O(()=>k.webOrder(l),[l]),[p,j]=g.useState(!1),[c,m]=g.useState(!1),[_,y]=M(),s=h.data,v=async()=>{m(!0);try{const t=await k.buyShippingLabel(l);h.setData(t),n==null||n(),i(`Label bought — tracking ${t.tracking_number}`,"ok")}catch(t){i(t.message,"err")}finally{m(!1)}},a=async t=>{var x,C;j(!0);try{const o=await k.updateWebOrder(l,t);if((C=(x=o.stock)==null?void 0:x.warnings)!=null&&C.length)o.stock.warnings.forEac
1h(f=>i(f,"warn"));else if(t.payment_status==="paid")i("Marked paid — stock adjusted","ok");else if(t.status==="cancelled"){const f=["Order cancelled"];o.restored_stock&&f.push("stock put back"),o.refunded&&f.push(`${r(o.refund_amount)} refunded`),i(f.join(" — "),"ok"),o.needs_manual_refund&&i("This order was paid by hand — refund the customer yourself; that part isn’t automated","warn")}else t.status==="shipped"?i("Marked shipped","ok"):i("Order updated","ok");h.setData(o),n==null||n()}catch(o){i(o.message,"err")}finally{j(!1)}},S=()=>{if(!String(s.tracking_number||"").trim()){i("Add a tracking number before marking this shipped","err");return}a({status:"shipped"})},z=(s==null?void 0:s.payment_status)==="paid"&&!!s.provider_txn_id&&!!s.provider&&s.provider!=="manual",w=async()=>{const t=["Cancel this order?"];s.stock_drawn&&t.push("Stock already drawn for it will be put back."),z?t.push(`${r(s.total)} will be refunded to the original card automatically.`):s.payment_status==="paid"&&t.push("It was paid by hand — you'll still need to refund the customer yourself."),await _(t.join(" "),{confirmLabel:"Cancel order",danger:!0})&&await a({status:"cancelled"})};return e.jsxs(e.Fragment,{children:[y,e.jsx(q,{title:s?`Order ${s.order_number}`:"Order",badge:s?L(s.status):null,onClose:u,footer:s&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:u,children:"Close"}),!["cancelled","completed"].includes(s.status)&&e.jsx("button",{className:"danger",disabled:p,onClick:w,children:"Cancel order"}),s.fulfillment==="ship"&&!["shipped","completed","cancelled"].includes(s.status)&&e.jsx("button",{disabled:p,onClick:S,children:"Mark shipped"}),s.payment_status!=="paid"&&s.status!=="cancelled"&&e.jsx("button",{className:"primary",disabled:p,onClick:()=>a({payment_status:"paid"}),children:"Mark paid"})]}),children:h.loading||!s?e.jsx(F,{}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid k2",style:{marginBottom:14},children:[e.jsx(b,{label:"Total",value:r(s.total)}),e.jsx(b,{label:"Payment",value:$(s.payment_status)})]}),s.payment_status==="unpaid"&&s.status!=="cancelled"&&e.jsx("div",{className:"banner warn",style:{marginBottom:14},children:"Stock is drawn down when this order is marked paid — not before."}),s.payment_status==="refunded"&&e.jsxs("div",{className:"banner info",style:{marginBottom:14},children:["Refunded",s.refund_amount?` ${r(s.refund_amount)}`:""," back to the original card",s.refunded_at?` on ${T(s.refunded_at)}`:"","."]}),s.status==="cancelled"&&s.payment_status==="paid"&&e.jsx("div",{className:"banner warn",style:{marginBottom:14},children:"Cancelled after being paid by hand — refund the customer yourself; that part isn’t automated."}),e.jsx(d,{label:"Status",children:e.jsx(P,{value:s.status,options:N,onChange:t=>{const x=t.target.value;if(x==="cancelled"){w();return}if(x==="shipped"&&s.fulfillment==="ship"){S();return}a({status:x})}})}),s.fulfillment==="ship"&&s.shippo_rate_id&&e.jsx("div",{className:"soft",style:{padding:12,marginBottom:14},children:s.label_url?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:6},children:[e.jsxs("strong",{children:[s.shipping_carrier," ",s.shipping_service]}),s.label_cost!=null&&e.jsxs("span",{className:"muted",children:[" — ",r(s.label_cost)]})]}),e.jsx("a",{href:s.label_url,target:"_blank",rel:"noreferrer",children:"Print label (PDF) →"}),s.tracking_url&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("a",{href:s.tracking_url,target:"_blank",rel:"noreferrer",children:"Track shipment →"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:8},children:[e.jsxs("strong",{children:[s.shipping_carrier," ",s.shipping_service]})," — ",r(s.shipping)," quoted at checkout, not yet purchased."]}),e.jsx("button",{type:"button",className:"sm primary",disabled:c,onClick:v,children:c?"Buying label…":"Buy shipping label"})]})}),s.fulfillment==="ship"&&e.jsx(d,{label:"Tracking number",hint:"Shown to the customer on their order page.",children:e.jsx("input",{type:"text",defaultValue:s.tracking_number||"",onBlur:t=>{t.target.value!==(s.tracking_number||"")&&a({tracking_number:t.target.value})}})}),e.jsx(d,{label:"Staff note",hint:"Internal — never shown on the storefront.",children:e.jsx("textarea",{rows:"2",defaultValue:s.staff_note||"",onBlur:t=>{t.target.value!==(s.staff_note||"")&&a({staff_note:t.target.value})}})}),e.jsx("h3",{style:{margin:"18px 0 8px"},children:"Items"}),e.jsx("table",{className:"tbl",children:e.jsxs("tbody",{children:[s.lines.map(t=>e.jsxs("tr",{children:[e.jsxs("td",{children:[t.title,t.variant_label&&e.jsx("div",{className:"muted",style:{fontSize:12},children:t.variant_label}),t.sku&&e.jsxs("div",{className:"muted",style:{fontSize:12},children:["#",t.sku]})]}),e.jsxs("td",{className:"r",children:[t.qty," × ",r(t.unit_price)]}),e.jsx("td",{className:"r",children:r(t.line_total)})]},t.id)),e.jsxs("tr",{children:[e.jsx("td",{colSpan:"2",className:"r",children:"Subtotal"}),e.jsx("td",{className:"r",children:r(s.subtotal)})]}),s.discount>0&&e.jsxs("tr",{children:[e.jsxs("td",{colSpan:"2",className:"r",children:["Discount",s.promo_code?` (${s.promo_code})`:""]}),e.jsxs("td",{className:"r",children:["−",r(s.discount)]})]}),s.shipping>0&&e.jsxs("tr",{children:[e.jsx("td",{colSpan:"2",className:"r",children:"Shipping"}),e.jsx("td",{className:"r",children:r(s.shipping)})]}),e.jsxs("tr",{children:[e.jsx("td",{colSpan:"2",className:"r",children:"Tax"}),e.jsx("td",{className:"r",children:r(s.tax)})]}),e.jsxs("tr",{children:[e.jsx("td",{colSpan:"2",className:"r",children:e.jsx("strong",{children:"Total"})}),e.jsx("td",{className:"r",children:e.jsx("strong",{children:r(s.total)})})]})]})}),e.jsx("h3",{style:{margin:"18px 0 8px"},children:"Customer"}),e.jsxs("p",{className:"soft",style:{margin:"0 0 8px"},children:[s.first_name," ",s.last_name,e.jsx("br",{}),s.email]}),e.jsx(d,{label:"Phone",children:e.jsx("input",{type:"text",defaultValue:s.phone||"",onBlur:t=>{t.target.value!==(s.phone||"")&&a({phone:t.target.value})}})}),s.fulfillment==="ship"&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{margin:"18px 0 8px"},children:"Ship to"}),e.jsx(d,{label:"Address line 1",children:e.jsx("input",{type:"text",defaultValue:s.ship_address1||"",onBlur:t=>{t.target.value!==(s.ship_address1||"")&&a({ship_address1:t.target.value})}})}),e.jsx(d,{label:"Address line 2",children:e.jsx("input",{type:"text",defaultValue:s.ship_address2||"",onBlur:t=>{t.target.value!==(s.ship_address2||"")&&a({ship_address2:t.target.value})}})}),e.jsxs("div",{className:"grid k3",style:{gap:12},children:[e.jsx(d,{label:"City",children:e.jsx("input",{type:"text",defaultValue:s.ship_city||"",onBlur:t=>{t.target.value!==(s.ship_city||"")&&a({ship_city:t.target.value})}})}),e.jsx(d,{label:"State",children:e.jsx("input",{type:"text",defaultValue:s.ship_state||"",maxLength:2,onBlur:t=>{t.target.value!==(s.ship_state||"")&&a({ship_state:t.target.value})}})}),e.jsx(d,{label:"ZIP",children:e.jsx("input",{type:"text",defaultValue:s.ship_zip||"",onBlur:t=>{t.target.value!==(s.ship_zip||"")&&a({ship_zip:t.target.value})}})})]})]}),s.customer_note&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{margin:"18px 0 8px"},children:"Customer note"}),e.jsx("p",{className:"soft",style:{margin:0},children:s.customer_note})]}),s.card_last4&&e.jsxs("p",{className:"muted",style:{fontSize:12,marginTop:16},children:["Paid by ",s.card_brand||"card"," ending ",s.card_last4,s.provider_txn_id?` · txn ${s.provider_txn_id}`:""]}),s.provider==="affirm"&&e.jsxs("p",{className:"muted",style:{fontSize:12,marginTop:16},children:["Paid through Affirm financing",s.provider_txn_id?` · txn ${s.provider_txn_id}`:""]})]})})]})}export{G 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.