import { useEffect, useState } from 'react' import { provisionChannels, updateContact, type Contact, type Org, type ProvisionResult, } from '../api/client' import ConfirmDialog from './ConfirmDialog' import StatusBadge from './StatusBadge' const APPLICANT_FIELDS: { key: keyof Contact; label: string }[] = [ { key: 'deptName', label: '부서명' }, { key: 'managerName', label: '담당자명' }, { key: 'managerTitle', label: '직급/직함' }, { key: 'managerPhone', label: '연락처' }, { key: 'managerEmail', label: '이메일' }, ] const MJ_FIELDS: { key: keyof Contact; label: string; type?: string }[] = [ { key: 'mjDeptName', label: '부서명' }, { key: 'mjManagerName', label: '담당자명' }, { key: 'mjManagerPhone', label: '연락처' }, { key: 'mjManagerEmail', label: '이메일' }, ] const LAWYER_FIELDS: { key: keyof Contact; label: string; type?: string }[] = [ { key: 'lawyerName', label: '성명' }, { key: 'lawyerPhone', label: '연락처' }, { key: 'lawyerEmail', label: '이메일' }, { key: 'lawyerAssignedDate', label: '배정일', type: 'date' }, ] function emptyContact(org: Org): Contact { return { deptName: org.deptName ?? '', managerName: org.managerName ?? '', managerTitle: org.managerTitle ?? '', managerPhone: org.managerPhone ?? '', managerEmail: org.managerEmail ?? '', mjDeptName: org.mjDeptName ?? '', mjManagerName: org.mjManagerName ?? '', mjManagerPhone: org.mjManagerPhone ?? '', mjManagerEmail: org.mjManagerEmail ?? '', lawyerName: org.lawyerName ?? '', lawyerPhone: org.lawyerPhone ?? '', lawyerEmail: org.lawyerEmail ?? '', lawyerAssignedDate: org.lawyerAssignedDate ?? '', } } const REQUIRED_FIELDS: (keyof Contact)[] = [ 'deptName', 'managerName', 'managerPhone', 'managerEmail', ] function ContactFieldGroup({ title, fields, contact, onChange, }: { title: string fields: { key: keyof Contact; label: string; type?: string }[] contact: Contact onChange: (key: keyof Contact, value: string) => void }) { return (
{error}
} {result && (문정원 채널: {outcomeLabel(result.mj)}
법률검토 채널: {outcomeLabel(result.law)}
{result.mj === 'FAILED' && result.law === 'FAILED' ? (문정원 채널과 법률검토 채널 모두 생성에 실패했습니다. 아직 만들어진 채널이 없으니 [채널 생성]을 다시 눌러도 안전합니다.
) : ( <> {result.law === 'FAILED' && (법률검토 채널 생성에 실패했습니다. 문정원 채널은 그대로 남아 있으니 [채널 생성]을 다시 눌러도 안전합니다. 없는 채널만 다시 만듭니다.
)} {result.mj === 'FAILED' && (문정원 채널 생성에 실패했습니다. 법률검토 채널은 그대로 남아 있으니 [채널 생성]을 다시 눌러도 안전합니다. 없는 채널만 다시 만듭니다.
)} > )} {result.message && ({result.message}
)}