diff --git a/client/stylesheets/custom.css b/client/stylesheets/custom.css index 3aa28e0..dc89720 100644 --- a/client/stylesheets/custom.css +++ b/client/stylesheets/custom.css @@ -30,6 +30,10 @@ table .dropdown-menu > li > span{ padding: 6px 16px; display: block; } +button.close span{ + font-size: 24px; + color: black; +} .panel-body{ max-height: 550px; overflow-y: scroll; diff --git a/imports/client/views/core/DatePicker.js b/imports/client/views/core/DatePicker.js index 4fd1e4a..26435b1 100644 --- a/imports/client/views/core/DatePicker.js +++ b/imports/client/views/core/DatePicker.js @@ -10,7 +10,7 @@ class DatePicker extends Component { changeYear: true, showButtonPanel: true, yearRange: '-35:-1', - dateFormat: 'dd/mm/yy', + dateFormat: 'mm/dd/yy', onSelect: function(dateText, inst) { var date = $(this).val(); // $("#datepickerDOB").val(date); diff --git a/imports/client/views/core/checkBoxFilter.js b/imports/client/views/core/checkBoxFilter.js new file mode 100644 index 0000000..9c96bd4 --- /dev/null +++ b/imports/client/views/core/checkBoxFilter.js @@ -0,0 +1,44 @@ +export class CheckboxFilter extends React.Component { + constructor(props) { + super(props); + this.filter = this.filter.bind(this); + this.isFiltered = this.isFiltered.bind(this); + } + + filter(event) { + if (this.refs.nokCheckbox.checked && this.refs.okCheckbox.checked) { + // all checkboxes are checked means we want to remove the filter for this column + this.props.filterHandler(); + } else { + this.props.filterHandler({ callback: this.isFiltered }); + } + } + + isFiltered(targetValue) { + if (targetValue === 'no') { + return (this.refs.nokCheckbox.checked); + } else { + return (this.refs.okCheckbox.checked); + } + } + + render() { + return ( +
+ + +
+ ); + } +} + +CheckboxFilter.propTypes = { + filterHandler: React.PropTypes.func.isRequired, + textOK: React.PropTypes.string, + textNOK: React.PropTypes.string +}; + +CheckboxFilter.defaultProps = { + textOK: 'OK', + textNOK: 'Not OK' +}; diff --git a/imports/client/views/org/admin/parents/index.js b/imports/client/views/org/admin/parents/index.js index 91ae565..6854d74 100644 --- a/imports/client/views/org/admin/parents/index.js +++ b/imports/client/views/org/admin/parents/index.js @@ -35,6 +35,8 @@ const meteorTick = (props, onData) => { 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; } } } diff --git a/imports/client/views/org/admin/parents/parentsview.js b/imports/client/views/org/admin/parents/parentsview.js index b7a7f38..f0b3c82 100644 --- a/imports/client/views/org/admin/parents/parentsview.js +++ b/imports/client/views/org/admin/parents/parentsview.js @@ -24,6 +24,9 @@ export class ParentsView extends Component { onUpdate(key, value) { this.setState({[key]: value}); }; + togglePanel(){ + this.setState({panleOpen: !this.state.panleOpen}); + } render() { const {user, org, parent} = this.props.data; @@ -40,7 +43,6 @@ export class ParentsView extends Component {
-
{/* */} -
-
-
-
-
- -
-
- Advanced Search -
    -
  • -
-
- -
-
-
- this.onUpdate('firstNameSearch',e.target.value)} - placeholder="First Name" - /> -
- -
-
-
-
-
-
-
- this.onUpdate('lastNameSearch',e.target.value)} - placeholder="Last Name" /> -
- -
-
-
-
-
-
-
diff --git a/imports/client/views/org/admin/parents/view/ParentTable.js b/imports/client/views/org/admin/parents/view/ParentTable.js index 0b7a34d..8bf1e54 100644 --- a/imports/client/views/org/admin/parents/view/ParentTable.js +++ b/imports/client/views/org/admin/parents/view/ParentTable.js @@ -8,13 +8,35 @@ import { FormGroup,Panel,Table, 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 + show: false, + panleOpen: true, }; this.onUpdate = this.onUpdate.bind(this); }; @@ -29,34 +51,18 @@ export class ParentTable extends Component {
Parent Details
- - - - - - - - - - - { - this.props.parent.map(function(parent, i) - { - return( - - ) - }) - } - -
First NameRelationshipStatusActions
+ + + Sr No + Name + Relationship + Profession + + ); }; diff --git a/imports/client/views/org/admin/staff/StaffView.js b/imports/client/views/org/admin/staff/StaffView.js index 1372a4b..46041b8 100644 --- a/imports/client/views/org/admin/staff/StaffView.js +++ b/imports/client/views/org/admin/staff/StaffView.js @@ -37,65 +37,19 @@ export class StaffView extends Component { />
-
-
-
- - - -
-
-
-
-
- -
-
- Advanced Search -
    -
  • -
-
- -
-
-
- this.onUpdate('firstNameSearch',e.target.value)} - placeholder="First Name" - /> -
- -
-
-
-
-
-
-
- this.onUpdate('lastNameSearch',e.target.value)} - placeholder="Last Name" /> -
- -
-
-
-
-
-
-
-
+
+ + + +
diff --git a/imports/client/views/org/admin/staff/add/AddStaffFormContainer.js b/imports/client/views/org/admin/staff/add/AddStaffFormContainer.js index 994879e..da3af70 100644 --- a/imports/client/views/org/admin/staff/add/AddStaffFormContainer.js +++ b/imports/client/views/org/admin/staff/add/AddStaffFormContainer.js @@ -3,7 +3,6 @@ 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' -import { addStudentManually } from '/imports/collections/students/methods'; export class AddStaffFormContainer extends Component { @@ -29,11 +28,13 @@ export class AddStaffFormContainer extends Component { } handleSubmit() { - if (this.state.currentStep === 2) { - console.log(this.form.state.values); + 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(); + } }); } } @@ -82,13 +83,10 @@ export class AddStaffFormContainer extends Component { martialStatus: [(value) => isRequired('martialStatus', value)], dob: [(value) => isRequired('Date of birth', value)], - email: [(value) => this.state.currentStep === 1 && isRequired('Email', value), (value) => this.state.currentStep === 1 && isValidEmail(value)], - phone: [(value) => this.state.currentStep === 1 && isRequired('Phone', value)], - address: [(value) => this.state.currentStep === 1 && isRequired('Address', 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)], @@ -97,6 +95,12 @@ export class AddStaffFormContainer extends Component { 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/staff/add/StaffForm.js b/imports/client/views/org/admin/staff/add/StaffForm.js index 48b8ad3..ec763b6 100644 --- a/imports/client/views/org/admin/staff/add/StaffForm.js +++ b/imports/client/views/org/admin/staff/add/StaffForm.js @@ -27,6 +27,10 @@ const StaffForm = props => ( label: 'Professional Info', active: props.currentStep === 2, }, + { + label: 'Contact Info', + active: props.currentStep === 3, + }, ]} /> {props.currentStep === 0 && ( @@ -138,50 +142,20 @@ const StaffForm = props => ( Additional Info - - - props.setValue('email', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.email && ( - {props.errors.email} - )} - - - - - + + props.setValue('phone', e.target.value)} + value={props.getValue('desgnation')} + placeholder="Professor" + onChange={e => props.setValue('desgnation', e.target.value)} /> - {props.isSubmitted() && props.errors && props.errors.phone && ( - {props.errors.phone} + {props.isSubmitted() && props.errors && props.errors.desgnation && ( + {props.errors.desgnation} )} - - - props.setValue('address', e.target.value)} - /> - {props.isSubmitted() && props.errors && props.errors.address && ( - {props.errors.address} - )} - - - - - ( )} + + @@ -315,6 +291,85 @@ const StaffForm = props => ( )} + {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 && (
@@ -325,7 +380,7 @@ const StaffForm = props => (
)} - {props.currentStep < 2 && ( + {props.currentStep < 3 && (
)} - {props.currentStep === 2 && ( + {props.currentStep === 3 && (
diff --git a/imports/client/views/org/admin/students/add/AddStudentFormContainer.js b/imports/client/views/org/admin/students/add/AddStudentFormContainer.js index 3209ba8..b89f64c 100644 --- a/imports/client/views/org/admin/students/add/AddStudentFormContainer.js +++ b/imports/client/views/org/admin/students/add/AddStudentFormContainer.js @@ -29,7 +29,15 @@ export class AddStudentFormContainer extends Component { handleSubmit() { if (this.state.currentStep === 3) { - addStudentManually.call(this.form.state.values); + addStudentManually.call(this.form.state.values, function(err, result){ + console.log("err"); + console.log(err); + console.log("result"); + console.log(result); + if(!err){ + this.props.modalState(); + } + }); } } diff --git a/imports/client/views/org/admin/students/add/addStudent.js b/imports/client/views/org/admin/students/add/addStudent.js index c08e592..033a163 100644 --- a/imports/client/views/org/admin/students/add/addStudent.js +++ b/imports/client/views/org/admin/students/add/addStudent.js @@ -49,7 +49,9 @@ export class AddStudent extends Component { Add Student - + {/* diff --git a/imports/client/views/org/admin/students/view/StudentTable.js b/imports/client/views/org/admin/students/view/StudentTable.js index fc56fa1..8f21ff2 100644 --- a/imports/client/views/org/admin/students/view/StudentTable.js +++ b/imports/client/views/org/admin/students/view/StudentTable.js @@ -33,10 +33,9 @@ const options = { function dateFormatter(cell, row) { if(cell){ - console.log(cell); + cell = new Date(cell); return `${('0' + cell.getDate()).slice(-2)}/${('0' + (cell.getMonth() + 1)).slice(-2)}/${cell.getFullYear()}`; } - } export class StudentTable extends Component { @@ -69,13 +68,12 @@ export class StudentTable extends Component {
- Admission Id - First Name - Last Name - Class - DOB + Admission Id + First Name + Last Name + Class + DOB - ); diff --git a/imports/collections/parents/index.js b/imports/collections/parents/index.js index f074a5f..97fe606 100644 --- a/imports/collections/parents/index.js +++ b/imports/collections/parents/index.js @@ -66,6 +66,7 @@ Parents.schema = new SimpleSchema({ relationship: { type: String, optional: true }, gender: { type: String, optional: true }, profession: { type: String, optional: true }, + relationship: { type: String, optional: true }, permanentAddress: { type: new SimpleSchema({ home: { type: String, optional: true }, diff --git a/imports/collections/staff/index.js b/imports/collections/staff/index.js index df96300..9c67187 100644 --- a/imports/collections/staff/index.js +++ b/imports/collections/staff/index.js @@ -85,9 +85,7 @@ Staffs.schema = new SimpleSchema({ permanentAddress: { type: new SimpleSchema({ - home: { type: String, optional: true }, - street: { type: String, optional: true }, - town: { type: String, optional: true }, + address: { type: String, optional: true }, city: { type: String, optional: true }, state: { type: String, optional: true }, zip: { type: String, optional: true }, @@ -123,7 +121,7 @@ Staffs.schema = new SimpleSchema({ from: { type: String, optional: true }, to: { type: String, optional: true } })], - optional: true + optional: true }, services: { diff --git a/imports/collections/staff/methods.js b/imports/collections/staff/methods.js index 6c56581..56bc2a3 100644 --- a/imports/collections/staff/methods.js +++ b/imports/collections/staff/methods.js @@ -31,9 +31,7 @@ export const staffAddNew = new ValidatedMethod({ martialStatus: { type: String }, gender: { type: String }, dob: { type: String }, - email: { type: String }, - phone: { type: String }, - address: { type: String }, + desgnation: { type: String }, type: { type: String }, doj: { type: String }, teaching: { type: String }, @@ -42,6 +40,11 @@ export const staffAddNew = new ValidatedMethod({ university: { type: String }, degreeFrom: { type: String }, degreeEnded: { type: String }, + email: { type: String }, + phone: { type: String }, + address: { type: String }, + city: { type: String }, + state: { type: String }, }).validator(), run(data) { @@ -64,20 +67,27 @@ export const staffAddNew = new ValidatedMethod({ console.log(newUserId); if(newUserId){ newStaffId = Staffs.insert({ - userId: newUserId, - orgId: orgId, - employeeId: data.employeeId, - martialStatus:data.martialStatus, - gender: data.gender, - dob: data.dob, - teaching: data.teaching, - type: data.type, - qualifaication: data.qualifaication, - specialization: data.specialization, - university: data.university, - degreeFrom: data.degreeFrom, - degreeEnded: data.degreeEnded, - doj: data.doj + userId: newUserId, + orgId: orgId, + employeeId: data.employeeId, + martialStatus: data.martialStatus, + gender: data.gender, + dob: data.dob, + teaching: data.teaching, + type: data.type, + 'educationDetails':[{ + qualifaication: data.qualifaication, + specialization: data.specialization, + university: data.university, + from: data.degreeFrom, + to: data.degreeEnded, + }], + permanentAddress:{ + address: data.data, + city: data.city, + state: data.state, + }, + doj: data.doj }); } console.log("newStaffId"); diff --git a/imports/collections/students/index.js b/imports/collections/students/index.js index 93e3ddb..75bb3c5 100644 --- a/imports/collections/students/index.js +++ b/imports/collections/students/index.js @@ -94,7 +94,7 @@ Students.schema = new SimpleSchema({ parent: { type: [new SimpleSchema({ id: { type: String, }, - relatinship: { type: String, }, + relationship: { type: String, }, })], optional: true }, diff --git a/imports/collections/students/methods.js b/imports/collections/students/methods.js index 82c9d85..e62835e 100644 --- a/imports/collections/students/methods.js +++ b/imports/collections/students/methods.js @@ -83,6 +83,7 @@ export const addStudentManually = new ValidatedMethod({ section: data.section, bloodGroup: data.bloodGroup, community: data.community, + relationship: data.relation, }); } if(newStudentId){ @@ -98,7 +99,7 @@ export const addStudentManually = new ValidatedMethod({ section: data.section, bloodGroup: data.bloodGroup, community: data.community, - parent: [{id: newParentUserId, relatinship: data.relation}] + parent: [{id: newParentUserId, relationship: data.relation}] }); } return {newStudentId};