add activity dialog on master data module
This commit is contained in:
@ -56,7 +56,7 @@ const AddDialog = () => {
|
||||
reload();
|
||||
toast.success('Municipio created successfully!');
|
||||
const createActivity = {
|
||||
module: 'Manage Municipio',
|
||||
module: 'Manage Municipios',
|
||||
description: `Create Municipio => ${selectedMunicipios}`,
|
||||
action: 'C'
|
||||
};
|
||||
|
||||
@ -4,9 +4,16 @@ import { useCallback, useState } from 'react';
|
||||
import { apiConfig } from '@/config/api.config';
|
||||
import { useCallApi } from '@/hooks';
|
||||
import { toast } from 'sonner';
|
||||
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle
|
||||
} from '@/components/ui/dialog';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { DialogDescription } from '@radix-ui/react-dialog';
|
||||
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||
|
||||
const API_URL = apiConfig.service_master_data;
|
||||
|
||||
@ -25,16 +32,23 @@ const DeleteDialog = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await DeleteData(
|
||||
`${API_URL}/municipios/delete/${selectedMunicipios}/false`,
|
||||
{ id: selectedMunicipios }
|
||||
);
|
||||
const response = await DeleteData(`${API_URL}/municipios/delete/${selectedMunicipios}/false`, {
|
||||
id: selectedMunicipios
|
||||
});
|
||||
|
||||
if (response?.status) {
|
||||
setAlert({ show: false, message: '' });
|
||||
handleDeleteDialog(false, null);
|
||||
toast.success('Success Delete Municipio');
|
||||
reload();
|
||||
|
||||
const createActivity = {
|
||||
module: 'Manage Municipios',
|
||||
description: `Edit Municipio',', => ${selectedMunicipios}`,
|
||||
action: 'D'
|
||||
};
|
||||
|
||||
doSaveLogActivity(createActivity);
|
||||
} else {
|
||||
setAlert({ show: true, message: response?.message });
|
||||
toast.error('Failed Delete Municipio');
|
||||
@ -43,7 +57,6 @@ const DeleteDialog = () => {
|
||||
|
||||
return (
|
||||
<Dialog open={showDeleteDialog} onOpenChange={(open) => handleDeleteDialog(open, null)}>
|
||||
|
||||
<DialogContent className="container-fixed max-w-md flex flex-col p-5 overflow-hidden [&>button]:hidden">
|
||||
<DialogHeader className="p-0 border-0 block">
|
||||
<DialogTitle></DialogTitle>
|
||||
|
||||
@ -61,7 +61,7 @@ const EditDialog = () => {
|
||||
toast.success('Success update municipio');
|
||||
reload();
|
||||
const createActivity = {
|
||||
module: 'Manage Municipio',
|
||||
module: 'Manage Municipios',
|
||||
description: `Edit Municipio => ${selectedMunicipios}`,
|
||||
action: 'U'
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user