PageSourceSearch

https://seodoon-church-admin.web.app/assets/MonthClosePage-DsR9sE6C.js

js seodoon-church-admin.web.app collected 2026-10-03 12:37:10 UTC 4,380 bytes, 2 lines download raw bytes

1import{j as s}from"./vendor-data-Z5doMMu-.js";import{r as n}from"./vendor-react-zNM0AU50.js";import{by as k,w as p,bH as b,a7 as c}from"./vendor-ui-CW5bJ11U.js";import{u as M}from"./index-D1K3lVhu.js";import{f as g}from"./financeCloseService-C1M9uxKC.js";import{g as R}from"./financeConstants-CXKUiVP8.js";import"./vendor-firebase-Da9KY1q_.js";import"./vendor-charts-08G1rM8P.js";const Y=Array.from({length:12},(r,x)=>x+1);function A(r){if(!r)return"";try{return r.toLocaleDateString("ko-KR",{dateStyle:"short"})}catch{return""}}function K(){const{user:r,isRole:x}=M(),m=(r==null?void 0:r.churchId)||"seodoon-church",f=x("최고관리자","재정부장"),l=Number(R()),[a,y]=n.useState(String(l)),[j,N]=n.useState([]),[w,h]=n.useState(!0),[v,o]=n.useState(null),u=()=>{h(!0),g.getCloses(m,a).then(N).catch(e=>c.error(`마감 현황 조회 실패: ${e.message||e}`)).finally(()=>h(!1))};n.useEffect(u,[a]);const C=e=>j.find(t=>t.month===e&&t.closed),S=async e=>{if(window.confirm(`${a}년 ${e}월을 마감하시겠습니까?
2마감 후에는 해당 월의 헌금·지출 등록/수정/삭제가 제한됩니다.`)){o(e);try{await g.closeMonth(m,a,e,(r==null?void 0:r.uid)||"",(r==null?void 0:r.name)||""),c.success(`${e}월이 마감되었습니다`),u()}catch(t){c.error(`마감 실패: ${t.message||t}`)}finally{o(null)}}},$=async e=>{if(window.confirm(`${a}년 ${e}월 마감을 해제하시겠습니까?`)){o(e);try{await g.reopenMonth(m,a,e),c.success(`${e}월 마감이 해제되었습니다`),u()}catch(t){c.error(`마감 해제 실패: ${t.message||t}`)}finally{o(null)}}};return s.jsxs("div",{className:"p-6 max-w-4xl mx-auto",children:[s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"월 마감"}),s.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"월별 재정 기록을 잠급니다. 마감된 월은 헌금·지출 등록/수정/삭제가 제한됩니다."})]}),s.jsx("select",{value:a,onChange:e=>y(e.target.value),className:"border border-gray-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-blue-500",children:[l+1,l,l-1,l-2].map(e=>s.jsxs("option",{value:String(e),children:[e,"년도"]},e))})]}),!f&&s.jsxs("div",{className:"mb-4 flex items-start gap-2 bg-blue-50 border border-blue-100 text-blue-700 rounded-lg p-3 text-sm",children:[s.jsx(k,{className:"w-4 h-4 mt-0.5 shrink-0"}),s.jsx("span",{children:"마감 해제는 재정부장·최고관리자만 가능합니다. 마감에 오류가 있으면 재정부장에게 요청하세요."})]}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3",children:w?s.jsx("div",{className:"col-span-full text-center text-gray-400 py-10",children:"불러오는 중..."}):Y.map(e=>{const t=C(e),i=!!t,d=v===e;return s.jsxs("div",{className:`rounded-xl border p-4 ${i?"bg-gray-50 border-gray-200":"bg-white border-gray-200"}`,children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("span",{className:"text-lg font-bold text-gray-900",children:[e,"월"]}),i?s.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-gray-600 bg-gray-200 px-2 py-0.5 rounded-full",children:[s.jsx(p,{className:"w-3 h-3"})," 마감"]}):s.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium text-emerald-700 bg-emerald-50 px-2 py-0.5 rounded-full",children:[s.jsx(b,{className:"w-3 h-3"})," 열림"]})]}),i&&s.jsxs("p",{className:"text-[11px] text-gray-400 mb-3",children:[(t==null?void 0:t.closedByName)||(t==null?void 0:t.closedBy)," · ",A(t==null?void 0:t.closedAt)]}),i?f?s.jsxs("button",{onClick:()=>$(e),disabled:d,className:"w-full flex items-center justify-center gap-1.5 text-sm border border-gray-300 text-gray-600 hover:bg-gray-100 py-2 rounded-lg transition-colors",children:[s.jsx(b,{className:"w-3.5 h-3.5"})," ",d?"처리 중...":"마감 해제"]}):s.jsx("div",{className:"w-full text-center text-xs text-gray-300 py-2",children:"잠김"}):s.jsxs("button",{onClick:()=>S(e),disabled:d,className:"w-full flex items-center justify-center gap-1.5 text-sm bg-blue-600 hover:bg-blue-700 disabled:bg-gray-300 text-white py-2 rounded-lg transition-colors",children:[s.jsx(p,{className:"w-3.5 h-3.5"})," ",d?"처리 중...":"마감"]})]},e)})})]})}export{K as MonthClosePage,K 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.