Commit 23c4a9e94d77e08909f59bde82ef1ef3041232fc

Authored by ajaiprakash
Exists in master

Merge branch 'master' of https://bitbucket.org/youngdesk/ydapp

client/stylesheets/custom.css
... ... @@ -4,3 +4,33 @@ body
4 4 background: -o-linear-gradient(#00b395, #00cdaa);
5 5 background: linear-gradient(#00b395, #00cdaa);
6 6 }
  7 +
  8 +table .dropdown span{
  9 + color: #000000;
  10 +}
  11 +table .dropdown-toggle{
  12 + cursor: pointer;
  13 +}
  14 +table .dropdown .fa{
  15 + display: inline;
  16 + margin: 6px 6px;
  17 +}
  18 +table .dropdown-menu {
  19 + min-width: 134px;
  20 +}
  21 +table .dropdown-menu > li {
  22 + cursor: pointer;
  23 +}
  24 +table .dropdown-menu > li:hover{
  25 + text-decoration: none;
  26 + color: #333333;
  27 + background-color: #f5f5f5;
  28 +}
  29 +table .dropdown-menu > li > span{
  30 + padding: 6px 16px;
  31 + display: block;
  32 +}
  33 +.panel-body{
  34 + max-height: 550px;
  35 + overflow-y: scroll;
  36 +}
... ...
imports/client/views/org/admin/students/view/StudentRow.js
... ... @@ -12,15 +12,25 @@ export class StudentRow extends Component {
12 12 constructor(props) {
13 13 super(props);
14 14 this.state = {
15   -
  15 + editOpen: false,
16 16 };
17 17 this.onUpdate = this.onUpdate.bind(this);
  18 + this.toggleEditOpen = this.toggleEditOpen.bind(this);
  19 + this.deleteStudent = this.deleteStudent.bind(this);
18 20 };
19 21  
20 22 onUpdate(key, value) {
21 23 this.setState({[key]: value});
22 24 };
23   -
  25 + toggleEditOpen(){
  26 + this.setState({
  27 + editOpen : !this.state.editOpen
  28 + })
  29 + }
  30 + deleteStudent(){
  31 + console.log("Delete");
  32 + console.log(this.props.student._id);
  33 + }
24 34 render() {
25 35 const {student} = this.props;
26 36 if(student.firstName){
... ... @@ -33,14 +43,14 @@ export class StudentRow extends Component {
33 43 <td><span className="label label-success">Active</span></td>
34 44 <td className="text-center">
35 45 <ul className="icons-list">
36   - <li className="dropdown">
37   - <a href="#" className="dropdown-toggle" data-toggle="dropdown">
  46 + <li className={this.state.editOpen? "dropdown open": "dropdown" }>
  47 + <span className="dropdown-toggle" onClick={this.toggleEditOpen}>
38 48 <i className="icon-menu9"></i>
39   - </a>
  49 + </span>
40 50 <ul className="dropdown-menu dropdown-menu-right">
41   - <li><a href="#"><i className="icon-file-pdf"></i> Export to .pdf</a></li>
42   - <li><a href="#"><i className="icon-file-excel"></i> Export to .csv</a></li>
43   - <li><a href="#"><i className="icon-file-word"></i> Export to .doc</a></li>
  51 + <li onClick={this.viewStudent}><Link to={`/student/${student._id}`}><span><i className="fa fa-binoculars"></i>View </span></Link></li>
  52 + <li onClick={this.editStudent}><span><i className="fa fa-pencil-square"></i> Edit </span></li>
  53 + <li onClick={this.deleteStudent}><span><i className="fa fa-exclamation-triangle"></i> Delete</span></li>
44 54 </ul>
45 55 </li>
46 56 </ul>
... ...
imports/client/views/org/admin/students/view/StudentTable.js
... ... @@ -5,7 +5,7 @@ import React, { Component } from &#39;react&#39;;
5 5 import { Link,browserHistory } from 'react-router';
6 6 import { FormGroup,Panel,Table,
7 7 ButtonToolbar,Modal,
8   - FormControl,Glyphicon,Button } from 'react-bootstrap';
  8 + FormControl,Glyphicon,Button, } from 'react-bootstrap';
9 9 import {moment} from 'meteor/momentjs:moment'
10 10 import {StudentRow} from './StudentRow'
11 11  
... ... @@ -14,14 +14,18 @@ export class StudentTable extends Component {
14 14 constructor(props) {
15 15 super(props);
16 16 this.state = {
17   - show: false
  17 + show: false,
  18 + panleOpen: true,
18 19 };
19 20 this.onUpdate = this.onUpdate.bind(this);
  21 + this.togglePanel = this.togglePanel.bind(this);
20 22 };
21 23 onUpdate(key, value) {
22 24 this.setState({[key]: value});
23 25 };
24   -
  26 + togglePanel(){
  27 + this.setState({panleOpen: !this.state.panleOpen});
  28 + }
25 29 render() {
26 30 return (
27 31 <div className="panel panel-flat">
... ... @@ -29,35 +33,37 @@ export class StudentTable extends Component {
29 33 <h5 className="panel-title">Student Details</h5>
30 34 <div className="heading-elements">
31 35 <ul className="icons-list">
32   - <li><a data-action="collapse"></a></li>
33   - <li><a data-action="reload"></a></li>
  36 + <li onClick={this.togglePanel}><a data-action="collapse" className={this.state.panleOpen?"rotate-180":null}></a></li>
34 37 </ul>
35 38 </div>
36 39 </div>
37   - <Table striped bordered condensed hover>
38   - <thead>
39   - <tr>
40   - <th>First Name</th>
41   - <th>Last Name</th>
42   - <th>Class</th>
43   - <th>DOB</th>
44   - <th>Status</th>
45   - <th className="text-center">Actions</th>
46   - </tr>
47   - </thead>
48   - <tbody>
49   - {
50   - this.props.students.map(function(student, i)
51   - {
52   - return(
53   - <StudentRow
54   - student = {student}
55   - />
56   - )
57   - })
58   - }
59   - </tbody>
60   - </Table>
  40 + <Panel collapsible expanded={this.state.panleOpen}>
  41 + <Table striped bordered condensed hover>
  42 + <thead>
  43 + <tr>
  44 + <th>First Name</th>
  45 + <th>Last Name</th>
  46 + <th>Class</th>
  47 + <th>DOB</th>
  48 + <th>Status</th>
  49 + <th className="text-center">Actions</th>
  50 + </tr>
  51 + </thead>
  52 + <tbody>
  53 + {
  54 + this.props.students.map(function(student, i)
  55 + {
  56 + return(
  57 + <StudentRow
  58 + key = { i }
  59 + student = {student}
  60 + />
  61 + )
  62 + })
  63 + }
  64 + </tbody>
  65 + </Table>
  66 + </Panel>
61 67 </div>
62 68 );
63 69 };
... ...
imports/collections/staff/methods.js
... ... @@ -76,7 +76,8 @@ export const staffAddNew = new ValidatedMethod({
76 76 specialization: data.specialization,
77 77 university: data.university,
78 78 degreeFrom: data.degreeFrom,
79   - degreeEnded: data.degreeEnded
  79 + degreeEnded: data.degreeEnded,
  80 + doj: data.doj
80 81 });
81 82 }
82 83 console.log("newStaffId");
... ...
imports/collections/students/index.js
... ... @@ -63,7 +63,7 @@ Students.deny({
63 63 Students.schema = new SimpleSchema({
64 64 userId: { type: String },
65 65 orgId: { type: String },
66   - admissionId: { type: String, optional: true ,unique: true,},
  66 + admissionId: { type: String, optional: true },
67 67 enrollmentDate: { type: String, optional: true },
68 68 address: { type: String, optional: true },
69 69 prefix: { type: String, optional: true },
... ...
imports/collections/students/serverCsvUpload.js
... ... @@ -36,7 +36,7 @@ export const save_csv_data = new ValidatedMethod({
36 36 validate: null,
37 37  
38 38 run({item,filename,csv_fiels}) {
39   -
  39 +
40 40 if ((item.length))
41 41 { console.log("++++++++++++++++++"+item.length)
42 42 var csv = json2csv({
... ... @@ -101,7 +101,7 @@ export const addStudentCSV= new ValidatedMethod({
101 101 bloodGroup: data['Blood Group*'],
102 102 nationality: data['Nationality*'],
103 103 motherTongue: data['Mother Tongue*'],
104   - religion: data['Religion*'],
  104 + religion: data['Religion*'],
105 105 community: data['Community'],
106 106  
107 107 rollNo: data['Student Roll*'],
... ... @@ -109,15 +109,15 @@ export const addStudentCSV= new ValidatedMethod({
109 109 section: data['Student Section Name*'],
110 110  
111 111 prevInstitute: [{ name: data['Previous Institution Name'],
112   - fromYear: data['Class-From'],
  112 + fromYear: data['Class-From'],
113 113 toYear: data['Class-To'],
114 114 fromClass: data['From-Year'],
115   - toClass: data['To-Year']
  115 + toClass: data['To-Year']
116 116 }],
117 117 permanentAddress: { street: data['Student Line Adress*'],
118   - city: data['Student City*'],
  118 + city: data['Student City*'],
119 119 state: data['Student State*'],
120   - zip: data['Student Zip Code*']
  120 + zip: data['Student Zip Code*']
121 121 },
122 122 parent: [{id: newParentUserId, relatinship: data['Parent Relation*']}]
123 123 });
... ... @@ -147,8 +147,8 @@ export const studentUploadCsv = new ValidatedMethod({
147 147 var CSV_valid_buffer = [];
148 148 var CSV_invalid_buffer = [];
149 149 var filename = "Student" + new Date().getTime().toString();
150   - var csv_filepath = '/Users/satheeshnagaraj/Documents/Workspace/Meteor/Youngdesk/ydapp/CSV_Files/';
151   -
  150 + var csv_filepath = '/Users/deepak/dev/yd/csv';
  151 +
152 152  
153 153  
154 154 for (let i = 0; i < data.length; i++)
... ... @@ -195,6 +195,10 @@ export const studentUploadCsv = new ValidatedMethod({
195 195 {
196 196 CSV_valid_buffer.push(item);
197 197 console.log("----------------------------------------1");
  198 + console.log("----------------------------------------item");
  199 + console.log(item);
  200 + console.log (Users.findOne({"firstName": item["First Name*"],"lastName": item["Last Name*"]}));
  201 +
198 202 Meteor.call('student.addCSV',item);
199 203 console.log("----------------------------------------2");
200 204  
... ...