text: /**
   *
   * ManageStudents
   *
   */
  
  import React from 'react';
  import { Table, Button, Icon, Popconfirm, message } from 'antd';
  import {
      manageStudentsApiResponse,
  } from './ManageStudents.constants';
  
  import ManageStudentsAddEditModal from './ManageStudentsAddEditModal';
  
  import {
      filterArray,
  } from '../../utils/utilityFunctions';
  
  import {
      InputFilterContainer,
      InputField,
      IconContainer,
      ActionContainer,
  } from './ManageStudents.styled';
  
  class ManageStudents extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
      constructor(props) {
          super(props);
          this.state = {
              filterValue: '',
              dataSource: manageStudentsApiResponse.data,
              addEditModalStatus: '',
              addEditingStudentData: null,
          }
      }
  
      componentDidMount() {
          this.getStudentListApiCAllFunction();
      }
  
      getStudentListApiCAllFunction = () => {
          //api for get all stds
          // this.state.dataSource
          
      }
      startNewAssessment = () =>{
          console.log("start new assess");
          this.props.history.push('/login'); 
      }
  
      pastAssessment = () =>{
          console.log("past assess");
          this.props.history.push('/pastAssessment'); 
      }
      
      changeFilter = (event) => {
          this.setState({ filterValue: event.target.value });
      }
  
      editStudentData = (data) => {
          this.setState({
              addEditModalStatus: 'edit',
              addEditingStudentData: data
          });
      }
  
      createNewStudent = () => {
          this.setState({ addEditModalStatus: 'add' });
      }
  
      cancelAddEdit = () => {
          this.setState({
              addEditModalStatus: '',
              addEditingStudentData: null
          });
      }
  
      deleteStudent = (studentId) => {
          //delete api call
          message.success('Student successfully deleted');
          this.getStudentListApiCAllFunction();
      }
  
      updateListingData = () => {
          this.getStudentListApiCAllFunction();
          this.cancelAddEdit();
      }
  
      render() {
  
          const manageStudentsColumns = [
              {
                  title: 'Name',
                  dataIndex: 'studentName',
                  key: 'studentName',
              },
              {
                  title: 'Reference ID',
                  dataIndex: 'studentReferenceNumber',
                  key: 'studentReferenceNumber',
              },
              // {
              //     title: 'Address',
              //     dataIndex: 'studentContactNo',
              //     key: 'studentContactNo',
              // },
              {
                  title: 'Organization Name',
                  dataIndex: 'organization.orgName',
                  key: 'organization',
              },
              {
                  title: 'Coach Name',
                  dataIndex: 'userID',
                  key: 'userID',
              },
              {
                  title: '',
                  dataIndex: '',
                  key: '',
                  render: () => <button onClick={() => this.startNewAssessment()}>Start New Assessment</button>,
              },
              {
                  title: '',
                  dataIndex: '',
                  key: '',
                  render: () => <button onClick={() => this.pastAssessment()}>Past Assessment</button>,
              },
              
          ];
  
          const { filterValue, dataSource, addEditModalStatus = '', addEditingStudentData } = this.state;
  
          let filteredDataSource = dataSource;
  
          if (filterValue && filterValue.length) {
              filteredDataSource = filterArray(dataSource, filterValue, ['studentName', 'studentReferenceNumber', 'organization.orgName', 'userID']);
          }
  
          return (
              <div>
                  <InputFilterContainer>
                      <InputField
                          onChange={this.changeFilter}
                          value={filterValue}
                          placeholder="Enter Filter"
                      />
                      <Button
                          type="primary"
                          onClick={this.createNewStudent}
                      >
                          Add Student
                      </Button>
                  </InputFilterContainer>
                  <Table
                      dataSource={filteredDataSource}
                      columns={manageStudentsColumns}
                  />
                  {addEditModalStatus && addEditModalStatus.length ? (
                      <ManageStudentsAddEditModal
                          addEditModalStatus={addEditModalStatus}
                          addEditingStudentData={addEditingStudentData}
                          cancelAddEdit={this.cancelAddEdit}
                          updateListingData={this.updateListingData}
                      />
                  ) : null}
              </div>
          )
      }
  }
  
  
  export default ManageStudents;
  