PageSourceSearch

https://seodoon-church-admin.web.app/assets/ProfileEditRequestsPage-B5oJLTsk.js

js seodoon-church-admin.web.app collected 2026-10-03 12:35:30 UTC 6,368 bytes, 7 lines download raw bytes

1import{j as e}from"./vendor-data-Z5doMMu-.js";import{r as d}from"./vendor-react-zNM0AU50.js";import{l as w,q as u,x as j,w as D,m as R,k as m,u as p}from"./vendor-firebase-Da9KY1q_.js";import{d as i}from"./index-D1K3lVhu.js";import"./vendor-ui-CW5bJ11U.js";import"./vendor-charts-08G1rM8P.js";const P=()=>{const[o,f]=d.useState([]),[c,b]=d.useState(!0),[n,l]=d.useState("pending");d.useEffect(()=>{x()},[n]);const x=async()=>{try{b(!0);const t=w(i,"profile_edit_requests");let s;n==="all"?s=u(t,j("requested_at","desc")):s=u(t,D("status","==",n),j("requested_at","desc"));const N=(await R(s)).docs.map(h=>{const a=h.data();return{id:h.id,user_id:a.user_id,member_doc_id:a.member_doc_id,user_name:a.user_name,user_email:a.user_email,changes:a.changes,original_data:a.original_data,status:a.status,requested_at:a.requested_at,approved_at:a.approved_at,approved_by:a.approved_by,reject_reason:a.reject_reason}});f(N)}catch(t){console.error("수정요청 로드 실패:",t),alert("수정요청을 불러오는데 실패했습니다.")}finally{b(!1)}},y=async t=>{if(confirm(`${t.user_name}님의 정보 수정을 승인하시겠습니까?
2
3변경사항이 교적부에 즉시 반영됩니다.`))try{const s=m(i,"members",t.member_doc_id);await p(s,{...t.changes,updated_at:new Date});const r=m(i,"profile_edit_requests",t.id);await p(r,{status:"approved",approved_at:new Date,approved_by:"admin"}),alert("승인되었습니다. 교적부가 업데이트되었습니다."),x()}catch(s){console.error("승인 실패:",s),alert(`승인 처리에 실패했습니다.
4`+s)}},_=async t=>{const s=prompt(`${t.user_name}님의 정보 수정을 거절하시겠습니까?
5
6거절 사유를 입력해주세요:`);if(s!==null){if(!s.trim()){alert("거절 사유를 입력해주세요.");return}try{const r=m(i,"profile_edit_requests",t.id);await p(r,{status:"rejected",approved_at:new Date,approved_by:"admin",reject_reason:s.trim()}),alert("거절되었습니다."),x()}catch(r){console.error("거절 처리 실패:",r),alert(`거절 처리에 실패했습니다.
7`+r)}}},g=t=>t?(t.toDate?t.toDate():new Date(t)).toLocaleString("ko-KR"):"-",v=t=>({phone:"전화번호",detailed_position:"세부직분",car_number:"차량번호"})[t]||t;return e.jsxs("div",{className:"p-6 max-w-7xl mx-auto",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:"프로필 수정 요청 관리"}),e.jsx("p",{className:"text-sm text-gray-600",children:"회원들의 정보 수정 요청을 승인하거나 거절할 수 있습니다."})]}),e.jsxs("div",{className:"mb-6 flex gap-2 border-b border-gray-200",children:[e.jsxs("button",{onClick:()=>l("pending"),className:`px-4 py-2 font-semibold transition-colors ${n==="pending"?"text-blue-600 border-b-2 border-blue-600":"text-gray-500 hover:text-gray-700"}`,children:["대기 중 (",o.filter(t=>t.status==="pending").length,")"]}),e.jsx("button",{onClick:()=>l("approved"),className:`px-4 py-2 font-semibold transition-colors ${n==="approved"?"text-green-600 border-b-2 border-green-600":"text-gray-500 hover:text-gray-700"}`,children:"승인됨"}),e.jsx("button",{onClick:()=>l("rejected"),className:`px-4 py-2 font-semibold transition-colors ${n==="rejected"?"text-red-600 border-b-2 border-red-600":"text-gray-500 hover:text-gray-700"}`,children:"거절됨"}),e.jsx("button",{onClick:()=>l("all"),className:`px-4 py-2 font-semibold transition-colors ${n==="all"?"text-gray-900 border-b-2 border-gray-900":"text-gray-500 hover:text-gray-700"}`,children:"전체"})]}),c&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"}),e.jsx("p",{className:"mt-2 text-gray-600",children:"로딩 중..."})]}),!c&&o.length===0&&e.jsx("div",{className:"bg-gray-50 rounded-lg p-12 text-center",children:e.jsx("p",{className:"text-gray-500",children:"수정 요청이 없습니다."})}),!c&&o.length>0&&e.jsx("div",{className:"space-y-4",children:o.map(t=>e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-6 hover:shadow-md transition-shadow",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold text-gray-900",children:t.user_name}),e.jsx("p",{className:"text-sm text-gray-600",children:t.user_email}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["요청일시: ",g(t.requested_at)]})]}),e.jsxs("div",{children:[t.status==="pending"&&e.jsx("span",{className:"px-3 py-1 bg-yellow-100 text-yellow-800 text-xs font-semibold rounded-full",children:"대기 중"}),t.status==="approved"&&e.jsx("span",{className:"px-3 py-1 bg-green-100 text-green-800 text-xs font-semibold rounded-full",children:"승인됨"}),t.status==="rejected"&&e.jsx("span",{className:"px-3 py-1 bg-red-100 text-red-800 text-xs font-semibold rounded-full",children:"거절됨"})]})]}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-4 mb-4",children:[e.jsx("h4",{className:"text-sm font-semibold text-gray-700 mb-3",children:"변경 요청 내역"}),e.jsx("div",{className:"space-y-2",children:Object.entries(t.changes).map(([s,r])=>e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsx("span",{className:"font-semibold text-gray-700 w-24",children:v(s)}),e.jsx("span",{className:"text-red-600 line-through",children:t.original_data[s]||"-"}),e.jsx("span",{className:"text-gray-400",children:"→"}),e.jsx("span",{className:"text-green-600 font-semibold",children:r||"-"})]},s))})]}),t.status!=="pending"&&e.jsxs("div",{className:"bg-blue-50 rounded-lg p-3 mb-4",children:[e.jsxs("p",{className:"text-xs text-gray-600",children:["처리일시: ",g(t.approved_at)]}),t.reject_reason&&e.jsxs("p",{className:"text-sm text-red-700 mt-1",children:[e.jsx("strong",{children:"거절 사유:"})," ",t.reject_reason]})]}),t.status==="pending"&&e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:()=>y(t),className:"flex-1 px-4 py-2 bg-green-500 text-white rounded-lg font-semibold hover:bg-green-600 transition-colors",children:"승인하기"}),e.jsx("button",{onClick:()=>_(t),className:"flex-1 px-4 py-2 bg-red-500 text-white rounded-lg font-semibold hover:bg-red-600 transition-colors",children:"거절하기"})]})]},t.id))})]})};export{P 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.