diff --git a/src/pages/master/aldeias/blocks/EditDialog.tsx b/src/pages/master/aldeias/blocks/EditDialog.tsx index aaf4bb4..76c7c10 100644 --- a/src/pages/master/aldeias/blocks/EditDialog.tsx +++ b/src/pages/master/aldeias/blocks/EditDialog.tsx @@ -27,8 +27,8 @@ import { import { doSaveLogActivity } from '@/actions/GlobalActions'; interface SucosProps { - sucos_id: number; - sucos_name: string; + id: number; + name: string; } const API_URL = apiConfig.service_master_data; @@ -97,8 +97,8 @@ const EditDialog = () => { order_direction: sorting[0].desc == false ? 'ASC' : 'DESC' }); - // console.log('SUCOS', response?.data); setSucos(response?.data.list); + console.log(sucos); } catch (error) { console.error('Error fetching Sucos', error); setAlert({ show: true, message: 'Failed to get Sucos. Please try again.' }); @@ -221,8 +221,8 @@ const EditDialog = () => { className="input col-span-5 text-left" style={{ color: 'inherit' }} > - {sucos.find((suco) => suco.sucos_id === formField.sucosId) - ?.sucos_name || 'Select Sucos'} + {sucos.find((suco) => suco.id === formField.sucosId) + ?.name || 'Select Sucos'} @@ -233,17 +233,17 @@ const EditDialog = () => { {sucos.map((suco) => ( { setFormField({ ...formField, - sucosId: suco.sucos_id + sucosId: suco.id }); setOpen(false); }} > - {suco.sucos_name} + {suco.name} ))} diff --git a/src/pages/master/sucos/blocks/EditDialog.tsx b/src/pages/master/sucos/blocks/EditDialog.tsx index 4dbd307..50156f3 100644 --- a/src/pages/master/sucos/blocks/EditDialog.tsx +++ b/src/pages/master/sucos/blocks/EditDialog.tsx @@ -34,7 +34,6 @@ interface PostoAdmsProps { const API_URL = apiConfig.service_master_data; const EditDialog = () => { - const parentRef = useRef(null); const { showEditDialog, handleEditDialog, selectedSucos, sucos } = useManageSucosContext(); const { reload } = useDataGrid(); const { PutData, GetData } = useCallApi(); diff --git a/src/pages/master/sucos/hooks/ManageSucosContext.tsx b/src/pages/master/sucos/hooks/ManageSucosContext.tsx index 780b93a..2d106a7 100644 --- a/src/pages/master/sucos/hooks/ManageSucosContext.tsx +++ b/src/pages/master/sucos/hooks/ManageSucosContext.tsx @@ -9,9 +9,12 @@ import { useNavigate } from 'react-router'; import axios from 'axios'; interface SucosProps { - sucos_id: number; - sucos_name: string; - posto_name: string; + id: string; + name: string; + posto: { + id: string; + name: string; + }; } interface ContextProps { @@ -106,7 +109,9 @@ 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: { @@ -124,13 +129,13 @@ const ManageSucosContextProvider = ({ children }: { children: React.ReactNode }) <> @@ -158,7 +163,7 @@ const ManageSucosContextProvider = ({ children }: { children: React.ReactNode }) order_direction: sorting[0].desc == false ? 'ASC' : 'DESC', filter: JSON.stringify(filter) }); - // console.log('Sucos List Response:', response?.data); + console.log('Sucos List Response:', response?.data); setSucos(response?.data.list || []); return { data: response?.data.list, totalCount: response?.data.total_count }; } catch (error) {