Merge remote-tracking branch 'origin/master'
# Conflicts: # src/app/[locale]/(protected)/construction/project/bidding/estimates/[id]/edit/page.tsx # src/app/[locale]/(protected)/construction/project/bidding/estimates/[id]/page.tsx
This commit is contained in:
@@ -193,9 +193,33 @@ export function EmployeeForm({
|
||||
}
|
||||
}, [employee, mode]);
|
||||
|
||||
// 휴대폰 번호 자동 하이픈 포맷팅
|
||||
const formatPhoneNumber = (value: string): string => {
|
||||
const numbers = value.replace(/[^0-9]/g, '');
|
||||
if (numbers.length <= 3) return numbers;
|
||||
if (numbers.length <= 7) return `${numbers.slice(0, 3)}-${numbers.slice(3)}`;
|
||||
return `${numbers.slice(0, 3)}-${numbers.slice(3, 7)}-${numbers.slice(7, 11)}`;
|
||||
};
|
||||
|
||||
// 주민등록번호 자동 하이픈 포맷팅
|
||||
const formatResidentNumber = (value: string): string => {
|
||||
const numbers = value.replace(/[^0-9]/g, '');
|
||||
if (numbers.length <= 6) return numbers;
|
||||
return `${numbers.slice(0, 6)}-${numbers.slice(6, 13)}`;
|
||||
};
|
||||
|
||||
// 입력 변경 핸들러
|
||||
const handleChange = (field: keyof EmployeeFormData, value: unknown) => {
|
||||
setFormData(prev => ({ ...prev, [field]: value }));
|
||||
let formattedValue = value;
|
||||
|
||||
// 자동 하이픈 적용
|
||||
if (field === 'phone' && typeof value === 'string') {
|
||||
formattedValue = formatPhoneNumber(value);
|
||||
} else if (field === 'residentNumber' && typeof value === 'string') {
|
||||
formattedValue = formatResidentNumber(value);
|
||||
}
|
||||
|
||||
setFormData(prev => ({ ...prev, [field]: formattedValue }));
|
||||
// 에러 초기화
|
||||
if (errors[field as keyof ValidationErrors]) {
|
||||
setErrors(prev => ({ ...prev, [field]: undefined }));
|
||||
@@ -233,8 +257,8 @@ export function EmployeeForm({
|
||||
if (mode === 'create') {
|
||||
if (!formData.password) {
|
||||
newErrors.password = '비밀번호를 입력해주세요.';
|
||||
} else if (formData.password.length < 6) {
|
||||
newErrors.password = '비밀번호는 6자 이상이어야 합니다.';
|
||||
} else if (formData.password.length < 8) {
|
||||
newErrors.password = '비밀번호는 8자 이상이어야 합니다.';
|
||||
}
|
||||
|
||||
if (formData.password !== formData.confirmPassword) {
|
||||
@@ -357,8 +381,8 @@ export function EmployeeForm({
|
||||
<form onSubmit={handleSubmit} className="space-y-6">
|
||||
{/* 사원 정보 - 프로필 사진 + 기본 정보 */}
|
||||
<Card>
|
||||
<CardHeader className="bg-black text-white rounded-t-lg">
|
||||
<CardTitle className="text-base font-medium">사원 정보</CardTitle>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-base">사원 정보</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="pt-6">
|
||||
{/* 기본 정보 필드들 */}
|
||||
@@ -455,8 +479,8 @@ export function EmployeeForm({
|
||||
{/* 사원 상세 */}
|
||||
{(fieldSettings.showProfileImage || fieldSettings.showEmployeeCode || fieldSettings.showGender || fieldSettings.showAddress) && (
|
||||
<Card>
|
||||
<CardHeader className="bg-black text-white rounded-t-lg">
|
||||
<CardTitle className="text-base font-medium">사원 상세</CardTitle>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-base">사원 상세</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="pt-6 space-y-4">
|
||||
{/* 프로필 사진 + 사원코드/성별 */}
|
||||
@@ -585,8 +609,8 @@ export function EmployeeForm({
|
||||
{/* 인사 정보 */}
|
||||
{(fieldSettings.showHireDate || fieldSettings.showEmploymentType || fieldSettings.showRank || fieldSettings.showStatus || fieldSettings.showDepartment || fieldSettings.showPosition || fieldSettings.showClockInLocation || fieldSettings.showClockOutLocation || fieldSettings.showResignationDate || fieldSettings.showResignationReason) && (
|
||||
<Card>
|
||||
<CardHeader className="bg-black text-white rounded-t-lg">
|
||||
<CardTitle className="text-base font-medium">인사 정보</CardTitle>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-base">인사 정보</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="pt-6 space-y-4">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
@@ -821,8 +845,8 @@ export function EmployeeForm({
|
||||
|
||||
{/* 사용자 정보 */}
|
||||
<Card>
|
||||
<CardHeader className="bg-black text-white rounded-t-lg">
|
||||
<CardTitle className="text-base font-medium">사용자 정보</CardTitle>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-base">사용자 정보</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="pt-6">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
|
||||
Reference in New Issue
Block a user