add create activity on 4 modules: Provider, Conversion, Menu, Currency
This commit is contained in:
@ -33,6 +33,7 @@ import {
|
|||||||
SelectValue
|
SelectValue
|
||||||
} from '@/components/ui/select';
|
} from '@/components/ui/select';
|
||||||
import { useManageConversionContext } from '../hooks/useManageConversionContext';
|
import { useManageConversionContext } from '../hooks/useManageConversionContext';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
interface CurrencyProps {
|
interface CurrencyProps {
|
||||||
ID: string;
|
ID: string;
|
||||||
name: string;
|
name: string;
|
||||||
@ -80,6 +81,13 @@ const AddDialog = () => {
|
|||||||
resetForm();
|
resetForm();
|
||||||
handleAddDialog(false);
|
handleAddDialog(false);
|
||||||
toast.success('Success Create Conversion');
|
toast.success('Success Create Conversion');
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Conversion',
|
||||||
|
description: `Create Conversion => ${selectedConversion}`,
|
||||||
|
action: 'C'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
reload();
|
reload();
|
||||||
} else {
|
} else {
|
||||||
toast.error('Error Create Conversion');
|
toast.error('Error Create Conversion');
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import {
|
|||||||
} from '@/components/ui/dialog';
|
} from '@/components/ui/dialog';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { DialogDescription } from '@radix-ui/react-dialog';
|
import { DialogDescription } from '@radix-ui/react-dialog';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
const API_URL = apiConfig.service_wallet;
|
const API_URL = apiConfig.service_wallet;
|
||||||
|
|
||||||
@ -40,6 +41,13 @@ const DeleteDialog = () => {
|
|||||||
setAlert({ show: false, message: '' });
|
setAlert({ show: false, message: '' });
|
||||||
handleDeleteDialog(false, null);
|
handleDeleteDialog(false, null);
|
||||||
toast.success('Success Delete Conversion');
|
toast.success('Success Delete Conversion');
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Conversion',
|
||||||
|
description: `Delete Conversion => ${selectedConversion}`,
|
||||||
|
action: 'D'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
reload();
|
reload();
|
||||||
} else {
|
} else {
|
||||||
setAlert({ show: true, message: response?.message });
|
setAlert({ show: true, message: response?.message });
|
||||||
|
|||||||
@ -33,6 +33,7 @@ import {
|
|||||||
SelectValue
|
SelectValue
|
||||||
} from '@/components/ui/select';
|
} from '@/components/ui/select';
|
||||||
import { useManageConversionContext } from '../hooks/useManageConversionContext';
|
import { useManageConversionContext } from '../hooks/useManageConversionContext';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
interface CurrencyProps {
|
interface CurrencyProps {
|
||||||
ID: string;
|
ID: string;
|
||||||
name: string;
|
name: string;
|
||||||
@ -82,6 +83,13 @@ const EditDialog = () => {
|
|||||||
resetForm();
|
resetForm();
|
||||||
handleEditDialog(false, null);
|
handleEditDialog(false, null);
|
||||||
toast.success('Success Update Conversion');
|
toast.success('Success Update Conversion');
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Conversion',
|
||||||
|
description: `Update Conversion => ${selectedConversion}`,
|
||||||
|
action: 'U'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
reload();
|
reload();
|
||||||
} else {
|
} else {
|
||||||
toast.error('Error Create Conversion');
|
toast.error('Error Create Conversion');
|
||||||
|
|||||||
@ -34,6 +34,7 @@ import {
|
|||||||
} from '@/components/ui/select';
|
} from '@/components/ui/select';
|
||||||
import { useManageCurrencyContext } from '../hooks/useManageCurrencyContext';
|
import { useManageCurrencyContext } from '../hooks/useManageCurrencyContext';
|
||||||
import { prefix } from 'stylis';
|
import { prefix } from 'stylis';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
interface CurrencyProps {
|
interface CurrencyProps {
|
||||||
ID: string;
|
ID: string;
|
||||||
name: string;
|
name: string;
|
||||||
@ -80,6 +81,13 @@ const AddDialog = () => {
|
|||||||
resetForm();
|
resetForm();
|
||||||
handleAddDialog(false);
|
handleAddDialog(false);
|
||||||
toast.success('Success Create Currency');
|
toast.success('Success Create Currency');
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Currency',
|
||||||
|
description: `Create Currency=> ${selectedCurrency}`,
|
||||||
|
action: 'C'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
reload();
|
reload();
|
||||||
} else {
|
} else {
|
||||||
toast.error('Error Create Currency');
|
toast.error('Error Create Currency');
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import {
|
|||||||
} from '@/components/ui/dialog';
|
} from '@/components/ui/dialog';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { DialogDescription } from '@radix-ui/react-dialog';
|
import { DialogDescription } from '@radix-ui/react-dialog';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
const API_URL = apiConfig.service_wallet;
|
const API_URL = apiConfig.service_wallet;
|
||||||
|
|
||||||
@ -39,6 +40,13 @@ const DeleteDialog = () => {
|
|||||||
setAlert({ show: false, message: '' });
|
setAlert({ show: false, message: '' });
|
||||||
handleDeleteDialog(false, null);
|
handleDeleteDialog(false, null);
|
||||||
toast.success('Success Delete Currency');
|
toast.success('Success Delete Currency');
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Currency',
|
||||||
|
description: `Delete Currency=> ${selectedCurrency}`,
|
||||||
|
action: 'D'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
reload();
|
reload();
|
||||||
} else {
|
} else {
|
||||||
setAlert({ show: true, message: response?.message });
|
setAlert({ show: true, message: response?.message });
|
||||||
|
|||||||
@ -33,6 +33,7 @@ import {
|
|||||||
SelectValue
|
SelectValue
|
||||||
} from '@/components/ui/select';
|
} from '@/components/ui/select';
|
||||||
import { useManageCurrencyContext } from '../hooks/useManageCurrencyContext';
|
import { useManageCurrencyContext } from '../hooks/useManageCurrencyContext';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
interface CurrencyProps {
|
interface CurrencyProps {
|
||||||
ID: string;
|
ID: string;
|
||||||
name: string;
|
name: string;
|
||||||
@ -81,6 +82,13 @@ const EditDialog = () => {
|
|||||||
resetForm();
|
resetForm();
|
||||||
handleEditDialog(false, null);
|
handleEditDialog(false, null);
|
||||||
toast.success('Success Update Currency');
|
toast.success('Success Update Currency');
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Currency',
|
||||||
|
description: `Update Currency=> ${selectedCurrency}`,
|
||||||
|
action: 'U'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
reload();
|
reload();
|
||||||
} else {
|
} else {
|
||||||
toast.error('Error Create Currency');
|
toast.error('Error Create Currency');
|
||||||
@ -97,9 +105,9 @@ const EditDialog = () => {
|
|||||||
setFormField((prev) => ({
|
setFormField((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
status: response.data.status,
|
status: response.data.status,
|
||||||
code:response.data.code,
|
code: response.data.code,
|
||||||
name:response.data.name,
|
name: response.data.name,
|
||||||
prefix:response.data.prefix,
|
prefix: response.data.prefix
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
// console.log('form fieldd Transaction Type: ', formField);
|
// console.log('form fieldd Transaction Type: ', formField);
|
||||||
|
|||||||
@ -31,6 +31,7 @@ import {
|
|||||||
CommandItem,
|
CommandItem,
|
||||||
CommandList
|
CommandList
|
||||||
} from '@/components/ui/command';
|
} from '@/components/ui/command';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
export interface CustomerProps {
|
export interface CustomerProps {
|
||||||
id: string;
|
id: string;
|
||||||
@ -50,7 +51,7 @@ const API_URL_MASTERDATA = apiConfig.service_master_data;
|
|||||||
const API_URL_TRANSACTION = apiConfig.service_transaction;
|
const API_URL_TRANSACTION = apiConfig.service_transaction;
|
||||||
|
|
||||||
const AddDialog = () => {
|
const AddDialog = () => {
|
||||||
const { showAddDialog, handleAddDialog } = useManageProviderContext();
|
const { showAddDialog, handleAddDialog, selectedProvider } = useManageProviderContext();
|
||||||
const { reload } = useDataGrid();
|
const { reload } = useDataGrid();
|
||||||
const { PostData, GetData } = useCallApi();
|
const { PostData, GetData } = useCallApi();
|
||||||
const parentRef = useRef<any | null>(null);
|
const parentRef = useRef<any | null>(null);
|
||||||
@ -91,6 +92,13 @@ const AddDialog = () => {
|
|||||||
resetForm();
|
resetForm();
|
||||||
handleAddDialog(false);
|
handleAddDialog(false);
|
||||||
toast.success('Success Create Provider');
|
toast.success('Success Create Provider');
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Provider',
|
||||||
|
description: `Create Provider => ${selectedProvider}`,
|
||||||
|
action: 'C'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
reload();
|
reload();
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed Create Provider');
|
toast.error('Failed Create Provider');
|
||||||
|
|||||||
@ -4,8 +4,16 @@ import { Alert, useDataGrid } from '@/components';
|
|||||||
import { useCallApi } from '@/hooks';
|
import { useCallApi } from '@/hooks';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
import {
|
||||||
|
Dialog,
|
||||||
|
DialogContent,
|
||||||
|
DialogDescription,
|
||||||
|
DialogFooter,
|
||||||
|
DialogHeader,
|
||||||
|
DialogTitle
|
||||||
|
} from '@/components/ui/dialog';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
const API_URL = apiConfig.service_master_data;
|
const API_URL = apiConfig.service_master_data;
|
||||||
|
|
||||||
@ -29,6 +37,13 @@ const DeleteDialog = () => {
|
|||||||
setAlert({ show: false, message: '' });
|
setAlert({ show: false, message: '' });
|
||||||
handleDeleteDialog(false, null);
|
handleDeleteDialog(false, null);
|
||||||
toast.success('Success Delete Provider');
|
toast.success('Success Delete Provider');
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Provider',
|
||||||
|
description: `Delete Provider => ${selectedProvider}`,
|
||||||
|
action: 'D'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
reload();
|
reload();
|
||||||
} else {
|
} else {
|
||||||
setAlert({ show: true, message: response?.message });
|
setAlert({ show: true, message: response?.message });
|
||||||
|
|||||||
@ -32,6 +32,7 @@ import {
|
|||||||
CommandItem,
|
CommandItem,
|
||||||
CommandList
|
CommandList
|
||||||
} from '@/components/ui/command';
|
} from '@/components/ui/command';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
const API_URL_CUSTOMER = apiConfig.service_customer;
|
const API_URL_CUSTOMER = apiConfig.service_customer;
|
||||||
const API_URL_MASTERDATA = apiConfig.service_master_data;
|
const API_URL_MASTERDATA = apiConfig.service_master_data;
|
||||||
@ -82,6 +83,13 @@ const EditDialog = () => {
|
|||||||
resetForm();
|
resetForm();
|
||||||
handleEditDialog(false, null);
|
handleEditDialog(false, null);
|
||||||
toast.success('Provider updated successfully.');
|
toast.success('Provider updated successfully.');
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Provider',
|
||||||
|
description: `Update Provider => ${selectedProvider}`,
|
||||||
|
action: 'U'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
reload();
|
reload();
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed to update provider.');
|
toast.error('Failed to update provider.');
|
||||||
@ -308,11 +316,11 @@ const EditDialog = () => {
|
|||||||
</label>
|
</label>
|
||||||
<Popover open={open} onOpenChange={setOpen}>
|
<Popover open={open} onOpenChange={setOpen}>
|
||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="input col-span-5 text-left"
|
className="input col-span-5 text-left"
|
||||||
style={{ color: 'inherit' }}
|
style={{ color: 'inherit' }}
|
||||||
>
|
>
|
||||||
{customers.find((customer) => customer.id === formField.agent)
|
{customers.find((customer) => customer.id === formField.agent)
|
||||||
?.fullname || 'Select Agent'}
|
?.fullname || 'Select Agent'}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@ -21,10 +21,11 @@ import {
|
|||||||
SelectTrigger,
|
SelectTrigger,
|
||||||
SelectValue
|
SelectValue
|
||||||
} from '@/components/ui/select';
|
} from '@/components/ui/select';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
const API_URL = apiConfig.service_dashboard;
|
const API_URL = apiConfig.service_dashboard;
|
||||||
const AddDialog = () => {
|
const AddDialog = () => {
|
||||||
const { showAddDialog, handleAddDialog, parents } = useManageMenusContext();
|
const { showAddDialog, handleAddDialog, parents, selectedMenu } = useManageMenusContext();
|
||||||
const { reload } = useDataGrid();
|
const { reload } = useDataGrid();
|
||||||
const { PostData } = useCallApi();
|
const { PostData } = useCallApi();
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
@ -66,6 +67,13 @@ const AddDialog = () => {
|
|||||||
handleAddDialog(false);
|
handleAddDialog(false);
|
||||||
resetForm();
|
resetForm();
|
||||||
toast.success('Success Create Menu');
|
toast.success('Success Create Menu');
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Menu',
|
||||||
|
description: `Create Menu => ${selectedMenu}`,
|
||||||
|
action: 'C'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
reload();
|
reload();
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed Create Menu');
|
toast.error('Failed Create Menu');
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import {
|
|||||||
} from '@/components/ui/dialog';
|
} from '@/components/ui/dialog';
|
||||||
import { EnforceSwitch } from '@/components/switch';
|
import { EnforceSwitch } from '@/components/switch';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
const API_URL = apiConfig.service_dashboard;
|
const API_URL = apiConfig.service_dashboard;
|
||||||
const DeleteDialog = () => {
|
const DeleteDialog = () => {
|
||||||
@ -34,6 +35,13 @@ const DeleteDialog = () => {
|
|||||||
setAlert((prev) => ({ ...prev, show: false, message: '' }));
|
setAlert((prev) => ({ ...prev, show: false, message: '' }));
|
||||||
handleDeleteDialog(false, null);
|
handleDeleteDialog(false, null);
|
||||||
toast.success('Success Delete Menu');
|
toast.success('Success Delete Menu');
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Menu',
|
||||||
|
description: `DeleteMenu => ${selectedMenu}`,
|
||||||
|
action: 'D'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
reload();
|
reload();
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed Delete Menu');
|
toast.error('Failed Delete Menu');
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import {
|
|||||||
SelectTrigger,
|
SelectTrigger,
|
||||||
SelectValue
|
SelectValue
|
||||||
} from '@/components/ui/select';
|
} from '@/components/ui/select';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
const API_URL = apiConfig.service_dashboard;
|
const API_URL = apiConfig.service_dashboard;
|
||||||
|
|
||||||
@ -69,6 +70,13 @@ const EditDialog = () => {
|
|||||||
handleEditDialog(false, null);
|
handleEditDialog(false, null);
|
||||||
resetForm();
|
resetForm();
|
||||||
toast.success('Success Update Menu');
|
toast.success('Success Update Menu');
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Menu',
|
||||||
|
description: `Update Menu => ${selectedMenu}`,
|
||||||
|
action: 'U'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
reload();
|
reload();
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed Update Menu');
|
toast.error('Failed Update Menu');
|
||||||
|
|||||||
Reference in New Issue
Block a user