1/*! For license information please see 1158.9ee57c78.chunk.js.LICENSE.txt */ 2"use strict";(globalThis.webpackChunkfrontend=globalThis.webpackChunkfrontend||[]).push([[1158],{91140(e,t,a){a.d(t,{BT:()=>d,Wu:()=>o,ZB:()=>l,Zp:()=>n,aR:()=>c,wL:()=>m});var s=a(65043),i=a(99766),r=a(70579);const n=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,i.cn)("rounded-xl border bg-card text-card-foreground shadow",a),...s})});n.displayName="Card";const c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,i.cn)("flex flex-col space-y-1.5 p-6",a),...s})});c.displayName="CardHeader";const l=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,i.cn)("font-semibold leading-none tracking-tight",a),...s})});l.displayName="CardTitle";const d=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,i.cn)("text-sm text-muted-foreground",a),...s})});d.displayName="CardDescription";const o=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,i.cn)("p-6 pt-0",a),...s})});o.displayName="CardContent";const m=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,i.cn)("flex items-center p-6 pt-0",a),...s})});m.displayName="CardFooter"},92264(e,t,a){a.d(t,{p:()=>n});var s=a(65043),i=a(99766),r=a(70579);const n=s.forwardRef((e,t)=>{let{className:a,type:s,...n}=e;return(0,r.jsx)("input",{type:s,className:(0,i.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",a),ref:t,...n})});n.displayName="Input"},84370(e,t,a){a.d(t,{bq:()=>u,eb:()=>f,gC:()=>x,l6:()=>o,yv:()=>m});var s=a(65043),i=a(22095),r=a(36210),n=a(92382),c=a(15711),l=a(99766),d=a(70579);const o=i.bL,m=(i.YJ,i.WT),u=s.forwardRef((e,t)=>{let{className:a,children:s,...r}=e;return(0,d.jsxs)(i.l9,{ref:t,className:(0,l.cn)("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...r,children:[s,(0,d.jsx)(i.In,{asChild:!0,children:(0,d.jsx)(n.A,{className:"h-4 w-4 opacity-50"})})]})});u.displayName=i.l9.displayName;const h=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,d.jsx)(i.PP,{ref:t,className:(0,l.cn)("flex cursor-default items-center justify-center py-1",a),...s,children:(0,d.jsx)(c.A,{className:"h-4 w-4"})})});h.displayName=i.PP.displayName;const p=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,d.jsx)(i.wn,{ref:t,className:(0,l.cn)("flex cursor-default items-center justify-center py-1",a),...s,children:(0,d.jsx)(n.A,{className:"h-4 w-4"})})});p.displayName=i.wn.displayName;const x=s.forwardRef((e,t)=>{let{className:a,children:s,position:r="popper",...n}=e;return(0,d.jsx)(i.ZL,{children:(0,d.jsxs)(i.UC,{ref:t,className:(0,l.cn)("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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-select-content-transform-origin]","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:r,...n,children:[(0,d.jsx)(h,{}),(0,d.jsx)(i.LM,{className:(0,l.cn)("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),(0,d.jsx)(p,{})]})})});x.displayName=i.UC.displayName;s.forwardRef((e,t)=>
2{let{className:a,...s}=e;return(0,d.jsx)(i.JU,{ref:t,className:(0,l.cn)("px-2 py-1.5 text-sm font-semibold",a),...s})}).displayName=i.JU.displayName;const f=s.forwardRef((e,t)=>{let{className:a,children:s,...n}=e;return(0,d.jsxs)(i.q7,{ref:t,className:(0,l.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...n,children:[(0,d.jsx)("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,d.jsx)(i.VF,{children:(0,d.jsx)(r.A,{className:"h-4 w-4"})})}),(0,d.jsx)(i.p4,{children:s})]})});f.displayName=i.q7.displayName;s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,d.jsx)(i.wv,{ref:t,className:(0,l.cn)("-mx-1 my-1 h-px bg-muted",a),...s})}).displayName=i.wv.displayName},51654(e,t,a){a.d(t,{d:()=>c});var s=a(65043),i=a(77943),r=a(99766),n=a(70579);const c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(i.bL,{className:(0,r.cn)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",a),...s,ref:t,children:(0,n.jsx)(i.zi,{className:(0,r.cn)("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})});c.displayName=i.bL.displayName},11158(e,t,a){a.r(t),a.d(t,{default:()=>S});var s=a(73824),i=a(46258),r=a(65043),n=a(4980),c=a(56328),l=a(91140),d=a(13390),o=a(92264),m=a(13416),u=a(59938),h=a(5949),p=a(65598),x=a(84370),f=a(51654),y=a(37719),b=a(77819),v=a(57856),j=a(19233),N=a(6608),g=a(71360),w=a(22024),k=a(65505),C=a(9855),A=a(70579);const R={urgent:{icon:y.A,color:"text-red-500",label:"Urgent"},high:{icon:b.A,color:"text-orange-500",label:"High"},normal:{icon:v.A,color:"text-blue-500",label:"Normal"},low:{icon:j.A,color:"text-gray-500",label:"Low"}},_=()=>{const[e,t]=(0,r.useState)([]),[a,i]=(0,r.useState)(!0),[y,b]=(0,r.useState)(!1),[v,j]=(0,r.useState)(null),[_,S]=(0,r.useState)(!1),[$,L]=(0,r.useState)(null),[q,z]=(0,r.useState)({title:"",content:"",priority:"normal",is_active:!0});(0,r.useEffect)(()=>{M()},[]);const M=async()=>{try{const e=await n.A.get(`${s.nC}/notices/admin/all`);t(e.data.notices||[])}catch(e){c.oR.error("Failed to load notices")}finally{i(!1)}};return(0,A.jsxs)(l.Zp,{"data-testid":"admin-notice-manager",children:[(0,A.jsxs)(l.aR,{className:"flex flex-row items-center justify-between",children:[(0,A.jsxs)(l.ZB,{className:"text-xl font-semibold flex items-center gap-2",children:[(0,A.jsx)(N.A,{className:"w-5 h-5"}),"Notice Board Management"]}),(0,A.jsxs)(d.$,{onClick:()=>{j(null),z({title:"",content:"",priority:"normal",is_active:!0}),b(!0)},"data-testid":"create-notice-btn",children:[(0,A.jsx)(g.A,{className:"w-4 h-4 mr-2"}),"Create Notice"]})]}),(0,A.jsxs)(l.Wu,{children:[a?(0,A.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,A.jsx)(w.A,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):0===e.length?(0,A.jsxs)("div",{className:"text-center py-8 text-muted-foreground",children:[(0,A.jsx)(N.A,{className:"w-12 h-12 mx-auto mb-4 opacity-30"}),(0,A.jsx)("p",{children:"No notices yet. Create your first notice to communicate with Pro and Schools subscribers."})]}):(0,A.jsx)("div",{className:"space-y-4",children:e.map(e=>{const t=R[e.priority]||R.normal,a=t.icon;return(0,A.jsx)("div",{className:"p-4 rounded-lg border "+(e.is_active?"bg-background":"bg-muted/50 opacity-60"),"data-testid":`admin-notice-${e.notice_id}`,children:(0,A.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,A.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,A.jsxs)("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[(0,A.jsx)(a,{className:`w-4 h-4 ${t.color}`}),(0,A.jsx)("h4",{className:"font-semibold",children:e.title}),(0,A.jsx)(h.E,{variant:e.is_active?"default":"secondary",children:e.is_active?"Active":"Inactive"}),(0,A.jsx)(h.E,{variant:"outline",children:t.label})]}),(0,A.jsx)("p",{className:"text-sm text-muted-foreground line-clamp-2",children:e.content}
2),(0,A.jsxs)("p",{className:"text-xs text-muted-foreground/70 mt-2",children:["Created ",(i=e.created_at,new Date(i).toLocaleDateString("en-AU",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}))," by ",e.created_by_name||"Admin"]})]}),(0,A.jsxs)("div",{className:"flex items-center gap-2",children:[(0,A.jsx)(d.$,{variant:"ghost",size:"sm",onClick:()=>(async e=>{try{await n.A.put(`${s.nC}/notices/${e.notice_id}`,{is_active:!e.is_active}),c.oR.success(e.is_active?"Notice deactivated":"Notice activated"),M()}catch(t){c.oR.error("Failed to update notice")}})(e),children:e.is_active?"Deactivate":"Activate"}),(0,A.jsx)(d.$,{variant:"ghost",size:"icon",onClick:()=>(e=>{j(e),z({title:e.title,content:e.content,priority:e.priority,is_active:e.is_active}),b(!0)})(e),children:(0,A.jsx)(k.A,{className:"w-4 h-4"})}),(0,A.jsx)(d.$,{variant:"ghost",size:"icon",onClick:()=>(async e=>{L(e);try{await n.A.delete(`${s.nC}/notices/${e}`),c.oR.success("Notice deleted"),M()}catch(t){c.oR.error("Failed to delete notice")}finally{L(null)}})(e.notice_id),disabled:$===e.notice_id,className:"text-destructive hover:text-destructive",children:$===e.notice_id?(0,A.jsx)(w.A,{className:"w-4 h-4 animate-spin"}):(0,A.jsx)(C.A,{className:"w-4 h-4"})})]})]})},e.notice_id);var i})}),(0,A.jsx)(p.lG,{open:y,onOpenChange:b,children:(0,A.jsxs)(p.Cf,{className:"sm:max-w-lg",children:[(0,A.jsxs)(p.c7,{children:[(0,A.jsx)(p.L3,{children:v?"Edit Notice":"Create Notice"}),(0,A.jsx)(p.rr,{children:v?"Update the notice details below.":"Create a new notice visible to Pro and Schools subscribers."})]}),(0,A.jsxs)("div",{className:"space-y-4 py-4",children:[(0,A.jsxs)("div",{children:[(0,A.jsx)(u.J,{htmlFor:"title",children:"Title"}),(0,A.jsx)(o.p,{id:"title",value:q.title,onChange:e=>z({...q,title:e.target.value}),placeholder:"Notice title","data-testid":"notice-title-input"})]}),(0,A.jsxs)("div",{children:[(0,A.jsx)(u.J,{htmlFor:"content",children:"Content"}),(0,A.jsx)(m.T,{id:"content",value:q.content,onChange:e=>z({...q,content:e.target.value}),placeholder:"Notice content...",rows:4,"data-testid":"notice-content-input"})]}),(0,A.jsxs)("div",{children:[(0,A.jsx)(u.J,{htmlFor:"priority",children:"Priority"}),(0,A.jsxs)(x.l6,{value:q.priority,onValueChange:e=>z({...q,priority:e}),children:[(0,A.jsx)(x.bq,{"data-testid":"notice-priority-select",children:(0,A.jsx)(x.yv,{})}),(0,A.jsxs)(x.gC,{children:[(0,A.jsx)(x.eb,{value:"low",children:"Low - General information"}),(0,A.jsx)(x.eb,{value:"normal",children:"Normal - Standard notice"}),(0,A.jsx)(x.eb,{value:"high",children:"High - Important update"}),(0,A.jsx)(x.eb,{value:"urgent",children:"Urgent - Requires immediate attention"})]})]})]}),(0,A.jsxs)("div",{className:"flex items-center gap-2",children:[(0,A.jsx)(f.d,{id:"is_active",checked:q.is_active,onCheckedChange:e=>z({...q,is_active:e}),"data-testid":"notice-active-switch"}),(0,A.jsx)(u.J,{htmlFor:"is_active",children:"Active (visible to subscribers)"})]})]}),(0,A.jsxs)(p.Es,{children:[(0,A.jsx)(d.$,{variant:"outline",onClick:()=>b(!1),children:"Cancel"}),(0,A.jsx)(d.$,{onClick:async()=>{if(q.title.trim()&&q.content.trim()){S(!0);try{v?(await n.A.put(`${s.nC}/notices/${v.notice_id}`,q),c.oR.success("Notice updated successfully")):(await n.A.post(`${s.nC}/notices`,q),c.oR.success("Notice created successfully")),b(!1),M()}catch(a){var e,t;c.oR.error((null===(e=a.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.detail)||"Failed to save notice")}finally{S(!1)}}else c.oR.error("Title and content are required")},disabled:_,"data-testid":"save-notice-btn",children:_?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(w.A,{className:"w-4 h-4 animate-spin mr-2"}),"Saving..."]}):v?"Update Notice":"Create Notice"})]})]})})]})]})},S=()=>{const{user:e}=(0,s.As)();return!e||"admin"!==e.role&&"super_admin"!==e.role?(0,A.jsx)(i.A,{children:(0,A.jsx)("div",{className:"flex items-center justify-center min-h-[400px]",children:(0,A.jsx)("p",{className:"text-muted-foreground",children:"Admin access required"})})}):(0,A.jsx)(i.A,{children:(0,A.jsxs)("div",{className:"max-w-5xl mx-auto
2space-y-6","data-testid":"admin-notices-page",children:[(0,A.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,A.jsx)("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-blue-500 to-cyan-500 flex items-center justify-center text-white",children:(0,A.jsx)(j.A,{className:"w-6 h-6"})}),(0,A.jsxs)("div",{className:"min-w-0",children:[(0,A.jsx)("h1",{className:"text-3xl font-bold text-foreground",children:"Notice Board Manager"}),(0,A.jsx)("p",{className:"text-muted-foreground",children:"Create and manage announcements for all users"})]})]}),(0,A.jsx)(_,{})]})})}},77819(e,t,a){a.d(t,{A:()=>s});const s=(0,a(77784).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},57856(e,t,a){a.d(t,{A:()=>s});const s=(0,a(77784).A)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},22024(e,t,a){a.d(t,{A:()=>s});const s=(0,a(77784).A)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},65505(e,t,a){a.d(t,{A:()=>s});const s=(0,a(77784).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},71360(e,t,a){a.d(t,{A:()=>s});const s=(0,a(77784).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},37719(e,t,a){a.d(t,{A:()=>s});const s=(0,a(77784).A)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},77943(e,t,a){a.d(t,{bL:()=>g,zi:()=>w});var s=a(65043),i=a(30858),r=a(82814),n=a(21862),c=a(13642),l=a(23168),d=a(93124),o=a(87914),m=a(70579),u="Switch",[h,p]=(0,n.A)(u),[x,f]=h(u),y=s.forwardRef((e,t)=>{const{__scopeSwitch:a,name:n,checked:l,defaultChecked:d,required:h,disabled:p,value:f="on",onCheckedChange:y,form:b,...v}=e,[g,w]=s.useState(null),k=(0,r.s)(t,e=>w(e)),C=s.useRef(!1),A=!g||(b||!!g.closest("form")),[R,_]=(0,c.i)({prop:l,defaultProp:d??!1,onChange:y,caller:u});return(0,m.jsxs)(x,{scope:a,checked:R,disabled:p,children:[(0,m.jsx)(o.sG.button,{type:"button",role:"switch","aria-checked":R,"aria-required":h,"data-state":N(R),"data-disabled":p?"":void 0,disabled:p,value:f,...v,ref:k,onClick:(0,i.mK)(e.onClick,e=>{_(e=>!e),A&&(C.current=e.isPropagationStopped(),C.current||e.stopPropagation())})}),A&&(0,m.jsx)(j,{control:g,bubbles:!C.current,name:n,value:f,checked:R,required:h,disabled:p,form:b,style:{transform:"translateX(-100%)"}})]})});y.displayName=u;var b="SwitchThumb",v=s.forwardRef((e,t)=>{const{__scopeSwitch:a,...s}=e,i=f(b,a);return(0,m.jsx)(o.sG.span,{"data-state":N(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:t})});v.displayName=b;var j=s.forwardRef((e,t)=>{let{__scopeSwitch:a,control:i,checked:n,bubbles:c=!0,...o}=e;const u=s.useRef(null),h=(0,r.s)(u,t),p=(0,l.Z)(n),x=(0,d.X)(i);return s.useEffect(()=>{const e=u.current;if(!e)return;const t=window.HTMLInputElement.prototype,a=Object.getOwnPropertyDescriptor(t,"checked").set;if(p!==n&&a){const t=new Event("click",{bubbles:c});a.call(e,n),e.dispatchEvent(t)}},[p,n,c]),(0,m.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:h,style:{...o.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function N(e){return e?"checked":"unchecked"}j.displayName="SwitchBubbleInput";var g=y,w=v}}]); 3//# sourceMappingURL=1158.9ee57c78.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.