2026-01-29 22:56:01 +09:00
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 단계 상세 뷰 컴포넌트
|
|
|
|
|
*
|
|
|
|
|
* 기획서 스크린샷 2 기준:
|
|
|
|
|
* - 기본 정보: 단계코드, 단계명, 필수여부, 승인여부, 검사여부, 상태
|
|
|
|
|
* - 연결 정보: 유형(팝업/없음), 도달(입고완료 자재 목록 등)
|
|
|
|
|
* - 완료 정보: 유형(선택 완료 시 완료/클릭 시 완료)
|
|
|
|
|
*/
|
|
|
|
|
|
2026-02-05 21:58:53 +09:00
|
|
|
import { useState } from 'react';
|
2026-01-29 22:56:01 +09:00
|
|
|
import { useRouter } from 'next/navigation';
|
2026-02-05 21:58:53 +09:00
|
|
|
import { ArrowLeft, Edit, Trash2 } from 'lucide-react';
|
2026-01-29 22:56:01 +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';
|
|
|
|
|
import { PageHeader } from '@/components/organisms/PageHeader';
|
|
|
|
|
import { useMenuStore } from '@/store/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-05 21:58:53 +09:00
|
|
|
import { deleteProcessStep } from './actions';
|
|
|
|
|
import { toast } from 'sonner';
|
|
|
|
|
import {
|
|
|
|
|
AlertDialog,
|
|
|
|
|
AlertDialogAction,
|
|
|
|
|
AlertDialogCancel,
|
|
|
|
|
AlertDialogContent,
|
|
|
|
|
AlertDialogDescription,
|
|
|
|
|
AlertDialogFooter,
|
|
|
|
|
AlertDialogHeader,
|
|
|
|
|
AlertDialogTitle,
|
|
|
|
|
} from '@/components/ui/alert-dialog';
|
2026-01-29 22:56:01 +09:00
|
|
|
import type { ProcessStep } from '@/types/process';
|
|
|
|
|
|
|
|
|
|
interface StepDetailProps {
|
|
|
|
|
step: ProcessStep;
|
|
|
|
|
processId: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function StepDetail({ step, processId }: StepDetailProps) {
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const sidebarCollapsed = useMenuStore((state) => state.sidebarCollapsed);
|
2026-02-05 21:58:53 +09:00
|
|
|
const { canUpdate, canDelete } = usePermission();
|
|
|
|
|
const [showDeleteDialog, setShowDeleteDialog] = useState(false);
|
|
|
|
|
const [isDeleting, setIsDeleting] = useState(false);
|
2026-01-29 22:56:01 +09:00
|
|
|
|
|
|
|
|
const handleEdit = () => {
|
|
|
|
|
router.push(
|
|
|
|
|
`/ko/master-data/process-management/${processId}/steps/${step.id}?mode=edit`
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleBack = () => {
|
|
|
|
|
router.push(`/ko/master-data/process-management/${processId}`);
|
|
|
|
|
};
|
|
|
|
|
|
2026-02-05 21:58:53 +09:00
|
|
|
const handleDelete = async () => {
|
|
|
|
|
setIsDeleting(true);
|
|
|
|
|
try {
|
|
|
|
|
const result = await deleteProcessStep(processId, step.id);
|
|
|
|
|
if (result.success) {
|
|
|
|
|
toast.success('단계가 삭제되었습니다.');
|
|
|
|
|
router.push(`/ko/master-data/process-management/${processId}`);
|
|
|
|
|
} else {
|
|
|
|
|
toast.error(result.error || '삭제에 실패했습니다.');
|
|
|
|
|
}
|
|
|
|
|
} catch {
|
|
|
|
|
toast.error('삭제 중 오류가 발생했습니다.');
|
|
|
|
|
} finally {
|
|
|
|
|
setIsDeleting(false);
|
|
|
|
|
setShowDeleteDialog(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2026-01-29 22:56:01 +09:00
|
|
|
return (
|
|
|
|
|
<PageLayout>
|
|
|
|
|
<PageHeader title="단계 상세" />
|
|
|
|
|
|
|
|
|
|
<div className="space-y-6 pb-24">
|
|
|
|
|
{/* 기본 정보 */}
|
|
|
|
|
<Card>
|
|
|
|
|
<CardHeader className="bg-muted/50">
|
|
|
|
|
<CardTitle className="text-base">기본 정보</CardTitle>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent className="pt-6">
|
|
|
|
|
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-6">
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">단계코드</div>
|
|
|
|
|
<div className="font-medium font-mono">{step.stepCode}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">단계명</div>
|
|
|
|
|
<div className="font-medium">{step.stepName}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">필수여부</div>
|
|
|
|
|
<Badge variant={step.isRequired ? 'default' : 'outline'}>
|
|
|
|
|
{step.isRequired ? '필수' : '선택'}
|
|
|
|
|
</Badge>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">승인여부</div>
|
|
|
|
|
<Badge variant={step.needsApproval ? 'default' : 'outline'}>
|
|
|
|
|
{step.needsApproval ? '필요' : '불필요'}
|
|
|
|
|
</Badge>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">검사여부</div>
|
|
|
|
|
<Badge variant={step.needsInspection ? 'default' : 'outline'}>
|
|
|
|
|
{step.needsInspection ? '필요' : '불필요'}
|
|
|
|
|
</Badge>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">상태</div>
|
|
|
|
|
<Badge variant={step.isActive ? 'default' : 'secondary'}>
|
|
|
|
|
{step.isActive ? '사용' : '미사용'}
|
|
|
|
|
</Badge>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
{/* 연결 정보 */}
|
|
|
|
|
<Card>
|
|
|
|
|
<CardHeader className="bg-muted/50">
|
|
|
|
|
<CardTitle className="text-base">연결 정보</CardTitle>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent className="pt-6">
|
|
|
|
|
<div className="grid grid-cols-1 sm:grid-cols-2 gap-6">
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">유형</div>
|
|
|
|
|
<div className="font-medium">{step.connectionType}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">도달</div>
|
|
|
|
|
<div className="font-medium">{step.connectionTarget || '-'}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
{/* 완료 정보 */}
|
|
|
|
|
<Card>
|
|
|
|
|
<CardHeader className="bg-muted/50">
|
|
|
|
|
<CardTitle className="text-base">완료 정보</CardTitle>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardContent className="pt-6">
|
|
|
|
|
<div className="grid grid-cols-1 sm:grid-cols-2 gap-6">
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
<div className="text-sm text-muted-foreground">유형</div>
|
|
|
|
|
<div className="font-medium">{step.completionType}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* 하단 액션 버튼 (sticky) */}
|
|
|
|
|
<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={handleBack} size="sm" className="md:size-default">
|
|
|
|
|
<ArrowLeft className="h-4 w-4 md:mr-2" />
|
|
|
|
|
<span className="hidden md:inline">공정으로 돌아가기</span>
|
2026-01-29 22:56:01 +09:00
|
|
|
</Button>
|
2026-02-05 21:58:53 +09:00
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
{canDelete && (
|
|
|
|
|
<Button
|
|
|
|
|
variant="destructive"
|
|
|
|
|
onClick={() => setShowDeleteDialog(true)}
|
|
|
|
|
size="sm"
|
|
|
|
|
className="md:size-default"
|
|
|
|
|
>
|
|
|
|
|
<Trash2 className="h-4 w-4 md:mr-2" />
|
|
|
|
|
<span className="hidden md:inline">삭제</span>
|
|
|
|
|
</Button>
|
|
|
|
|
)}
|
|
|
|
|
{canUpdate && (
|
|
|
|
|
<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>
|
2026-01-29 22:56:01 +09:00
|
|
|
</div>
|
2026-02-05 21:58:53 +09:00
|
|
|
|
|
|
|
|
{/* 삭제 확인 다이얼로그 */}
|
|
|
|
|
<AlertDialog open={showDeleteDialog} onOpenChange={setShowDeleteDialog}>
|
|
|
|
|
<AlertDialogContent>
|
|
|
|
|
<AlertDialogHeader>
|
|
|
|
|
<AlertDialogTitle>단계 삭제</AlertDialogTitle>
|
|
|
|
|
<AlertDialogDescription>
|
|
|
|
|
'{step.stepName}' 단계를 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다.
|
|
|
|
|
</AlertDialogDescription>
|
|
|
|
|
</AlertDialogHeader>
|
|
|
|
|
<AlertDialogFooter>
|
|
|
|
|
<AlertDialogCancel disabled={isDeleting}>취소</AlertDialogCancel>
|
|
|
|
|
<AlertDialogAction
|
|
|
|
|
onClick={handleDelete}
|
|
|
|
|
disabled={isDeleting}
|
|
|
|
|
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
|
|
|
|
|
>
|
|
|
|
|
{isDeleting ? '삭제 중...' : '삭제'}
|
|
|
|
|
</AlertDialogAction>
|
|
|
|
|
</AlertDialogFooter>
|
|
|
|
|
</AlertDialogContent>
|
|
|
|
|
</AlertDialog>
|
2026-01-29 22:56:01 +09:00
|
|
|
</PageLayout>
|
|
|
|
|
);
|
|
|
|
|
}
|