import React from 'react'; import PropTypes from 'prop-types'; import { translate, Interpolate } from 'react-i18next'; import ReactTable from 'react-table'; import 'react-table/react-table.css'; import Pager from '../Pager/Pager'; import { Row, Col, Card, CardBody, CardTitle } from 'reactstrap'; import LoadersAdvanced from '../Loader/Loader'; // const steps = [ // { name: 'Account Information' }, // { name: 'Payment Information' }, // { name: 'Finish Wizard' } // ] export class Table extends React.Component { static propTypes = { t: PropTypes.func, data: PropTypes.array.isRequired, columns: PropTypes.array.isRequired, totalCount: PropTypes.number.isRequired, showTotalCount: PropTypes.bool, noCard: PropTypes.bool, limit: PropTypes.number.isRequired, page: PropTypes.number.isRequired, isLoading: PropTypes.bool.isRequired, onFetchData: PropTypes.func.isRequired, onRowClick: PropTypes.func, cardTitle: PropTypes.string }; onFetchData = (state) => { this.props.onFetchData( state.page, state.pageSize, state.sorted, state.filtered ); }; onPageAction = (pageState) => { const { totalCount } = this.props; const gridState = this.refs.grid.state; const { page, pageSize, sorted, filtered } = gridState; let state = { page, pageSize, sorted, filtered }; if (pageState.limitByPage) { state.pageSize = pageState.limitByPage; } if (pageState.currentPage) { state.page = pageState.currentPage - 1; } if (totalCount < state.pageSize) { state.page = 0; } this.onFetchData(state); }; getPagination = () => { const { showTotalCount = false, totalCount, page, limit } = this.props; const numPages = Math.ceil(totalCount / limit); return totalCount > 0 ? (