From 2d915ee9380ea01a65f6125542ac881319c90ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Wed, 18 Mar 2026 21:46:02 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20[stocks]=20=EC=9E=AC=EA=B3=A0=EC=83=9D?= =?UTF-8?q?=EC=82=B0=20=EC=83=81=EC=84=B8=20=EB=B3=B4=EA=B8=B0=EC=97=90=20?= =?UTF-8?q?=EC=88=98=EC=A0=95/=EC=82=AD=EC=A0=9C=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - showEdit: true, showDelete: true 설정 - onDelete prop으로 IntegratedDetailTemplate 내장 삭제 다이얼로그 활용 - 불필요한 DeleteConfirmDialog, isDeleteDialogOpen, handleDelete 제거 --- .../stocks/StockProductionDetail.tsx | 43 ++++--------------- 1 file changed, 9 insertions(+), 34 deletions(-) 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)} /> - - ); }