add activity dialog on municipios, postoadm, sucos, and aldeias
This commit is contained in:
@ -24,6 +24,7 @@ import {
|
|||||||
CommandItem,
|
CommandItem,
|
||||||
CommandList
|
CommandList
|
||||||
} from '@/components/ui/command';
|
} from '@/components/ui/command';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
interface SucosProps {
|
interface SucosProps {
|
||||||
sucos_id: number;
|
sucos_id: number;
|
||||||
@ -34,7 +35,7 @@ const API_URL = apiConfig.service_master_data;
|
|||||||
|
|
||||||
const AddDialog = () => {
|
const AddDialog = () => {
|
||||||
const parentRef = useRef<any | null>(null);
|
const parentRef = useRef<any | null>(null);
|
||||||
const { showAddDialog, handleAddDialog } = useManageAldeiasContext();
|
const { showAddDialog, handleAddDialog, selectedAldeias } = useManageAldeiasContext();
|
||||||
const { reload } = useDataGrid();
|
const { reload } = useDataGrid();
|
||||||
const { PostData, GetData } = useCallApi();
|
const { PostData, GetData } = useCallApi();
|
||||||
const parsedUser = getAuth()?.user;
|
const parsedUser = getAuth()?.user;
|
||||||
@ -70,6 +71,13 @@ const AddDialog = () => {
|
|||||||
handleAddDialog(false);
|
handleAddDialog(false);
|
||||||
toast.success('Success Create Aldeias');
|
toast.success('Success Create Aldeias');
|
||||||
reload();
|
reload();
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Aldeias',
|
||||||
|
description: `Create Aldeias => ${selectedAldeias}`,
|
||||||
|
action: 'C'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
toast.error('Error Create Aldeias');
|
toast.error('Error Create Aldeias');
|
||||||
setAlert({ show: true, message: 'Failed to create Aldeias. Please try again.' });
|
setAlert({ show: true, message: 'Failed to create Aldeias. Please try again.' });
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import {
|
|||||||
CommandItem,
|
CommandItem,
|
||||||
CommandList
|
CommandList
|
||||||
} from '@/components/ui/command';
|
} from '@/components/ui/command';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
interface SucosProps {
|
interface SucosProps {
|
||||||
sucos_id: number;
|
sucos_id: number;
|
||||||
@ -69,6 +70,13 @@ const EditDialog = () => {
|
|||||||
handleEditDialog(false, null);
|
handleEditDialog(false, null);
|
||||||
toast.success('Success Update Aldeias');
|
toast.success('Success Update Aldeias');
|
||||||
reload();
|
reload();
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Aldeias',
|
||||||
|
description: `Edit Aldeias => ${selectedAldeias}`,
|
||||||
|
action: 'U'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
toast.error('Error Update Aldeias');
|
toast.error('Error Update Aldeias');
|
||||||
setAlert({ show: true, message: 'Error Update Aldeias' });
|
setAlert({ show: true, message: 'Error Update Aldeias' });
|
||||||
|
|||||||
@ -55,13 +55,13 @@ const AddDialog = () => {
|
|||||||
resetForm();
|
resetForm();
|
||||||
reload();
|
reload();
|
||||||
toast.success('Municipio created successfully!');
|
toast.success('Municipio created successfully!');
|
||||||
// const createActivity = {
|
const createActivity = {
|
||||||
// module: 'Manage Municipio',
|
module: 'Manage Municipio',
|
||||||
// description: `Create Municipio => ${selectedMunicipios}`,
|
description: `Create Municipio => ${selectedMunicipios}`,
|
||||||
// action: 'C'
|
action: 'C'
|
||||||
// };
|
};
|
||||||
|
|
||||||
// doSaveLogActivity(createActivity);
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed to create municipio.');
|
toast.error('Failed to create municipio.');
|
||||||
setAlert({ show: true, message: 'Failed to create municipio. Please try again.' });
|
setAlert({ show: true, message: 'Failed to create municipio. Please try again.' });
|
||||||
|
|||||||
@ -60,13 +60,13 @@ const EditDialog = () => {
|
|||||||
resetForm();
|
resetForm();
|
||||||
toast.success('Success update municipio');
|
toast.success('Success update municipio');
|
||||||
reload();
|
reload();
|
||||||
// const createActivity = {
|
const createActivity = {
|
||||||
// module: 'Manage Municipio',
|
module: 'Manage Municipio',
|
||||||
// description: `Edit Municipio => ${selectedMunicipios}`,
|
description: `Edit Municipio => ${selectedMunicipios}`,
|
||||||
// action: 'U'
|
action: 'U'
|
||||||
// };
|
};
|
||||||
|
|
||||||
// doSaveLogActivity(createActivity);
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed update user');
|
toast.error('Failed update user');
|
||||||
setAlert({ show: true, message: 'Failed to update municipio. Please try again.' });
|
setAlert({ show: true, message: 'Failed to update municipio. Please try again.' });
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import {
|
|||||||
CommandItem,
|
CommandItem,
|
||||||
CommandList
|
CommandList
|
||||||
} from '@/components/ui/command';
|
} from '@/components/ui/command';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
interface MunicipioProps {
|
interface MunicipioProps {
|
||||||
id: number;
|
id: number;
|
||||||
@ -34,7 +35,7 @@ const API_URL = apiConfig.service_master_data;
|
|||||||
|
|
||||||
const AddDialog = () => {
|
const AddDialog = () => {
|
||||||
const parentRef = useRef<any | null>(null);
|
const parentRef = useRef<any | null>(null);
|
||||||
const { showAddDialog, handleAddDialog } = useManagePostoAdmsContext();
|
const { showAddDialog, handleAddDialog, selectedPostoAdms } = useManagePostoAdmsContext();
|
||||||
const { reload } = useDataGrid();
|
const { reload } = useDataGrid();
|
||||||
const { PostData, GetData } = useCallApi();
|
const { PostData, GetData } = useCallApi();
|
||||||
const parsedUser = getAuth()?.user;
|
const parsedUser = getAuth()?.user;
|
||||||
@ -72,6 +73,13 @@ const AddDialog = () => {
|
|||||||
resetForm();
|
resetForm();
|
||||||
reload();
|
reload();
|
||||||
toast.success('Posto Adm created successfully!');
|
toast.success('Posto Adm created successfully!');
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Posto Administrativo',
|
||||||
|
description: `Create PostoAdms => ${selectedPostoAdms}`,
|
||||||
|
action: 'C'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed to create Posto Adm. Please try again.');
|
toast.error('Failed to create Posto Adm. Please try again.');
|
||||||
setAlert({ show: true, message: 'Failed to create Posto Adm. Please try again.' });
|
setAlert({ show: true, message: 'Failed to create Posto Adm. Please try again.' });
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import {
|
|||||||
CommandItem,
|
CommandItem,
|
||||||
CommandList
|
CommandList
|
||||||
} from '@/components/ui/command';
|
} from '@/components/ui/command';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
interface MunicipioProps {
|
interface MunicipioProps {
|
||||||
id: number;
|
id: number;
|
||||||
@ -72,6 +73,14 @@ const EditDialog = () => {
|
|||||||
resetForm();
|
resetForm();
|
||||||
toast.success('Success Update Posto Adm');
|
toast.success('Success Update Posto Adm');
|
||||||
reload();
|
reload();
|
||||||
|
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Posto Administrativo',
|
||||||
|
description: `Edit PostoAdms => ${selectedPostoAdms}`,
|
||||||
|
action: 'U'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
toast.error('Error Update Posto Adm');
|
toast.error('Error Update Posto Adm');
|
||||||
setAlert({ show: true, message: 'Failed to update posto adm. Please try again.' });
|
setAlert({ show: true, message: 'Failed to update posto adm. Please try again.' });
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import {
|
|||||||
CommandItem,
|
CommandItem,
|
||||||
CommandList
|
CommandList
|
||||||
} from '@/components/ui/command';
|
} from '@/components/ui/command';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
interface PostoAdmsProps {
|
interface PostoAdmsProps {
|
||||||
PostoAdms_id: number;
|
PostoAdms_id: number;
|
||||||
@ -33,7 +34,7 @@ const API_URL = apiConfig.service_master_data;
|
|||||||
|
|
||||||
const AddDialog = () => {
|
const AddDialog = () => {
|
||||||
const parentRef = useRef<any | null>(null);
|
const parentRef = useRef<any | null>(null);
|
||||||
const { showAddDialog, handleAddDialog } = useManageSucosContext();
|
const { showAddDialog, handleAddDialog, selectedSucos } = useManageSucosContext();
|
||||||
const { reload } = useDataGrid();
|
const { reload } = useDataGrid();
|
||||||
const { PostData, GetData } = useCallApi();
|
const { PostData, GetData } = useCallApi();
|
||||||
const parsedUser = getAuth()?.user;
|
const parsedUser = getAuth()?.user;
|
||||||
@ -69,6 +70,13 @@ const AddDialog = () => {
|
|||||||
handleAddDialog(false);
|
handleAddDialog(false);
|
||||||
reload();
|
reload();
|
||||||
toast.success('Sucos created successfully!');
|
toast.success('Sucos created successfully!');
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Sucos',
|
||||||
|
description: `Create Sucos => ${selectedSucos}`,
|
||||||
|
action: 'C'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed to create Sucos Please try again.');
|
toast.error('Failed to create Sucos Please try again.');
|
||||||
setAlert({ show: true, message: 'Failed to create Sucos Please try again.' });
|
setAlert({ show: true, message: 'Failed to create Sucos Please try again.' });
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import {
|
|||||||
CommandItem,
|
CommandItem,
|
||||||
CommandList
|
CommandList
|
||||||
} from '@/components/ui/command';
|
} from '@/components/ui/command';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
interface PostoAdmsProps {
|
interface PostoAdmsProps {
|
||||||
PostoAdms_id: number; // Ubah ke PostoAdms_id
|
PostoAdms_id: number; // Ubah ke PostoAdms_id
|
||||||
@ -76,6 +77,13 @@ const EditDialog = () => {
|
|||||||
handleEditDialog(false, null);
|
handleEditDialog(false, null);
|
||||||
toast.success('Success Update Sucos');
|
toast.success('Success Update Sucos');
|
||||||
reload();
|
reload();
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Sucos',
|
||||||
|
description: `Edit Sucos => ${selectedSucos}`,
|
||||||
|
action: 'U'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed Update Sucos');
|
toast.error('Failed Update Sucos');
|
||||||
setAlert({ show: true, message: 'Failed Update Sucos. Please try again' });
|
setAlert({ show: true, message: 'Failed Update Sucos. Please try again' });
|
||||||
|
|||||||
Reference in New Issue
Block a user