feat: [공정관리] 품목 전체 삭제 버튼 추가 (등록/수정/상세 화면)

This commit is contained in:
김보곤
2026-03-21 12:58:03 +09:00
parent 6f41e0ee50
commit 480ff620ca
2 changed files with 43 additions and 0 deletions

View File

@@ -86,6 +86,18 @@ export function ProcessDetail({ process, onProcessUpdate }: ProcessDetailProps)
}
};
// 품목 전체 삭제
const handleRemoveAllItems = async () => {
if (!confirm(`등록된 품목 ${itemCount}개를 모두 삭제하시겠습니까?`)) return;
const result = await removeProcessItem(process.id, []);
if (result.success && result.data) {
toast.success('품목이 모두 제거되었습니다.');
onProcessUpdate?.(result.data);
} else {
toast.error(result.error || '품목 전체 제거에 실패했습니다.');
}
};
const [isDuplicating, setIsDuplicating] = useState(false);
// 공정 복제
@@ -278,6 +290,17 @@ export function ProcessDetail({ process, onProcessUpdate }: ProcessDetailProps)
<Button variant="outline" size="sm" onClick={handleEdit} className="shrink-0">
</Button>
{itemCount > 0 && (
<Button
variant="outline"
size="sm"
onClick={handleRemoveAllItems}
className="shrink-0 text-destructive hover:text-destructive"
>
<Trash2 className="h-3.5 w-3.5 mr-1" />
</Button>
)}
</div>
<p className="text-sm text-muted-foreground mt-1">