
import React from 'react'
import DashBody from '../../Layout/Dashboard/DashBody'
import DashHeader from '../../Layout/Dashboard/DashHeader'
import LyTable from '../../Layout/Dashboard/LyTable'
import useTableColumns from './useTableColumns'
import { QueryStatusEnum } from '../../config/QueryStatus'

import { useGetUsers } from '../../api/users'
import SearchField from '../../Layout/Dashboard/SearchField'

function Page() {

    const column   =useTableColumns()
    const {data  ,status } = useGetUsers()

    const totalRows = data?.meta?.total;
    
  return (
    // Pass Status to Layout 
    <DashBody status={status as QueryStatusEnum} >

      <DashHeader showAddButton={false} title={'users'}>
      <div className='RightSide d-flex gap-2 align-center '>
     <SearchField searchBy={"name"} />

     {/* <AddButton  onClick={()=>navigate('/users/add')}></AddButton> */}
     </div>
      </DashHeader>
      <LyTable
        data={data?.data}
        isLoading={false}
        columns={column}
        total={totalRows}
        is_pagination={true}
    />
      
    </DashBody>
  )
}

export default Page

