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.