Skip to content
Snippets Groups Projects
Applications.js 2.55 KiB
Newer Older
  • Learn to ignore specific revisions
  • import React, { Component } from 'react';
    import { Link } from 'react-router-dom';
    
    import { Container, Table, Label, Button } from 'semantic-ui-react';
    
    import { connect } from 'react-redux';
    
    import { getProfiles, setStatus } from '../../actions/statistics';
    
    import ConfirmModal from '../forms/ConfirmModal';
    
    
    class Applications extends Component {
      componentWillMount() {
    
        this.props.getProfiles();
    
      }
    
      renderApplicants() {
    
        return this.props.profiles.map((profile) =>
    
        { return (
          <Table.Row>
            <Table.Cell>
    
              </Link>
            </Table.Cell>
    
            { profile.signed ?
              <Table.Cell textAlign='center'>
                { profile.role === 'Student' ?
                  <Label color='green'>Elfogadva</Label>
    
                  null
                }
                { profile.role === 'Staff' ?
                  <Label color='blue'>Staff</Label>
                  :
                  null
                }
    
                { profile.role === 'Applicant' ?
                  <Label color='orange'>Jelentkezett</Label>
    
                  :
                  null
                }
                { profile.role === 'Denied' ?
                  <Label color='red'>Elutasítva</Label>
                  :
                  null
                }
              </Table.Cell>
              :
              <Table.Cell textAlign='center'>
                <Label color='red'>Nem jelentkezett</Label>
              </Table.Cell>
            }
    
    Chif Gergő's avatar
    Chif Gergő committed
            <Table.Cell>
    
            <ConfirmModal
              button = {<Button
    
    Chif Gergő's avatar
    Chif Gergő committed
                color='blue'
                size='tiny'
              >
              ADD STAFF STATUS
    
            </Button>}
            text='staff jogot adsz neki'
            onAccept={() => this.props.setStatus(profile.id, 'Staff')}
            />
    
    Chif Gergő's avatar
    Chif Gergő committed
            </Table.Cell>
    
          </Table.Row>
        );
        });
      }
    
      render() {
        return (
          <Container
            textAlign='center'
            style={{
              padding: '80px'
            }}
          >
            <Table color='blue' celled selectable compact>
              <Table.Header>
                <Table.Row>
                  <Table.HeaderCell>Jelentkezettek</Table.HeaderCell>
    
                  <Table.HeaderCell textAlign='center'>Jelentkezés státusza:</Table.HeaderCell>
    
    Chif Gergő's avatar
    Chif Gergő committed
                  <Table.HeaderCell />
    
                </Table.Row>
              </Table.Header>
    
              <Table.Body>
    
                {this.renderApplicants()}
    
              </Table.Body>
            </Table>
          </Container>
        );
      }
    }
    
    
    const mapStateToProps = ({ trainees: { profiles }, user }) => ({ profiles, user });
    
    export default connect(mapStateToProps, { getProfiles, setStatus })(Applications);