PageSourceSearch

https://seodoon-church-admin.web.app/assets/MemberForm-Cmv9C13b.js

js seodoon-church-admin.web.app collected 2026-10-03 12:35:29 UTC 48,264 bytes, 10 lines download raw bytes

1import{j as e}from"./vendor-data-Z5doMMu-.js";import{r as b,b as ce,h as de}from"./vendor-react-zNM0AU50.js";import{m as $}from"./index-D1K3lVhu.js";import{z as F,ad as ee,f as se,X as z,A as ue,g as te,E as me,a7 as w,n as pe,a8 as xe,ae as he,T as ae,aa as J,H as Y,i as ge,af as be}from"./vendor-ui-CW5bJ11U.js";import{u as W}from"./userService-CE4aI1A4.js";import{C as Z}from"./financeConstants-CXKUiVP8.js";import{s as je}from"./storageService-HxVmCucr.js";import{v as H}from"./visitService-DcwGr2oo.js";import{G as ve,C as fe,M as ye,P as Ne,A as _e,c as we,d as Ce,a as Se,g as Ie,b as Ee,e as Re,W as Te,E as ke,f as Me,K as Ae,h as Pe,i as De,S as Oe,j as $e,k as Le,B as Ve,F as Ue,l as Fe}from"./positions-BjtHy0zm.js";import"./vendor-firebase-Da9KY1q_.js";import"./vendor-charts-08G1rM8P.js";function Be({memberId:u,memberName:j}){const[i,v]=b.useState(!0),[I,C]=b.useState(!1),[g,d]=b.useState(null),[N,S]=b.useState("");b.useEffect(()=>{let p=!0;return(async()=>{try{const y=await W.getUserByMemberId(u);if(!p)return;d(y),y&&S(y.assignedDepartmentId||"")}catch{}finally{p&&v(!1)}})(),()=>{p=!1}},[u]);const a=!!(g!=null&&g.assignedDepartmentId);async function R(){if(!g)return;if(!N){F.error("담당 부서를 선택하세요");return}const p=Z.find(y=>y.id===N);C(!0);try{const y=(g.roles||[]).filter(P=>P!=="dept_head");await W.updateUser(g.uid,{assignedDepartmentId:N,assignedDepartmentName:(p==null?void 0:p.name)||"",customPermissions:{...g.customPermissions||{},deptLedger:!0},roles:y}),d({...g,assignedDepartmentId:N,assignedDepartmentName:(p==null?void 0:p.name)||"",customPermissions:{...g.customPermissions||{},deptLedger:!0},roles:y}),F.success(`${p==null?void 0:p.name} 부서회계 지정 완료`)}catch{F.error("지정에 실패했습니다")}finally{C(!1)}}async function m(){if(g){C(!0);try{const p=(g.roles||[]).filter(y=>y!=="dept_head");await W.updateUser(g.uid,{assignedDepartmentId:null,assignedDepartmentName:null,customPermissions:{...g.customPermissions||{},deptLedger:!1},roles:p}),d({...g,assignedDepartmentId:void 0,assignedDepartmentName:void 0,roles:p}),S(""),F.success("회계 지정을 해제했습니다")}catch{F.error("해제에 실패했습니다")}finally{C(!1)}}}return e.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 bg-gray-50",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-800",children:"부서 회계 지정"}),a&&e.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full bg-blue-100 text-blue-700",children:[g==null?void 0:g.assignedDepartmentName," · 부서회계"]})]}),i?e.jsx("p",{className:"text-sm text-gray-400",children:"불러오는 중…"}):g?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("select",{value:N,onChange:p=>S(p.target.value),className:"w-full px-3 py-2 border border-gray-200 rounded-lg text-sm bg-white",children:[e.jsx("option",{value:"",children:"담당 부서 선택"}),Z.map(p=>e.jsx("option",{value:p.id,children:p.level&&p.level>1?`— ${p.name}`:p.name},p.id))]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:R,disabled:I,className:"px-4 py-2 bg-blue-600 text-white rounded-lg text-sm font-medium hover:bg-blue-700 disabled:opacity-50",children:a?"변경 저장":"지정"}),a&&e.jsx("button",{type:"button",onClick:m,disabled:I,className:"px-4 py-2 text-rose-600 border border-rose-200 rounded-lg text-sm hover:bg-rose-50 disabled:opacity-50",children:"해제"})]}),e.jsx("p",{className:"text-xs text-gray-400",children:"역할은 유지되며 담당부서 접근 권한(deptLedger)만 부여됩니다. 회계는 이 부서의 수입지출·예산신청만 볼 수 있습니다. 담당장로(부장)는 교적부의 담당 부서 지정으로 관리됩니다."})]}):e.jsxs("p",{className:"text-sm text-gray-500",children:["이 교인은 앱(교인수첩) 계정이 없어 회계 지정을 할 수 없습니다.",j?` (${j})`:""," 앱 가입 후 지정하세요."]})]})}function He({relations:u,onChange:j}){const[i,v]=b.useState("search"),[I,C]=b.useState("배우자"),[g,d]=b.useState(""),[N,S]=b.useState([]),[a,R]=b.useState(""),[m,p]=b.useState(null),[y,P]=b.useState([]);b.useEffect(()=>{L()},[]);async function L(){try{const r=await $.getMembers();P(r)}catch(r){console.error("교인 목록 로드 실패:",r)}}b.useEffect(()=>{if(i!=="search"||!g.trim()){S([]);return}const r=y.filter(h=>h.name.includes(g.trim())).slice(0,10);S(r)},[g,y,i]);function V(r){v(r),d(""),S([]),R(""),p(null)}function q(r){p(r),d(""),S([])}function k(){let r=null;if(i==="search"){if(!m){alert("교인을 선택해주세요.");return}r={memberId:m.id,relativeId:m.id,relativeName:m.name,relationType:I}}else if(i==="manual"){if(!a.trim()){alert("이름을 입력해주세요.");return}r={relativeName:a.trim(),relationType:I,isExternal:!0}}else i==="none"&&(r={relativeName:"없음",relationType:I,isNone:!0});
1if(r){const h=u.find(E=>r.memberId&&E.memberId?E.memberId===r.memberId:r.isExternal||E.isExternal?E.relativeName===r.relativeName:!1);if(h){alert(`이미 등록된 가족입니다.
2기존: ${h.relativeName} (${h.relationType})
3새로 추가하려는: ${r.relativeName} (${r.relationType})`);return}j([...u,r]),p(null),R(""),d("")}}function U(r){if(confirm("이 관계를 삭제하시겠습니까?")){const h=u.filter((E,G)=>G!==r);j(h)}}function A(r){if(r===0)return;const h=[...u],E=h[r];h[r]=h[r-1],h[r-1]=E,j(h)}function D(r){if(r===u.length-1)return;const h=[...u],E=h[r];h[r]=h[r+1],h[r+1]=E,j(h)}return e.jsxs("div",{className:"space-y-4",children:[u.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"등록된 가족 관계"}),u.map((r,h)=>e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-gray-50 rounded-lg border",children:[e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("button",{type:"button",onClick:()=>A(h),disabled:h===0,className:`p-0.5 rounded ${h===0?"text-gray-300 cursor-not-allowed":"text-gray-500 hover:text-blue-600 hover:bg-blue-50"}`,title:"위로 이동",children:e.jsx(ee,{className:"w-4 h-4"})}),e.jsx("button",{type:"button",onClick:()=>D(h),disabled:h===u.length-1,className:`p-0.5 rounded ${h===u.length-1?"text-gray-300 cursor-not-allowed":"text-gray-500 hover:text-blue-600 hover:bg-blue-50"}`,title:"아래로 이동",children:e.jsx(se,{className:"w-4 h-4"})})]}),e.jsx("span",{className:"font-medium",children:r.relativeName}),e.jsxs("span",{className:"text-sm text-gray-500",children:["(",r.relationType,")"]}),r.memberId&&e.jsx("span",{className:"text-xs text-blue-600 bg-blue-50 px-2 py-1 rounded",children:"교적부 연결됨"}),r.isExternal&&e.jsx("span",{className:"text-xs text-orange-600 bg-orange-50 px-2 py-1 rounded",children:"외부 가족"}),e.jsx("button",{type:"button",onClick:()=>U(h),className:"ml-auto text-red-500 hover:text-red-700",children:e.jsx(z,{className:"w-4 h-4"})})]},h))]}),e.jsxs("div",{className:"p-4 bg-blue-50 border border-blue-200 rounded-lg space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-sm font-semibold text-blue-900",children:"가족 추가"}),e.jsx("div",{className:"flex gap-1 text-xs",children:e.jsxs("button",{type:"button",onClick:()=>alert(`💡 교적부에 등록된 교인을 선택하면 5대 가계도를 생성할 수 있습니다.
4
5📋 교적부 검색: 교인 이름으로 검색
6✏️ 직접 입력: 교적부에 없는 가족 입력
7❌ 없음: 해당 관계가 없음을 표시`),className:"text-blue-600 hover:text-blue-800 flex items-center gap-1",children:[e.jsx(ue,{className:"w-3 h-3"}),"도움말"]})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"관계"}),e.jsxs("select",{value:I,onChange:r=>C(r.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm",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.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.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.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.jsx("option",{value:"손녀(외)",children:"손녀(외)"}),e.jsx("option",{value:"기타",children:"기타"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-700 mb-2",children:"입력 방식"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>V("search"),className:`flex-1 px-3 py-2 text-sm rounded-lg border font-medium ${i==="search"?"border-blue-500 bg-blue-500 text-white":"border-gray-300 bg-white text-gray-700 hover:bg-gray-50"}`,children:"📋 교적부 검색"}),e.jsx("button",{type:"button",onClick:()=>V("manual"),className:`flex-1 px-3 py-2 text-sm rounded-lg border font-medium ${i==="manual"?"border-blue-500 bg-blue-500 text-white":"border-gray-300 bg-white text-gray-700 hover:bg-gray-50"}`,children:"✏️ 직접 입력"}),e.jsx("button",{type:"button",onClick:()=>V("none"),className:`flex-1 px-3 py-2 text-sm rounded-lg border font-medium ${i==="none"?"border-blue-500 bg-blue-500 text-white":"border-gray-300 bg-white text-gray-700 hover:bg-gray-50"}`,children:"❌ 없음"})]})]}),i==="search"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"relative",children:[e.jsx(te,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx("input",{type:"text",value:g,onChange:r=>d(r.target.value),placeholder:"이름을 입력하면 자동으로 검색됩니다",className:"w-full pl-10 pr-3 py-2 border border-gray-300 rounded-lg text-sm"})]}),N.length>0&&e.jsx("div",{className:"absolute z-50 w-full mt-1 bg-white border border-gray-300 rounded-lg shadow-lg max-h-60 overflow-y-auto",children:N.map(r=>e.jsxs("button",{type:"button",onClick:()=>q(r),className:"w-full p-3 hover:bg-blue-50 text-left border-b last:border-b-0 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:r.name}),e.jsxs("div",{className:"text-xs text-gray-500",children:[r.detailed_position||r.position||"성도"," |",r.age&&` ${r.age}세`,r.district&&` | ${r.district}`]})]}),e.jsx(me,{className:"w-4 h-4 text-gray-400"})]},r.id))})]}),m&&e.jsxs("div",{className:"p-2 bg-green-50 border border-green-200 rounded-lg flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm",children:["선택됨: ",e.jsx("strong",{children:m.name})]}),e.jsx("button",{type:"button",onClick:()=>p(null),className:"text-red-500 hover:text-red-700",children:e.jsx(z,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"text-xs text-gray-600",children:"💡 교적부에 등록된 êµ
7ì¸ì„ 선택하면 나중에 가계도를 생성할 수 있습니다"})]}),i==="manual"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("input",{type:"text",value:a,onChange:r=>R(r.target.value),placeholder:"이름을 입력하세요 (예: 홍길동)",className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm"}),e.jsx("div",{className:"text-xs text-orange-600",children:"⚠️ 교적부에 등록되지 않은 가족입니다. 가계도에는 표시되지 않습니다."})]}),i==="none"&&e.jsx("div",{className:"p-3 bg-gray-100 rounded-lg text-sm text-gray-600",children:"이 관계에 해당하는 가족이 없음을 기록합니다."}),e.jsx("button",{type:"button",onClick:k,className:"w-full px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 font-medium",children:"추가"})]})]})}function as({member:u,mode:j}){var K,Q;const i=ce(),{id:v}=de(),[I,C]=b.useState(!1),[g,d]=b.useState(null),[N,S]=b.useState((u==null?void 0:u.photo_url)||""),[a,R]=b.useState(u),[m,p]=b.useState([]),[y,P]=b.useState(!1),[L,V]=b.useState(!1),[q,k]=b.useState(!1),[U,A]=b.useState(null);b.useEffect(()=>{j==="edit"&&v&&(G(v),D(v))},[j,v]);async function D(s){try{P(!0);const l=await H.getMemberVisits(s);p(l)}catch(l){console.error("심방 기록 조회 실패:",l)}finally{P(!1)}}async function r(s){if(v)try{await H.addVisit(s),w.success("심방 기록이 추가되었습니다"),D(v),k(!1)}catch(l){console.error("심방 기록 추가 실패:",l),w.error("심방 기록 추가에 실패했습니다")}}async function h(s,l){if(v)try{await H.updateVisit(s,l),w.success("심방 기록이 수정되었습니다"),D(v),A(null),k(!1)}catch(o){console.error("심방 기록 수정 실패:",o),w.error("심방 기록 수정에 실패했습니다")}}async function E(s){if(v&&confirm("이 심방 기록을 삭제하시겠습니까?"))try{await H.deleteVisit(s),w.success("심방 기록이 삭제되었습니다"),D(v)}catch(l){console.error("심방 기록 삭제 실패:",l),w.error("심방 기록 삭제에 실패했습니다")}}async function G(s){try{C(!0);const l=await $.getMember(s);l?(R(l),S(l.photo_url||"")):(w.error("교인 정보를 찾을 수 없습니다"),i("/members"))}catch(l){console.error("교인 정보 로드 실패:",l),w.error("교인 정보를 불러오는데 실패했습니다"),i("/members")}finally{C(!1)}}const[t,n]=b.useState({name:"",member_classification:"서둔출석성도",position:"성도",gender:"남",registration_date:new Date().toISOString().split("T")[0],calendar_type:"양력",spiritual_maturity:"1단계",family_structure:"일반",care_type:"해당없음",status:"활동",relations:[],roles:[],service_assignments:[],elder_departments:[]});b.useEffect(()=>{a&&n(s=>({...s,name:a.name||"",member_classification:a.member_classification||"서둔출석성도",position:a.position||"성도",position_order:a.position_order,detailed_position:a.detailed_position||"",detailed_position_order:a.detailed_position_order,father_id:a.father_id||"",mother_id:a.mother_id||"",birth_date:a.birth_date||"",age:a.age,gender:a.gender||"남",registration_date:a.registration_date||new Date().toISOString().split("T")[0],mobile_phone:a.mobile_phone||"",phone:a.phone||"",email:a.email||"",address_city:a.address_city||"",address_district:a.address_district||"",address_dong:a.address_dong||"",address_bunji:a.address_bunji||"",address_postal:a.address_postal||"",address_full:a.address_full||"",spouse:a.spouse||"",children:a.children,relations:a.relations||[],introducer:a.introducer||"",baptism_date:a.baptism_date||"",confirmation_date:a.confirmation_date||"",calendar_type:a.calendar_type||"양력",spiritual_maturity:a.spiritual_maturity||"1단계",family_structure:a.family_structure||"일반",care_type:a.care_type||"해당없음",parish:a.parish||"",region:a.region||"",district:a.district||"",district_role:a.district_role||"",evangelism_group:a.evangelism_group||"",evangelism_position:a.evangelism_position||"",deacon_association_position:a.deacon_association_position||"",kwonsa_association_position:a.kwonsa_association_position||"",attendance_rate:a.attendance_rate,last_contact:a.last_contact||"",status:a.status||"활동",member_number:a.member_number||"",occupation:a.occupation||"",blood_type:a.blood_type||"",position_appointment_date:a.position_appointment_date||"",ministry:a.ministry||"",talents:a.talents||"",medical_info:a.medical_info||"",pastoral_notes:a.pastoral_notes||"",roles:a.roles||[],service_assignments:a.service_assignments||[],elder_departments:a.elder_departments||[]}))},[a]);function le(s){var x;const l=(x=s.target.files)==null?void 0:x[0];if(!l)return;if(l.size>5*1024*1024){w.error("파일 크기는 5MB 이하여야 합니다");return}d(l);const o=new FileReader;o.onloadend=()=>{S(o.result)},o.readAsDataURL(l)}function re(s,l){return{배우자:"배우자",부:l==="남"?"아들":l==="여"?"딸":"자녀",모:l==="남"?"아들":l==="여"?"딸":"자녀",아들:t.gender==="남"?"부":"모",딸:t.gender==="남"?"부":"모",자녀:t.gender==="남"?"부":"모"}[s]||null}async function ne(s,l,o){try{console.log("🔄 양방향 관계 업데이트 시작",{memberId:s,memberName:o,relationsCount:l.length});const x=l.filter(f=>f.memberId&&!f.isNone&&!f.isExternal);console.log("🔍 업데이트 대상 관계:",x.length);for(const f of x)if(f.memberId)try{console.log(`📖 상대방 조회 중: ${f.memberId}`);const _=await $.getMember(f.memberId);if(!_){console.warn(`회원을 찾을 수 없습니다: ${f.memberId}`);continue}const M=re(f.relationType,_.gender);if(!M){console.warn(`역방향 관계 타입을 계산할 수 없습니다: ${f.relationType}`);continue}const B=_.relations||[];if(B.some(O=>O.memberId===s))console.log(`ℹ️ ${_.name}에게 이미 관계가 존재함`);else{const O={memberId:s,relativeId:s,relativeName:o||"이름없음",relationType:M},oe=[...B,O];console.log(`📝 ${_.name}에게 역방향 관계 추가 시도:`,O),await $.updateMember(f.memberId,{relations:oe}),console.log(`✅ ${_.name}에게 역방향 관계 추가 완료: ${o}(${M})`)}}catch(_){console.error(`❌ ${f.relativeName}(${f.memberId}) 관계 업데이트 실패:`,_)}console.log("✅ 양방향 관계 업데이트 완료")}catch(x){console.error("❌ 양방향 관계 업데이트 실패:",x),w.error("가족 관계 양방향 업데이트에 실패했습니다. 수동으로 확인해주세요.")}}async function ie(s){if(s.preventDefault(),!t.name){w.error("이름은 필수 항목입니다");return}try{C(!0);let l=a==null?void 0:a.photo_url;if(g){const M=(a==null?void 0:a.id)||`temp_${Date.now()}`;l=await je.uploadMemberPhoto(M,g)}const o=t.relations?t.relations.filter((M,B,X)=>B===X.findIndex(O=>O.memberId===M.memberId)):[];let x=t.address_full||"";t.address_bunji&&(x.includes(t.address_bunji)||(x=x?x+" "+t.address_bunji:t.address_bunji));const f={...t,address_full:x,relations:o,photo_url:l};let _;if(j==="create")_=(await $.createMember(f)).id,w.success("교인이 등록되었습니다");else if(a)await $.updateMember(a.id,f),_=a.id,w.success("교인 정보가 수정되었습니다");else throw new Error("Invalid state");t.relations&&t.relations.length>0&&await ne(_,t.relations,t.name||""),j==="create"&&i(`/members/${_}/edit`,{replace:!0})}catch(l){console.error("저장 실패:",l),w.error("저장에 실패했습니다")}finally{C(!1)}}return e.jsxs("form",{onSubmit:ie,className:"space-y-4 animate-fade-in",children:[e.jsx("div",{className:"relative overflow-hidden bg-white border border-gray-200 rounded-2xl p-6 shadow-sm",children:e.jsxs("div",{className:"relative flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative",children:[N?e.jsx("img",{src:N,alt:"미리보기",className:"w-20 h-20 rounded-2xl object-cover border-4 border-gray-100 shadow-sm",onError:()=>S("")}):e.jsx("div",{className:"w-20 h-20 rounded-2xl bg-blue-50 flex flex-col items-center justify-center border-4 border-gray-100",children:e.jsx(pe,{className:"w-8 h-8 text-blue-600"})}),e.jsxs("label",{className:"absolute -bottom-2 -right-2 cursor-pointer",children:[e.jsx("input",{type:"file",accept:"image/*",onChange:le,className:"hidden"}),e.jsx("div",{className:"w-8 h-8 bg-blue-600 rounded-full flex items-center justify-center shadow-sm hover:scale-110 transition-transform",children:e.jsx(xe,{className:"w-4 h-4 text-white"})})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-3 mb-1",children:e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:j==="create"?"교인 등록":"교인 정보 수정"})}),e.jsx("p",{className:"text-gray-500 text-sm",children:j==="create"?"새로운 교인을 등록합니다":`${t.name||""} 교인의 정보를 수정합니다`})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>i(-1),className:"flex items-center gap-2 px-4 py-2.5 bg-white border border-gray-300 text-gray-700 rounded-xl hover:bg-gray-50 transition-all text-sm font-medium",children:[e.jsx(z,{className:"w-4 h-4"}),"취소"]}),e.jsxs("button",{type:"submit",disabled:I,className:"flex items-center gap-2 px-5 py-2.5 bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition-all text-sm font-semibold shadow-sm disabled:opacity-50",children:[e.jsx(he,{className:"w-4 h-4"}),I?"저장 중...":"저장"]})]})]})}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs(T,{title:"기본 정보",children:[e.jsx(c,{label:"이름",required:!0,children:e.jsx("input",{type:"text",value:t.name,onChange:s=>n({...t,name:s.target.value}),className:"compact-input",placeholder:"홍길동"})}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(c,{label:"성별",children:e.jsx("select",{value:t.gender,onCh
7ange:s=>n({...t,gender:s.target.value}),className:"compact-input",children:ve.map(s=>e.jsx("option",{value:s,children:s},s))})}),e.jsx(c,{label:"나이",children:e.jsx("input",{type:"number",value:t.age||"",onChange:s=>n({...t,age:parseInt(s.target.value)||void 0}),className:"compact-input",placeholder:"35"})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(c,{label:"생년월일",children:e.jsx("input",{type:"date",value:t.birth_date,onChange:s=>n({...t,birth_date:s.target.value}),className:"compact-input"})}),e.jsx(c,{label:"음/양력",children:e.jsx("select",{value:t.calendar_type,onChange:s=>n({...t,calendar_type:s.target.value}),className:"compact-input",children:fe.map(s=>e.jsx("option",{value:s,children:s},s))})})]}),e.jsx(c,{label:"등록일",children:e.jsx("input",{type:"date",value:t.registration_date,onChange:s=>n({...t,registration_date:s.target.value}),className:"compact-input"})}),e.jsx(c,{label:"인도자",children:e.jsx("input",{type:"text",value:t.introducer,onChange:s=>n({...t,introducer:s.target.value}),className:"compact-input",placeholder:"교회로 인도한 사람"})})]}),e.jsxs(T,{title:"연락처",children:[e.jsx(c,{label:"핸드폰",children:e.jsx("input",{type:"tel",value:t.mobile_phone,onChange:s=>n({...t,mobile_phone:s.target.value}),className:"compact-input",placeholder:"010-1234-5678"})}),e.jsx(c,{label:"전화번호",children:e.jsx("input",{type:"tel",value:t.phone,onChange:s=>n({...t,phone:s.target.value}),className:"compact-input",placeholder:"02-1234-5678"})}),e.jsx(c,{label:"이메일",children:e.jsx("input",{type:"email",value:t.email,onChange:s=>n({...t,email:s.target.value}),className:"compact-input",placeholder:"[email protected]"})})]}),e.jsxs(T,{title:"주소",children:[e.jsx("div",{className:"flex gap-2 mb-2",children:e.jsxs("button",{type:"button",onClick:()=>{var l;const s=()=>{new window.daum.Postcode({oncomplete:o=>{const x=o.roadAddress||o.jibunAddress||"";n(f=>({...f,address_city:o.sido||"",address_district:o.sigungu||"",address_dong:o.bname||"",address_postal:o.zonecode||"",address_full:x,address_bunji:""}))}}).open()};if((l=window.daum)!=null&&l.Postcode)s();else{const o=document.createElement("script");o.src="https://t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js",o.onload=()=>s(),o.onerror=()=>w.error("주소 검색 서비스를 불러올 수 없습니다."),document.head.appendChild(o)}},className:"flex items-center gap-1 px-3 py-1.5 bg-blue-500 text-white text-sm rounded hover:bg-blue-600",children:[e.jsx(te,{size:14}),"주소 검색"]})}),e.jsx(c,{label:"도로명주소",children:e.jsx("input",{type:"text",value:t.address_full,onChange:s=>n({...t,address_full:s.target.value}),className:"compact-input",placeholder:"주소 검색 또는 직접 입력"})}),e.jsx(c,{label:"상세주소",children:e.jsx("input",{type:"text",value:t.address_bunji,onChange:s=>n({...t,address_bunji:s.target.value}),className:"compact-input",placeholder:"동/호수 (예: 305동 1201호)"})}),e.jsx(c,{label:"우편번호",children:e.jsx("input",{type:"text",value:t.address_postal,onChange:s=>n({...t,address_postal:s.target.value}),className:"compact-input",placeholder:"주소 검색 시 자동입력"})})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(T,{title:"직분",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(c,{label:"교인구분",children:e.jsx("select",{value:t.member_classification,onChange:s=>n({...t,member_classification:s.target.value}),className:"compact-input",children:ye.map(s=>e.jsx("option",{value:s,children:s},s))})}),e.jsx(c,{label:"직분",children:e.jsx("select",{value:t.position,onChange:s=>n({...t,position:s.target.value}),className:"compact-input",children:Ne.map(s=>e.jsx("option",{value:s,children:s},s))})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(c,{label:"세부직분",children:e.jsxs("select",{value:t.detailed_position,onChange:s=>n({...t,detailed_position:s.target.value}),className:"compact-input",children:[e.jsx("option",{value:"",children:"선택하세요"}),_e.map(s=>e.jsx("option",{value:s,children:s},s))]})}),e.jsx(c,{label:"임직순번",children:e.jsx("input",{type:"number",value:t.position_order||"",onChange:s=>n({...t,position_order:parseInt(s.target.value)||void 0}),className:"compact-input"})})]}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:e.jsx(c,{label:"세부직분번호",children:e.jsx("input",{type:"number",value:t.detailed_position_order??"",onChange:s=>n({...t,detailed_position_order:parseInt(s.target.value)||void 0}),className:"compact-input"})})}),t.position==="장로"&&e.jsxs("div",{className:"flex items-center gap-3 mt-2",children:[e.jsx("label",{className:"text-xs font-medium text-gray-600 flex-shrink-0 w-16",children:"당회역할"}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:((K=t.roles)==null?void 0:K.includes("당회서기"))||!1,onChange:s=>{const l=s.target.checked?[...t.roles||[],"당회서기"]:(t.roles||[]).filter(o=>o!=="당회서기");n({...t,roles:l})},className:"w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500"}),e.jsx("span",{className:"text-sm text-gray-700",children:"당회서기 (회의록 작성 권한)"})]})]})]}),e.jsxs(T,{title:"교회활동",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(c,{label:"상태",children:e.jsx("select",{value:t.status,onChange:s=>n({...t,status:s.target.value}),className:"compact-input",children:Ce.map(s=>e.jsx("option",{value:s,children:s},s))})}),e.jsx(c,{label:"교구",children:e.jsxs("select",{value:t.parish||"",onChange:s=>{const l=s.target.value;n({...t,parish:l,region:"",district:""})},className:"compact-input",children:[e.jsx("option",{value:"",children:"선택하세요"}),Se.map(s=>e.jsx("option",{value:s,children:s},s))]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(c,{label:"지역",children:e.jsxs("select",{value:t.region||"",onChange:s=>{const l=s.target.value;n({...t,region:l,district:""})},className:"compact-input",disabled:!t.parish,children:[e.jsx("option",{value:"",children:"선택하세요"}),t.parish&&Ie(t.parish).map(s=>e.jsx("option",{value:s,children:s},s))]})}),e.jsx(c,{label:"구역",children:e.jsxs("select",{value:t.district||"",onChange:s=>n({...t,district:s.target.value}),className:"compact-input",disabled:!t.parish||!t.region,children:[e.jsx("option",{value:"",children:"선택하세요"}),t.parish&&t.region&&Ee(t.parish,t.region).map(s=>e.jsx("option",{value:s,children:s},s))]})}),e.jsx(c,{label:"구역장 지정",children:e.jsxs("select",{value:t.district_role||"",onChange:s=>n({...t,district_role:s.target.value}),className:"compact-input",children:[e.jsx("option",{value:"",children:"일반"}),e.jsx("option",{value:"구역장",children:"구역장"}),e.jsx("option",{value:"권찰",children:"권찰"})]})})]}),t.member_classification!=="서둔출석교역자"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 gap-2",children:e.jsx(c,{label:"선교회",children:e.jsxs("select",{value:t.evangelism_group,onChange:s=>n({...t,evangelism_group:s.target.value}),className:"compact-input",children:[e.jsx("option",{value:"",children:"선택하세요"}),(t.gender==="남"?Re:Te).map(s=>e.jsx("option",{value:s,children:s},s))]})})}),e.jsx(c,{label:"선교회직책",children:e.jsxs("select",{value:t.evangelism_position,onChange:s=>n({...t,evangelism_position:s.target.value}),className:"compact-input",children:[e.jsx("option",{value:"",children:"선택하세요"}),ke.map(s=>e.jsx("option",{value:s,children:s},s))]})})]}),t.position==="안수집사"&&e.jsx(c,{label:"안수집사회직ì
7±…",children:e.jsxs("select",{value:t.deacon_association_position||"",onChange:s=>n({...t,deacon_association_position:s.target.value}),className:"compact-input",children:[e.jsx("option",{value:"",children:"선택하세요"}),Me.map(s=>e.jsx("option",{value:s,children:s},s))]})}),t.position==="권사"&&e.jsx(c,{label:"권사회직책",children:e.jsxs("select",{value:t.kwonsa_association_position||"",onChange:s=>n({...t,kwonsa_association_position:s.target.value}),className:"compact-input",children:[e.jsx("option",{value:"",children:"선택하세요"}),Ae.map(s=>e.jsx("option",{value:s,children:s},s))]})}),(t.detailed_position==="시무장로"||we.includes(t.detailed_position||""))&&e.jsxs(c,{label:`${t.detailed_position==="시무장로"?"관할":"담당"}부서 (복수선택)`,children:[e.jsxs("select",{value:"",onChange:s=>{if(!s.target.value)return;const l=t.elder_departments||[];l.includes(s.target.value)||n({...t,elder_departments:[...l,s.target.value]}),s.target.value=""},className:"compact-input",children:[e.jsx("option",{value:"",children:"부서를 선택하세요"}),(t.detailed_position==="시무장로"?Pe:De).filter(s=>!(t.elder_departments||[]).includes(s)).map(s=>e.jsx("option",{value:s,children:s},s))]}),t.elder_departments&&t.elder_departments.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:t.elder_departments.map(s=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 text-xs font-medium bg-blue-50 text-blue-700 rounded-md border border-blue-200",children:[s,e.jsx("button",{type:"button",onClick:()=>{n({...t,elder_departments:t.elder_departments.filter(l=>l!==s)})},className:"text-blue-400 hover:text-blue-600 ml-0.5",children:"×"})]},s))})]}),e.jsx(c,{label:"봉사부서 배정",children:e.jsxs("div",{className:"space-y-2",children:[(t.service_assignments||[]).map((s,l)=>e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsxs("select",{value:s.department,onChange:o=>{const x=[...t.service_assignments||[]];x[l]={...x[l],department:o.target.value},n({...t,service_assignments:x})},className:"compact-input flex-1",children:[e.jsx("option",{value:"",children:"부서선택"}),Oe.map(o=>e.jsx("optgroup",{label:o.label,children:o.departments.map(x=>e.jsx("option",{value:x,children:x},x))},o.label))]}),e.jsxs("select",{value:s.role,onChange:o=>{const x=[...t.service_assignments||[]];x[l]={...x[l],role:o.target.value},n({...t,service_assignments:x})},className:"compact-input flex-1",children:[e.jsx("option",{value:"",children:"역할선택"}),$e.map(o=>e.jsx("option",{value:o,children:o},o))]}),e.jsx("button",{type:"button",onClick:()=>{const o=(t.service_assignments||[]).filter((x,f)=>f!==l);n({...t,service_assignments:o})},className:"p-1 text-red-500 hover:bg-red-50 rounded",children:e.jsx(ae,{className:"w-4 h-4"})})]},l)),e.jsxs("button",{type:"button",onClick:()=>{const s=t.service_assignments||[];n({...t,service_assignments:[...s,{department:"",role:""}]})},className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:[e.jsx(J,{className:"w-4 h-4"}),"봉사부서 추가"]})]})}),e.jsx(c,{label:"사역",children:e.jsx("input",{type:"text",value:t.ministry,onChange:s=>n({...t,ministry:s.target.value}),className:"compact-input",placeholder:"찬양팀"})})]}),e.jsxs(T,{title:"신앙 정보",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(c,{label:"세례일",children:e.jsx("input",{type:"date",value:t.baptism_date,onChange:s=>n({...t,baptism_date:s.target.value}),className:"compact-input"})}),e.jsx(c,{label:"입교일",children:e.jsx("input",{type:"date",value:t.confirmation_date,onChange:s=>n({...t,confirmation_date:s.target.value}),className:"compact-input"})})]}),e.jsx(c,{label:"영적성숙",children:e.jsx("select",{value:t.spiritual_maturity,onChange:s=>n({...t,spiritual_maturity:s.target.value}),className:"compact-input",children:Le.map(s=>e.jsx("option",{value:s,children:s},s))})})]}),e.jsxs(T,{title:"기타 정보",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(c,{label:"직업",children:e.jsx("input",{type:"text",value:t.occupation,onChange:s=>n({...t,occupation:s.target.value}),className:"compact-input",placeholder:"회사원"})}),e.jsx(c,{label:"혈액형",children:e.jsxs("select",{value:t.blood_type,onCh
7ange:s=>n({...t,blood_type:s.target.value}),className:"compact-input",children:[e.jsx("option",{value:"",children:"선택"}),Ve.map(s=>e.jsx("option",{value:s,children:s},s))]})})]}),e.jsx(c,{label:"재능",children:e.jsx("textarea",{value:t.talents,onChange:s=>n({...t,talents:s.target.value}),className:"compact-input",rows:2,placeholder:"피아노, 기타"})}),e.jsx(c,{label:"의료정보",children:e.jsx("textarea",{value:t.medical_info,onChange:s=>n({...t,medical_info:s.target.value}),className:"compact-input",rows:2,placeholder:"알레르기, 복용약물"})}),e.jsx(c,{label:"목양메모",children:e.jsx("textarea",{value:t.pastoral_notes,onChange:s=>n({...t,pastoral_notes:s.target.value}),className:"compact-input",rows:3,placeholder:"목회자 메모"})})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(T,{title:"가족 정보",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(c,{label:"배우자",children:e.jsx("input",{type:"text",value:t.spouse,onChange:s=>n({...t,spouse:s.target.value}),className:"compact-input"})}),e.jsx(c,{label:"자녀수",children:e.jsx("input",{type:"number",value:t.children||"",onChange:s=>n({...t,children:parseInt(s.target.value)||void 0}),className:"compact-input",placeholder:"2"})})]}),e.jsx(c,{label:"가족구조",children:e.jsx("select",{value:t.family_structure||"일반",onChange:s=>n({...t,family_structure:s.target.value}),className:"compact-input",children:Ue.map(s=>e.jsx("option",{value:s,children:s},s))})}),e.jsx(c,{label:"돌봄관련",children:e.jsx("select",{value:t.care_type||"해당없음",onChange:s=>n({...t,care_type:s.target.value}),className:"compact-input",children:Fe.map(s=>e.jsx("option",{value:s,children:s},s))})})]}),e.jsx(T,{title:"가족 관계",children:e.jsx(He,{relations:t.relations||[],onChange:s=>{const l=s.find(_=>_.relationType==="부"),o=s.find(_=>_.relationType==="모");let x=t.father_id,f=t.mother_id;l&&(l.isNone?x="":x=l.memberId||l.relativeId||""),o&&(o.isNone?f="":f=o.memberId||o.relativeId||""),n({...t,relations:s,father_id:x,mother_id:f})}})})]})]}),j==="edit"&&a&&e.jsx("div",{className:"mt-4",children:e.jsx(Be,{memberId:a.id,memberName:t.name||a.name})}),j==="edit"&&v&&e.jsx("div",{className:"mt-4",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 bg-slate-50 border-b border-gray-100 flex items-center justify-between",children:[e.jsxs("button",{type:"button",onClick:()=>V(!L),className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[e.jsx(Y,{className:"w-4 h-4 text-blue-600"}),e.jsx("h3",{className:"text-sm font-bold text-gray-800",children:"심방 히스토리"}),e.jsxs("span",{className:"text-xs px-2 py-0.5 bg-blue-50 text-blue-700 rounded-full tabular-nums",children:[m.length,"건"]}),L?e.jsx(ee,{className:"w-4 h-4 text-gray-400"}):e.jsx(se,{className:"w-4 h-4 text-gray-400"})]}),e.jsxs("button",{type:"button",onClick:()=>{A(null),k(!0)},className:"flex items-center gap-1 px-2 py-1 bg-blue-600 text-white rounded text-xs font-medium hover:bg-blue-700 transition-colors",children:[e.jsx(J,{className:"w-3 h-3"}),"추가"]})]}),L&&e.jsx("div",{className:"p-4",children:y?e.jsx("div",{className:"text-center py-6 text-gray-500 text-sm",children:"심방 기록을 불러오는 중..."}):m.length===0?e.jsxs("div",{className:"text-center py-6",children:[e.jsx(Y,{className:"w-10 h-10 text-gray-300 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-gray-500",children:"심방 기록이 없습니다"}),e.jsx("button",{type:"button",onClick:()=>{A(null),k(!0)},className:"mt-3 text-xs text-blue-600 hover:text-blue-700 font-medium",children:"첫 심방 기록 추가하기 →"})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-4 gap-2 mb-4",children:[e.jsxs("div",{className:"bg-blue-50 rounded-lg p-2 text-center",children:[e.jsx("div",{className:"text-lg font-bold text-blue-600 tabular-nums",children:m.length}),e.jsx("div",{className:"text-[10px] text-gray-500",children:"총 심방"})]}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-2 text-center",children:[e.jsx("div",{className:"text-xs font-bold text-gray-700",children:((Q=m[0])==null?void 0:Q.visit_date)||"-"}),e.jsx("div",{className:"text-[10px] text-gray-500",children:"최근 심방"})]}),e.jsxs("div",{className:"bg-blue-50 rounded-lg p-2 text-center",children:[e.jsx("div",{className:"text-lg font-bold text-blue-600",children:m.filter(s=>s.visit_type==="가정심방").length}),e.jsx("div",{className:"text-[10px] text-gray-500",children:"가정심방"})]}),e.jsxs("div",{className:"bg-orange-50 rounded-lg p-2 text-center",children:[e.jsx("div",{className:"text-lg font-bold text-orange-600",children:m.filter(s=>s.follow_up_needed).length}),e.jsx("div",{className:"text-[10px] text-gray-500",children:"후속조치"})]})]}),e.jsx("div",{className:"max-h-80 overflow-y-auto space-y-2",children:m.map(s=>e.jsx(ze,{visit:s,onEdit:()=>{A(s),k(!0)},onDelete:()=>E(s.id)},s.id))})]})})]})}),q&&v&&e.jsx(qe,{memberId:v,memberName:(a==null?void 0:a.name)||t.name||"",visit:U,onClose:()=>{k(!1),A(null)},onSubmit:s=>{U?h(U.id,s):r({...s,member_id:v})}})]})}function ze({visit:u,onEdit:j,onDelete:i}){const v={가정심방:"bg-blue-100 text-blue-700",병원심방:"bg-red-100 text-red-700",전화심방:"bg-green-100 text-green-700",상담:"bg-blue-100 text-blue-700",기타:"bg-gray-100 text-gray-700"};return e.jsxs("div",{className:"bg-gray-50 rounded-lg p-3 border border-gray-100 hover:border-gray-200 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-bold text-gray-900",children:u.visit_date}),e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${v[u.visit_type]||v.기타}`,children:u.visit_type}),u.follow_up_needed&&e.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 bg-orange-100 text-orange-700 rounded flex items-center gap-0.5",children:[e.jsx(ge,{className:"w-2.5 h-2.5"}),"후속조치"]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{type:"button",onClick:j,className:"p-1 hover:bg-gray-200 rounded transition-colors",title:"수정",children:e.jsx(be,{className:"w-3 h-3 text-blue-600"})}),e.jsx("button",{type:"button",onClick:i,className:"p-1 hover:bg-gray-200 rounded transition-colors",title:"삭제",children:e.jsx(ae,{className:"w-3 h-3 text-red-600"})})]})]}),e.jsxs("div",{className:"text-[11px] text-gray-600 space-y-1",children:[u.visitors&&u.visitors.length>0&&e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-gray-700",children:"심방자:"}
7)," ",u.visitors.join(", ")]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-gray-700",children:"목적:"})," ",u.purpose]}),e.jsxs("p",{className:"line-clamp-2",children:[e.jsx("span",{className:"font-medium text-gray-700",children:"내용:"})," ",u.content]}),u.prayer_topics&&u.prayer_topics.length>0&&e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-gray-700",children:"기도제목:"})," ",u.prayer_topics.join(", ")]})]})]})}function qe({memberId:u,memberName:j,visit:i,onClose:v,onSubmit:I}){var a,R;const[C,g]=b.useState(!1),[d,N]=b.useState({visit_type:(i==null?void 0:i.visit_type)||"가정심방",visit_date:(i==null?void 0:i.visit_date)||new Date().toISOString().split("T")[0],visitors:((a=i==null?void 0:i.visitors)==null?void 0:a.join(", "))||"",purpose:(i==null?void 0:i.purpose)||"",content:(i==null?void 0:i.content)||"",prayer_topics:((R=i==null?void 0:i.prayer_topics)==null?void 0:R.join(`
8`))||"",follow_up_needed:(i==null?void 0:i.follow_up_needed)||!1,follow_up_date:(i==null?void 0:i.follow_up_date)||""});async function S(m){if(m.preventDefault(),!d.purpose||!d.content){w.error("목적과 내용을 입력하세요");return}g(!0);try{const p={member_id:u,visit_type:d.visit_type,visit_date:d.visit_date,visitors:d.visitors.split(",").map(y=>y.trim()).filter(y=>y),purpose:d.purpose,content:d.content,prayer_topics:d.prayer_topics?d.prayer_topics.split(`
9`).map(y=>y.trim()).filter(y=>y):void 0,follow_up_needed:d.follow_up_needed,follow_up_date:d.follow_up_needed?d.follow_up_date:void 0};I(p)}finally{g(!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-xl shadow-xl max-w-lg w-full max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"px-4 py-3 bg-blue-600 text-white flex items-center justify-between rounded-t-xl",children:[e.jsxs("h2",{className:"text-sm font-bold flex items-center gap-2",children:[e.jsx(Y,{className:"w-4 h-4"}),i?"심방 기록 수정":"심방 기록 추가"]}),e.jsx("button",{type:"button",onClick:v,className:"p-1 hover:bg-white/20 rounded transition-colors",children:e.jsx(z,{className:"w-4 h-4"})})]}),e.jsxs("form",{onSubmit:S,className:"p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"교인"}),e.jsx("input",{type:"text",value:j,disabled:!0,className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg bg-gray-50"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:["심방 유형 ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("select",{value:d.visit_type,onChange:m=>N({...d,visit_type:m.target.value}),className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",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.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-xs font-medium text-gray-700 mb-1",children:["심방 날짜 ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"date",value:d.visit_date,onChange:m=>N({...d,visit_date:m.target.value}),className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",required:!0})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"심방자 (쉼표로 구분)"}),e.jsx("input",{type:"text",value:d.visitors,onChange:m=>N({...d,visitors:m.target.value}),className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"홍길동, 김철수"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:["심방 목적 ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"text",value:d.purpose,onChange:m=>N({...d,purpose:m.target.value}),className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"예: 정기 심방",required:!0})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:["심방 내용 ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("textarea",{value:d.content,onChange:m=>N({...d,content:m.target.value}),className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",rows:3,placeholder:"심방 내용을 기록하세요",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-700 mb-1",children:"기도 제목 
9(줄바꿈으로 구분)"}),e.jsx("textarea",{value:d.prayer_topics,onChange:m=>N({...d,prayer_topics:m.target.value}),className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",rows:2,placeholder:`건강 회복
10가족 평안`})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:d.follow_up_needed,onChange:m=>N({...d,follow_up_needed:m.target.checked}),className:"w-4 h-4 text-blue-600 rounded"}),e.jsx("span",{className:"text-xs font-medium text-gray-700",children:"후속조치 필요"})]}),d.follow_up_needed&&e.jsx("input",{type:"date",value:d.follow_up_date,onChange:m=>N({...d,follow_up_date:m.target.value}),className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"후속조치 예정일"})]}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx("button",{type:"button",onClick:v,className:"flex-1 px-3 py-2 border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors text-sm",children:"취소"}),e.jsx("button",{type:"submit",disabled:C,className:"flex-1 px-3 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors text-sm font-medium disabled:opacity-50",children:C?"저장 중...":i?"수정":"추가"})]})]})]})})}function T({title:u,children:j}){return e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden",children:[e.jsx("div",{className:"px-4 py-3 bg-slate-50 border-b border-gray-100",children:e.jsx("h3",{className:"text-sm font-bold text-gray-800",children:u})}),e.jsx("div",{className:"p-4 space-y-3",children:j})]})}function c({label:u,required:j,children:i}){return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("label",{className:"text-xs font-medium text-gray-600 flex-shrink-0 w-16",children:[u,j&&e.jsx("span",{className:"text-red-500 ml-0.5",children:"*"})]}),e.jsx("div",{className:"flex-1",children:i})]})}export{as as MemberForm};

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.