add activity dialog on master data module

This commit is contained in:
Wikzyy
2025-04-07 15:20:35 +07:00
parent 61211e7e16
commit 5e719eefa2
21 changed files with 190 additions and 39 deletions

View File

@ -31,6 +31,7 @@ import {
CommandList
} from '@/components/ui/command';
import { NumericFormat } from 'react-number-format';
import { doSaveLogActivity } from '@/actions/GlobalActions';
interface GroupProps {
ID: string;
@ -48,7 +49,7 @@ interface WalletProps {
const API_URL_WALLET = apiConfig.service_wallet;
const AddDialog = () => {
const { showAddDialog, handleAddDialog } = useManageWalletRuleContext();
const { showAddDialog, handleAddDialog, selectedWalletRule } = useManageWalletRuleContext();
const { reload } = useDataGrid();
const { PostData, GetData } = useCallApi();
const [open, setOpen] = useState(false);
@ -94,6 +95,14 @@ const AddDialog = () => {
handleAddDialog(false);
toast.success('Success Create Wallet Rule');
reload();
const createActivity = {
module: 'Manage Wallet Rule',
description: `Create Wallet Rule => ${selectedWalletRule?.ID}`,
action: 'C'
};
doSaveLogActivity(createActivity);
} else {
toast.error('Failed Create Wallet Rule');
setAlert({ show: true, message: 'Failed Create Wallet Rule' });

View File

@ -13,6 +13,7 @@ import {
DialogTitle
} from '@/components/ui/dialog';
import { Button } from '@/components/ui/button';
import { doSaveLogActivity } from '@/actions/GlobalActions';
const API_URL_WALLET = apiConfig.service_wallet;
@ -37,6 +38,13 @@ const DeleteDialog = () => {
toast.success('Wallet rule deleted successfully');
handleDeleteDialog(false, null);
reload();
const createActivity = {
module: 'Manage Wallet Rule',
description: `Edit Wallet Rule', => ${selectedWalletRule.ID}`,
action: 'D'
};
doSaveLogActivity(createActivity);
setAlert({ show: false, message: '' });
} else {
toast.error('Failed to delete wallet rule');

View File

@ -31,6 +31,7 @@ import {
import { Input } from '@/components/ui/input';
import { Button } from '@/components/ui/button';
import { NumericFormat } from 'react-number-format';
import { doSaveLogActivity } from '@/actions/GlobalActions';
interface GroupProps {
ID: string;
@ -97,6 +98,14 @@ const EditDialog = () => {
handleEditDialog(false, null);
toast.success('Success Update Wallet Rule');
reload();
const createActivity = {
module: 'Manage Wallet Rule',
description: `Edit Wallet Rule => ${selectedWalletRule?.ID}`,
action: 'U'
};
doSaveLogActivity(createActivity);
} else {
toast.error('Failed Update Wallet Rule');
setAlert({ show: true, message: 'Failed Update Wallet Rule' });