- Updated import paths for various components to align with new directory structure. - Changed imports from 'row-actions', 'confirm-dialog', 'image-preview-button', and 'file-upload' to their respective new locations in 'data-display', 'dialogs', and 'inputs'. - Adjusted imports in multiple pages including purchase, restock, transaction, category, customer, product, raw-material, supplier, roles, and settings. - Ensured all relevant components are imported from their new locations to maintain functionality.
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { ConfirmDialog } from '@/components/dialogs';
|
|
|
|
type DeleteConfirmDialogProps<T> = {
|
|
target: T | null;
|
|
onOpenChange: (open: boolean) => void;
|
|
title: string;
|
|
description?: string | ((target: T) => string);
|
|
confirmLabel?: string;
|
|
variant?: 'default' | 'destructive';
|
|
onConfirm: () => void;
|
|
};
|
|
|
|
export function DeleteConfirmDialog<T>({
|
|
target,
|
|
onOpenChange,
|
|
title,
|
|
description,
|
|
confirmLabel = 'Hapus',
|
|
variant,
|
|
onConfirm,
|
|
}: DeleteConfirmDialogProps<T>) {
|
|
return (
|
|
<ConfirmDialog
|
|
open={target !== null}
|
|
onOpenChange={onOpenChange}
|
|
title={title}
|
|
description={
|
|
typeof description === 'function' && target
|
|
? description(target)
|
|
: typeof description === 'string'
|
|
? description
|
|
: ''
|
|
}
|
|
confirmLabel={confirmLabel}
|
|
variant={variant}
|
|
onConfirm={onConfirm}
|
|
/>
|
|
);
|
|
}
|