diff --git a/src/pages/master/aldeias/AldeiasMaster.tsx b/src/pages/master/aldeias/AldeiasMaster.tsx index bb3fec1..05f8a0e 100644 --- a/src/pages/master/aldeias/AldeiasMaster.tsx +++ b/src/pages/master/aldeias/AldeiasMaster.tsx @@ -9,11 +9,11 @@ const AldeiasMaster = () => { return ( <> - TPAY | Manage Aldeias + TPAY | Manage Aldeia -

Aldeias

+

Aldeia

Dashboard @@ -24,7 +24,7 @@ const AldeiasMaster = () => { - Manage Aldeias + Manage Aldeia diff --git a/src/pages/master/aldeias/blocks/AddDialog.tsx b/src/pages/master/aldeias/blocks/AddDialog.tsx index 6297958..a1c566c 100644 --- a/src/pages/master/aldeias/blocks/AddDialog.tsx +++ b/src/pages/master/aldeias/blocks/AddDialog.tsx @@ -69,18 +69,18 @@ const AddDialog = () => { if (response?.status) { resetForm(); handleAddDialog(false); - toast.success('Success Create Aldeias'); + toast.success('Success Create Aldeia'); reload(); const createActivity = { - module: 'Manage Aldeias', + module: 'Manage Aldeia', description: `Create Aldeia => ${formField.name}`, action: 'C' }; doSaveLogActivity(createActivity); } else { - toast.error('Error Create Aldeias'); - setAlert({ show: true, message: 'Failed to create Aldeias. Please try again.' }); + toast.error('Error Create Aldeia'); + setAlert({ show: true, message: 'Failed to create Aldeia. Please try again.' }); } }, [formField] @@ -100,7 +100,8 @@ const AddDialog = () => { // console.log('SUCOS', response?.data); setSucos(response?.data.list); } catch (error) { - console.error('Error fetching municipios', error); + // console.error('Error fetching Municipio', error); + setAlert({ show: true, message: 'Failed to fetch Municipio. Please try again.' }); } }; @@ -141,7 +142,7 @@ const AddDialog = () => { handleAddDialog(open)}> - Aldeias - Create + Aldeia - Create @@ -157,7 +158,7 @@ const AddDialog = () => {
{ - diff --git a/src/pages/master/aldeias/blocks/DeleteDialog.tsx b/src/pages/master/aldeias/blocks/DeleteDialog.tsx index 92e570e..44f0a81 100644 --- a/src/pages/master/aldeias/blocks/DeleteDialog.tsx +++ b/src/pages/master/aldeias/blocks/DeleteDialog.tsx @@ -32,11 +32,11 @@ const DeleteDialog = () => { if (response?.status) { setAlert({ show: false, message: '' }); handleDeleteDialog(false, null); - toast.success('Success Delete Aldeias'); + toast.success('Success Delete Aldeia'); reload(); const createActivity = { - module: 'Manage Aldeias', + module: 'Manage Aldeia', description: `Delete Aldeia => ${selectedAldeias}`, action: 'D' }; @@ -44,7 +44,7 @@ const DeleteDialog = () => { doSaveLogActivity(createActivity); } else { setAlert({ show: true, message: response?.message }); - toast.error('Failed Delete Aldeias'); + toast.error('Failed Delete Aldeia'); } }, [selectedAldeias, DeleteData, handleDeleteDialog, reload]); diff --git a/src/pages/master/aldeias/blocks/EditDialog.tsx b/src/pages/master/aldeias/blocks/EditDialog.tsx index 40033a7..0eec124 100644 --- a/src/pages/master/aldeias/blocks/EditDialog.tsx +++ b/src/pages/master/aldeias/blocks/EditDialog.tsx @@ -68,18 +68,18 @@ const EditDialog = () => { if (response?.status) { resetForm(); handleEditDialog(false, null); - toast.success('Success Update Aldeias'); + toast.success('Success Update Aldeia'); reload(); const createActivity = { - module: 'Manage Aldeias', + module: 'Manage Aldeia', description: `Edit Aldeia => ${selectedAldeias}`, action: 'U' }; doSaveLogActivity(createActivity); } else { - toast.error('Error Update Aldeias'); - setAlert({ show: true, message: 'Error Update Aldeias' }); + toast.error('Error Update Aldeia'); + setAlert({ show: true, message: 'Error Update Aldeia' }); } }, [selectedAldeias, formField] @@ -99,7 +99,8 @@ const EditDialog = () => { // console.log('SUCOS', response?.data); setSucos(response?.data.list); } catch (error) { - console.error('Error fetching municipios', error); + console.error('Error fetching Sucos', error); + setAlert({ show: true, message: 'Failed to get Sucos. Please try again.' }); } }; @@ -164,7 +165,7 @@ const EditDialog = () => { handleEditDialog(open, null)}> - Aldeias - Update + Aldeia - Update @@ -180,7 +181,7 @@ const EditDialog = () => {
{ table.getColumn('name')?.setFilterValue(event.target.value)} /> diff --git a/src/pages/master/aldeias/hooks/ManageAldeiasContext.tsx b/src/pages/master/aldeias/hooks/ManageAldeiasContext.tsx index 03519e9..355a683 100644 --- a/src/pages/master/aldeias/hooks/ManageAldeiasContext.tsx +++ b/src/pages/master/aldeias/hooks/ManageAldeiasContext.tsx @@ -80,7 +80,7 @@ const ManageAldeiasContextProvider = ({ children }: { children: React.ReactNode { accessorFn: (row) => row.name, id: 'name', - header: ({ column }) => , + header: ({ column }) => , enableSorting: true, enableHiding: false, meta: { @@ -90,7 +90,7 @@ const ManageAldeiasContextProvider = ({ children }: { children: React.ReactNode { accessorFn: (row) => row.sucos.name, id: 'sucos_name', - header: ({ column }) => , + header: ({ column }) => , enableSorting: true, enableHiding: false, meta: { diff --git a/src/pages/master/municipios/Municipios.tsx b/src/pages/master/municipios/Municipios.tsx index cc82b5c..253ff86 100644 --- a/src/pages/master/municipios/Municipios.tsx +++ b/src/pages/master/municipios/Municipios.tsx @@ -11,11 +11,11 @@ const Municipios = () => { return ( <> - TPAY | Municipios + TPAY | Municipio -

MUNICIPIOS

+

MUNICIPIO

Dashboard @@ -26,7 +26,7 @@ const Municipios = () => { - Manage Municipios + Manage Municipio
diff --git a/src/pages/master/municipios/blocks/AddDialog.tsx b/src/pages/master/municipios/blocks/AddDialog.tsx index 824645b..2b88edc 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 Municipios', + module: 'Manage Municipio', description: `Create Municipio => ${formField.name}`, action: 'C' }; @@ -107,52 +107,36 @@ const AddDialog = () => { return ( handleAddDialog(open)}> - - - - -
-
-

Add Municipios

-
-
-
{ - handleAddDialog(false); - resetForm(); - }} - > - -
-
+ + + Municipio - Create + - -
+ +
{alert.show && ( - - {alert.message} + +

{alert.message}

)} -
-
-
- - - setFormField((prev) => ({ ...prev, name: target.value })) - } - /> + +
+
+
+ + setFormField({ ...formField, name: e.target.value })} + /> +
-
+
diff --git a/src/pages/master/municipios/blocks/DeleteDialog.tsx b/src/pages/master/municipios/blocks/DeleteDialog.tsx index edab547..08a0551 100644 --- a/src/pages/master/municipios/blocks/DeleteDialog.tsx +++ b/src/pages/master/municipios/blocks/DeleteDialog.tsx @@ -43,7 +43,7 @@ const DeleteDialog = () => { reload(); const createActivity = { - module: 'Manage Municipios', + module: 'Manage Municipio', description: `Delete Municipio => ${selectedMunicipios}`, action: 'D' }; diff --git a/src/pages/master/municipios/blocks/EditDialog.tsx b/src/pages/master/municipios/blocks/EditDialog.tsx index e7365c5..6b6724a 100644 --- a/src/pages/master/municipios/blocks/EditDialog.tsx +++ b/src/pages/master/municipios/blocks/EditDialog.tsx @@ -21,7 +21,6 @@ import { doSaveLogActivity } from '@/actions/GlobalActions'; const API_URL = apiConfig.service_master_data; const EditDialog = () => { - const parentRef = useRef(null); const { showEditDialog, handleEditDialog, selectedMunicipios, municipios } = useManageMunicipiosContext(); const { reload } = useDataGrid(); @@ -131,7 +130,7 @@ const EditDialog = () => { handleEditDialog(open, null)}> - Municipios - Update + Municipio - Update @@ -147,7 +146,7 @@ const EditDialog = () => {
{
-
+
diff --git a/src/pages/master/municipios/blocks/ListToolbar.tsx b/src/pages/master/municipios/blocks/ListToolbar.tsx index 4c5a633..4ebdf62 100644 --- a/src/pages/master/municipios/blocks/ListToolbar.tsx +++ b/src/pages/master/municipios/blocks/ListToolbar.tsx @@ -28,7 +28,7 @@ const ListToolbar = () => { table.getColumn('name')?.setFilterValue(event.target.value)} /> diff --git a/src/pages/master/municipios/hooks/ManageMunicipiosContext.tsx b/src/pages/master/municipios/hooks/ManageMunicipiosContext.tsx index 5a95477..3fcb85e 100644 --- a/src/pages/master/municipios/hooks/ManageMunicipiosContext.tsx +++ b/src/pages/master/municipios/hooks/ManageMunicipiosContext.tsx @@ -75,7 +75,6 @@ const ManageMunicipiosProvider = ({ children }: { children: React.ReactNode }) = const [selectedMunicipios, setSelectedMunicipios] = useState(null); const [municipios, setMunicipios] = useState([]); const { GetData } = useCallApi(); - const navigate = useNavigate(); const handleSearchDialog = useCallback((show: boolean) => { setShowSearchDialog(show); @@ -95,18 +94,13 @@ const ManageMunicipiosProvider = ({ children }: { children: React.ReactNode }) = setShowDeleteDialog(show); }, []); - const handleNavigate = (path: string) => { - const url = navigate(`${API_URL}/municipios/postoadms/${path}`); - console.log(url); - }; - const columns = useMemo[]>( () => [ { // accessorFn: (row) => row.name, // id: 'name', accessorKey: 'name', - header: ({ column }) => , + header: ({ column }) => , enableSorting: true, enableHiding: false, meta: { @@ -158,12 +152,6 @@ const ManageMunicipiosProvider = ({ children }: { children: React.ReactNode }) = order_direction: sorting[0].desc == false ? 'ASC' : 'DESC', filter: JSON.stringify(filter) }); - // console.log(response?.data); - // const sortedList = response.data.data.list.sort((a: MunicipiosProps, b: MunicipiosProps) => { - // if (a.name < b.name) return -1; - // if (a.name > b.name) return 1; - // return 0; - // }); setMunicipios(response?.data.list); return { data: response?.data.list, totalCount: response?.data.total_count }; } catch (error) { diff --git a/src/pages/master/postoadms/blocks/AddDialog.tsx b/src/pages/master/postoadms/blocks/AddDialog.tsx index a268b9e..6958a63 100644 --- a/src/pages/master/postoadms/blocks/AddDialog.tsx +++ b/src/pages/master/postoadms/blocks/AddDialog.tsx @@ -72,17 +72,20 @@ const AddDialog = () => { handleAddDialog(false); resetForm(); reload(); - toast.success('Posto Adm created successfully!'); + toast.success('Postu Administrativo created successfully!'); const createActivity = { module: 'Manage Posto Administrativo', - description: `Create PostoAdms => ${formField.name}`, + description: `Create Postu Administrativo => ${formField.name}`, action: 'C' }; doSaveLogActivity(createActivity); } else { - toast.error('Failed to create Posto Adm. Please try again.'); - setAlert({ show: true, message: 'Failed to create Posto Adm. Please try again.' }); + toast.error('Failed to create Postu Administrativo. Please try again.'); + setAlert({ + show: true, + message: 'Failed to create Postu Administrativo. Please try again.' + }); } }, [formField] @@ -102,7 +105,8 @@ const AddDialog = () => { // console.log(response?.data); setMunicipios(response?.data.list); } catch (error) { - console.error('Error fetching municipios', error); + console.error('Error fetching Municipio', error); + setAlert({ show: true, message: 'Failed to get Municipio. Please try again.' }); } }; @@ -159,7 +163,7 @@ const AddDialog = () => {
{ { onWheel={(e) => e.stopPropagation()} > - + No Municipio found. diff --git a/src/pages/master/postoadms/blocks/DeleteDialog.tsx b/src/pages/master/postoadms/blocks/DeleteDialog.tsx index b94301e..72dad0d 100644 --- a/src/pages/master/postoadms/blocks/DeleteDialog.tsx +++ b/src/pages/master/postoadms/blocks/DeleteDialog.tsx @@ -28,7 +28,7 @@ const DeleteDialog = () => { const doDeletePostoAdm = useCallback(async () => { if (!selectedPostoAdms) { - toast.error('No Posto Adm selected'); + toast.error('No Postu Administrativo selected'); return; } @@ -39,18 +39,18 @@ const DeleteDialog = () => { if (response?.status) { setAlert({ show: false, message: '' }); handleDeleteDialog(false, null); - toast.success('Success Delete Posto Adm'); + toast.success('Success Delete Postu Administrativo'); reload(); const createActivity = { - module: 'Manage Posto Administrativo', - description: `Delete PostoAdms => ${selectedPostoAdms}`, + module: 'Manage Postu Administrativo', + description: `Delete Postu Administrativo => ${selectedPostoAdms}`, action: 'D' }; doSaveLogActivity(createActivity); } else { setAlert({ show: true, message: response?.message }); - toast.error('Failed Delete Posto Adm'); + toast.error('Failed Delete Postu Administrativo'); } }, [selectedPostoAdms, DeleteData, handleDeleteDialog, reload]); diff --git a/src/pages/master/postoadms/blocks/EditDialog.tsx b/src/pages/master/postoadms/blocks/EditDialog.tsx index 532403b..fd68b10 100644 --- a/src/pages/master/postoadms/blocks/EditDialog.tsx +++ b/src/pages/master/postoadms/blocks/EditDialog.tsx @@ -71,19 +71,22 @@ const EditDialog = () => { if (response?.status) { handleEditDialog(false, null); resetForm(); - toast.success('Success Update Posto Adm'); + toast.success('Success Update Postu Administrativo'); reload(); const createActivity = { - module: 'Manage Posto Administrativo', - description: `Edit PostoAdms => ${selectedPostoAdms}`, + module: 'Manage Postu Administrativo', + description: `Edit Postu Administrativo => ${selectedPostoAdms}`, action: 'U' }; doSaveLogActivity(createActivity); } else { - toast.error('Error Update Posto Adm'); - setAlert({ show: true, message: 'Failed to update posto adm. Please try again.' }); + toast.error('Error Update Postu Administrativo'); + setAlert({ + show: true, + message: 'Failed to update Postu Administrativo Please try again.' + }); } }, [selectedPostoAdms, formField] @@ -103,7 +106,8 @@ const EditDialog = () => { // console.log('MUNICIPIOS: ', response?.data); setMunicipios(response?.data.list); } catch (error) { - console.error('Error fetching municipios', error); + console.error('Error fetching Municipio', error); + setAlert({ show: true, message: 'Failed to get Municipio. Please try again.' }); } }, []); @@ -169,7 +173,7 @@ const EditDialog = () => { handleEditDialog(open, null)}> - Posto Adm - Update + Postu Administrativo - Update @@ -185,7 +189,7 @@ const EditDialog = () => {
{ - + No Municipio found. diff --git a/src/pages/master/postoadms/blocks/ListToolbar.tsx b/src/pages/master/postoadms/blocks/ListToolbar.tsx index 04742a3..37b3976 100644 --- a/src/pages/master/postoadms/blocks/ListToolbar.tsx +++ b/src/pages/master/postoadms/blocks/ListToolbar.tsx @@ -16,7 +16,7 @@ const ListToolbar = () => { table.getColumn('name')?.setFilterValue(event.target.value)} /> diff --git a/src/pages/master/postoadms/hooks/ManagePostoAdmsContext.tsx b/src/pages/master/postoadms/hooks/ManagePostoAdmsContext.tsx index ef6f7b5..fe31218 100644 --- a/src/pages/master/postoadms/hooks/ManagePostoAdmsContext.tsx +++ b/src/pages/master/postoadms/hooks/ManagePostoAdmsContext.tsx @@ -88,7 +88,7 @@ const ManagePostoAdmsContextProvider = ({ children }: { children: React.ReactNod id: 'name', // accessorKey: 'PostoAdms_name', header: ({ column }) => ( - + ), enableSorting: true, enableHiding: false, @@ -99,7 +99,7 @@ const ManagePostoAdmsContextProvider = ({ children }: { children: React.ReactNod { accessorFn: (row) => row.municipios_name, id: 'municipios_name', - header: ({ column }) => , + header: ({ column }) => , enableSorting: false, enableHiding: false, meta: { diff --git a/src/pages/master/sucos/blocks/AddDialog.tsx b/src/pages/master/sucos/blocks/AddDialog.tsx index b8213cf..97fbd99 100644 --- a/src/pages/master/sucos/blocks/AddDialog.tsx +++ b/src/pages/master/sucos/blocks/AddDialog.tsx @@ -72,7 +72,7 @@ const AddDialog = () => { toast.success('Sucos created successfully!'); const createActivity = { module: 'Manage Sucos', - description: `Create Suco => ${formField.name}`, + description: `Create Sucos => ${formField.name}`, action: 'C' }; @@ -128,7 +128,8 @@ const AddDialog = () => { // console.log('ini data posto :', response?.data); setPostoadms(response?.data.list || []); } catch (error) { - console.log('Error fetching posto', error); + console.log('Error fetching Postu Administrativo', error); + setAlert({ show: true, message: 'Failed to get Posto Administrativo. Please try again.' }); } }; @@ -155,7 +156,7 @@ const AddDialog = () => {
{
{ onWheel={(e) => e.stopPropagation()} > - + - No Posto Adms Found. + No Postu Administrativo Found. {posto_adms.map((posto) => ( { const doDeleteSucos = useCallback(async () => { if (!selectedSucos) { - toast.error('No sucos selected'); + toast.error('No Sucos selected'); return; } @@ -41,7 +41,7 @@ const DeleteDialog = () => { reload(); const createActivity = { module: 'Manage Sucos', - description: `Delete Suco => ${selectedSucos}`, + description: `Delete Sucos => ${selectedSucos}`, action: 'D' }; diff --git a/src/pages/master/sucos/blocks/EditDialog.tsx b/src/pages/master/sucos/blocks/EditDialog.tsx index 136ad9b..4dbd307 100644 --- a/src/pages/master/sucos/blocks/EditDialog.tsx +++ b/src/pages/master/sucos/blocks/EditDialog.tsx @@ -79,7 +79,7 @@ const EditDialog = () => { reload(); const createActivity = { module: 'Manage Sucos', - description: `Edit Suco => ${selectedSucos}`, + description: `Edit Sucos => ${selectedSucos}`, action: 'U' }; @@ -103,10 +103,11 @@ const EditDialog = () => { order_direction: sorting[0].desc == false ? 'ASC' : 'DESC' }); - setPostoadms(response?.data.list); // console.log('Data Posto Adms:', response?.data.list); + setPostoadms(response?.data.list); } catch (error) { - console.log('Error fetching postoadms', error); + console.log('Error fetching Postu Administrativo', error); + setAlert({ show: true, message: 'Failed to get Posto Administrativo. Please try again.' }); } }, []); @@ -118,7 +119,7 @@ const EditDialog = () => { setFormField((prev) => ({ ...prev, name: response.data.name, - postoId: response.data.posto.id // Pastikan ini sesuai dengan PostoAdms_id + postoId: response.data.posto.id })); } else { setFormField((prev) => ({ @@ -126,8 +127,6 @@ const EditDialog = () => { name: '' })); } - console.log('Responnya nih:', response); - console.log('Data Posto nya nih:', response?.data?.posto); }, []); const handleUpdate = (e: React.FormEvent) => { @@ -138,7 +137,7 @@ const EditDialog = () => { return; } - console.log('Form Field before update:', formField); // Log formField sebelum update + // console.log('Form Field before update:', formField); doUpdateSucos(e); setAlert({ show: false, message: '' }); }; @@ -146,14 +145,12 @@ const EditDialog = () => { useEffect(() => { if (showEditDialog) { resetForm(); - console.log('Edit Dialog Opened'); // Log ketika dialog dibuka } }, [showEditDialog]); useEffect(() => { if (selectedSucos) { doFetchData(selectedSucos); - console.log('Selected Sucos ID:', selectedSucos); // Log selectedSucos ID } }, [selectedSucos]); @@ -164,7 +161,6 @@ const EditDialog = () => { updated_by: parsedUser?.username, updated_at: formattedTime }); - console.log('Form Field after update:', formField); // Log formField setelah update } }, [formattedTime]); @@ -172,7 +168,6 @@ const EditDialog = () => { doFetchPostoAdms([{ id: 'name', desc: false }]); }, []); - // console.log(selectedSucos); return ( handleEditDialog(open, null)}> @@ -193,7 +188,7 @@ const EditDialog = () => {
{
- + - No Posto Adms Found. + No Postu Administrativo Found. {postoadms.map((posto) => ( { onSelect={() => { setFormField({ ...formField, - postoId: posto.PostoAdms_id // Gunakan PostoAdms_id + postoId: posto.PostoAdms_id }); setOpen(false); }} diff --git a/src/pages/master/sucos/hooks/ManageSucosContext.tsx b/src/pages/master/sucos/hooks/ManageSucosContext.tsx index 6a888b1..05bd3c5 100644 --- a/src/pages/master/sucos/hooks/ManageSucosContext.tsx +++ b/src/pages/master/sucos/hooks/ManageSucosContext.tsx @@ -106,7 +106,7 @@ const ManageSucosContextProvider = ({ children }: { children: React.ReactNode }) const value = row.getValue(columnId); return String(value).includes(String(filterValue)); }, - header: ({ column }) => , + header: ({ column }) => , enableSorting: true, enableHiding: false, meta: { diff --git a/src/pages/transaction/approval-transaction/blocks/ApprovalDialog.tsx b/src/pages/transaction/approval-transaction/blocks/ApprovalDialog.tsx index 076f924..6108b50 100644 --- a/src/pages/transaction/approval-transaction/blocks/ApprovalDialog.tsx +++ b/src/pages/transaction/approval-transaction/blocks/ApprovalDialog.tsx @@ -38,7 +38,8 @@ const ApprovalDialog = () => { const [formField, setFormField] = useState({ transaction_code: '', - status: '' + status: '', + notes: '' }); const [alert, setAlert] = useState({ @@ -61,8 +62,9 @@ const ApprovalDialog = () => { } const response = await PostData(`${API_URL}/transaction/set-approval`, { - transaction_code: transactionDetails.code, + transaction_code: transactionDetails.id, status: formField.status, + notes: formField.notes }); if (response?.status) { @@ -119,8 +121,8 @@ const ApprovalDialog = () => {
-
+ {formField.status === 'N' && ( +
+ + +
+ +
+
+ )} +

diff --git a/src/pages/transaction/approval-transaction/hooks/ApprovalTransactionContext.tsx b/src/pages/transaction/approval-transaction/hooks/ApprovalTransactionContext.tsx index 84b0f3a..5564f0d 100644 --- a/src/pages/transaction/approval-transaction/hooks/ApprovalTransactionContext.tsx +++ b/src/pages/transaction/approval-transaction/hooks/ApprovalTransactionContext.tsx @@ -203,6 +203,7 @@ const ApprovalTransactionProvider = ({ children }: { children: React.ReactNode } setSelectedTransactionIdForApproval(row.id); setShowApprovalDialog(true); }} + disabled={row.status_approve === 'Y' || row.status_approve === 'N'} >