'use client'; /** * 작업 카드 컴포넌트 * * 기획 화면에 맞춘 레이아웃: * - 헤더 박스: 품목명 + 수량 * - 뱃지 영역: 순위/긴급/상태(좌측), 납기(우측) * - 공정 + 작업번호 * - 업체/현장 * - 담당자 * - 지시 박스 (회색 배경) * - 전량완료 버튼 (검은색, 전체너비) * - 4버튼 2x2 그리드 */ import { useState } from 'react'; import { ChevronDown } from 'lucide-react'; import { Card, CardContent } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { getPresetStyle } from '@/lib/utils/status-config'; import { Button } from '@/components/ui/button'; import type { WorkOrder } from '../ProductionDashboard/types'; import { STATUS_LABELS } from '../ProductionDashboard/types'; import { ProcessDetailSection } from './ProcessDetailSection'; interface WorkCardProps { order: WorkOrder; onComplete: (order: WorkOrder) => void; onProcessDetail: (order: WorkOrder) => void; onMaterialInput: (order: WorkOrder) => void; onWorkLog: (order: WorkOrder) => void; onIssueReport: (order: WorkOrder) => void; } export function WorkCard({ order, onComplete, onProcessDetail, onMaterialInput, onWorkLog, onIssueReport, }: WorkCardProps) { const [isExpanded, setIsExpanded] = useState(false); // 납기일 포맷 (YYYY-MM-DD) const formatDueDate = (dateStr: string) => { const date = new Date(dateStr); const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0'); return `${year}-${month}-${day}`; }; return ( {/* 헤더 박스: 품목명 + 수량 */}

{order.productCode !== '-' ? order.productCode : order.productName}

{order.quantity} EA
{/* 본문 영역 */}
{/* 뱃지 영역: 순위/긴급/상태(좌측), 납기(우측) */}
{/* 순위 뱃지 */} {order.priority <= 3 && ( {order.priority}순위 )} {/* 긴급 뱃지 */} {order.isUrgent && ( 긴급 )} {/* 상태 뱃지 */} {STATUS_LABELS[order.status]}
{/* 납기 */}

납기

{formatDueDate(order.dueDate)}

{/* 공정 뱃지 + 작업번호 */}
{order.processName} {order.orderNo}
{/* 업체/현장 */}

{order.client} · {order.projectName}

{/* 담당자 */} {order.assignees && order.assignees.length > 0 && (

담당: {order.assignees.join(', ')}

)} {/* 지시 박스 (회색 배경) */} {order.instruction && (

지시: {order.instruction}

)} {/* 전량완료 버튼 - 검은색, 전체 너비 */} {/* 4버튼 2x2 그리드 */}
{/* 공정상세 섹션 (토글) */} onMaterialInput(order)} />
); }