add create activity on 4 modules: Provider, Conversion, Menu, Currency

This commit is contained in:
bagusajisaputroo
2025-04-07 16:17:00 +07:00
parent 5e719eefa2
commit 10937bceeb
12 changed files with 114 additions and 11 deletions

View File

@ -31,6 +31,7 @@ import {
CommandItem,
CommandList
} from '@/components/ui/command';
import { doSaveLogActivity } from '@/actions/GlobalActions';
export interface CustomerProps {
id: string;
@ -50,7 +51,7 @@ const API_URL_MASTERDATA = apiConfig.service_master_data;
const API_URL_TRANSACTION = apiConfig.service_transaction;
const AddDialog = () => {
const { showAddDialog, handleAddDialog } = useManageProviderContext();
const { showAddDialog, handleAddDialog, selectedProvider } = useManageProviderContext();
const { reload } = useDataGrid();
const { PostData, GetData } = useCallApi();
const parentRef = useRef<any | null>(null);
@ -91,6 +92,13 @@ const AddDialog = () => {
resetForm();
handleAddDialog(false);
toast.success('Success Create Provider');
const createActivity = {
module: 'Manage Provider',
description: `Create Provider => ${selectedProvider}`,
action: 'C'
};
doSaveLogActivity(createActivity);
reload();
} else {
toast.error('Failed Create Provider');

View File

@ -4,8 +4,16 @@ import { Alert, useDataGrid } from '@/components';
import { useCallApi } from '@/hooks';
import { useCallback, useState } from 'react';
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 { doSaveLogActivity } from '@/actions/GlobalActions';
const API_URL = apiConfig.service_master_data;
@ -29,6 +37,13 @@ const DeleteDialog = () => {
setAlert({ show: false, message: '' });
handleDeleteDialog(false, null);
toast.success('Success Delete Provider');
const createActivity = {
module: 'Manage Provider',
description: `Delete Provider => ${selectedProvider}`,
action: 'D'
};
doSaveLogActivity(createActivity);
reload();
} else {
setAlert({ show: true, message: response?.message });

View File

@ -32,6 +32,7 @@ import {
CommandItem,
CommandList
} from '@/components/ui/command';
import { doSaveLogActivity } from '@/actions/GlobalActions';
const API_URL_CUSTOMER = apiConfig.service_customer;
const API_URL_MASTERDATA = apiConfig.service_master_data;
@ -82,6 +83,13 @@ const EditDialog = () => {
resetForm();
handleEditDialog(false, null);
toast.success('Provider updated successfully.');
const createActivity = {
module: 'Manage Provider',
description: `Update Provider => ${selectedProvider}`,
action: 'U'
};
doSaveLogActivity(createActivity);
reload();
} else {
toast.error('Failed to update provider.');
@ -308,11 +316,11 @@ const EditDialog = () => {
</label>
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<button
type="button"
className="input col-span-5 text-left"
style={{ color: 'inherit' }}
>
<button
type="button"
className="input col-span-5 text-left"
style={{ color: 'inherit' }}
>
{customers.find((customer) => customer.id === formField.agent)
?.fullname || 'Select Agent'}
</button>