ERP-node/frontend/lib/registry/components/v2-timeline-scheduler/config.ts

161 lines
4.2 KiB
TypeScript

"use client";
import { TimelineSchedulerConfig, ZoomLevel, ScheduleType, ToolbarAction } from "./types";
/**
* 기본 타임라인 스케줄러 설정
* - 기본적으로 schedule_mng 테이블 사용 (공통 스케줄 테이블)
* - 필드 매핑은 schedule_mng 컬럼에 맞춤
*/
export const defaultTimelineSchedulerConfig: Partial<TimelineSchedulerConfig> = {
// schedule_mng 테이블 기본 사용
useCustomTable: false,
scheduleType: "PRODUCTION", // 기본: 생산계획
// 표시 설정
defaultZoomLevel: "day",
editable: true,
draggable: true,
resizable: true,
rowHeight: 50,
headerHeight: 60,
resourceColumnWidth: 150,
cellWidth: {
day: 60,
week: 120,
month: 40,
},
showConflicts: true,
showProgress: true,
showTodayLine: true,
showToolbar: true,
showZoomControls: true,
showNavigation: true,
showAddButton: true,
height: 500,
// 상태별 색상
statusColors: {
planned: "#3b82f6", // blue-500
in_progress: "#f59e0b", // amber-500
completed: "#10b981", // emerald-500
delayed: "#ef4444", // red-500
cancelled: "#6b7280", // gray-500
},
// schedule_mng 테이블 필드 매핑
fieldMapping: {
id: "schedule_id",
resourceId: "resource_id",
title: "schedule_name",
startDate: "start_date",
endDate: "end_date",
status: "status",
},
// 리소스 필드 매핑 (equipment_mng 기준)
resourceFieldMapping: {
id: "equipment_code",
name: "equipment_name",
group: "equipment_type",
},
// 기본 리소스 테이블
resourceTable: "equipment_mng",
};
/**
* 줌 레벨 옵션
*/
export const zoomLevelOptions: { value: ZoomLevel; label: string }[] = [
{ value: "day", label: "일" },
{ value: "week", label: "주" },
{ value: "month", label: "월" },
];
/**
* 상태 옵션
*/
export const statusOptions = [
{ value: "planned", label: "계획됨", color: "#3b82f6" },
{ value: "in_progress", label: "진행중", color: "#f59e0b" },
{ value: "completed", label: "완료", color: "#10b981" },
{ value: "delayed", label: "지연", color: "#ef4444" },
{ value: "cancelled", label: "취소", color: "#6b7280" },
];
/**
* 스케줄 타입 옵션
*/
export const scheduleTypeOptions: { value: ScheduleType; label: string }[] = [
{ value: "PRODUCTION", label: "생산계획" },
{ value: "MAINTENANCE", label: "정비계획" },
{ value: "SHIPPING", label: "배차계획" },
{ value: "WORK_ASSIGN", label: "작업배정" },
];
/**
* 뷰 모드 옵션
*/
export const viewModeOptions: { value: string; label: string; description: string }[] = [
{ value: "resource", label: "리소스 기반", description: "설비/작업자 행 기반 간트차트" },
{ value: "itemGrouped", label: "품목별 그룹", description: "품목별 카드형 타임라인" },
];
/**
* 데이터 소스 옵션
*/
export const dataSourceOptions: { value: string; label: string; description: string }[] = [
{ value: "linkedSelection", label: "연결 필터 선택값", description: "좌측 테이블에서 선택된 행 데이터 사용" },
{ value: "currentSchedules", label: "현재 스케줄", description: "타임라인에 표시 중인 스케줄 ID 사용" },
];
/**
* 아이콘 옵션
*/
export const toolbarIconOptions: { value: string; label: string }[] = [
{ value: "Zap", label: "Zap (번개)" },
{ value: "Package", label: "Package (박스)" },
{ value: "Plus", label: "Plus (추가)" },
{ value: "Download", label: "Download (다운로드)" },
{ value: "Upload", label: "Upload (업로드)" },
{ value: "RefreshCw", label: "RefreshCw (새로고침)" },
{ value: "Play", label: "Play (재생)" },
{ value: "FileText", label: "FileText (문서)" },
{ value: "Send", label: "Send (전송)" },
{ value: "Sparkles", label: "Sparkles (반짝)" },
{ value: "Wand2", label: "Wand2 (마법봉)" },
];
/**
* 줌 레벨별 표시 일수
*/
export const zoomLevelDays: Record<ZoomLevel, number> = {
day: 14, // 2주
week: 56, // 8주
month: 90, // 3개월
};
/**
* 요일 라벨 (한글)
*/
export const dayLabels = ["일", "월", "화", "수", "목", "금", "토"];
/**
* 월 라벨 (한글)
*/
export const monthLabels = [
"1월",
"2월",
"3월",
"4월",
"5월",
"6월",
"7월",
"8월",
"9월",
"10월",
"11월",
"12월",
];