1import{j as e}from"./vendor-data-Z5doMMu-.js";import{b as D,r as o}from"./vendor-react-zNM0AU50.js";import{f}from"./faithJourneyService-B56_rhGw.js";import{m as E}from"./index-D1K3lVhu.js";import{a7 as m,c as _,aa as L,g as A,a as q,d as P,aw as F,af as O,T as $}from"./vendor-ui-CW5bJ11U.js";import"./vendor-firebase-Da9KY1q_.js";import"./vendor-charts-08G1rM8P.js";function U(){var w;const i=D(),[p,u]=o.useState(!0),[h,x]=o.useState([]),[s,d]=o.useState([]),[c,a]=o.useState(""),[b,C]=o.useState(""),[j,S]=o.useState("all"),[k,g]=o.useState(!1);o.useEffect(()=>{v()},[]);async function v(){try{u(!0);const[t,l]=await Promise.all([f.getAllEvents(),E.getMembers()]);x(t),d(l.filter(r=>r.member_classification==="ìëì¶ìì±ë"))}catch(t){console.error("ë°ì´í° ë¡ë© ì¤í¨:",t),m.error("ë°ì´í°ë¥¼ ë¶ë¬ì¬ ì ììµëë¤")}finally{u(!1)}}const y=h.filter(t=>{var r;const l=s.find(n=>n.id===t.member_id);if(!l||c&&t.member_id!==c)return!1;if(b){const n=b.toLowerCase();if(!l.name.toLowerCase().includes(n)&&!t.title.toLowerCase().includes(n)&&!((r=t.description)!=null&&r.toLowerCase().includes(n)))return!1}return!(j!=="all"&&t.event_type!==j)}),N=y.reduce((t,l)=>(t[l.member_id]||(t[l.member_id]=[]),t[l.member_id].push(l),t),{});async function M(t){if(confirm("ì´ ì´ë²¤í¸ë¥¼ ìì íìê² ìµëê¹?"))try{await f.deleteEvent(t),m.success("ìì ëììµëë¤"),v()}catch{m.error("ìì ì ì¤í¨íìµëë¤")}}return p?e.jsx("div",{className:"flex items-center justify-center h-96",children:e.jsx("div",{className:"text-gray-500 text-[13px]",children:"ë°ì´í°ë¥¼ ë¶ë¬ì¤ë ì¤..."})}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-[18px] font-bold text-gray-900 flex items-center gap-2",children:[e.jsx(_,{className:"w-5 h-5 text-blue-600"}),"ì ì ì¬ì ì¶ì "]}),e.jsx("p",{className:"text-[12px] text-gray-500 mt-1",children:"êµì¸ë¤ì ì ì ì±ì¥ ê³¼ì ì 기ë¡íê³ ì¶ì í©ëë¤"})]}),e.jsxs("button",{onClick:()=>g(!0),className:"flex items-center gap-1.5 px-3 py-1.5 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors text-[13px] font-medium",children:[e.jsx(L,{className:"w-4 h-4"}),"ì´ë²¤í¸ ì¶ê°"]})]}),e.jsxs("div",{className:"bg-white border border-gray-200 rounded shadow-sm p-3",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-gray-700 mb-1",children:"êµì¸ ì í"}),e.jsxs("select",{value:c,onChange:t=>a(t.target.value),className:"compact-input",children:[e.jsx("option",{value:"",children:"ì ì²´"}),s.map(t=>e.jsxs("option",{value:t.id,children:[t.name," (",t.position,")"]},t.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-gray-700 mb-1",children:"ì´ë²¤í¸ ì í"}),e.jsxs("select",{value:j,onChange:t=>S(t.target.value),className:"compact-input",children:[e.jsx("option",{value:"all",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.jsx("option",{value:"기í",children:"기í"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-gray-700 mb-1",children:"ê²ì"}),e.jsxs("div",{className:"relative",children:[e.jsx(A,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"ì´ë¦, ì 목, ë´ì©...",value:b,onChange:t=>C(t.target.value),className:"compact-input pl-8"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-2 text-[11px] text-gray-500",children:[e.jsxs("span",{children:["ì´ ",y.length,"ê°ì ì´ë²¤í¸"]}),c&&e.jsx("span",{className:"px-2 py-0.5 bg-blue-100 text-blue-700 rounded",children:(w=s.find(t=>t.id===c))==null?void 0:w.name})]})]}),e.jsx("div",{className:"space-y-6",children:Object.keys(N).length===0?e.jsxs("div",{className:"bg-white border border-gray-200 rounded shadow-sm p-12 text-center",children:[e.jsx(_,{className:"w-12 h-12 text-gray-300 mx-auto mb-3"}),e.jsx("p",{className:"text-[13px] text-gray-500",children:c||b||j!=="all"?"ê²ì ê²°ê
1³¼ê° ììµëë¤":"ë±ë¡ë ì ì ì¬ì ì´ë²¤í¸ê° ììµëë¤"})]}):Object.entries(N).map(([t,l])=>{const r=s.find(n=>n.id===t);return r?e.jsxs("div",{className:"bg-white border border-gray-200 rounded shadow-sm p-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4 pb-3 border-b border-gray-100",children:[r.photo_url?e.jsx("img",{src:r.photo_url,alt:r.name,className:"w-12 h-12 rounded-full object-cover"}):e.jsx("div",{className:"w-12 h-12 rounded-full bg-gray-200 flex items-center justify-center text-[14px] text-gray-600 font-bold",children:r.name[0]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-[14px] font-bold text-gray-900",children:r.name}),e.jsxs("p",{className:"text-[11px] text-gray-500",children:[r.position," · ",r.district||"미배ì "," · ",l.length,"ê° ì´ë²¤í¸"]})]}),e.jsxs("button",{onClick:()=>i(`/members/${r.id}`),className:"text-[12px] text-blue-600 hover:text-blue-800 flex items-center gap-1",children:["ìì¸ë³´ê¸°",e.jsx(q,{className:"w-3 h-3"})]})]}),e.jsx("div",{className:"space-y-3",children:l.map((n,T)=>e.jsx(J,{event:n,isLast:T===l.length-1,onEdit:()=>{m.success("í¸ì§ 기ë¥ì ì¤ë¹ ì¤ì
ëë¤")},onDelete:()=>M(n.id)},n.id))})]},t):null})}),k&&e.jsx(R,{members:s,onClose:()=>g(!1),onSuccess:()=>{g(!1),v()}})]})}function J({event:i,isLast:p,onEdit:u,onDelete:h}){const x={ë±ë¡:"bg-blue-100 text-blue-700 border-blue-200",ì¸ë¡:"bg-green-100 text-green-700 border-green-200",ì§ë¶ìëª
:"bg-blue-100 text-blue-700 border-blue-200",ì¬ììì:"bg-orange-100 text-orange-700 border-orange-200",íë ¨ìë£:"bg-yellow-100 text-yellow-700 border-yellow-200",기í:"bg-gray-100 text-gray-700 border-gray-200"},s=x[i.event_type]||x.기í;return e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:`w-8 h-8 rounded-full border-2 flex items-center justify-center ${s}`,children:e.jsx(P,{className:"w-4 h-4"})}),!p&&e.jsx("div",{className:"w-0.5 h-full bg-gray-200 mt-1"})]}),e.jsx("div",{className:"flex-1 pb-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:`text-[11px] px-2 py-0.5 rounded font-medium border ${s}`,children:i.event_type}),e.jsx("span",{className:"text-[11px] text-gray-500",children:i.event_date}),i.achievement_level&&e.jsx("div",{className:"flex items-center gap-0.5",children:[...Array(i.achievement_level)].map((d,c
1)=>e.jsx(F,{className:"w-3 h-3 text-yellow-500 fill-yellow-500"},c))})]}),e.jsx("h4",{className:"text-[13px] font-bold text-gray-900 mb-1",children:i.title}),i.description&&e.jsx("p",{className:"text-[12px] text-gray-600",children:i.description})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:u,className:"p-1 hover:bg-gray-100 rounded transition-colors",title:"ìì ",children:e.jsx(O,{className:"w-3.5 h-3.5 text-blue-600"})}),e.jsx("button",{onClick:h,className:"p-1 hover:bg-gray-100 rounded transition-colors",title:"ìì ",children:e.jsx($,{className:"w-3.5 h-3.5 text-red-600"})})]})]})})]})}function R({members:i,onClose:p,onSuccess:u}){const[h,x]=o.useState(!1),[s,d]=o.useState({member_id:"",event_type:"ë±ë¡",event_date:new Date().toISOString().split("T")[0],title:"",description:"",achievement_level:void 0});async function c(a){if(a.preventDefault(),!s.member_id||!s.title){m.error("íì í목ì ì
ë ¥íì¸ì");return}try{x(!0),await f.addEvent(s),m.success("ì´ë²¤í¸ê° ì¶ê°ëììµëë¤"),u()}catch{m.error("ì¶ê°ì ì¤í¨íìµëë¤")}finally{x(!1)}}return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full max-h-[90vh] overflow-y-auto",children:[e.jsx("div",{className:"p-4 border-b border-gray-200",children:e.jsx("h2",{className:"text-[16px] font-bold text-gray-900",children:"ì ì ì¬ì ì´ë²¤í¸ ì¶ê°"})}),e.jsxs("form",{onSubmit:c,className:"p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[12px] font-medium text-gray-700 mb-1",children:["êµì¸ ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("select",{value:s.member_id,onChange:a=>d({...s,member_id:a.target.value}),className:"compact-input",required:!0,children:[e.jsx("option",{value:"",children:"ì ííì¸ì"}),i.map(a=>e.jsxs("option",{value:a.id,children:[a.name," (",a.position,")"]},a.id))]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[12px] font-medium text-gray-700 mb-1",children:["ì´ë²¤í¸ ì í ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("select",{value:s.event_type,onChange:a=>d({...s,event_type:a.target.value}),className:"compact-input",required:!0,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.jsx("option",{value:"기í",children:"기í"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[12px] font-medium text-gray-700 mb-1",children:["ë ì§ ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"date",value:s.event_date,onChange:a=>d({...s,event_date:a.target.value}),className:"compact-input",required:!0})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[12px] font-medium text-gray-700 mb-1",children:["ì 목 ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"text",value:s.title,onChange:a=>d({...s,title:a.target.value}),className:"compact-input",placeholder:"ì: ì ìíë ¨ ê³¼ì ìë£",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-gray-700 mb-1",children:"ì¤ëª
"}),e.jsx("textarea",{value:s.description,onChange:a=>d({...s,description:a.target.value}),className:"compact-input",rows:3,placeholder:"ì´ë²¤í¸ì ëí ìì¸ ì¤ëª
"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-gray-700 mb-1",children:"ì±ì·¨ë (ì í)"}),e.jsxs("select",{value:s.achievement_level||"",onChange:a=>d({...s,achievement_level:a.target.value?Number(a.target.value):void 0}),className:"compact-input",children:[e.jsx("option",{value:"",children:"ìì"}),e.jsx("option",{value:"1",children:"â (1ë¨ê³)"}),e.jsx("option",{value:"2",children:"ââ (2ë¨ê³)"}),e.jsx("option",{value:"3",children:"âââ (3ë¨ê³)"}),e.jsx("option",{value:"4",children:"ââââ (4ë¨ê³)"}),e.jsx("option",{value:"5",children:"âââââ (5ë¨ê³)"})]})]}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx("button",{type:"button",onClick:p,className:"flex-1 px-3 py-2 border border-gray-300 rounded hover:bg-gray-50 transition-colors text-[13px]",children:"ì·¨ì"}),e.jsx("button",{type:"submit",disabled:h,className:"flex-1 px-3 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors text-[13px] font-medium disabled:opacity-50",children:h?"ì¶ê° ì¤...":"ì¶ê°"})]})]})]})})}export{U as FaithJourneyPage};
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.