From e277faafa49eaaea41b5bbea47e4ba9baf97e00e Mon Sep 17 00:00:00 2001 From: Deepak Date: Thu, 20 Apr 2017 22:54:23 +0530 Subject: [PATCH] added different users view --- imports/client/app/routes.js | 29 +- imports/client/views/org/admin/settings/Header.js | 85 ---- imports/client/views/org/admin/settings/header.css | 10 - .../views/org/admin/settings/parents/index.js | 72 --- .../org/admin/settings/parents/parentsview.js | 48 -- .../org/admin/settings/parents/view/ParentRow.js | 54 --- .../org/admin/settings/parents/view/ParentTable.js | 70 --- .../views/org/admin/settings/staff/StaffView.js | 44 -- .../org/admin/settings/staff/UploadCsvStaff.js | 103 ----- .../settings/staff/add/AddStaffFormContainer.js | 123 ----- .../org/admin/settings/staff/add/StaffForm.js | 417 ----------------- .../views/org/admin/settings/staff/add/addStaff.js | 66 --- .../client/views/org/admin/settings/staff/index.js | 70 --- .../org/admin/settings/staff/view/StaffRow.js | 56 --- .../org/admin/settings/staff/view/StaffTable.js | 85 ---- .../org/admin/settings/students/StudentDataView.js | 274 ----------- .../admin/settings/students/StudentDataView0.js | 88 ---- .../org/admin/settings/students/StudentView.js | 66 --- .../views/org/admin/settings/students/UploadCsv.js | 103 ----- .../students/add/AddStudentFormContainer.js | 130 ------ .../org/admin/settings/students/add/StudentForm.js | 474 ------------------- .../org/admin/settings/students/add/addStudent.js | 66 --- .../admin/settings/students/add/addStudentForm.js | 500 --------------------- .../views/org/admin/settings/students/index.js | 69 --- .../views/org/admin/settings/students/student.css | 5 - .../org/admin/settings/students/view/StudentRow.js | 66 --- .../admin/settings/students/view/StudentTable.js | 85 ---- .../views/org/admin/users/list/AdminUsersList.js | 63 +++ imports/client/views/org/admin/users/list/index.js | 50 +++ .../org/admin/users/module/AdminUserViewLayout.js | 50 +++ .../client/views/org/admin/users/module/Header.js | 85 ++++ .../client/views/org/admin/users/module/header.css | 10 + .../client/views/org/admin/users/module/index.js | 50 +++ .../client/views/org/admin/users/parents/index.js | 72 +++ .../views/org/admin/users/parents/parentsview.js | 43 ++ .../org/admin/users/parents/view/ParentRow.js | 54 +++ .../org/admin/users/parents/view/ParentTable.js | 70 +++ .../views/org/admin/users/staff/StaffView.js | 39 ++ .../views/org/admin/users/staff/UploadCsvStaff.js | 103 +++++ .../admin/users/staff/add/AddStaffFormContainer.js | 123 +++++ .../views/org/admin/users/staff/add/StaffForm.js | 417 +++++++++++++++++ .../views/org/admin/users/staff/add/addStaff.js | 66 +++ .../client/views/org/admin/users/staff/index.js | 70 +++ .../views/org/admin/users/staff/view/StaffRow.js | 56 +++ .../views/org/admin/users/staff/view/StaffTable.js | 85 ++++ .../org/admin/users/students/StudentDataView.js | 274 +++++++++++ .../org/admin/users/students/StudentDataView0.js | 88 ++++ .../views/org/admin/users/students/StudentView.js | 64 +++ .../views/org/admin/users/students/UploadCsv.js | 103 +++++ .../users/students/add/AddStudentFormContainer.js | 130 ++++++ .../org/admin/users/students/add/StudentForm.js | 474 +++++++++++++++++++ .../org/admin/users/students/add/addStudent.js | 66 +++ .../org/admin/users/students/add/addStudentForm.js | 500 +++++++++++++++++++++ .../client/views/org/admin/users/students/index.js | 69 +++ .../views/org/admin/users/students/student.css | 5 + .../org/admin/users/students/view/StudentRow.js | 66 +++ .../org/admin/users/students/view/StudentTable.js | 85 ++++ 57 files changed, 3448 insertions(+), 3240 deletions(-) delete mode 100644 imports/client/views/org/admin/settings/Header.js delete mode 100644 imports/client/views/org/admin/settings/header.css delete mode 100644 imports/client/views/org/admin/settings/parents/index.js delete mode 100644 imports/client/views/org/admin/settings/parents/parentsview.js delete mode 100644 imports/client/views/org/admin/settings/parents/view/ParentRow.js delete mode 100644 imports/client/views/org/admin/settings/parents/view/ParentTable.js delete mode 100644 imports/client/views/org/admin/settings/staff/StaffView.js delete mode 100644 imports/client/views/org/admin/settings/staff/UploadCsvStaff.js delete mode 100644 imports/client/views/org/admin/settings/staff/add/AddStaffFormContainer.js delete mode 100644 imports/client/views/org/admin/settings/staff/add/StaffForm.js delete mode 100644 imports/client/views/org/admin/settings/staff/add/addStaff.js delete mode 100644 imports/client/views/org/admin/settings/staff/index.js delete mode 100644 imports/client/views/org/admin/settings/staff/view/StaffRow.js delete mode 100644 imports/client/views/org/admin/settings/staff/view/StaffTable.js delete mode 100644 imports/client/views/org/admin/settings/students/StudentDataView.js delete mode 100644 imports/client/views/org/admin/settings/students/StudentDataView0.js delete mode 100644 imports/client/views/org/admin/settings/students/StudentView.js delete mode 100644 imports/client/views/org/admin/settings/students/UploadCsv.js delete mode 100644 imports/client/views/org/admin/settings/students/add/AddStudentFormContainer.js delete mode 100644 imports/client/views/org/admin/settings/students/add/StudentForm.js delete mode 100644 imports/client/views/org/admin/settings/students/add/addStudent.js delete mode 100644 imports/client/views/org/admin/settings/students/add/addStudentForm.js delete mode 100644 imports/client/views/org/admin/settings/students/index.js delete mode 100644 imports/client/views/org/admin/settings/students/student.css delete mode 100644 imports/client/views/org/admin/settings/students/view/StudentRow.js delete mode 100644 imports/client/views/org/admin/settings/students/view/StudentTable.js create mode 100644 imports/client/views/org/admin/users/list/AdminUsersList.js create mode 100644 imports/client/views/org/admin/users/list/index.js create mode 100644 imports/client/views/org/admin/users/module/AdminUserViewLayout.js create mode 100644 imports/client/views/org/admin/users/module/Header.js create mode 100644 imports/client/views/org/admin/users/module/header.css create mode 100644 imports/client/views/org/admin/users/module/index.js create mode 100644 imports/client/views/org/admin/users/parents/index.js create mode 100644 imports/client/views/org/admin/users/parents/parentsview.js create mode 100644 imports/client/views/org/admin/users/parents/view/ParentRow.js create mode 100644 imports/client/views/org/admin/users/parents/view/ParentTable.js create mode 100644 imports/client/views/org/admin/users/staff/StaffView.js create mode 100644 imports/client/views/org/admin/users/staff/UploadCsvStaff.js create mode 100644 imports/client/views/org/admin/users/staff/add/AddStaffFormContainer.js create mode 100644 imports/client/views/org/admin/users/staff/add/StaffForm.js create mode 100644 imports/client/views/org/admin/users/staff/add/addStaff.js create mode 100644 imports/client/views/org/admin/users/staff/index.js create mode 100644 imports/client/views/org/admin/users/staff/view/StaffRow.js create mode 100644 imports/client/views/org/admin/users/staff/view/StaffTable.js create mode 100644 imports/client/views/org/admin/users/students/StudentDataView.js create mode 100644 imports/client/views/org/admin/users/students/StudentDataView0.js create mode 100644 imports/client/views/org/admin/users/students/StudentView.js create mode 100644 imports/client/views/org/admin/users/students/UploadCsv.js create mode 100644 imports/client/views/org/admin/users/students/add/AddStudentFormContainer.js create mode 100644 imports/client/views/org/admin/users/students/add/StudentForm.js create mode 100644 imports/client/views/org/admin/users/students/add/addStudent.js create mode 100644 imports/client/views/org/admin/users/students/add/addStudentForm.js create mode 100644 imports/client/views/org/admin/users/students/index.js create mode 100644 imports/client/views/org/admin/users/students/student.css create mode 100644 imports/client/views/org/admin/users/students/view/StudentRow.js create mode 100644 imports/client/views/org/admin/users/students/view/StudentTable.js diff --git a/imports/client/app/routes.js b/imports/client/app/routes.js index 048eee0..53b217a 100644 --- a/imports/client/app/routes.js +++ b/imports/client/app/routes.js @@ -26,10 +26,14 @@ import { importCsvController } from '/imports/client/views/org/impo /** Admin **/ -import { StudentDataController } from '/imports/client/views/org/admin/settings/students/index' -import { staffViewController } from '/imports/client/views/org/admin/settings/staff/index' -import { ParentViewController } from '/imports/client/views/org/admin/settings/parents/index' import { AdminSettingsController } from '/imports/client/views/org/admin/settings/index' +// +import { AdminUsersModule } from '/imports/client/views/org/admin/users/module/index' +import { AdminUsersListController } from '/imports/client/views/org/admin/users/list/index' +import { StudentDataController } from '/imports/client/views/org/admin/users/students/index' +import { staffViewController } from '/imports/client/views/org/admin/users/staff/index' +import { ParentViewController } from '/imports/client/views/org/admin/users/parents/index' + //Admin mail import { AdminMailModule } from '/imports/client/views/org/admin/mailbox/module/index' import { AdminInboxController } from '/imports/client/views/org/admin/mailbox/inbox/index' @@ -56,20 +60,23 @@ There are three types of routes **/ const getOrgAdminRoutes = () => ( - - - - - - - + + + + + + + + + + - + ) diff --git a/imports/client/views/org/admin/settings/Header.js b/imports/client/views/org/admin/settings/Header.js deleted file mode 100644 index 5659f97..0000000 --- a/imports/client/views/org/admin/settings/Header.js +++ /dev/null @@ -1,85 +0,0 @@ -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.css'; - - -export class Header extends Component { - - constructor(props) { - super(props); - this.state = { - - }; - this.onUpdate = this.onUpdate.bind(this); - }; - - onUpdate(key, value) { - this.setState({[key]: value}); - }; - - render() { - return ( -
-
- -
- -
-
-
- -
- -
-
Students
-

Click to view

-
-
-
- -
-
- -
-
-
- -
- -
-
Teachers
-

Click to view

-
-
-
- -
- -
- -
-
-
- -
- -
-
Parents
-

Click to view

-
-
-
- -
- -
-
- ); - }; - -}; diff --git a/imports/client/views/org/admin/settings/header.css b/imports/client/views/org/admin/settings/header.css deleted file mode 100644 index e45826e..0000000 --- a/imports/client/views/org/admin/settings/header.css +++ /dev/null @@ -1,10 +0,0 @@ -.img-circle -{ - width: 70px; - height: 70px; -} - -.panel-body -{ - overflow-y:hidden; -} diff --git a/imports/client/views/org/admin/settings/parents/index.js b/imports/client/views/org/admin/settings/parents/index.js deleted file mode 100644 index a765b86..0000000 --- a/imports/client/views/org/admin/settings/parents/index.js +++ /dev/null @@ -1,72 +0,0 @@ -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) => { - Shelf.layout.set({ - bulb: 'SETTINGS', - subbulb: 'USERS', - view: 'PARENTS' - }); - 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; - parent[i].profession = parentData[j].profession; - 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/settings/parents/parentsview.js b/imports/client/views/org/admin/settings/parents/parentsview.js deleted file mode 100644 index 432c86f..0000000 --- a/imports/client/views/org/admin/settings/parents/parentsview.js +++ /dev/null @@ -1,48 +0,0 @@ -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 { 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}); - }; - togglePanel(){ - this.setState({panleOpen: !this.state.panleOpen}); - } - - render() { - const {user, org, parent} = this.props.data; - return ( -
-
- - {/* - */} -
- ); - }; - - -}; diff --git a/imports/client/views/org/admin/settings/parents/view/ParentRow.js b/imports/client/views/org/admin/settings/parents/view/ParentRow.js deleted file mode 100644 index 130b080..0000000 --- a/imports/client/views/org/admin/settings/parents/view/ParentRow.js +++ /dev/null @@ -1,54 +0,0 @@ -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/settings/parents/view/ParentTable.js b/imports/client/views/org/admin/settings/parents/view/ParentTable.js deleted file mode 100644 index 8bf1e54..0000000 --- a/imports/client/views/org/admin/settings/parents/view/ParentTable.js +++ /dev/null @@ -1,70 +0,0 @@ -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' -import {BootstrapTable, TableHeaderColumn}from 'react-bootstrap-table'; -const options = { - page: 0, // which page you want to show as default - sizePerPageList: [ { - text: '5', value: 5 - }, { - text: '10', value: 10 - }], // you can change the dropdown list for size per page - sizePerPage: 5, // which size per page you want to locate as default - pageStartIndex: 0, // where to start counting the pages - paginationSize: 3, // the pagination bar size. - prePage: 'Prev', // Previous page button text - nextPage: 'Next', // Next page button text - firstPage: 'First', // First page button text - lastPage: 'Last', // Last page button text - paginationShowsTotal: false, // Accept bool or function - paginationPosition: 'bottom' // default is bottom, top and both is all available - // hideSizePerPage: true > You can hide the dropdown for sizePerPage - // alwaysShowAllBtns: true // Always show next and previous button - // withFirstAndLast: false > Hide the going to First and Last page button - }; - -export class ParentTable extends Component { - - constructor(props) { - super(props); - this.state = { - show: false, - panleOpen: true, - }; - this.onUpdate = this.onUpdate.bind(this); - }; - onUpdate(key, value) { - this.setState({[key]: value}); - }; - - render() { - return ( -
-
-
Parent Details
-
-
    -
  • -
