feat: [esign] 계약 변수에 상대방 이름/전화번호 자동 입력 및 랜덤 데이터 버튼 추가
This commit is contained in:
@@ -580,6 +580,40 @@ className={`w-full text-left px-3 py-2.5 rounded-lg mb-1 transition-colors ${i =
|
||||
}));
|
||||
};
|
||||
|
||||
// 개발용: 주소/사업자등록번호/상호 랜덤 입력
|
||||
const fillRandomVariables = () => {
|
||||
const addresses = [
|
||||
'서울특별시 강남구 테헤란로 123, 4층',
|
||||
'서울특별시 서초구 서초대로 456, 7층',
|
||||
'경기도 성남시 분당구 판교로 789',
|
||||
'서울특별시 마포구 월드컵북로 54길 12',
|
||||
'인천광역시 연수구 송도과학로 32',
|
||||
];
|
||||
const bizNos = [
|
||||
'123-45-67890', '234-56-78901', '345-67-89012',
|
||||
'456-78-90123', '567-89-01234',
|
||||
];
|
||||
const companies = [
|
||||
'(주)테스트컴퍼니', '(주)블루오션', '(주)스마트솔루션',
|
||||
'(주)넥스트웨이브', '(주)그린테크',
|
||||
];
|
||||
const pick = arr => arr[Math.floor(Math.random() * arr.length)];
|
||||
const labelMap = {
|
||||
'주소': pick(addresses),
|
||||
'사업자등록번호': pick(bizNos),
|
||||
'상호': pick(companies),
|
||||
};
|
||||
setMetadata(prev => {
|
||||
const updated = { ...prev };
|
||||
templateVars.forEach(v => {
|
||||
if (labelMap[v.label] !== undefined) {
|
||||
updated[v.key] = labelMap[v.label];
|
||||
}
|
||||
});
|
||||
return updated;
|
||||
});
|
||||
};
|
||||
|
||||
const fillRandomCounterpart = async () => {
|
||||
try {
|
||||
const res = await fetch(`/esign/contracts/search-partners?q=`, {
|
||||
@@ -665,6 +699,20 @@ className={`w-full text-left px-3 py-2.5 rounded-lg mb-1 transition-colors ${i =
|
||||
if (hasTemplates) { setStep(2); } else { handleSubmit(); }
|
||||
} else if (step === 2) {
|
||||
applyTitleDefaults(form.title);
|
||||
// 상대방 이름/전화번호를 계약 변수에 자동 입력
|
||||
setMetadata(prev => {
|
||||
const updated = { ...prev };
|
||||
const labelMap = {
|
||||
'파트너명': form.counterpart_name,
|
||||
'전화번호': form.counterpart_phone,
|
||||
};
|
||||
templateVars.forEach(v => {
|
||||
if (labelMap[v.label] !== undefined && labelMap[v.label] && !updated[v.key]?.trim()) {
|
||||
updated[v.key] = labelMap[v.label];
|
||||
}
|
||||
});
|
||||
return updated;
|
||||
});
|
||||
setStep(3);
|
||||
}
|
||||
};
|
||||
@@ -991,7 +1039,16 @@ className="px-5 py-1.5 bg-blue-600 text-white rounded-md hover:bg-blue-700 text-
|
||||
{templateVars.length > 0 && (
|
||||
<div>
|
||||
<div className="flex items-center justify-between mb-1.5">
|
||||
<div className="text-[11px] font-medium text-gray-500">직접 입력 항목</div>
|
||||
<div className="flex items-center gap-1.5">
|
||||
<div className="text-[11px] font-medium text-gray-500">직접 입력 항목</div>
|
||||
<button type="button" onClick={fillRandomVariables}
|
||||
className="p-1 bg-amber-500 hover:bg-amber-600 text-white rounded transition-colors"
|
||||
title="주소/사업자등록번호/상호 랜덤 입력 (개발용)">
|
||||
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
|
||||
<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
{isCustomerContract ? (
|
||||
<button type="button" onClick={() => setTenantModalOpen(true)}
|
||||
className="inline-flex items-center gap-1 px-2.5 py-1 bg-white border border-green-300 text-green-700 rounded-md text-xs font-medium hover:bg-green-50 transition-colors">
|
||||
|
||||
Reference in New Issue
Block a user