PageSourceSearch

https://mycurriculummate.com.au/static/js/3937.9c273e9f.chunk.js

js mycurriculummate.com.au collected 2026-09-24 14:09:52 UTC 13,653 bytes, 2 lines download raw bytes

1"use strict";(globalThis.webpackChunkfrontend=globalThis.webpackChunkfrontend||[]).push([[3937],{3937(e,t,a){a.r(t),a.d(t,{default:()=>E});var s=a(5043),r=a(3974),l=a(4980),d=a(6328),o=a(4204),n=a(3390),i=a(1140),c=a(2264),m=a(942),u=a(9766),x=a(579);const p=m.bL,h=m.l9,f=(m.Mz,s.forwardRef((e,t)=>{let{className:a,align:s="center",sideOffset:r=4,...l}=e;return(0,x.jsx)(m.ZL,{children:(0,x.jsx)(m.UC,{ref:t,align:s,sideOffset:r,className:(0,u.cn)("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",a),...l})})}));f.displayName=m.UC.displayName;var g=a(9463),b=a(8326),v=a(2363);function y(e){let{className:t,classNames:a,showOutsideDays:s=!0,...r}=e;return(0,x.jsx)(v.hv,{showOutsideDays:s,className:(0,u.cn)("p-3",t),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:(0,u.cn)((0,n.r)({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:(0,u.cn)("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md","range"===r.mode?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:(0,u.cn)((0,n.r)({variant:"ghost"}),"h-8 w-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...a},components:{IconLeft:e=>{let{className:t,...a}=e;return(0,x.jsx)(g.A,{className:(0,u.cn)("h-4 w-4",t),...a})},IconRight:e=>{let{className:t,...a}=e;return(0,x.jsx)(b.A,{className:(0,u.cn)("h-4 w-4",t),...a})}},...r})}y.displayName="Calendar";var j=a(6898),N=a(2494),w=a(2024),_=a(1457),k=a(4919),$=a(6376),S=a(5347),A=a(3639),C=a(9292);const D=e=>new Intl.NumberFormat("en-AU",{style:"currency",currency:"AUD"}).format(null!==e&&void 0!==e?e:0),L=e=>e?new Date(e).toLocaleDateString("en-AU",{day:"numeric",month:"short"}):"\u2014",z=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,R=[{key:"7",label:"7D"},{key:"30",label:"30D"},{key:"90",label:"90D"},{key:"fy",label:"This FY"}];function M(e){const t=new Date;if("fy"===e){const e=t.getMonth()>=6?t.getFullYear():t.getFullYear()-1;return{from:new Date(e,6,1),to:t}}const a=Number(e),s=new Date(t);return s.setDate(s.getDate()-(a-1)),{from:s,to:t}}const U={credit:"bg-amber-100 text-amber-700",pro:"bg-emerald-100 text-emerald-700",school:"bg-lime-100 text-lime-700"},O={credit:"Data pack",pro:"Pro",school:"School"};function T(e){let{title:t,value:a,subtitle:s,refundLine:r,icon:l,loading:d}=e;return(0,x.jsxs)(i.Zp,{children:[(0,x.jsx)(i.aR,{className:"pb-2",children:(0,x.jsxs)(i.ZB,{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[(0,x.jsx)(l,{className:"w-4 h-4 text-primary"}),t]})}),(0,x.jsxs)(i.Wu,{children:[d?(0,x.jsx)("div",{className:"h-8 w-28 bg-muted animate-pulse rounded"}):(0,x.jsx)("div",{className:"text-2xl font-bold text-foreground",children:a}),s&&(0,x.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:s}),r&&(0,x.jsx)("p",{className:"text-xs text-red-600 font-medium mt
1-1",children:r})]})]})}function E(){var e,t,a,m,u,v,E,F,P,Y,Z,I,q;const[B,W]=(0,s.useState)("90"),[V,G]=(0,s.useState)(()=>M("90")),[H,J]=(0,s.useState)(!1),[K,Q]=(0,s.useState)(V),[X,ee]=(0,s.useState)("all"),[te,ae]=(0,s.useState)(""),[se,re]=(0,s.useState)(""),[le,de]=(0,s.useState)(1),[oe,ne]=(0,s.useState)(null),[ie,ce]=(0,s.useState)(!0),[me,ue]=(0,s.useState)(!1);(0,s.useEffect)(()=>{const e=setTimeout(()=>{re(te.trim()),de(1)},350);return()=>clearTimeout(e)},[te]);const xe=(0,s.useMemo)(()=>z(V.from),[V]),pe=(0,s.useMemo)(()=>z(V.to),[V]),he=(0,s.useCallback)(async()=>{ce(!0);try{const e=await l.A.get(`${r.nC}/admin/sales`,{params:{from:xe,to:pe,type:X,q:se||void 0,page:le,page_size:25}});ne(e.data)}catch{d.oR.error("Failed to load sales log.")}finally{ce(!1)}},[xe,pe,X,se,le]);(0,s.useEffect)(()=>{he()},[he]);const fe=(null===oe||void 0===oe?void 0:oe.summary)||{},ge=(null===oe||void 0===oe?void 0:oe.rows)||[],be=(null===oe||void 0===oe?void 0:oe.total_rows)||0,ve=Math.max(1,Math.ceil(be/25)),ye="custom"===B?`${L(xe)} \u2013 ${L(pe)} (custom)`:`${L(xe)} \u2013 ${L(pe)}`,je=e=>(null===e||void 0===e?void 0:e.refunded_count)>0?`\u2212 ${D(e.refunded_aud)} refunded (${e.refunded_count})`:null;return(0,x.jsx)(o.A,{children:(0,x.jsxs)("div",{className:"space-y-6",children:[(0,x.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[(0,x.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,x.jsx)("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-amber-500 to-emerald-600 flex items-center justify-center text-white shrink-0",children:(0,x.jsx)(j.A,{className:"w-6 h-6"})}),(0,x.jsxs)("div",{className:"min-w-0",children:[(0,x.jsx)("h1",{className:"text-3xl font-bold text-foreground",children:"Sales Log"}),(0,x.jsxs)("p",{className:"text-muted-foreground",children:["Every data pack, Pro, and School sale \u2014 ",ye]})]})]}),(0,x.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,x.jsx)("div",{className:"flex rounded-md border border-border overflow-hidden",children:R.map(e=>(0,x.jsx)("button",{onClick:()=>{return t=e.key,W(t),G(M(t)),void de(1);var t},className:"px-3 py-1.5 text-sm transition-colors border-l border-border first:border-l-0 "+(B===e.key?"bg-primary text-primary-foreground":"bg-background text-muted-foreground hover:bg-muted"),children:e.label},e.key))}),(0,x.jsxs)(p,{open:H,onOpenChange:e=>{J(e),e&&Q(V)},children:[(0,x.jsx)(h,{asChild:!0,children:(0,x.jsxs)(n.$,{variant:"custom"===B?"default":"outline",size:"sm",children:[(0,x.jsx)(N.A,{className:"w-4 h-4 mr-2"}),"Custom range"]})}),(0,x.jsxs)(f,{className:"w-auto p-0",align:"end",children:[(0,x.jsx)(y,{mode:"range",selected:K,onSelect:Q,numberOfMonths:2,disabled:{after:new Date}}),(0,x.jsxs)("div",{className:"flex justify-end gap-2 p-3 border-t border-border",children:[(0,x.jsx)(n.$,{variant:"outline",size:"sm",onClick:()=>J(!1),children:"Cancel"}),(0,x.jsx)(n.$,{size:"sm",onClick:()=>{null!==K&&void 0!==K&&K.from&&null!==K&&void 0!==K&&K.to&&(G({from:K.from,to:K.to}),W("custom"),de(1),J(!1))},disabled:!(null!==K&&void 0!==K&&K.from)||!(null!==K&&void 0!==K&&K.to),children:"Apply"})]})]})]}),(0,x.jsxs)(n.$,{onClick:async()=>{ue(!0);try{const e=await l.A.get(`${r.nC}/admin/sales/export`,{params:{from:xe,to:pe,type:X,q:se||void 0},responseType:"blob"}),t=window.URL.createObjectURL(new Blob([e.data])),a=document.createElement("a");a.href=t,a.setAttribute("download",`sales-log_${xe}_${pe}.csv`),document.body.appendChild(a),a.click(),a.remove(),window.URL.revokeObjectURL(t)}catch{d.oR.error("Export failed.")}finally{ue(!1)}},disabled:me,variant:"outline",size:"sm",children:[me?(0,x.jsx)(w.A,{className:"w-4 h-4 mr-2 animate-spin"}):(0,x.jsx)(_.A,{className:"w-4 h-4 mr-2"}),"Export CSV"]})]})]}),(0,x.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[(0,x.jsx)(T,{title:"Total revenue",value:D(null===(e=fe.total)||void 0===e?void 0:e.paid_aud),subtitle:`${((null===(t=fe.total)||void 0===t?void 0:t.paid_count)||0)+((null===(a=fe.total)||void 0===a?void 0:a.refunded_count)||0)} transactions`,refundLine:je(fe.total),icon:k.A,loading:ie}),(0,x.jsx)(T,{title:"Data packs",value:D(null===(m=fe.credit)||void 0===m?void 0:m.paid_aud),subtitle:`${(null===(u=fe.credit)||void 0===u?void 0:u.paid_count)||0}
1 sold`,refundLine:je(fe.credit),icon:$.A,loading:ie}),(0,x.jsx)(T,{title:"Pro subscriptions",value:D(null===(v=fe.pro)||void 0===v?void 0:v.paid_aud),subtitle:`${(null===(E=fe.pro)||void 0===E?void 0:E.paid_count)||0} active \xb7 ${(null===(F=fe.pro)||void 0===F?void 0:F.yearly_count)||0} yearly, ${(null===(P=fe.pro)||void 0===P?void 0:P.monthly_count)||0} monthly`,refundLine:je(fe.pro),icon:S.A,loading:ie}),(0,x.jsx)(T,{title:"School seats",value:D(null===(Y=fe.school)||void 0===Y?void 0:Y.paid_aud),subtitle:`${(null===(Z=fe.school)||void 0===Z?void 0:Z.seats)||0} seats \xb7 ${(null===(I=fe.school)||void 0===I?void 0:I.schools)||0} school${1===(null===(q=fe.school)||void 0===q?void 0:q.schools)?"":"s"}`,refundLine:je(fe.school),icon:A.A,loading:ie})]}),(0,x.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,x.jsxs)("div",{className:"relative flex-1 min-w-[200px]",children:[(0,x.jsx)(C.A,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,x.jsx)(c.p,{value:te,onChange:e=>ae(e.target.value),placeholder:"Search by name, email, or school\u2026",className:"pl-9"})]}),(0,x.jsx)("div",{className:"flex rounded-md border border-border overflow-hidden",children:["all","credit","pro","school"].map(e=>(0,x.jsx)("button",{onClick:()=>{ee(e),de(1)},className:"px-3 py-1.5 text-sm capitalize transition-colors border-l border-border first:border-l-0 "+(X===e?"bg-primary text-primary-foreground":"bg-background text-muted-foreground hover:bg-muted"),children:"all"===e?"All":"credit"===e?"Data packs":e},e))})]}),(0,x.jsx)(i.Zp,{children:(0,x.jsx)(i.Wu,{className:"p-0 overflow-x-auto",children:(0,x.jsxs)("table",{className:"w-full text-sm min-w-[720px]",children:[(0,x.jsx)("thead",{children:(0,x.jsxs)("tr",{className:"border-b border-border bg-muted/40",children:[(0,x.jsx)("th",{className:"text-left py-2.5 px-4 font-semibold text-xs uppercase tracking-wide text-muted-foreground",children:"Date"}),(0,x.jsx)("th",{className:"text-left py-2.5 px-4 font-semibold text-xs uppercase tracking-wide text-muted-foreground",children:"Customer"}),(0,x.jsx)("th",{className:"text-left py-2.5 px-4 font-semibold text-xs uppercase tracking-wide text-muted-foreground",children:"Type"}),(0,x.jsx)("th",{className:"text-left py-2.5 px-4 font-semibold text-xs uppercase tracking-wide text-muted-foreground",children:"Detail"}),(0,x.jsx)("th",{className:"text-right py-2.5 px-4 font-semibold text-xs uppercase tracking-wide text-muted-foreground",children:"Amount"}),(0,x.jsx)("th",{className:"text-left py-2.5 px-4 font-semibold text-xs uppercase tracking-wide text-muted-foreground",children:"Status"})]})}),(0,x.jsxs)("tbody",{children:[ie&&(0,x.jsx)("tr",{children:(0,x.jsx)("td",{colSpan:6,className:"text-center py-10 text-muted-foreground",children:(0,x.jsx)(w.A,{className:"w-5 h-5 animate-spin inline-block"})})}),!ie&&0===ge.length&&(0,x.jsx)("tr",{children:(0,x.jsx)("td",{colSpan:6,className:"text-center py-10 text-muted-foreground text-sm",children:"No transactions match this period and filter."})}),!ie&&ge.map(e=>(0,x.jsxs)("tr",{className:"border-b border-border last:border-0 hover:bg-muted/30",children:[(0,x.jsx)("td",{className:"py-2.5 px-4 text-muted-foreground whitespace-nowrap tabular-nums",children:L(e.date)}),(0,x.jsx)("td",{className:"py-2.5 px-4 font-medium",children:e.customer_name}),(0,x.jsx)("td",{className:"py-2.5 px-4",children:(0,x.jsx)("span",{className:`inline-block text-xs font-semibold px-2 py-0.5 rounded-full ${U[e.type]}`,children:O[e.type]})}),(0,x.jsx)("td",{className:"py-2.5 px-4 text-muted-foreground",children:e.detail}),(0,x.jsx)("td",{className:"py-2.5 px-4 text-right font-semibold tabular-nums",children:D(e.amount_aud)}),(0,x.jsx)("td",{className:"py-2.5 px-4",children:e.refunded?(0,x.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-red-600 text-xs font-medium",children:[(0,x.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-red-600"}),"Refunded"]}):(0,x.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-emerald-600 text-xs font-medium",children:[(0,x.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-600"}),"Paid"]})})]},e.id))]})]})})}),be>0&&(0,x.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,x.jsxs)("span",{children:[25*(le-1)+1,"\u2013",Math.min(25*le,be)," of ",be]}),(0,x.jsxs)("div",{className:"flex gap-2",children:[(0,x.jsx)(n.$,{variant:"outline",size:"sm",disabled:le<=1,onClick:()=>de(e=>e-1),children:(0,x.jsx)(g.A,{className:"w-4 h-4"})}),(0,x.jsx)(n.$,{variant:"outline",size:"sm",disabled:le>=ve,onClick:()=>de(e=>e+1),children:(0,x.jsx)(b.A,{className:"w-4 h-4"})})]})]})]})})}}}]);
2//# sourceMappingURL=3937.9c273e9f.chunk.js.map

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.