-
-
- - - Sr No - Name - Relationship - Profession - - -
- ); - }; - -}; diff --git a/imports/client/views/org/admin/settings/staff/StaffView.js b/imports/client/views/org/admin/settings/staff/StaffView.js deleted file mode 100644 index 47c73b8..0000000 --- a/imports/client/views/org/admin/settings/staff/StaffView.js +++ /dev/null @@ -1,44 +0,0 @@ -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 { StaffTable } from './view/StaffTable' -import { AddStaff } from './add/addStaff' -import { UploadCsvStaff } from './UploadCsvStaff' - -export class StaffView 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, staff} = this.props.data; - return ( -
-
- - - -
- ); - }; - -}; diff --git a/imports/client/views/org/admin/settings/staff/UploadCsvStaff.js b/imports/client/views/org/admin/settings/staff/UploadCsvStaff.js deleted file mode 100644 index 62da6d4..0000000 --- a/imports/client/views/org/admin/settings/staff/UploadCsvStaff.js +++ /dev/null @@ -1,103 +0,0 @@ -// import {UploadCsv } from '/imports/collections/students/UploadCsv' -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,ControlLabel,HelpBlock, - FormControl,Glyphicon,Button } from 'react-bootstrap'; -// import { AddStudentForm } from './addStudentForm'; -import { FilesCollection } from 'meteor/ostrio:files'; -const Papa = this.Papa; -// console.log(this); -const style = { - margin: 12, -}; -function FieldGroup({ id, label, help, ...props }) { - return ( - - {label} - - {help && {help}} - - ); -} -export class UploadCsvStaff extends Component { - constructor(props) { - super(props); - this.state = { - show: false - }; - 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}); - }; - uploadStaffCsv(e){ - e.preventDefault(); - e.persist(); - var file = $('input[type="file"]').prop("files")[0]; - Papa.parse(file, { - header: true, - complete: function(csvData) { - console.log("csvData"); - console.log(csvData); - if(csvData){ - Meteor.call('staff.uploadCsv', csvData, function (error, result) { - console.log("error"); - console.log(error); - console.log("result"); - console.log(result); - }) - } - } - }); - } - - render() { - console.log(this.props); - return ( - - - - - Upload Csv - - -
this.uploadStaffCsv(e) } > - - - -
- - - -
-
- ); - }; - -}; diff --git a/imports/client/views/org/admin/settings/staff/add/AddStaffFormContainer.js b/imports/client/views/org/admin/settings/staff/add/AddStaffFormContainer.js deleted file mode 100644 index da3af70..0000000 --- a/imports/client/views/org/admin/settings/staff/add/AddStaffFormContainer.js +++ /dev/null @@ -1,123 +0,0 @@ -import React, { Component } from 'react' -import StaffForm from './StaffForm' -import Form from '/imports/client/views/core/Form' -import Validator from '/imports/client/views/core/Validator' -import { isRequired, isValidEmail } from '/imports/client/views/core/validations' - -export class AddStaffFormContainer extends Component { - - constructor(props) { - super(props) - this.state = { currentStep: 0 } - this.handleNextClick = this.handleNextClick.bind(this) - this.handleBackClick = this.handleBackClick.bind(this) - this.handleSubmit = this.handleSubmit.bind(this) - } - - handleNextClick() { - console.log("clicked"); - this.form.handleSubmit() - if (this.validator.getErrors() && Object.keys(this.validator.getErrors()).length > 0) return - console.log("after submit"); - this.setState({ currentStep: this.state.currentStep + 1 }) - this.form.resetSubmitted() - } - - handleBackClick() { - this.setState({ currentStep: this.state.currentStep + -1 }) - } - - handleSubmit() { - if (this.state.currentStep === 3) { - Meteor.call('staff.addNew', this.form.state.values, (error, result) => { - console.log(error); - console.log(result); - if(!error){ - this.props.modalState(); - } - }); - } - } - - //render callback - render() { - return ( -
this.form = form} - initialValues={{ - employeeId: '12345', - firstName: 'Test', - lastName: 'Last', - - martialStatus: 'single', - gender: 'male', - dob: '07/03/1993', - - email: 'deepak125.dk+400@gmail.com', - phone: '9876543210', - address: '123', - - teaching: "yes", - type: 'permanent', - doj: '07/03/2016', - - qualifaication: 'Phd', - specialization: 'Maths', - university: 'Pune University', - - degreeFrom: '07/03/2009', - degreeEnded: '07/03/2013', - }} - > - {({ values, setValue, getValue, isSubmitted, isDirty }) => ( - this.validator = validator} - validations={{ - employeeId: [(value) => isRequired('Admission id', value)], - firstName: [(value) => isRequired('First name', value)], - lastName: [(value) => isRequired('Last name', value)], - - gender: [(value) => isRequired('Gender', value)], - martialStatus: [(value) => isRequired('martialStatus', value)], - dob: [(value) => isRequired('Date of birth', value)], - - teaching: [(value) => this.state.currentStep === 1 && isRequired('teaching', value)], - type: [(value) => this.state.currentStep === 1 && isRequired('type', value)], - doj: [(value) => this.state.currentStep === 1 && isRequired('doj', value)], - desgnation: [(value) => this.state.currentStep === 1 && isRequired('desgnation', value)], - - qualifaication: [(value) => this.state.currentStep === 2 && isRequired('qualifaication', value)], - specialization: [(value) => this.state.currentStep === 2 && isRequired('specialization', value)], - university: [(value) => this.state.currentStep === 2 && isRequired('university', value)], - - degreeFrom: [(value) => this.state.currentStep === 2 && isRequired('degreeFrom', value)], - degreeEnded: [(value) => this.state.currentStep === 2 && isRequired('degreeEnded', value)], - - email: [(value) => this.state.currentStep === 3 && isRequired('Email', value), (value) => this.state.currentStep === 1 && isValidEmail(value)], - phone: [(value) => this.state.currentStep === 3 && isRequired('Phone', value)], - address: [(value) => this.state.currentStep === 3 && isRequired('Address', value)], - city: [(value) => this.state.currentStep === 3 && isRequired('City', value)], - state: [(value) => this.state.currentStep === 3 && isRequired('State', value)], - - }} - > - {({ errors }) => ( - - )} - - )} -
- ) - } -} diff --git a/imports/client/views/org/admin/settings/staff/add/StaffForm.js b/imports/client/views/org/admin/settings/staff/add/StaffForm.js deleted file mode 100644 index ec763b6..0000000 --- a/imports/client/views/org/admin/settings/staff/add/StaffForm.js +++ /dev/null @@ -1,417 +0,0 @@ -import React, { PropTypes } from 'react' -import { - Row, - Col, - FormGroup, - FormControl, - Button -} from 'react-bootstrap' -import DatePicker from '/imports/client/views/core/DatePicker' -import Label from '/imports/client/views/core/Label' -import Stepper from '/imports/client/views/core/Stepper' -import ErrorLabel from '/imports/client/views/core/ErrorLabel' - -const StaffForm = props => ( -
- - {props.currentStep === 0 && ( -
- Personal data - - - - - props.setValue('employeeId', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.employeeId && ( - {props.errors.employeeId} - )} - - - - - - - props.setValue('firstName', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.firstName && ( - {props.errors.firstName} - )} - - - - - - - props.setValue('lastName', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.lastName && ( - {props.errors.lastName} - )} - - - - - - - - props.setValue('gender', e.target.value)} - > - - - - {props.isSubmitted() && props.errors && props.errors.gender && ( - {props.errors.gender} - )} - - - - - - - props.setValue('martialStatus', e.target.value)} - > - - - - - {props.isSubmitted() && props.errors && props.errors.martialStatus && ( - {props.errors.martialStatus} - )} - - - - - - - { - props.setValue('dob', e.target.value) - }} - /> - {props.isSubmitted() && props.errors && props.errors.dob && ( - {props.errors.dob} - )} - - - -
- )} - {props.currentStep === 1 && ( -
- Additional Info - - - - - props.setValue('desgnation', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.desgnation && ( - {props.errors.desgnation} - )} - - - - - - props.setValue('teaching', e.target.value)} - > - - - - {props.isSubmitted() && props.errors && props.errors.teaching && ( - {props.errors.teaching} - )} - - - - - - props.setValue('type', e.target.value)} - > - - - - {props.isSubmitted() && props.errors && props.errors.type && ( - {props.errors.type} - )} - - - - - - - - { - props.setValue('doj', e.target.value) - }} - /> - {props.isSubmitted() && props.errors && props.errors.doj && ( - {props.errors.doj} - )} - - - -
- )} - {props.currentStep === 2 && ( -
- Professional Info - - - - - props.setValue('qualifaication', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.qualifaication && ( - {props.errors.qualifaication} - )} - - - - - - props.setValue('specialization', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.specialization && ( - {props.errors.specialization} - )} - - - - - - props.setValue('university', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.university && ( - {props.errors.university} - )} - - - - - - - - { - props.setValue('degreeFrom', e.target.value) - }} - /> - {props.isSubmitted() && props.errors && props.errors.degreeFrom && ( - {props.errors.degreeFrom} - )} - - - - - - { - props.setValue('degreeEnded', e.target.value) - }} - /> - {props.isSubmitted() && props.errors && props.errors.degreeEnded && ( - {props.errors.degreeEnded} - )} - - - -
- )} - {props.currentStep === 3 && ( -
- Additional Info - - - - - props.setValue('email', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.email && ( - {props.errors.email} - )} - - - - - - props.setValue('phone', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.phone && ( - {props.errors.phone} - )} - - - - - - - - props.setValue('address', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.address && ( - {props.errors.address} - )} - - - - - - props.setValue('city', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.city && ( - {props.errors.city} - )} - - - - - - props.setValue('state', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.state && ( - {props.errors.state} - )} - - - -
- )} -
- {props.currentStep > 0 && ( -
- - -
- )} - {props.currentStep < 3 && ( -
- -
- )} - {props.currentStep === 3 && ( -
- -
- )} -
-
-) - -StaffForm.propTypes = { - currentStep: PropTypes.number.isRequired, - onNextClick: PropTypes.func.isRequired, - onBackClick: PropTypes.func.isRequired, - setValue: PropTypes.func.isRequired, - getValue: PropTypes.func.isRequired, -} - -export default StaffForm diff --git a/imports/client/views/org/admin/settings/staff/add/addStaff.js b/imports/client/views/org/admin/settings/staff/add/addStaff.js deleted file mode 100644 index 2819b6b..0000000 --- a/imports/client/views/org/admin/settings/staff/add/addStaff.js +++ /dev/null @@ -1,66 +0,0 @@ -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 { AddStaffFormContainer } from './AddStaffFormContainer'; - -const style = { - margin: 12, -}; -export class AddStaff extends Component { - constructor(props) { - super(props); - this.state = { - show: false - }; - 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() { - return ( - - - - - Add New Staff - - - - - {/* - - - - */} - - - ); - }; - -}; diff --git a/imports/client/views/org/admin/settings/staff/index.js b/imports/client/views/org/admin/settings/staff/index.js deleted file mode 100644 index 75b547a..0000000 --- a/imports/client/views/org/admin/settings/staff/index.js +++ /dev/null @@ -1,70 +0,0 @@ -// import { InviteSignupController } from '/imports/client/views/invite/signup/index' -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 { Staffs } from '/imports/collections/staff/index'; -import { StaffView } from './StaffView'; - -const meteorTick = (props, onData) => { - Shelf.layout.set({ - bulb: 'SETTINGS', - subbulb: 'USERS', - view: 'STAFF' - }); - const handles = [ - Meteor.subscribe('users.current'), - Meteor.subscribe('orgs.current'), - Meteor.subscribe('users.forMyOrg'), - Meteor.subscribe('staff.forMyOrg'), - ]; - - if(_.every(handles, (handle) => (handle.ready()) )) { - const user = Users.current(); - const org = Orgs.current(); - staff = Users.find({"role":"STAFF"}).fetch() ? Users.find({"role":"STAFF"}).fetch() : ""; - console.log(Users.find({"role":"STAFF"}).fetch()); - staffData = Staffs.find().fetch() ? Staffs.find().fetch() : ""; - console.log("staffData"); - console.log(staffData); - for(var i=0; i< staff.length; i++){ - for(var j=0; j< staffData.length; j++){ - if(staff[i]._id == staffData[j].userId){ - staff[i].type = staffData[j].type; - staff[i].employeeId = staffData[j].employeeId; - staff[i].dob = staffData[j].dob; - } - } - } - onData(null, { - data: { - user: user, - org: org, - staff: staff - }, - }); - } - - return () => { - _.each(handles, (handle) => handle.stop() ); - }; -}; - - -const reduxTick = (props, onData) => { - onData(null, { - data: {} - }); -}; - - -export const staffViewController = composeAll( - composeWithTracker(meteorTick, Loading), - compose(reduxTick, Loading), -)(StaffView); diff --git a/imports/client/views/org/admin/settings/staff/view/StaffRow.js b/imports/client/views/org/admin/settings/staff/view/StaffRow.js deleted file mode 100644 index f2438f6..0000000 --- a/imports/client/views/org/admin/settings/staff/view/StaffRow.js +++ /dev/null @@ -1,56 +0,0 @@ -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 StaffRow extends Component { - - constructor(props) { - super(props); - this.state = { - - }; - this.onUpdate = this.onUpdate.bind(this); - }; - - onUpdate(key, value) { - this.setState({[key]: value}); - }; - - render() { - const {staff} = this.props; - if(staff.firstName){ - return ( - - {staff.firstName} - {staff.lastName} - {staff.type} - {staff.dob? moment(staff.dob).format("LL") : } - Active - - - - - ); - }else { - return null; - } - - }; - -}; diff --git a/imports/client/views/org/admin/settings/staff/view/StaffTable.js b/imports/client/views/org/admin/settings/staff/view/StaffTable.js deleted file mode 100644 index 357d37a..0000000 --- a/imports/client/views/org/admin/settings/staff/view/StaffTable.js +++ /dev/null @@ -1,85 +0,0 @@ -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 {StaffRow} from './StaffRow' -import {BootstrapTable, TableHeaderColumn}from 'react-bootstrap-table'; -const options = { - page: 0, // which page you want to show as default - sizePerPageList: [ { - text: '5', value: 5 - }, { - text: '10', value: 10 - }], // you can change the dropdown list for size per page - sizePerPage: 5, // which size per page you want to locate as default - pageStartIndex: 0, // where to start counting the pages - paginationSize: 3, // the pagination bar size. - prePage: 'Prev', // Previous page button text - nextPage: 'Next', // Next page button text - firstPage: 'First', // First page button text - lastPage: 'Last', // Last page button text - paginationShowsTotal: false, // Accept bool or function - paginationPosition: 'bottom' // default is bottom, top and both is all available - // hideSizePerPage: true > You can hide the dropdown for sizePerPage - // alwaysShowAllBtns: true // Always show next and previous button - // withFirstAndLast: false > Hide the going to First and Last page button - }; - -function dateFormatter(cell, row) { - console.log("cell"); - console.log(cell); - if(cell){ - cell = new Date(cell); - console.log(cell); - return `${('0' + cell.getDate()).slice(-2)}/${('0' + (cell.getMonth() + 1)).slice(-2)}/${cell.getFullYear()}`; - } -} - -export class StaffTable extends Component { - - constructor(props) { - super(props); - this.state = { - show: false, - panleOpen: true, - }; - this.onUpdate = this.onUpdate.bind(this); - }; - onUpdate(key, value) { - this.setState({[key]: value}); - }; - togglePanel(){ - this.setState({panleOpen: !this.state.panleOpen}); - } - render() { - console.log("this.props.staff"); - console.log(this.props.staff); - return ( -
-
-
Teachers Details
-
-
    -
  • -
-
-
- - - Employee Id - First Name - Last Name - Type - DOB - - -
- ); - }; - -}; diff --git a/imports/client/views/org/admin/settings/students/StudentDataView.js b/imports/client/views/org/admin/settings/students/StudentDataView.js deleted file mode 100644 index 750102e..0000000 --- a/imports/client/views/org/admin/settings/students/StudentDataView.js +++ /dev/null @@ -1,274 +0,0 @@ -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 { AddStudentForm } from './addStudentForm'; - -export class StudentDataView extends Component { - - constructor(props) { - super(props); - this.state = { - show: false - }; - 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() { - return ( -
- -
-
-
-
-
-
-
- - - -
- -
-
Students
- Click to view -
-
-
-
- -
-
-
-
- - - -
- -
-
Teachers
- Click to view -
-
-
-
- -
-
-
-
- - - -
- -
-
Parents
- Click to view -
-
-
-
- -
-
-
-
- - - -
- -
-
Non Teaching Staff
- Click to view -
-
-
-
-
- -
-
-
Student Details
-
-
    -
  • -
  • -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
First NameLast NameclassNameDOBStatusActions
MarthEnrightVII22 Jun 1972Active - -
JackelynWeibleXI3 Oct 1981Inactive - -
-
- - - - -
-
-
-
-
- -
-
- Advanced Search -
    -
  • -
-
- -
-
-
- -
- -
-
-
-
-
-
-
- -
- -
-
-
-
-
-
-
- -
- -
-
-
-
-
- - -
-
-
-
- - ); - }; - -}; diff --git a/imports/client/views/org/admin/settings/students/StudentDataView0.js b/imports/client/views/org/admin/settings/students/StudentDataView0.js deleted file mode 100644 index 03a3f53..0000000 --- a/imports/client/views/org/admin/settings/students/StudentDataView0.js +++ /dev/null @@ -1,88 +0,0 @@ -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 { AddStudentForm } from './addStudentForm'; - -export class StudentDataView extends Component { - - constructor(props) { - super(props); - this.state = { - show: false - }; - 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() { - return ( -
- - - - - - - - - - - { - this.props.data.students.map(function(student, i) - { - return( - - - - - - ) - }) - } - - -
#First NameLast Name
{i+1}{student.firstName}{student.lastName}
- - - - - New Student - - - - - - - - - -
-
- ); - }; - -}; diff --git a/imports/client/views/org/admin/settings/students/StudentView.js b/imports/client/views/org/admin/settings/students/StudentView.js deleted file mode 100644 index 8c07979..0000000 --- a/imports/client/views/org/admin/settings/students/StudentView.js +++ /dev/null @@ -1,66 +0,0 @@ -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 { 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 ( -
-
-
- - - -
-
- ); - }; - -}; diff --git a/imports/client/views/org/admin/settings/students/UploadCsv.js b/imports/client/views/org/admin/settings/students/UploadCsv.js deleted file mode 100644 index 78dfc52..0000000 --- a/imports/client/views/org/admin/settings/students/UploadCsv.js +++ /dev/null @@ -1,103 +0,0 @@ -// import {UploadCsv } from '/imports/collections/students/UploadCsv' -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,ControlLabel,HelpBlock, - FormControl,Glyphicon,Button } from 'react-bootstrap'; -// import { AddStudentForm } from './addStudentForm'; -import { FilesCollection } from 'meteor/ostrio:files'; -const Papa = this.Papa; -// console.log(this); -const style = { - margin: 12, -}; -function FieldGroup({ id, label, help, ...props }) { - return ( - - {label} - - {help && {help}} - - ); -} -export class UploadCsv extends Component { - constructor(props) { - super(props); - this.state = { - show: false - }; - 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}); - }; - uploadStudentCsv(e){ - e.preventDefault(); - e.persist(); - var file = $('input[type="file"]').prop("files")[0]; - Papa.parse(file, { - header: true, - complete: function(csvData) { - console.log("csvData"); - console.log(csvData); - if(csvData){ - Meteor.call('student.uploadCsv', csvData, function (error, result) { - console.log("error"); - console.log(error); - console.log("result"); - console.log(result); - }) - } - } - }); - } - - render() { - console.log(this.props); - return ( - - - - - Upload Csv file - - -
this.uploadStudentCsv(e) } > - - - -
- - - -
-
- ); - }; - -}; diff --git a/imports/client/views/org/admin/settings/students/add/AddStudentFormContainer.js b/imports/client/views/org/admin/settings/students/add/AddStudentFormContainer.js deleted file mode 100644 index 46cc059..0000000 --- a/imports/client/views/org/admin/settings/students/add/AddStudentFormContainer.js +++ /dev/null @@ -1,130 +0,0 @@ -import React, { Component } from 'react' -import { AddStudentForm } from './addStudentForm' -import StudentForm from './StudentForm' -import Form from '/imports/client/views/core/Form' -import Validator from '/imports/client/views/core/Validator' -import { isRequired, isValidEmail } from '/imports/client/views/core/validations' - - -export class AddStudentFormContainer extends Component { - - constructor(props) { - super(props) - this.state = { currentStep: 0 } - this.handleNextClick = this.handleNextClick.bind(this) - this.handleBackClick = this.handleBackClick.bind(this) - this.handleSubmit = this.handleSubmit.bind(this) - } - - handleNextClick() { - this.form.handleSubmit() - if (this.validator.getErrors() && Object.keys(this.validator.getErrors()).length > 0) return - this.setState({ currentStep: this.state.currentStep + 1 }) - this.form.resetSubmitted() - } - - handleBackClick() { - this.setState({ currentStep: this.state.currentStep + -1 }) - } - - handleSubmit() { - self = this; - if (this.state.currentStep === 3) { - Meteor.call('student.addManually',this.form.state.values, function(err, result){ - console.log("err"); - console.log(err); - console.log("result"); - console.log(result); - if(!err){ - self.props.hideModal(); - } - }); - } - } - - //render callback - render() { - return ( -
this.form = form} - initialValues={{ - gender: 'male', - parentGender: 'male', - admissionId: "123", - firstName: "first", - lastName: "last", - email: "deepak125.dk+21@gmail.com", - dob: "04/04/1989", - gender: "male", - rollNo: "1", - studentClass: "2", - section: "B", - community: "SC", - bloodGroup: "B+", - phone: "9876543321", - address: "address", - city: "chennai", - state: "tn", - parentName: "parentName", - parentEmail: "deepak125.dk+41@gmail.com", - relation: "father", - profession: "farmer", - parentGender: "male", - parentPhone: "987655412", - parentAddress: "parentAddress", - parentCity: "parentCity", - parentState: "parentState", - parentZipcode: "parentZipcode", - }} - > - {({ values, setValue, getValue, isSubmitted, isDirty }) => ( - this.validator = validator} - validations={{ - admissionId: [(value) => isRequired('Admission id', value)], - firstName: [(value) => isRequired('First name', value)], - lastName: [(value) => isRequired('Last name', value)], - email: [(value) => isRequired('Email', value), isValidEmail], - dob: [(value) => isRequired('Date of birth', value)], - gender: [(value) => isRequired('Gender', value)], - rollNo: [(value) => this.state.currentStep === 1 && isRequired('Roll no', value)], - studentClass: [(value) => this.state.currentStep === 1 && isRequired('Class', value)], - section: [(value) => this.state.currentStep === 1 && isRequired('Section', value)], - community: [(value) => this.state.currentStep === 1 && isRequired('Community', value)], - bloodGroup: [(value) => this.state.currentStep === 1 && isRequired('Blood group', value)], - phone: [(value) => this.state.currentStep === 1 && isRequired('Phone', value)], - address: [(value) => this.state.currentStep === 2 && isRequired('Address', value)], - city: [(value) => this.state.currentStep === 2 && isRequired('City', value)], - state: [(value) => this.state.currentStep === 2 && isRequired('State', value)], - parentName: [(value) => this.state.currentStep === 3 && isRequired('Parent name', value)], - parentEmail: [(value) => this.state.currentStep === 3 && isRequired('Parent email', value), (value) => this.state.currentStep === 3 && isValidEmail(value)], - relation: [(value) => this.state.currentStep === 3 && isRequired('Relation', value)], - profession: [(value) => this.state.currentStep === 3 && isRequired('Profession', value)], - parentGender: [(value) => this.state.currentStep === 3 && isRequired('Parent gender', value)], - parentPhone: [(value) => this.state.currentStep === 3 && isRequired('Parent phone', value)], - parentAddress: [(value) => this.state.currentStep === 3 && isRequired('Parent address', value)], - parentCity: [(value) => this.state.currentStep === 3 && isRequired('Parent city', value)], - parentState: [(value) => this.state.currentStep === 3 && isRequired('Parent state', value)], - parentZipcode: [(value) => this.state.currentStep === 3 && isRequired('Parent zip code', value)], - }} - > - {({ errors }) => ( - - )} - - )} -
- ) - } -} diff --git a/imports/client/views/org/admin/settings/students/add/StudentForm.js b/imports/client/views/org/admin/settings/students/add/StudentForm.js deleted file mode 100644 index a321be7..0000000 --- a/imports/client/views/org/admin/settings/students/add/StudentForm.js +++ /dev/null @@ -1,474 +0,0 @@ -import React, { PropTypes } from 'react' -import { - Row, - Col, - FormGroup, - FormControl, - Button -} from 'react-bootstrap' -import DatePicker from '/imports/client/views/core/DatePicker' -import Label from '/imports/client/views/core/Label' -import Stepper from '/imports/client/views/core/Stepper' -import ErrorLabel from '/imports/client/views/core/ErrorLabel' - -const StudentForm = props => ( -
- - {props.currentStep === 0 && ( -
- Personal data - - - - - props.setValue('admissionId', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.admissionId && ( - {props.errors.admissionId} - )} - - - - - - props.setValue('firstName', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.firstName && ( - {props.errors.firstName} - )} - - - - - - props.setValue('lastName', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.lastName && ( - {props.errors.lastName} - )} - - - - - - - - props.setValue('gender', e.target.value)} - > - - - - {props.isSubmitted() && props.errors && props.errors.gender && ( - {props.errors.gender} - )} - - - - - - props.setValue('email', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.email && ( - {props.errors.email} - )} - - - - - - { - props.setValue('dob', e.target.value) - }} - /> - {props.isSubmitted() && props.errors && props.errors.dob && ( - {props.errors.dob} - )} - - - -
- )} - {props.currentStep === 1 && ( -
- Academic - - - - - props.setValue('rollNo', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.rollNo && ( - {props.errors.rollNo} - )} - - - - - - props.setValue('studentClass', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.studentClass && ( - {props.errors.studentClass} - )} - - - - - - props.setValue('section', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.section && ( - {props.errors.section} - )} - - - - - - - - props.setValue('community', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.community && ( - {props.errors.community} - )} - - - - - - props.setValue('bloodGroup', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.bloodGroup && ( - {props.errors.bloodGroup} - )} - - - - - - props.setValue('phone', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.phone && ( - {props.errors.phone} - )} - - - -
- )} - {props.currentStep === 2 && ( -
- Address - - - - - props.setValue('address', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.address && ( - {props.errors.address} - )} - - - - - - props.setValue('city', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.city && ( - {props.errors.city} - )} - - - - - - props.setValue('state', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.state && ( - {props.errors.state} - )} - - - -
- )} - {props.currentStep === 3 && ( -
- Parent information - - - - - props.setValue('parentName', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.parentName && ( - {props.errors.parentName} - )} - - - - - - props.setValue('parentEmail', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.parentEmail && ( - {props.errors.parentEmail} - )} - - - - - - props.setValue('relation', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.relation && ( - {props.errors.relation} - )} - - - - - - - - props.setValue('profession', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.profession && ( - {props.errors.profession} - )} - - - - - - props.setValue('parentGender', e.target.value)} - > - - - - {props.isSubmitted() && props.errors && props.errors.parentGender && ( - {props.errors.parentGender} - )} - - - - - - props.setValue('parentPhone', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.parentPhone && ( - {props.errors.parentPhone} - )} - - - - - - - - props.setValue('parentAddress', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.parentAddress && ( - {props.errors.parentAddress} - )} - - - - - - props.setValue('parentCity', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.parentCity && ( - {props.errors.parentCity} - )} - - - - - - props.setValue('parentState', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.parentState && ( - {props.errors.parentState} - )} - - - - - - - - props.setValue('parentZipcode', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.parentZipcode && ( - {props.errors.parentZipcode} - )} - - - -
- )} -
- {props.currentStep > 0 && ( -
- - -
- )} - {props.currentStep < 3 && ( -
- -
- )} - {props.currentStep === 3 && ( -
- -
- )} -
-
-) - -StudentForm.propTypes = { - currentStep: PropTypes.number.isRequired, - onNextClick: PropTypes.func.isRequired, - onBackClick: PropTypes.func.isRequired, - setValue: PropTypes.func.isRequired, - getValue: PropTypes.func.isRequired, -} - -export default StudentForm diff --git a/imports/client/views/org/admin/settings/students/add/addStudent.js b/imports/client/views/org/admin/settings/students/add/addStudent.js deleted file mode 100644 index 69bfc4a..0000000 --- a/imports/client/views/org/admin/settings/students/add/addStudent.js +++ /dev/null @@ -1,66 +0,0 @@ -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 { AddStudentFormContainer } from './AddStudentFormContainer'; - -const style = { - margin: 12, -}; -export class AddStudent extends Component { - constructor(props) { - super(props); - this.state = { - show: false - }; - 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() { - return ( - - - - - Add Student - - - - - {/* - - - - */} - - - ); - }; - -}; diff --git a/imports/client/views/org/admin/settings/students/add/addStudentForm.js b/imports/client/views/org/admin/settings/students/add/addStudentForm.js deleted file mode 100644 index 9f41e25..0000000 --- a/imports/client/views/org/admin/settings/students/add/addStudentForm.js +++ /dev/null @@ -1,500 +0,0 @@ -import _ from 'lodash'; -import { Meteor } from 'meteor/meteor'; - -import React, { Component } from 'react'; -import { Link,browserHistory } from 'react-router'; -import { Form, FormGroup,InputGroup, - DropdownButton,MenuItem,ControlLabel, - SplitButton, - FormControl,Glyphicon,Button } from 'react-bootstrap'; -import DatePicker from 'react-bootstrap-date-picker' -import {addStudentManually} from '/imports/collections/students/methods'; - -export class AddStudentForm extends Component { - - constructor(props) { - super(props); - this.state = { - admissionId: "123", - firstName: "first", - lastName: "last", - middleName: "middle", - email: "deepak125.dk+21@gmail.com", - dob: "", - formattedDob: "", - gender: "male", - rollNo: "1", - class: "2", - section: "B", - community: "SC", - bloodGroup: "B+", - phone: "9876543321", - address: "address", - city: "chennai", - state: "tn", - parentName: "parentName", - parentEmail: "deepak125.dk+41@gmail.com", - relation: "father", - profession: "farmer", - parentGender: "male", - parentPhone: "987655412", - parentAddress: "parentAddress", - parentCity: "parentCity", - parentState: "parentState", - parentZipcode: "parentZipcode", - }; - this.onUpdate = this.onUpdate.bind(this); - this.handleDob = this.handleDob.bind(this); - }; - - onUpdate(key, value) { - this.setState({[key]: value}); - }; - - handleDob(value, formattedValue) { - this.setState({ - dob: value, // ISO String, ex: "2016-11-19T12:00:00.000Z" - formattedDob: formattedValue // Formatted String, ex: "11/19/2016" - }); -} - addStudent(e){ - e.preventDefault(); - e.persist(); - const firstName = this.state.firstName; - const middleName = this.state.middleName; - const lastName = this.state.lastName; - const admissionId = this.state.admissionId; - const email = this.state.email; - const dob = this.state.dob; - const formattedDob = this.state.formattedDob; - const gender = this.state.gender; - const rollNo = this.state.rollNo; - const studentclass = this.state.class; - const section = this.state.section; - const community = this.state.community; - const bloodGroup = this.state.bloodGroup; - const phone = this.state.phone; - const address = this.state.address; - const city = this.state.city; - const state = this.state.state; - const parentName = this.state.parentName; - const parentEmail = this.state.parentEmail; - const relation = this.state.relation; - const profession = this.state.profession; - const parentGender = this.state.parentGender; - const parentPhone = this.state.parentPhone; - const parentAddress = this.state.parentAddress; - const parentCity = this.state.parentCity; - const parentState = this.state.parentState; - const parentZipcode = this.state.parentZipcode; - if(admissionId==""){ - Bert.alert('Enter Admission Id!', 'danger'); - }else if(firstName==""){ - Bert.alert('Enter Fist Name', 'danger'); - } else if(middleName==""){ - Bert.alert('Enter Middle name!', 'danger'); - }else if(lastName==""){ - Bert.alert('Enter Last name!', 'danger'); - }else if(email==""){ - Bert.alert('Enter email!', 'danger'); - }else if(dob==""){ - Bert.alert('Enter DOB!', 'danger'); - }else if(gender==""){ - Bert.alert('Enter Student Gender!', 'danger'); - }else if(studentclass==""){ - Bert.alert('Enter Class!', 'danger'); - }else if(section==""){ - Bert.alert('Enter Section!', 'danger'); - }else if(community==""){ - Bert.alert('Enter Section!', 'danger'); - }else if(bloodGroup==""){ - Bert.alert('Enter Blood Group!', 'danger'); - }else if(phone==""){ - Bert.alert('Enter phone!', 'danger'); - }else if(address==""){ - Bert.alert('Enter address!', 'danger'); - }else if(city==""){ - Bert.alert('Enter city!', 'danger'); - }else if(state==""){ - Bert.alert('Enter state!', 'danger'); - }else if(parentName==""){ - Bert.alert('Enter Parent name!', 'danger'); - }else if(parentEmail==""){ - Bert.alert('Enter Parent Email!', 'danger'); - }else if(relation==""){ - Bert.alert('Enter relation!', 'danger'); - }else if(profession==""){ - Bert.alert('Enter parent profession!', 'danger'); - }else if(parentGender==""){ - Bert.alert("Enter Parent's Gender!", 'danger'); - }else if(parentPhone==""){ - Bert.alert("Enter Parent's Phone!", 'danger'); - }else if(parentAddress==""){ - Bert.alert("Enter Parent's Address!", 'danger'); - }else if(parentCity==""){ - Bert.alert("Enter Parent's City!", 'danger'); - }else if(parentState==""){ - Bert.alert("Enter Parent's State!", 'danger'); - }else if(parentZipcode==""){ - Bert.alert("Enter Parent's zipcode!", 'danger'); - }else{ - addStudentManually.call({ - admissionId, - firstName, - middleName, - lastName, - email, - dob, - formattedDob, - gender, - rollNo, - studentclass, - section, - community, - bloodGroup, - phone, - address, - city, - state, - parentName, - parentEmail, - relation, - profession, - parentGender, - parentPhone, - parentAddress, - parentCity, - parentState, - parentZipcode - }, function (error, result) { - console.log(error); - console.log(result); - }); - } - } - render() { - return ( -
this.addStudent(e) } inline> - -
-
Personal data
-
-
-
- - - Admission Id - this.onUpdate('admissionId',e.target.value)} - /> - - -
- -
- - - First Name - this.onUpdate('firstName',e.target.value)} - /> - - -
-
-
-
- - - - Admission Id - this.onUpdate('admissionId',e.target.value)} - /> - - - - First Name - this.onUpdate('firstName',e.target.value)} - /> - - - Middle Name - this.onUpdate('middleName',e.target.value)} - /> - - - - Last Name - this.onUpdate('lastName',e.target.value)} - /> - - - - Email - this.onUpdate('email',e.target.value)} - /> - - - Date of birth - - - - - Gender - this.onUpdate('gender',e.target.value)} - > - - - - - - - Roll No - this.onUpdate('rollNo',e.target.value)} - /> - - - Class - this.onUpdate('class',e.target.value)} - /> - - - Section - this.onUpdate('section',e.target.value)} - /> - - - - Community - this.onUpdate('community',e.target.value)} - /> - - - - bloodGroup - this.onUpdate('bloodGroup',e.target.value)} - /> - - - - Phone - this.onUpdate('phone',e.target.value)} - /> - - - - Address - this.onUpdate('address',e.target.value)} - /> - - - - City - this.onUpdate('city',e.target.value)} - /> - - - - State - this.onUpdate('state',e.target.value)} - /> - - - - Parent Name - this.onUpdate('parentName',e.target.value)} - /> - - - - Parent Email - this.onUpdate('parentEmail',e.target.value)} - /> - - - - Relation - this.onUpdate('relation',e.target.value)} - /> - - - - Profession - this.onUpdate('profession',e.target.value)} - /> - - - - Parent Gender - this.onUpdate('parentGender',e.target.value)} - > - - - - - - - Parent Phone - this.onUpdate('parentPhone',e.target.value)} - /> - - - - Parent Address - this.onUpdate('parentAddress',e.target.value)} - /> - - - - Parent City - this.onUpdate('parentCity',e.target.value)} - /> - - - - Parent State - this.onUpdate('parentState',e.target.value)} - /> - - - - Parent Zipcode - this.onUpdate('parentZipcode',e.target.value)} - /> - - -
- ); - }; - -}; diff --git a/imports/client/views/org/admin/settings/students/index.js b/imports/client/views/org/admin/settings/students/index.js deleted file mode 100644 index 016dcde..0000000 --- a/imports/client/views/org/admin/settings/students/index.js +++ /dev/null @@ -1,69 +0,0 @@ -// import { StudentDataController } from '/imports/client/views/org/admin/students/index' -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 { StudentView } from './StudentView'; -import { Students } from '/imports/collections/students/index'; - - -const meteorTick = (props, onData) => { - Shelf.layout.set({ - bulb: 'SETTINGS', - subbulb: 'USERS', - view: 'STUDENTS' - }); - const handles = [ - Meteor.subscribe('users.current'), - Meteor.subscribe('orgs.current'), - Meteor.subscribe('users.forMyOrg'), - Meteor.subscribe('student.forMyOrg'), - ]; - - if(_.every(handles, (handle) => (handle.ready()) )) { - const user = Users.current(); - const org = Orgs.current(); - students = Users.find({"role":"STUDENT"}).fetch() ? Users.find({"role":"STUDENT"}).fetch() : ""; - studentData = Students.find().fetch() ? Students.find().fetch() : ""; - for(var i=0; i< studentData.length; i++){ - for(var j=0; j< students.length; j++){ - if(studentData[i].userId == students[j]._id && studentData[i].admissionId){ - studentData[i].firstName = students[j].firstName; - studentData[i].lastName = students[j].lastName; - }else{ - - } - } - } - onData(null, { - data: { - user: user, - org: org, - studentData: studentData - }, - }); - } - - return () => { - _.each(handles, (handle) => handle.stop() ); - }; -}; - - -const reduxTick = (props, onData) => { - onData(null, { - data: {} - }); -}; - - -export const StudentDataController = composeAll( - composeWithTracker(meteorTick, Loading), - compose(reduxTick, Loading), -)(StudentView); diff --git a/imports/client/views/org/admin/settings/students/student.css b/imports/client/views/org/admin/settings/students/student.css deleted file mode 100644 index dc886d1..0000000 --- a/imports/client/views/org/admin/settings/students/student.css +++ /dev/null @@ -1,5 +0,0 @@ -.btn-toolbar { - display: inline-block; - font-size: 0; - margin-right: 12px; -} diff --git a/imports/client/views/org/admin/settings/students/view/StudentRow.js b/imports/client/views/org/admin/settings/students/view/StudentRow.js deleted file mode 100644 index a02bbf6..0000000 --- a/imports/client/views/org/admin/settings/students/view/StudentRow.js +++ /dev/null @@ -1,66 +0,0 @@ -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 StudentRow extends Component { - - constructor(props) { - super(props); - this.state = { - editOpen: false, - }; - this.onUpdate = this.onUpdate.bind(this); - this.toggleEditOpen = this.toggleEditOpen.bind(this); - this.deleteStudent = this.deleteStudent.bind(this); - }; - - onUpdate(key, value) { - this.setState({[key]: value}); - }; - toggleEditOpen(){ - this.setState({ - editOpen : !this.state.editOpen - }) - } - deleteStudent(){ - console.log("Delete"); - console.log(this.props.student._id); - } - render() { - const {student} = this.props; - if(student.firstName){ - return ( - - {student.firstName} - {student.lastName} - {student.class} - {student.dob? moment(student.dob).format("LL") : } - Active - -
    -
  • - - - -
      -
    • View
    • -
    • Edit
    • -
    • Delete
    • -
    -
  • -
