diff --git a/frontend/app/(main)/COMPANY_16/purchase/supplier/page.tsx b/frontend/app/(main)/COMPANY_16/purchase/supplier/page.tsx index c2111d7e..88da1d20 100644 --- a/frontend/app/(main)/COMPANY_16/purchase/supplier/page.tsx +++ b/frontend/app/(main)/COMPANY_16/purchase/supplier/page.tsx @@ -56,7 +56,7 @@ const CONTACT_TABLE = "supplier_contact"; const SUPPLIER_GRID_COLUMNS = [ { key: "supplier_code", label: "공급업체코드" }, { key: "supplier_name", label: "공급업체명" }, - { key: "division", label: "거래유형" }, + { key: "division", label: "공급업체유형" }, { key: "contact_person", label: "담당자" }, { key: "contact_phone", label: "전화번호" }, { key: "email", label: "이메일" }, @@ -452,9 +452,12 @@ export default function SupplierManagementPage() { const handleModalContactSave = async () => { if (!modalContactForm.contact_name) { toast.error("담당자명은 필수입니다."); return; } if (modalContactEditId) { - // 수정 — 로컬 리스트에서 교체 + // 수정 — 로컬 리스트에서 교체 + 메인 설정 시 다른 메인 해제 + const isSettingMain = modalContactForm.is_main === "Y" || modalContactForm.is_main === true; setModalContacts((prev) => prev.map((c) => - c._localId === modalContactEditId ? { ...c, ...modalContactForm } : c + (c._localId || c.id) === modalContactEditId + ? { ...c, ...modalContactForm } + : isSettingMain ? { ...c, is_main: "N" } : c )); } else { // 추가 — 로컬 리스트에 카드 추가 @@ -512,8 +515,11 @@ export default function SupplierManagementPage() { const handleModalDeliverySave = async () => { if (!modalDeliveryForm.destination_name) { toast.error("납품처명은 필수입니다."); return; } if (modalDeliveryEditId) { + const isSettingMain = modalDeliveryForm.is_default === "Y" || modalDeliveryForm.is_default === true; setModalDeliveries((prev) => prev.map((d) => - (d._localId || d.id) === modalDeliveryEditId ? { ...d, ...modalDeliveryForm } : d + (d._localId || d.id) === modalDeliveryEditId + ? { ...d, ...modalDeliveryForm } + : isSettingMain ? { ...d, is_default: "N" } : d )); } else { setModalDeliveries((prev) => [...prev, { @@ -544,7 +550,7 @@ export default function SupplierManagementPage() { setModalDeliveryFormOpen(false); setTaxTypeRows([]); setSupplierModalOpen(true); - // 거래처 코드 자동 채번 — 기존 데이터 max값 기반 + // 공급업체 코드 자동 채번 — 기존 데이터 max값 기반 try { const ruleRes = await apiClient.get(`/numbering-rules/by-column/${SUPPLIER_TABLE}/supplier_code`); const ruleData = ruleRes.data; @@ -1233,7 +1239,7 @@ export default function SupplierManagementPage() { ...(isColumnVisible("supplier_name") ? [{ key: "supplier_name", label: "공급업체명", minWidth: "min-w-[140px]" }] : []), ...(isColumnVisible("division") ? [{ key: "division", - label: "거래유형", + label: "공급업체유형", width: "w-[80px]", render: (val: any) => val ? ( @@ -1298,7 +1304,7 @@ export default function SupplierManagementPage() { if (suppMappings.length === 0) { rows.push({ 공급업체코드: c.supplier_code, 공급업체명: c.supplier_name, - 거래유형: getCategoryLabel("division", c.division), + 공급업체유형: getCategoryLabel("division", c.division), 담당자: c.contact_person, 전화번호: c.contact_phone, 사업자번호: c.business_number, 이메일: c.email, 상태: getCategoryLabel("status", c.status), @@ -1310,7 +1316,7 @@ export default function SupplierManagementPage() { for (const m of suppMappings) { rows.push({ 공급업체코드: c.supplier_code, 공급업체명: c.supplier_name, - 거래유형: getCategoryLabel("division", c.division), + 공급업체유형: getCategoryLabel("division", c.division), 담당자: c.contact_person, 전화번호: c.contact_phone, 사업자번호: c.business_number, 이메일: c.email, 상태: getCategoryLabel("status", c.status), @@ -1763,7 +1769,7 @@ export default function SupplierManagementPage() {
- + setSupplierForm((p) => ({ ...p, supplier_code: e.target.value }))} diff --git a/frontend/app/(main)/COMPANY_16/sales/customer/page.tsx b/frontend/app/(main)/COMPANY_16/sales/customer/page.tsx index 0ba76d35..20bde7c4 100644 --- a/frontend/app/(main)/COMPANY_16/sales/customer/page.tsx +++ b/frontend/app/(main)/COMPANY_16/sales/customer/page.tsx @@ -452,9 +452,12 @@ export default function CustomerManagementPage() { const handleModalContactSave = async () => { if (!modalContactForm.contact_name) { toast.error("담당자명은 필수입니다."); return; } if (modalContactEditId) { - // 수정 — 로컬 리스트에서 교체 + // 수정 — 로컬 리스트에서 교체 + 메인 설정 시 다른 메인 해제 + const isSettingMain = modalContactForm.is_main === "Y" || modalContactForm.is_main === true; setModalContacts((prev) => prev.map((c) => - c._localId === modalContactEditId ? { ...c, ...modalContactForm } : c + (c._localId || c.id) === modalContactEditId + ? { ...c, ...modalContactForm } + : isSettingMain ? { ...c, is_main: "N" } : c )); } else { // 추가 — 로컬 리스트에 카드 추가 @@ -512,8 +515,11 @@ export default function CustomerManagementPage() { const handleModalDeliverySave = async () => { if (!modalDeliveryForm.destination_name) { toast.error("납품처명은 필수입니다."); return; } if (modalDeliveryEditId) { + const isSettingMain = modalDeliveryForm.is_default === "Y" || modalDeliveryForm.is_default === true; setModalDeliveries((prev) => prev.map((d) => - (d._localId || d.id) === modalDeliveryEditId ? { ...d, ...modalDeliveryForm } : d + (d._localId || d.id) === modalDeliveryEditId + ? { ...d, ...modalDeliveryForm } + : isSettingMain ? { ...d, is_default: "N" } : d )); } else { setModalDeliveries((prev) => [...prev, {