fix:고객 서비스이용 계약서 기본값 - 라벨 기반 매칭으로 수정
- 하드코딩 키 대신 템플릿 변수의 라벨(계약번호/총개발비/월구독료)로 매칭 - 빈 문자열 기본값도 덮어쓰도록 trim() 체크 추가 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -518,16 +518,25 @@ className={`w-full text-left px-3 py-2.5 rounded-lg mb-1 transition-colors ${i =
|
||||
return '';
|
||||
};
|
||||
|
||||
// 계약 제목 변경 시 기본값 세팅
|
||||
// 계약 제목 변경 시 기본값 세팅 (라벨 기반 매칭)
|
||||
const applyTitleDefaults = async (title) => {
|
||||
if (title === '고객 서비스이용 계약서') {
|
||||
const contractNum = await fetchContractNumber();
|
||||
setMetadata(prev => ({
|
||||
...prev,
|
||||
...(contractNum && !prev.contract_number ? { contract_number: contractNum } : {}),
|
||||
...(!prev.total_dev_cost ? { total_dev_cost: '20,000,000' } : {}),
|
||||
...(!prev.monthly_fee ? { monthly_fee: '500,000' } : {}),
|
||||
}));
|
||||
const labelDefaults = {
|
||||
'계약번호': contractNum || '',
|
||||
'총개발비': '20,000,000',
|
||||
'총개발비용': '20,000,000',
|
||||
'월구독료': '500,000',
|
||||
};
|
||||
setMetadata(prev => {
|
||||
const updated = { ...prev };
|
||||
templateVars.forEach(v => {
|
||||
if (labelDefaults[v.label] !== undefined && !updated[v.key]?.trim()) {
|
||||
updated[v.key] = labelDefaults[v.label];
|
||||
}
|
||||
});
|
||||
return updated;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user