// @mui import { Autocomplete, Box, Button, Card, Collapse, IconButton, InputLabel, MenuItem, OutlinedInput, Paper, Select, SelectChangeEvent, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TextField, Typography, Badge, Tab, Tabs, CardHeader, Stack, Menu, ButtonGroup, Pagination, TablePagination, Grid, } from '@mui/material'; import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'; import AddIcon from '@mui/icons-material/Add'; import UploadIcon from '@mui/icons-material/Upload'; import CancelIcon from '@mui/icons-material/Cancel'; // hooks import React, { ChangeEvent, Component, useEffect, useRef, useState } from 'react'; import useSettings from '../../hooks/useSettings'; import { useNavigate, useParams, useSearchParams } from 'react-router-dom'; // components import axios from '../../utils/axios'; import { LaravelPaginatedData } from '../../@types/paginated-data'; import { Member } from '../../@types/member'; import Iconify from '../../components/Iconify'; export default function DashboardTable() { const navigate = useNavigate(); const { themeStretch } = useSettings(); const { corporate_id } = useParams(); const [searchParams, setSearchParams] = useSearchParams(); const [importResult, setImportResult] = useState(null); function SearchInput(props: any) { // SEARCH const searchInput = useRef(null); const [searchText, setSearchText] = useState(''); const handleSearchChange = (event: any) => { const newSearchText = event.target.value ?? ''; setSearchText(newSearchText); }; const handleSearchSubmit = (event: any) => { event.preventDefault(); props.onSearch(searchText); // Trigger to Parent }; // useEffect(() => { // // Trigger First Search // setSearchText(searchParams.get('search') ?? ''); // }, [searchParams]); return (
); } function ImportForm(props: any) { // IMPORT // Create Button Menu const [anchorEl, setAnchorEl] = React.useState(null); const createMenu = Boolean(anchorEl); const importForm = useRef(null); const [currentImportFileName, setCurrentImportFileName] = useState(null); const handleImportChange = (event: any) => { if (event.target.files[0]) { setCurrentImportFileName(event.target.files[0].name); } else { setCurrentImportFileName(null); } }; const options = ['All', 'Option 2']; const [value, setValue] = React.useState(options[0]); const [inputValue, setInputValue] = React.useState(''); return (
{/* Filter Division */} { setValue(newValue); }} inputValue={inputValue} onInputChange={(event, newInputValue) => { setInputValue(newInputValue); }} id="controllable-states-demo" options={options} sx={{ minWidth: 240 }} renderInput={(params) => } /> {/* Search */} {/* Button Import */} {/* */} {/* Button Add Task */}
); } // Called on every row to map the data to the columns function createData(member: Member): Member { return { ...member, }; } // Generate the every row of the table // function Row(props: { row: ReturnType }) { // const { row } = props; // const [open, setOpen] = React.useState(true); // return ( // // *': { borderBottom: 'unset' } }}> // // setOpen(!open)}> // {open ? : } // // // {row.member_id} // {row.payor_id} // {row.name} // {row.nik} // {row.nric} // // // // {/* */} // // {/* COLLAPSIBLE ROW */} // // // // // // // // // // // // // ); // } // Dummy Default Data const [dataTableIsLoading, setDataTableLoading] = useState(true); const [dataTableData, setDataTableData] = useState({ current_page: 1, data: [], path: '', first_page_url: '', last_page: 1, last_page_url: '', next_page_url: '', prev_page_url: '', per_page: 10, from: 0, to: 0, total: 0, }); const loadDataTableData = async (appliedFilter: any | null = null) => { setDataTableLoading(true); const filter = appliedFilter ? appliedFilter : Object.fromEntries([...searchParams.entries()]); const response = await axios.get('/members', { params: filter }); setDataTableData(response.data.members); setDataTableLoading(false); }; const headStyle = { fontWeight: 'bold', }; const applyFilter = async (searchFilter: string) => { await loadDataTableData({ search: searchFilter }); setSearchParams({ search: searchFilter }); }; useEffect(() => { loadDataTableData(); }, []); return ( {/* The Main Table */} MemberID Name Divisi Limit Status Action {dataTableIsLoading ? ( No Data Found ) : dataTableData.data.length === 0 ? ( No Data ) : ( {/* {dataTableData.data.map((row) => ( ))} */} Testing )}
{/* */}
); }