add activity dialog on master data module
This commit is contained in:
@ -4,8 +4,16 @@ import { useCallApi } from '@/hooks';
|
||||
import { useCallback, useState } from 'react';
|
||||
import { apiConfig } from '@/config/api.config';
|
||||
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;
|
||||
|
||||
@ -24,16 +32,22 @@ const DeleteDialog = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await DeleteData(
|
||||
`${API_URL}/postoadms/delete/${selectedPostoAdms}/false`,
|
||||
{ id: selectedPostoAdms }
|
||||
);
|
||||
const response = await DeleteData(`${API_URL}/postoadms/delete/${selectedPostoAdms}/false`, {
|
||||
id: selectedPostoAdms
|
||||
});
|
||||
|
||||
if (response?.status) {
|
||||
setAlert({ show: false, message: '' });
|
||||
handleDeleteDialog(false, null);
|
||||
toast.success('Success Delete Posto Adm');
|
||||
reload();
|
||||
const createActivity = {
|
||||
module: 'Manage Posto Administrativo',
|
||||
description: `Edit PostoAdms => ${selectedPostoAdms}`,
|
||||
action: 'D'
|
||||
};
|
||||
|
||||
doSaveLogActivity(createActivity);
|
||||
} else {
|
||||
setAlert({ show: true, message: response?.message });
|
||||
toast.error('Failed Delete Posto Adm');
|
||||
|
||||
Reference in New Issue
Block a user