diff --git a/src/pages/master/aldeias/blocks/AddDialog.tsx b/src/pages/master/aldeias/blocks/AddDialog.tsx index 97c40b2..cc2619a 100644 --- a/src/pages/master/aldeias/blocks/AddDialog.tsx +++ b/src/pages/master/aldeias/blocks/AddDialog.tsx @@ -73,7 +73,7 @@ const AddDialog = () => { reload(); const createActivity = { module: 'Manage Aldeias', - description: `Create Aldeias => ${selectedAldeias}`, + description: `Create Aldeia => ${selectedAldeias}`, action: 'C' }; diff --git a/src/pages/master/aldeias/blocks/DeleteDialog.tsx b/src/pages/master/aldeias/blocks/DeleteDialog.tsx index 17c4954..9293c89 100644 --- a/src/pages/master/aldeias/blocks/DeleteDialog.tsx +++ b/src/pages/master/aldeias/blocks/DeleteDialog.tsx @@ -6,6 +6,7 @@ import { useCallback, useState } from 'react'; import { toast } from 'sonner'; import { Dialog, DialogContent, DialogFooter, DialogHeader } from '@/components/ui/dialog'; import { Button } from '@/components/ui/button'; +import { doSaveLogActivity } from '@/actions/GlobalActions'; const API_URL = apiConfig.service_master_data; @@ -33,6 +34,14 @@ const DeleteDialog = () => { handleDeleteDialog(false, null); toast.success('Success Delete Aldeias'); reload(); + + const createActivity = { + module: 'Manage Aldeias', + description: `Edit Aldeia => ${selectedAldeias}`, + action: 'D' + }; + + doSaveLogActivity(createActivity); } else { setAlert({ show: true, message: response?.message }); toast.error('Failed Delete Aldeias'); diff --git a/src/pages/master/aldeias/blocks/EditDialog.tsx b/src/pages/master/aldeias/blocks/EditDialog.tsx index fd4f29a..79eb0ce 100644 --- a/src/pages/master/aldeias/blocks/EditDialog.tsx +++ b/src/pages/master/aldeias/blocks/EditDialog.tsx @@ -72,7 +72,7 @@ const EditDialog = () => { reload(); const createActivity = { module: 'Manage Aldeias', - description: `Edit Aldeias => ${selectedAldeias}`, + description: `Edit Aldeia => ${selectedAldeias}`, action: 'U' }; diff --git a/src/pages/master/municipios/blocks/AddDialog.tsx b/src/pages/master/municipios/blocks/AddDialog.tsx index 5afd080..61a6b3a 100644 --- a/src/pages/master/municipios/blocks/AddDialog.tsx +++ b/src/pages/master/municipios/blocks/AddDialog.tsx @@ -56,7 +56,7 @@ const AddDialog = () => { reload(); toast.success('Municipio created successfully!'); const createActivity = { - module: 'Manage Municipio', + module: 'Manage Municipios', description: `Create Municipio => ${selectedMunicipios}`, action: 'C' }; diff --git a/src/pages/master/municipios/blocks/DeleteDialog.tsx b/src/pages/master/municipios/blocks/DeleteDialog.tsx index f7e6f5d..ee742f5 100644 --- a/src/pages/master/municipios/blocks/DeleteDialog.tsx +++ b/src/pages/master/municipios/blocks/DeleteDialog.tsx @@ -4,9 +4,16 @@ import { useCallback, useState } from 'react'; import { apiConfig } from '@/config/api.config'; import { useCallApi } from '@/hooks'; 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 { DialogDescription } from '@radix-ui/react-dialog'; +import { doSaveLogActivity } from '@/actions/GlobalActions'; const API_URL = apiConfig.service_master_data; @@ -25,16 +32,23 @@ const DeleteDialog = () => { return; } - const response = await DeleteData( - `${API_URL}/municipios/delete/${selectedMunicipios}/false`, - { id: selectedMunicipios } - ); + const response = await DeleteData(`${API_URL}/municipios/delete/${selectedMunicipios}/false`, { + id: selectedMunicipios + }); if (response?.status) { setAlert({ show: false, message: '' }); handleDeleteDialog(false, null); toast.success('Success Delete Municipio'); reload(); + + const createActivity = { + module: 'Manage Municipios', + description: `Edit Municipio',', => ${selectedMunicipios}`, + action: 'D' + }; + + doSaveLogActivity(createActivity); } else { setAlert({ show: true, message: response?.message }); toast.error('Failed Delete Municipio'); @@ -43,7 +57,6 @@ const DeleteDialog = () => { return ( handleDeleteDialog(open, null)}> - diff --git a/src/pages/master/municipios/blocks/EditDialog.tsx b/src/pages/master/municipios/blocks/EditDialog.tsx index 72995d4..e7365c5 100644 --- a/src/pages/master/municipios/blocks/EditDialog.tsx +++ b/src/pages/master/municipios/blocks/EditDialog.tsx @@ -61,7 +61,7 @@ const EditDialog = () => { toast.success('Success update municipio'); reload(); const createActivity = { - module: 'Manage Municipio', + module: 'Manage Municipios', description: `Edit Municipio => ${selectedMunicipios}`, action: 'U' }; diff --git a/src/pages/master/postoadms/blocks/DeleteDialog.tsx b/src/pages/master/postoadms/blocks/DeleteDialog.tsx index fca5448..eaca302 100644 --- a/src/pages/master/postoadms/blocks/DeleteDialog.tsx +++ b/src/pages/master/postoadms/blocks/DeleteDialog.tsx @@ -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'); diff --git a/src/pages/master/products/blocks/AddDialog.tsx b/src/pages/master/products/blocks/AddDialog.tsx index f5b7a57..ad917e2 100644 --- a/src/pages/master/products/blocks/AddDialog.tsx +++ b/src/pages/master/products/blocks/AddDialog.tsx @@ -22,6 +22,7 @@ import { SelectTrigger, SelectValue } from '@/components/ui/select'; +import { doSaveLogActivity } from '@/actions/GlobalActions'; interface ProviderProps { provider_id: number; @@ -32,7 +33,7 @@ const API_URL = apiConfig.service_master_data; const AddDialog = () => { const parentRef = useRef(null); const parsedUser = getAuth()?.user; - const { showAddDialog, handleAddDialog } = useManageProductsContext(); + const { showAddDialog, handleAddDialog, selectedProducts } = useManageProductsContext(); const { PostData, GetData } = useCallApi(); const { reload } = useDataGrid(); const [alert, setAlert] = useState({ @@ -75,6 +76,14 @@ const AddDialog = () => { handleAddDialog(false); toast.success('Success Create Product'); reload(); + + const createActivity = { + module: 'Manage Products', + description: `Create Product => ${selectedProducts}`, + action: 'C' + }; + + doSaveLogActivity(createActivity); } else { toast.error('Failed Create Product'); setAlert({ show: true, message: response?.message }); @@ -173,9 +182,7 @@ const AddDialog = () => { className="input" type="text" value={formField.name} - onChange={(e) => - setFormField({ ...formField, name: e.target.value }) - } + onChange={(e) => setFormField({ ...formField, name: e.target.value })} /> @@ -189,9 +196,7 @@ const AddDialog = () => { className="input" type="text" value={formField.type} - onChange={(e) => - setFormField({ ...formField, type: e.target.value }) - } + onChange={(e) => setFormField({ ...formField, type: e.target.value })} /> @@ -205,9 +210,7 @@ const AddDialog = () => { className="input" type="text" value={formField.code} - onChange={(e) => - setFormField({ ...formField, code: e.target.value }) - } + onChange={(e) => setFormField({ ...formField, code: e.target.value })} /> @@ -221,9 +224,7 @@ const AddDialog = () => { className="input" type="text" value={formField.description} - onChange={(e) => - setFormField({ ...formField, description: e.target.value }) - } + onChange={(e) => setFormField({ ...formField, description: e.target.value })} /> @@ -323,9 +324,7 @@ const AddDialog = () => {