- - - ); - }else { - return null; - } - - }; - -}; diff --git a/imports/client/views/org/admin/settings/students/view/StudentTable.js b/imports/client/views/org/admin/settings/students/view/StudentTable.js deleted file mode 100644 index 5f331fa..0000000 --- a/imports/client/views/org/admin/settings/students/view/StudentTable.js +++ /dev/null @@ -1,85 +0,0 @@ -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 {StudentRow} from './StudentRow' -import {BootstrapTable, TableHeaderColumn}from 'react-bootstrap-table'; - -const options = { - page: 0, // which page you want to show as default - sizePerPageList: [ { - text: '5', value: 5 - }, { - text: '10', value: 10 - }], // you can change the dropdown list for size per page - sizePerPage: 5, // which size per page you want to locate as default - pageStartIndex: 0, // where to start counting the pages - paginationSize: 3, // the pagination bar size. - prePage: 'Prev', // Previous page button text - nextPage: 'Next', // Next page button text - firstPage: 'First', // First page button text - lastPage: 'Last', // Last page button text - paginationShowsTotal: false, // Accept bool or function - paginationPosition: 'bottom' // default is bottom, top and both is all available - // hideSizePerPage: true > You can hide the dropdown for sizePerPage - // alwaysShowAllBtns: true // Always show next and previous button - // withFirstAndLast: false > Hide the going to First and Last page button - }; - -function dateFormatter(cell, row) { - if(cell){ - cell = new Date(cell); - return `${('0' + cell.getDate()).slice(-2)}/${('0' + (cell.getMonth() + 1)).slice(-2)}/${cell.getFullYear()}`; - } -} -export class StudentTable extends Component { - - constructor(props) { - super(props); - this.state = { - show: false, - panleOpen: true, - }; - this.onUpdate = this.onUpdate.bind(this); - this.togglePanel = this.togglePanel.bind(this); - }; - onUpdate(key, value) { - this.setState({[key]: value}); - }; - togglePanel(){ - this.setState({panleOpen: !this.state.panleOpen}); - } - - render() { - studentData = this.props.studentData; - console.log("this.props.studentData"); - console.log(this.props.studentData); - return ( -
-
-
Student Details
-
-
    -
  • -
-
-
- - - Admission Id - First Name - Last Name - Class - DOB - - -
- ); - }; - -}; diff --git a/imports/client/views/org/admin/users/list/AdminUsersList.js b/imports/client/views/org/admin/users/list/AdminUsersList.js new file mode 100644 index 0000000..8f08686 --- /dev/null +++ b/imports/client/views/org/admin/users/list/AdminUsersList.js @@ -0,0 +1,63 @@ +import _ from 'lodash'; +import { Meteor } from 'meteor/meteor'; +import React, { Component } from 'react'; +import { Link } from 'react-router'; +import { Avatar } from '/imports/client/components/Avatar'; +import { Icon } from '/imports/client/components/Icon'; +import classNames from 'classnames'; +import { EnterModule } from '/imports/client/views/org/enter/module/index'; +// import { VerifyModule } from '/imports/client/views/verify/module/index'; +import { Navbar,Modal, Nav, NavItem, + Glyphicon, Collapse, + NavbarToggler, NavbarBrand, + NavLink, DropdownItem, DropdownToggle, DropdownMenu, + NavDropdown, MenuItem, Breadcrumb } from 'react-bootstrap'; + import { VerifyModule } from '/imports/client/views/verify/module/index' + +var Accordion = require('react-bootstrap').Accordion; +var Panel = require('react-bootstrap').Panel; +export class AdminUsersList extends Component { + render() { + return ( +
+
+
+ +
+ +
+
+
Students Click to view
+
+ +
+
+
+
+ +
+ +
+
+
Teachers Click to view
+
+ +
+
+
+
+ +
+ +
+
+
Parents Click to view
+
+ +
+
+
+ ); + }; + +}; diff --git a/imports/client/views/org/admin/users/list/index.js b/imports/client/views/org/admin/users/list/index.js new file mode 100644 index 0000000..24a8d7e --- /dev/null +++ b/imports/client/views/org/admin/users/list/index.js @@ -0,0 +1,50 @@ +// import { MailModule } from '/imports/client/views/org/admin/mailbox/module/index' +import { + composeWithTracker, + compose, + composeAll + } from 'react-komposer'; +import { AdminUsersList } from './AdminUsersList'; +import { Loading } from '/imports/client/components/Loading'; + +import { Users } from '/imports/collections/users/index'; +import { Orgs } from '/imports/collections/orgs/index'; + + +const meteorTick = (props, onData) => { + + const handles = [ + Meteor.subscribe('users.current'), + Meteor.subscribe('orgs.current'), + ]; + + const user = Users.current(); + + if(_.every(handles, (handle) => (handle.ready()) ) && user) { + onData(null, { + layout: Shelf.layout.get(), + data: { + companyId: props.params.companyId, + user: Users.current(), + org: Orgs.current(), + }, + }); + } + + return () => { + _.each(handles, (handle) => handle.stop() ); + }; +}; + + +const reduxTick = (props, onData) => { + onData(null, { + data: {} + }); +}; + + +export const AdminUsersListController = composeAll( + composeWithTracker(meteorTick, Loading), + compose(reduxTick, Loading), +)(AdminUsersList); diff --git a/imports/client/views/org/admin/users/module/AdminUserViewLayout.js b/imports/client/views/org/admin/users/module/AdminUserViewLayout.js new file mode 100644 index 0000000..897f3ac --- /dev/null +++ b/imports/client/views/org/admin/users/module/AdminUserViewLayout.js @@ -0,0 +1,50 @@ +import _ from 'lodash'; +import { Meteor } from 'meteor/meteor'; + +import React, { Component } from 'react'; +import { Link } from 'react-router'; +import classNames from 'classnames'; +import { Users } from '/imports/collections/users/index'; +import { If, Case } from '/imports/client/components/Logic'; +import {Header} from './Header' + + +export class AdminUserViewLayout extends Component { + + renderMenuItem(bulb, label, path, auth) { + const user = Users.current(); + return ( + ( + + {label} + + )} + /> + ); + }; + + renderSeparator() { + return
; + }; + + render() { + const user = this.props.data.user; + return ( +
+
+
+ { this.props.children } +
+
+ ); + }; + +}; diff --git a/imports/client/views/org/admin/users/module/Header.js b/imports/client/views/org/admin/users/module/Header.js new file mode 100644 index 0000000..5659f97 --- /dev/null +++ b/imports/client/views/org/admin/users/module/Header.js @@ -0,0 +1,85 @@ +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.css'; + + +export class Header extends Component { + + constructor(props) { + super(props); + this.state = { + + }; + this.onUpdate = this.onUpdate.bind(this); + }; + + onUpdate(key, value) { + this.setState({[key]: value}); + }; + + render() { + return ( +
+
+ +
+ +
+
+
+ +
+ +
+
Students
+

