feat: [esign] 근로계약서 사원 불러오기 시 주소, 생년월일, 계약일 자동 반영
- 주민등록번호에서 출생년도/월/일 분리 (세기 자동 판별) - 입사일 기반 계약일, 근로계약시작일, 연봉계약시작일 자동 반영 - 연봉계약종료일은 입사일 + 1년으로 계산 - 사원 주소, 계약자 이름 자동 매핑 추가
This commit is contained in:
@@ -950,9 +950,30 @@ className={`w-full text-left px-3 py-2.5 rounded-lg mb-1 transition-colors ${i =
|
||||
|
||||
// 사원 선택 시 근로계약서 변수 자동 채우기
|
||||
const handleEmployeeSelect = (emp) => {
|
||||
// 입사일에서 년/월/일 분리
|
||||
let hireYear = '', hireMonth = '', hireDay = '';
|
||||
let endYear = '', endMonth = '', endDay = '';
|
||||
if (emp.hire_date) {
|
||||
const hd = emp.hire_date.replace(/-/g, '');
|
||||
if (hd.length >= 8) {
|
||||
hireYear = hd.substring(0, 4);
|
||||
hireMonth = hd.substring(4, 6);
|
||||
hireDay = hd.substring(6, 8);
|
||||
// 1년 후 계산
|
||||
const endDate = new Date(parseInt(hireYear), parseInt(hireMonth) - 1, parseInt(hireDay));
|
||||
endDate.setFullYear(endDate.getFullYear() + 1);
|
||||
endYear = String(endDate.getFullYear());
|
||||
endMonth = String(endDate.getMonth() + 1).padStart(2, '0');
|
||||
endDay = String(endDate.getDate()).padStart(2, '0');
|
||||
}
|
||||
}
|
||||
|
||||
const labelMap = {
|
||||
'직원.*주소': emp.address,
|
||||
'주소': emp.address,
|
||||
'출생.*년도': emp.birth_year,
|
||||
'출생.*월$': emp.birth_month,
|
||||
'출생.*일$': emp.birth_day,
|
||||
'부서': emp.department,
|
||||
'직책': emp.position,
|
||||
'직위': emp.job_title || emp.position,
|
||||
@@ -964,6 +985,22 @@ className={`w-full text-left px-3 py-2.5 rounded-lg mb-1 transition-colors ${i =
|
||||
'근로자.*이름': emp.name,
|
||||
'근로자.*성명': emp.name,
|
||||
'입사.*일': emp.hire_date,
|
||||
// 계약일 = 입사일
|
||||
'계약.*연도': hireYear,
|
||||
'계약.*월$': hireMonth,
|
||||
'계약.*일$': hireDay,
|
||||
// 근로계약 시작일 = 입사일
|
||||
'근로계약.*시작.*년도': hireYear,
|
||||
'근로계약.*시작.*월$': hireMonth,
|
||||
'근로계약.*시작.*일$': hireDay,
|
||||
// 연봉계약 시작일 = 입사일
|
||||
'연봉계약.*시작.*년도': hireYear,
|
||||
'연봉계약.*시작.*월$': hireMonth,
|
||||
'연봉계약.*시작.*일$': hireDay,
|
||||
// 연봉계약 종료일 = 입사일 + 1년
|
||||
'연봉계약.*종료.*년도': endYear,
|
||||
'연봉계약.*종료.*월$': endMonth,
|
||||
'연봉계약.*종료.*일$': endDay,
|
||||
};
|
||||
|
||||
setMetadata(prev => {
|
||||
|
||||
Reference in New Issue
Block a user