diff --git a/src/components/stocks/StockProductionDetail.tsx b/src/components/stocks/StockProductionDetail.tsx index e42e871c..429a8e15 100644 --- a/src/components/stocks/StockProductionDetail.tsx +++ b/src/components/stocks/StockProductionDetail.tsx @@ -24,7 +24,6 @@ import { toast } from 'sonner'; import { IntegratedDetailTemplate } from '@/components/templates/IntegratedDetailTemplate'; import { FormSection } from '@/components/organisms/FormSection'; import { BadgeSm } from '@/components/atoms/BadgeSm'; -import { DeleteConfirmDialog } from '@/components/ui/confirm-dialog'; import { getStockOrderById, getBendingCodeMap, @@ -49,8 +48,8 @@ const stockDetailConfig: DetailConfig = { fields: [], actions: { showBack: true, - showEdit: false, - showDelete: false, + showEdit: true, + showDelete: true, backLabel: '목록', }, }; @@ -95,7 +94,6 @@ export function StockProductionDetail({ orderId }: StockProductionDetailProps) { const [order, setOrder] = useState(null); const [codeMap, setCodeMap] = useState(null); const [loading, setLoading] = useState(true); - const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false); const [isProcessing, setIsProcessing] = useState(false); // 데이터 로드 @@ -171,28 +169,6 @@ export function StockProductionDetail({ orderId }: StockProductionDetailProps) { } }, [order]); - // 삭제 - const handleDelete = useCallback(async () => { - if (!order) return; - setIsProcessing(true); - try { - const result = await deleteStockOrder(order.id); - if (result.__authError) { - toast.error('인증이 만료되었습니다.'); - return; - } - if (result.success) { - toast.success('재고생산이 삭제되었습니다.'); - router.push(basePath); - } else { - toast.error(result.error || '삭제에 실패했습니다.'); - } - } finally { - setIsProcessing(false); - setIsDeleteDialogOpen(false); - } - }, [order, router, basePath]); - // 헤더 액션 버튼 const headerActionItems = useMemo((): ActionItem[] => { if (!order) return []; @@ -343,18 +319,17 @@ export function StockProductionDetail({ orderId }: StockProductionDetailProps) { itemId={orderId} isLoading={loading} onCancel={() => router.push(basePath)} + onDelete={async (id) => { + const result = await deleteStockOrder(String(id)); + if (result.__authError) { + return { success: false, error: '인증이 만료되었습니다.' }; + } + return { success: result.success, error: result.error }; + }} headerActions={null} headerActionItems={headerActionItems} renderView={(data) => renderViewContent(data as unknown as StockOrder)} /> - - ); }