fix: [process] 품목 전체 삭제 confirm() → DeleteConfirmDialog 전환
This commit is contained in:
@@ -87,8 +87,8 @@ export function ProcessDetail({ process, onProcessUpdate }: ProcessDetailProps)
|
||||
};
|
||||
|
||||
// 품목 전체 삭제
|
||||
const [showRemoveAllDialog, setShowRemoveAllDialog] = useState(false);
|
||||
const handleRemoveAllItems = async () => {
|
||||
if (!confirm(`등록된 품목 ${itemCount}개를 모두 삭제하시겠습니까?`)) return;
|
||||
const result = await removeProcessItem(process.id, []);
|
||||
if (result.success && result.data) {
|
||||
toast.success('품목이 모두 제거되었습니다.');
|
||||
@@ -96,6 +96,7 @@ export function ProcessDetail({ process, onProcessUpdate }: ProcessDetailProps)
|
||||
} else {
|
||||
toast.error(result.error || '품목 전체 제거에 실패했습니다.');
|
||||
}
|
||||
setShowRemoveAllDialog(false);
|
||||
};
|
||||
|
||||
const [isDuplicating, setIsDuplicating] = useState(false);
|
||||
@@ -294,7 +295,7 @@ export function ProcessDetail({ process, onProcessUpdate }: ProcessDetailProps)
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={handleRemoveAllItems}
|
||||
onClick={() => setShowRemoveAllDialog(true)}
|
||||
className="shrink-0 text-destructive hover:text-destructive"
|
||||
>
|
||||
<Trash2 className="h-3.5 w-3.5 mr-1" />
|
||||
@@ -511,6 +512,14 @@ export function ProcessDetail({ process, onProcessUpdate }: ProcessDetailProps)
|
||||
loading={deleteDialog.isPending}
|
||||
description="이 공정을 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다."
|
||||
/>
|
||||
|
||||
{/* 품목 전체 삭제 확인 다이얼로그 */}
|
||||
<DeleteConfirmDialog
|
||||
open={showRemoveAllDialog}
|
||||
onOpenChange={setShowRemoveAllDialog}
|
||||
onConfirm={handleRemoveAllItems}
|
||||
description={`등록된 품목 ${itemCount}개를 모두 삭제하시겠습니까?`}
|
||||
/>
|
||||
</PageLayout>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user