fix variable to props on sucos

This commit is contained in:
Wikzyy
2025-04-16 17:51:37 +07:00
parent 585cd326b7
commit 858941b3b7
3 changed files with 21 additions and 17 deletions

View File

@ -34,7 +34,6 @@ interface PostoAdmsProps {
const API_URL = apiConfig.service_master_data;
const EditDialog = () => {
const parentRef = useRef<any | null>(null);
const { showEditDialog, handleEditDialog, selectedSucos, sucos } = useManageSucosContext();
const { reload } = useDataGrid();
const { PutData, GetData } = useCallApi();

View File

@ -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<string>(columnId);
return String(value).includes(String(filterValue));
},
header: ({ column }) => <DataGridColumnHeader title="Postu Administrativo Name" column={column} />,
header: ({ column }) => (
<DataGridColumnHeader title="Postu Administrativo Name" column={column} />
),
enableSorting: true,
enableHiding: false,
meta: {
@ -124,13 +129,13 @@ const ManageSucosContextProvider = ({ children }: { children: React.ReactNode })
<>
<button
className="btn btn-sm btn-icon btn-clear btn-light"
onClick={() => handleEditDialog(true, row.sucos_id)}
onClick={() => handleEditDialog(true, row.id)}
>
<KeenIcon icon="notepad-edit" />
</button>
<button
className="btn btn-sm btn-icon btn-clear btn-light"
onClick={() => handleDeleteDialog(true, row.sucos_id)}
onClick={() => handleDeleteDialog(true, row.id)}
>
<KeenIcon icon="trash" />
</button>
@ -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) {