1import{r as n,j as e,C as h,e as v,g as f,aE as w,a as p,p as b,B as N,O as _,m as i,a3 as j,F as A,aj as R,D as M,d as y,f as g}from"./index-F66J0iB8.js";function C({removalLog:l,onSuccess:d}){const[a,x]=n.useState(""),[c,u]=n.useState(""),[r,o]=n.useState(!1),s=async()=>{var t;if(a.length<50){alert("Please provide at least 50 characters explaining why this removal was unjust.");return}o(!0);try{const m=await i.entities.TeacherProfile.filter({id:l.removed_member_id});await i.entities.MemberRemovalAppeal.create({removal_log_id:l.id,language_group_id:l.language_group_id,appellant_id:l.removed_member_id,appellant_username:((t=m[0])==null?void 0:t.username)||"Unknown",appeal_reason:a,supporting_evidence:c}),d==null||d()}catch(m){alert("Failed to submit appeal: "+m.message)}finally{o(!1)}};return e.jsxs(h,{className:"border-blue-300",children:[e.jsx(v,{children:e.jsxs(f,{className:"flex items-center gap-2 text-blue-900",children:[e.jsx(w,{className:"w-5 h-5"}),"Appeal This Removal"]})}),e.jsxs(p,{className:"space-y-4",children:[e.jsxs("div",{className:"bg-blue-50 p-3 rounded text-sm text-blue-900",children:[e.jsxs("p",{className:"font-medium mb-1",children:["You were removed for: ",l.removal_reason]}),e.jsx("p",{className:"text-blue-700",children:l.removal_explanation})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Why do you believe this removal was unjust? *"}),e.jsx(b,{value:a,onChange:t=>x(t.target.value),placeholder:"Explain why you think this removal was unfair or based on incorrect information...",rows:4,className:"w-full"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Minimum 50 characters (",a.length,"/50)"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:"Supporting Evidence (optional)"}),e.jsx(b,{value:c,onChange:t=>u(t.target.value),placeholder:"Any additional context, screenshots, or evidence that supports your appeal...",rows:3,className:"w-full"})]}),e.jsxs("div",{className:"bg-yellow-50 border border-yellow-200 rounded p-3 text-sm text-yellow-900",children:[e.jsx("p",{className:"font-medium",children:"What happens next:"}),e.jsxs("ul",{className:"list-disc ml-4 mt-1 space-y-1",children:[e.jsx("li",{children:"Platform admins will review your appeal within 5-7 business days"}),e.jsx("li",{children:"They may contact you or the group founder for more information"}),e.jsx("li",{children:"You'll be notified of the decision via email"})]})]}),e.jsxs(N,{onClick:s,disabled:r||a.length<50,className:"w-full",children:[e.jsx(_,{className:"w-4 h-4 mr-2"}),r?"Submitting Appeal...":"Submit Appeal to Admins"]})]})]})}function E(){const[l,d]=n.useState(null),[a,x]=n.useState(null);n.useEffect(()=>{(async()=>{const t=await i.auth.me();d(t);const m=await i.entities.TeacherProfile.filter({user_id:t.id});x(m[0])})()},[]);const{data:c=[],refetch:u}=j({queryKey:["my-removals",a==null?void 0:a.id],queryFn:async()=>a?await i.entities.MemberRemovalLog.filter({removed_member_id:a.id}):[],enabled:!!a}),{data:r=[]}=j({queryKey:["my-appeals",a==null?void 0:a.id],queryFn:async()=>a?await i.entities.MemberRemovalAppeal.filter({appellant_id:a.id}):[],enabled:!!a}),o=c.filter(s=>!r.some(t=>t.removal_log_id===s.id));return a?e.jsx("div",{className:"min-h-screen bg-gray-50 p-4 sm:p-6 lg:p-8",children:e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:"My Removal Appeals"}),e.jsx("p",{className:"text-gray-600",children:"Appeal group removals you believe were unjust"})]}),c.length===0?e.jsx(h,{children:e.jsxs(p,{className:"py-12 text-center",children:[e.jsx(A,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600 mb-6",children:"You haven't been removed from any groups"}
1),e.jsx(R,{to:M("TeacherDashboard"),children:e.jsx(N,{children:"Back to Dashboard"})})]})}):e.jsxs("div",{className:"space-y-6",children:[o.length>0&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Removals You Can Appeal"}),e.jsx("div",{className:"space-y-4",children:o.map(s=>e.jsx(C,{removalLog:s,onSuccess:u},s.id))})]}),r.length>0&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Your Appeals"}),e.jsx("div",{className:"space-y-4",children:r.map(s=>e.jsxs(h,{children:[e.jsx(v,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(f,{className:"text-lg",children:"Appeal for Group Removal"}),e.jsx(y,{className:s.status==="approved"?"bg-green-100 text-green-800":s.status==="rejected"?"bg-red-100 text-red-800":s.status==="under_review"?"bg-blue-100 text-blue-800":"bg-yellow-100 text-yellow-800",children:s.status})]})}),e.jsxs(p,{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-700",children:"Your Appeal:"}),e.jsx("p",{className:"text-sm text-gray-600 bg-gray-50 p-3 rounded",children:s.appeal_reason})]}),s.supporting_evidence&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-700",children:"Evidence:"}),e.jsx("p",{className:"text-sm text-gray-600 bg-gray-50 p-3 rounded",children:s.supporting_evidence})]}),s.admin_decision&&e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded p-3",children:[e.jsx("p",{className:"text-sm font-medium text-blue-900",children:"Admin Decision:"}),e.jsx("p",{className:"text-sm text-blue-700 mt-1",children:s.admin_decision}),s.resolution_action&&e.jsx(y,{className:"mt-2 bg-blue-100 text-blue-800",children:s.resolution_action})]}),e.jsxs("p",{className:"text-xs text-gray-500",children:["Submitted ",g(new Date(s.created_date),"MMM d, yyyy"),s.resolved_at&&` ⢠Resolved ${g(new Date(s.resolved_at),"MMM d, yyyy")}`]})]})]},s.id))})]})]})]})}):e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsx("p",{className:"text-gray-600",children:"Loading..."})})}export{E 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.