summaryrefslogtreecommitdiff
path: root/config/basicContractColumnsConfig.ts
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-07-15 00:50:39 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-07-15 00:50:39 +0000
commit15c3ae6536c264db0508e4fc4aaa59c3e6d1af30 (patch)
tree8e2ad5e6a06999bfaaf00ab4ee30083a87050bad /config/basicContractColumnsConfig.ts
parentd5d27847a7eded9db59462fa744b76772bc9ce1d (diff)
(대표님) 기본계약 및 정기평가 작업사항, OCR 변경사항
Diffstat (limited to 'config/basicContractColumnsConfig.ts')
-rw-r--r--config/basicContractColumnsConfig.ts311
1 files changed, 249 insertions, 62 deletions
diff --git a/config/basicContractColumnsConfig.ts b/config/basicContractColumnsConfig.ts
index 08eab26a..f5c4b80e 100644
--- a/config/basicContractColumnsConfig.ts
+++ b/config/basicContractColumnsConfig.ts
@@ -1,8 +1,8 @@
// 기본 계약 관련 컬럼 설정 파일
-
-import { BasicContractTemplate, BasicContractView } from "@/db/schema";
-
-
+import {
+ BasicContractTemplate,
+ BasicContractView
+} from "@/db/schema";
// 컬럼 설정 인터페이스
export interface BasicContractColumnConfig {
@@ -40,9 +40,9 @@ export interface BasicContractTemplateColumnConfig {
type?: 'string' | 'number' | 'date' | 'boolean';
}
-// 기본 계약 컬럼 설정
+// 기본 계약 뷰 컬럼 설정 (업데이트된 뷰 테이블 기준)
export const basicContractColumnsConfig: BasicContractColumnConfig[] = [
-
+ // 벤더 정보 그룹
{
id: "vendorCode",
label: "Vendor Code",
@@ -61,136 +61,279 @@ export const basicContractColumnsConfig: BasicContractColumnConfig[] = [
excelHeader: "업체대표이메일",
group: "벤더 정보",
},
- // 계약 기본 정보 그룹
+
+ // 템플릿 정보 그룹
+ {
+ id: "templateCode",
+ label: "템플릿 코드",
+ excelHeader: "템플릿 코드",
+ group: "템플릿 정보",
+ },
{
id: "templateName",
label: "템플릿 이름",
excelHeader: "템플릿 이름",
- // group: "기본 정보",
+ group: "템플릿 정보",
},
-
+ {
+ id: "templateRevision",
+ label: "리비전",
+ excelHeader: "리비전",
+ group: "템플릿 정보",
+ type: "number",
+ },
+ {
+ id: "validityPeriod",
+ label: "유효기간(개월)",
+ excelHeader: "유효기간(개월)",
+ group: "템플릿 정보",
+ type: "number",
+ },
+ {
+ id: "legalReviewRequired",
+ label: "법무검토 필요",
+ excelHeader: "법무검토 필요",
+ group: "템플릿 정보",
+ type: "boolean",
+ },
+
+ // 계약 상태 정보
{
id: "status",
label: "서명 상태",
excelHeader: "서명 상태",
- // group: "기본 정보",
+ group: "계약 상태",
+ },
+ {
+ id: "templateStatus",
+ label: "템플릿 상태",
+ excelHeader: "템플릿 상태",
+ group: "계약 상태",
},
- // 벤더 정보 그룹
-
-
- // 요청자 정보 그룹
+ // 요청자 정보
{
- id: "userName",
+ id: "requestedByName",
label: "요청자",
excelHeader: "요청자",
- // group: "요청자 정보",
- },
+ group: "요청자 정보",
+ },
// 날짜 정보 그룹
{
id: "createdAt",
- label: "Request Date",
- excelHeader: "Request Date",
+ label: "요청일",
+ excelHeader: "요청일",
+ group: "날짜 정보",
+ type: "date",
+ },
+ {
+ id: "completedAt",
+ label: "서명완료일",
+ excelHeader: "서명완료일",
group: "날짜 정보",
type: "date",
},
{
id: "updatedAt",
- label: "Updated Date",
- excelHeader: "Updated Date",
+ label: "최종수정일",
+ excelHeader: "최종수정일",
group: "날짜 정보",
type: "date",
},
];
-// 기본 계약 템플릿 컬럼 설정
+// 기본 계약 템플릿 컬럼 설정 (업데이트된 스키마 기준)
export const basicContractTemplateColumnsConfig: BasicContractTemplateColumnConfig[] = [
// 템플릿 기본 정보 그룹
{
+ id: "templateCode",
+ label: "템플릿 코드",
+ excelHeader: "템플릿 코드",
+ group: "기본 정보",
+ },
+ {
id: "templateName",
- label: "Template Name",
- excelHeader: "Template Name",
+ label: "템플릿 이름",
+ excelHeader: "템플릿 이름",
group: "기본 정보",
},
{
- id: "validityPeriod",
- label: "서명 유효기간(개월)",
- excelHeader: "서명 유효기간(개월)",
- // group: "기본 정보",
+ id: "revision",
+ label: "리비전",
+ excelHeader: "리비전",
+ group: "기본 정보",
+ type: "number",
},
{
id: "status",
- label: "Status",
- excelHeader: "Status",
+ label: "상태",
+ excelHeader: "상태",
+ group: "기본 정보",
+ },
+ // {
+ // id: "validityPeriod",
+ // label: "유효기간(개월)",
+ // excelHeader: "유효기간(개월)",
+ // group: "기본 정보",
+ // type: "number",
+ // },
+ {
+ id: "legalReviewRequired",
+ label: "법무검토 필요",
+ excelHeader: "법무검토 필요",
group: "기본 정보",
+ type: "boolean",
+ },
+
+ // 적용 범위 그룹
+ {
+ id: "shipBuildingApplicable",
+ label: "조선해양",
+ excelHeader: "조선해양 적용",
+ group: "적용 범위",
+ type: "boolean",
+ },
+ {
+ id: "windApplicable",
+ label: "풍력",
+ excelHeader: "풍력 적용",
+ group: "적용 범위",
+ type: "boolean",
+ },
+ {
+ id: "pcApplicable",
+ label: "PC",
+ excelHeader: "PC 적용",
+ group: "적용 범위",
+ type: "boolean",
+ },
+ {
+ id: "nbApplicable",
+ label: "NB",
+ excelHeader: "NB 적용",
+ group: "적용 범위",
+ type: "boolean",
+ },
+ {
+ id: "rcApplicable",
+ label: "RC",
+ excelHeader: "RC 적용",
+ group: "적용 범위",
+ type: "boolean",
+ },
+ {
+ id: "gyApplicable",
+ label: "GY",
+ excelHeader: "GY 적용",
+ group: "적용 범위",
+ type: "boolean",
+ },
+ {
+ id: "sysApplicable",
+ label: "S&Sys",
+ excelHeader: "S&Sys 적용",
+ group: "적용 범위",
+ type: "boolean",
+ },
+ {
+ id: "infraApplicable",
+ label: "Infra",
+ excelHeader: "Infra 적용",
+ group: "적용 범위",
+ type: "boolean",
},
// 파일 정보 그룹
{
id: "fileName",
- label: "File Name",
- excelHeader: "File Name",
+ label: "파일명",
+ excelHeader: "파일명",
group: "파일 정보",
},
- // 날짜 정보 그룹
+ // 감사 정보 그룹
{
id: "createdAt",
- label: "Created Date",
- excelHeader: "Created Date",
- group: "날짜 정보",
+ label: "생성일",
+ excelHeader: "생성일",
+ group: "감사 정보",
type: "date",
},
{
id: "updatedAt",
- label: "Updated Date",
- excelHeader: "Updated Date",
- group: "날짜 정보",
+ label: "수정일",
+ excelHeader: "수정일",
+ group: "감사 정보",
+ type: "date",
+ },
+ {
+ id: "disposedAt",
+ label: "폐기일",
+ excelHeader: "폐기일",
+ group: "감사 정보",
+ type: "date",
+ },
+ {
+ id: "restoredAt",
+ label: "복구일",
+ excelHeader: "복구일",
+ group: "감사 정보",
type: "date",
},
];
+// 벤더용 계약 뷰 컬럼 설정 (벤더가 보는 화면용)
export const basicContractVendorColumnsConfig: BasicContractColumnConfig[] = [
-
-
- // 계약 기본 정보 그룹
+ // 템플릿 정보
+ {
+ id: "templateCode",
+ label: "템플릿 코드",
+ excelHeader: "템플릿 코드",
+ group: "계약 정보",
+ },
{
id: "templateName",
- label: "템플릿 이름",
- excelHeader: "템플릿 이름",
- // group: "기본 정보",
+ label: "계약 유형",
+ excelHeader: "계약 유형",
+ group: "계약 정보",
+ },
+ {
+ id: "templateRevision",
+ label: "리비전",
+ excelHeader: "리비전",
+ group: "계약 정보",
+ type: "number",
},
{
id: "validityPeriod",
- label: "서명 유효기간(개월)",
- excelHeader: "서명 유효기간(개월)",
- // group: "기본 정보",
+ label: "유효기간(개월)",
+ excelHeader: "유효기간(개월)",
+ group: "계약 정보",
+ type: "number",
},
-
+
+ // 상태 정보
{
id: "status",
label: "서명 상태",
excelHeader: "서명 상태",
- // group: "기본 정보",
+ group: "계약 상태",
},
- // 벤더 정보 그룹
-
-
- // 요청자 정보 그룹
+ // 요청자 정보
{
- id: "userName",
+ id: "requestedByName",
label: "요청자",
excelHeader: "요청자",
- // group: "요청자 정보",
- },
+ group: "요청자 정보",
+ },
- // 날짜 정보 그룹
+ // 날짜 정보
{
id: "createdAt",
- label: "Request Date",
- excelHeader: "Request Date",
+ label: "요청일",
+ excelHeader: "요청일",
group: "날짜 정보",
type: "date",
},
@@ -203,9 +346,53 @@ export const basicContractVendorColumnsConfig: BasicContractColumnConfig[] = [
},
{
id: "updatedAt",
- label: "Updated Date",
- excelHeader: "Updated Date",
+ label: "최종수정일",
+ excelHeader: "최종수정일",
group: "날짜 정보",
type: "date",
},
];
+
+// 적용 범위 상수 및 유틸리티
+export const BUSINESS_UNITS = [
+ { key: 'shipBuildingApplicable', label: '조선해양', shortLabel: '조선' },
+ { key: 'windApplicable', label: '풍력', shortLabel: '풍력' },
+ { key: 'pcApplicable', label: 'PC', shortLabel: 'PC' },
+ { key: 'nbApplicable', label: 'NB', shortLabel: 'NB' },
+ { key: 'rcApplicable', label: 'RC', shortLabel: 'RC' },
+ { key: 'gyApplicable', label: 'GY', shortLabel: 'GY' },
+ { key: 'sysApplicable', label: 'S&Sys', shortLabel: 'S&S' },
+ { key: 'infraApplicable', label: 'Infra', shortLabel: 'Infra' },
+] as const;
+
+// 적용 범위 관련 헬퍼 함수들
+export const scopeHelpers = {
+ // 적용된 사업부 목록을 문자열로 반환
+ getApplicableScopeLabels: (template: BasicContractTemplate): string[] => {
+ return BUSINESS_UNITS
+ .filter(unit => template[unit.key as keyof BasicContractTemplate])
+ .map(unit => unit.shortLabel);
+ },
+
+ // 적용된 사업부 수 반환
+ getApplicableScopeCount: (template: BasicContractTemplate): number => {
+ return BUSINESS_UNITS
+ .filter(unit => template[unit.key as keyof BasicContractTemplate])
+ .length;
+ },
+
+ // 모든 사업부가 적용되었는지 확인
+ isAllScopesApplicable: (template: BasicContractTemplate): boolean => {
+ return BUSINESS_UNITS
+ .every(unit => template[unit.key as keyof BasicContractTemplate]);
+ },
+
+ // 적용 범위 문자열 생성 (UI 표시용)
+ getScopeDisplayText: (template: BasicContractTemplate): string => {
+ const applicable = scopeHelpers.getApplicableScopeLabels(template);
+ if (applicable.length === 0) return '적용 범위 없음';
+ if (applicable.length === BUSINESS_UNITS.length) return '전체 적용';
+ if (applicable.length <= 3) return applicable.join(', ');
+ return `${applicable.slice(0, 2).join(', ')} 외 ${applicable.length - 2}개`;
+ }
+}; \ No newline at end of file