1import{j as e}from"./vendor-data-Z5doMMu-.js";import{r as n}from"./vendor-react-zNM0AU50.js";import{G as X,K as _e,U as pe,a5 as he,c as Ne,ar as ve,i as re,A as Ee,B as we,g as $e,a4 as le,E as Se,ax as Te,T as Q,aa as xe,af as ue,a7 as v,X as z,L as ge,f as Ie,ag as Me,a as Oe,Z as Pe,b9 as Re,ai as Le}from"./vendor-ui-CW5bJ11U.js";import{y as W,k as R,u as Z,z as J,l as I,q as V,x as q,m as B,w as Fe}from"./vendor-firebase-Da9KY1q_.js";import{d as D,m as Ce,u as Ye}from"./index-D1K3lVhu.js";import{p as ye}from"./pushService-ggivUk2Y.js";import"./vendor-charts-08G1rM8P.js";const ie="seodoon-church",ee=`churches/${ie}/silverClasses`,te=`churches/${ie}/silverStaff`,U=`churches/${ie}/silverEvents`,se=`churches/${ie}/silverNotices`,ae="silverEnrollments";function L(t){const d={};for(const[s,l]of Object.entries(t))l!==void 0&&(d[s]=l);return d}const ne={async getAll(){try{const t=V(I(D,ee),q("sortOrder","asc"));return(await B(t)).docs.map(s=>{var l,o,a,x;return{id:s.id,...s.data(),createdAt:(o=(l=s.data().createdAt)==null?void 0:l.toDate)==null?void 0:o.call(l),updatedAt:(x=(a=s.data().updatedAt)==null?void 0:a.toDate)==null?void 0:x.call(a)}})}catch(t){return console.error("ì¤ë²ëí ë° ì¡°í ì¤í¨:",t),[]}},async create(t){const d=L(t);return(await J(I(D,ee),{...d,createdAt:new Date,updatedAt:new Date})).id},async update(t,d){const s=L(d);await Z(R(D,ee,t),{...s,updatedAt:new Date})},async remove(t){await W(R(D,ee,t))}},de={async getAll(){try{const t=V(I(D,te),q("sortOrder","asc"));return(await B(t)).docs.map(s=>{var l,o,a,x;return{id:s.id,...s.data(),createdAt:(o=(l=s.data().createdAt)==null?void 0:l.toDate)==null?void 0:o.call(l),updatedAt:(x=(a=s.data().updatedAt)==null?void 0:a.toDate)==null?void 0:x.call(a)}})}catch(t){return console.error("ì¤ë²ëí ë´ì¬ì ì¡°í ì¤í¨:",t),[]}},async create(t){const d=L(t);return(await J(I(D,te),{...d,createdAt:new Date,updatedAt:new Date})).id},async update(t,d){const s=L(d);await Z(R(D,te,t),{...s,updatedAt:new Date})},async remove(t){await W(R(D,te,t))}},K={async getAll(){try{const t=V(I(D,U),q("start_date","asc"));return(await B(t)).docs.map(s=>{var l,o,a,x;return{id:s.id,...s.data(),createdAt:(o=(l=s.data().createdAt)==null?void 0:l.toDate)==null?void 0:o.call(l),updatedAt:(x=(a=s.data().updatedAt)==null?void 0:a.toDate)==null?void 0:x.call(a)}})}catch(t){console.error("ì¤ë²ëí ì¼ì ì¡°í ì¤í¨:",t);try{const d=V(I(D,U),q("sortOrder","asc"));return(await B(d)).docs.map(l=>{var o,a,x,h;return{id:l.id,...l.data(),createdAt:(a=(o=l.data().createdAt)==null?void 0:o.toDate)==null?void 0:a.call(o),updatedAt:(h=(x=l.data().updatedAt)==null?void 0:x.toDate)==null?void 0:h.call(x)}})}catch{return[]}}},async getByDateRange(t,d){try{const s=V(I(D,U),Fe("start_date","<=",d),q("start_date","asc"));return(await B(s)).docs.map(a=>{var x,h,r,i;return{id:a.id,...a.data(),createdAt:(h=(x=a.data().createdAt)==null?void 0:x.toDate)==null?void 0:h.call(x),updatedAt:(i=(r=a.data().updatedAt)==null?void 0:r.toDate)==null?void 0:i.call(r)}}).filter(a=>a.end_date>=t)}catch(s){return console.error("ì¤ë²ëí ì¼ì ë²ì ì¡°í ì¤í¨:",s),[]}},async create(t){const d=L(t);return d.start_date&&(d.month=parseInt(d.start_date.split("-")[1])),d.sortOrder||(d.sortOrder=0),(await J(I(D,U),{...d,createdAt:new Date,updatedAt:new Date})).id},async update(t,d){const s=L(d);s.start_date&&(s.month=parseInt(s.start_date.split("-")[1])),await Z(R(D,U,t),{...s,updatedAt:new Date})},async remove(t){await W(R(D,U,t))}},ce={async getAll(){try{const t=V(I(D,se),q("createdAt","desc"));return(await B(t)).docs.map(s=>{var l,o,a,x;return{id:s.id,...s.data(),createdAt:(o=(l=s.data().createdAt)==null?void 0:l.toDate)==null?void 0:o.call(l),updatedAt:(x=(a=s.data().updatedAt)==null?void 0:a.toDate)==null?void 0:x.call(a)}})}catch(t){return console.error("ì¤ë²ëí ê³µì§ ì¡°í ì¤í¨:",t),[]}},async create(t){const d=L(t);return(await J(I(D,se),{...d,createdAt:new Date,updatedAt:new Date})).id},async update(t,d){const s=L(d);await Z(R(D,se,t),{...s,updatedAt:new Date})},async remove(t){await W(R(D,se,t))}},oe={async getAll(){try{const t=V(I(D,ae),q("createdAt","desc"));return(await B(t)).docs.map(s=>{var o,a;const l=s.data();return{id:s.id,...l,createdAt:((a=(o=l.createdAt)==null?void 0:o.toDate)==null?void 0:a.call(o))||l.createdAt}})}catch(t){return console.error("ì¤ë²ëí ìê°ì ì² ì¡°í ì¤í¨:",t),[]}},async create(t){const d=L(t);return(await J(I(D,ae),{...d,createdAt:new Date})).id},async updateStatus(t,d){await Z(R(D,ae,t),{status:d})},async remove(t){await W(R(D,ae,t))}},be={class:"ìì
",event:"íì¬",notice:"ê³µì§",other:"기í"},ke=["class","event","notice","other"],H={class:{bg:"bg-amber-50",text:"text-amber-700",border:"border-amber-200",dot:"bg-
1amber-500"},event:{bg:"bg-green-50",text:"text-green-700",border:"border-green-200",dot:"bg-green-500"},notice:{bg:"bg-blue-50",text:"text-blue-700",border:"border-blue-200",dot:"bg-blue-500"},other:{bg:"bg-gray-50",text:"text-gray-600",border:"border-gray-200",dot:"bg-gray-400"}},Ve=["ì¤ì","ìì
ìë´","íì¬","ì¼ë°"],fe={pending:"ë기",approved:"ì¹ì¸",rejected:"ê±°ì "},qe=["ð¼","ð¿","ð","ð¸","ðº","ð","ð»","ð·"],je=["êµíë°","ì¥ë¯¸ë°","ë°±í©ë°","ëª©ë ¨ë°","ê°ë리ë°","ì§ë¬ëë°","무ê¶íë°","í´ë°ë¼ê¸°ë°","í¤ë¦½ë°","ë¼ì¼ë½ë°","ìì íë°","매íë°","ë²ê½ë°","ì½ì¤ëª¨ì¤ë°","ëë°±ë°"];function De({onSelect:t,placeholder:d="êµì ë¶ìì ê²ì..."}){const[s,l]=n.useState(!1),[o,a]=n.useState(""),[x,h]=n.useState([]),[r,i]=n.useState([]),[u,y]=n.useState(!1),p=n.useRef(null);return n.useEffect(()=>{(async()=>{y(!0);try{const c=await Ce.getMembers();h(c)}catch{}y(!1)})()},[]),n.useEffect(()=>{if(!o.trim())i(x.slice(0,30));else{const m=o.toLowerCase();i(x.filter(c=>{var f,w;return((f=c.name)==null?void 0:f.toLowerCase().includes(m))||((w=c.phone)==null?void 0:w.includes(m))}).slice(0,30))}},[o,x]),n.useEffect(()=>{const m=c=>{p.current&&!p.current.contains(c.target)&&l(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]),e.jsxs("div",{ref:p,className:"relative",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Re,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-amber-500"}),e.jsx("input",{type:"text",value:o,onChange:m=>{a(m.target.value),s||l(!0)},onFocus:()=>l(!0),placeholder:d,className:"w-full pl-8 pr-3 py-2 border border-amber-200 rounded-lg text-[13px] bg-amber-50/50 focus:outline-none focus:ring-2 focus:ring-amber-400"}),u&&e.jsx(ge,{className:"absolute right-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-gray-400 animate-spin"})]}),s&&e.jsx("div",{className:"absolute z-50 w-full mt-1 bg-white border border-gray-200 rounded-lg shadow-lg max-h-52 overflow-y-auto",children:u?e.jsx("div",{className:"p-3 text-center text-gray-400 text-[12px]",children:"ë¡ë© ì¤..."}):r.length===0?e.jsx("div",{className:"p-3 text-center text-gray-400 text-[12px]",children:o?"ê²°ê³¼ ìì":"êµì¸ ìì"}):e.jsx("ul",{children:r.map(m=>{var c;return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>{t(m),a(""),l(!1)},className:"w-full px-3 py-2 text-left hover:bg-amber-50 flex items-center gap-2 border-b border-gray-50 last:border-0 text-[12px]",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-gray-100 flex items-center justify-center flex-shrink-0 text-[10px] text-gray-500",children:m.photo_url?e.jsx("img",{src:m.photo_url,alt:"",className:"w-6 h-6 rounded-full object-cover"}):(c=m.name)==null?void 0:c[0]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"font-medium text-gray-900",children:m.name}),e.jsx("span",{className:"text-gray-400 ml-1.5",children:m.position||"ì±ë"})]}),e.jsx("span",{className:"text-gray-400 flex-shrink-0",children:m.mobile_phone||m.phone||""})]})},m.id)})})})]})}function xt(){const[t,d]=n.useState("dashboard"),[s,l]=n.useState([]),[o,a]=n.useState([]),[x,h]=n.useState([]),[r,i]=n.useState([]),[u,y]=n.useState([]),[p,m]=n.useState({}),[c,f]=n.useState(!0),w=n.useCallback(async()=>{f(!0);const[S,b,_,$,E]=await Promise.all([ne.getAll(),de.getAll(),K.getAll(),ce.getAll(),oe.getAll()]);l(S),a(b),h(_),i($),y(E);const g=b.filter(A=>A.memberId).map(A=>A.memberId);if(g.length>0){const A={};await Promise.all(g.map(async T=>{const M=await Ce.getMember(T);M!=null&&M.position&&(A[T]=M.position)})),m(A)}f(!1)},[]);n.useEffect(()=>{w()},[w]);const C=[{id:"dashboard",label:"ëìë³´ë",icon:_e},{id:"enrollments",label:"ìê°ì ì²",icon:pe},{id:"classes",label:"ë° í¸ì±",icon:X},{id:"staff",label:"ë´ì¬ì",icon:he},{id:"schedule",label:"ì¼ì /ê³µì§",icon:Ne}];return e.jsxs("div",{className:"space-y-0",children:[e.jsx("div",{className:"rounded-xl p-6 text-white mb-5",style:{background:"linear-gradient(135deg, #78350f 0%, #92400e 50%, #d97706 100%)"},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:"w-10 h-10 bg-white/20 rounded-lg flex items-center justify-center",children:e.jsx(X,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-[18px] font-bold",children:"ì¤ë²ëí ê´ë¦¬"}),e.jsx("p",{className:"text-[12px] text-white/70 mt-0.5",children:"ë°í¸ì±, ë´ì¬ì, ì¼ì , ê³µì§, ìê°ì ì²ì ê´ë¦¬í©ëë¤"})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"bg-white/15 backdrop-blur-sm rounded-lg px-4 py-2 text-center",children:[e.jsx("div",{className:"text-[11px] text-white/70",children:"ë°"}),e.jsx("div",{className:"text-[22px] font-bold leading-tight",children:s.length})]}),e.jsxs("div",{className:"bg-white/15 backdrop-blur-sm rounded-lg px-4 py-2 text-center",children:[e.jsx("div",{className:"text-[11px] text-white/70",children:"ìê°ì ì²"}),e.jsx("div",{className:"text-[22px] font-bold leading-tight",children:u.length})]})]})]})}),e.jsx("div",{className:"flex gap-1 border-b border-gray-200 mb-4",children:C.map(S=>e.jsxs("button",{onClick:()=>d(S.id),className:`flex items-center gap-1.5 px-4 py-2.5 text-[13px] font-medium border-b-2 -mb-[1px] transition-colors ${t===S.id?"border-amber-600 text-amber-700":"border-transparent text-gray-500 hover:text-gray-700"}`,children:[e.jsx(S.icon,{className:"w-4 h-4"}),S.label]},S.id))}),c?e.jsx("div",{className:"text-center py-16 text-gray-400 text-[13px]",children:"ë¡ë© ì¤..."}):e.jsxs(e.Fragment,{children:[t==="dashboard"&&e.jsx(Be,{classes:s,staffList:o,enrollments:u,notices:r,events:x}),t==="enrollments"&&e.jsx(ze,{enrollments:u,classes:s,onReload:w}),t==="classes"&&e.jsx(He,{classes:s,staffList:o,onReload:w}),t==="staff"&&e.jsx(Ke,{staffList:o,positionMap:p,onReload:w}),t==="schedule"&&e.jsx(Qe,{events:x,notices:r,onReload:w})]})]})}function Be({classes:t,staffList:d,enrollments:s,notices:l,events:o}){const a=s.filter(r=>r.status==="pending").length,x=s.filter(r=>r.status==="approved").length,h=[{label:"ë°",value:t.length,unit:"ê°",color:"#d97706",bg:"#fffbeb",icon:X},{label:"ë´ì¬ì",value:d.length,unit:"ëª
",color:"#16a34a",bg
1:"#f0fdf4",icon:he},{label:"ìê°ì ì²",value:s.length,unit:"ê±´",color:"#7c3aed",bg:"#f5f3ff",icon:pe},{label:"ì¹ì¸",value:x,unit:"ê±´",color:"#0891b2",bg:"#ecfeff",icon:ve},{label:"ë기",value:a,unit:"ê±´",color:"#ea580c",bg:"#fff7ed",icon:re}];return e.jsxs("div",{className:"space-y-5",children:[e.jsx("div",{className:"grid grid-cols-5 gap-3",children:h.map((r,i)=>e.jsxs("div",{className:"rounded-xl p-4 border",style:{backgroundColor:r.bg,borderColor:`${r.color}20`},children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-[11px] font-medium",style:{color:r.color},children:r.label}),e.jsx(r.icon,{className:"w-4 h-4",style:{color:r.color,opacity:.5}})]}),e.jsxs("div",{className:"text-[24px] font-bold leading-tight",style:{color:r.color},children:[r.value,e.jsx("span",{className:"text-[12px] font-normal ml-0.5",children:r.unit})]})]},i))}),a>0&&e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3 flex items-center gap-2",children:[e.jsx(Ee,{className:"w-4 h-4 text-amber-500 flex-shrink-0"}),e.jsxs("span",{className:"text-[13px] text-amber-700",children:["íì¸ ë기 ì¤ì¸ ìê°ì ì²ì´ ",e.jsxs("strong",{children:[a,"ê±´"]})," ììµëë¤."]})]}),e.jsxs("div",{className:"bg-white rounded-xl border p-4",children:[e.jsxs("h3",{className:"text-[14px] font-bold text-gray-900 mb-3 flex items-center gap-2",children:[e.jsx(X,{className:"w-4 h-4 text-amber-600"}),"ë°ë³ íí©"]}),t.length===0?e.jsx("div",{className:"text-center py-8 text-gray-400 text-[13px]",children:"ë±ë¡ë ë°ì´ ììµëë¤"}):e.jsx("div",{className:"grid grid-cols-4 gap-3",children:t.map(r=>{const i=s.filter(u=>u.preferredClass===r.name);return e.jsxs("div",{className:"p-3 bg-amber-50/50 rounded-lg border border-amber-100",children:[e.jsx("div",{className:"text-xl mb-1",children:r.icon}),e.jsx("div",{className:"text-[13px] font-bold text-gray-900",children:r.name}),e.jsxs("div",{className:"text-[11px] text-gray-500 mt-0.5",children:["êµì¬: ",r.teacherName]}),e.jsxs("div",{className:"text-[11px] text-amber-600 mt-1 font-medium",children:["ì ì² ",i.length,"ëª
"]})]},r.id)})})]}),e.jsxs("div",{className:"bg-white rounded-xl border p-4",children:[e.jsxs("h3",{className:"text-[14px] font-bold text-gray-900 mb-3 flex items-center gap-2",children:[e.jsx(we,{className:"w-4 h-4 text-amber-600"}),"ìµê·¼ ê³µì§ì¬í"]}),l.length===0?e.jsx("div",{className:"text-center py-8 text-gray-400 text-[13px]",children:"ê³µì§ì¬íì´ ììµëë¤"}):e.jsx("div",{className:"space-y-2",children:l.slice(0,5).map(r=>e.jsxs("div",{className:"flex items-center gap-3 p-2.5 bg-gray-50 rounded-lg",children:[e.jsx("span",{className:`text-[11px] font-medium px-2 py-0.5 rounded ${r.category==="ì¤ì"?"bg-red-100 text-red-700":r.category==="ìì
ìë´"?"bg-blue-100 text-blue-700":r.category==="íì¬"?"bg-green-100 text-green-700":"bg-gray-100 text-gray-600"}`,children:r.category}),e.jsx("span",{className:"text-[13px] text-gray-900 font-medium flex-1 truncate",children:r.title}),r.pinned&&e.jsx("span",{className:"text-[10px] text-amber-600 font-bold",children:"ê³ ì "})]},r.id))})]})]})}function ze({enrollments:t,classes:d,onReload:s}){const[l,o]=n.useState(""),[a,x]=n.useState("all"),[h,r]=n.useState(!1),[i,u]=n.useState(!1),y=t.filter(c=>!(a!=="all"&&c.status!==a||l&&!c.name.includes(l)&&!c.phone.includes(l))),p=async(c,f)=>{try{await oe.updateStatus(c,f),v.success(`${fe[f]} ì²ë¦¬ëììµëë¤`),s()}catch{v.error("ìí ë³ê²½ ì¤í¨")}},m=async c=>{if(confirm(`"${c.name}" ëì ìê°ì ì²ì ìì íìê² ìµëê¹?`))try{await oe.remove(c.id),v.success("ìì ëììµëë¤"),s()}catch{v.error("ìì ì¤í¨")}};return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"bg-white rounded-lg border px-3 py-2.5 flex items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1 max-w-[200px]",children:[e.jsx($e,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-gray-400"}
1),e.jsx("input",{type:"text",placeholder:"ì´ë¦/ì íë²í¸ ê²ì",value:l,onChange:c=>o(c.target.value),className:"w-full pl-8 pr-2 py-1.5 border rounded text-[12px] focus:outline-none focus:ring-1 focus:ring-amber-400"})]}),e.jsxs("select",{value:a,onChange:c=>x(c.target.value),className:"border rounded px-2 py-1.5 text-[12px] focus:outline-none focus:ring-1 focus:ring-amber-400",children:[e.jsx("option",{value:"all",children:"ì ì²´ ìí"}),e.jsx("option",{value:"pending",children:"ë기"}),e.jsx("option",{value:"approved",children:"ì¹ì¸"}),e.jsx("option",{value:"rejected",children:"ê±°ì "})]}),e.jsxs("div",{className:"text-[12px] text-gray-500 ml-auto",children:["ì´ ",e.jsx("strong",{className:"text-gray-800",children:y.length}),"ê±´"]}),e.jsxs("button",{onClick:()=>u(!0),className:"flex items-center gap-1 px-3 py-1.5 bg-blue-600 text-white rounded text-[12px] font-medium hover:bg-blue-700 transition-colors",title:"ìê°ììê² í¸ì ë°ì¡",children:[e.jsx(le,{className:"w-3.5 h-3.5"}),"í¸ì ë°ì¡"]}),e.jsxs("button",{onClick:()=>r(!0),className:"flex items-center gap-1 px-3 py-1.5 bg-amber-600 text-white rounded text-[12px] font-medium hover:bg-amber-700 transition-colors",children:[e.jsx(Se,{className:"w-3.5 h-3.5"}),"ìê°ì ì¶ê°"]})]}),y.length===0?e.jsxs("div",{className:"bg-white rounded-lg border text-center py-16 text-gray-400 text-[13px]",children:[e.jsx(pe,{className:"w-10 h-10 mx-auto mb-3 text-gray-300"}),"ìê°ì ì²ì´ ììµëë¤"]}):e.jsx("div",{className:"bg-white rounded-lg border overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-gray-100 border-b border-gray-300",children:[e.jsx("th",{className:"px-2.5 py-2 text-left text-[11px] font-bold text-gray-700 border-r border-gray-200 w-8",children:"#"}),e.jsx("th",{className:"px-2.5 py-2 text-left text-[11px] font-bold text-gray-700 border-r border-gray-200",children:"ì´ë¦"}),e.jsx("th",{className:"px-2.5 py-2 text-center text-[11px] font-bold text-gray-700 border-r border-gray-200 w-12",children:"ì±ë³"}),e.jsx("th",{className:"px-2.5 py-2 text-center text-[11px] font-bold text-gray-700 border-r border-gray-200 w-16",children:"ì¶ì"}),e.jsx("th",{className:"px-2.5 py-2 text-left text-[11px] font-bold text-gray-700 border-r border-gray-200 w-[120px]",children:"ì°ë½ì²"}),e.jsx("th",{className:"px-2.5 py-2 text-left text-[11px] font-bold text-gray-700 border-r border-gray-200",children:"주ì"}),e.jsx("th",{className:"px-2.5 py-2 text-center text-[11px] font-bold text-gray-700 border-r border-gray-200 w-16",children:"í¬ë§ë°"}),e.jsx("th",{className:"px-2.5 py-2 text-center text-[11px] font-bold text-gray-700 border-r border-gray-200 w-14",children:"êµíµ"}),e.jsx("th",{className:"px-2.5 py-2 text-left text-[11px] font-bold text-gray-700 border-r border-gray-200 w-[100px]",children:"ë¹ìì°ë½"}),e.jsx("th",{className:"px-2.5 py-2 text-left text-[11px] font-bold text-gray-700 border-r border-gray-200",children:"ê±´ê°"}),e.jsx("th",{className:"px-2.5 py-2 text-center text-[11px] font-bold text-gray-700 border-r border-gray-200 w-12",children:"ìí"}),e.jsx("th",{className:"px-2.5 py-2 text-center text-[11px] font-bold text-gray-700 w-[100px]",children:"ê´ë¦¬"})]})}),e.jsx("tbody",{children:y.map((c,f)=>e.jsxs("tr",{className:`border-b border-gray-200 hover:bg-amber-50/40 transition-colors ${f%2===1?"bg-gray-50/50":""}`,children:[e.jsx("td",{className:"px-2.5 py-1.5 text-[11px] text-gray-400 border-r border-gray-100",children:f+1}),e.jsx("td",{className:"px-2.5 py-1.5 border-r border-gray-100",children:e.jsx("span",{className:"text-[12px] font-semibold text-gray-900",children:c.name})}),e.jsx("td",{className:"px-2.5 py-1.5 text-center text-[12px] text-gray-700 border-r border-gray-100",children:c.gender}),e.jsx("td",{className:"px-2.5 py-1.5 text-center text-[12px] text-gray-600 border-r border-gray-100",children:c.birthYear}),e.jsx("td",{className:"px-2.5 py-1.5 text-[12px] text-gray-700 border-r border-gray-100",children:c.phone}),e.jsx("td",{className:"px-2.5 py-1.5 text-[11px] text-gray-500 border-r border-gray-100 truncate max-w-[180px]",children:c.address||"-"}),e.jsx("td",{className:"px-2.5 py-1.5 text-center text-[12px] text-gray-700 border-r border-gray-100",children:c.preferredClass||"-"}),e.jsx("td",{className:"px-2.5 py-1.5 text-center text-[11px] text-gray-600 border-r border-gray-100",children:c.transport||"-"}),e.jsx("td",{className:"px-2.5 py-1.5 text-[11px] text-gray-500 border-r border-gray-100",children:c.emergencyName?`${c.emergencyName} ${c.emergencyPhone||""}`:"-"}),e.jsx("td",{className:"px-2.5 py-1.5 text-[11px] text-gray-500 border-r border-gray-100 truncate max-w-[120px]",children:c.healthNote||"-"}),e.jsx("td",{className:"px-2.5 py-1.5 text-center border-r border-gray-100",children:e.jsx("span",{className:`inline-block px-1.5 py-0.5 rounded text-[10px] font-bold ${c.status==="approved"?"bg-green-100 text-green-700":c.status==="rejected"?"bg-red-100 text-red-700":"bg-amber-100 text-amber-700"}`,children:fe[c.status]})}),e.jsx("td",{className:"px-1.5 py-1.5 text-center",children:e.jsxs("div",{className:"flex items-center justify-center gap-0.5",children:[c.status!=="approved"&&e.jsx("button",{onClick:()=>p(c.id,"approved"),className:"p-1 text-green-600 hover:bg-green-50 rounded transition-colors",title:"ì¹ì¸",children:e.jsx(ve,{className:"w-3.5 h-3.5"})}),c.status!=="rejected"&&e.jsx("button",{onClick:()=>p(c.id,"rejected"),className:"p-1 text-red-500 hover:bg-red-50 rounded transition-colors",title:"ê±°ì ",children:e.jsx(Te,{className:"w-3.5 h-3.5"})}),c.status!=="pending"&&e.jsx("button",{onClick:()=>p(c.id,"pending"),className:"p-1 text-amber-500 hover:bg-amber-50 rounded transition-colors",title:"ë기",children:e.jsx(re,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>m(c),className:"p-1 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded transition-colors",title:"ìì ",children:e.jsx(Q,{className:"w-3.5 h-3.5"})})]})})]},c.id))})]})})}),h&&e.jsx(Ue,{classes:d,onClose:()=>r(!1),onSave:()=>{r(!1),s()}}),i&&e.jsx(Ae,{targetLabel:"ìê°ì",memberIds:t.filter(c=>c.memberId).map(c=>c.memberId),totalCount:t.length,linkedCount:t.filter(c=>c.memberId).length,onClose:()=>u(!1)})]})}function Ue({classes:t,onClose:d,onSave:s}){var F;const[l,o]=n.useState(""),[a,x]=n.useState("ì¬"),[h,r]=n.useState(""),[i,u]=n.useState(""),[y,p]=n.useState(""),[m,c]=n.useState(((F=t[0])==null?void 0:F.name)||""),[f,w]=n.useState(""),[C,S]=n.useState(""),[b,_]=n.useState(""),[$,E]=n.useState(""),[g,A]=n.useState(),[T,M]=n.useState(!1),N=j=>{if(A(j.id),o(j.name||""),x(j.gender||"ì¬"),j.birth_date){const G=j.birth_date.substring(0,4);G&&!isNaN(Number(G))&&r(G)}u(j.mobile_phone||j.phone||""),p(j.address_full||"")},O=async()=>
1{if(!l.trim()||!i.trim()){v.error("ì´ë¦ê³¼ ì°ë½ì²ë íìì
ëë¤");return}M(!0);try{await oe.create({name:l,gender:a,birthYear:h,phone:i,address:y||void 0,preferredClass:m,emergencyName:f||void 0,emergencyPhone:C||void 0,healthNote:b||void 0,transport:$||void 0,status:"approved",year:new Date().getFullYear(),memberId:g}),v.success("ìê°ìì´ ì¶ê°ëììµëë¤"),s()}catch{v.error("ì¶ê° ì¤í¨")}finally{M(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white rounded-xl p-5 w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-[15px] font-bold flex items-center gap-2",children:[e.jsx(Se,{className:"w-4 h-4 text-amber-600"}),"ìê°ì ì¶ê°"]}),e.jsx("button",{onClick:d,className:"p-1 hover:bg-gray-100 rounded-md",children:e.jsx(z,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"mb-4 p-3 bg-amber-50 rounded-lg border border-amber-200",children:[e.jsx("label",{className:"block text-[11px] font-bold text-amber-700 mb-1.5",children:"êµì ë¶ìì ê°ì ¸ì¤ê¸°"}),e.jsx(De,{onSelect:N,placeholder:"ì´ë¦ ëë ì íë²í¸ë¡ ê²ì..."}),e.jsx("p",{className:"text-[10px] text-amber-600 mt-1",children:"êµì ë¶ìì ì ííë©´ 기본 ì ë³´ê° ìëì¼ë¡ ì±ìì§ëë¤"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-medium text-gray-600 mb-1",children:"ì´ë¦ *"}),e.jsx("input",{value:l,onChange:j=>o(j.target.value),className:"w-full border rounded px-2.5 py-1.5 text-[12px]",placeholder:"í길ë"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-medium text-gray-600 mb-1",children:"ì±ë³"}),e.jsxs("select",{value:a,onChange:j=>x(j.target.value),className:"w-full border rounded px-2.5 py-1.5 text-[12px]",children:[e.jsx("option",{value:"ë¨",children:"ë¨"}),e.jsx("option",{value:"ì¬",children:"ì¬"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-medium text-gray-600 mb-1",children:"ì¶ìì°ë"}),e.jsx("input",{value:h,onChange:j=>r(j.target.value),className:"w-full border rounded px-2.5 py-1.5 text-[12px]",placeholder:"1950"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-medium text-gray-600 mb-1",children:"ì°ë½ì² *"}),e.jsx("input",{value:i,onChange:j=>u(j.target.value),className:"w-full border rounded px-2.5 py-1.5 text-[12px]",placeholder:"010-1234-5678"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"block text-[11px] font-medium text-gray-600 mb-1",children:"주ì"}),e.jsx("input",{value:y,onChange:j=>p(j.target.value),className:"w-full border rounded px-2.5 py-1.5 text-[12px]",placeholder:"ììì ..."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-medium text-gray-600 mb-1",children:"í¬ë§ë°"}),e.jsxs("select",{value:m,onChange:j=>c(j.target.value),className:"w-full border rounded px-2.5 py-1.5 text-[12px]",children:[t.map(j=>e.jsxs("option",{value:j.name,children:[j.icon," ",j.name]},j.id)),e.jsx("option",{value:"",children:"미ì "})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-medium text-gray-600 mb-1",children:"êµíµí¸"}),e.jsxs("select",{value:$,onChange:j=>E(j.target.value),className:"w-full border rounded px-2.5 py-1.5 text-[12px]",children:[e.jsx("option",{value:"",children:"ì í"}),e.jsx("option",{value:"ìê°ì©",children:"ìê°ì©"}),e.jsx("option",{value:"êµíì°¨ë",children:"êµíì°¨ë"}),e.jsx("option",{value:"ëì¤êµíµ",children:"ëì¤êµíµ"}),e.jsx("option",{value:"ëë³´",children:"ëë³´"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-medium text-gray-600 mb-1",children:"ë¹ìì°ë½ ì´ë¦"}),e.jsx("input",{value:f,onChange:j=>w(j.target.value),className:"w-full border rounded px-2.5 py-1.5 text-[12px]",placeholder:"ë³´í¸ì ì´ë¦"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-medium text-gray-600 mb-1",children:"ë¹ìì°ë½ ì í"}),e.jsx("input",{value:C,onChange:j=>S(j.target.value),className:"w-full border rounded px-2.5 py-1.5 text-[12px]",placeholder:"010-0000-0000"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"block text-[11px] font-medium text-gray-600 mb-1",children:"ê±´ê° ì°¸ê³ ì¬í"}),e.jsx("input",{value:b,onChange:j=>_(j.target.value),className:"w-full border rounded px-2.5 py-1.5 text-[12px]",placeholder:"í¹ì´ì¬í ìì"})]})]}),e.jsxs("div",{className:"flex gap-2 mt-4",children:[e.jsx("button",{onClick:d,className:"flex-1 px-3 py-2 border rounded-lg text-[12px] font-medium text-gray-600 hover:bg-gray-50",children:"ì·¨ì"}),e.jsx("button",{onClick:O,disabled:T,className:"flex-1 px-3 py-2 bg-amber-600 text-white rounded-lg text-[12px] font-medium hover:bg-amber-700 disabled:opacity-50",children:T?"ì ì¥ ì¤...":"ìê°ì ì¶ê°"})]})]})})}function He({classes:t,staffList:d,onReload:s}){const[l,o]=n.useState(!1),[a,x]=n.useState(null),h=async i=>{if(confirm(`"${i.name}" ë°ì ìì íìê² ìµëê¹?`))try{await ne.remove(i.id),v.success("ìì ëììµëë¤"),s()}catch{v.error("ìì ì¤í¨")}},r=i=>i.teacherNames&&i.teacherNames.length>0?i.teacherNames.join(", "):i.teacherName||"-";return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-white rounded-xl border p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-[13px] text-gray-500",children:["ì ì²´ ",e.jsx("strong",{className:"text-gray-800",children:t.length}),"ê° ë°"]}),e.jsxs("button",{onClick:()=>{o(!0),x(null)},className:"flex items-center gap-1.5 px-4 py-2 bg-amber-600 text-white rounded-lg text-[13px] font-medium hover:bg-amber-700 shadow-sm transition-colors",children:[e.jsx(xe,{className:"w-4 h-4"}),"ë° ì¶ê°"]})]})}),t.length===0&&!l?e.jsxs("div",{className:"bg-white rounded-xl border text-center py-16 text-gray-400 text-[13px]",children:[e.jsx(X,{className:"w-10 h-10 mx-auto mb-3 text-gray-300"}),"ë±ë¡ë ë°ì´ ììµëë¤"]}):e.jsx("div",{className:"grid grid-cols-2 gap-3",children:t.map(i=>e.jsxs("div",{className:"bg-white rounded-xl border p-5 hover:shadow-md transition-shadow",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-3xl",children:i.icon}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[15px] font-bold text-gray-900",children:i.name}),e.jsxs("div",{className:"text-[13px] text-gray-500 mt-0.5",children:["ë´ìêµì¬: ",e.jsx("strong",{className:"text-gray-700",children:r(i)})]})]})]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>{x(i),o(!1)},className:"p-1.5 text-gray-400 hover:text-amber-600 hover:bg-amber-50 rounded-md transition-colors",children:e.jsx(ue,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>h(i),className:"p-1.5 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded-md transition-colors",children:e.jsx(Q,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"text-[11px] text-gray-400 mt-2",children:["ìì: ",i.sortOrder]})]},i.id))}),(l||a)&&e.jsx(Ge,{item:a,staffList:d,nextOrder:t.length+1,onClose:()=>{o(!1),x(null)},onSave:()=>{o(!1),x(null),s()}})]})}function Ge({item:t,staffList:d,nextOrder:s,onClose:l,onSave:o}){const[a,x]=n.useState((t==null?void 0:t.name)||""),[h,r]=n.useState(""),[i,u]=n.useState(!1),[y,p]=n.useState((t==null?void 0:t.icon)||"ð¼"),[m,c]=n.useState((t==null?void 0:t.teacherNames)||
1(t!=null&&t.teacherName?[t.teacherName]:[])),[f,w]=n.useState(!1),[C,S]=n.useState((t==null?void 0:t.sortOrder)??s),[b,_]=n.useState(!1);n.useEffect(()=>{t!=null&&t.name&&!je.includes(t.name)&&(u(!0),r(t.name))},[t]);const $=async()=>{const g=i?h.trim():a;if(!g){v.error("ë° ì´ë¦ì ì ííì¸ì");return}if(m.length===0){v.error("ë´ìêµì¬ë¥¼ ì ííì¸ì");return}_(!0);try{const A={name:g,icon:y,teacherName:m.join(", "),teacherNames:m,sortOrder:C};t?await ne.update(t.id,A):await ne.create(A),v.success(t?"ìì ëììµëë¤":"ì¶ê°ëììµëë¤"),o()}catch{v.error("ì ì¥ ì¤í¨")}finally{_(!1)}},E=g=>{c(A=>A.includes(g)?A.filter(T=>T!==g):[...A,g])};return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",onClick:l,children:e.jsxs("div",{className:"bg-white rounded-xl p-6 w-full max-w-md",onClick:g=>g.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-[16px] font-bold",children:t?"ë° ìì ":"ë° ì¶ê°"}),e.jsx("button",{onClick:l,className:"p-1 hover:bg-gray-100 rounded-md",children:e.jsx(z,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-gray-600 mb-1",children:"ìì´ì½"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:qe.map(g=>e.jsx("button",{onClick:()=>p(g),className:`text-2xl p-2 rounded-lg border-2 transition-colors ${y===g?"border-amber-500 bg-amber-50":"border-gray-200 hover:border-gray-300"}`,children:g},g))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-gray-600 mb-1",children:"ë° ì´ë¦"}),i?e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:h,onChange:g=>r(g.target.value),className:"flex-1 border rounded-lg px-3 py-2 text-[13px]",placeholder:"ë° ì´ë¦ ì
ë ¥",autoFocus:!0}),e.jsx("button",{onClick:()=>{u(!1),r(""),x("")},className:"px-3 py-2 border rounded-lg text-[12px] text-gray-500 hover:bg-gray-50",children:"목ë¡"})]}):e.jsxs("select",{value:a,onChange:g=>{if(g.target.value==="__custom__"){u(!0),x("");return}x(g.target.value)},className:"w-full border rounded-lg px-3 py-2 text-[13px] bg-white",children:[e.jsx("option",{value:"",children:"ì ííì¸ì"}),je.map(g=>e.jsx("option",{value:g,children:g},g)),e.jsx("option",{value:"__custom__",children:"ì§ì ì
ë ¥..."})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[12px] font-medium text-gray-600 mb-1",children:["ë´ìêµì¬ ",e.jsx("span",{className:"text-gray-400",children:"(ë´ì¬ì ì¤ ë³µìì í)"})]}),m.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:m.map(g=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 bg-amber-50 text-amber-700 rounded-full text-[12px] font-medium border border-amber-200",children:[g,e.jsx("button",{onClick:()=>E(g),className:"hover:text-red-500",children:e.jsx(z,{className:"w-3 h-3"})})]},g))}),e.jsxs("button",{onClick:()=>w(!f),className:"w-full border rounded-lg px-3 py-2 text-[13px] text-left bg-white hover:bg-gray-50 flex items-center justify-between",children:[e.jsx("span",{className:"text-gray-400",children:m.length>0?`${m.length}ëª
ì íë¨`:"ë´ì¬ì를 ì ííì¸ì"}),e.jsx(Ie,{className:`w-4 h-4 text-gray-400 transition-transform ${f?"rotate-180":""}`})]}),f&&e.jsx("div",{className:"mt-1 border rounded-lg max-h-48 overflow-y-auto bg-white shadow-lg",children:d.length===0?e.jsx("div",{className:"px-3 py-4 text-[12px] text-gray-400 text-center",children:"ë±ë¡ë ë´ì¬ìê° ììµëë¤"}):d.map(g=>e.jsxs("label",{className:"flex items-center gap-2.5 px-3 py-2 hover:bg-amber-50 cursor-pointer border-b last:border-b-0",children:[e.jsx("input",{type:"checkbox",checked:m.includes(g.name),onChange:()=>E(g.name),className:"w-4 h-4 rounded border-gray-300 text-amber-600 focus:ring-amber-500"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-[13px] text-gray-900",children:g.name}),g.role&&e.jsxs("span",{className:"text-[11px] text-gray-400 ml-1.5",children:["(",g.role,")"]})]})]},g.id))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-gray-600 mb-1",children:"ìì"}),e.jsx("input",{type:"number",value:C,onChange:g=>S(Number(g.target.value)),className:"w-full border rounded-lg px-3 py-2 text-[13px]"})]})]}),e.jsxs("div",{className:"flex gap-2 mt-5",children:[e.jsx("button",{onClick:l,className:"flex-1 px-4 py-2.5 border rounded-lg text-[13px] font-medium text-gray-600 hover:bg-gray-50",children:"ì·¨ì"}),e.jsx("button",{onClick:$,disabled:b,className:"flex-1 px-4 py-2.5 bg-amber-600 text-white rounded-lg text-[13px] font-medium hover:bg-amber-700 disabled:opacity-50",children:b?"ì ì¥ ì¤...":t?"ìì ":"ì¶ê°"})]})]})})}function Ke({staffList:t,positionMap:d,onReload:s}){const[l,o]=n.useState(!1),[a,x]=n.useState(null),[h,r]=n.useState(!1),i=async u=>
1{if(confirm(`"${u.name}" ë´ì¬ì를 ìì íìê² ìµëê¹?`))try{await de.remove(u.id),v.success("ìì ëììµëë¤"),s()}catch{v.error("ìì ì¤í¨")}};return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"bg-white rounded-lg border px-3 py-2.5 flex items-center justify-between",children:[e.jsxs("div",{className:"text-[12px] text-gray-500",children:["ì ì²´ ",e.jsx("strong",{className:"text-gray-800",children:t.length}),"ëª
"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>r(!0),className:"flex items-center gap-1 px-3 py-1.5 bg-blue-600 text-white rounded text-[12px] font-medium hover:bg-blue-700 transition-colors",title:"ë´ì¬ììê² í¸ì ë°ì¡",children:[e.jsx(le,{className:"w-3.5 h-3.5"}),"í¸ì ë°ì¡"]}),e.jsxs("button",{onClick:()=>{o(!0),x(null)},className:"flex items-center gap-1 px-3 py-1.5 bg-amber-600 text-white rounded text-[12px] font-medium hover:bg-amber-700 transition-colors",children:[e.jsx(xe,{className:"w-3.5 h-3.5"}),"ë´ì¬ì ì¶ê°"]})]})]}),t.length===0&&!l?e.jsxs("div",{className:"bg-white rounded-lg border text-center py-16 text-gray-400 text-[13px]",children:[e.jsx(he,{className:"w-10 h-10 mx-auto mb-3 text-gray-300"}),"ë±ë¡ë ë´ì¬ìê° ììµëë¤"]}):e.jsx("div",{className:"bg-white rounded-lg border overflow-hidden",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-gray-100 border-b border-gray-300",children:[e.jsx("th",{className:"px-2.5 py-2 text-center text-[11px] font-bold text-gray-700 border-r border-gray-200 w-8",children:"#"}),e.jsx("th",{className:"px-2.5 py-2 text-left text-[11px] font-bold text-gray-700 border-r border-gray-200 w-[120px]",children:"ì§ë¶/ìí "}),e.jsx("th",{className:"px-2.5 py-2 text-left text-[11px] font-bold text-gray-700 border-r border-gray-200",children:"ì´ë¦"}),e.jsx("th",{className:"px-2.5 py-2 text-left text-[11px] font-bold text-gray-700 border-r border-gray-200 w-[120px]",children:"ì°ë½ì²"}),e.jsx("th",{className:"px-2.5 py-2 text-center text-[11px] font-bold text-gray-700 w-[80px]",children:"ê´ë¦¬"})]})}),e.jsx("tbody",{children:t.map((u,y)=>e.jsxs("tr",{className:`border-b border-gray-200 hover:bg-amber-50/40 transition-colors ${y%2===1?"bg-gray-50/50":""}`,children:[e.jsx("td",{className:"px-2.5 py-1.5 text-center text-[11px] text-gray-400 border-r border-gray-100",children:u.sortOrder}),e.jsx("td",{className:"px-2.5 py-1.5 border-r border-gray-100",children:e.jsx("span",{className:"inline-block px-1.5 py-0.5 rounded bg-amber-100 text-amber-700 text-[11px] font-medium",children:u.role})}),e.jsxs("td",{className:"px-2.5 py-1.5 text-[12px] font-semibold text-gray-900 border-r border-gray-100",children:[u.name,u.memberId&&d[u.memberId]&&e.jsx("span",{className:"ml-1 text-[10px] font-normal text-gray-500",children:d[u.memberId]})]}),e.jsx("td",{className:"px-2.5 py-1.5 text-[12px] text-gray-600 border-r border-gray-100",children:u.phone||"-"}),e.jsx("td",{className:"px-1.5 py-1.5 text-center",children:e.jsxs("div",{className:"flex items-center justify-center gap-0.5",children:[e.jsx("button",{onClick:()=>{x(u),o(!1)},className:"p-1 text-gray-400 hover:text-amber-600 hover:bg-amber-50 rounded transition-colors",children:e.jsx(ue,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>i(u),className:"p-1 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded transition-colors",children:e.jsx(Q,{className:"w-3.5 h-3.5"})})]})})]},u.id))})]})}),(l||a)&&e.jsx(Xe,{item:a,nextOrder:t.length+1,onClose:()=>{o(!1),x(null)},onSave:()=>{o(!1),x(null),s()}}),h&&e.jsx(Ae,{targetLabel:"ë´ì¬ì",memberIds:t.filter(u=>u.memberId).map(u=>u.memberId),totalCount:t.length,linkedCount:t.filter(u=>u.memberId).length,onClose:()=>r(!1)})]})}function Xe({item:t,nextOrder:d,onClose:s,onSave:l}){const[o,a]=n.useState((t==null?void 0:t.role)||""),[x,h]=n.useState((t==null?void 0:t.name)||""),[r,i]=n.useState((t==null?void 0:t.phone)||""),[u,y]=n.useState((t==null?void 0:t.memberId)||""),[p,m]=n.useState((t==null?void 0:t.sortOrder)??d),[c,f]=n.useState(!1),w=b=>{y(b.id),h(b.name||""),i(b.mobile_phone||b.phone||"")},C=async()=>
1{if(!o.trim()||!x.trim()){v.error("ìí ê³¼ ì´ë¦ì ì
ë ¥íì¸ì");return}f(!0);try{const b={role:o,name:x,phone:r||void 0,memberId:u||void 0,sortOrder:p};t?await de.update(t.id,b):await de.create(b),v.success(t?"ìì ëììµëë¤":"ì¶ê°ëììµëë¤"),l()}catch{v.error("ì ì¥ ì¤í¨")}finally{f(!1)}},S=["íì¥","êµìì","íì¥","ë´ìêµì¬","ì°¨ëì§ë","취미ë°","ë´ì¬"];return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white rounded-xl p-5 w-full max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-[15px] font-bold",children:t?"ë´ì¬ì ìì ":"ë´ì¬ì ì¶ê°"}),e.jsx("button",{onClick:s,className:"p-1 hover:bg-gray-100 rounded-md",children:e.jsx(z,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"mb-4 p-3 bg-amber-50 rounded-lg border border-amber-200",children:[e.jsx("label",{className:"block text-[11px] font-bold text-amber-700 mb-1.5",children:"êµì ë¶ìì ê°ì ¸ì¤ê¸°"}),e.jsx(De,{onSelect:w,placeholder:"ì´ë¦ ëë ì íë²í¸ë¡ ê²ì..."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-medium text-gray-600 mb-1",children:"ì§ë¶/ìí *"}),e.jsx("input",{value:o,onChange:b=>a(b.target.value),className:"w-full border rounded px-2.5 py-1.5 text-[12px]",placeholder:"ì: íì¥"}),e.jsx("div",{className:"flex gap-1 mt-1 flex-wrap",children:S.map(b=>e.jsx("button",{onClick:()=>a(b),className:"text-[10px] px-1.5 py-0.5 bg-gray-100 hover:bg-amber-100 text-gray-600 rounded transition-colors",children:b},b))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-medium text-gray-600 mb-1",children:"ì´ë¦ *"}),e.jsx("input",{value:x,onChange:b=>h(b.target.value),className:"w-full border rounded px-2.5 py-1.5 text-[12px]",placeholder:"ì: í길ë"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-medium text-gray-600 mb-1",children:"ì°ë½ì²"}),e.jsx("input",{value:r,onChange:b=>i(b.target.value),className:"w-full border rounded px-2.5 py-1.5 text-[12px]",placeholder:"010-1234-5678"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-medium text-gray-600 mb-1",children:"ìì"}),e.jsx("input",{type:"number",value:p,onChange:b=>m(Number(b.target.value)),className:"w-full border rounded px-2.5 py-1.5 text-[12px]"})]})]}),e.jsxs("div",{className:"flex gap-2 mt-4",children:[e.jsx("button",{onClick:s,className:"flex-1 px-3 py-2 border rounded-lg text-[12px] font-medium text-gray-600 hover:bg-gray-50",children:"ì·¨ì"}),e.jsx("button",{onClick:C,disabled:c,className:"flex-1 px-3 py-2 bg-amber-600 text-white rounded-lg text-[12px] font-medium hover:bg-amber-700 disabled:opacity-50",children:c?"ì ì¥ ì¤...":t?"ìì ":"ì¶ê°"})]})]})})}function Qe({events:t,notices:d,onReload:s}){const[l,o]=n.useState("events");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>o("events"),className:`px-4 py-2 rounded-lg text-[13px] font-medium transition-colors ${l==="events"?"bg-amber-600 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:["ì°ì¤ íì¬ (",t.length,")"]}),e.jsxs("button",{onClick:()=>o("notices"),className:`px-4 py-2 rounded-lg text-[13px] font-medium transition-colors ${l==="notices"?"bg-amber-600 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:["ê³µì§ì¬í (",d.length,")"]})]}),l==="events"?e.jsx(We,{events:t,onReload:s}):e.jsx(tt,{notices:d,onReload:s})]})}function We({events:t,onReload:d}){const[s,l]=n.useState("month"),[o,a]=n.useState(new Date),[x,h]=n.useState([]),[r,i]=n.useState(!1),[u,y]=n.useState(!1),[p,m]=n.useState(null),[c,f]=n.useState(""),[w,C]=n.useState([]),S=o.getFullYear(),b=o.getMonth(),_=k=>k.toString().padStart(2,"0"),$=(()=>{const P=new Date(S,b,1).getDay(),Y=new Date(S,b,1-P),me=new Date(S,b+1,6*7-P-new Date(S,b+1,0).getDate()-P+1);return{start:`${Y.getFullYear()}-${_(Y.getMonth()+1)}-${_(Y.getDate())}`,end:`${me.getFullYear()}-${_(me.getMonth()+1)}-${_(me.getDate())}`}})(),E=n.useCallback(async()=>{i(!0);try{const k=await K.getByDateRange($.start,$.end);h(k)}catch{h([])}finally{i(!1)}},[$.start,$.end]);n.useEffect(()=>{E()},[E]);const g=w.length===0?x:x.filter(k=>w.includes(k.category)),A=()=>a(new Date(S,b-1,1)),T=()=>a(new Date(S,b+1,1)),M=()=>a(new Date),N=k=>{f(k),m(null),y(!0)},O=k=>{m(k),f(""),y(!0)},F=async k=>{try{p?(await K.update(p.id,k),v.success("ìì ëììµëë¤")):(await K.create(k),v.success("ì¶ê°ëììµëë¤")),y(!1),m(null),E(),d()}catch{v.error("ì ì¥ ì¤í¨")}},j=async()=>
1{if(!(!p||!confirm(`"${p.title}" ì¼ì ì ìì íìê² ìµëê¹?`)))try{await K.remove(p.id),v.success("ìì ëììµëë¤"),y(!1),m(null),E(),d()}catch{v.error("ìì ì¤í¨")}},G=k=>{C(P=>P.includes(k)?P.filter(Y=>Y!==k):[...P,k])};return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-white rounded-xl border p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:A,className:"p-1.5 hover:bg-gray-100 rounded-lg",children:e.jsx(Me,{className:"w-5 h-5 text-gray-600"})}),e.jsxs("h2",{className:"text-[16px] font-bold text-gray-900 min-w-[120px] text-center",children:[S,"ë
",b+1,"ì"]}),e.jsx("button",{onClick:T,className:"p-1.5 hover:bg-gray-100 rounded-lg",children:e.jsx(Oe,{className:"w-5 h-5 text-gray-600"})}),e.jsx("button",{onClick:M,className:"ml-2 px-3 py-1 text-[12px] font-medium text-amber-700 bg-amber-50 border border-amber-200 rounded-lg hover:bg-amber-100",children:"ì¤ë"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-0.5 bg-gray-100 rounded-lg p-0.5",children:[e.jsxs("button",{onClick:()=>l("month"),className:`px-3 py-1.5 text-[12px] font-medium rounded-md transition-colors ${s==="month"?"bg-white text-gray-900 shadow-sm":"text-gray-500"}`,children:[e.jsx(Ne,{className:"w-3.5 h-3.5 inline mr-1"}),"ì"]}),e.jsxs("button",{onClick:()=>l("list"),className:`px-3 py-1.5 text-[12px] font-medium rounded-md transition-colors ${s==="list"?"bg-white text-gray-900 shadow-sm":"text-gray-500"}`,children:[e.jsx(Pe,{className:"w-3.5 h-3.5 inline mr-1"}),"목ë¡"]})]}),e.jsxs("button",{onClick:()=>{m(null),f(""),y(!0)},className:"flex items-center gap-1.5 px-4 py-2 bg-amber-600 text-white rounded-lg text-[13px] font-medium hover:bg-amber-700 shadow-sm",children:[e.jsx(xe,{className:"w-4 h-4"}),"ì¼ì ì¶ê°"]})]})]})}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[ke.map(k=>{const P=H[k],Y=w.includes(k);return e.jsx("button",{onClick:()=>G(k),className:`px-2.5 py-1 text-[11px] font-medium rounded-full border transition-all ${Y?`${P.bg} ${P.text} ${P.border}`:"bg-gray-100 text-gray-500 border-gray-200 hover:bg-gray-200"}`,children:be[k]},k)}),w.length>0&&e.jsx("button",{onClick:()=>C([]),className:"px-2 py-1 text-[11px] text-gray-400 hover:text-gray-600",children:"ì´ê¸°í"})]}),r?e.jsx("div",{className:"bg-white rounded-xl border text-center py-16",children:e.jsx(ge,{className:"w-6 h-6 mx-auto animate-spin text-amber-500"})}):s==="month"?e.jsx(Ze,{year:S,month:b,schedules:g,onDateClick:N,onEventClick:O}):e.jsx(Je,{schedules:g,onEventClick:O}),u&&e.jsx(et,{event:p,defaultDate:c,onClose:()=>{y(!1),m(null)},onSave:F,onDelete:p?j:void 0})]})}function Ze({year:t,month:d,schedules:s,onDateClick:l,onEventClick:o}){const a=p=>p.toString().padStart(2,"0"),x=["ì¼","ì","í","ì","목","ê¸","í "],h=(()=>{const p=new Date;return`${p.getFullYear()}-${a(p.getMonth()+1)}-${a(p.getDate())}`})(),i=new Date(t,d,1).getDay();new Date(t,d+1,0).getDate();const u=[];for(let p=0;p<42;p++){const m=new Date(t,d,1-i+p);u.push({key:`${m.getFullYear()}-${a(m.getMonth()+1)}-${a(m.getDate())}`,date:m.getDate(),isCurrentMonth:m.getMonth()===d})}const y={};for(const p of s){if(!p.start_date)continue;const m=p.start_date,c=p.end_date||p.start_date;let f=new Date(m);const w=new Date(c);for(;f<=w;){const C=`${f.getFullYear()}-${a(f.getMonth()+1)}-${a(f.getDate())}`;y[C]||(y[C]=[]),y[C].push(p),f.setDate(f.getDate()+1)}}return e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[e.jsx("div",{className:"grid grid-cols-7 border-b border-gray-200",children:x.map((p,m)=>e.jsx("div",{className:`py-2 text-center text-[12px] font-medium ${m===0?"text-red-500":m===6?"text-blue-500":"text-gray-500"}`,children:p},p))}),e.jsx("div",{className:"grid grid-cols-7",children:u.map((p,m)=>{const c=y[p.key]||[],f=p.key===h,w=m%7;return e.jsxs("div",{onClick:()=>l(p.key),className:`min-h-[100px] border-b border-r border-gray-100 p-1 cursor-pointer hover:bg-amber-50/30 transition-colors ${p.isCurrentMonth?"":"bg-gray-50/50"}`,children:[e.jsx("div",{className:`w-6 h-6 flex items-center justify-center text-[12px] font-medium rounded-full mb-0.5 ${f?"bg-amber-600 text-white":p.isCurrentMonth?w===0?"text-red-500":w===6?"text-blue-500":"text-gray-700":"text-gray-300"}`,children:p.date}),e.jsxs("div",{className:"space-y-0.5",children:[c.slice(0,3).map(C=>{const S=H[C.category]||H.other;return e.jsxs("button",{onClick:b=>{b.stopPropagation(),o(C)},className:`w-full text-left px-1 py-0.5 rounded text-[10px] font-medium truncate ${S.bg} ${S.text}`,children:[!C.all_day&&C.start_time&&e.jsxs("span",{className:"text-[9px] opacity-70",children:[C.start_time," "]}
1),C.title]},C.id)}),c.length>3&&e.jsxs("span",{className:"text-[10px] text-gray-400 pl-1",children:["+",c.length-3,"ê±´"]})]})]},p.key)})})]})}function Je({schedules:t,onEventClick:d}){const s=r=>r.toString().padStart(2,"0"),l=(()=>{const r=new Date;return`${r.getFullYear()}-${s(r.getMonth()+1)}-${s(r.getDate())}`})(),o=["ì¼","ì","í","ì","목","ê¸","í "],a={};for(const r of t)r.start_date&&(a[r.start_date]||(a[r.start_date]=[]),a[r.start_date].push(r));const x=Object.keys(a).sort(),h=r=>{const i=new Date(r);return`${i.getMonth()+1}ì ${i.getDate()}ì¼ (${o[i.getDay()]})`};return x.length===0?e.jsxs("div",{className:"bg-white rounded-xl border text-center py-16 text-gray-400 text-[13px]",children:[e.jsx(re,{className:"w-10 h-10 mx-auto mb-3 text-gray-300"}),"ì´ ê¸°ê°ì ë±ë¡ë ì¼ì ì´ ììµëë¤"]}):e.jsx("div",{className:"space-y-3",children:x.map(r=>e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 overflow-hidden",children:[e.jsxs("div",{className:`px-4 py-2 border-b border-gray-100 flex items-center gap-2 ${r===l?"bg-amber-50":"bg-gray-50"}`,children:[e.jsx("span",{className:`text-[13px] font-semibold ${r===l?"text-amber-700":"text-gray-700"}`,children:h(r)}),r===l&&e.jsx("span",{className:"px-1.5 py-0.5 bg-amber-600 text-white text-[10px] rounded font-medium",children:"ì¤ë"}),e.jsxs("span",{className:"text-[11px] text-gray-400",children:[a[r].length,"ê±´"]})]}),e.jsx("div",{className:"divide-y divide-gray-50",children:a[r].map(i=>{const u=H[i.category]||H.other;return e.jsxs("button",{onClick:()=>d(i),className:"w-full text-left px-4 py-3 hover:bg-gray-50 flex items-start gap-3 transition-colors",children:[e.jsx("div",{className:`w-2 h-2 rounded-full mt-1.5 flex-shrink-0 ${u.dot}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[e.jsx("span",{className:"text-[13px] font-medium text-gray-900",children:i.title}),e.jsx("span",{className:`px-1.5 py-0.5 text-[10px] font-medium rounded-full ${u.bg} ${u.text}`,children:be[i.category]})]}),e.jsxs("div",{className:"flex items-center gap-3 text-[12px] text-gray-500",children:[i.all_day?e.jsx("span",{children:"ì¢
ì¼"}):i.start_time&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(re,{className:"w-3 h-3"}),i.start_time,i.end_time?` ~ ${i.end_time}`:""]}),i.location&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(Le,{className:"w-3 h-3"}),i.location]})]}),i.description&&e.jsx("p",{className:"text-[11px] text-gray-400 mt-0.5 truncate",children:i.description})]})]},i.id)})})]},r))})}function et({event:t,defaultDate:d,onClose:s,onSave:l,onDelete:o}){const a=()=>{const N=new Date,O=F=>F.toString().padStart(2,"0");return`${N.getFullYear()}-${O(N.getMonth()+1)}-${O(N.getDate())}`},[x,h]=n.useState((t==null?void 0:t.title)||""),[r,i]=n.useState((t==null?void 0:t.description)||""),[u,y]=n.useState((t==null?void 0:t.location)||""),[p,m]=n.useState((t==null?void 0:t.start_date)||d||a()),[c,f]=n.useState((t==null?void 0:t.end_date)||d||a()),[w,C]=n.useState((t==null?void 0:t.start_time)||"10:00"),[S,b]=n.useState((t==null?void 0:t.end_time)||"12:00"),[_,$]=n.useState((t==null?void 0:t.all_day)??!1),[E,g]=n.useState((t==null?void 0:t.category)||"event"),[A,T]=n.useState(!1),M=async()=>{if(!x.trim()){v.error("ì¼ì ëª
ì ì
ë ¥íì¸ì");return}T(!0);try{await l({title:x.trim(),description:r.trim()||void 0,location:u.trim()||void 0,start_date:p,start_time:_?void 0:w,end_date:c,end_time:_?void 0:S,all_day:_,category:E})}finally{T(!1)}};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/40",onClick:s,children:e.jsxs("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-lg max-h-[85vh] overflow-y-auto",onClick:N=>N.stopPropagation(),children:[e.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 flex items-center justify-between",children:[e.jsx("h3",{className:"text-[16px] font-bold text-gray-900",children:t?"ì¼ì ìì ":"ì ì¼ì "}),e.jsx("button",{onClick:s,className:"p-1 hover:bg-gray-100 rounded-lg",children:e.jsx(z,{className:"w-5 h-5 text-gray-500"})})]}),e.jsxs("div",{className:"p-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[12px] font-medium text-gray-600 mb-1 block",children:"ì¼ì ëª
*"}),e.jsx("input",{type:"text",value:x,onChange:N=>h(N.target.value),autoFocus:!0,placeholder:"ì¼ì ì 목ì ì
ë ¥íì¸ì",className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-[13px]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[12px] font-medium text-gray-600 mb-1.5 block",children:"ì¹´í
ê³ ë¦¬"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:ke.map(N=>{const O=H[N],F=E===N;return e.jsx("button",{onClick:()=>g(N),className:`px-3 py-1 text-[12px] font-medium rounded-full border transition-all ${F?`${O.bg} ${O.text} ${O.border}`:"bg-gray-50 text-gray-500 border-gray-200"}`,children:be[N]},N)})})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:_,onChange:N=>$(N.target.checked),className:"rounded border-gray-300 text-amber-600"}),e.jsx("span",{className:"text-[13px] text-gray-700",children:"ì¢
ì¼"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[12px] font-medium text-gray-600 mb-1 block",children:"ììì¼"}),e.jsx("input",{type:"date",value:p,onChange:N=>{m(N.target.value),N.target.value>c&&f(N.target.value)},className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-[13px]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[12px] font-medium text-gray-600 mb-1 block",children:"ì¢
ë£ì¼"}),e.jsx("input",{type:"date",value:c,onChange:N=>f(N.target.value),min:p,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-[13px]"})]}),!_&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[12px] font-medium text-gray-600 mb-1 block",children:"ìì ìê°"}),e.jsx("input",{type:"time",value:w,onChange:N=>C(N.target.value),className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-[13px]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[12px] font-medium text-gray-600 mb-1 block",children:"ì¢
ë£ ìê°"}),e.jsx("input",{type:"time",value:S,onChange:N=>b(N.target.value),className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-[13px]"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[12px] font-medium text-gray-600 mb-1 block",children:"ì¥ì"}),e.jsx("input",{type:"text",value:u,onChange:N=>y(N.target.value),placeholder:"ì¥ì (ì í)",className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-[13px]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[12px] font-medium text-gray-600 mb-1 block",children:"ë©ëª¨"}),e.jsx("textarea",{value:r,onChange:N=>i(N.target.value),placeholder:"ì¶ê° ë©ëª¨ (ì í)",rows:2,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-[13px] resize-none"})]})]}),e.jsxs("div",{className:"px-5 py-4 border-t border-gray-100 flex items-center justify-between",children:[e.jsx("div",{children:t&&o&&e.jsxs("button",{onClick:o,className:"px-3 py-1.5 text-[12px] text-red-600 hover:bg-red-50 rounded-lg flex items-center gap-1",children:[e.jsx(Q,{className:"w-3.5 h-3.5"})," ìì "]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:s,className:"px-4 py-2 text-[13px] text-gray-600 hover:bg-gray-100 rounded-lg",children:"ì·¨ì"}),e.jsx("button",{onClick:M,disabled:!x.trim()||A,className:"px-4 py-2 bg-amber-600 text-white text-[13px] font-medium rounded-lg hover:bg-amber-700 disabled:opacity-50",children:A?"ì ì¥ ì¤...":t?"ìì ":"ì ì¥"})]})]})]})})}function tt({notices:t,onReload:d}){const[s,l]=n.useState(!1),[o,a]=n.useState(null),x=async h=>{if(confirm(`"${h.title}" ê³µì§ë¥¼ ìì íìê² ìµëê¹?`))try{await ce.remove(h.id),v.success("ìì ëììµëë¤"),d()}catch{v.error("ìì ì¤í¨")}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-white rounded-xl border p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-[13px] text-gray-500",children:["ì ì²´ ",e.jsx("strong",{className:"text-gray-800",children:t.length}),"ê°"]}),e.jsxs("button",{onClick:()=>{l(!0),a(null)},className:"flex items-center gap-1.5 px-4 py-2 bg-amber-600 text-white rounded-lg text-[13px] font-medium hover:bg-amber-700 shadow-sm transition-colors",children:[e.jsx(xe,{className:"w-4 h-4"}),"ê³µì§ ìì±"]})]})}),t.length===0&&!s?e.jsxs("div",{className:"bg-white rounded-xl border text-center py-16 text-gray-400 text-[13px]",children:[e.jsx(we,{className:"w-10 h-10 mx-auto mb-3 text-gray-300"}),"ê³µì§ì¬íì´ ììµëë¤"]}):e.jsx("div",{className:"bg-white rounded-xl border overflow-hidden",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 bg-gray-50/80",children:[e.jsx("th",{className:"px-4 py-3 text-center text-[12px] font-semibold text-gray-600 w-[80px]",children:"ì¹´í
ê³ ë¦¬"}),e.jsx("th",{className:"px-4 py-3 text-left text-[12px] font-semibold text-gray-600",children:"ì 목"}),e.jsx("th",{className:"px-4 py-3 text-center text-[12px] font-semibold text-gray-600 w-[60
1px]",children:"ê³ ì "}),e.jsx("th",{className:"px-4 py-3 text-center text-[12px] font-semibold text-gray-600 w-[100px]",children:"ìì±ì¼"}),e.jsx("th",{className:"px-4 py-3 text-center text-[12px] font-semibold text-gray-600 w-[120px]",children:"ì¡ì
"})]})}),e.jsx("tbody",{children:t.map((h,r)=>e.jsxs("tr",{className:`border-b border-gray-100 hover:bg-amber-50/30 transition-colors ${r%2===1?"bg-gray-50/30":""}`,children:[e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("span",{className:`inline-block px-2 py-0.5 rounded text-[11px] font-medium ${h.category==="ì¤ì"?"bg-red-100 text-red-700":h.category==="ìì
ìë´"?"bg-blue-100 text-blue-700":h.category==="íì¬"?"bg-green-100 text-green-700":"bg-gray-100 text-gray-600"}`,children:h.category})}),e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("div",{className:"text-[13px] font-medium text-gray-900",children:h.title}),e.jsx("div",{className:"text-[11px] text-gray-400 mt-0.5 truncate max-w-[300px]",children:h.content})]}),e.jsx("td",{className:"px-4 py-3 text-center text-[13px]",children:h.pinned?e.jsx("span",{className:"text-amber-500 font-bold",children:"Y"}):e.jsx("span",{className:"text-gray-300",children:"-"})}),e.jsx("td",{className:"px-4 py-3 text-center text-[12px] text-gray-500",children:h.createdAt?new Date(h.createdAt).toLocaleDateString("ko-KR"):"-"}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[e.jsx("button",{onClick:()=>{a(h),l(!1)},className:"p-1.5 text-gray-400 hover:text-amber-600 hover:bg-amber-50 rounded-md transition-colors",children:e.jsx(ue,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>x(h),className:"p-1.5 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded-md transition-colors",children:e.jsx(Q,{className:"w-4 h-4"})})]})})]},h.id))})]})}),(s||o)&&e.jsx(st,{item:o,onClose:()=>{l(!1),a(null)},onSave:()=>{l(!1),a(null),d()}})]})}function st({item:t,onClose:d,onSave:s}){const[l,o]=n.useState((t==null?void 0:t.title)||""),[a,x]=n.useState((t==null?void 0:t.content)||""),[h,r]=n.useState((t==null?void 0:t.category)||"ì¼ë°"),[i,u]=n.useState((t==null?void 0:t.pinned)??!1),[y,p]=n.useState(!1),m=async()=>{if(!l.trim()||!a.trim()){v.error("ì 목과 ë´ì©ì ì
ë ¥íì¸ì");return}p(!0);try{t?await ce.update(t.id,{title:l,content:a,category:h,pinned:i}):await ce.create({title:l,content:a,category:h,pinned:i}),v.success(t?"ìì ëììµëë¤":"ê³µì§ê° ìì±ëììµëë¤"),s()}catch{v.error("ì ì¥ ì¤í¨")}finally{p(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white rounded-xl p-6 w-full max-w-lg",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-[16px] font-bold",children:t?"ê³µì§ ìì ":"ê³µì§ ìì±"}),e.jsx("button",{onClick:d,className:"p-1 hover:bg-gray-100 rounded-md",children:e.jsx(z,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"block text-[12px] font-medium text-gray-600 mb-1",children:"ì¹´í
ê³ ë¦¬"}),e.jsx("select",{value:h,onChange:c=>r(c.target.value),className:"w-full border rounded-lg px-3 py-2 text-[13px]",children:Ve.map(c=>e.jsx("option",{value:c,children:c},c))})]}),e.jsx("div",{className:"flex items-end pb-0.5",children:e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:i,onChange:c=>u(c.target.checked),className:"w-4 h-4 text-amber-600 rounded border-gray-300"}),e.jsx("span",{className:"text-[13px] font-medium text-gray-600",children:"ìë¨ ê³ ì "})]})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-gray-600 mb-1",children:"ì 목"}),e.jsx("input",{value:l,onChange:c=>o(c.target.value),className:"w-full border rounded-lg px-3 py-2 text-[13px]",placeholder:"ê³µì§ ì 목"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-gray-600 mb-1",children:"ë´ì©"}),e.jsx("textarea",{value:a,onChange:c=>x(c.target.value),className:"w-full border rounded-lg px-3 py-2 text-[13px] h-40 resize-y",placeholder:"ê³µì§ ë´ì©ì ì
ë ¥íì¸ì"})]})]}),e.jsxs("div",{className:"flex gap-2 mt-5",children:[e.jsx("button",{onClick:d,className:"flex-1 px-4 py-2.5 border rounded-lg text-[13px] font-medium text-gray-600 hover:bg-gray-50",children:"ì·¨ì"}),e.jsx("button",{onClick:m,disabled:y,className:"flex-1 px-4 py-2.5 bg-amber-600 text-white rounded-lg text-[13px] font-medium hover:bg-amber-700 disabled:opacity-50",children:y?"ì ì¥ ì¤...":t?"ìì ":"ìì±"})]})]})})}function Ae({targetLabel:t,memberIds:d,totalCount:s,linkedCount:l,onClose:o}){const{user:a}=Ye(),[x,h]=n.useState(""),[r,i]=n.useState(""),[u,y]=n.useState(!1),p=async()=>
1{if(!x.trim()||!r.trim()){v.error("ì 목과 ë´ì©ì ì
ë ¥íì¸ì");return}if(d.length===0){v.error("êµì ë¶ì ì°ëë ëìì´ ìì´ ë°ì¡í ì ììµëë¤");return}y(!0);try{const m=await ye.createPush({title:x,body:r,status:"draft",category:"content",link_url:"/silver/index.html",link_type:"internal",target_config:{mode:"individual",individual:{member_ids:d}},created_by:(a==null?void 0:a.uid)||"admin"});await ye.sendNow(m),v.success(`${t} ${d.length}ëª
ìê² í¸ì를 ë°ì¡íìµëë¤`),o()}catch(m){v.error((m==null?void 0:m.message)||"í¸ì ë°ì¡ ì¤í¨")}finally{y(!1)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white rounded-xl p-5 w-full max-w-md",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-[15px] font-bold flex items-center gap-2",children:[e.jsx(le,{className:"w-4 h-4 text-blue-600"}),t," í¸ì ë°ì¡"]}),e.jsx("button",{onClick:o,className:"p-1 hover:bg-gray-100 rounded-md",children:e.jsx(z,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"mb-4 p-3 bg-blue-50 rounded-lg border border-blue-200",children:e.jsxs("div",{className:"text-[12px] text-blue-700",children:[e.jsx("strong",{children:"ë°ì¡ ëì:"})," êµì ë¶ ì°ëë ",t," ",e.jsxs("strong",{children:[l,"ëª
"]}),l<s&&e.jsxs("span",{className:"text-blue-500",children:[" (ì ì²´ ",s,"ëª
ì¤ ",s-l,"ëª
ì êµì ë¶ ë¯¸ì°ë)"]})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-medium text-gray-600 mb-1",children:"ì 목 *"}),e.jsx("input",{value:x,onChange:m=>h(m.target.value),className:"w-full border rounded px-2.5 py-2 text-[13px]",placeholder:"ì: ì¤ë²ëí ìë´"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-medium text-gray-600 mb-1",children:"ë´ì© *"}),e.jsx("textarea",{value:r,onChange:m=>i(m.target.value),className:"w-full border rounded px-2.5 py-2 text-[13px] h-24 resize-y",placeholder:"ì림 ë´ì©ì ì
ë ¥íì¸ì"})]})]}),e.jsxs("div",{className:"flex gap-2 mt-4",children:[e.jsx("button",{onClick:o,className:"flex-1 px-3 py-2 border rounded-lg text-[12px] font-medium text-gray-600 hover:bg-gray-50",children:"ì·¨ì"}),e.jsx("button",{onClick:p,disabled:u||d.length===0,className:"flex-1 px-3 py-2 bg-blue-600 text-white rounded-lg text-[12px] font-medium hover:bg-blue-700 disabled:opacity-50 flex items-center justify-center gap-1.5",children:u?e.jsxs(e.Fragment,{children:[e.jsx(ge,{className:"w-3.5 h-3.5 animate-spin"})," ë°ì¡ ì¤..."]}):e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"w-3.5 h-3.5"})," ë°ì¡í기"]})})]})]})})}export{xt as SilverUniversityPage};
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.