PageSourceSearch

https://dietacademy.jp/_app/AdminDashboard-CWYlWMCl.js

js dietacademy.jp collected 2026-10-07 11:49:43 UTC 33,056 bytes, 1 lines download raw bytes

1import{c as he,d as ue,b as n,j as e}from"./index-D5yTtBfj.js";import{u as pe,r as x,e as U}from"./react-w2_hd-Mb.js";import{q as K,B as be,ae as Y,i as A,J as R,W as H,az as ge,a7 as X,aI as fe,ao as je,o as Z,b3 as ve,bx as we,bi as J,by as Ne,F as ye,a as _,X as ke,bz as Ce,d as _e,e as qe}from"./lucide-ZnjHBfqS.js";import{R as De,L as Te,f as Se,X as ze,Y as Ie,T as Ae,h as Re,g as Q}from"./recharts-CniQ4Sg7.js";import"./supabase-DkYWVPkI.js";const V=[{ja:"小さな一歩が、未来の大きな健康をつくります。",en:"Small daily actions lead to extraordinary health."},{ja:"完璧を目指すのではなく、継続を目指しましょう。",en:"Strive for consistency, not perfection."},{ja:"知識は力であり、実践は結果を生み出します。",en:"Knowledge is potential; practice brings results."},{ja:"一歩ずつ前進することが、確実な成功への道です。",en:"Step by step is the surest path to success."},{ja:"心と体のバランスが、最高のパフォーマンスを引き出します。",en:"Balance of mind and body unlocks your peak potential."},{ja:"受講生の笑顔と健康が、私たちの最高の成果です。",en:"The health and smiles of our students are our greatest achievement."},{ja:"毎日の積み重ねが、一生モノの習慣へと変わります。",en:"Daily accumulation transforms into lifelong habits."},{ja:"情熱をもって寄り添い、共に成長しましょう。",en:"Coach with passion and grow together."},{ja:"諦めない姿勢が、新しい可能性を切り開きます。",en:"A persistent attitude opens doors to new possibilities."},{ja:"健康への投資は、最高の未来への投資です。",en:"Investing in health is investing in your brightest future."},{ja:"質にこだわり、心を込めた指導を届けましょう。",en:"Deliver quality guidance with heart and precision."},{ja:"変化を恐れず、常に新しい学びを楽しみましょう。",en:"Embrace change and find joy in continuous learning."},{ja:"一人ひとりの目標に寄り添う姿勢が信頼を築きます。",en:"Personalized care builds unbreakable trust."},{ja:"正しい知識は、人を美しく健康に変える力があります。",en:"True knowledge has the power to transform lives."},{ja:"今日の成果を喜び、明日の糧にしましょう。",en:"Celebrate today's progress and fuel tomorrow's ambition."},{ja:"自信は、毎日の達成感から生まれます。",en:"
1Confidence is built through daily small victories."},{ja:"最高のサービスは、細やかな気配りから生まれます。",en:"Excellence lies in the fine details of care."},{ja:"人の健康に貢献できることは、誇り高き使命です。",en:"Empowering others to live healthier is a noble mission."},{ja:"挑戦し続けることが、自分自身を高める鍵です。",en:"Continuous challenge is the key to personal mastery."},{ja:"前向きな言葉と態度が、良い結果を引き寄せます。",en:"Positive mindsets attract remarkable outcomes."},{ja:"感謝の気持ちを忘れず、今日も全力でサポートしましょう。",en:"Lead with gratitude and give your best every single day."},{ja:"健康は幸せの基盤です。そのサポートを大切に。",en:"Health is the foundation of all happiness."},{ja:"小さな気付きが、大きな飛躍のきっかけになります。",en:"A subtle insight can ignite a massive breakthrough."},{ja:"目標を明確にし、信念を持って突き進みましょう。",en:"Clarity of vision drives steadfast momentum."},{ja:"誠実なサポートが、生徒の人生を変える力になります。",en:"Sincere dedication transforms lives."},{ja:"成功の秘訣は、毎日少しずつ努力を続けることです。",en:"The secret of success is persistent effort every day."},{ja:"理想の未来は、今日の選択から始まります。",en:"Your ideal future begins with choices made today."},{ja:"質の高い習慣が、質の高い人生をつくります。",en:"High-quality habits create a high-quality life."},{ja:"仲間と共に学び、互いに高め合いましょう。",en:"Learn together and elevate each other."},{ja:"今日も素晴らしい一日を、笑顔でスタートしましょう!",en:"Start today with enthusiasm and a radiant smile!"}],Fe=()=>{var G;const f=pe(),{t:s,language:u}=he(),q=ue(),[l,ee]=x.useState({students:0,courses:0,enrollments:0,tickets:0,newDiagnostics:0,newInquiries:0,unreadNutritionalChats:0}),[j,te]=x.useState([]),[d,D]=x.useState("inquiries"),[v,se]=x.useState(30),[g,w]=x.useState([]),[T,L]=x.useState(""),[N,ae]=x.useState("todo"),[$,E]=x.useState(!1),[M,ie]=x.useState([]),[re,P]=x.useState(!0),[y,ne]=x.use
1State({open:!1,course:null}),[S,F]=x.useState(!1),[B,O]=x.useState(!1);x.useEffect(()=>{k(),z(v);const t=n.channel("admin-dashboard-inquiries-realtime").on("postgres_changes",{event:"INSERT",schema:"public",table:"inquiry_requests"},()=>{k(),z(v),q.info(u==="ja"?"🔔 新しい資料請求が届きました!":"🔔 New Inquiry Request received!")}).on("postgres_changes",{event:"INSERT",schema:"public",table:"diagnostic_submissions"},()=>{k(),z(v)}).subscribe();return()=>{n.removeChannel(t)}},[v,u]);const z=async t=>{const a=new Date;a.setDate(a.getDate()-t);const[i,o]=await Promise.all([n.from("diagnostic_submissions").select("submitted_at").gte("submitted_at",a.toISOString()),n.from("inquiry_requests").select("submitted_at").gte("submitted_at",a.toISOString())]),m=new Map,c=new Map;for(let r=t-1;r>=0;r--){const h=new Date;h.setDate(h.getDate()-r);const b=`${h.getMonth()+1}/${h.getDate()}`;m.set(b,0),c.set(b,0)}i.data&&i.data.forEach(r=>{const h=new Date(r.submitted_at),b=`${h.getMonth()+1}/${h.getDate()}`;m.has(b)&&m.set(b,(m.get(b)||0)+1)}),o.data&&o.data.forEach(r=>{const h=new Date(r.submitted_at),b=`${h.getMonth()+1}/${h.getDate()}`;c.has(b)&&c.set(b,(c.get(b)||0)+1)});const p=Array.from(m.keys()).map(r=>({date:r,diagnosticsCount:m.get(r)||0,inquiriesCount:c.get(r)||0}));te(p)},k=async()=>{try{P(!0);const[t,a,i,o,m,c,p,r,h]=await Promise.all([n.from("profiles").select("id",{count:"exact",head:!0}).eq("role","student"),n.from("courses").select("id",{count:"exact",head:!0}).eq("status","published"),n.from("enrollments").select("id",{count:"exact",head:!0}),n.from("tickets").select("id",{count:"exact",head:!0}).eq("status","open"),n.from("diagnostic_submissions").select("id",{count:"exact",head:!0}).eq("status","new"),n.from("inquiry_requests").select("id",{count:"exact",head:!0}).eq("status","new"),n.from("admin_todos").select("id, task, category, is_completed, created_at").order("created_at",{ascending:!1}),n.from("profiles").select("id, full_name, created_at").eq("role","student").order("created_at",{ascending:!1}).limit(5),n.from("nutritional_chat_messages").select("id",{count:"exact",head:!0}).eq("sender_type","student").eq("is_read",!1)]);ee({students:t.count||0,courses:a.count||0,enrollments:i.count||0,tickets:o.count||0,newDiagnostics:m.count||0,newInquiries:c.count||0,unreadNutritionalChats:h.count||0}),p.data&&w(p.data),r.data&&ie(r.data)}catch(t){console.error("Error fetching dashboard data:",t)}finally{P(!1)}},oe=async t=>{if(t.preventDefault(),!(!T.trim()||$)){E(!0);try{const{data:a,error:i}=await n.from("admin_todos").insert({task:T.trim(),category:N}).select().single();if(i)throw i;a&&(w([a,...g]),L(""))}catch(a){console.error(a),q.error(s("admin.dashboard.todos.saveError"))}finally{E(!1)}}},le=async(t,a)=>{try{const{error:i}=await n.from("admin_todos").update({is_completed:!a}).eq("id",t);if(i)throw i;w(g.map(o=>o.id===t?{...o,is_completed:!a}:o))}catch(i){console.error(i)}},de=async t=>{try{const{error:a}=await n.from("admin_todos").delete().eq("id",t);if(a)throw a;w(g.filter(i=>i.id!==t))}catch(a){console.error(a)}},ce=async(t,a)=>{try{const{error:i}=await n.from("admin_todos").update({category:a}).eq("id",t);if(i)throw i;w(g.map(o=>o.id===t?{...o,category:a}:o))}catch(i){console.error(i)}},C=()=>{ne({open:!1,course:null}),F(!1)},xe=async()=>{if(!(!y.course||!S)){O(!0);try{const t=y.course.id,{data:a}=await n.from("modules").select("id").eq("course_id",t),i=(a||[]).map(m=>m.id);i.length>0&&await n.from("lessons").delete().in("module_id",i),await n.from("questions").delete().eq("course_id",t),await n.from("modules").delete().eq("course_id",t),await n.from("enrollments").delete().eq("course_id",t),await n.from("certificates").delete().eq("course_id",t);const{error:o}=await n.from("courses").delete().eq("id",t);if(o)throw o;C(),k()}catch(t){console.error("Failed to delete course:",t),q.error(s("admin.dashboard.deleteError"))}finally{O(!1)}}},I=()=>{const t=new Date().getHours();return t<12?{text:s("admin.dashboard.greeting.morning"),icon:Ce,color:"text-amber-500"}:t<18?{text:s("admin.dashboard.greeting.afternoon"),icon:_e,color:"text-orange-500"}:{text:s("admin.dashboard.greeting.evening"),icon:qe,color:"text-indigo-400"}},me=[{label:s("admin.dashboard.totalStudents"),value:l.students,icon:K,color:"text-blue-600",bg:"bg-blue-50"},{label:s("admin.dashboard.publishedCourses"),value:l.courses,icon:be,color:"text-[#FF8C6B]",bg:"bg-emerald-50"},{label:s("admin.dashboard.totalEnrollments"),value:l.enrollments,icon:Y,color:"text-green-600",bg:"bg-green-50"},{label:s("admin.dashboard.openTickets"),value:l.tickets,icon:A,color:"text-purple-600",bg:"bg-purple-50"}],W=U.useMemo(()=>
1{if(j.length===0)return[];const t=r=>d==="inquiries"?r.inquiriesCount:d==="diagnostics"?r.diagnosticsCount:r.inquiriesCount+r.diagnosticsCount;let a=j[0],i=j[0];j.forEach(r=>{t(r)>=t(a)&&(a=r),t(r)<=t(i)&&(i=r)});const o=t(a),m=t(i),c=[],p=d==="inquiries";return o===0?c.push({id:"no-activity",title:p?u==="ja"?"資料請求がありません":"No Inquiry Requests":s("admin.dashboard.insights.zeroTitle")||"Zero Registrations",desc:p?u==="ja"?"選択期間中の資料請求は0件です。キャンペーンの広告配信をご確認ください。":"Zero inquiry requests in this period. Check your ad campaigns.":s("admin.dashboard.insights.zeroDesc")||"Zero diagnostics in this period. Are the ads running correctly?",icon:R,color:"text-red-500",bg:"bg-red-50",border:"border-red-100"}):c.push({id:"peak",title:(s("admin.dashboard.insights.peakTitle")||"Peak on {date} ({count} registrations)").replace("{date}",a.date).replace("{count}",o.toString()),desc:p?u==="ja"?"この日に資料請求が集中しました!キャンペーン施策の効果を分析しましょう。":"Peak in inquiry requests on this date! Analyze campaign reach.":s("admin.dashboard.insights.peakDesc")||"What was special about this day? Analyze to replicate the strategy!",icon:Y,color:p?"text-purple-500":"text-emerald-500",bg:p?"bg-purple-50":"bg-emerald-50",border:p?"border-purple-100":"border-emerald-100"}),o===0?c.push({id:"offline",title:s("admin.dashboard.insights.offlineTitle")||"System Inactive?",desc:s("admin.dashboard.insights.offlineDesc")||"Make sure your checkout and forms are accessible to users.",icon:H,color:"text-amber-500",bg:"bg-amber-50",border:"border-amber-100"}):m===0?c.push({id:"attention",title:(s("admin.dashboard.insights.attentionTitle")||"Attention: {date} had no registrations").replace("{date}",i.date),desc:s("admin.dashboard.insights.attentionDesc")||"Was there any pause in the campaigns or instability on this day?",icon:ge,color:"text-amber-500",bg:"bg-amber-50",border:"border-amber-100"}):c.push({id:"consistent",title:s("admin.dashboard.insights.consistentTitle")||"Consistent Activity",desc:(s("admin.dashboard.insights.consistentDesc")||"Even the slowest day ({date}) had {count} registrations. Great job!").replace("{date}",i.date).replace("{count}",m.toString()),icon:X,color:"text-blue-500",bg:"bg-blue-50",border:"border-blue-100"}),c},[j,d,s,u]);return re?e.jsxs("div",{className:"p-6 md:p-10 max-w-7xl w-full mx-auto space-y-8 animate-in fade-in duration-500",children:[e.jsx("div",{className:"h-10 bg-slate-100 w-1/3 rounded-xl animate-pulse"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-6",children:[...Array(4)].map((t,a)=>e.jsx("div",{className:"h-32 bg-slate-100 rounded-3xl animate-pulse"},a))}),e.jsxs("div",{className:"grid lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsx("div",{className:"h-64 bg-slate-100 rounded-3xl animate-pulse"}),e.jsx("div",{className:"h-96 bg-slate-100 rounded-3xl animate-pulse"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"h-48 bg-slate-100 rounded-3xl animate-pulse"}),e.jsx("div",{className:"h-48 bg-slate-100 rounded-3xl animate-pulse"})]})]})]}):e.jsxs("div",{className:"p-6 md:p-10 max-w-7xl w-full mx-auto space-y-10 animate-in fade-in duration-700",children:[e.jsx("header",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold tracking-tight text-slate-800 font-serif-jp flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{className:"text-slate-400 font-normal flex items-center gap-2",children:[I().text,e.jsx("span",{className:I().color,children:U.createElement(I().icon,{size:28})})]}),e.jsx("span",{children:s("admin.dashboard.welcomeAdmin")})]}),e.jsxs("p",{className:"text-slate-500 text-sm font-medium mt-1 flex items-center gap-2",children:[e.jsx(fe,{size:14}),new Date().toLocaleDateString(u==="ja"?"ja-JP":"en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})]}),(()=>{const t=new Date().getDate(),a=V[(t-1)%V.length];return e.jsxs("div",{className:"mt-3 inline-flex items-center gap-2.5 px-3.5 py-2 bg-gradient-to-r from-teal-50/90 via-emerald-50/80 to-teal-50/90 rounded-xl border border-teal-200/60 text-xs shadow-sm max-w-xl animate-in fade-in slide-in-from-top-2 duration-500",children:[e.jsx(je,{size:15,className:"text-teal-600 flex-shrink-0 animate-pulse"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-bold text-teal-800 tracking-wider text-[10px] bg-teal-100/80 text-teal-700 px-2 py-0.5 rounded-md flex-shrink-0",children:"本日の言葉"}),e.jsxs("span",{className:"font-bold text-slate-700",children:['"',a.ja,'"']})]})]})})()]})}),e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:me.map((t,a)=>e.jsxs("div",{className:"bg-white p-4 rounded-2xl border border-slate-100 shadow-[0_4px_20px_rgb(0,0,0,0.03)] hover:-translate-y-0.5 transition-all duration-300 flex items-center gap-4",children:[e.jsx("div",{className:`p-3 rounded-xl flex-shrink-0 ${t.bg} ${t.color}`,children:e.jsx(t.icon,{size:20})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-2xl font-black tracking-tight text-slate-800",children:t.value}),e.jsx("div",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-widest truncate mt-0.5",children:t.label})]})]},a))}),e.jsxs("div",{className:"grid lg:grid-cols-3 gap-8 items-start min-w-0",children:[e.jsxs("section",{className:"lg:col-span-2 space-y-8 min-w-0",children:[e.jsxs("div",{className:"bg-white p-6 md:p-8 rounded-3xl border border-slate-100 shadow-[0_8px_30px_rgb(0,0,0,0.04)] relative overflow-hidden group min-w-0",children:[e.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-gradient-to-br from-purple-50 via-teal-50 to-transparent roun
1ded-bl-[100px] -z-10 opacity-50 group-hover:opacity-100 transition-opacity duration-500"}),e.jsxs("div",{className:"flex flex-col gap-5 mb-8",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsx("div",{children:e.jsxs("h2",{className:"text-lg font-bold text-slate-800 font-serif-jp flex items-center gap-2",children:[e.jsx(H,{size:20,className:d==="inquiries"?"text-purple-600":d==="combined"?"text-indigo-600":"text-teal-600"}),e.jsxs("span",{className:"truncate",children:[s(d==="inquiries"?"admin.dashboard.inquiryTrendTitle":d==="combined"?"admin.dashboard.combinedTrendTitle":"admin.dashboard.trendChartTitle"),"(",v,u==="ja"?"日間":" days",")"]})]})}),e.jsx("div",{className:"flex flex-wrap bg-slate-50 p-1 rounded-xl border border-slate-100",children:[7,14,30].map(t=>e.jsxs("button",{onClick:()=>se(t),className:`px-3 py-1.5 text-xs font-bold rounded-lg transition-all duration-300 ${v===t?"bg-white text-slate-800 shadow-sm border border-slate-200/50":"text-slate-400 hover:text-slate-600"}`,children:[t,u==="ja"?"日":"d"]},t))})]}),e.jsxs("div",{className:"flex bg-slate-100/80 p-1 rounded-2xl border border-slate-200/50 self-start overflow-x-auto max-w-full",children:[e.jsxs("button",{onClick:()=>D("inquiries"),className:`px-4 py-2 text-xs font-bold rounded-xl transition-all duration-300 flex items-center gap-2 whitespace-nowrap ${d==="inquiries"?"bg-white text-purple-700 shadow-sm border border-purple-200/50":"text-slate-500 hover:text-slate-800"}`,children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-purple-500 inline-block shadow-sm"}),s("admin.dashboard.tabInquiries"),e.jsx("span",{className:"px-1.5 py-0.5 text-[9px] bg-purple-100 text-purple-700 rounded-md font-extrabold uppercase tracking-wider",children:u==="ja"?"新着":"Campaign"})]}),e.jsxs("button",{onClick:()=>D("diagnostics"),className:`px-4 py-2 text-xs font-bold rounded-xl transition-all duration-300 flex items-center gap-2 whitespace-nowrap ${d==="diagnostics"?"bg-white text-teal-700 shadow-sm border border-teal-200/50":"text-slate-500 hover:text-slate-800"}`,children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-teal-500 inline-block shadow-sm"}),s("admin.dashboard.tabDiagnostics")]}),e.jsxs("button",{onClick:()=>D("combined"),className:`px-4 py-2 text-xs font-bold rounded-xl transition-all duration-300 flex items-center gap-2 whitespace-nowrap ${d==="combined"?"bg-white text-indigo-700 shadow-sm border border-indigo-200/50":"text-slate-500 hover:text-slate-800"}`,children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-gradient-to-r from-purple-500 to-teal-500 inline-block shadow-sm"}),s("admin.dashboard.tabCombined")]})]})]}),e.jsx("div",{className:"h-64",children:e.jsx(De,{width:"100%",height:"100%",children:e.jsxs(Te,{data:j,margin:{top:10,right:10,left:-20,bottom:0},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"colorDiagnostics",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#0D9488",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"#0D9488",stopOpacity:0})]}),e.jsxs("linearGradient",{id:"colorInquiries",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#8B5CF6",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"#8B5CF6",stopOpacity:0})]})]}),e.jsx(Se,{strokeDasharray:"3 3",vertical:!1,stroke:"#f1f5f9"}),e.jsx(ze,{dataKey:"date",axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:"#94a3b8"},dy:10,minTickGap:15}),e.jsx(Ie,{axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:"#94a3b8"}}),e.jsx(Ae,{contentStyle:{borderRadius:"12px",border:"none",boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",fontSize:"12px",fontWeight:"bold"},labelStyle:{color:"#64748b",marginBottom:"4px"},cursor:{stroke:"#e2e8f0",strokeWidth:1,strokeDasharray:"3 3"},formatter:(t,a)=>{const i=a==="inquiriesCount"?s("admin.dashboard.tabInquiries"):a==="diagnosticsCount"?s("admin.dashboard.tabDiagnostics"):a;return[t,i]}}),d==="combined"&&e.jsx(Re,{verticalAlign:"top",height:36,formatter:t=>e.jsx("span",{className:"text-xs font-bold text-slate-600",children:s(t==="inquiriesCount"?"admin.dashboard.tabInquiries":"admin.dashboard.tabDiagnostics")})}),(d==="inquiries"||d==="combined")&&e.jsx(Q,{type:"monotone",dataKey:"inquiriesCount",name:"inquiriesCount",stroke:"#8B5CF6",strokeWidth:3,dot:!1,activeDot:{r:6,fill:"#8B5CF6",stroke:"#fff",strokeWidth:2}}),(d==="diagnostics"||d==="combined")&&e.jsx(Q,{type:"monotone",dataKey:"diagnosticsCount",name:"diagnosticsCount",stroke:"#0D9488",strokeWidth:3,dot:!1,activeDot:{r:6,fill:"#0D9488",stroke:"#fff",strokeWidth:2}})]})})}),W.length>0&&e.jsx("div",{className:"mt-6 grid sm:grid-cols-2 gap-4",children:W.map(t=>e.jsxs("div",{className:`p-4 rounded-2xl border flex items-start gap-3 ${t.bg} ${t.border}`,children:[e.jsx("div",{className:`p-2 rounded-xl bg-white/50 backdrop-blur-sm shadow-sm flex-shrink-0 ${t.color}`,children:e.jsx(t.icon,{size:18})}),e.jsxs("div",{children:[e.jsx("h4",{className:`text-sm font-bold ${t.color.replace("text-","text-").replace("500","700")} mb-1`,children:t.title}),e.jsx("p",{className:"text-[11px] font-medium text-slate-600 leading-snug",children:t.desc})]})]},t.id))})]}),e.jsxs("div",{className:"bg-white rounded-3xl border border-slate-100 shadow-[0_8px_30px_rgb(0,0,0,0.04)] p-6 md:p-8 flex flex-col h-[400px] min-w-0",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 border-b border-slate-100 pb-5 mb-5",children:[e.jsxs("h2",{className:"text-lg font-bold tracking-tight text-slate-800 font-serif-jp flex items-center gap-2",children:[e.jsx(Z,{size:20,className:"text-indigo-600 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:s("admin.dashboard.todos.title")})]}),e.jsx("div",{className:"flex flex-wrap bg-slate-50 p-1 rounded-xl border border-slate-100",children:["todo","in_progress","done"].map(t=>e.jsxs("button",{onClick:()=>ae(t),className:`px-4 py-1.5 text-xs font-bold rounded-lg transition-all duration-300 ${N===t?"bg-white text-indigo-600 shadow-sm border border-slate-200/50":"text-slate-400 hover:text-slate-600"}`,children:[s(t==="todo"?"admin.dashboard.todos.todo":t==="in_progress"?"admin.dashboard.todos.inProgress":"admin.dashboard.todos.done"),e.jsxs("span",{className:"ml-1.5 opacity-50",children:["(",g.filter(a=>a.category===t).length,")"]})]},t))})]}),e.jsxs("form",{onSubmit:oe,className:"relative mb-4",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:e.jsx(ve,{size:16,className:"text-slate-400"})}),e.jsx("input",{type:"text",value:T,onChange:t=>L(t.target.value),placeholder:s("admin.dashboard.todos.addPlaceholder"),disabled:$,className:"w-full bg-slate-50 border border-slate-100 rounded-xl pl-10 pr-4 py-3 outline-none focus:border-indigo-300 focus:bg-white focus:shadow-[0_4px_12px_rgb(0,0,0,0.03)] text-sm font-medium transition-all"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto space-y-2 pr-2 custom-scrollbar",children:g.filter(t=>t.category===N).length===0?e.jsx("div",{className:"text-center p-8 bg-slate-50 border border-dashed border-slate-200 rounded-2xl text-slate-400 font-medium text-sm",children:s("admin.dashboard.todos.noTasks")}):g.filter(t=>t.category===N).map(t=>e.jsxs("div",{className:`group flex items-start justify-between p-3 rounded-xl border transition-all ${t.is_completed?"bg-slate-50 border-slate-100":"bg-white border-slate-100 hover:border-indigo-100 shadow-sm hover:shadow-md"}`,children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0 pr-2",children:[e.jsx("button",{onClick:()=>le(t.id,t.is_completed),className:`flex-shrink-0 mt-0.5 transition-colors ${t.is_completed?"text-indigo-400":"text-slate-300 hover:text-indigo-500"}`,children:t.is_completed?e.jsx(X,{size:18}):e.jsx(we,{size:18})}),e.jsx("span",{className:`text-sm font-medium break-words leading-snug ${t.is_completed?"text-slate-400 line-through":"text-slate-700"}`,children:t.task})]}),e.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0 self-start",children:[e.jsxs("select",{value:t.category,onChange:a=>ce(t.id,a.target.value),className:"text-[10px] font-bold text-slate-500 bg-slate-100 rounded-lg px-2 py-1 outline-none border-none cursor-pointer appearance-none text-center",children:[e.jsx("option",{value:"todo",children:"To Do"}),e.jsx("option",{value:"in_progress",children:"In Progress"}),e.jsx("option",{value:"done",children:"Done"})]}),e.jsx("button",{onClick:()=>de(t.id),className:"p-1.5 text-slate-300 hover:text-red-500 hover:bg-red-50 rounded-lg transition-colors",children:e.jsx(J,{size:14})})]})]},t.id))})]})]}),e.jsxs("section",{className:"space-y-8 min-w-0",children:[e.jsxs("div",{className:"bg-gradient-to-br from-red-50 to-amber-50 rounded-3xl border border-red-100 shadow-[0_8px_30px_rgb(0,0,0,0.04)] p-6",children:[e.jsxs("h2",{className:"text-sm font-bold text-red-800 uppercase tracking-widest flex items-center gap-2 mb-4",children:[e.jsx(Ne,{size:16,className:"animate-bounce"}),s("admin.dashboard.attentionNeeded")]}),e.jsxs("div",{className:"space-y-3",children:[l.newInquiries>0&&e.jsxs("div",{onClick:()=>f("/admin/inquiry-requests"),className:"bg-gradient-to-r from-purple-50 via-white to-purple-50 p-4 rounded-2xl shadow-[0_8px_30px_rgb(139,92,246,0.12)] border-2 border-purple-300 hover:border-purple-500 cursor-pointer transition-all active:scale-95 group relative overflow-hidden",children:[e.jsx("div",{className:"absolute -right-4 -bottom-4 w-16 h-16 bg-purple-200/30 rounded-full blur-xl pointer-events-none"}),e.jsxs("div",{className:"flex items-center justify-between relative z-10",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 bg-gradient-to-br from-purple-600 to-indigo-600 text-white rounded-xl group-hover:scale-110 transition-transform shadow-md shadow-purple-500/30 flex-shrink-0",children:e.jsx(ye,{size:18})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-bold text-slate-800",children:[l.newInquiries," ",s("admin.dashboard.newInquiriesAlert")]}),e.jsx("span",{className:"bg-purple-600 text-white text-[9px] font-black px-2 py-0.5 rounded-full uppercase tracking-wider animate-pulse",children:u==="ja"?"要対応":"NEW"})]}),e.jsxs("div",{className:"text-xs text-purple-700 font-bold mt-0.5",children:[s("admin.dashboard.viewInquiryRequests")," →"]})]})]}),e.jsx(_,{size:18,className:"text-purple-400 group-hover:text-purple-600 transition-colors"})]})]}),l.newDiagnostics>0&&e.jsx("div",{onClick:()=>f("/admin/diagnostics"),className:"bg-white p-4 rounded-2xl shadow-[0_8px_30px_rgb(0,0,0,0.04)] border border-red-100 hover:border-red-300 cursor-pointer transition-all active:scale-95 group",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-red-100 text-red-600 rounded-xl group-hover:scale-110 transition-transform",children:e.jsx(Z,{size:18})}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm font-bold text-slate-800",children:[l.newDiagnostics," ",s("admin.dashboard.newDiagnostics")]}),e.jsx("div",{className:"text-xs text-slate-500 font-medium",children:s("admin.dashboard.viewDiagnostics")})]})]}),e.jsx(_,{size:16,className:"text-slate-300 group-hover:text-red-500 transition-colors"})]})}),l.tickets>0&&e.jsx("div",{onClick:()=>f("/admin/support"),className:"bg-white p-4 rounded-2xl shadow-[0_8px_30px_rgb(0,0,0,0.04)] border border-amber-100 hover:border-amber-300 cursor-pointer transition-all active:scale-95 group",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-amber-100 text-amber-600 rounded-xl group-hover:scale-110 transition-transform",children:e.jsx(A,{size:18})}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm font-bold text-slate-800",children:[l.tickets," ",s("admin.dashboard.unansweredTickets")]}),e.jsx("div",{className:"text-xs text-slate-500 font-medium",children:s("admin.dashboard.viewTickets")})]})]}),e.jsx(_,{size:16,className:"text-slate-300 group-hover:text-amber-500 transition-colors"})]})}),l.unreadNutritionalChats>0&&e.jsx("div",{onClick:()=>f("/admin/nutritional-app"),className:"bg-white p-4 rounded-2xl shadow-[0_8px_30px_rgb(0,0,0,0.04)] border border-emerald-100 hover:border-emerald-300 cursor-pointer transition-all active:scale-95 group",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-emerald-100 text-emerald-600 rounded-xl group-hover:scale-110 transition-transform",children:e.jsx(A,{size:18})}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-sm font-bold text-slate-800",children:[l.unreadNutritionalChats," ",s("admin.dashboard.unreadNutritionalChats")||"Unread Nutritional Messages"]}),e.jsx("div",{className:"text-xs text-slate-500 font-medium",children:s("admin.dashboard.viewNutritionalChats")||"Open Nutritional Ap
1p"})]})]}),e.jsx(_,{size:16,className:"text-slate-300 group-hover:text-emerald-500 transition-colors"})]})}),l.newInquiries===0&&l.newDiagnostics===0&&l.tickets===0&&l.unreadNutritionalChats===0&&e.jsx("div",{className:"p-4 bg-white/50 border border-white rounded-2xl text-xs font-bold text-slate-500 text-center",children:"No pending tasks! 🎉"})]})]}),e.jsxs("div",{className:"bg-white rounded-3xl border border-slate-100 shadow-[0_8px_30px_rgb(0,0,0,0.04)] p-6 overflow-hidden",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-6",children:[e.jsx("h2",{className:"text-sm font-bold text-slate-800 uppercase tracking-widest",children:s("admin.dashboard.recentStudents")}),e.jsx("button",{onClick:()=>f("/admin/students"),className:"text-xs font-bold text-teal-600 hover:text-teal-700 transition-colors",children:s("admin.dashboard.manageAll")})]}),e.jsxs("div",{className:"space-y-4",children:[M.map(t=>e.jsxs("div",{className:"flex items-center gap-3 group cursor-pointer",onClick:()=>f("/admin/students"),children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-slate-50 border border-slate-100 flex items-center justify-center text-slate-400 flex-shrink-0 group-hover:bg-teal-50 group-hover:text-teal-600 transition-colors",children:e.jsx(K,{size:16})}),e.jsxs("div",{className:"overflow-hidden",children:[e.jsx("h4",{className:"text-sm font-bold text-slate-800 tracking-tight truncate",children:t.full_name||s("admin.dashboard.noName")}),e.jsx("p",{className:"text-[10px] font-bold text-slate-400 tracking-widest mt-0.5",children:new Date(t.created_at).toLocaleDateString()})]})]},t.id)),M.length===0&&e.jsx("div",{className:"p-4 text-center text-xs font-medium text-slate-400 bg-slate-50 rounded-2xl",children:s("admin.dashboard.noStudents")})]})]})]})]}),y.open&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:C,children:[e.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm animate-in fade-in duration-300"}),e.jsxs("div",{className:"relative bg-white rounded-3xl shadow-2xl max-w-md w-full p-8 space-y-6 animate-in zoom-in-95 fade-in duration-300",onClick:t=>t.stopPropagation(),children:[e.jsx("button",{onClick:C,className:"absolute top-4 right-4 p-2 text-slate-300 hover:text-slate-600 transition-all active:scale-90",children:e.jsx(ke,{size:20})}),e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-red-50 flex items-center justify-center mb-4",children:e.jsx(R,{size:32,className:"text-red-500"})}),e.jsx("h3",{className:"text-xl font-bold tracking-tight text-slate-800 font-serif-jp",children:s("admin.dashboard.deleteCourseTitle")}),e.jsxs("p",{className:"text-sm text-slate-500 mt-2 leading-relaxed",children:[e.jsx("strong",{className:"text-red-600",children:(G=y.course)==null?void 0:G.title}),s("admin.dashboard.deleteCourseDesc1"),e.jsx("br",{}),s("admin.dashboard.deleteCourseDesc2")]})]}),e.jsxs("div",{className:"bg-red-50 border border-red-100 rounded-2xl p-4",children:[e.jsxs("p",{className:"text-xs text-red-600 font-bold mb-3 flex items-center gap-2",children:[e.jsx(R,{size:14}),s("admin.dashboard.deleteIrreversible")]}),e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:S,onChange:t=>F(t.target.checked),className:"mt-0.5 w-4 h-4 accent-red-500"}),e.jsx("span",{className:"text-xs text-red-700 font-medium leading-relaxed",children:s("admin.dashboard.deleteConfirmLabel")})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:C,className:"flex-1 py-3 px-4 bg-slate-100 text-slate-600 rounded-xl font-bold text-sm hover:bg-slate-200 transition-colors active:scale-95",children:s("admin.dashboard.deleteCancel")}),e.jsx("button",{onClick:xe,disabled:!S||B,className:"flex-1 py-3 px-4 bg-red-500 text-white rounded-xl font-bold text-sm hover:bg-red-600 transition-colors disabled:opacity-40 disabled:active:scale-100 flex items-center justify-center gap-2 active:scale-95",children:B?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"})," ",s("admin.dashboard.deleting")]}):e.jsxs(e.Fragment,{children:[e.jsx(J,{size:16})," ",s("admin.dashboard.deleteConfirm")]})})]})]})]})]})};export{Fe as AdminDashboard};

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.