diff --git a/src/pages/master/walletRule/WalletRuleMaster.tsx b/src/pages/master/walletRule/WalletRuleMaster.tsx
index 23fde29..08e56d2 100644
--- a/src/pages/master/walletRule/WalletRuleMaster.tsx
+++ b/src/pages/master/walletRule/WalletRuleMaster.tsx
@@ -3,6 +3,7 @@ import { ManageWalletRuleContextProvider } from './hooks/ManageWalletRuleContext
import { Breadcrumbs, Link } from '@mui/material';
import AddDialog from './blocks/AddDialog';
import EditDialog from './blocks/EditDialog';
+import DeleteDialog from './blocks/DeleteDialog';
const WalletRuleMaster = () => {
return (
@@ -29,6 +30,7 @@ const WalletRuleMaster = () => {
+
);
diff --git a/src/pages/master/walletRule/blocks/DeleteDialog.tsx b/src/pages/master/walletRule/blocks/DeleteDialog.tsx
new file mode 100644
index 0000000..2f72635
--- /dev/null
+++ b/src/pages/master/walletRule/blocks/DeleteDialog.tsx
@@ -0,0 +1,76 @@
+import { useCallApi } from '@/hooks';
+import { useManageWalletRuleContext } from '../hooks/useManageWalletRuleContext';
+import { Alert, useDataGrid } from '@/components';
+import { useCallback, useState } from 'react';
+import { toast } from 'sonner';
+import { apiConfig } from '@/config/api.config';
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle
+} from '@/components/ui/dialog';
+import { Button } from '@/components/ui/button';
+
+const API_URL_WALLET = apiConfig.service_wallet;
+
+const DeleteDialog = () => {
+ const { showDeleteDialog, handleDeleteDialog, selectedWalletRule } = useManageWalletRuleContext();
+ const { DeleteData } = useCallApi();
+ const { reload } = useDataGrid();
+ const [alert, setAlert] = useState({ show: false, message: '' });
+
+ const doDeleteWalletRule = useCallback(async () => {
+ if (!selectedWalletRule) {
+ toast.error('No wallet rule selected');
+ return;
+ }
+
+ const response = await DeleteData(
+ `${API_URL_WALLET}/dashboard/wallet_rule/${selectedWalletRule}`,
+ { id: selectedWalletRule }
+ );
+
+ if (response?.status) {
+ toast.success('Wallet rule deleted successfully');
+ handleDeleteDialog(false, null);
+ reload();
+ setAlert({ show: false, message: '' });
+ } else {
+ toast.error('Failed to delete wallet rule');
+ setAlert({ show: true, message: response?.message });
+ }
+ }, [selectedWalletRule]);
+
+ return (
+
+ );
+};
+
+export default DeleteDialog;