From 2b20f4fbae18b34a6deee9a803e8d7904a0e1803 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Chif=20Gerg=C5=91?= <chifgeri97@gmail.com>
Date: Sat, 19 Jan 2019 20:33:11 +0100
Subject: [PATCH] Create page to administrate applicants

---
 src/components/Header.js             |  5 +++
 src/components/Main.js               |  2 +
 src/components/pages/Applications.js | 56 ++++++++++++++++++++++++++++
 3 files changed, 63 insertions(+)
 create mode 100644 src/components/pages/Applications.js

diff --git a/src/components/Header.js b/src/components/Header.js
index e84ddf4..df8fd7c 100644
--- a/src/components/Header.js
+++ b/src/components/Header.js
@@ -39,6 +39,11 @@ const menuItems = [
     to: '/statistics',
     prefix: '',
   },
+  {
+    text: 'JelentkezĂŠsek',
+    to: '/applications',
+    prefix: '',
+  },
 ]
 
 const FixedMenu = ({ user }) => (
diff --git a/src/components/Main.js b/src/components/Main.js
index 8f917c6..9529bc6 100644
--- a/src/components/Main.js
+++ b/src/components/Main.js
@@ -9,6 +9,7 @@ import Profile from './pages/Profile';
 import Statistics from './pages/Statistics';
 import Groups from './pages/Groups';
 import News from './pages/News';
+import Applications from './pages/Applications';
 import EventDetail from './pages/EventDetail';
 
 const Main = () => (
@@ -22,6 +23,7 @@ const Main = () => (
     <Route path='/statistics' component={Statistics} />
     <Route path='/groups' component={Groups} />
     <Route path='/events/:id' component={EventDetail} />
+    <Route path='/applications' component={Applications} />
     <Route component={NotFound} />
   </Switch>
 );
diff --git a/src/components/pages/Applications.js b/src/components/pages/Applications.js
new file mode 100644
index 0000000..563d3ae
--- /dev/null
+++ b/src/components/pages/Applications.js
@@ -0,0 +1,56 @@
+import React, { Component } from 'react';
+import moment from 'moment';
+import { Link } from 'react-router-dom';
+import { Container, Table, Button } from 'semantic-ui-react';
+import { connect } from 'react-redux';
+import { getTrainees } from '../../actions/statistics';
+
+class Applications extends Component {
+  componentWillMount() {
+    this.props.getTrainees();
+  }
+
+  renderApplicants() {
+    return this.props.trainees.map((trainee) =>
+    { return (
+      <Table.Row>
+        <Table.Cell>
+          <Link to={`trainee/${trainee.id}`}>
+            {trainee.full_name}
+          </Link>
+        </Table.Cell>
+        <Table.Cell>
+        </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>JelentkezĂŠs elfogadva:</Table.HeaderCell>
+            </Table.Row>
+          </Table.Header>
+
+          <Table.Body>
+            {this.props.trainees ? this.renderApplicants() : 'Nincs mĂŠg alaklom beĂ­rva'}
+          </Table.Body>
+        </Table>
+      </Container>
+    );
+  }
+}
+
+const mapStateToProps = ({ trainees: { trainees }, user }) => ({ trainees, user });
+
+export default connect(mapStateToProps, { getTrainees })(Applications);
-- 
GitLab