// @mui
import { Typography, Container, Grid, Card } from '@mui/material';
// hooks
import useSettings from '@/hooks/useSettings';
// components
import Page from '@/components/Page';
// theme
import CardNotification from '@/sections/dashboard/CardNotification';
import CardSearchMember from '@/sections/dashboard/CardSearchMember'
import { useContext, useEffect, useState } from 'react';
import axios from '@/utils/axios';
import { Stack } from '@mui/system';
import { Input } from '@mui/material';
//sections
import TableList from '@/sections/claim/TableList';
import { fDate } from '@/utils/formatTime';
import DialogDetailClaim from '@/components/dialogs/DialogDetailClaim';
import HeaderBreadcrumbs from "@/components/HeaderBreadcrumbs";

// ----------------------------------------------------------------------

// const [notifications, setNotifications] = useState([])

const itemList = [
  { info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '08:00 WIB' },
  { info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '09:00 WIB' },
  { info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '10:00 WIB' },
  { info: 'Mohon lengkapi dokumen Mahen sadarsa', date: 'Selasa, 20 April 22', time: '11:00 WIB' },
];

// ----------------------------------------------------------------------

/* ---------------------------------- types --------------------------------- */

type PolicyProps = {
  myLimit: {
    balance: number;
    total: number;
    percentage: number;
  };
  lockLimit: {
    balance: number;
    percentage: number;
  };
};

/* -------------------------------------------------------------------------- */

/* ------------------------------ default data ------------------------------ */
const defaultPolicyData = {
  myLimit: {
    balance: 0,
    total: 0,
    percentage: 0,
  },
  lockLimit: {
    balance: 0,
    percentage: 0,
  },
};
/* -------------------------------------------------------------------------- */

export default function Claim() {
  const { themeStretch } = useSettings();

  // const [tableData, setTableData] = useState([]);
  const [policyData, setPolicyData] = useState<PolicyProps>(defaultPolicyData);

  // TODO Remove This
  //const [itemList, setItemList] = useState([]);
  function handleDataLoaded(dataTable:any) {
    let dummyData = [];
    dataTable.map(function(data:any) {
      if (data.status == 'approved') {
        dummyData.push({
          info: `LOG Approved for member ${data.member.full_name}`,
          date: fDate(data.created_at, "dd MMMM"),
          time: fDate(data.created_at, "HH:mm")
        })
      }
    })

    //setItemList(dummyData);
  }

  return (
    <Page title="Claim">
      <Container maxWidth={themeStretch ? false : 'xl'}>
        <Grid container spacing={2}>
          {/* <Grid item xs={12} lg={12} md={12}>
            <CardSearchMember/>
          </Grid> */}
          {/*<Grid item xs={12} lg={6} md={6}>
            <CardNotification data={itemList} />
          </Grid>*/}
          <Grid item xs={12} lg={12} md={12}>
            <HeaderBreadcrumbs
                heading={'Claim'}
                links={[
                {
                    name: 'Dashboard',
                    href: '/dashboard',
                },
                {
                    name: 'Claim',
                    href: '/claim',
                },
                ]}
            />
            <Card>
            <TableList/>
            </Card>
          </Grid>
        </Grid>
      </Container>

    </Page>
  );
}
