This commit is contained in:
Raja Oktafrianto
2025-04-08 11:19:17 +07:00
59 changed files with 1622 additions and 221 deletions

View File

@ -24,6 +24,7 @@ import {
CommandItem,
CommandList
} from '@/components/ui/command';
import { doSaveLogActivity } from '@/actions/GlobalActions';
interface PostoAdmsProps {
PostoAdms_id: number;
@ -33,7 +34,7 @@ const API_URL = apiConfig.service_master_data;
const AddDialog = () => {
const parentRef = useRef<any | null>(null);
const { showAddDialog, handleAddDialog } = useManageSucosContext();
const { showAddDialog, handleAddDialog, selectedSucos } = useManageSucosContext();
const { reload } = useDataGrid();
const { PostData, GetData } = useCallApi();
const parsedUser = getAuth()?.user;
@ -69,6 +70,13 @@ const AddDialog = () => {
handleAddDialog(false);
reload();
toast.success('Sucos created successfully!');
const createActivity = {
module: 'Manage Sucos',
description: `Create Suco => ${formField.name}`,
action: 'C'
};
doSaveLogActivity(createActivity);
} else {
toast.error('Failed to create Sucos Please try again.');
setAlert({ show: true, message: 'Failed to create Sucos Please try again.' });

View File

@ -4,8 +4,16 @@ import { useCallback, useState } from 'react';
import { useCallApi } from '@/hooks';
import { Alert, useDataGrid } from '@/components';
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;
@ -31,6 +39,13 @@ const DeleteDialog = () => {
handleDeleteDialog(false, null);
toast.success('Success Delete Sucos');
reload();
const createActivity = {
module: 'Manage Sucos',
description: `Delete Suco => ${selectedSucos}`,
action: 'D'
};
doSaveLogActivity(createActivity);
} else {
setAlert({ show: true, message: response?.message });
toast.error('Failed Delete Sucos');

View File

@ -24,6 +24,7 @@ import {
CommandItem,
CommandList
} from '@/components/ui/command';
import { doSaveLogActivity } from '@/actions/GlobalActions';
interface PostoAdmsProps {
PostoAdms_id: number; // Ubah ke PostoAdms_id
@ -76,6 +77,13 @@ const EditDialog = () => {
handleEditDialog(false, null);
toast.success('Success Update Sucos');
reload();
const createActivity = {
module: 'Manage Sucos',
description: `Edit Suco => ${selectedSucos}`,
action: 'U'
};
doSaveLogActivity(createActivity);
} else {
toast.error('Failed Update Sucos');
setAlert({ show: true, message: 'Failed Update Sucos. Please try again' });

View File

@ -153,7 +153,7 @@ const ManageSucosContextProvider = ({ children }: { children: React.ReactNode })
const response = await GetData(`${API_URL}/sucos/list`, {
limit: limit,
page: page + 1,
with_deleted: true,
with_deleted: false,
order_field: sorting[0].id,
order_direction: sorting[0].desc == false ? 'ASC' : 'DESC',
filter: JSON.stringify(filter)