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

@ -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');