import React, { Fragment, useState, useEffect } from 'react'
import {
    TextField,
    Icon,
    Button,
    StepLabel,
    Step,
    Stepper,
    Grid,
    FormControl,
    InputLabel,
    Select,
    MenuItem,
} from '@material-ui/core'
import Table from './Table'
import { Breadcrumb } from 'app/components'
import { Link } from 'react-router-dom'
import { Autocomplete, createFilterOptions } from '@material-ui/lab'

function CustomerView(props) {
    const [age, setAge] = React.useState('')
    const {
        data,
        setTxtSearch,
        changeActive,
        setChangeActive,
        handeChangeActive,
        setPageIndex,
        pageIndex,
        totalRecords,
        setResults,
        setFunctions,
    } = props

    const handleChange = (event) => {
        setAge(event.target.value)
    }
    return (
        <Fragment>
            <div className="m-sm-30">
                <div className="mb-sm-30">
                    <Breadcrumb
                        routeSegments={[
                            {
                                name: 'Log hành động',
                                path: '/system/log-action',
                            },
                        ]}
                    />
                </div>

                <Grid
                    style={{
                        padding: 10,
                        marginBottom: 20,
                    }}
                    justify={'space-between'}
                    alignItems={'center'}
                    container
                    spacing={3}
                >
                    <Grid
                        container
                        spacing={2}
                        item
                        lg={8}
                        md={8}
                        sm={8}
                        xs={8}
                    >
                        <Grid item>
                            <TextField
                                variant="outlined"
                                className="w-full"
                                label="Tìm kiếm"
                                onChange={(e) => {
                                    const text = e.target.value
                                    setTimeout(() => {
                                        setTxtSearch(text)
                                    }, 1000)
                                }}
                            />
                        </Grid>
                        <Grid item>
                            <TextField
                                variant="outlined"
                                className="w-full"
                                label="Chức năng"
                                onChange={(e) => {
                                    const text = e.target.value
                                    setTimeout(() => {
                                        setFunctions(text)
                                    }, 1000)
                                }}
                            />
                        </Grid>

                        <Grid item>
                            <TextField
                                variant="outlined"
                                className="w-full"
                                label="Kết quả"
                                onChange={(e) => {
                                    const text = e.target.value
                                    setTimeout(() => {
                                        setResults(text)
                                    }, 1000)
                                }}
                            />
                        </Grid>
                    </Grid>
                </Grid>

                <Table
                    data={data}
                    changeActive={changeActive}
                    setChangeActive={setChangeActive}
                    handeChangeActive={handeChangeActive}
                    pageIndex={pageIndex}
                    setPageIndex={setPageIndex}
                    totalRecords={totalRecords}
                />
            </div>
        </Fragment>
    )
}

export default CustomerView