Click to view

+
+
+
+ +
+
+ +
+
+
+ +
+ +
+
Teachers
+

Click to view

+
+
+
+ +
+ +
+ +
+
+
+ +
+ +
+
Parents
+

Click to view

+
+
+
+ +
+ +
+
+ ); + }; + +}; diff --git a/imports/client/views/org/admin/users/module/header.css b/imports/client/views/org/admin/users/module/header.css new file mode 100644 index 0000000..e45826e --- /dev/null +++ b/imports/client/views/org/admin/users/module/header.css @@ -0,0 +1,10 @@ +.img-circle +{ + width: 70px; + height: 70px; +} + +.panel-body +{ + overflow-y:hidden; +} diff --git a/imports/client/views/org/admin/users/module/index.js b/imports/client/views/org/admin/users/module/index.js new file mode 100644 index 0000000..a29aa4d --- /dev/null +++ b/imports/client/views/org/admin/users/module/index.js @@ -0,0 +1,50 @@ +// import { MailModule } from '/imports/client/views/org/admin/mailbox/module/index' +import { + composeWithTracker, + compose, + composeAll + } from 'react-komposer'; +import { AdminUserViewLayout } from './AdminUserViewLayout'; +import { Loading } from '/imports/client/components/Loading'; + +import { Users } from '/imports/collections/users/index'; +import { Orgs } from '/imports/collections/orgs/index'; + + +const meteorTick = (props, onData) => { + + const handles = [ + Meteor.subscribe('users.current'), + Meteor.subscribe('orgs.current'), + ]; + + const user = Users.current(); + + if(_.every(handles, (handle) => (handle.ready()) ) && user) { + onData(null, { + layout: Shelf.layout.get(), + data: { + companyId: props.params.companyId, + user: Users.current(), + org: Orgs.current(), + }, + }); + } + + return () => { + _.each(handles, (handle) => handle.stop() ); + }; +}; + + +const reduxTick = (props, onData) => { + onData(null, { + data: {} + }); +}; + + +export const AdminUsersModule = composeAll( + composeWithTracker(meteorTick, Loading), + compose(reduxTick, Loading), +)(AdminUserViewLayout); diff --git a/imports/client/views/org/admin/users/parents/index.js b/imports/client/views/org/admin/users/parents/index.js new file mode 100644 index 0000000..a765b86 --- /dev/null +++ b/imports/client/views/org/admin/users/parents/index.js @@ -0,0 +1,72 @@ +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) => { + Shelf.layout.set({ + bulb: 'SETTINGS', + subbulb: 'USERS', + view: 'PARENTS' + }); + 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; + parent[i].profession = parentData[j].profession; + 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/users/parents/parentsview.js b/imports/client/views/org/admin/users/parents/parentsview.js new file mode 100644 index 0000000..6bbf764 --- /dev/null +++ b/imports/client/views/org/admin/users/parents/parentsview.js @@ -0,0 +1,43 @@ +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 { 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}); + }; + togglePanel(){ + this.setState({panleOpen: !this.state.panleOpen}); + } + + render() { + const {user, org, parent} = this.props.data; + return ( +
+ + {/* + */} +
+ ); + }; + + +}; diff --git a/imports/client/views/org/admin/users/parents/view/ParentRow.js b/imports/client/views/org/admin/users/parents/view/ParentRow.js new file mode 100644 index 0000000..130b080 --- /dev/null +++ b/imports/client/views/org/admin/users/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/users/parents/view/ParentTable.js b/imports/client/views/org/admin/users/parents/view/ParentTable.js new file mode 100644 index 0000000..8bf1e54 --- /dev/null +++ b/imports/client/views/org/admin/users/parents/view/ParentTable.js @@ -0,0 +1,70 @@ +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' +import {BootstrapTable, TableHeaderColumn}from 'react-bootstrap-table'; +const options = { + page: 0, // which page you want to show as default + sizePerPageList: [ { + text: '5', value: 5 + }, { + text: '10', value: 10 + }], // you can change the dropdown list for size per page + sizePerPage: 5, // which size per page you want to locate as default + pageStartIndex: 0, // where to start counting the pages + paginationSize: 3, // the pagination bar size. + prePage: 'Prev', // Previous page button text + nextPage: 'Next', // Next page button text + firstPage: 'First', // First page button text + lastPage: 'Last', // Last page button text + paginationShowsTotal: false, // Accept bool or function + paginationPosition: 'bottom' // default is bottom, top and both is all available + // hideSizePerPage: true > You can hide the dropdown for sizePerPage + // alwaysShowAllBtns: true // Always show next and previous button + // withFirstAndLast: false > Hide the going to First and Last page button + }; + +export class ParentTable extends Component { + + constructor(props) { + super(props); + this.state = { + show: false, + panleOpen: true, + }; + this.onUpdate = this.onUpdate.bind(this); + }; + onUpdate(key, value) { + this.setState({[key]: value}); + }; + + render() { + return ( +
+
+
Parent Details
+
+
    +
  • +
