Files
sam-react-prod/src/components/process-management/ProcessWorkLogContent.tsx

136 lines
6.2 KiB
TypeScript
Raw Normal View History

'use client';
/**
*
*
* :
* - DocumentHeader: default + 4col
* - SectionHeader: 섹션
*/
import type { Process } from '@/types/process';
import { DocumentHeader, SectionHeader } from '@/components/document-system';
const getDocumentCode = (processName: string): string => {
if (processName.includes('스크린')) return 'WL-SCR';
if (processName.includes('슬랫')) return 'WL-SLT';
if (processName.includes('절곡') || processName.includes('포밍')) return 'WL-BEN';
return 'WL-STK';
};
const getDepartmentName = (processName: string, department?: string): string => {
if (processName.includes('스크린')) return '스크린 생산부서';
if (processName.includes('슬랫')) return '슬랫 생산부서';
if (processName.includes('절곡')) return '절곡 생산부서';
if (processName.includes('포밍')) return '포밍 생산부서';
return department || '생산부서';
};
interface ProcessWorkLogContentProps {
data: Process;
}
export function ProcessWorkLogContent({ data: process }: ProcessWorkLogContentProps) {
const documentCode = getDocumentCode(process.processName);
const departmentName = getDepartmentName(process.processName, process.department);
const today = new Date().toLocaleDateString('ko-KR', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
}).replace(/\. /g, '-').replace('.', '');
const workItems = [
{ no: 1, name: '원단 재단', spec: 'W2900 × H3900', qty: 9, unit: 'EA', worker: '이작업', note: '' },
{ no: 2, name: '미싱 작업', spec: 'W2800 × H3800', qty: 8, unit: 'EA', worker: '김작업', note: '' },
{ no: 3, name: '앤드락 조립', spec: 'W2700 × H3700', qty: 7, unit: 'EA', worker: '이작업', note: '' },
{ no: 4, name: '검수', spec: 'W2600 × H3600', qty: 6, unit: 'EA', worker: '김작업', note: '' },
{ no: 5, name: '포장', spec: 'W2500 × H3500', qty: 5, unit: 'EA', worker: '이작업', note: '' },
];
return (
<div className="p-6 bg-white">
{/* 문서 헤더 (공통 컴포넌트) */}
<DocumentHeader
title="작 업 일 지"
documentCode={documentCode}
subtitle={departmentName}
logo={{ text: 'KD', subtext: '정동기업' }}
approval={{
type: '4col',
writer: { name: '홍길동', date: '12/17' },
showDepartment: true,
departmentLabels: {
writer: '판매/전진',
reviewer: '생산',
approver: '품질',
},
}}
/>
{/* 신청업체 / 신청내용 테이블 */}
<table className="w-full border-collapse border border-gray-300 mb-6 text-sm">
<thead>
<tr>
<th colSpan={2} className="bg-gray-800 text-white p-2.5 font-medium border-r border-gray-300"> </th>
<th colSpan={2} className="bg-gray-800 text-white p-2.5 font-medium"> </th>
</tr>
</thead>
<tbody>
<tr className="border-b border-gray-300">
<td className="w-24 bg-gray-100 p-3 font-medium border-r border-gray-300"> </td>
<td className="p-3 border-r border-gray-300">{today}</td>
<td className="w-24 bg-gray-100 p-3 font-medium border-r border-gray-300"> </td>
<td className="p-3"> A동</td>
</tr>
<tr className="border-b border-gray-300">
<td className="bg-gray-100 p-3 font-medium border-r border-gray-300"> </td>
<td className="p-3 border-r border-gray-300">()</td>
<td className="bg-gray-100 p-3 font-medium border-r border-gray-300"></td>
<td className="p-3">{today}</td>
</tr>
<tr className="border-b border-gray-300">
<td className="bg-gray-100 p-3 font-medium border-r border-gray-300"> </td>
<td className="p-3 border-r border-gray-300"></td>
<td className="bg-gray-100 p-3 font-medium border-r border-gray-300"> LOT NO.</td>
<td className="p-3">KD-TS-251217-01-01</td>
</tr>
<tr>
<td className="bg-gray-100 p-3 font-medium border-r border-gray-300"></td>
<td className="p-3 border-r border-gray-300">SH3040 &nbsp; W3000×H4000</td>
<td className="bg-gray-100 p-3 font-medium border-r border-gray-300"></td>
<td className="p-3"> &nbsp; </td>
</tr>
</tbody>
</table>
{/* 작업항목 테이블 */}
<table className="w-full border-collapse border border-gray-300 text-sm">
<thead>
<tr className="bg-gray-800 text-white">
<th className="p-2.5 font-medium border-r border-gray-600 w-16"></th>
<th className="p-2.5 font-medium border-r border-gray-600"></th>
<th className="p-2.5 font-medium border-r border-gray-600 w-40"></th>
<th className="p-2.5 font-medium border-r border-gray-600 w-20"></th>
<th className="p-2.5 font-medium border-r border-gray-600 w-16"></th>
<th className="p-2.5 font-medium border-r border-gray-600 w-20"></th>
<th className="p-2.5 font-medium w-24"></th>
</tr>
</thead>
<tbody>
{workItems.map((item, index) => (
<tr key={item.no} className={index < workItems.length - 1 ? 'border-b border-gray-300' : ''}>
<td className="p-3 text-center border-r border-gray-300">{item.no}</td>
<td className="p-3 border-r border-gray-300">{item.name}</td>
<td className="p-3 text-center border-r border-gray-300">{item.spec}</td>
<td className="p-3 text-center border-r border-gray-300">{item.qty}</td>
<td className="p-3 text-center border-r border-gray-300">{item.unit}</td>
<td className="p-3 text-center border-r border-gray-300">{item.worker}</td>
<td className="p-3 text-center">{item.note}</td>
</tr>
))}
</tbody>
</table>
</div>
);
}