fix filter search posto and remove console log parsedUser
This commit is contained in:
@ -14,7 +14,7 @@ const BasicSettings = () => {
|
||||
// const user = localStorage.getItem('user');
|
||||
// const parsedUser = user ? JSON.parse(user) : null;
|
||||
const parsedUser = getAuth()?.user;
|
||||
console.log('parsedUser :', parsedUser);
|
||||
// console.log('parsedUser :', parsedUser);
|
||||
const [newUsername, setNewUsername] = useState<string>(parsedUser?.username || '');
|
||||
const [newEmail, setNewEmail] = useState<string>(parsedUser?.email || '');
|
||||
const [newName, setNewName] = useState<string>(parsedUser?.name || '');
|
||||
|
||||
@ -17,9 +17,9 @@ const ListToolbar = () => {
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Search Postu"
|
||||
value={(table.getColumn('PostoAdms_name')?.getFilterValue() as string) ?? ''}
|
||||
value={(table.getColumn('name')?.getFilterValue() as string) ?? ''}
|
||||
onChange={(event) =>
|
||||
table.getColumn('PostoAdms_name')?.setFilterValue(event.target.value)
|
||||
table.getColumn('name')?.setFilterValue(event.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
|
||||
@ -84,9 +84,9 @@ const ManagePostoAdmsContextProvider = ({ children }: { children: React.ReactNod
|
||||
const columns = useMemo<ColumnDef<any>[]>(
|
||||
() => [
|
||||
{
|
||||
// accessorFn: (row) => row.PostoAdms_id,
|
||||
// id: 'PostoAdms_id',
|
||||
accessorKey: 'PostoAdms_id',
|
||||
accessorFn: (row) => row.PostoAdms_id,
|
||||
id: 'id',
|
||||
// accessorKey: 'PostoAdms_id',
|
||||
header: ({ column }) => <DataGridColumnHeader title="ID" column={column} />,
|
||||
enableSorting: true,
|
||||
enableHiding: false,
|
||||
@ -95,9 +95,9 @@ const ManagePostoAdmsContextProvider = ({ children }: { children: React.ReactNod
|
||||
}
|
||||
},
|
||||
{
|
||||
// accessorFn: (row) => row.posto_adms_name,
|
||||
// id: 'posto_adms_name',
|
||||
accessorKey: 'PostoAdms_name',
|
||||
accessorFn: (row) => row.PostoAdms_name,
|
||||
id: 'name',
|
||||
// accessorKey: 'PostoAdms_name',
|
||||
header: ({ column }) => (
|
||||
<DataGridColumnHeader title="Posto Administrativo Name" column={column} />
|
||||
),
|
||||
|
||||
@ -175,7 +175,8 @@ const ManageMenusContextProvider = ({ children }: { children: React.ReactNode })
|
||||
|
||||
const flattenChildren = (parent: any, parentIdx: number, depth = 0, parentName = '') => {
|
||||
if (parent.link === '/') {
|
||||
if (!parents.find((el: any) => el.id === parent.id)) setParents((el: any) => [...el, { id: parent.id, name: parent.name }]) // GET PARENTS
|
||||
if (!parents.find((el: any) => el.id === parent.id))
|
||||
setParents((el: any) => [...el, { id: parent.id, name: parent.name }]); // GET PARENTS
|
||||
}
|
||||
if (!parent.children || parent.children.length === 0) {
|
||||
return []; // Jika tidak ada children, kembalikan array kosong
|
||||
@ -220,8 +221,9 @@ const ManageMenusContextProvider = ({ children }: { children: React.ReactNode })
|
||||
|
||||
const total_count = transformedData.length;
|
||||
|
||||
console.log(response.data);
|
||||
setMenus(transformedData);
|
||||
return { data: transformedData, totalCount: total_count };
|
||||
return { data: transformedData, totalCount: response.data.total_count };
|
||||
} catch (error) {
|
||||
console.error('Error fetching Menus', error);
|
||||
return { data: [], totalCount: 0 };
|
||||
|
||||
Reference in New Issue
Block a user