+
+
+ + + Sr No + Name + Relationship + Profession + + +
+ ); + }; + +}; diff --git a/imports/client/views/org/admin/users/staff/StaffView.js b/imports/client/views/org/admin/users/staff/StaffView.js new file mode 100644 index 0000000..c1909c9 --- /dev/null +++ b/imports/client/views/org/admin/users/staff/StaffView.js @@ -0,0 +1,39 @@ +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 { StaffTable } from './view/StaffTable' +import { AddStaff } from './add/addStaff' +import { UploadCsvStaff } from './UploadCsvStaff' + +export class StaffView 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, staff} = this.props.data; + return ( +
+ + + +
+ ); + }; + +}; diff --git a/imports/client/views/org/admin/users/staff/UploadCsvStaff.js b/imports/client/views/org/admin/users/staff/UploadCsvStaff.js new file mode 100644 index 0000000..62da6d4 --- /dev/null +++ b/imports/client/views/org/admin/users/staff/UploadCsvStaff.js @@ -0,0 +1,103 @@ +// import {UploadCsv } from '/imports/collections/students/UploadCsv' +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,ControlLabel,HelpBlock, + FormControl,Glyphicon,Button } from 'react-bootstrap'; +// import { AddStudentForm } from './addStudentForm'; +import { FilesCollection } from 'meteor/ostrio:files'; +const Papa = this.Papa; +// console.log(this); +const style = { + margin: 12, +}; +function FieldGroup({ id, label, help, ...props }) { + return ( + + {label} + + {help && {help}} + + ); +} +export class UploadCsvStaff extends Component { + constructor(props) { + super(props); + this.state = { + show: false + }; + 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}); + }; + uploadStaffCsv(e){ + e.preventDefault(); + e.persist(); + var file = $('input[type="file"]').prop("files")[0]; + Papa.parse(file, { + header: true, + complete: function(csvData) { + console.log("csvData"); + console.log(csvData); + if(csvData){ + Meteor.call('staff.uploadCsv', csvData, function (error, result) { + console.log("error"); + console.log(error); + console.log("result"); + console.log(result); + }) + } + } + }); + } + + render() { + console.log(this.props); + return ( + + + + + Upload Csv + + +
this.uploadStaffCsv(e) } > + + + +
+ + + +
+
+ ); + }; + +}; diff --git a/imports/client/views/org/admin/users/staff/add/AddStaffFormContainer.js b/imports/client/views/org/admin/users/staff/add/AddStaffFormContainer.js new file mode 100644 index 0000000..da3af70 --- /dev/null +++ b/imports/client/views/org/admin/users/staff/add/AddStaffFormContainer.js @@ -0,0 +1,123 @@ +import React, { Component } from 'react' +import StaffForm from './StaffForm' +import Form from '/imports/client/views/core/Form' +import Validator from '/imports/client/views/core/Validator' +import { isRequired, isValidEmail } from '/imports/client/views/core/validations' + +export class AddStaffFormContainer extends Component { + + constructor(props) { + super(props) + this.state = { currentStep: 0 } + this.handleNextClick = this.handleNextClick.bind(this) + this.handleBackClick = this.handleBackClick.bind(this) + this.handleSubmit = this.handleSubmit.bind(this) + } + + handleNextClick() { + console.log("clicked"); + this.form.handleSubmit() + if (this.validator.getErrors() && Object.keys(this.validator.getErrors()).length > 0) return + console.log("after submit"); + this.setState({ currentStep: this.state.currentStep + 1 }) + this.form.resetSubmitted() + } + + handleBackClick() { + this.setState({ currentStep: this.state.currentStep + -1 }) + } + + handleSubmit() { + if (this.state.currentStep === 3) { + Meteor.call('staff.addNew', this.form.state.values, (error, result) => { + console.log(error); + console.log(result); + if(!error){ + this.props.modalState(); + } + }); + } + } + + //render callback + render() { + return ( +
this.form = form} + initialValues={{ + employeeId: '12345', + firstName: 'Test', + lastName: 'Last', + + martialStatus: 'single', + gender: 'male', + dob: '07/03/1993', + + email: 'deepak125.dk+400@gmail.com', + phone: '9876543210', + address: '123', + + teaching: "yes", + type: 'permanent', + doj: '07/03/2016', + + qualifaication: 'Phd', + specialization: 'Maths', + university: 'Pune University', + + degreeFrom: '07/03/2009', + degreeEnded: '07/03/2013', + }} + > + {({ values, setValue, getValue, isSubmitted, isDirty }) => ( + this.validator = validator} + validations={{ + employeeId: [(value) => isRequired('Admission id', value)], + firstName: [(value) => isRequired('First name', value)], + lastName: [(value) => isRequired('Last name', value)], + + gender: [(value) => isRequired('Gender', value)], + martialStatus: [(value) => isRequired('martialStatus', value)], + dob: [(value) => isRequired('Date of birth', value)], + + teaching: [(value) => this.state.currentStep === 1 && isRequired('teaching', value)], + type: [(value) => this.state.currentStep === 1 && isRequired('type', value)], + doj: [(value) => this.state.currentStep === 1 && isRequired('doj', value)], + desgnation: [(value) => this.state.currentStep === 1 && isRequired('desgnation', value)], + + qualifaication: [(value) => this.state.currentStep === 2 && isRequired('qualifaication', value)], + specialization: [(value) => this.state.currentStep === 2 && isRequired('specialization', value)], + university: [(value) => this.state.currentStep === 2 && isRequired('university', value)], + + degreeFrom: [(value) => this.state.currentStep === 2 && isRequired('degreeFrom', value)], + degreeEnded: [(value) => this.state.currentStep === 2 && isRequired('degreeEnded', value)], + + email: [(value) => this.state.currentStep === 3 && isRequired('Email', value), (value) => this.state.currentStep === 1 && isValidEmail(value)], + phone: [(value) => this.state.currentStep === 3 && isRequired('Phone', value)], + address: [(value) => this.state.currentStep === 3 && isRequired('Address', value)], + city: [(value) => this.state.currentStep === 3 && isRequired('City', value)], + state: [(value) => this.state.currentStep === 3 && isRequired('State', value)], + + }} + > + {({ errors }) => ( + + )} + + )} +
+ ) + } +} diff --git a/imports/client/views/org/admin/users/staff/add/StaffForm.js b/imports/client/views/org/admin/users/staff/add/StaffForm.js new file mode 100644 index 0000000..ec763b6 --- /dev/null +++ b/imports/client/views/org/admin/users/staff/add/StaffForm.js @@ -0,0 +1,417 @@ +import React, { PropTypes } from 'react' +import { + Row, + Col, + FormGroup, + FormControl, + Button +} from 'react-bootstrap' +import DatePicker from '/imports/client/views/core/DatePicker' +import Label from '/imports/client/views/core/Label' +import Stepper from '/imports/client/views/core/Stepper' +import ErrorLabel from '/imports/client/views/core/ErrorLabel' + +const StaffForm = props => ( +
+ + {props.currentStep === 0 && ( +
+ Personal data + + + + + props.setValue('employeeId', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.employeeId && ( + {props.errors.employeeId} + )} + + + + + + + props.setValue('firstName', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.firstName && ( + {props.errors.firstName} + )} + + + + + + + props.setValue('lastName', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.lastName && ( + {props.errors.lastName} + )} + + + + + + + + props.setValue('gender', e.target.value)} + > + + + + {props.isSubmitted() && props.errors && props.errors.gender && ( + {props.errors.gender} + )} + + + + + + + props.setValue('martialStatus', e.target.value)} + > + + + + + {props.isSubmitted() && props.errors && props.errors.martialStatus && ( + {props.errors.martialStatus} + )} + + + + + + + { + props.setValue('dob', e.target.value) + }} + /> + {props.isSubmitted() && props.errors && props.errors.dob && ( + {props.errors.dob} + )} + + + +
+ )} + {props.currentStep === 1 && ( +
+ Additional Info + + + + + props.setValue('desgnation', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.desgnation && ( + {props.errors.desgnation} + )} + + + + + + props.setValue('teaching', e.target.value)} + > + + + + {props.isSubmitted() && props.errors && props.errors.teaching && ( + {props.errors.teaching} + )} + + + + + + props.setValue('type', e.target.value)} + > + + + + {props.isSubmitted() && props.errors && props.errors.type && ( + {props.errors.type} + )} + + + + + + + + { + props.setValue('doj', e.target.value) + }} + /> + {props.isSubmitted() && props.errors && props.errors.doj && ( + {props.errors.doj} + )} + + + +
+ )} + {props.currentStep === 2 && ( +
+ Professional Info + + + + + props.setValue('qualifaication', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.qualifaication && ( + {props.errors.qualifaication} + )} + + + + + + props.setValue('specialization', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.specialization && ( + {props.errors.specialization} + )} + + + + + + props.setValue('university', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.university && ( + {props.errors.university} + )} + + + + + + + + { + props.setValue('degreeFrom', e.target.value) + }} + /> + {props.isSubmitted() && props.errors && props.errors.degreeFrom && ( + {props.errors.degreeFrom} + )} + + + + + + { + props.setValue('degreeEnded', e.target.value) + }} + /> + {props.isSubmitted() && props.errors && props.errors.degreeEnded && ( + {props.errors.degreeEnded} + )} + + + +
+ )} + {props.currentStep === 3 && ( +
+ Additional Info + + + + + props.setValue('email', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.email && ( + {props.errors.email} + )} + + + + + + props.setValue('phone', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.phone && ( + {props.errors.phone} + )} + + + + + + + + props.setValue('address', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.address && ( + {props.errors.address} + )} + + + + + + props.setValue('city', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.city && ( + {props.errors.city} + )} + + + + + + props.setValue('state', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.state && ( + {props.errors.state} + )} + + + +
+ )} +
+ {props.currentStep > 0 && ( +
+ + +
+ )} + {props.currentStep < 3 && ( +
+ +
+ )} + {props.currentStep === 3 && ( +
+ +
+ )} +
+
+) + +StaffForm.propTypes = { + currentStep: PropTypes.number.isRequired, + onNextClick: PropTypes.func.isRequired, + onBackClick: PropTypes.func.isRequired, + setValue: PropTypes.func.isRequired, + getValue: PropTypes.func.isRequired, +} + +export default StaffForm diff --git a/imports/client/views/org/admin/users/staff/add/addStaff.js b/imports/client/views/org/admin/users/staff/add/addStaff.js new file mode 100644 index 0000000..2819b6b --- /dev/null +++ b/imports/client/views/org/admin/users/staff/add/addStaff.js @@ -0,0 +1,66 @@ +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 { AddStaffFormContainer } from './AddStaffFormContainer'; + +const style = { + margin: 12, +}; +export class AddStaff extends Component { + constructor(props) { + super(props); + this.state = { + show: false + }; + 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() { + return ( + + + + + Add New Staff + + + + + {/* + + + + */} + + + ); + }; + +}; diff --git a/imports/client/views/org/admin/users/staff/index.js b/imports/client/views/org/admin/users/staff/index.js new file mode 100644 index 0000000..75b547a --- /dev/null +++ b/imports/client/views/org/admin/users/staff/index.js @@ -0,0 +1,70 @@ +// import { InviteSignupController } from '/imports/client/views/invite/signup/index' +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 { Staffs } from '/imports/collections/staff/index'; +import { StaffView } from './StaffView'; + +const meteorTick = (props, onData) => { + Shelf.layout.set({ + bulb: 'SETTINGS', + subbulb: 'USERS', + view: 'STAFF' + }); + const handles = [ + Meteor.subscribe('users.current'), + Meteor.subscribe('orgs.current'), + Meteor.subscribe('users.forMyOrg'), + Meteor.subscribe('staff.forMyOrg'), + ]; + + if(_.every(handles, (handle) => (handle.ready()) )) { + const user = Users.current(); + const org = Orgs.current(); + staff = Users.find({"role":"STAFF"}).fetch() ? Users.find({"role":"STAFF"}).fetch() : ""; + console.log(Users.find({"role":"STAFF"}).fetch()); + staffData = Staffs.find().fetch() ? Staffs.find().fetch() : ""; + console.log("staffData"); + console.log(staffData); + for(var i=0; i< staff.length; i++){ + for(var j=0; j< staffData.length; j++){ + if(staff[i]._id == staffData[j].userId){ + staff[i].type = staffData[j].type; + staff[i].employeeId = staffData[j].employeeId; + staff[i].dob = staffData[j].dob; + } + } + } + onData(null, { + data: { + user: user, + org: org, + staff: staff + }, + }); + } + + return () => { + _.each(handles, (handle) => handle.stop() ); + }; +}; + + +const reduxTick = (props, onData) => { + onData(null, { + data: {} + }); +}; + + +export const staffViewController = composeAll( + composeWithTracker(meteorTick, Loading), + compose(reduxTick, Loading), +)(StaffView); diff --git a/imports/client/views/org/admin/users/staff/view/StaffRow.js b/imports/client/views/org/admin/users/staff/view/StaffRow.js new file mode 100644 index 0000000..f2438f6 --- /dev/null +++ b/imports/client/views/org/admin/users/staff/view/StaffRow.js @@ -0,0 +1,56 @@ +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 StaffRow extends Component { + + constructor(props) { + super(props); + this.state = { + + }; + this.onUpdate = this.onUpdate.bind(this); + }; + + onUpdate(key, value) { + this.setState({[key]: value}); + }; + + render() { + const {staff} = this.props; + if(staff.firstName){ + return ( + + {staff.firstName} + {staff.lastName} + {staff.type} + {staff.dob? moment(staff.dob).format("LL") : } + Active + + + + + ); + }else { + return null; + } + + }; + +}; diff --git a/imports/client/views/org/admin/users/staff/view/StaffTable.js b/imports/client/views/org/admin/users/staff/view/StaffTable.js new file mode 100644 index 0000000..357d37a --- /dev/null +++ b/imports/client/views/org/admin/users/staff/view/StaffTable.js @@ -0,0 +1,85 @@ +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 {StaffRow} from './StaffRow' +import {BootstrapTable, TableHeaderColumn}from 'react-bootstrap-table'; +const options = { + page: 0, // which page you want to show as default + sizePerPageList: [ { + text: '5', value: 5 + }, { + text: '10', value: 10 + }], // you can change the dropdown list for size per page + sizePerPage: 5, // which size per page you want to locate as default + pageStartIndex: 0, // where to start counting the pages + paginationSize: 3, // the pagination bar size. + prePage: 'Prev', // Previous page button text + nextPage: 'Next', // Next page button text + firstPage: 'First', // First page button text + lastPage: 'Last', // Last page button text + paginationShowsTotal: false, // Accept bool or function + paginationPosition: 'bottom' // default is bottom, top and both is all available + // hideSizePerPage: true > You can hide the dropdown for sizePerPage + // alwaysShowAllBtns: true // Always show next and previous button + // withFirstAndLast: false > Hide the going to First and Last page button + }; + +function dateFormatter(cell, row) { + console.log("cell"); + console.log(cell); + if(cell){ + cell = new Date(cell); + console.log(cell); + return `${('0' + cell.getDate()).slice(-2)}/${('0' + (cell.getMonth() + 1)).slice(-2)}/${cell.getFullYear()}`; + } +} + +export class StaffTable extends Component { + + constructor(props) { + super(props); + this.state = { + show: false, + panleOpen: true, + }; + this.onUpdate = this.onUpdate.bind(this); + }; + onUpdate(key, value) { + this.setState({[key]: value}); + }; + togglePanel(){ + this.setState({panleOpen: !this.state.panleOpen}); + } + render() { + console.log("this.props.staff"); + console.log(this.props.staff); + return ( +
+
+
Teachers Details
+
+
    +
  • +
+
+
+ + + Employee Id + First Name + Last Name + Type + DOB + + +
+ ); + }; + +}; diff --git a/imports/client/views/org/admin/users/students/StudentDataView.js b/imports/client/views/org/admin/users/students/StudentDataView.js new file mode 100644 index 0000000..750102e --- /dev/null +++ b/imports/client/views/org/admin/users/students/StudentDataView.js @@ -0,0 +1,274 @@ +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 { AddStudentForm } from './addStudentForm'; + +export class StudentDataView extends Component { + + constructor(props) { + super(props); + this.state = { + show: false + }; + 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() { + return ( +
+ +
+
+
+
+
+
+
+ + + +
+ +
+
Students
+ Click to view +
+
+
+
+ +
+
+
+
+ + + +
+ +
+
Teachers
+ Click to view +
+
+
+
+ +
+
+
+
+ + + +
+ +
+
Parents
+ Click to view +
+
+
+
+ +
+
+
+
+ + + +
+ +
+
Non Teaching Staff
+ Click to view +
+
+
+
+
+ +
+
+
Student Details
+
+
    +
  • +
  • +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
First NameLast NameclassNameDOBStatusActions
MarthEnrightVII22 Jun 1972Active + +
JackelynWeibleXI3 Oct 1981Inactive + +
+
+ + + + +
+
+
+
+
+ +
+
+ Advanced Search +
    +
  • +
+
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ + +
+
+
+
+ + ); + }; + +}; diff --git a/imports/client/views/org/admin/users/students/StudentDataView0.js b/imports/client/views/org/admin/users/students/StudentDataView0.js new file mode 100644 index 0000000..03a3f53 --- /dev/null +++ b/imports/client/views/org/admin/users/students/StudentDataView0.js @@ -0,0 +1,88 @@ +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 { AddStudentForm } from './addStudentForm'; + +export class StudentDataView extends Component { + + constructor(props) { + super(props); + this.state = { + show: false + }; + 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() { + return ( +
+ + + + + + + + + + + { + this.props.data.students.map(function(student, i) + { + return( + + + + + + ) + }) + } + + +
#First NameLast Name
{i+1}{student.firstName}{student.lastName}
+ + + + + New Student + + + + + + + + + +
+
+ ); + }; + +}; diff --git a/imports/client/views/org/admin/users/students/StudentView.js b/imports/client/views/org/admin/users/students/StudentView.js new file mode 100644 index 0000000..d65f66c --- /dev/null +++ b/imports/client/views/org/admin/users/students/StudentView.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 { 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 { 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 ( +
+
+ + + +
+
+ ); + }; + +}; diff --git a/imports/client/views/org/admin/users/students/UploadCsv.js b/imports/client/views/org/admin/users/students/UploadCsv.js new file mode 100644 index 0000000..78dfc52 --- /dev/null +++ b/imports/client/views/org/admin/users/students/UploadCsv.js @@ -0,0 +1,103 @@ +// import {UploadCsv } from '/imports/collections/students/UploadCsv' +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,ControlLabel,HelpBlock, + FormControl,Glyphicon,Button } from 'react-bootstrap'; +// import { AddStudentForm } from './addStudentForm'; +import { FilesCollection } from 'meteor/ostrio:files'; +const Papa = this.Papa; +// console.log(this); +const style = { + margin: 12, +}; +function FieldGroup({ id, label, help, ...props }) { + return ( + + {label} + + {help && {help}} + + ); +} +export class UploadCsv extends Component { + constructor(props) { + super(props); + this.state = { + show: false + }; + 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}); + }; + uploadStudentCsv(e){ + e.preventDefault(); + e.persist(); + var file = $('input[type="file"]').prop("files")[0]; + Papa.parse(file, { + header: true, + complete: function(csvData) { + console.log("csvData"); + console.log(csvData); + if(csvData){ + Meteor.call('student.uploadCsv', csvData, function (error, result) { + console.log("error"); + console.log(error); + console.log("result"); + console.log(result); + }) + } + } + }); + } + + render() { + console.log(this.props); + return ( + + + + + Upload Csv file + + +
this.uploadStudentCsv(e) } > + + + +
+ + + +
+
+ ); + }; + +}; diff --git a/imports/client/views/org/admin/users/students/add/AddStudentFormContainer.js b/imports/client/views/org/admin/users/students/add/AddStudentFormContainer.js new file mode 100644 index 0000000..46cc059 --- /dev/null +++ b/imports/client/views/org/admin/users/students/add/AddStudentFormContainer.js @@ -0,0 +1,130 @@ +import React, { Component } from 'react' +import { AddStudentForm } from './addStudentForm' +import StudentForm from './StudentForm' +import Form from '/imports/client/views/core/Form' +import Validator from '/imports/client/views/core/Validator' +import { isRequired, isValidEmail } from '/imports/client/views/core/validations' + + +export class AddStudentFormContainer extends Component { + + constructor(props) { + super(props) + this.state = { currentStep: 0 } + this.handleNextClick = this.handleNextClick.bind(this) + this.handleBackClick = this.handleBackClick.bind(this) + this.handleSubmit = this.handleSubmit.bind(this) + } + + handleNextClick() { + this.form.handleSubmit() + if (this.validator.getErrors() && Object.keys(this.validator.getErrors()).length > 0) return + this.setState({ currentStep: this.state.currentStep + 1 }) + this.form.resetSubmitted() + } + + handleBackClick() { + this.setState({ currentStep: this.state.currentStep + -1 }) + } + + handleSubmit() { + self = this; + if (this.state.currentStep === 3) { + Meteor.call('student.addManually',this.form.state.values, function(err, result){ + console.log("err"); + console.log(err); + console.log("result"); + console.log(result); + if(!err){ + self.props.hideModal(); + } + }); + } + } + + //render callback + render() { + return ( +
this.form = form} + initialValues={{ + gender: 'male', + parentGender: 'male', + admissionId: "123", + firstName: "first", + lastName: "last", + email: "deepak125.dk+21@gmail.com", + dob: "04/04/1989", + gender: "male", + rollNo: "1", + studentClass: "2", + section: "B", + community: "SC", + bloodGroup: "B+", + phone: "9876543321", + address: "address", + city: "chennai", + state: "tn", + parentName: "parentName", + parentEmail: "deepak125.dk+41@gmail.com", + relation: "father", + profession: "farmer", + parentGender: "male", + parentPhone: "987655412", + parentAddress: "parentAddress", + parentCity: "parentCity", + parentState: "parentState", + parentZipcode: "parentZipcode", + }} + > + {({ values, setValue, getValue, isSubmitted, isDirty }) => ( + this.validator = validator} + validations={{ + admissionId: [(value) => isRequired('Admission id', value)], + firstName: [(value) => isRequired('First name', value)], + lastName: [(value) => isRequired('Last name', value)], + email: [(value) => isRequired('Email', value), isValidEmail], + dob: [(value) => isRequired('Date of birth', value)], + gender: [(value) => isRequired('Gender', value)], + rollNo: [(value) => this.state.currentStep === 1 && isRequired('Roll no', value)], + studentClass: [(value) => this.state.currentStep === 1 && isRequired('Class', value)], + section: [(value) => this.state.currentStep === 1 && isRequired('Section', value)], + community: [(value) => this.state.currentStep === 1 && isRequired('Community', value)], + bloodGroup: [(value) => this.state.currentStep === 1 && isRequired('Blood group', value)], + phone: [(value) => this.state.currentStep === 1 && isRequired('Phone', value)], + address: [(value) => this.state.currentStep === 2 && isRequired('Address', value)], + city: [(value) => this.state.currentStep === 2 && isRequired('City', value)], + state: [(value) => this.state.currentStep === 2 && isRequired('State', value)], + parentName: [(value) => this.state.currentStep === 3 && isRequired('Parent name', value)], + parentEmail: [(value) => this.state.currentStep === 3 && isRequired('Parent email', value), (value) => this.state.currentStep === 3 && isValidEmail(value)], + relation: [(value) => this.state.currentStep === 3 && isRequired('Relation', value)], + profession: [(value) => this.state.currentStep === 3 && isRequired('Profession', value)], + parentGender: [(value) => this.state.currentStep === 3 && isRequired('Parent gender', value)], + parentPhone: [(value) => this.state.currentStep === 3 && isRequired('Parent phone', value)], + parentAddress: [(value) => this.state.currentStep === 3 && isRequired('Parent address', value)], + parentCity: [(value) => this.state.currentStep === 3 && isRequired('Parent city', value)], + parentState: [(value) => this.state.currentStep === 3 && isRequired('Parent state', value)], + parentZipcode: [(value) => this.state.currentStep === 3 && isRequired('Parent zip code', value)], + }} + > + {({ errors }) => ( + + )} + + )} +
+ ) + } +} diff --git a/imports/client/views/org/admin/users/students/add/StudentForm.js b/imports/client/views/org/admin/users/students/add/StudentForm.js new file mode 100644 index 0000000..a321be7 --- /dev/null +++ b/imports/client/views/org/admin/users/students/add/StudentForm.js @@ -0,0 +1,474 @@ +import React, { PropTypes } from 'react' +import { + Row, + Col, + FormGroup, + FormControl, + Button +} from 'react-bootstrap' +import DatePicker from '/imports/client/views/core/DatePicker' +import Label from '/imports/client/views/core/Label' +import Stepper from '/imports/client/views/core/Stepper' +import ErrorLabel from '/imports/client/views/core/ErrorLabel' + +const StudentForm = props => ( +
+ + {props.currentStep === 0 && ( +
+ Personal data + + + + + props.setValue('admissionId', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.admissionId && ( + {props.errors.admissionId} + )} + + + + + + props.setValue('firstName', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.firstName && ( + {props.errors.firstName} + )} + + + + + + props.setValue('lastName', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.lastName && ( + {props.errors.lastName} + )} + + + + + + + + props.setValue('gender', e.target.value)} + > + + + + {props.isSubmitted() && props.errors && props.errors.gender && ( + {props.errors.gender} + )} + + + + + + props.setValue('email', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.email && ( + {props.errors.email} + )} + + + + + + { + props.setValue('dob', e.target.value) + }} + /> + {props.isSubmitted() && props.errors && props.errors.dob && ( + {props.errors.dob} + )} + + + +
+ )} + {props.currentStep === 1 && ( +
+ Academic + + + + + props.setValue('rollNo', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.rollNo && ( + {props.errors.rollNo} + )} + + + + + + props.setValue('studentClass', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.studentClass && ( + {props.errors.studentClass} + )} + + + + + + props.setValue('section', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.section && ( + {props.errors.section} + )} + + + + + + + + props.setValue('community', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.community && ( + {props.errors.community} + )} + + + + + + props.setValue('bloodGroup', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.bloodGroup && ( + {props.errors.bloodGroup} + )} + + + + + + props.setValue('phone', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.phone && ( + {props.errors.phone} + )} + + + +
+ )} + {props.currentStep === 2 && ( +
+ Address + + + + + props.setValue('address', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.address && ( + {props.errors.address} + )} + + + + + + props.setValue('city', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.city && ( + {props.errors.city} + )} + + + + + + props.setValue('state', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.state && ( + {props.errors.state} + )} + + + +
+ )} + {props.currentStep === 3 && ( +
+ Parent information + + + + + props.setValue('parentName', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.parentName && ( + {props.errors.parentName} + )} + + + + + + props.setValue('parentEmail', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.parentEmail && ( + {props.errors.parentEmail} + )} + + + + + + props.setValue('relation', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.relation && ( + {props.errors.relation} + )} + + + + + + + + props.setValue('profession', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.profession && ( + {props.errors.profession} + )} + + + + + + props.setValue('parentGender', e.target.value)} + > + + + + {props.isSubmitted() && props.errors && props.errors.parentGender && ( + {props.errors.parentGender} + )} + + + + + + props.setValue('parentPhone', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.parentPhone && ( + {props.errors.parentPhone} + )} + + + + + + + + props.setValue('parentAddress', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.parentAddress && ( + {props.errors.parentAddress} + )} + + + + + + props.setValue('parentCity', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.parentCity && ( + {props.errors.parentCity} + )} + + + + + + props.setValue('parentState', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.parentState && ( + {props.errors.parentState} + )} + + + + + + + + props.setValue('parentZipcode', e.target.value)} + /> + {props.isSubmitted() && props.errors && props.errors.parentZipcode && ( + {props.errors.parentZipcode} + )} + + + +
+ )} +
+ {props.currentStep > 0 && ( +
+ + +
+ )} + {props.currentStep < 3 && ( +
+ +
+ )} + {props.currentStep === 3 && ( +
+ +
+ )} +
+
+) + +StudentForm.propTypes = { + currentStep: PropTypes.number.isRequired, + onNextClick: PropTypes.func.isRequired, + onBackClick: PropTypes.func.isRequired, + setValue: PropTypes.func.isRequired, + getValue: PropTypes.func.isRequired, +} + +export default StudentForm diff --git a/imports/client/views/org/admin/users/students/add/addStudent.js b/imports/client/views/org/admin/users/students/add/addStudent.js new file mode 100644 index 0000000..69bfc4a --- /dev/null +++ b/imports/client/views/org/admin/users/students/add/addStudent.js @@ -0,0 +1,66 @@ +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 { AddStudentFormContainer } from './AddStudentFormContainer'; + +const style = { + margin: 12, +}; +export class AddStudent extends Component { + constructor(props) { + super(props); + this.state = { + show: false + }; + 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() { + return ( + + + + + Add Student + + + + + {/* + + + + */} + + + ); + }; + +}; diff --git a/imports/client/views/org/admin/users/students/add/addStudentForm.js b/imports/client/views/org/admin/users/students/add/addStudentForm.js new file mode 100644 index 0000000..9f41e25 --- /dev/null +++ b/imports/client/views/org/admin/users/students/add/addStudentForm.js @@ -0,0 +1,500 @@ +import _ from 'lodash'; +import { Meteor } from 'meteor/meteor'; + +import React, { Component } from 'react'; +import { Link,browserHistory } from 'react-router'; +import { Form, FormGroup,InputGroup, + DropdownButton,MenuItem,ControlLabel, + SplitButton, + FormControl,Glyphicon,Button } from 'react-bootstrap'; +import DatePicker from 'react-bootstrap-date-picker' +import {addStudentManually} from '/imports/collections/students/methods'; + +export class AddStudentForm extends Component { + + constructor(props) { + super(props); + this.state = { + admissionId: "123", + firstName: "first", + lastName: "last", + middleName: "middle", + email: "deepak125.dk+21@gmail.com", + dob: "", + formattedDob: "", + gender: "male", + rollNo: "1", + class: "2", + section: "B", + community: "SC", + bloodGroup: "B+", + phone: "9876543321", + address: "address", + city: "chennai", + state: "tn", + parentName: "parentName", + parentEmail: "deepak125.dk+41@gmail.com", + relation: "father", + profession: "farmer", + parentGender: "male", + parentPhone: "987655412", + parentAddress: "parentAddress", + parentCity: "parentCity", + parentState: "parentState", + parentZipcode: "parentZipcode", + }; + this.onUpdate = this.onUpdate.bind(this); + this.handleDob = this.handleDob.bind(this); + }; + + onUpdate(key, value) { + this.setState({[key]: value}); + }; + + handleDob(value, formattedValue) { + this.setState({ + dob: value, // ISO String, ex: "2016-11-19T12:00:00.000Z" + formattedDob: formattedValue // Formatted String, ex: "11/19/2016" + }); +} + addStudent(e){ + e.preventDefault(); + e.persist(); + const firstName = this.state.firstName; + const middleName = this.state.middleName; + const lastName = this.state.lastName; + const admissionId = this.state.admissionId; + const email = this.state.email; + const dob = this.state.dob; + const formattedDob = this.state.formattedDob; + const gender = this.state.gender; + const rollNo = this.state.rollNo; + const studentclass = this.state.class; + const section = this.state.section; + const community = this.state.community; + const bloodGroup = this.state.bloodGroup; + const phone = this.state.phone; + const address = this.state.address; + const city = this.state.city; + const state = this.state.state; + const parentName = this.state.parentName; + const parentEmail = this.state.parentEmail; + const relation = this.state.relation; + const profession = this.state.profession; + const parentGender = this.state.parentGender; + const parentPhone = this.state.parentPhone; + const parentAddress = this.state.parentAddress; + const parentCity = this.state.parentCity; + const parentState = this.state.parentState; + const parentZipcode = this.state.parentZipcode; + if(admissionId==""){ + Bert.alert('Enter Admission Id!', 'danger'); + }else if(firstName==""){ + Bert.alert('Enter Fist Name', 'danger'); + } else if(middleName==""){ + Bert.alert('Enter Middle name!', 'danger'); + }else if(lastName==""){ + Bert.alert('Enter Last name!', 'danger'); + }else if(email==""){ + Bert.alert('Enter email!', 'danger'); + }else if(dob==""){ + Bert.alert('Enter DOB!', 'danger'); + }else if(gender==""){ + Bert.alert('Enter Student Gender!', 'danger'); + }else if(studentclass==""){ + Bert.alert('Enter Class!', 'danger'); + }else if(section==""){ + Bert.alert('Enter Section!', 'danger'); + }else if(community==""){ + Bert.alert('Enter Section!', 'danger'); + }else if(bloodGroup==""){ + Bert.alert('Enter Blood Group!', 'danger'); + }else if(phone==""){ + Bert.alert('Enter phone!', 'danger'); + }else if(address==""){ + Bert.alert('Enter address!', 'danger'); + }else if(city==""){ + Bert.alert('Enter city!', 'danger'); + }else if(state==""){ + Bert.alert('Enter state!', 'danger'); + }else if(parentName==""){ + Bert.alert('Enter Parent name!', 'danger'); + }else if(parentEmail==""){ + Bert.alert('Enter Parent Email!', 'danger'); + }else if(relation==""){ + Bert.alert('Enter relation!', 'danger'); + }else if(profession==""){ + Bert.alert('Enter parent profession!', 'danger'); + }else if(parentGender==""){ + Bert.alert("Enter Parent's Gender!", 'danger'); + }else if(parentPhone==""){ + Bert.alert("Enter Parent's Phone!", 'danger'); + }else if(parentAddress==""){ + Bert.alert("Enter Parent's Address!", 'danger'); + }else if(parentCity==""){ + Bert.alert("Enter Parent's City!", 'danger'); + }else if(parentState==""){ + Bert.alert("Enter Parent's State!", 'danger'); + }else if(parentZipcode==""){ + Bert.alert("Enter Parent's zipcode!", 'danger'); + }else{ + addStudentManually.call({ + admissionId, + firstName, + middleName, + lastName, + email, + dob, + formattedDob, + gender, + rollNo, + studentclass, + section, + community, + bloodGroup, + phone, + address, + city, + state, + parentName, + parentEmail, + relation, + profession, + parentGender, + parentPhone, + parentAddress, + parentCity, + parentState, + parentZipcode + }, function (error, result) { + console.log(error); + console.log(result); + }); + } + } + render() { + return ( +
this.addStudent(e) } inline> + +
+
Personal data
+
+
+
+ + + Admission Id + this.onUpdate('admissionId',e.target.value)} + /> + + +
+ +
+ + + First Name + this.onUpdate('firstName',e.target.value)} + /> + + +
+
+
+
+ + + + Admission Id + this.onUpdate('admissionId',e.target.value)} + /> + + + + First Name + this.onUpdate('firstName',e.target.value)} + /> + + + Middle Name + this.onUpdate('middleName',e.target.value)} + /> + + + + Last Name + this.onUpdate('lastName',e.target.value)} + /> + + + + Email + this.onUpdate('email',e.target.value)} + /> + + + Date of birth + + + + + Gender + this.onUpdate('gender',e.target.value)} + > + + + + + + + Roll No + this.onUpdate('rollNo',e.target.value)} + /> + + + Class + this.onUpdate('class',e.target.value)} + /> + + + Section + this.onUpdate('section',e.target.value)} + /> + + + + Community + this.onUpdate('community',e.target.value)} + /> + + + + bloodGroup + this.onUpdate('bloodGroup',e.target.value)} + /> + + + + Phone + this.onUpdate('phone',e.target.value)} + /> + + + + Address + this.onUpdate('address',e.target.value)} + /> + + + + City + this.onUpdate('city',e.target.value)} + /> + + + + State + this.onUpdate('state',e.target.value)} + /> + + + + Parent Name + this.onUpdate('parentName',e.target.value)} + /> + + + + Parent Email + this.onUpdate('parentEmail',e.target.value)} + /> + + + + Relation + this.onUpdate('relation',e.target.value)} + /> + + + + Profession + this.onUpdate('profession',e.target.value)} + /> + + + + Parent Gender + this.onUpdate('parentGender',e.target.value)} + > + + + + + + + Parent Phone + this.onUpdate('parentPhone',e.target.value)} + /> + + + + Parent Address + this.onUpdate('parentAddress',e.target.value)} + /> + + + + Parent City + this.onUpdate('parentCity',e.target.value)} + /> + + + + Parent State + this.onUpdate('parentState',e.target.value)} + /> + + + + Parent Zipcode + this.onUpdate('parentZipcode',e.target.value)} + /> + + +
+ ); + }; + +}; diff --git a/imports/client/views/org/admin/users/students/index.js b/imports/client/views/org/admin/users/students/index.js new file mode 100644 index 0000000..016dcde --- /dev/null +++ b/imports/client/views/org/admin/users/students/index.js @@ -0,0 +1,69 @@ +// import { StudentDataController } from '/imports/client/views/org/admin/students/index' +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 { StudentView } from './StudentView'; +import { Students } from '/imports/collections/students/index'; + + +const meteorTick = (props, onData) => { + Shelf.layout.set({ + bulb: 'SETTINGS', + subbulb: 'USERS', + view: 'STUDENTS' + }); + const handles = [ + Meteor.subscribe('users.current'), + Meteor.subscribe('orgs.current'), + Meteor.subscribe('users.forMyOrg'), + Meteor.subscribe('student.forMyOrg'), + ]; + + if(_.every(handles, (handle) => (handle.ready()) )) { + const user = Users.current(); + const org = Orgs.current(); + students = Users.find({"role":"STUDENT"}).fetch() ? Users.find({"role":"STUDENT"}).fetch() : ""; + studentData = Students.find().fetch() ? Students.find().fetch() : ""; + for(var i=0; i< studentData.length; i++){ + for(var j=0; j< students.length; j++){ + if(studentData[i].userId == students[j]._id && studentData[i].admissionId){ + studentData[i].firstName = students[j].firstName; + studentData[i].lastName = students[j].lastName; + }else{ + + } + } + } + onData(null, { + data: { + user: user, + org: org, + studentData: studentData + }, + }); + } + + return () => { + _.each(handles, (handle) => handle.stop() ); + }; +}; + + +const reduxTick = (props, onData) => { + onData(null, { + data: {} + }); +}; + + +export const StudentDataController = composeAll( + composeWithTracker(meteorTick, Loading), + compose(reduxTick, Loading), +)(StudentView); diff --git a/imports/client/views/org/admin/users/students/student.css b/imports/client/views/org/admin/users/students/student.css new file mode 100644 index 0000000..dc886d1 --- /dev/null +++ b/imports/client/views/org/admin/users/students/student.css @@ -0,0 +1,5 @@ +.btn-toolbar { + display: inline-block; + font-size: 0; + margin-right: 12px; +} diff --git a/imports/client/views/org/admin/users/students/view/StudentRow.js b/imports/client/views/org/admin/users/students/view/StudentRow.js new file mode 100644 index 0000000..a02bbf6 --- /dev/null +++ b/imports/client/views/org/admin/users/students/view/StudentRow.js @@ -0,0 +1,66 @@ +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 StudentRow extends Component { + + constructor(props) { + super(props); + this.state = { + editOpen: false, + }; + this.onUpdate = this.onUpdate.bind(this); + this.toggleEditOpen = this.toggleEditOpen.bind(this); + this.deleteStudent = this.deleteStudent.bind(this); + }; + + onUpdate(key, value) { + this.setState({[key]: value}); + }; + toggleEditOpen(){ + this.setState({ + editOpen : !this.state.editOpen + }) + } + deleteStudent(){ + console.log("Delete"); + console.log(this.props.student._id); + } + render() { + const {student} = this.props; + if(student.firstName){ + return ( + + {student.firstName} + {student.lastName} + {student.class} + {student.dob? moment(student.dob).format("LL") : } + Active + +
    +
  • + + + +
      +
    • View
    • +
    • Edit
    • +
    • Delete
    • +
    +
  • +
