PageSourceSearch

https://seodoon-church-admin.web.app/assets/CouncilSchedulePage-BmRgeKgz.js

js seodoon-church-admin.web.app collected 2026-10-03 12:36:23 UTC 8,596 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-data-Z5doMMu-.js";import{r as a}from"./vendor-react-zNM0AU50.js";import{u as M}from"./index-D1K3lVhu.js";import{b as v}from"./councilService-CCqwDmOg.js";import{L as P,c as $,Z as z,aa as A,ag as F,a as O,i as R,ai as V,b5 as W,T as X,z as N,X as Y}from"./vendor-ui-CW5bJ11U.js";import"./vendor-firebase-Da9KY1q_.js";import"./vendor-charts-08G1rM8P.js";function U(){const{user:s}=M(),[i,w]=a.useState([]),[x,m]=a.useState(!0),[S,o]=a.useState(!1),[C,u]=a.useState(null),[b,h]=a.useState("calendar"),[f,p]=a.useState(new Date);a.useEffect(()=>{g()},[]);async function g(){m(!0);const t=await v.getAll();w(t),m(!1)}async function y(t){confirm("삭제하시겠습니까?")&&(await v.remove(t),N.success("삭제되었습니다"),g())}const l=f.getFullYear(),n=f.getMonth(),r=`${l}-${String(n+1).padStart(2,"0")}`;i.filter(t=>{var d;return(d=t.date)==null?void 0:d.startsWith(r)});const L=a.useMemo(()=>{const t=new Date(l,n,1).getDay(),d=new Date(l,n+1,0).getDate(),j=[];for(let c=0;c<t;c++)j.push({day:0,events:[]});for(let c=1;c<=d;c++){const T=`${l}-${String(n+1).padStart(2,"0")}-${String(c).padStart(2,"0")}`,E=i.filter(I=>I.date===T);j.push({day:c,events:E})}return j},[i,l,n]),k=new Date().toISOString().slice(0,10),D=i.filter(t=>t.date>=k).sort((t,d)=>t.date.localeCompare(d.date));return x?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(P,{className:"w-6 h-6 animate-spin text-gray-400"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white border border-gray-200 rounded-2xl p-6 text-gray-900",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx($,{className:"w-7 h-7 text-blue-600"}),e.jsx("h1",{className:"text-2xl font-bold",children:"일정"})]}),e.jsx("p",{className:"text-gray-500 text-sm",children:"당회 일정 관리"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex gap-1 bg-gray-100 rounded-lg p-1",children:[e.jsx("button",{onClick:()=>h("calendar"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition ${b==="calendar"?"bg-white shadow":"text-gray-500"}`,children:e.jsx($,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>h("list"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition ${b==="list"?"bg-white shadow":"text-gray-500"}`,children:e.jsx(z,{className:"w-4 h-4"})})]}),e.jsxs("button",{onClick:()=>{u(null),o(!0)},className:"flex items-center gap-1.5 px-4 py-2 bg-blue-600 text-white rounded-lg text-sm hover:bg-blue-700",children:[e.jsx(A,{className:"w-4 h-4"})," 일정 추가"]})]}),b==="calendar"?e.jsxs("div",{className:"bg-white rounded-xl border p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("button",{onClick:()=>p(new Date(l,n-1)),className:"p-2 hover:bg-gray-100 rounded-lg",children:e.jsx(F,{className:"w-5 h-5"})}),e.jsxs("h2",{className:"font-bold text-lg",children:[l,"년 ",n+1,"월"]}),e.jsx("button",{onClick:()=>p(new Date(l,n+1)),className:"p-2 hover:bg-gray-100 rounded-lg",children:e.jsx(O,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"grid grid-cols-7 gap-px mb-1",children:["일","월","화","수","목","금","토"].map(t=>e.jsx("div",{className:`text-center text-xs font-medium py-2 ${t==="일"?"text-red-500":t==="토"?"text-blue-500":"text-gray-500"}`,children:t},t))}),e.jsx("div",{className:"grid grid-cols-7 gap-px",children:L.map((t,d)=>{const j=t.day>0&&`${l}-${String(n+1).padStart(2,"0")}-${String(t.day).padStart(2,"0")}`===k;return e.jsx("div",{className:`min-h-[80px] p-1 border rounded ${t.day===0?"bg-gray-50":"bg-white hover:bg-gray-50"} ${j?"ring-2 ring-blue-400":""}`,children:t.day>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`text-xs font-medium mb-1 ${d%7===0?"text-red-500":d%7===6?"text-blue-500":"text-gray-700"}`,children:t.day}),t.events.map(c=>e.jsx("div",{className:"text-[10px] bg-blue-100 text-blue-800 rounded px-1 py-0.5 mb-0.5 truncate cursor-pointer hover:bg-blue-200",onClick:()=>{u(c),o(!0)},children:c.title},c.id))]})},d)})})]}):e.jsx("div",{className:"space-y-3",children:D.length===0?e.jsx("div",{className:"bg-white rounded-xl border p-8 text-center text-gray-400",children:"등록된 일정이 없습니다"}):D.map(t=>e.jsxs("div",{className:"bg-white rounded-xl border p-4 flex items-start gap-4",children:[e.jsxs("div",{className:"flex-shrink-0 w-14 h-14 bg-blue-100 rounded-xl flex flex-col items-center justify-center",children:[e.jsxs("span",{className:"text-[10px] text-blue-600",children:[t.date.slice(5,7),"월"]}),e.jsx("span",{className:"text-lg font-bold text-blue-800",children:t.date.slice(8,10)})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-medium text-gray-800",children:t.title}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 mt-1 text-xs text-gray-500",children:[t.time&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(R,{className:"w-3 h-3"}),t.time]}),t.location&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(V,{className:"w-3 h-3"}),t.location]})]}),t.description&&e.jsx("p",{className:"text-sm text-gray-600 mt-1",children:t.description})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>{u(t),o(!0)},className:"p-1.5 hover:bg-gray-200 rounded",children:e.jsx(W,{className:"w-3.5 h-3.5 text-gray-500"})}),e.jsx("button",{onClick:()=>y(t.id),className:"p-1.5 hover:bg-red-100 rounded",children:e.jsx(X,{className:"w-3.5 h-3.5 text-red-500"})})]})]},t.id))}),S&&e.jsx(Z,{editing:C,onClose:()=>o(!1),onSave:g})]})}function Z({editing:s,onClose:i,onSave:w}){const{user:x}=M(),[m,S]=a.useState((s==null?void 0:s.title)||""),[o,C]=a.useState((s==null?void 0:s.date)||new Date().toISOString().slice(0,10)),[u,b]=a.useState((s==null?void 0:s.time)||""),[h,f]=a.useState((s==null?void 0:s.location)||""),[p,g]=a.useState((s==null?void 0:s.description)||""),[y,l]=a.useState(!1);async function n(){if(!m.trim()||!o){N.error("제목과 날짜를 입력하세요");return}l(!0);try{s?await v.update(s.id,{title:m,date:o,time:u,location:h,description:p}):await v.create({title:m,date:o,time:u,location:h,description:p,department:"당회",authorId:x==null?void 0:x.uid,author:(x==null?void 0:x.name)||"당회원"}),N.success(s?"수정되었습니다":"등록되었습니다"),w(),i()}catch{N.error("저장 실패")}finally{l(!1)}}return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-white rounded-xl w-full max-w-lg",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[e.jsx("h3",{className:"font-bold text-lg",children:s?"일정 수정":"일정 추가"}),e.jsx("button",{onClick:i,className:"p-1 hover:bg-gray-100 rounded",children:e.jsx(Y,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 block mb-1",children:"제목 *"}),e.jsx("input",{value:m,onChange:r=>S(r.target.value),className:"w-full border rounded-lg px-3 py-2 text-sm"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 block mb-1",children:"날짜 *"}),e.jsx("input",{type:"date",value:o,onChange:r=>C(r.target.value),className:"w-full border rounded-lg px-3 py-2 text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 block mb-1",children:"시간"}),e.jsx("input",{value:u,onChange:r=>b(r.target.value),className:"w-full border rounded-lg px-3 py-2 text-sm",placeholder:"예: 19:00"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 block mb-1",children:"장소"}),e.jsx("input",{value:h,onChange:r=>f(r.target.value),className:"w-full border rounded-lg px-3 py-2 text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 block mb-1",children:"설명"}),e.jsx("textarea",{value:p,onChange:r=>g(r.target.value),rows:3,className:"w-full border rounded-lg px-3 py-2 text-sm"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 p-4 border-t",children:[e.jsx("button",{onClick:i,className:"px-4 py-2 text-sm border rounded-lg",children:"취소"}),e.jsx("button",{onClick:n,disabled:y,className:"px-4 py-2 text-sm bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50",children:y?"저장중...":"저장"})]})]})})}export{U as CouncilSchedulePage,U as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.