-
-
-

+
+
+
+
+
-
-
Teachers Click to view
+
+
+
Teachers
+
Click to view
-
+
+
+
+
+
+
+
+
+
+
+

+
+
+
+
Parents
+
Click to view
+
+
+
diff --git a/imports/client/views/org/admin/header.css b/imports/client/views/org/admin/header.css
new file mode 100644
index 0000000..07c32cf
--- /dev/null
+++ b/imports/client/views/org/admin/header.css
@@ -0,0 +1,5 @@
+.img-circle
+{
+ width: 70px;
+ height: 70px;
+}
diff --git a/imports/client/views/org/admin/parents/index.js b/imports/client/views/org/admin/parents/index.js
new file mode 100644
index 0000000..91ae565
--- /dev/null
+++ b/imports/client/views/org/admin/parents/index.js
@@ -0,0 +1,66 @@
+import _ from 'lodash';
+import {
+ composeWithTracker,
+ compose,
+ composeAll
+ } from 'react-komposer';
+import { Loading } from '/imports/client/components/Loading';
+
+import { Orgs } from '/imports/collections/orgs/index';
+import { Users } from '/imports/collections/users/index';
+import { Parents } from '/imports/collections/parents/index';
+import { ParentsView } from './parentsview';
+
+
+
+const meteorTick = (props, onData) => {
+
+ const handles = [
+ Meteor.subscribe('users.current'),
+ Meteor.subscribe('orgs.current'),
+ Meteor.subscribe('users.forMyOrg'),
+ Meteor.subscribe('parent.forMyOrg'),
+ ];
+
+ if(_.every(handles, (handle) => (handle.ready()) )) {
+ const user = Users.current();
+ const org = Orgs.current();
+ console.log("parents");
+ parent = Users.find({"role":"PARENT"}).fetch() ? Users.find({"role":"PARENT"}).fetch() : "";
+ console.log(Users.find({"role":"PARENT"}).fetch());
+ parentData = Parents.find().fetch() ? Parents.find().fetch() : "";
+ console.log("parentData");
+ console.log(parentData);
+ for(var i=0; i< parent.length; i++){
+ for(var j=0; j< parentData.length; j++){
+ if(parent[i]._id == parentData[j].userId){
+ parent[i].relationship = parentData[j].relationship;
+ }
+ }
+ }
+ onData(null, {
+ data: {
+ user: user,
+ org: org,
+ parent: parent
+ },
+ });
+ }
+
+ return () => {
+ _.each(handles, (handle) => handle.stop() );
+ };
+};
+
+
+const reduxTick = (props, onData) => {
+ onData(null, {
+ data: {}
+ });
+};
+
+
+export const ParentViewController = composeAll(
+ composeWithTracker(meteorTick, Loading),
+ compose(reduxTick, Loading),
+)(ParentsView);
diff --git a/imports/client/views/org/admin/parents/parentsview.js b/imports/client/views/org/admin/parents/parentsview.js
new file mode 100644
index 0000000..b7a7f38
--- /dev/null
+++ b/imports/client/views/org/admin/parents/parentsview.js
@@ -0,0 +1,108 @@
+import _ from 'lodash';
+import { Meteor } from 'meteor/meteor';
+
+import React, { Component } from 'react';
+import { Link,browserHistory } from 'react-router';
+import { FormGroup,
+ FormControl,Glyphicon,Button } from 'react-bootstrap';
+import { Header } from '../Header';
+import { AdminSidebar } from '../Sidebar'
+import { AdminBreadcrumb } from '../Breadcrumb'
+import { ParentTable } from './view/ParentTable'
+
+
+export class ParentsView extends Component {
+
+ constructor(props) {
+ super(props);
+ this.state = {
+
+ };
+ this.onUpdate = this.onUpdate.bind(this);
+ };
+
+ onUpdate(key, value) {
+ this.setState({[key]: value});
+ };
+
+ render() {
+ const {user, org, parent} = this.props.data;
+ return (
+
+ );
+ };
+
+
+};
diff --git a/imports/client/views/org/admin/parents/view/ParentRow.js b/imports/client/views/org/admin/parents/view/ParentRow.js
new file mode 100644
index 0000000..130b080
--- /dev/null
+++ b/imports/client/views/org/admin/parents/view/ParentRow.js
@@ -0,0 +1,54 @@
+import _ from 'lodash';
+import { Meteor } from 'meteor/meteor';
+
+import React, { Component } from 'react';
+import { Link,browserHistory } from 'react-router';
+import { FormGroup,
+ FormControl,Glyphicon,Button } from 'react-bootstrap';
+
+
+ export class ParentRow extends Component {
+
+ constructor(props) {
+ super(props);
+ this.state = {
+
+ };
+ this.onUpdate = this.onUpdate.bind(this);
+ };
+
+ onUpdate(key, value) {
+ this.setState({[key]: value});
+ };
+
+ render() {
+ const {parent} = this.props;
+ if(parent.firstName){
+ return (
+
+ {parent.firstName} |
+ {parent.relationship} | {/* relationship doesnt reflect here */}
+ Active |
+
+
+ |
+
+ );
+ }else {
+ return null;
+ }
+
+ };
+
+ };
diff --git a/imports/client/views/org/admin/parents/view/ParentTable.js b/imports/client/views/org/admin/parents/view/ParentTable.js
new file mode 100644
index 0000000..0b7a34d
--- /dev/null
+++ b/imports/client/views/org/admin/parents/view/ParentTable.js
@@ -0,0 +1,64 @@
+import _ from 'lodash';
+import { Meteor } from 'meteor/meteor';
+
+import React, { Component } from 'react';
+import { Link,browserHistory } from 'react-router';
+import { FormGroup,Panel,Table,
+ ButtonToolbar,Modal,
+ FormControl,Glyphicon,Button } from 'react-bootstrap';
+import {moment} from 'meteor/momentjs:moment'
+import {ParentRow} from './ParentRow'
+
+export class ParentTable extends Component {
+
+ constructor(props) {
+ super(props);
+ this.state = {
+ show: false
+ };
+ this.onUpdate = this.onUpdate.bind(this);
+ };
+ onUpdate(key, value) {
+ this.setState({[key]: value});
+ };
+
+ render() {
+ return (
+
+
+
+
+
+ First Name |
+ Relationship |
+ Status |
+ Actions |
+
+
+
+ {
+ this.props.parent.map(function(parent, i)
+ {
+ return(
+
+ )
+ })
+ }
+
+
+
+ );
+ };
+
+};
diff --git a/imports/client/views/org/admin/students/index.js b/imports/client/views/org/admin/students/index.js
index f0d6b76..6a007fb 100644
--- a/imports/client/views/org/admin/students/index.js
+++ b/imports/client/views/org/admin/students/index.js
@@ -26,6 +26,7 @@ const meteorTick = (props, onData) => {
const user = Users.current();
const org = Orgs.current();
students = Users.find({"role":"STUDENT"}).fetch() ? Users.find({"role":"STUDENT"}).fetch() : "";
+ console.log(students);
studentData = Students.find().fetch() ? Students.find().fetch() : "";
for(var i=0; i< students.length; i++){
for(var j=0; j< studentData.length; j++){
diff --git a/imports/collections/parents/methods.js b/imports/collections/parents/methods.js
index 9f0728c..d9ac05c 100644
--- a/imports/collections/parents/methods.js
+++ b/imports/collections/parents/methods.js
@@ -8,8 +8,8 @@ import { Bert } from 'meteor/themeteorchef:bert';
import { Users } from '/imports/collections/users/index';
import { Students } from '/imports/collections/students/index';
import { Orgs } from '/imports/collections/orgs/index';
-export const studentMethods = new ValidatedMethod({
- name: 'student.method',
+export const parentMethods = new ValidatedMethod({
+ name: 'parent.method',
validate: new SimpleSchema({
itemId: { type: String },
@@ -20,80 +20,3 @@ export const studentMethods = new ValidatedMethod({
},
});
-
-export const addStudentManually = new ValidatedMethod({
- name: 'student.addManually',
-
- validate: new SimpleSchema({
- admissionId: { type: String },
- firstName: { type: String },
- middleName: { type: String },
- lastName: { type: String },
- email: { type: String },
- dob: { type: String },
- formattedDob: { type: String },
- gender: { type: String },
- rollNo: { type: String },
- studentclass: { type: String },
- section: { type: String },
- community: { type: String },
- bloodGroup: { type: String },
- phone: { type: String },
- address: { type: String },
- city: { type: String },
- state: { type: String },
- parentName: { type: String },
- parentEmail: { type: String },
- relation: { type: String },
- profession: { type: String },
- parentGender: { type: String },
- parentPhone: { type: String },
- parentAddress: { type: String },
- parentCity: { type: String },
- parentState: { type: String },
- parentZipcode: { type: String },
- }).validator(),
-
- run(data) {
- console.log("data");
- console.log(data);
- const user = Users.findOne({_id: this.userId});
- orgId = user.orgId;
- newStudentId = Users.insert({
- emails: [data.email],
- username: firstName,
- firstName: firstName,
- middleName: middleName,
- lastName: lastName,
- orgId: orgId,
- role: 'STUDENT'
- });
- newParentId = Users.insert({
- emails: [data.parentEmail],
- username: parentName,
- firstName: parentName,
- orgId: orgId,
- role: 'PARENT'
- });
- console.log("newUserId");
- console.log(newUserId);
- if(newUserId){
- Students.insert({
- userId: newUserId,
- orgId: orgId,
- admissionId: data.admissionId,
- address: data.address,
- gender: data.gender,
- dob: data.dob,
- rollNo: data.rollNo,
- class: data.studentclass,
- section: data.section,
- bloodGroup: data.bloodGroup,
- community: data.community,
-
- });
- }
- return {newUserId};
- },
-
-});
diff --git a/imports/collections/parents/publications.js b/imports/collections/parents/publications.js
new file mode 100644
index 0000000..bba437b
--- /dev/null
+++ b/imports/collections/parents/publications.js
@@ -0,0 +1,12 @@
+import { Meteor } from 'meteor/meteor';
+import { check, Match } from 'meteor/check'
+
+import { Orgs } from '/imports/collections/orgs/index';
+import { Users } from '/imports/collections/users/index';
+import { Parents } from '/imports/collections/parents/index';
+
+Meteor.publish('parent.forMyOrg', function () {
+ const user = Users.findOne({_id: this.userId});
+ if(!user) return [];
+ return Parents.find({orgId: user.orgId});
+});
diff --git a/imports/server/collections.js b/imports/server/collections.js
index e4c0235..62dc553 100644
--- a/imports/server/collections.js
+++ b/imports/server/collections.js
@@ -10,3 +10,6 @@ import '/imports/collections/students/serverCsvUpload';
import '/imports/collections/staff/methods';
import '/imports/collections/staff/publications';
import '/imports/collections/staff/serverCsvUpload';
+
+import '/imports/collections/parents/methods';
+import '/imports/collections/parents/publications';