From f88c5e3e40b669e8ead8e529ac19c760603051dd Mon Sep 17 00:00:00 2001 From: hjjeong Date: Mon, 11 May 2026 14:42:36 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B2=AC=EC=A0=81=EC=84=9C=20=EB=8B=B4?= =?UTF-8?q?=EB=8B=B9=EC=9E=90/=EC=97=B0=EB=9D=BD=EC=B2=98=20=EC=9E=90?= =?UTF-8?q?=EB=8F=99=20=EC=B1=84=EC=9B=80=20(wace=20estimateTemplate1.jsp?= =?UTF-8?q?=20ready=201:1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 신규 작성 시 useAuth로 로그인 사용자 정보 자동 채움: - 담당자 = "{deptName} {userName}" (wace: connectUserDeptName + connectUserName) - 연락처 = user.tel (wace: cell_phone || tel) 조건: templateObjid 없는 신규 작성 + 사용자가 아직 입력하지 않은 빈 값에만 채움. 기존 견적서 수정 모드는 DB 값 우선 (manager_name/manager_contact). Co-Authored-By: Claude Opus 4.7 (1M context) --- .../estimate/template1/pop/[contractObjid]/page.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frontend/app/(main)/COMPANY_16/sales/estimate/template1/pop/[contractObjid]/page.tsx b/frontend/app/(main)/COMPANY_16/sales/estimate/template1/pop/[contractObjid]/page.tsx index 9b57fd72..0390d071 100644 --- a/frontend/app/(main)/COMPANY_16/sales/estimate/template1/pop/[contractObjid]/page.tsx +++ b/frontend/app/(main)/COMPANY_16/sales/estimate/template1/pop/[contractObjid]/page.tsx @@ -10,6 +10,7 @@ import React, { useEffect, useMemo, useRef, useState } from "react"; import { useParams, useSearchParams, useRouter } from "next/navigation"; import { salesEstimateApi, EstimateTemplateItemRow } from "@/lib/api/salesEstimate"; import { CustomerSelect } from "@/components/common/CustomerSelect"; +import { useAuth } from "@/hooks/useAuth"; // ─── 포맷 헬퍼 (wace addComma / getCurrencySymbol 1:1) ──────── function addComma(num: number | string): string { @@ -67,6 +68,7 @@ export default function EstimateTemplate1Page() { const params = useParams<{ contractObjid: string }>(); const searchParams = useSearchParams(); const router = useRouter(); + const { user } = useAuth(); const contractObjidParam = params?.contractObjid ?? ""; const templateObjidParam = searchParams?.get("templateObjid") ?? ""; @@ -233,6 +235,15 @@ export default function EstimateTemplate1Page() { // eslint-disable-next-line react-hooks/exhaustive-deps }, [contractObjidParam, templateObjidParam]); + // 로그인 사용자 정보로 담당자/연락처 자동 채움 (wace estimateTemplate1.jsp:321-322) + // — 신규 작성 시에만, 그리고 사용자가 아직 직접 입력하지 않은 경우(빈값)에만 채움 + useEffect(() => { + if (!user) return; + if (templateObjidParam) return; // 기존 견적서 수정 모드는 건드리지 않음 + setManagerName(prev => prev || `${user.deptName ?? ""} ${user.userName ?? ""}`.trim()); + setManagerContact(prev => prev || user.tel ?? ""); + }, [user, templateObjidParam]); + // ─── 저장 (wace fn_save 1:1) ───────────────────────────────── async function handleSave() { if (!contractObjid) {