[feat] negodata: 소유권 게이팅 + 견적 낙찰 + 작성자명 표시 + 전화입력 + 카드 엑셀
- 소유권 게이팅(common/authz): 변경 액션 본인∪OWNER, 협력사 삭제 OWNER 전용 - 견적 수동 낙찰(award) + 작성자명(creatorName) 표시 + 전화번호 입력 컴포넌트 + 카드 엑셀 업로드 - supplier_type 은 이번 커밋 미변경(다음 커밋에서 코드부터 정리 예정) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
c32ee300e6
commit
c62b66e35b
56 files changed
+1900
-188
No files matched your search
@@ -0,0 +1,34 @@
|
||||
// 국내 전화번호 표시/저장 헬퍼.
|
||||
// - 저장(폼 상태·DB)은 숫자만(normalizePhone): 검색·중복체크·정합성 위해 정규화.
|
||||
// - 화면 표시는 앞자리 규칙대로 하이픈 삽입(formatPhoneKR).
|
||||
|
||||
// 숫자만 뽑아 최대 11자리로 자른다. 폼 값·DB 저장은 이 결과를 쓴다.
|
||||
export function normalizePhone(value: string): string {
|
||||
return value.replace(/\D/g, '').slice(0, 11);
|
||||
}
|
||||
|
||||
// 앞자리로 국번 자리수를 분기해 하이픈을 넣는다. 입력이 하이픈 포함이어도(레거시) 먼저 정규화.
|
||||
export function formatPhoneKR(value: string): string {
|
||||
const d = normalizePhone(value);
|
||||
if (!d) return '';
|
||||
|
||||
// 대표번호 15xx/16xx/18xx: 4-4 (8자리)
|
||||
if (d.startsWith('1')) {
|
||||
if (d.length <= 4) return d;
|
||||
return `${d.slice(0, 4)}-${d.slice(4, 8)}`;
|
||||
}
|
||||
|
||||
// 서울 02: 2-3-4(9자리) 또는 2-4-4(10자리)
|
||||
if (d.startsWith('02')) {
|
||||
if (d.length <= 2) return d;
|
||||
if (d.length <= 5) return `${d.slice(0, 2)}-${d.slice(2)}`;
|
||||
if (d.length <= 9) return `${d.slice(0, 2)}-${d.slice(2, 5)}-${d.slice(5)}`;
|
||||
return `${d.slice(0, 2)}-${d.slice(2, 6)}-${d.slice(6, 10)}`;
|
||||
}
|
||||
|
||||
// 휴대폰 010·지역번호 031 등 3자리 국번: 3-3-4(10자리) 또는 3-4-4(11자리)
|
||||
if (d.length <= 3) return d;
|
||||
if (d.length <= 7) return `${d.slice(0, 3)}-${d.slice(3)}`;
|
||||
if (d.length <= 10) return `${d.slice(0, 3)}-${d.slice(3, 6)}-${d.slice(6)}`;
|
||||
return `${d.slice(0, 3)}-${d.slice(3, 7)}-${d.slice(7, 11)}`;
|
||||
}
|
||||
Reference in new issue
Block a user