add activity dialog on master data module
This commit is contained in:
@ -73,7 +73,7 @@ const AddDialog = () => {
|
|||||||
reload();
|
reload();
|
||||||
const createActivity = {
|
const createActivity = {
|
||||||
module: 'Manage Aldeias',
|
module: 'Manage Aldeias',
|
||||||
description: `Create Aldeias => ${selectedAldeias}`,
|
description: `Create Aldeia => ${selectedAldeias}`,
|
||||||
action: 'C'
|
action: 'C'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import { useCallback, useState } from 'react';
|
|||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
import { Dialog, DialogContent, DialogFooter, DialogHeader } from '@/components/ui/dialog';
|
import { Dialog, DialogContent, DialogFooter, DialogHeader } from '@/components/ui/dialog';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
const API_URL = apiConfig.service_master_data;
|
const API_URL = apiConfig.service_master_data;
|
||||||
|
|
||||||
@ -33,6 +34,14 @@ const DeleteDialog = () => {
|
|||||||
handleDeleteDialog(false, null);
|
handleDeleteDialog(false, null);
|
||||||
toast.success('Success Delete Aldeias');
|
toast.success('Success Delete Aldeias');
|
||||||
reload();
|
reload();
|
||||||
|
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Aldeias',
|
||||||
|
description: `Edit Aldeia => ${selectedAldeias}`,
|
||||||
|
action: 'D'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
setAlert({ show: true, message: response?.message });
|
setAlert({ show: true, message: response?.message });
|
||||||
toast.error('Failed Delete Aldeias');
|
toast.error('Failed Delete Aldeias');
|
||||||
|
|||||||
@ -72,7 +72,7 @@ const EditDialog = () => {
|
|||||||
reload();
|
reload();
|
||||||
const createActivity = {
|
const createActivity = {
|
||||||
module: 'Manage Aldeias',
|
module: 'Manage Aldeias',
|
||||||
description: `Edit Aldeias => ${selectedAldeias}`,
|
description: `Edit Aldeia => ${selectedAldeias}`,
|
||||||
action: 'U'
|
action: 'U'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -56,7 +56,7 @@ const AddDialog = () => {
|
|||||||
reload();
|
reload();
|
||||||
toast.success('Municipio created successfully!');
|
toast.success('Municipio created successfully!');
|
||||||
const createActivity = {
|
const createActivity = {
|
||||||
module: 'Manage Municipio',
|
module: 'Manage Municipios',
|
||||||
description: `Create Municipio => ${selectedMunicipios}`,
|
description: `Create Municipio => ${selectedMunicipios}`,
|
||||||
action: 'C'
|
action: 'C'
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4,9 +4,16 @@ import { useCallback, useState } from 'react';
|
|||||||
import { apiConfig } from '@/config/api.config';
|
import { apiConfig } from '@/config/api.config';
|
||||||
import { useCallApi } from '@/hooks';
|
import { useCallApi } from '@/hooks';
|
||||||
import { toast } from 'sonner';
|
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 { Button } from '@/components/ui/button';
|
||||||
import { DialogDescription } from '@radix-ui/react-dialog';
|
import { DialogDescription } from '@radix-ui/react-dialog';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
const API_URL = apiConfig.service_master_data;
|
const API_URL = apiConfig.service_master_data;
|
||||||
|
|
||||||
@ -25,16 +32,23 @@ const DeleteDialog = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await DeleteData(
|
const response = await DeleteData(`${API_URL}/municipios/delete/${selectedMunicipios}/false`, {
|
||||||
`${API_URL}/municipios/delete/${selectedMunicipios}/false`,
|
id: selectedMunicipios
|
||||||
{ id: selectedMunicipios }
|
});
|
||||||
);
|
|
||||||
|
|
||||||
if (response?.status) {
|
if (response?.status) {
|
||||||
setAlert({ show: false, message: '' });
|
setAlert({ show: false, message: '' });
|
||||||
handleDeleteDialog(false, null);
|
handleDeleteDialog(false, null);
|
||||||
toast.success('Success Delete Municipio');
|
toast.success('Success Delete Municipio');
|
||||||
reload();
|
reload();
|
||||||
|
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Municipios',
|
||||||
|
description: `Edit Municipio',', => ${selectedMunicipios}`,
|
||||||
|
action: 'D'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
setAlert({ show: true, message: response?.message });
|
setAlert({ show: true, message: response?.message });
|
||||||
toast.error('Failed Delete Municipio');
|
toast.error('Failed Delete Municipio');
|
||||||
@ -43,7 +57,6 @@ const DeleteDialog = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={showDeleteDialog} onOpenChange={(open) => handleDeleteDialog(open, null)}>
|
<Dialog open={showDeleteDialog} onOpenChange={(open) => handleDeleteDialog(open, null)}>
|
||||||
|
|
||||||
<DialogContent className="container-fixed max-w-md flex flex-col p-5 overflow-hidden [&>button]:hidden">
|
<DialogContent className="container-fixed max-w-md flex flex-col p-5 overflow-hidden [&>button]:hidden">
|
||||||
<DialogHeader className="p-0 border-0 block">
|
<DialogHeader className="p-0 border-0 block">
|
||||||
<DialogTitle></DialogTitle>
|
<DialogTitle></DialogTitle>
|
||||||
|
|||||||
@ -61,7 +61,7 @@ const EditDialog = () => {
|
|||||||
toast.success('Success update municipio');
|
toast.success('Success update municipio');
|
||||||
reload();
|
reload();
|
||||||
const createActivity = {
|
const createActivity = {
|
||||||
module: 'Manage Municipio',
|
module: 'Manage Municipios',
|
||||||
description: `Edit Municipio => ${selectedMunicipios}`,
|
description: `Edit Municipio => ${selectedMunicipios}`,
|
||||||
action: 'U'
|
action: 'U'
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4,8 +4,16 @@ import { useCallApi } from '@/hooks';
|
|||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { apiConfig } from '@/config/api.config';
|
import { apiConfig } from '@/config/api.config';
|
||||||
import { toast } from 'sonner';
|
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 { Button } from '@/components/ui/button';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
const API_URL = apiConfig.service_master_data;
|
const API_URL = apiConfig.service_master_data;
|
||||||
|
|
||||||
@ -24,16 +32,22 @@ const DeleteDialog = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await DeleteData(
|
const response = await DeleteData(`${API_URL}/postoadms/delete/${selectedPostoAdms}/false`, {
|
||||||
`${API_URL}/postoadms/delete/${selectedPostoAdms}/false`,
|
id: selectedPostoAdms
|
||||||
{ id: selectedPostoAdms }
|
});
|
||||||
);
|
|
||||||
|
|
||||||
if (response?.status) {
|
if (response?.status) {
|
||||||
setAlert({ show: false, message: '' });
|
setAlert({ show: false, message: '' });
|
||||||
handleDeleteDialog(false, null);
|
handleDeleteDialog(false, null);
|
||||||
toast.success('Success Delete Posto Adm');
|
toast.success('Success Delete Posto Adm');
|
||||||
reload();
|
reload();
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Posto Administrativo',
|
||||||
|
description: `Edit PostoAdms => ${selectedPostoAdms}`,
|
||||||
|
action: 'D'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
setAlert({ show: true, message: response?.message });
|
setAlert({ show: true, message: response?.message });
|
||||||
toast.error('Failed Delete Posto Adm');
|
toast.error('Failed Delete Posto Adm');
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import {
|
|||||||
SelectTrigger,
|
SelectTrigger,
|
||||||
SelectValue
|
SelectValue
|
||||||
} from '@/components/ui/select';
|
} from '@/components/ui/select';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
interface ProviderProps {
|
interface ProviderProps {
|
||||||
provider_id: number;
|
provider_id: number;
|
||||||
@ -32,7 +33,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 parsedUser = getAuth()?.user;
|
const parsedUser = getAuth()?.user;
|
||||||
const { showAddDialog, handleAddDialog } = useManageProductsContext();
|
const { showAddDialog, handleAddDialog, selectedProducts } = useManageProductsContext();
|
||||||
const { PostData, GetData } = useCallApi();
|
const { PostData, GetData } = useCallApi();
|
||||||
const { reload } = useDataGrid();
|
const { reload } = useDataGrid();
|
||||||
const [alert, setAlert] = useState({
|
const [alert, setAlert] = useState({
|
||||||
@ -75,6 +76,14 @@ const AddDialog = () => {
|
|||||||
handleAddDialog(false);
|
handleAddDialog(false);
|
||||||
toast.success('Success Create Product');
|
toast.success('Success Create Product');
|
||||||
reload();
|
reload();
|
||||||
|
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Products',
|
||||||
|
description: `Create Product => ${selectedProducts}`,
|
||||||
|
action: 'C'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed Create Product');
|
toast.error('Failed Create Product');
|
||||||
setAlert({ show: true, message: response?.message });
|
setAlert({ show: true, message: response?.message });
|
||||||
@ -173,9 +182,7 @@ const AddDialog = () => {
|
|||||||
className="input"
|
className="input"
|
||||||
type="text"
|
type="text"
|
||||||
value={formField.name}
|
value={formField.name}
|
||||||
onChange={(e) =>
|
onChange={(e) => setFormField({ ...formField, name: e.target.value })}
|
||||||
setFormField({ ...formField, name: e.target.value })
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -189,9 +196,7 @@ const AddDialog = () => {
|
|||||||
className="input"
|
className="input"
|
||||||
type="text"
|
type="text"
|
||||||
value={formField.type}
|
value={formField.type}
|
||||||
onChange={(e) =>
|
onChange={(e) => setFormField({ ...formField, type: e.target.value })}
|
||||||
setFormField({ ...formField, type: e.target.value })
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -205,9 +210,7 @@ const AddDialog = () => {
|
|||||||
className="input"
|
className="input"
|
||||||
type="text"
|
type="text"
|
||||||
value={formField.code}
|
value={formField.code}
|
||||||
onChange={(e) =>
|
onChange={(e) => setFormField({ ...formField, code: e.target.value })}
|
||||||
setFormField({ ...formField, code: e.target.value })
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -221,9 +224,7 @@ const AddDialog = () => {
|
|||||||
className="input"
|
className="input"
|
||||||
type="text"
|
type="text"
|
||||||
value={formField.description}
|
value={formField.description}
|
||||||
onChange={(e) =>
|
onChange={(e) => setFormField({ ...formField, description: e.target.value })}
|
||||||
setFormField({ ...formField, description: e.target.value })
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -323,9 +324,7 @@ const AddDialog = () => {
|
|||||||
</label>
|
</label>
|
||||||
<Select
|
<Select
|
||||||
value={formField.status}
|
value={formField.status}
|
||||||
onValueChange={(value) =>
|
onValueChange={(value) => setFormField({ ...formField, status: value })}
|
||||||
setFormField({ ...formField, status: value })
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<SelectTrigger>
|
<SelectTrigger>
|
||||||
<SelectValue placeholder="Select Status" />
|
<SelectValue placeholder="Select Status" />
|
||||||
|
|||||||
@ -4,8 +4,16 @@ import { Alert, useDataGrid } from '@/components';
|
|||||||
import { useCallApi } from '@/hooks';
|
import { useCallApi } from '@/hooks';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { toast } from 'sonner';
|
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 { Button } from '@/components/ui/button';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
const API_URL = apiConfig.service_master_data;
|
const API_URL = apiConfig.service_master_data;
|
||||||
|
|
||||||
@ -30,6 +38,13 @@ const DeleteDialog = () => {
|
|||||||
handleDeleteDialog(false, null);
|
handleDeleteDialog(false, null);
|
||||||
toast.success('Success Delete Product');
|
toast.success('Success Delete Product');
|
||||||
reload();
|
reload();
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Product',
|
||||||
|
description: `Edit Product',', => ${selectedProducts}`,
|
||||||
|
action: 'D'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
setAlert({ show: true, message: response?.message });
|
setAlert({ show: true, message: response?.message });
|
||||||
toast.error('Failed Delete Product');
|
toast.error('Failed Delete Product');
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import {
|
|||||||
SelectTrigger,
|
SelectTrigger,
|
||||||
SelectValue
|
SelectValue
|
||||||
} from '@/components/ui/select';
|
} from '@/components/ui/select';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
interface ProviderProps {
|
interface ProviderProps {
|
||||||
provider_id: string;
|
provider_id: string;
|
||||||
@ -74,6 +75,14 @@ const EditDialog = () => {
|
|||||||
handleEditDialog(false, null);
|
handleEditDialog(false, null);
|
||||||
toast.success('Product updated successfully.');
|
toast.success('Product updated successfully.');
|
||||||
reload();
|
reload();
|
||||||
|
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Products',
|
||||||
|
description: `Edit Product => ${selectedProducts}`,
|
||||||
|
action: 'U'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed to update Product. Please try again.');
|
toast.error('Failed to update Product. Please try again.');
|
||||||
setAlert({ show: true, message: 'Failed to update Product. Please try again.' });
|
setAlert({ show: true, message: 'Failed to update Product. Please try again.' });
|
||||||
|
|||||||
@ -15,13 +15,14 @@ import {
|
|||||||
} from '@/components/ui/dialog';
|
} from '@/components/ui/dialog';
|
||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
const API_URL = apiConfig.service_master_data;
|
const API_URL = apiConfig.service_master_data;
|
||||||
const AddDialog = () => {
|
const AddDialog = () => {
|
||||||
const parentRef = useRef<any | null>(null);
|
const parentRef = useRef<any | null>(null);
|
||||||
const { reload } = useDataGrid();
|
const { reload } = useDataGrid();
|
||||||
const { PostData } = useCallApi();
|
const { PostData } = useCallApi();
|
||||||
const { showAddDialog, handleAddDialog } = useManageProfessionContext();
|
const { showAddDialog, handleAddDialog, selectedProfession } = useManageProfessionContext();
|
||||||
const parsedUser = getAuth()?.user;
|
const parsedUser = getAuth()?.user;
|
||||||
const [alert, setAlert] = useState({
|
const [alert, setAlert] = useState({
|
||||||
show: false,
|
show: false,
|
||||||
@ -53,6 +54,14 @@ const AddDialog = () => {
|
|||||||
handleAddDialog(false);
|
handleAddDialog(false);
|
||||||
toast.success('Success Create Profession');
|
toast.success('Success Create Profession');
|
||||||
reload();
|
reload();
|
||||||
|
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Profession',
|
||||||
|
description: `Create Profession => ${selectedProfession}`,
|
||||||
|
action: 'C'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed Create Profession');
|
toast.error('Failed Create Profession');
|
||||||
setAlert({ show: true, message: response?.message });
|
setAlert({ show: true, message: response?.message });
|
||||||
|
|||||||
@ -4,8 +4,16 @@ import { Alert, useDataGrid } from '@/components';
|
|||||||
import { useCallApi } from '@/hooks';
|
import { useCallApi } from '@/hooks';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { toast } from 'sonner';
|
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 { Button } from '@/components/ui/button';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
const API_URL = apiConfig.service_master_data;
|
const API_URL = apiConfig.service_master_data;
|
||||||
|
|
||||||
@ -29,6 +37,13 @@ const DeleteDialog = () => {
|
|||||||
handleDeleteDialog(false, null);
|
handleDeleteDialog(false, null);
|
||||||
toast.success('Success Delete Profession');
|
toast.success('Success Delete Profession');
|
||||||
reload();
|
reload();
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Profession',
|
||||||
|
description: `Edit Profession', => ${selectedProfession}`,
|
||||||
|
action: 'D'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
setAlert({ show: true, message: response?.message });
|
setAlert({ show: true, message: response?.message });
|
||||||
toast.error('Failed Delete Profession');
|
toast.error('Failed Delete Profession');
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import {
|
|||||||
} from '@/components/ui/dialog';
|
} from '@/components/ui/dialog';
|
||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
const API_URL = apiConfig.service_master_data;
|
const API_URL = apiConfig.service_master_data;
|
||||||
const EditDialog = () => {
|
const EditDialog = () => {
|
||||||
@ -54,6 +55,14 @@ const EditDialog = () => {
|
|||||||
handleEditDialog(false, null);
|
handleEditDialog(false, null);
|
||||||
toast.success('Success Update Profession');
|
toast.success('Success Update Profession');
|
||||||
reload();
|
reload();
|
||||||
|
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Profession',
|
||||||
|
description: `Edit Profession => ${selectedProfession}`,
|
||||||
|
action: 'U'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed Update Profession');
|
toast.error('Failed Update Profession');
|
||||||
setAlert({ show: true, message: 'Failed Update Profession' });
|
setAlert({ show: true, message: 'Failed Update Profession' });
|
||||||
|
|||||||
@ -72,7 +72,7 @@ const AddDialog = () => {
|
|||||||
toast.success('Sucos created successfully!');
|
toast.success('Sucos created successfully!');
|
||||||
const createActivity = {
|
const createActivity = {
|
||||||
module: 'Manage Sucos',
|
module: 'Manage Sucos',
|
||||||
description: `Create Sucos => ${selectedSucos}`,
|
description: `Create Suco => ${selectedSucos}`,
|
||||||
action: 'C'
|
action: 'C'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,16 @@ import { useCallback, useState } from 'react';
|
|||||||
import { useCallApi } from '@/hooks';
|
import { useCallApi } from '@/hooks';
|
||||||
import { Alert, useDataGrid } from '@/components';
|
import { Alert, useDataGrid } from '@/components';
|
||||||
import { toast } from 'sonner';
|
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 { Button } from '@/components/ui/button';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
const API_URL = apiConfig.service_master_data;
|
const API_URL = apiConfig.service_master_data;
|
||||||
|
|
||||||
@ -31,6 +39,13 @@ const DeleteDialog = () => {
|
|||||||
handleDeleteDialog(false, null);
|
handleDeleteDialog(false, null);
|
||||||
toast.success('Success Delete Sucos');
|
toast.success('Success Delete Sucos');
|
||||||
reload();
|
reload();
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Sucos',
|
||||||
|
description: `Edit Suco => ${selectedSucos}`,
|
||||||
|
action: 'D'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
setAlert({ show: true, message: response?.message });
|
setAlert({ show: true, message: response?.message });
|
||||||
toast.error('Failed Delete Sucos');
|
toast.error('Failed Delete Sucos');
|
||||||
|
|||||||
@ -79,7 +79,7 @@ const EditDialog = () => {
|
|||||||
reload();
|
reload();
|
||||||
const createActivity = {
|
const createActivity = {
|
||||||
module: 'Manage Sucos',
|
module: 'Manage Sucos',
|
||||||
description: `Edit Sucos => ${selectedSucos}`,
|
description: `Edit Suco => ${selectedSucos}`,
|
||||||
action: 'U'
|
action: 'U'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import {
|
|||||||
} from '@/components/ui/select';
|
} from '@/components/ui/select';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Checkbox } from '@/components/ui/checkbox';
|
import { Checkbox } from '@/components/ui/checkbox';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
interface CurrencyProps {
|
interface CurrencyProps {
|
||||||
ID: string;
|
ID: string;
|
||||||
@ -42,7 +43,7 @@ const API_URL_WALLET = apiConfig.service_wallet;
|
|||||||
const API_URL_MASTER_DATA = apiConfig.service_master_data;
|
const API_URL_MASTER_DATA = apiConfig.service_master_data;
|
||||||
|
|
||||||
const AddDialog = () => {
|
const AddDialog = () => {
|
||||||
const { showAddDialog, handleAddDialog } = useManageWalletContext();
|
const { showAddDialog, handleAddDialog, selectedWallet } = useManageWalletContext();
|
||||||
const { GetData, PostData } = useCallApi();
|
const { GetData, PostData } = useCallApi();
|
||||||
const { reload } = useDataGrid();
|
const { reload } = useDataGrid();
|
||||||
const [alert, setAlert] = useState({
|
const [alert, setAlert] = useState({
|
||||||
@ -101,6 +102,14 @@ const AddDialog = () => {
|
|||||||
handleAddDialog(false);
|
handleAddDialog(false);
|
||||||
toast.success('Success Create Wallet');
|
toast.success('Success Create Wallet');
|
||||||
reload();
|
reload();
|
||||||
|
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Wallet',
|
||||||
|
description: `Create Wallet => ${selectedWallet?.Wallet_id} - ${selectedWallet?.Wallet_name}`,
|
||||||
|
action: 'C'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed Create Wallet');
|
toast.error('Failed Create Wallet');
|
||||||
setAlert({ show: true, message: 'Failed Create Wallet' });
|
setAlert({ show: true, message: 'Failed Create Wallet' });
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import {
|
|||||||
SelectValue
|
SelectValue
|
||||||
} from '@/components/ui/select';
|
} from '@/components/ui/select';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
interface CurrencyProps {
|
interface CurrencyProps {
|
||||||
ID: string;
|
ID: string;
|
||||||
@ -81,6 +82,14 @@ const EditDialog = () => {
|
|||||||
handleEditDialog(false, null);
|
handleEditDialog(false, null);
|
||||||
toast.success('Success Update Wallet');
|
toast.success('Success Update Wallet');
|
||||||
reload();
|
reload();
|
||||||
|
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Wallet',
|
||||||
|
description: `Edit Wallet => ${selectedWallet?.Wallet_id} - ${selectedWallet?.Wallet_name}`,
|
||||||
|
action: 'U'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed Update Wallet');
|
toast.error('Failed Update Wallet');
|
||||||
setAlert({ show: true, message: 'Failed Update Wallet' });
|
setAlert({ show: true, message: 'Failed Update Wallet' });
|
||||||
|
|||||||
@ -31,6 +31,7 @@ import {
|
|||||||
CommandList
|
CommandList
|
||||||
} from '@/components/ui/command';
|
} from '@/components/ui/command';
|
||||||
import { NumericFormat } from 'react-number-format';
|
import { NumericFormat } from 'react-number-format';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
interface GroupProps {
|
interface GroupProps {
|
||||||
ID: string;
|
ID: string;
|
||||||
@ -48,7 +49,7 @@ interface WalletProps {
|
|||||||
|
|
||||||
const API_URL_WALLET = apiConfig.service_wallet;
|
const API_URL_WALLET = apiConfig.service_wallet;
|
||||||
const AddDialog = () => {
|
const AddDialog = () => {
|
||||||
const { showAddDialog, handleAddDialog } = useManageWalletRuleContext();
|
const { showAddDialog, handleAddDialog, selectedWalletRule } = useManageWalletRuleContext();
|
||||||
const { reload } = useDataGrid();
|
const { reload } = useDataGrid();
|
||||||
const { PostData, GetData } = useCallApi();
|
const { PostData, GetData } = useCallApi();
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
@ -94,6 +95,14 @@ const AddDialog = () => {
|
|||||||
handleAddDialog(false);
|
handleAddDialog(false);
|
||||||
toast.success('Success Create Wallet Rule');
|
toast.success('Success Create Wallet Rule');
|
||||||
reload();
|
reload();
|
||||||
|
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Wallet Rule',
|
||||||
|
description: `Create Wallet Rule => ${selectedWalletRule?.ID}`,
|
||||||
|
action: 'C'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed Create Wallet Rule');
|
toast.error('Failed Create Wallet Rule');
|
||||||
setAlert({ show: true, message: 'Failed Create Wallet Rule' });
|
setAlert({ show: true, message: 'Failed Create Wallet Rule' });
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import {
|
|||||||
DialogTitle
|
DialogTitle
|
||||||
} from '@/components/ui/dialog';
|
} from '@/components/ui/dialog';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
const API_URL_WALLET = apiConfig.service_wallet;
|
const API_URL_WALLET = apiConfig.service_wallet;
|
||||||
|
|
||||||
@ -37,6 +38,13 @@ const DeleteDialog = () => {
|
|||||||
toast.success('Wallet rule deleted successfully');
|
toast.success('Wallet rule deleted successfully');
|
||||||
handleDeleteDialog(false, null);
|
handleDeleteDialog(false, null);
|
||||||
reload();
|
reload();
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Wallet Rule',
|
||||||
|
description: `Edit Wallet Rule', => ${selectedWalletRule.ID}`,
|
||||||
|
action: 'D'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
setAlert({ show: false, message: '' });
|
setAlert({ show: false, message: '' });
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed to delete wallet rule');
|
toast.error('Failed to delete wallet rule');
|
||||||
|
|||||||
@ -31,6 +31,7 @@ import {
|
|||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { NumericFormat } from 'react-number-format';
|
import { NumericFormat } from 'react-number-format';
|
||||||
|
import { doSaveLogActivity } from '@/actions/GlobalActions';
|
||||||
|
|
||||||
interface GroupProps {
|
interface GroupProps {
|
||||||
ID: string;
|
ID: string;
|
||||||
@ -97,6 +98,14 @@ const EditDialog = () => {
|
|||||||
handleEditDialog(false, null);
|
handleEditDialog(false, null);
|
||||||
toast.success('Success Update Wallet Rule');
|
toast.success('Success Update Wallet Rule');
|
||||||
reload();
|
reload();
|
||||||
|
|
||||||
|
const createActivity = {
|
||||||
|
module: 'Manage Wallet Rule',
|
||||||
|
description: `Edit Wallet Rule => ${selectedWalletRule?.ID}`,
|
||||||
|
action: 'U'
|
||||||
|
};
|
||||||
|
|
||||||
|
doSaveLogActivity(createActivity);
|
||||||
} else {
|
} else {
|
||||||
toast.error('Failed Update Wallet Rule');
|
toast.error('Failed Update Wallet Rule');
|
||||||
setAlert({ show: true, message: 'Failed Update Wallet Rule' });
|
setAlert({ show: true, message: 'Failed Update Wallet Rule' });
|
||||||
|
|||||||
Reference in New Issue
Block a user