+ + + ); + }else { + return null; + } + + }; + +}; diff --git a/imports/client/views/org/admin/users/students/view/StudentTable.js b/imports/client/views/org/admin/users/students/view/StudentTable.js new file mode 100644 index 0000000..5f331fa --- /dev/null +++ b/imports/client/views/org/admin/users/students/view/StudentTable.js @@ -0,0 +1,85 @@ +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 {StudentRow} from './StudentRow' +import {BootstrapTable, TableHeaderColumn}from 'react-bootstrap-table'; + +const options = { + page: 0, // which page you want to show as default + sizePerPageList: [ { + text: '5', value: 5 + }, { + text: '10', value: 10 + }], // you can change the dropdown list for size per page + sizePerPage: 5, // which size per page you want to locate as default + pageStartIndex: 0, // where to start counting the pages + paginationSize: 3, // the pagination bar size. + prePage: 'Prev', // Previous page button text + nextPage: 'Next', // Next page button text + firstPage: 'First', // First page button text + lastPage: 'Last', // Last page button text + paginationShowsTotal: false, // Accept bool or function + paginationPosition: 'bottom' // default is bottom, top and both is all available + // hideSizePerPage: true > You can hide the dropdown for sizePerPage + // alwaysShowAllBtns: true // Always show next and previous button + // withFirstAndLast: false > Hide the going to First and Last page button + }; + +function dateFormatter(cell, row) { + if(cell){ + cell = new Date(cell); + return `${('0' + cell.getDate()).slice(-2)}/${('0' + (cell.getMonth() + 1)).slice(-2)}/${cell.getFullYear()}`; + } +} +export class StudentTable extends Component { + + constructor(props) { + super(props); + this.state = { + show: false, + panleOpen: true, + }; + this.onUpdate = this.onUpdate.bind(this); + this.togglePanel = this.togglePanel.bind(this); + }; + onUpdate(key, value) { + this.setState({[key]: value}); + }; + togglePanel(){ + this.setState({panleOpen: !this.state.panleOpen}); + } + + render() { + studentData = this.props.studentData; + console.log("this.props.studentData"); + console.log(this.props.studentData); + return ( +
+
+
Student Details
+
+
    +
  • +
+
+
+ + + Admission Id + First Name + Last Name + Class + DOB + + +
+ ); + }; + +}; -- 2.0.0