StudentView.js
2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import _ from 'lodash';
import { Meteor } from 'meteor/meteor';
import React, { Component } from 'react';
import { Link,browserHistory } from 'react-router';
import { Navbar,Modal, Nav, NavItem,
Glyphicon, Collapse, FormGroup, FormControl, Panel,
NavbarToggler, NavbarBrand, Table, ButtonToolbar,
NavLink, DropdownItem, DropdownToggle, DropdownMenu,
NavDropdown, MenuItem, Breadcrumb, Button } from 'react-bootstrap';
import { StudentTable } from './view/StudentTable';
import { Header } from '../Header';
import { AdminSidebar } from '../Sidebar'
import { AdminBreadcrumb } from '../Breadcrumb'
import { UploadCsv } from './UploadCsv';
import { AddStudent } from './add/addStudent';
import { Students } from '/imports/collections/students/index';
import './student.css'
export class StudentView extends Component {
constructor(props) {
super(props);
this.state = {
show: false,
firstNameSearch: "",
lastNameSearch: "",
};
this.showModal = this.showModal.bind(this);
this.hideModal = this.hideModal.bind(this);
this.onUpdate = this.onUpdate.bind(this);
};
showModal() {
this.setState({show: true});
}
hideModal() {
this.setState({show: false});
}
onUpdate(key, value) {
this.setState({[key]: value});
};
render() {
firstNameSearch = this.state.firstNameSearch;
lastNameSearch = this.state.lastNameSearch;
var students =_.filter(this.props.data.students,function(item){
if(item.firstName){
return _.includes(item.firstName.toLowerCase(),firstNameSearch.toLowerCase());
}
});
return (
<div className="appLayout-box">
<div className="page-container">
<div className="page-content">
<AdminSidebar
user = {this.props.data.user}
org = {this.props.data.org}
/>
{/*end sidebar*/}
<div className="content-wrapper">
<AdminBreadcrumb />
{/*content*/}
<div className="content has-detached-left">
<div className="container-detached">
<div className="">
<Header/>
<StudentTable
data = {this.props.data}
students = {students}
/>
<AddStudent/>
<UploadCsv />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
};
};