2025-12-26 15:48:08 +09:00
|
|
|
'use client';
|
|
|
|
|
|
2026-01-29 22:56:01 +09:00
|
|
|
/**
|
|
|
|
|
* 공정 상세 페이지 (리디자인)
|
|
|
|
|
*
|
|
|
|
|
* 기획서 스크린샷 1 기준:
|
|
|
|
|
* - 기본 정보: 공정번호, 공정형, 담당부서, 담당자, 생산일자, 상태
|
|
|
|
|
* - 품목 설정 정보: 품목 선택 버튼 + 개수 표시
|
|
|
|
|
* - 단계 테이블: 드래그&드롭 순서변경 + 단계 등록 버튼
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { useState, useEffect, useCallback, useRef } from 'react';
|
2025-12-26 15:48:08 +09:00
|
|
|
import { useRouter } from 'next/navigation';
|
2026-02-25 14:28:49 +09:00
|
|
|
import { ArrowLeft, Edit, GripVertical, Plus, Trash2 } from 'lucide-react';
|
|
|
|
|
import { ReorderButtons } from '@/components/molecules';
|
2025-12-26 15:48:08 +09:00
|
|
|
import { Button } from '@/components/ui/button';
|
|
|
|
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
|
|
|
|
import { Badge } from '@/components/ui/badge';
|
|
|
|
|
import { PageLayout } from '@/components/organisms/PageLayout';
|
2026-01-26 15:07:10 +09:00
|
|
|
import { PageHeader } from '@/components/organisms/PageHeader';
|
2026-02-11 15:09:51 +09:00
|
|
|
import { useMenuStore } from '@/stores/menuStore';
|
feat(WEB): 권한 관리 시스템 구현 및 상세 페이지 권한 통합
- PermissionContext, usePermission 훅, PermissionGuard 컴포넌트 신규 추가
- AccessDenied 접근 거부 페이지 추가
- permissions lib (체커, 매퍼, 타입) 구현
- BadDebtDetail, BoardDetail, LaborDetail, PricingDetail 등 상세 페이지 권한 적용
- ProcessDetail, StepDetail, ItemDetail, PermissionDetail 권한 연동
- RootProvider에 PermissionProvider 통합
- protected layout 권한 체크 추가
- Claude 프로젝트 설정 파일 추가
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 10:17:02 +09:00
|
|
|
import { usePermission } from '@/hooks/usePermission';
|
2026-02-09 17:52:43 +09:00
|
|
|
import { toast } from 'sonner';
|
2026-02-09 21:49:45 +09:00
|
|
|
import { DeleteConfirmDialog } from '@/components/ui/confirm-dialog';
|
|
|
|
|
import { useDeleteDialog } from '@/hooks/useDeleteDialog';
|
|
|
|
|
import { getProcessSteps, reorderProcessSteps, removeProcessItem, deleteProcess } from './actions';
|
2026-01-29 22:56:01 +09:00
|
|
|
import type { Process, ProcessStep } from '@/types/process';
|
2025-12-26 15:48:08 +09:00
|
|
|
|
|
|
|
|
interface ProcessDetailProps {
|
|
|
|
|
process: Process;
|
2026-02-09 21:31:00 +09:00
|
|
|
onProcessUpdate?: (process: Process) => void;
|
2025-12-26 15:48:08 +09:00
|
|
|
}
|
|
|
|
|
|
2026-02-09 21:31:00 +09:00
|
|
|
export function ProcessDetail({ process, onProcessUpdate }: ProcessDetailProps) {
|
2025-12-26 15:48:08 +09:00
|
|
|
const router = useRouter();
|
2026-01-26 15:07:10 +09:00
|
|
|
const sidebarCollapsed = useMenuStore((state) => state.sidebarCollapsed);
|
feat(WEB): 권한 관리 시스템 구현 및 상세 페이지 권한 통합
- PermissionContext, usePermission 훅, PermissionGuard 컴포넌트 신규 추가
- AccessDenied 접근 거부 페이지 추가
- permissions lib (체커, 매퍼, 타입) 구현
- BadDebtDetail, BoardDetail, LaborDetail, PricingDetail 등 상세 페이지 권한 적용
- ProcessDetail, StepDetail, ItemDetail, PermissionDetail 권한 연동
- RootProvider에 PermissionProvider 통합
- protected layout 권한 체크 추가
- Claude 프로젝트 설정 파일 추가
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 10:17:02 +09:00
|
|
|
const { canUpdate } = usePermission();
|
2025-12-26 15:48:08 +09:00
|
|
|
|
2026-02-09 21:49:45 +09:00
|
|
|
// 삭제 다이얼로그
|
|
|
|
|
const deleteDialog = useDeleteDialog({
|
|
|
|
|
onDelete: deleteProcess,
|
|
|
|
|
onSuccess: () => router.push('/ko/master-data/process-management'),
|
|
|
|
|
entityName: '공정',
|
|
|
|
|
});
|
|
|
|
|
|
2026-01-29 22:56:01 +09:00
|
|
|
// 단계 목록 상태
|
|
|
|
|
const [steps, setSteps] = useState<ProcessStep[]>([]);
|
|
|
|
|
const [isStepsLoading, setIsStepsLoading] = useState(true);
|
2025-12-30 17:21:38 +09:00
|
|
|
|
2026-01-29 22:56:01 +09:00
|
|
|
// 드래그 상태
|
|
|
|
|
const [dragIndex, setDragIndex] = useState<number | null>(null);
|
|
|
|
|
const [dragOverIndex, setDragOverIndex] = useState<number | null>(null);
|
2026-02-25 14:28:49 +09:00
|
|
|
const dragNodeRef = useRef<HTMLElement | null>(null);
|
2026-01-29 22:56:01 +09:00
|
|
|
|
2026-02-09 21:31:00 +09:00
|
|
|
// 개별 품목 목록 추출
|
|
|
|
|
const individualItems = process.classificationRules
|
2026-01-29 22:56:01 +09:00
|
|
|
.filter((r) => r.registrationType === 'individual')
|
2026-02-09 21:31:00 +09:00
|
|
|
.flatMap((r) => r.items || []);
|
|
|
|
|
const itemCount = individualItems.length;
|
2025-12-30 17:21:38 +09:00
|
|
|
|
2026-01-29 22:56:01 +09:00
|
|
|
// 단계 목록 로드
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const loadSteps = async () => {
|
|
|
|
|
setIsStepsLoading(true);
|
|
|
|
|
const result = await getProcessSteps(process.id);
|
|
|
|
|
if (result.success && result.data) {
|
|
|
|
|
setSteps(result.data);
|
|
|
|
|
}
|
|
|
|
|
setIsStepsLoading(false);
|
|
|
|
|
};
|
|
|
|
|
loadSteps();
|
|
|
|
|
}, [process.id]);
|
|
|
|
|
|
2026-02-09 21:31:00 +09:00
|
|
|
// 품목 삭제
|
|
|
|
|
const handleRemoveItem = async (itemId: string) => {
|
|
|
|
|
const remainingIds = individualItems
|
|
|
|
|
.filter((item) => item.id !== itemId)
|
|
|
|
|
.map((item) => parseInt(item.id, 10));
|
|
|
|
|
|
|
|
|
|
const result = await removeProcessItem(process.id, remainingIds);
|
|
|
|
|
if (result.success && result.data) {
|
|
|
|
|
toast.success('품목이 제거되었습니다.');
|
|
|
|
|
onProcessUpdate?.(result.data);
|
|
|
|
|
} else {
|
|
|
|
|
toast.error(result.error || '품목 제거에 실패했습니다.');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2026-01-29 22:56:01 +09:00
|
|
|
// 네비게이션
|
2025-12-26 15:48:08 +09:00
|
|
|
const handleEdit = () => {
|
2026-01-25 12:27:43 +09:00
|
|
|
router.push(`/ko/master-data/process-management/${process.id}?mode=edit`);
|
2025-12-26 15:48:08 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleList = () => {
|
|
|
|
|
router.push('/ko/master-data/process-management');
|
|
|
|
|
};
|
|
|
|
|
|
2026-01-29 22:56:01 +09:00
|
|
|
const handleAddStep = () => {
|
feat: 다중 도메인 UI 개선 및 컴포넌트 리팩토링
- 게시판, HR, 설정, 차량관리, 건설, 견적 등 전반적 UI 개선
- FormField, TabChip, Select 등 공통 컴포넌트 개선
- 가격배분 edit 페이지 제거 및 상세 페이지 통합
- 체크리스트, 근태, 급여, 권한 관리 등 폼 개선
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 22:30:06 +09:00
|
|
|
router.push(`/ko/master-data/process-management/${process.id}/steps/new?mode=new`);
|
2025-12-26 15:48:08 +09:00
|
|
|
};
|
|
|
|
|
|
2026-01-29 22:56:01 +09:00
|
|
|
const handleStepClick = (stepId: string) => {
|
feat: 다중 도메인 UI 개선 및 컴포넌트 리팩토링
- 게시판, HR, 설정, 차량관리, 건설, 견적 등 전반적 UI 개선
- FormField, TabChip, Select 등 공통 컴포넌트 개선
- 가격배분 edit 페이지 제거 및 상세 페이지 통합
- 체크리스트, 근태, 급여, 권한 관리 등 폼 개선
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 22:30:06 +09:00
|
|
|
router.push(`/ko/master-data/process-management/${process.id}/steps/${stepId}?mode=view`);
|
2026-01-29 22:56:01 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// ===== 드래그&드롭 (HTML5 네이티브) =====
|
2026-02-25 14:28:49 +09:00
|
|
|
const handleDragStart = useCallback((e: React.DragEvent<HTMLElement>, index: number) => {
|
2026-01-29 22:56:01 +09:00
|
|
|
setDragIndex(index);
|
|
|
|
|
dragNodeRef.current = e.currentTarget;
|
|
|
|
|
e.dataTransfer.effectAllowed = 'move';
|
|
|
|
|
// 약간의 딜레이로 드래그 시작 시 스타일 적용
|
|
|
|
|
requestAnimationFrame(() => {
|
|
|
|
|
if (dragNodeRef.current) {
|
|
|
|
|
dragNodeRef.current.style.opacity = '0.4';
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}, []);
|
|
|
|
|
|
2026-02-25 14:28:49 +09:00
|
|
|
const handleDragOver = useCallback((e: React.DragEvent<HTMLElement>, index: number) => {
|
2026-01-29 22:56:01 +09:00
|
|
|
e.preventDefault();
|
|
|
|
|
e.dataTransfer.dropEffect = 'move';
|
|
|
|
|
setDragOverIndex(index);
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
const handleDragEnd = useCallback(() => {
|
|
|
|
|
if (dragNodeRef.current) {
|
|
|
|
|
dragNodeRef.current.style.opacity = '1';
|
|
|
|
|
}
|
|
|
|
|
setDragIndex(null);
|
|
|
|
|
setDragOverIndex(null);
|
|
|
|
|
dragNodeRef.current = null;
|
|
|
|
|
}, []);
|
|
|
|
|
|
2026-02-25 14:28:49 +09:00
|
|
|
const handleDrop = useCallback((e: React.DragEvent<HTMLElement>, dropIndex: number) => {
|
2026-01-29 22:56:01 +09:00
|
|
|
e.preventDefault();
|
|
|
|
|
if (dragIndex === null || dragIndex === dropIndex) return;
|
|
|
|
|
|
|
|
|
|
setSteps((prev) => {
|
|
|
|
|
const updated = [...prev];
|
|
|
|
|
const [moved] = updated.splice(dragIndex, 1);
|
|
|
|
|
updated.splice(dropIndex, 0, moved);
|
2026-02-04 13:13:08 +09:00
|
|
|
const reordered = updated.map((step, i) => ({ ...step, order: i + 1 }));
|
|
|
|
|
|
|
|
|
|
// API 순서 변경 호출
|
|
|
|
|
reorderProcessSteps(
|
|
|
|
|
process.id,
|
|
|
|
|
reordered.map((s) => ({ id: s.id, order: s.order }))
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return reordered;
|
2026-01-29 22:56:01 +09:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
handleDragEnd();
|
2026-02-04 13:13:08 +09:00
|
|
|
}, [dragIndex, handleDragEnd, process.id]);
|
2026-01-29 22:56:01 +09:00
|
|
|
|
2026-02-25 14:28:49 +09:00
|
|
|
// 화살표 버튼으로 순서 변경
|
|
|
|
|
const handleMoveStep = useCallback((fromIndex: number, toIndex: number) => {
|
|
|
|
|
setSteps((prev) => {
|
|
|
|
|
const updated = [...prev];
|
|
|
|
|
const [moved] = updated.splice(fromIndex, 1);
|
|
|
|
|
updated.splice(toIndex, 0, moved);
|
|
|
|
|
const reordered = updated.map((step, i) => ({ ...step, order: i + 1 }));
|
|
|
|
|
|
|
|
|
|
reorderProcessSteps(
|
|
|
|
|
process.id,
|
|
|
|
|
reordered.map((s) => ({ id: s.id, order: s.order }))
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return reordered;
|
|
|
|
|
});
|
|
|
|
|
}, [process.id]);
|
|
|
|
|
|
2025-12-26 15:48:08 +09:00
|
|
|
return (
|
|
|
|
|
<PageLayout>
|
|
|
|
|
{/* 헤더 */}
|
2026-01-29 22:56:01 +09:00
|
|
|
<PageHeader title="공정 상세" />
|
2025-12-26 15:48:08 +09:00
|
|
|
|
2026-01-26 15:07:10 +09:00
|
|
|
<div className="space-y-6 pb-24">
|
2025-12-26 15:48:08 +09:00
|
|
|
{/* 기본 정보 */}
|
|
|
|
|
<Card>
|
|
|
|
|
<CardHeader className="bg-muted/50">
|
|
|
|
|
<CardTitle className="text-base">기본 정보</CardTitle>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent className="pt-6">
|
feat(WEB): DatePicker 공통화 및 공정관리/작업자화면 대폭 개선
DatePicker 공통화:
- date-picker.tsx 공통 컴포넌트 신규 추가
- 전체 폼 컴포넌트 DatePicker 통일 적용 (50+ 파일)
- DateRangeSelector 개선
공정관리:
- RuleModal 대폭 리팩토링 (-592줄 → 간소화)
- ProcessForm, StepForm 개선
- ProcessDetail 수정, actions 확장
작업자화면:
- WorkerScreen 기능 대폭 확장 (+543줄)
- WorkItemCard 개선
- types 확장
회계/인사/영업/품질:
- BadDebtDetail, BillDetail, DepositDetail, SalesDetail 등 DatePicker 적용
- EmployeeForm, VacationDialog 등 DatePicker 적용
- OrderRegistration, QuoteRegistration DatePicker 적용
- InspectionCreate, InspectionDetail DatePicker 적용
공사관리/CEO대시보드:
- BiddingDetail, ContractDetail, HandoverReport 등 DatePicker 적용
- ScheduleDetailModal, TodayIssueSection 개선
기타:
- WorkOrderCreate/Edit/Detail/List 개선
- ShipmentCreate/Edit, ReceivingDetail 개선
- calendar, calendarEvents 수정
- datepicker 마이그레이션 체크리스트 추가
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 15:48:00 +09:00
|
|
|
{/* Row 1: 공정번호 | 공정명 | 담당부서 | 담당자 */}
|
2026-02-25 14:28:49 +09:00
|
|
|
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4 md:gap-6">
|
2026-01-29 22:56:01 +09:00
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">공정번호</div>
|
2025-12-26 15:48:08 +09:00
|
|
|
<div className="font-medium">{process.processCode}</div>
|
|
|
|
|
</div>
|
2026-01-26 15:07:10 +09:00
|
|
|
<div className="space-y-1">
|
feat(WEB): DatePicker 공통화 및 공정관리/작업자화면 대폭 개선
DatePicker 공통화:
- date-picker.tsx 공통 컴포넌트 신규 추가
- 전체 폼 컴포넌트 DatePicker 통일 적용 (50+ 파일)
- DateRangeSelector 개선
공정관리:
- RuleModal 대폭 리팩토링 (-592줄 → 간소화)
- ProcessForm, StepForm 개선
- ProcessDetail 수정, actions 확장
작업자화면:
- WorkerScreen 기능 대폭 확장 (+543줄)
- WorkItemCard 개선
- types 확장
회계/인사/영업/품질:
- BadDebtDetail, BillDetail, DepositDetail, SalesDetail 등 DatePicker 적용
- EmployeeForm, VacationDialog 등 DatePicker 적용
- OrderRegistration, QuoteRegistration DatePicker 적용
- InspectionCreate, InspectionDetail DatePicker 적용
공사관리/CEO대시보드:
- BiddingDetail, ContractDetail, HandoverReport 등 DatePicker 적용
- ScheduleDetailModal, TodayIssueSection 개선
기타:
- WorkOrderCreate/Edit/Detail/List 개선
- ShipmentCreate/Edit, ReceivingDetail 개선
- calendar, calendarEvents 수정
- datepicker 마이그레이션 체크리스트 추가
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 15:48:00 +09:00
|
|
|
<div className="text-sm text-muted-foreground">공정명</div>
|
|
|
|
|
<div className="font-medium">{process.processName}</div>
|
2025-12-26 15:48:08 +09:00
|
|
|
</div>
|
2026-01-26 15:07:10 +09:00
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">담당부서</div>
|
2026-01-29 22:56:01 +09:00
|
|
|
<div className="font-medium">{process.department || '-'}</div>
|
2025-12-26 15:48:08 +09:00
|
|
|
</div>
|
2026-01-29 22:56:01 +09:00
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">담당자</div>
|
|
|
|
|
<div className="font-medium">{process.manager || '-'}</div>
|
2025-12-26 15:48:08 +09:00
|
|
|
</div>
|
feat(WEB): DatePicker 공통화 및 공정관리/작업자화면 대폭 개선
DatePicker 공통화:
- date-picker.tsx 공통 컴포넌트 신규 추가
- 전체 폼 컴포넌트 DatePicker 통일 적용 (50+ 파일)
- DateRangeSelector 개선
공정관리:
- RuleModal 대폭 리팩토링 (-592줄 → 간소화)
- ProcessForm, StepForm 개선
- ProcessDetail 수정, actions 확장
작업자화면:
- WorkerScreen 기능 대폭 확장 (+543줄)
- WorkItemCard 개선
- types 확장
회계/인사/영업/품질:
- BadDebtDetail, BillDetail, DepositDetail, SalesDetail 등 DatePicker 적용
- EmployeeForm, VacationDialog 등 DatePicker 적용
- OrderRegistration, QuoteRegistration DatePicker 적용
- InspectionCreate, InspectionDetail DatePicker 적용
공사관리/CEO대시보드:
- BiddingDetail, ContractDetail, HandoverReport 등 DatePicker 적용
- ScheduleDetailModal, TodayIssueSection 개선
기타:
- WorkOrderCreate/Edit/Detail/List 개선
- ShipmentCreate/Edit, ReceivingDetail 개선
- calendar, calendarEvents 수정
- datepicker 마이그레이션 체크리스트 추가
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 15:48:00 +09:00
|
|
|
</div>
|
|
|
|
|
{/* Row 2: 구분 | 생산일자 | 상태 */}
|
2026-02-25 14:28:49 +09:00
|
|
|
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4 md:gap-6 mt-4 md:mt-6">
|
feat(WEB): DatePicker 공통화 및 공정관리/작업자화면 대폭 개선
DatePicker 공통화:
- date-picker.tsx 공통 컴포넌트 신규 추가
- 전체 폼 컴포넌트 DatePicker 통일 적용 (50+ 파일)
- DateRangeSelector 개선
공정관리:
- RuleModal 대폭 리팩토링 (-592줄 → 간소화)
- ProcessForm, StepForm 개선
- ProcessDetail 수정, actions 확장
작업자화면:
- WorkerScreen 기능 대폭 확장 (+543줄)
- WorkItemCard 개선
- types 확장
회계/인사/영업/품질:
- BadDebtDetail, BillDetail, DepositDetail, SalesDetail 등 DatePicker 적용
- EmployeeForm, VacationDialog 등 DatePicker 적용
- OrderRegistration, QuoteRegistration DatePicker 적용
- InspectionCreate, InspectionDetail DatePicker 적용
공사관리/CEO대시보드:
- BiddingDetail, ContractDetail, HandoverReport 등 DatePicker 적용
- ScheduleDetailModal, TodayIssueSection 개선
기타:
- WorkOrderCreate/Edit/Detail/List 개선
- ShipmentCreate/Edit, ReceivingDetail 개선
- calendar, calendarEvents 수정
- datepicker 마이그레이션 체크리스트 추가
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 15:48:00 +09:00
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">구분</div>
|
|
|
|
|
<div className="font-medium">{process.processCategory || '없음'}</div>
|
|
|
|
|
</div>
|
2026-01-29 22:56:01 +09:00
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">생산일자</div>
|
|
|
|
|
<div className="font-medium">
|
|
|
|
|
{process.useProductionDate ? '사용' : '미사용'}
|
|
|
|
|
</div>
|
2025-12-26 15:48:08 +09:00
|
|
|
</div>
|
2026-01-29 22:56:01 +09:00
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">상태</div>
|
|
|
|
|
<Badge variant={process.status === '사용중' ? 'default' : 'secondary'}>
|
|
|
|
|
{process.status}
|
|
|
|
|
</Badge>
|
2025-12-26 15:48:08 +09:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-02-11 14:30:46 +09:00
|
|
|
{/* Row 3: 중간검사여부 | 중간검사양식 | 작업일지여부 | 작업일지양식 */}
|
2026-02-25 14:28:49 +09:00
|
|
|
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4 md:gap-6 mt-4 md:mt-6">
|
2026-02-11 14:30:46 +09:00
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">중간검사 여부</div>
|
|
|
|
|
<Badge variant={process.needsInspection ? 'default' : 'secondary'}>
|
|
|
|
|
{process.needsInspection ? '사용' : '미사용'}
|
|
|
|
|
</Badge>
|
|
|
|
|
</div>
|
|
|
|
|
{process.needsInspection && (
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">중간검사 양식</div>
|
|
|
|
|
<div className="font-medium">{process.documentTemplateName || '-'}</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">작업일지 여부</div>
|
|
|
|
|
<Badge variant={process.needsWorkLog ? 'default' : 'secondary'}>
|
|
|
|
|
{process.needsWorkLog ? '사용' : '미사용'}
|
|
|
|
|
</Badge>
|
|
|
|
|
</div>
|
|
|
|
|
{process.needsWorkLog && (
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">작업일지 양식</div>
|
|
|
|
|
<div className="font-medium">{process.workLogTemplateName || '-'}</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
2025-12-26 15:48:08 +09:00
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
|
2026-01-29 22:56:01 +09:00
|
|
|
{/* 품목 설정 정보 */}
|
2025-12-30 17:21:38 +09:00
|
|
|
<Card>
|
2026-02-25 14:28:49 +09:00
|
|
|
<CardHeader className="bg-muted/50 py-3">
|
|
|
|
|
<div className="flex items-center gap-2 flex-wrap">
|
|
|
|
|
<CardTitle className="text-base shrink-0">
|
|
|
|
|
품목 설정 정보
|
|
|
|
|
</CardTitle>
|
|
|
|
|
<Badge variant="outline" className="text-xs">
|
|
|
|
|
{itemCount}개
|
|
|
|
|
</Badge>
|
|
|
|
|
<Button variant="outline" size="sm" onClick={handleEdit} className="shrink-0">
|
|
|
|
|
공정 품목 선택
|
|
|
|
|
</Button>
|
2026-01-29 22:56:01 +09:00
|
|
|
</div>
|
2026-02-25 14:28:49 +09:00
|
|
|
<p className="text-sm text-muted-foreground mt-1">
|
|
|
|
|
품목을 선택하면 이 공정으로 분류됩니다
|
|
|
|
|
</p>
|
2025-12-26 15:48:08 +09:00
|
|
|
</CardHeader>
|
2026-02-09 21:31:00 +09:00
|
|
|
{individualItems.length > 0 && (
|
2026-02-25 14:28:49 +09:00
|
|
|
<CardContent className="pt-4 max-h-[240px] md:max-h-none overflow-y-auto">
|
|
|
|
|
<div className="flex flex-wrap gap-1.5">
|
2026-02-09 21:31:00 +09:00
|
|
|
{individualItems.map((item) => (
|
|
|
|
|
<div
|
|
|
|
|
key={item.id}
|
2026-02-25 14:28:49 +09:00
|
|
|
className="inline-flex items-center gap-1.5 rounded-full border bg-muted/30 pl-3 pr-1.5 py-1 text-xs"
|
2026-02-09 21:31:00 +09:00
|
|
|
>
|
2026-02-25 14:28:49 +09:00
|
|
|
<span className="font-mono">{item.code}</span>
|
2026-02-09 21:31:00 +09:00
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
onClick={() => handleRemoveItem(item.id)}
|
2026-02-25 14:28:49 +09:00
|
|
|
className="shrink-0 rounded-full p-0.5 text-muted-foreground/50 hover:text-destructive transition-colors"
|
2026-02-09 21:31:00 +09:00
|
|
|
>
|
2026-02-25 14:28:49 +09:00
|
|
|
<Trash2 className="h-3 w-3" />
|
2026-02-09 21:31:00 +09:00
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</CardContent>
|
|
|
|
|
)}
|
2025-12-26 15:48:08 +09:00
|
|
|
</Card>
|
|
|
|
|
|
2026-01-29 22:56:01 +09:00
|
|
|
{/* 단계 테이블 */}
|
2025-12-26 15:48:08 +09:00
|
|
|
<Card>
|
|
|
|
|
<CardHeader className="bg-muted/50">
|
2026-01-29 22:56:01 +09:00
|
|
|
<div className="flex items-center justify-between">
|
|
|
|
|
<CardTitle className="text-base">
|
|
|
|
|
단계
|
|
|
|
|
{!isStepsLoading && (
|
|
|
|
|
<span className="text-sm font-normal text-muted-foreground ml-2">
|
|
|
|
|
총 {steps.length}건
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
|
|
|
|
</CardTitle>
|
|
|
|
|
<Button size="sm" onClick={handleAddStep}>
|
|
|
|
|
<Plus className="h-4 w-4 mr-1" />
|
|
|
|
|
단계 등록
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
2025-12-26 15:48:08 +09:00
|
|
|
</CardHeader>
|
2026-01-29 22:56:01 +09:00
|
|
|
<CardContent className="p-0">
|
|
|
|
|
{isStepsLoading ? (
|
|
|
|
|
<div className="p-8 text-center text-muted-foreground">
|
|
|
|
|
로딩 중...
|
2026-01-26 15:07:10 +09:00
|
|
|
</div>
|
2026-01-29 22:56:01 +09:00
|
|
|
) : steps.length === 0 ? (
|
|
|
|
|
<div className="p-8 text-center text-muted-foreground">
|
|
|
|
|
등록된 단계가 없습니다. [단계 등록] 버튼으로 추가해주세요.
|
2026-01-26 15:07:10 +09:00
|
|
|
</div>
|
2026-01-29 22:56:01 +09:00
|
|
|
) : (
|
2026-02-25 14:28:49 +09:00
|
|
|
<>
|
|
|
|
|
{/* 모바일: 카드 리스트 */}
|
|
|
|
|
<div className="md:hidden divide-y">
|
|
|
|
|
{steps.map((step, index) => (
|
|
|
|
|
<div
|
|
|
|
|
key={step.id}
|
|
|
|
|
draggable
|
|
|
|
|
onDragStart={(e) => handleDragStart(e, index)}
|
|
|
|
|
onDragOver={(e) => handleDragOver(e, index)}
|
|
|
|
|
onDragEnd={handleDragEnd}
|
|
|
|
|
onDrop={(e) => handleDrop(e, index)}
|
|
|
|
|
onClick={() => handleStepClick(step.id)}
|
|
|
|
|
className={`flex items-center gap-2 px-3 py-2.5 cursor-pointer hover:bg-muted/50 ${
|
|
|
|
|
dragOverIndex === index && dragIndex !== index
|
|
|
|
|
? 'border-t-2 border-t-primary'
|
|
|
|
|
: ''
|
|
|
|
|
}`}
|
|
|
|
|
>
|
|
|
|
|
<ReorderButtons
|
|
|
|
|
onMoveUp={() => handleMoveStep(index, index - 1)}
|
|
|
|
|
onMoveDown={() => handleMoveStep(index, index + 1)}
|
|
|
|
|
isFirst={index === 0}
|
|
|
|
|
isLast={index === steps.length - 1}
|
|
|
|
|
size="xs"
|
|
|
|
|
/>
|
|
|
|
|
<span className="text-xs text-muted-foreground w-5 shrink-0">{index + 1}</span>
|
|
|
|
|
<div className="flex-1 min-w-0">
|
|
|
|
|
<div className="flex items-center gap-1.5">
|
|
|
|
|
<span className="text-xs font-mono text-muted-foreground">{step.stepCode}</span>
|
|
|
|
|
<span className="text-sm font-medium truncate">{step.stepName}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex items-center gap-1 shrink-0">
|
|
|
|
|
<Badge variant={step.isRequired ? 'default' : 'outline'} className="text-[10px] px-1.5 py-0">필수</Badge>
|
|
|
|
|
<Badge variant={step.needsApproval ? 'default' : 'outline'} className="text-[10px] px-1.5 py-0">승인</Badge>
|
|
|
|
|
<Badge variant={step.needsInspection ? 'default' : 'outline'} className="text-[10px] px-1.5 py-0">검사</Badge>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
{/* 데스크탑: 테이블 */}
|
|
|
|
|
<div className="hidden md:block overflow-x-auto">
|
2026-01-29 22:56:01 +09:00
|
|
|
<table className="w-full">
|
|
|
|
|
<thead>
|
|
|
|
|
<tr className="border-b bg-muted/30">
|
2026-02-25 14:28:49 +09:00
|
|
|
<th className="w-16 px-3 py-3 text-center text-xs font-medium text-muted-foreground" />
|
|
|
|
|
<th className="w-14 px-3 py-3 text-center text-xs font-medium text-muted-foreground">No.</th>
|
|
|
|
|
<th className="px-3 py-3 text-left text-xs font-medium text-muted-foreground">단계코드</th>
|
|
|
|
|
<th className="px-3 py-3 text-left text-xs font-medium text-muted-foreground">단계명</th>
|
|
|
|
|
<th className="w-20 px-3 py-3 text-center text-xs font-medium text-muted-foreground">필수여부</th>
|
|
|
|
|
<th className="w-20 px-3 py-3 text-center text-xs font-medium text-muted-foreground">승인여부</th>
|
|
|
|
|
<th className="w-20 px-3 py-3 text-center text-xs font-medium text-muted-foreground">검사여부</th>
|
|
|
|
|
<th className="w-16 px-3 py-3 text-center text-xs font-medium text-muted-foreground">사용</th>
|
2026-01-29 22:56:01 +09:00
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
{steps.map((step, index) => (
|
|
|
|
|
<tr
|
|
|
|
|
key={step.id}
|
|
|
|
|
draggable
|
|
|
|
|
onDragStart={(e) => handleDragStart(e, index)}
|
|
|
|
|
onDragOver={(e) => handleDragOver(e, index)}
|
|
|
|
|
onDragEnd={handleDragEnd}
|
|
|
|
|
onDrop={(e) => handleDrop(e, index)}
|
|
|
|
|
onClick={() => handleStepClick(step.id)}
|
|
|
|
|
className={`border-b cursor-pointer transition-colors hover:bg-muted/50 ${
|
|
|
|
|
dragOverIndex === index && dragIndex !== index
|
|
|
|
|
? 'border-t-2 border-t-primary'
|
|
|
|
|
: ''
|
|
|
|
|
}`}
|
|
|
|
|
>
|
2026-02-25 14:28:49 +09:00
|
|
|
<td className="w-16 px-3 py-3 text-center" onClick={(e) => e.stopPropagation()}>
|
|
|
|
|
<div className="flex items-center justify-center gap-0.5">
|
|
|
|
|
<GripVertical className="h-4 w-4 text-muted-foreground cursor-grab active:cursor-grabbing" />
|
|
|
|
|
<ReorderButtons
|
|
|
|
|
onMoveUp={() => handleMoveStep(index, index - 1)}
|
|
|
|
|
onMoveDown={() => handleMoveStep(index, index + 1)}
|
|
|
|
|
isFirst={index === 0}
|
|
|
|
|
isLast={index === steps.length - 1}
|
|
|
|
|
size="xs"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2026-01-29 22:56:01 +09:00
|
|
|
</td>
|
2026-02-25 14:28:49 +09:00
|
|
|
<td className="w-14 px-3 py-3 text-center text-sm text-muted-foreground">{index + 1}</td>
|
|
|
|
|
<td className="px-3 py-3 text-sm font-mono">{step.stepCode}</td>
|
|
|
|
|
<td className="px-3 py-3 text-sm font-medium">{step.stepName}</td>
|
2026-01-29 22:56:01 +09:00
|
|
|
<td className="w-20 px-3 py-3 text-center">
|
2026-02-25 14:28:49 +09:00
|
|
|
<Badge variant={step.isRequired ? 'default' : 'outline'} className="text-xs">{step.isRequired ? 'Y' : 'N'}</Badge>
|
2026-01-29 22:56:01 +09:00
|
|
|
</td>
|
|
|
|
|
<td className="w-20 px-3 py-3 text-center">
|
2026-02-25 14:28:49 +09:00
|
|
|
<Badge variant={step.needsApproval ? 'default' : 'outline'} className="text-xs">{step.needsApproval ? 'Y' : 'N'}</Badge>
|
2026-01-29 22:56:01 +09:00
|
|
|
</td>
|
|
|
|
|
<td className="w-20 px-3 py-3 text-center">
|
2026-02-25 14:28:49 +09:00
|
|
|
<Badge variant={step.needsInspection ? 'default' : 'outline'} className="text-xs">{step.needsInspection ? 'Y' : 'N'}</Badge>
|
2026-01-29 22:56:01 +09:00
|
|
|
</td>
|
|
|
|
|
<td className="w-16 px-3 py-3 text-center">
|
2026-02-25 14:28:49 +09:00
|
|
|
<Badge variant={step.isActive ? 'default' : 'secondary'} className="text-xs">{step.isActive ? 'Y' : 'N'}</Badge>
|
2026-01-29 22:56:01 +09:00
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
))}
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
2025-12-26 15:48:08 +09:00
|
|
|
</div>
|
2026-02-25 14:28:49 +09:00
|
|
|
</>
|
2026-01-29 22:56:01 +09:00
|
|
|
)}
|
2025-12-26 15:48:08 +09:00
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-01-26 15:07:10 +09:00
|
|
|
{/* 하단 액션 버튼 (sticky) */}
|
2026-01-29 22:56:01 +09:00
|
|
|
<div
|
feat(WEB): 상세 페이지 권한 체계 통합 및 레이아웃/문서 기능 개선
권한 시스템 통합:
- BadDebtDetail, LaborDetail, PricingDetail 권한 로직 정리
- BoardDetail, ClientDetail, ItemDetail 권한 적용 개선
- ProcessDetail, StepDetail, PermissionDetail 권한 리팩토링
- ContractDetail, HandoverReport, ProgressBilling 권한 연동
- ReceivingDetail, ShipmentDetail, WorkOrderDetail 권한 적용
- InspectionDetail, OrderSalesDetail, QuoteFooterBar 권한 개선
기능 개선:
- AuthenticatedLayout 구조 리팩토링
- JointbarInspectionDocument 문서 레이아웃 개선
- PricingTableForm 폼 기능 보강
- DynamicItemForm, SectionsTab 개선
- 주문관리 상세/생산지시 페이지 개선
- VendorLedgerDetail 수정
설정:
- Claude hooks 추가 (빌드 차단, 파일 크기 체크, 미사용 import 체크)
- 품질감사 문서관리 계획 문서 추가
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 20:26:27 +09:00
|
|
|
className={`fixed bottom-4 left-4 right-4 px-4 py-3 bg-background/95 backdrop-blur rounded-xl border shadow-lg z-50 transition-all duration-300 md:bottom-6 md:px-6 md:right-[48px] ${sidebarCollapsed ? 'md:left-[156px]' : 'md:left-[316px]'} flex items-center justify-between`}
|
2026-01-29 22:56:01 +09:00
|
|
|
>
|
feat(WEB): 상세 페이지 권한 체계 통합 및 레이아웃/문서 기능 개선
권한 시스템 통합:
- BadDebtDetail, LaborDetail, PricingDetail 권한 로직 정리
- BoardDetail, ClientDetail, ItemDetail 권한 적용 개선
- ProcessDetail, StepDetail, PermissionDetail 권한 리팩토링
- ContractDetail, HandoverReport, ProgressBilling 권한 연동
- ReceivingDetail, ShipmentDetail, WorkOrderDetail 권한 적용
- InspectionDetail, OrderSalesDetail, QuoteFooterBar 권한 개선
기능 개선:
- AuthenticatedLayout 구조 리팩토링
- JointbarInspectionDocument 문서 레이아웃 개선
- PricingTableForm 폼 기능 보강
- DynamicItemForm, SectionsTab 개선
- 주문관리 상세/생산지시 페이지 개선
- VendorLedgerDetail 수정
설정:
- Claude hooks 추가 (빌드 차단, 파일 크기 체크, 미사용 import 체크)
- 품질감사 문서관리 계획 문서 추가
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 20:26:27 +09:00
|
|
|
<Button variant="outline" onClick={handleList} size="sm" className="md:size-default">
|
|
|
|
|
<ArrowLeft className="h-4 w-4 md:mr-2" />
|
|
|
|
|
<span className="hidden md:inline">목록으로</span>
|
2026-01-26 15:07:10 +09:00
|
|
|
</Button>
|
feat(WEB): 권한 관리 시스템 구현 및 상세 페이지 권한 통합
- PermissionContext, usePermission 훅, PermissionGuard 컴포넌트 신규 추가
- AccessDenied 접근 거부 페이지 추가
- permissions lib (체커, 매퍼, 타입) 구현
- BadDebtDetail, BoardDetail, LaborDetail, PricingDetail 등 상세 페이지 권한 적용
- ProcessDetail, StepDetail, ItemDetail, PermissionDetail 권한 연동
- RootProvider에 PermissionProvider 통합
- protected layout 권한 체크 추가
- Claude 프로젝트 설정 파일 추가
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 10:17:02 +09:00
|
|
|
{canUpdate && (
|
2026-02-09 21:49:45 +09:00
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
<Button
|
|
|
|
|
variant="outline"
|
|
|
|
|
onClick={() => deleteDialog.single.open(process.id)}
|
|
|
|
|
size="sm"
|
|
|
|
|
className="md:size-default text-destructive hover:text-destructive"
|
|
|
|
|
>
|
|
|
|
|
<Trash2 className="h-4 w-4 md:mr-2" />
|
|
|
|
|
<span className="hidden md:inline">삭제</span>
|
|
|
|
|
</Button>
|
|
|
|
|
<Button onClick={handleEdit} size="sm" className="md:size-default">
|
|
|
|
|
<Edit className="h-4 w-4 md:mr-2" />
|
|
|
|
|
<span className="hidden md:inline">수정</span>
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
feat(WEB): 권한 관리 시스템 구현 및 상세 페이지 권한 통합
- PermissionContext, usePermission 훅, PermissionGuard 컴포넌트 신규 추가
- AccessDenied 접근 거부 페이지 추가
- permissions lib (체커, 매퍼, 타입) 구현
- BadDebtDetail, BoardDetail, LaborDetail, PricingDetail 등 상세 페이지 권한 적용
- ProcessDetail, StepDetail, ItemDetail, PermissionDetail 권한 연동
- RootProvider에 PermissionProvider 통합
- protected layout 권한 체크 추가
- Claude 프로젝트 설정 파일 추가
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 10:17:02 +09:00
|
|
|
)}
|
2026-01-26 15:07:10 +09:00
|
|
|
</div>
|
2026-02-09 21:49:45 +09:00
|
|
|
|
|
|
|
|
{/* 삭제 확인 다이얼로그 */}
|
|
|
|
|
<DeleteConfirmDialog
|
|
|
|
|
open={deleteDialog.single.isOpen}
|
|
|
|
|
onOpenChange={deleteDialog.single.onOpenChange}
|
|
|
|
|
onConfirm={deleteDialog.single.confirm}
|
|
|
|
|
loading={deleteDialog.isPending}
|
|
|
|
|
description="이 공정을 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다."
|
|
|
|
|
/>
|
2025-12-26 15:48:08 +09:00
|
|
|
</PageLayout>
|
|
|
|
|
);
|
2026-01-29 22:56:01 +09:00
|
|
|
}
|