fix: [process] 품목 전체 삭제 confirm() → DeleteConfirmDialog 전환
This commit is contained in:
@@ -31,6 +31,7 @@ import {
|
||||
} from '@/components/ui/select';
|
||||
import { RuleModal } from './RuleModal';
|
||||
import { toast } from 'sonner';
|
||||
import { DeleteConfirmDialog } from '@/components/ui/confirm-dialog';
|
||||
import type { Process, ClassificationRule, ProcessType, ProcessStep } from '@/types/process';
|
||||
import { PROCESS_CATEGORY_OPTIONS } from '@/types/process';
|
||||
import {
|
||||
@@ -143,12 +144,13 @@ export function ProcessForm({ mode, initialData }: ProcessFormProps) {
|
||||
}, []);
|
||||
|
||||
// 품목 전체 삭제
|
||||
const [showRemoveAllDialog, setShowRemoveAllDialog] = useState(false);
|
||||
const handleRemoveAllItems = useCallback(() => {
|
||||
if (!confirm(`등록된 품목 ${itemCount}개를 모두 삭제하시겠습니까?`)) return;
|
||||
setClassificationRules((prev) =>
|
||||
prev.filter((rule) => rule.registrationType !== 'individual')
|
||||
);
|
||||
}, [itemCount]);
|
||||
setShowRemoveAllDialog(false);
|
||||
}, []);
|
||||
|
||||
// 부서 목록 + 문서양식 목록 로드
|
||||
useEffect(() => {
|
||||
@@ -611,7 +613,7 @@ export function ProcessForm({ mode, initialData }: ProcessFormProps) {
|
||||
type="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" />
|
||||
@@ -867,13 +869,23 @@ export function ProcessForm({ mode, initialData }: ProcessFormProps) {
|
||||
const config = isEdit ? processEditConfig : processCreateConfig;
|
||||
|
||||
return (
|
||||
<IntegratedDetailTemplate
|
||||
config={config}
|
||||
mode={isEdit ? 'edit' : 'create'}
|
||||
isLoading={isDepartmentsLoading}
|
||||
onCancel={handleCancel}
|
||||
onSubmit={handleSubmit}
|
||||
renderForm={renderFormContent}
|
||||
/>
|
||||
<>
|
||||
<IntegratedDetailTemplate
|
||||
config={config}
|
||||
mode={isEdit ? 'edit' : 'create'}
|
||||
isLoading={isDepartmentsLoading}
|
||||
onCancel={handleCancel}
|
||||
onSubmit={handleSubmit}
|
||||
renderForm={renderFormContent}
|
||||
/>
|
||||
|
||||
{/* 품목 전체 삭제 확인 다이얼로그 */}
|
||||
<DeleteConfirmDialog
|
||||
open={showRemoveAllDialog}
|
||||
onOpenChange={setShowRemoveAllDialog}
|
||||
onConfirm={handleRemoveAllItems}
|
||||
description={`등록된 품목 ${itemCount}개를 모두 삭제하시겠습니까?`}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user