import React from 'react';
import { Carousel } from 'antd';
import SupplierList from './list';
import SupplierEdit from './edit';
import { SUPPLIER_PAGE_ENUM } from '../enums/supplier_enums';

class SupplierPage extends React.Component {
  constructor(props) {
    super(props);
    this.myRef = React.createRef();
  }
  componentDidMount() {
    let pageIdx = window.sessionStorage.getItem('supplier.pageIdx');
    this.toShowPage(pageIdx || SUPPLIER_PAGE_ENUM.LIST);
  }
  toShowPage = pageIdx => {
    this.myRef.current.goTo(pageIdx, true);
  }
  render() {
    return (
      <Carousel dots={false} ref={this.myRef}>
        <div>
          <SupplierList />
        </div>
        <div>
          <SupplierEdit />
        </div>
      </Carousel>
    )
  }
}
export default SupplierPage;