diff --git a/docs/coding-rules/presets/erp-preset-type-b-master-detail.html b/docs/coding-rules/presets/erp-preset-type-b-master-detail.html index 9ca91da2..74af9e66 100644 --- a/docs/coding-rules/presets/erp-preset-type-b-master-detail.html +++ b/docs/coding-rules/presets/erp-preset-type-b-master-detail.html @@ -95,21 +95,19 @@ html, body { height: 100%; overflow: hidden; font-size: 13px; } ═══════════════════════════════════════════ */ .main-content { display: flex; flex: 1; overflow: hidden; - background: hsl(var(--background)); } /* Master Panel (Left) */ .panel-master { display: flex; flex-direction: column; min-width: 250px; overflow: hidden; - background: hsl(var(--muted)); - border-right: none; + background: hsl(var(--background)); } .panel-header { display: flex; align-items: center; justify-content: space-between; - padding: 12px 16px; + padding: 10px 16px; height: 44px; min-height: 44px; border-bottom: 1px solid hsl(var(--border)); - background: hsl(var(--muted)); + background: hsl(var(--card)); } .panel-header-left { display: flex; align-items: center; gap: 10px; } .panel-title { font-size: 13px; font-weight: 700; color: hsl(var(--foreground)); } @@ -121,26 +119,19 @@ html, body { height: 100%; overflow: hidden; font-size: 13px; } /* Resize Handle */ .resize-handle { - width: 6px; min-width: 6px; cursor: col-resize; - background: hsl(var(--border)); transition: background 0.15s; - position: relative; z-index: 10; + width: 5px; min-width: 5px; cursor: col-resize; + background: hsl(var(--border) / 0.6); transition: all 0.15s; + position: relative; z-index: 10; flex-shrink: 0; } .resize-handle:hover, .resize-handle.active { - background: hsl(var(--primary)); + background: hsl(var(--primary) / 0.5); } -.resize-handle::after { - content: ''; position: absolute; top: 50%; left: 50%; - transform: translate(-50%, -50%); - width: 2px; height: 30px; border-radius: 2px; - background: hsl(var(--muted-foreground) / 0.5); opacity: 0; transition: opacity 0.15s; -} -.resize-handle:hover::after, .resize-handle.active::after { opacity: 1; } /* Detail Panel (Right) */ .panel-detail { display: flex; flex-direction: column; min-width: 250px; flex: 1; overflow: hidden; - background: hsl(var(--muted)); + background: hsl(var(--background)); } /* ═══════════════════════════════════════════ @@ -148,6 +139,7 @@ html, body { height: 100%; overflow: hidden; font-size: 13px; } ═══════════════════════════════════════════ */ .table-wrapper { flex: 1; overflow: auto; position: relative; + background: hsl(var(--background)); } table { width: 100%; border-collapse: collapse; table-layout: fixed; @@ -156,22 +148,22 @@ thead { position: sticky; top: 0; z-index: 5; } thead th { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: hsl(var(--muted-foreground)); - padding: 10px 12px; text-align: left; - background: hsl(var(--card)); border-bottom: 1px solid hsl(var(--border)); + padding: 9px 12px; text-align: left; + background: hsl(var(--muted)); border-bottom: 1px solid hsl(var(--border)); white-space: nowrap; user-select: none; } tbody tr { - border-bottom: 1px solid hsl(var(--border)); + border-bottom: 1px solid hsl(var(--border) / 0.5); cursor: pointer; transition: all 0.1s; border-left: 3px solid transparent; } -tbody tr:hover { background: hsl(var(--accent)); } +tbody tr:hover { background: hsl(var(--accent) / 0.5); } tbody tr.selected { - background: hsl(var(--primary) / 0.08); + background: hsl(var(--primary) / 0.06); border-left: 3px solid hsl(var(--primary)); } tbody td { - padding: 9px 12px; color: hsl(var(--muted-foreground)); + padding: 8px 12px; color: hsl(var(--muted-foreground)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } tbody tr.selected td { color: hsl(var(--foreground)); } @@ -201,8 +193,8 @@ tbody tr.selected .cell-mono { color: hsl(var(--primary)); } .empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; padding: 40px; - border: 2px dashed hsl(var(--border)); border-radius: var(--radius); - margin: 20px; text-align: center; + border: 2px dashed hsl(var(--border) / 0.6); border-radius: var(--radius); + margin: 16px; text-align: center; } .empty-state-icon { width: 48px; height: 48px; color: hsl(var(--muted-foreground) / 0.5); margin-bottom: 16px; @@ -215,17 +207,18 @@ tbody tr.selected .cell-mono { color: hsl(var(--primary)); } ═══════════════════════════════════════════ */ .tabs { display: flex; border-bottom: 1px solid hsl(var(--border)); - background: hsl(var(--muted)); padding: 0 16px; + background: hsl(var(--card)); padding: 0 16px; + min-height: 38px; } .tab { display: flex; align-items: center; gap: 6px; - padding: 10px 16px; font-size: 12px; font-weight: 600; + padding: 9px 16px; font-size: 12px; font-weight: 600; color: hsl(var(--muted-foreground)); cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.15s; user-select: none; white-space: nowrap; } -.tab:hover { color: hsl(var(--muted-foreground)); } +.tab:hover { color: hsl(var(--foreground)); } .tab.active { color: hsl(var(--foreground)); border-bottom-color: hsl(var(--primary)); } @@ -236,7 +229,9 @@ tbody tr.selected .cell-mono { color: hsl(var(--primary)); } /* Detail Sub-Header */ .detail-sub-header { display: flex; align-items: center; justify-content: space-between; - padding: 10px 16px; border-bottom: 1px solid hsl(var(--border)); + padding: 8px 16px; border-bottom: 1px solid hsl(var(--border)); + background: hsl(var(--card)); + min-height: 38px; } .detail-sub-title { font-size: 12px; font-weight: 600; color: hsl(var(--muted-foreground)); } .detail-sub-actions { display: flex; gap: 6px; } diff --git a/docs/customer-management-tables.md b/docs/customer-management-tables.md new file mode 100644 index 00000000..68e1d7de --- /dev/null +++ b/docs/customer-management-tables.md @@ -0,0 +1,205 @@ +# 거래처관리 테이블 구조 + +## 개요 + +거래처관리 화면(`COMPANY_16/sales/customer`)에서 사용하는 테이블 목록. +모든 테이블은 FK 제약 없이 **값 기반 참조**로 연결됨. + +--- + +## 1. customer_mng (거래처 마스터) + +> 거래처 기본 정보. 메인 테이블. + +| 컬럼명 | 타입 | NULL | 기본값 | 설명 | +|---|---|---|---|---| +| `id` | integer | NO | auto increment | PK | +| `customer_code` | varchar | YES | | 거래처 코드 (채번: `CUST-XXX`) | +| `customer_name` | varchar | YES | | 거래처명 | +| `division` | varchar | YES | | 거래 유형 (카테고리) | +| `contact_person` | varchar | YES | | 담당자명 (레거시, `customer_contact`로 대체) | +| `contact_phone` | varchar | YES | | 전화번호 (레거시) | +| `email` | varchar | YES | | 이메일 (레거시) | +| `business_number` | varchar | YES | | 사업자번호 | +| `address` | text | YES | | 주소 | +| `status` | varchar | YES | | 상태 (카테고리: 활성/비활성) | +| `delivery_location` | varchar | YES | | 납품장소 (레거시, `delivery_destination`으로 대체) | +| `internal_manager` | varchar | YES | | 사내담당자 (user_info.user_id 참조) | +| `company_code` | varchar | YES | | 회사 코드 | +| `writer` | varchar | YES | | 작성자 | +| `created_date` | timestamptz | YES | | 생성일 | +| `updated_date` | timestamptz | YES | | 수정일 | + +**채번 규칙**: `rule-1773627245664-rw6ny43cf` (거래처코드, `customer_code` 컬럼) + +--- + +## 2. customer_contact (거래처 담당자) + +> 거래처별 복수 담당자 관리. `customer_id`(customer_mng.id)로 연결. + +| 컬럼명 | 타입 | NULL | 기본값 | 설명 | +|---|---|---|---|---| +| `id` | varchar | NO | | PK (UUID) | +| `customer_id` | varchar | YES | | customer_mng.id 참조 | +| `contact_name` | varchar | YES | | 담당자명 | +| `contact_phone` | varchar | YES | | 연락처 | +| `contact_email` | varchar | YES | | 이메일 | +| `department` | varchar | YES | | 부서 | +| `is_main` | varchar | YES | `'N'` | 메인 담당자 여부 (`Y`/`N`, 복수 가능) | +| `memo` | varchar | YES | | 메모 | +| `company_code` | varchar | YES | | 회사 코드 | +| `writer` | varchar | YES | | 작성자 | +| `created_date` | timestamp | YES | `now()` | 생성일 | +| `updated_date` | timestamp | YES | `now()` | 수정일 | + +**참조 방식**: `customer_id` = `customer_mng.id` (값 기반, FK 없음) +**메인 목록 표시**: `is_main = 'Y'`인 담당자의 이름/전화/이메일이 거래처 목록에 표시됨 + +--- + +## 3. customer_tax_type (거래처 세금유형) + +> 거래처별 세금유형 다중 설정. `customer_id`(customer_mng.id)로 연결. + +| 컬럼명 | 타입 | NULL | 기본값 | 설명 | +|---|---|---|---|---| +| `id` | varchar | NO | | PK (UUID) | +| `customer_id` | varchar | YES | | customer_mng.id 참조 | +| `tax_type_id` | varchar | YES | | 세금유형 코드 | +| `tax_type_name` | varchar | YES | | 세금유형명 (카테고리) | +| `rate` | numeric | YES | `0` | 세율 (%) | +| `company_code` | varchar | YES | | 회사 코드 | +| `writer` | varchar | YES | | 작성자 | +| `created_date` | timestamp | YES | `now()` | 생성일 | +| `updated_date` | timestamp | YES | `now()` | 수정일 | + +**카테고리**: `customer_tax_type.tax_type_name` → 부가세(일반), 부가세(영세), 면세, 기타 + +--- + +## 4. delivery_destination (납품처) + +> 거래처별 납품처 관리. `customer_code`(customer_mng.customer_code)로 연결. + +| 컬럼명 | 타입 | NULL | 기본값 | 설명 | +|---|---|---|---|---| +| `id` | varchar | NO | | PK (UUID) | +| `customer_code` | varchar | YES | | customer_mng.customer_code 참조 | +| `destination_code` | varchar | YES | | 납품처 코드 (채번: `DEST-XXX`) | +| `destination_name` | varchar | YES | | 납품처명 | +| `address` | varchar | YES | | 주소 | +| `manager_name` | varchar | YES | | 담당자명 | +| `phone` | varchar | YES | | 전화번호 | +| `memo` | varchar | YES | | 메모 | +| `is_default` | varchar | YES | | 메인 납품처 여부 (`Y`/`N`, 복수 가능) | +| `company_code` | varchar | YES | | 회사 코드 | +| `writer` | varchar | YES | | 작성자 | +| `created_date` | timestamp | YES | | 생성일 | +| `updated_date` | timestamp | YES | | 수정일 | + +**채번 규칙**: `rule-1773627245668-7ad2ka353` (납품처코드, `destination_code` 컬럼) +**참조 방식**: `customer_code` = `customer_mng.customer_code` (값 기반, FK 없음) + +--- + +## 5. customer_item_mapping (거래처-품목 매핑) + +> 거래처별 품목 매핑 + 거래처 품번/품명 관리. `customer_id`(customer_mng.customer_code)로 연결. + +| 컬럼명 | 타입 | NULL | 기본값 | 설명 | +|---|---|---|---|---| +| `id` | varchar | NO | | PK (UUID) | +| `customer_id` | varchar | YES | | customer_mng.customer_code 참조 | +| `item_id` | varchar | YES | | item_info.item_number 참조 | +| `customer_item_code` | varchar | YES | | 거래처 품번 | +| `customer_item_name` | varchar | YES | | 거래처 품명 | +| `currency_code` | varchar | YES | | 통화 (카테고리) | +| `current_unit_price` | varchar | YES | | 현재 단가 | +| `discount_type` | varchar | YES | | 할인유형 (카테고리) | +| `discount_value` | numeric | YES | | 할인값 | +| `base_price` | numeric | YES | | 기준가 | +| `calculated_price` | numeric | YES | | 계산 단가 | +| `rounding_type` | varchar | YES | | 반올림 유형 | +| `rounding_unit_value` | varchar | YES | | 반올림 단위 (카테고리) | +| `start_date` | date | YES | | 적용 시작일 | +| `end_date` | date | YES | | 적용 종료일 | +| `status` | varchar | YES | | 상태 | +| `is_active` | varchar | YES | | 활성 여부 | +| `company_code` | varchar | YES | | 회사 코드 | +| `writer` | varchar | YES | | 작성자 | +| `created_date` | timestamp | YES | | 생성일 | +| `updated_date` | timestamp | YES | | 수정일 | + +--- + +## 6. customer_item_prices (거래처 품목 단가) + +> 거래처별 품목 기간별 단가 관리. `customer_id` + `item_id`로 연결. + +| 컬럼명 | 타입 | NULL | 기본값 | 설명 | +|---|---|---|---|---| +| `id` | varchar | NO | | PK (UUID) | +| `mapping_id` | varchar | YES | | customer_item_mapping.id 참조 | +| `customer_id` | varchar | YES | | customer_mng.customer_code 참조 | +| `item_id` | varchar | YES | | item_info.item_number 참조 | +| `start_date` | date | YES | | 적용 시작일 | +| `end_date` | date | YES | | 적용 종료일 | +| `unit_price` | numeric | YES | | 최종 단가 | +| `currency_code` | varchar | YES | | 통화 (카테고리) | +| `base_price_type` | varchar | YES | | 기준유형 (카테고리) | +| `base_price` | numeric | YES | | 기준가 | +| `discount_type` | varchar | YES | | 할인유형 (카테고리) | +| `discount_value` | numeric | YES | | 할인값 | +| `rounding_type` | varchar | YES | | 반올림 유형 | +| `rounding_unit_value` | varchar | YES | | 반올림 단위 (카테고리) | +| `calculated_price` | numeric | YES | | 계산 단가 | +| `supply_price` | numeric | YES | | 공급가 | +| `vat_included_price` | numeric | YES | | 부가세 포함가 | +| `remarks` | varchar | YES | | 비고 | +| `company_code` | varchar | YES | | 회사 코드 | +| `writer` | varchar | YES | | 작성자 | +| `created_date` | timestamp | YES | | 생성일 | +| `updated_date` | timestamp | YES | | 수정일 | + +--- + +## 테이블 관계도 + +``` +customer_mng (마스터) + ├── customer_contact (customer_id = customer_mng.id) + ├── customer_tax_type (customer_id = customer_mng.id) + ├── delivery_destination (customer_code = customer_mng.customer_code) + ├── customer_item_mapping (customer_id = customer_mng.customer_code) + │ └── customer_item_prices (mapping_id = customer_item_mapping.id) + └── customer_item_prices (customer_id = customer_mng.customer_code) +``` + +> **주의**: `customer_contact`, `customer_tax_type`은 `customer_mng.id`(정수)로 연결되고, +> `delivery_destination`, `customer_item_mapping`, `customer_item_prices`는 `customer_mng.customer_code`(문자열)로 연결됨. + +--- + +## 카테고리 설정 + +| 테이블 | 컬럼 | 값 (COMPANY_16) | +|---|---|---| +| `customer_mng` | `division` | 국내사업부, 해외사업부, 온라인사업부 | +| `customer_mng` | `status` | 활성, 비활성 | +| `customer_tax_type` | `tax_type_name` | 부가세(일반), 부가세(영세), 면세, 기타 | +| `customer_item_prices` | `base_price_type` | 품목기준, 최종기준 등 | +| `customer_item_prices` | `currency_code` | KRW, USD 등 | +| `customer_item_prices` | `discount_type` | 할인금액, 할인율 등 | +| `customer_item_prices` | `rounding_unit_value` | 절삭, 반올림, 올림 등 | + +--- + +## 채번 규칙 + +| 대상 | rule_id | 패턴 | +|---|---|---| +| 거래처코드 | `rule-1773627245664-rw6ny43cf` | `CUST-XXX` | +| 납품처코드 | `rule-1773627245668-7ad2ka353` | `DEST-XXX` | + +채번 방식: DB max값 + 로컬 리스트 max값 중 큰 값 + 1 diff --git a/frontend/app/(main)/COMPANY_16/design/change-management/page.tsx b/frontend/app/(main)/COMPANY_16/design/change-management/page.tsx index 00fedd3f..39f06769 100644 --- a/frontend/app/(main)/COMPANY_16/design/change-management/page.tsx +++ b/frontend/app/(main)/COMPANY_16/design/change-management/page.tsx @@ -57,6 +57,7 @@ import { import { useTableSettings } from "@/hooks/useTableSettings"; import { TableSettingsModal } from "@/components/common/TableSettingsModal"; import { DynamicSearchFilter, FilterValue } from "@/components/common/DynamicSearchFilter"; +import { EDataTable, EDataTableColumn } from "@/components/common/EDataTable"; // --- Types --- type ChangeType = "설계오류" | "원가절감" | "고객요청" | "공정개선" | "법규대응"; @@ -866,185 +867,52 @@ export default function DesignChangeManagementPage() {
등록된 설비가 없어요
-