Commit 5cd508fa112434d625eb1ae8046584138670e5a9
Exists in
master
Merge branch 'master' of https://bitbucket.org/youngdesk/ydapp
Showing
21 changed files
Show diff stats
client/stylesheets/custom.css
imports/client/views/core/DatePicker.js
... | ... | @@ -10,7 +10,7 @@ class DatePicker extends Component { |
10 | 10 | changeYear: true, |
11 | 11 | showButtonPanel: true, |
12 | 12 | yearRange: '-35:-1', |
13 | - dateFormat: 'dd/mm/yy', | |
13 | + dateFormat: 'mm/dd/yy', | |
14 | 14 | onSelect: function(dateText, inst) { |
15 | 15 | var date = $(this).val(); |
16 | 16 | // $("#datepickerDOB").val(date); | ... | ... |
imports/client/views/core/checkBoxFilter.js
... | ... | @@ -0,0 +1,44 @@ |
1 | +export class CheckboxFilter extends React.Component { | |
2 | + constructor(props) { | |
3 | + super(props); | |
4 | + this.filter = this.filter.bind(this); | |
5 | + this.isFiltered = this.isFiltered.bind(this); | |
6 | + } | |
7 | + | |
8 | + filter(event) { | |
9 | + if (this.refs.nokCheckbox.checked && this.refs.okCheckbox.checked) { | |
10 | + // all checkboxes are checked means we want to remove the filter for this column | |
11 | + this.props.filterHandler(); | |
12 | + } else { | |
13 | + this.props.filterHandler({ callback: this.isFiltered }); | |
14 | + } | |
15 | + } | |
16 | + | |
17 | + isFiltered(targetValue) { | |
18 | + if (targetValue === 'no') { | |
19 | + return (this.refs.nokCheckbox.checked); | |
20 | + } else { | |
21 | + return (this.refs.okCheckbox.checked); | |
22 | + } | |
23 | + } | |
24 | + | |
25 | + render() { | |
26 | + return ( | |
27 | + <div> | |
28 | + <input ref='okCheckbox' type='checkbox' className='filter' onChange={ this.filter } defaultChecked={ true } /><label>{ this.props.textOK }</label> | |
29 | + <input ref='nokCheckbox' type='checkbox' className='filter' onChange={ this.filter } defaultChecked={ true } style={ { marginLeft: 30 + 'px' } } /><label>{ this.props.textNOK }</label> | |
30 | + </div> | |
31 | + ); | |
32 | + } | |
33 | +} | |
34 | + | |
35 | +CheckboxFilter.propTypes = { | |
36 | + filterHandler: React.PropTypes.func.isRequired, | |
37 | + textOK: React.PropTypes.string, | |
38 | + textNOK: React.PropTypes.string | |
39 | +}; | |
40 | + | |
41 | +CheckboxFilter.defaultProps = { | |
42 | + textOK: 'OK', | |
43 | + textNOK: 'Not OK' | |
44 | +}; | ... | ... |
imports/client/views/org/admin/parents/index.js
... | ... | @@ -35,6 +35,8 @@ const meteorTick = (props, onData) => { |
35 | 35 | for(var j=0; j< parentData.length; j++){ |
36 | 36 | if(parent[i]._id == parentData[j].userId){ |
37 | 37 | parent[i].relationship = parentData[j].relationship; |
38 | + parent[i].profession = parentData[j].profession; | |
39 | + parent[i].relationship = parentData[j].relationship; | |
38 | 40 | } |
39 | 41 | } |
40 | 42 | } | ... | ... |
imports/client/views/org/admin/parents/parentsview.js
... | ... | @@ -24,6 +24,9 @@ export class ParentsView extends Component { |
24 | 24 | onUpdate(key, value) { |
25 | 25 | this.setState({[key]: value}); |
26 | 26 | }; |
27 | + togglePanel(){ | |
28 | + this.setState({panleOpen: !this.state.panleOpen}); | |
29 | + } | |
27 | 30 | |
28 | 31 | render() { |
29 | 32 | const {user, org, parent} = this.props.data; |
... | ... | @@ -40,7 +43,6 @@ export class ParentsView extends Component { |
40 | 43 | |
41 | 44 | <div className="content has-detached-left"> |
42 | 45 | <div className="container-detached"> |
43 | - <div className="content-detached"> | |
44 | 46 | <Header |
45 | 47 | user = {user} |
46 | 48 | org = {org} |
... | ... | @@ -51,50 +53,6 @@ export class ParentsView extends Component { |
51 | 53 | /> |
52 | 54 | {/* <AddStaff/> |
53 | 55 | <UploadCsvStaff /> */} |
54 | - </div> | |
55 | - </div> | |
56 | - <div className="sidebar-detached affix-top"> | |
57 | - <div className="sidebar sidebar-default"> | |
58 | - <div className="sidebar-content"> | |
59 | - | |
60 | - <div className="sidebar-category"> | |
61 | - <div className="category-title"> | |
62 | - <span>Advanced Search</span> | |
63 | - <ul className="icons-list"> | |
64 | - <li><a href="#" data-action="collapse"></a></li> | |
65 | - </ul> | |
66 | - </div> | |
67 | - | |
68 | - <div className="category-content"> | |
69 | - <form action="#"> | |
70 | - <div className="has-feedback has-feedback-left"> | |
71 | - <input type="search" className="form-control" | |
72 | - value={this.state.firstNameSearch} | |
73 | - onChange={e=>this.onUpdate('firstNameSearch',e.target.value)} | |
74 | - placeholder="First Name" | |
75 | - /> | |
76 | - <div className="form-control-feedback"> | |
77 | - <i className="icon-search4 text-size-base text-muted"></i> | |
78 | - </div> | |
79 | - </div> | |
80 | - </form> | |
81 | - </div> | |
82 | - <div className="category-content"> | |
83 | - <form action="#"> | |
84 | - <div className="has-feedback has-feedback-left"> | |
85 | - <input type="search" className="form-control" | |
86 | - value={this.state.lastNameSearch} | |
87 | - onChange={e=>this.onUpdate('lastNameSearch',e.target.value)} | |
88 | - placeholder="Last Name" /> | |
89 | - <div className="form-control-feedback"> | |
90 | - <i className="icon-search4 text-size-base text-muted"></i> | |
91 | - </div> | |
92 | - </div> | |
93 | - </form> | |
94 | - </div> | |
95 | - </div> | |
96 | - </div> | |
97 | - </div> | |
98 | 56 | </div> |
99 | 57 | </div> |
100 | 58 | </div> | ... | ... |
imports/client/views/org/admin/parents/view/ParentTable.js
... | ... | @@ -8,13 +8,35 @@ import { FormGroup,Panel,Table, |
8 | 8 | FormControl,Glyphicon,Button } from 'react-bootstrap'; |
9 | 9 | import {moment} from 'meteor/momentjs:moment' |
10 | 10 | import {ParentRow} from './ParentRow' |
11 | +import {BootstrapTable, TableHeaderColumn}from 'react-bootstrap-table'; | |
12 | +const options = { | |
13 | + page: 0, // which page you want to show as default | |
14 | + sizePerPageList: [ { | |
15 | + text: '5', value: 5 | |
16 | + }, { | |
17 | + text: '10', value: 10 | |
18 | + }], // you can change the dropdown list for size per page | |
19 | + sizePerPage: 5, // which size per page you want to locate as default | |
20 | + pageStartIndex: 0, // where to start counting the pages | |
21 | + paginationSize: 3, // the pagination bar size. | |
22 | + prePage: 'Prev', // Previous page button text | |
23 | + nextPage: 'Next', // Next page button text | |
24 | + firstPage: 'First', // First page button text | |
25 | + lastPage: 'Last', // Last page button text | |
26 | + paginationShowsTotal: false, // Accept bool or function | |
27 | + paginationPosition: 'bottom' // default is bottom, top and both is all available | |
28 | + // hideSizePerPage: true > You can hide the dropdown for sizePerPage | |
29 | + // alwaysShowAllBtns: true // Always show next and previous button | |
30 | + // withFirstAndLast: false > Hide the going to First and Last page button | |
31 | + }; | |
11 | 32 | |
12 | 33 | export class ParentTable extends Component { |
13 | 34 | |
14 | 35 | constructor(props) { |
15 | 36 | super(props); |
16 | 37 | this.state = { |
17 | - show: false | |
38 | + show: false, | |
39 | + panleOpen: true, | |
18 | 40 | }; |
19 | 41 | this.onUpdate = this.onUpdate.bind(this); |
20 | 42 | }; |
... | ... | @@ -29,34 +51,18 @@ export class ParentTable extends Component { |
29 | 51 | <h5 className="panel-title">Parent Details</h5> |
30 | 52 | <div className="heading-elements"> |
31 | 53 | <ul className="icons-list"> |
32 | - <li><a data-action="collapse"></a></li> | |
33 | - <li><a data-action="reload"></a></li> | |
54 | + <li onClick={this.togglePanel}><a data-action="collapse" className={this.state.panleOpen?"rotate-180":null}></a></li> | |
34 | 55 | </ul> |
35 | 56 | </div> |
36 | 57 | </div> |
37 | - <Table striped bordered condensed hover> | |
38 | - <thead> | |
39 | - <tr> | |
40 | - <th>First Name</th> | |
41 | - <th>Relationship</th> | |
42 | - <th>Status</th> | |
43 | - <th className="text-center">Actions</th> | |
44 | - </tr> | |
45 | - </thead> | |
46 | - <tbody> | |
47 | - { | |
48 | - this.props.parent.map(function(parent, i) | |
49 | - { | |
50 | - return( | |
51 | - <ParentRow | |
52 | - key = {i} | |
53 | - parent = {parent} | |
54 | - /> | |
55 | - ) | |
56 | - }) | |
57 | - } | |
58 | - </tbody> | |
59 | - </Table> | |
58 | + <Panel collapsible expanded={this.state.panleOpen}> | |
59 | + <BootstrapTable data={ this.props.parent } pagination={ true } options={ options } > | |
60 | + <TableHeaderColumn dataField='srno' isKey={ true } dataSort={ true } filter={ { type: 'TextFilter' } }>Sr No</TableHeaderColumn> | |
61 | + <TableHeaderColumn dataField='firstName' dataSort={ true } filter={ { type: 'TextFilter' } }>Name</TableHeaderColumn> | |
62 | + <TableHeaderColumn dataField='relationship' dataSort={ true } filter={ { type: 'TextFilter' } }>Relationship</TableHeaderColumn> | |
63 | + <TableHeaderColumn dataField='profession' dataSort={ true } filter={ { type: 'TextFilter' } }>Profession</TableHeaderColumn> | |
64 | + </BootstrapTable> | |
65 | + </Panel> | |
60 | 66 | </div> |
61 | 67 | ); |
62 | 68 | }; | ... | ... |
imports/client/views/org/admin/staff/StaffView.js
... | ... | @@ -37,65 +37,19 @@ export class StaffView extends Component { |
37 | 37 | /> |
38 | 38 | <div className="content-wrapper"> |
39 | 39 | <AdminBreadcrumb /> |
40 | - | |
41 | 40 | <div className="content has-detached-left"> |
42 | 41 | <div className="container-detached"> |
43 | - <div className="content-detached"> | |
44 | - <Header | |
45 | - user = {user} | |
46 | - org = {org} | |
47 | - /> | |
48 | - <StaffTable | |
49 | - data = {this.props.data} | |
50 | - staff = {staff} | |
51 | - /> | |
52 | - <AddStaff/> | |
53 | - <UploadCsvStaff /> | |
54 | - </div> | |
55 | - </div> | |
56 | - <div className="sidebar-detached affix-top"> | |
57 | - <div className="sidebar sidebar-default"> | |
58 | - <div className="sidebar-content"> | |
59 | - | |
60 | - <div className="sidebar-category"> | |
61 | - <div className="category-title"> | |
62 | - <span>Advanced Search</span> | |
63 | - <ul className="icons-list"> | |
64 | - <li><a href="#" data-action="collapse"></a></li> | |
65 | - </ul> | |
66 | - </div> | |
67 | - | |
68 | - <div className="category-content"> | |
69 | - <form action="#"> | |
70 | - <div className="has-feedback has-feedback-left"> | |
71 | - <input type="search" className="form-control" | |
72 | - value={this.state.firstNameSearch} | |
73 | - onChange={e=>this.onUpdate('firstNameSearch',e.target.value)} | |
74 | - placeholder="First Name" | |
75 | - /> | |
76 | - <div className="form-control-feedback"> | |
77 | - <i className="icon-search4 text-size-base text-muted"></i> | |
78 | - </div> | |
79 | - </div> | |
80 | - </form> | |
81 | - </div> | |
82 | - <div className="category-content"> | |
83 | - <form action="#"> | |
84 | - <div className="has-feedback has-feedback-left"> | |
85 | - <input type="search" className="form-control" | |
86 | - value={this.state.lastNameSearch} | |
87 | - onChange={e=>this.onUpdate('lastNameSearch',e.target.value)} | |
88 | - placeholder="Last Name" /> | |
89 | - <div className="form-control-feedback"> | |
90 | - <i className="icon-search4 text-size-base text-muted"></i> | |
91 | - </div> | |
92 | - </div> | |
93 | - </form> | |
94 | - </div> | |
95 | - </div> | |
96 | - </div> | |
97 | - </div> | |
98 | - </div> | |
42 | + <Header | |
43 | + user = {user} | |
44 | + org = {org} | |
45 | + /> | |
46 | + <StaffTable | |
47 | + data = {this.props.data} | |
48 | + staff = {staff} | |
49 | + /> | |
50 | + <AddStaff/> | |
51 | + <UploadCsvStaff /> | |
52 | + </div> | |
99 | 53 | </div> |
100 | 54 | </div> |
101 | 55 | </div> | ... | ... |
imports/client/views/org/admin/staff/add/AddStaffFormContainer.js
... | ... | @@ -3,7 +3,6 @@ import StaffForm from './StaffForm' |
3 | 3 | import Form from '/imports/client/views/core/Form' |
4 | 4 | import Validator from '/imports/client/views/core/Validator' |
5 | 5 | import { isRequired, isValidEmail } from '/imports/client/views/core/validations' |
6 | -import { addStudentManually } from '/imports/collections/students/methods'; | |
7 | 6 | |
8 | 7 | export class AddStaffFormContainer extends Component { |
9 | 8 | |
... | ... | @@ -29,11 +28,13 @@ export class AddStaffFormContainer extends Component { |
29 | 28 | } |
30 | 29 | |
31 | 30 | handleSubmit() { |
32 | - if (this.state.currentStep === 2) { | |
33 | - console.log(this.form.state.values); | |
31 | + if (this.state.currentStep === 3) { | |
34 | 32 | Meteor.call('staff.addNew', this.form.state.values, (error, result) => { |
35 | 33 | console.log(error); |
36 | 34 | console.log(result); |
35 | + if(!error){ | |
36 | + this.props.modalState(); | |
37 | + } | |
37 | 38 | }); |
38 | 39 | } |
39 | 40 | } |
... | ... | @@ -82,13 +83,10 @@ export class AddStaffFormContainer extends Component { |
82 | 83 | martialStatus: [(value) => isRequired('martialStatus', value)], |
83 | 84 | dob: [(value) => isRequired('Date of birth', value)], |
84 | 85 | |
85 | - email: [(value) => this.state.currentStep === 1 && isRequired('Email', value), (value) => this.state.currentStep === 1 && isValidEmail(value)], | |
86 | - phone: [(value) => this.state.currentStep === 1 && isRequired('Phone', value)], | |
87 | - address: [(value) => this.state.currentStep === 1 && isRequired('Address', value)], | |
88 | - | |
89 | 86 | teaching: [(value) => this.state.currentStep === 1 && isRequired('teaching', value)], |
90 | 87 | type: [(value) => this.state.currentStep === 1 && isRequired('type', value)], |
91 | 88 | doj: [(value) => this.state.currentStep === 1 && isRequired('doj', value)], |
89 | + desgnation: [(value) => this.state.currentStep === 1 && isRequired('desgnation', value)], | |
92 | 90 | |
93 | 91 | qualifaication: [(value) => this.state.currentStep === 2 && isRequired('qualifaication', value)], |
94 | 92 | specialization: [(value) => this.state.currentStep === 2 && isRequired('specialization', value)], |
... | ... | @@ -97,6 +95,12 @@ export class AddStaffFormContainer extends Component { |
97 | 95 | degreeFrom: [(value) => this.state.currentStep === 2 && isRequired('degreeFrom', value)], |
98 | 96 | degreeEnded: [(value) => this.state.currentStep === 2 && isRequired('degreeEnded', value)], |
99 | 97 | |
98 | + email: [(value) => this.state.currentStep === 3 && isRequired('Email', value), (value) => this.state.currentStep === 1 && isValidEmail(value)], | |
99 | + phone: [(value) => this.state.currentStep === 3 && isRequired('Phone', value)], | |
100 | + address: [(value) => this.state.currentStep === 3 && isRequired('Address', value)], | |
101 | + city: [(value) => this.state.currentStep === 3 && isRequired('City', value)], | |
102 | + state: [(value) => this.state.currentStep === 3 && isRequired('State', value)], | |
103 | + | |
100 | 104 | }} |
101 | 105 | > |
102 | 106 | {({ errors }) => ( | ... | ... |
imports/client/views/org/admin/staff/add/StaffForm.js
... | ... | @@ -27,6 +27,10 @@ const StaffForm = props => ( |
27 | 27 | label: 'Professional Info', |
28 | 28 | active: props.currentStep === 2, |
29 | 29 | }, |
30 | + { | |
31 | + label: 'Contact Info', | |
32 | + active: props.currentStep === 3, | |
33 | + }, | |
30 | 34 | ]} |
31 | 35 | /> |
32 | 36 | {props.currentStep === 0 && ( |
... | ... | @@ -138,50 +142,20 @@ const StaffForm = props => ( |
138 | 142 | <legend className="text-semibold">Additional Info</legend> |
139 | 143 | <Row> |
140 | 144 | <Col xs={12} sm={4}> |
141 | - <FormGroup controlId="email"> | |
142 | - <Label required>Email</Label> | |
143 | - <FormControl | |
144 | - type="email" | |
145 | - value={props.getValue('email')} | |
146 | - placeholder="Email" | |
147 | - onChange={e => props.setValue('email', e.target.value)} | |
148 | - /> | |
149 | - {props.isSubmitted() && props.errors && props.errors.email && ( | |
150 | - <ErrorLabel> {props.errors.email} </ErrorLabel> | |
151 | - )} | |
152 | - </FormGroup> | |
153 | - </Col> | |
154 | - <Col xs={12} sm={4}> | |
155 | - <FormGroup controlId="phone"> | |
156 | - <Label required>Phone</Label> | |
145 | + <FormGroup controlId="desgnation"> | |
146 | + <Label required>Desgnation</Label> | |
157 | 147 | <FormControl |
158 | 148 | type="text" |
159 | - value={props.getValue('phone')} | |
160 | - placeholder="Martial Status" | |
161 | - onChange={e => props.setValue('phone', e.target.value)} | |
149 | + value={props.getValue('desgnation')} | |
150 | + placeholder="Professor" | |
151 | + onChange={e => props.setValue('desgnation', e.target.value)} | |
162 | 152 | /> |
163 | - {props.isSubmitted() && props.errors && props.errors.phone && ( | |
164 | - <ErrorLabel> {props.errors.phone} </ErrorLabel> | |
153 | + {props.isSubmitted() && props.errors && props.errors.desgnation && ( | |
154 | + <ErrorLabel> {props.errors.desgnation} </ErrorLabel> | |
165 | 155 | )} |
166 | 156 | </FormGroup> |
167 | 157 | </Col> |
168 | 158 | <Col xs={12} sm={4}> |
169 | - <FormGroup controlId="address"> | |
170 | - <Label required>Address</Label> | |
171 | - <FormControl | |
172 | - type="text" | |
173 | - value={props.getValue('address')} | |
174 | - placeholder="#876, Street, town" | |
175 | - onChange={e => props.setValue('address', e.target.value)} | |
176 | - /> | |
177 | - {props.isSubmitted() && props.errors && props.errors.address && ( | |
178 | - <ErrorLabel> {props.errors.address} </ErrorLabel> | |
179 | - )} | |
180 | - </FormGroup> | |
181 | - </Col> | |
182 | - </Row> | |
183 | - <Row> | |
184 | - <Col xs={12} sm={4}> | |
185 | 159 | <FormGroup controlId="formControlsSelect"> |
186 | 160 | <Label>Teaching Staff?</Label> |
187 | 161 | <FormControl componentClass="select" |
... | ... | @@ -213,6 +187,8 @@ const StaffForm = props => ( |
213 | 187 | )} |
214 | 188 | </FormGroup> |
215 | 189 | </Col> |
190 | + </Row> | |
191 | + <Row> | |
216 | 192 | <Col xs={12} sm={4}> |
217 | 193 | <FormGroup> |
218 | 194 | <Label required>Date of Joining</Label> |
... | ... | @@ -315,6 +291,85 @@ const StaffForm = props => ( |
315 | 291 | </Row> |
316 | 292 | </fieldset> |
317 | 293 | )} |
294 | + {props.currentStep === 3 && ( | |
295 | + <fieldset title="Academic"> | |
296 | + <legend className="text-semibold">Additional Info</legend> | |
297 | + <Row> | |
298 | + <Col xs={12} sm={4}> | |
299 | + <FormGroup controlId="email"> | |
300 | + <Label required>Email</Label> | |
301 | + <FormControl | |
302 | + type="email" | |
303 | + value={props.getValue('email')} | |
304 | + placeholder="Email" | |
305 | + onChange={e => props.setValue('email', e.target.value)} | |
306 | + /> | |
307 | + {props.isSubmitted() && props.errors && props.errors.email && ( | |
308 | + <ErrorLabel> {props.errors.email} </ErrorLabel> | |
309 | + )} | |
310 | + </FormGroup> | |
311 | + </Col> | |
312 | + <Col xs={12} sm={4}> | |
313 | + <FormGroup controlId="phone"> | |
314 | + <Label required>Phone</Label> | |
315 | + <FormControl | |
316 | + type="text" | |
317 | + value={props.getValue('phone')} | |
318 | + placeholder="Martial Status" | |
319 | + onChange={e => props.setValue('phone', e.target.value)} | |
320 | + /> | |
321 | + {props.isSubmitted() && props.errors && props.errors.phone && ( | |
322 | + <ErrorLabel> {props.errors.phone} </ErrorLabel> | |
323 | + )} | |
324 | + </FormGroup> | |
325 | + </Col> | |
326 | + </Row> | |
327 | + <Row> | |
328 | + <Col xs={12} sm={4}> | |
329 | + <FormGroup controlId="address"> | |
330 | + <Label required>Address</Label> | |
331 | + <FormControl | |
332 | + type="text" | |
333 | + value={props.getValue('address')} | |
334 | + placeholder="#876, Street, town" | |
335 | + onChange={e => props.setValue('address', e.target.value)} | |
336 | + /> | |
337 | + {props.isSubmitted() && props.errors && props.errors.address && ( | |
338 | + <ErrorLabel> {props.errors.address} </ErrorLabel> | |
339 | + )} | |
340 | + </FormGroup> | |
341 | + </Col> | |
342 | + <Col xs={12} sm={4}> | |
343 | + <FormGroup controlId="city"> | |
344 | + <Label required>City</Label> | |
345 | + <FormControl | |
346 | + type="text" | |
347 | + value={props.getValue('city')} | |
348 | + placeholder="Chennai" | |
349 | + onChange={e => props.setValue('city', e.target.value)} | |
350 | + /> | |
351 | + {props.isSubmitted() && props.errors && props.errors.city && ( | |
352 | + <ErrorLabel> {props.errors.city} </ErrorLabel> | |
353 | + )} | |
354 | + </FormGroup> | |
355 | + </Col> | |
356 | + <Col xs={12} sm={4}> | |
357 | + <FormGroup controlId="state"> | |
358 | + <Label required>State</Label> | |
359 | + <FormControl | |
360 | + type="text" | |
361 | + value={props.getValue('state')} | |
362 | + placeholder="Tamilnadu" | |
363 | + onChange={e => props.setValue('state', e.target.value)} | |
364 | + /> | |
365 | + {props.isSubmitted() && props.errors && props.errors.state && ( | |
366 | + <ErrorLabel> {props.errors.state} </ErrorLabel> | |
367 | + )} | |
368 | + </FormGroup> | |
369 | + </Col> | |
370 | + </Row> | |
371 | + </fieldset> | |
372 | + )} | |
318 | 373 | <div style={{ textAlign: 'left' }}> |
319 | 374 | {props.currentStep > 0 && ( |
320 | 375 | <div style={{ display: 'inline-block', marginRight: 10 }}> |
... | ... | @@ -325,7 +380,7 @@ const StaffForm = props => ( |
325 | 380 | |
326 | 381 | </div> |
327 | 382 | )} |
328 | - {props.currentStep < 2 && ( | |
383 | + {props.currentStep < 3 && ( | |
329 | 384 | <div style={{ display: 'inline-block' }}> |
330 | 385 | <Button |
331 | 386 | bsStyle="primary" |
... | ... | @@ -336,7 +391,7 @@ const StaffForm = props => ( |
336 | 391 | </Button> |
337 | 392 | </div> |
338 | 393 | )} |
339 | - {props.currentStep === 2 && ( | |
394 | + {props.currentStep === 3 && ( | |
340 | 395 | <div style={{ display: 'inline-block' }}> |
341 | 396 | <Button |
342 | 397 | bsStyle="primary" | ... | ... |
imports/client/views/org/admin/staff/add/addStaff.js
... | ... | @@ -49,7 +49,9 @@ export class AddStaff extends Component { |
49 | 49 | <Modal.Title id="contained-modal-title-lg">Add New Staff</Modal.Title> |
50 | 50 | </Modal.Header> |
51 | 51 | <Modal.Body> |
52 | - <AddStaffFormContainer /> | |
52 | + <AddStaffFormContainer | |
53 | + modalState = {this.hideModal} | |
54 | + /> | |
53 | 55 | </Modal.Body> |
54 | 56 | {/* |
55 | 57 | <Modal.Footer> | ... | ... |
imports/client/views/org/admin/staff/index.js
... | ... | @@ -33,6 +33,7 @@ const meteorTick = (props, onData) => { |
33 | 33 | for(var j=0; j< staffData.length; j++){ |
34 | 34 | if(staff[i]._id == staffData[j].userId){ |
35 | 35 | staff[i].type = staffData[j].type; |
36 | + staff[i].employeeId = staffData[j].employeeId; | |
36 | 37 | staff[i].dob = staffData[j].dob; |
37 | 38 | } |
38 | 39 | } | ... | ... |
imports/client/views/org/admin/staff/view/StaffTable.js
... | ... | @@ -8,57 +8,76 @@ import { FormGroup,Panel,Table, |
8 | 8 | FormControl,Glyphicon,Button } from 'react-bootstrap'; |
9 | 9 | import {moment} from 'meteor/momentjs:moment' |
10 | 10 | import {StaffRow} from './StaffRow' |
11 | +import {BootstrapTable, TableHeaderColumn}from 'react-bootstrap-table'; | |
12 | +const options = { | |
13 | + page: 0, // which page you want to show as default | |
14 | + sizePerPageList: [ { | |
15 | + text: '5', value: 5 | |
16 | + }, { | |
17 | + text: '10', value: 10 | |
18 | + }], // you can change the dropdown list for size per page | |
19 | + sizePerPage: 5, // which size per page you want to locate as default | |
20 | + pageStartIndex: 0, // where to start counting the pages | |
21 | + paginationSize: 3, // the pagination bar size. | |
22 | + prePage: 'Prev', // Previous page button text | |
23 | + nextPage: 'Next', // Next page button text | |
24 | + firstPage: 'First', // First page button text | |
25 | + lastPage: 'Last', // Last page button text | |
26 | + paginationShowsTotal: false, // Accept bool or function | |
27 | + paginationPosition: 'bottom' // default is bottom, top and both is all available | |
28 | + // hideSizePerPage: true > You can hide the dropdown for sizePerPage | |
29 | + // alwaysShowAllBtns: true // Always show next and previous button | |
30 | + // withFirstAndLast: false > Hide the going to First and Last page button | |
31 | + }; | |
32 | + | |
33 | +function dateFormatter(cell, row) { | |
34 | + console.log("cell"); | |
35 | + console.log(cell); | |
36 | + if(cell){ | |
37 | + cell = new Date(cell); | |
38 | + console.log(cell); | |
39 | + return `${('0' + cell.getDate()).slice(-2)}/${('0' + (cell.getMonth() + 1)).slice(-2)}/${cell.getFullYear()}`; | |
40 | + } | |
41 | +} | |
11 | 42 | |
12 | 43 | export class StaffTable extends Component { |
13 | 44 | |
14 | 45 | constructor(props) { |
15 | 46 | super(props); |
16 | 47 | this.state = { |
17 | - show: false | |
48 | + show: false, | |
49 | + panleOpen: true, | |
18 | 50 | }; |
19 | 51 | this.onUpdate = this.onUpdate.bind(this); |
20 | 52 | }; |
21 | 53 | onUpdate(key, value) { |
22 | 54 | this.setState({[key]: value}); |
23 | 55 | }; |
24 | - | |
56 | + togglePanel(){ | |
57 | + this.setState({panleOpen: !this.state.panleOpen}); | |
58 | + } | |
25 | 59 | render() { |
60 | + console.log("this.props.staff"); | |
61 | + console.log(this.props.staff); | |
26 | 62 | return ( |
27 | 63 | <div className="panel panel-flat"> |
28 | 64 | <div className="panel-heading"> |
29 | 65 | <h5 className="panel-title">Teachers Details</h5> |
30 | 66 | <div className="heading-elements"> |
31 | 67 | <ul className="icons-list"> |
32 | - <li><a data-action="collapse"></a></li> | |
33 | - <li><a data-action="reload"></a></li> | |
68 | + <li onClick={this.togglePanel}><a data-action="collapse" className={this.state.panleOpen?"rotate-180":null}></a></li> | |
34 | 69 | </ul> |
35 | 70 | </div> |
36 | 71 | </div> |
37 | - <Table striped bordered condensed hover> | |
38 | - <thead> | |
39 | - <tr> | |
40 | - <th>First Name</th> | |
41 | - <th>Last Name</th> | |
42 | - <th>Type</th> | |
43 | - <th>DOB</th> | |
44 | - <th>Status</th> | |
45 | - <th className="text-center">Actions</th> | |
46 | - </tr> | |
47 | - </thead> | |
48 | - <tbody> | |
49 | - { | |
50 | - this.props.staff.map(function(staff, i) | |
51 | - { | |
52 | - return( | |
53 | - <StaffRow | |
54 | - key = {i} | |
55 | - staff = {staff} | |
56 | - /> | |
57 | - ) | |
58 | - }) | |
59 | - } | |
60 | - </tbody> | |
61 | - </Table> | |
72 | + <Panel collapsible expanded={this.state.panleOpen}> | |
73 | + <BootstrapTable data={ this.props.staff } pagination={ true } options={ options } > | |
74 | + <TableHeaderColumn dataField='employeeId' isKey={ true } dataSort={ true } filter={ { type: 'TextFilter' } }>Employee Id</TableHeaderColumn> | |
75 | + <TableHeaderColumn dataField='firstName' dataSort={ true } filter={ { type: 'TextFilter' } }>First Name</TableHeaderColumn> | |
76 | + <TableHeaderColumn dataField='lastName' dataSort={ true } filter={ { type: 'TextFilter' } }>Last Name</TableHeaderColumn> | |
77 | + <TableHeaderColumn dataField='type' dataSort={ true } filter={ { type: 'TextFilter' } }>Type</TableHeaderColumn> | |
78 | + <TableHeaderColumn dataField='dob' dataFormat={ dateFormatter } >DOB</TableHeaderColumn> | |
79 | + </BootstrapTable> | |
80 | + </Panel> | |
62 | 81 | </div> |
63 | 82 | ); |
64 | 83 | }; | ... | ... |
imports/client/views/org/admin/students/StudentView.js
... | ... | @@ -65,7 +65,7 @@ export class StudentView extends Component { |
65 | 65 | |
66 | 66 | <div className="content has-detached-left"> |
67 | 67 | <div className="container-detached"> |
68 | - <div className="content-detached"> | |
68 | + <div className=""> | |
69 | 69 | <Header/> |
70 | 70 | <StudentTable |
71 | 71 | data = {this.props.data} |
... | ... | @@ -75,49 +75,6 @@ export class StudentView extends Component { |
75 | 75 | <UploadCsv /> |
76 | 76 | </div> |
77 | 77 | </div> |
78 | - <div className="sidebar-detached affix-top"> | |
79 | - <div className="sidebar sidebar-default"> | |
80 | - <div className="sidebar-content"> | |
81 | - | |
82 | - <div className="sidebar-category"> | |
83 | - <div className="category-title"> | |
84 | - <span>Advanced Search</span> | |
85 | - <ul className="icons-list"> | |
86 | - <li><a href="#" data-action="collapse"></a></li> | |
87 | - </ul> | |
88 | - </div> | |
89 | - | |
90 | - <div className="category-content"> | |
91 | - <form action="#"> | |
92 | - <div className="has-feedback has-feedback-left"> | |
93 | - <input type="search" className="form-control" | |
94 | - value={this.state.firstNameSearch} | |
95 | - onChange={e=>this.onUpdate('firstNameSearch',e.target.value)} | |
96 | - placeholder="First Name" | |
97 | - /> | |
98 | - <div className="form-control-feedback"> | |
99 | - <i className="icon-search4 text-size-base text-muted"></i> | |
100 | - </div> | |
101 | - </div> | |
102 | - </form> | |
103 | - </div> | |
104 | - <div className="category-content"> | |
105 | - <form action="#"> | |
106 | - <div className="has-feedback has-feedback-left"> | |
107 | - <input type="search" className="form-control" | |
108 | - value={this.state.lastNameSearch} | |
109 | - onChange={e=>this.onUpdate('lastNameSearch',e.target.value)} | |
110 | - placeholder="Last Name" /> | |
111 | - <div className="form-control-feedback"> | |
112 | - <i className="icon-search4 text-size-base text-muted"></i> | |
113 | - </div> | |
114 | - </div> | |
115 | - </form> | |
116 | - </div> | |
117 | - </div> | |
118 | - </div> | |
119 | - </div> | |
120 | - </div> | |
121 | 78 | </div> |
122 | 79 | </div> |
123 | 80 | </div> | ... | ... |
imports/client/views/org/admin/students/add/AddStudentFormContainer.js
... | ... | @@ -29,7 +29,15 @@ export class AddStudentFormContainer extends Component { |
29 | 29 | |
30 | 30 | handleSubmit() { |
31 | 31 | if (this.state.currentStep === 3) { |
32 | - addStudentManually.call(this.form.state.values); | |
32 | + addStudentManually.call(this.form.state.values, function(err, result){ | |
33 | + console.log("err"); | |
34 | + console.log(err); | |
35 | + console.log("result"); | |
36 | + console.log(result); | |
37 | + if(!err){ | |
38 | + this.props.modalState(); | |
39 | + } | |
40 | + }); | |
33 | 41 | } |
34 | 42 | } |
35 | 43 | ... | ... |
imports/client/views/org/admin/students/add/addStudent.js
... | ... | @@ -49,7 +49,9 @@ export class AddStudent extends Component { |
49 | 49 | <Modal.Title id="contained-modal-title-lg">Add Student</Modal.Title> |
50 | 50 | </Modal.Header> |
51 | 51 | <Modal.Body> |
52 | - <AddStudentFormContainer /> | |
52 | + <AddStudentFormContainer | |
53 | + modalState = {this.hideModal} | |
54 | + /> | |
53 | 55 | </Modal.Body> |
54 | 56 | {/* |
55 | 57 | <Modal.Footer> | ... | ... |
imports/client/views/org/admin/students/view/StudentTable.js
... | ... | @@ -33,10 +33,9 @@ const options = { |
33 | 33 | |
34 | 34 | function dateFormatter(cell, row) { |
35 | 35 | if(cell){ |
36 | - console.log(cell); | |
36 | + cell = new Date(cell); | |
37 | 37 | return `${('0' + cell.getDate()).slice(-2)}/${('0' + (cell.getMonth() + 1)).slice(-2)}/${cell.getFullYear()}`; |
38 | 38 | } |
39 | - | |
40 | 39 | } |
41 | 40 | export class StudentTable extends Component { |
42 | 41 | |
... | ... | @@ -69,13 +68,12 @@ export class StudentTable extends Component { |
69 | 68 | </div> |
70 | 69 | <Panel collapsible expanded={this.state.panleOpen}> |
71 | 70 | <BootstrapTable data={ this.props.students } pagination={ true } options={ options } > |
72 | - <TableHeaderColumn dataField='admissionId' isKey={ true } dataSort={ true }>Admission Id</TableHeaderColumn> | |
73 | - <TableHeaderColumn dataField='firstName' dataSort={ true }>First Name</TableHeaderColumn> | |
74 | - <TableHeaderColumn dataField='lastName' dataSort={ true }>Last Name</TableHeaderColumn> | |
75 | - <TableHeaderColumn dataField='class' dataSort={ true }>Class</TableHeaderColumn> | |
76 | - <TableHeaderColumn dataField='dob' filter={ { type: 'DateFilter' } }>DOB</TableHeaderColumn> | |
71 | + <TableHeaderColumn dataField='admissionId' isKey={ true } dataSort={ true } filter={ { type: 'TextFilter' } }>Admission Id</TableHeaderColumn> | |
72 | + <TableHeaderColumn dataField='firstName' dataSort={ true } filter={ { type: 'TextFilter' } }>First Name</TableHeaderColumn> | |
73 | + <TableHeaderColumn dataField='lastName' dataSort={ true } filter={ { type: 'TextFilter' } }>Last Name</TableHeaderColumn> | |
74 | + <TableHeaderColumn dataField='class' dataSort={ true } filter={ { type: 'TextFilter' } }>Class</TableHeaderColumn> | |
75 | + <TableHeaderColumn dataField='dob' dataFormat={ dateFormatter } >DOB</TableHeaderColumn> | |
77 | 76 | </BootstrapTable> |
78 | - | |
79 | 77 | </Panel> |
80 | 78 | </div> |
81 | 79 | ); | ... | ... |
imports/collections/parents/index.js
... | ... | @@ -66,6 +66,7 @@ Parents.schema = new SimpleSchema({ |
66 | 66 | relationship: { type: String, optional: true }, |
67 | 67 | gender: { type: String, optional: true }, |
68 | 68 | profession: { type: String, optional: true }, |
69 | + relationship: { type: String, optional: true }, | |
69 | 70 | permanentAddress: { |
70 | 71 | type: new SimpleSchema({ |
71 | 72 | home: { type: String, optional: true }, | ... | ... |
imports/collections/staff/index.js
... | ... | @@ -85,9 +85,7 @@ Staffs.schema = new SimpleSchema({ |
85 | 85 | |
86 | 86 | permanentAddress: { |
87 | 87 | type: new SimpleSchema({ |
88 | - home: { type: String, optional: true }, | |
89 | - street: { type: String, optional: true }, | |
90 | - town: { type: String, optional: true }, | |
88 | + address: { type: String, optional: true }, | |
91 | 89 | city: { type: String, optional: true }, |
92 | 90 | state: { type: String, optional: true }, |
93 | 91 | zip: { type: String, optional: true }, |
... | ... | @@ -123,7 +121,7 @@ Staffs.schema = new SimpleSchema({ |
123 | 121 | from: { type: String, optional: true }, |
124 | 122 | to: { type: String, optional: true } |
125 | 123 | })], |
126 | - optional: true | |
124 | + optional: true | |
127 | 125 | }, |
128 | 126 | |
129 | 127 | services: { | ... | ... |
imports/collections/staff/methods.js
... | ... | @@ -31,9 +31,7 @@ export const staffAddNew = new ValidatedMethod({ |
31 | 31 | martialStatus: { type: String }, |
32 | 32 | gender: { type: String }, |
33 | 33 | dob: { type: String }, |
34 | - email: { type: String }, | |
35 | - phone: { type: String }, | |
36 | - address: { type: String }, | |
34 | + desgnation: { type: String }, | |
37 | 35 | type: { type: String }, |
38 | 36 | doj: { type: String }, |
39 | 37 | teaching: { type: String }, |
... | ... | @@ -42,6 +40,11 @@ export const staffAddNew = new ValidatedMethod({ |
42 | 40 | university: { type: String }, |
43 | 41 | degreeFrom: { type: String }, |
44 | 42 | degreeEnded: { type: String }, |
43 | + email: { type: String }, | |
44 | + phone: { type: String }, | |
45 | + address: { type: String }, | |
46 | + city: { type: String }, | |
47 | + state: { type: String }, | |
45 | 48 | }).validator(), |
46 | 49 | |
47 | 50 | run(data) { |
... | ... | @@ -64,20 +67,27 @@ export const staffAddNew = new ValidatedMethod({ |
64 | 67 | console.log(newUserId); |
65 | 68 | if(newUserId){ |
66 | 69 | newStaffId = Staffs.insert({ |
67 | - userId: newUserId, | |
68 | - orgId: orgId, | |
69 | - employeeId: data.employeeId, | |
70 | - martialStatus:data.martialStatus, | |
71 | - gender: data.gender, | |
72 | - dob: data.dob, | |
73 | - teaching: data.teaching, | |
74 | - type: data.type, | |
75 | - qualifaication: data.qualifaication, | |
76 | - specialization: data.specialization, | |
77 | - university: data.university, | |
78 | - degreeFrom: data.degreeFrom, | |
79 | - degreeEnded: data.degreeEnded, | |
80 | - doj: data.doj | |
70 | + userId: newUserId, | |
71 | + orgId: orgId, | |
72 | + employeeId: data.employeeId, | |
73 | + martialStatus: data.martialStatus, | |
74 | + gender: data.gender, | |
75 | + dob: data.dob, | |
76 | + teaching: data.teaching, | |
77 | + type: data.type, | |
78 | + 'educationDetails':[{ | |
79 | + qualifaication: data.qualifaication, | |
80 | + specialization: data.specialization, | |
81 | + university: data.university, | |
82 | + from: data.degreeFrom, | |
83 | + to: data.degreeEnded, | |
84 | + }], | |
85 | + permanentAddress:{ | |
86 | + address: data.data, | |
87 | + city: data.city, | |
88 | + state: data.state, | |
89 | + }, | |
90 | + doj: data.doj | |
81 | 91 | }); |
82 | 92 | } |
83 | 93 | console.log("newStaffId"); | ... | ... |
imports/collections/students/index.js
imports/collections/students/methods.js
... | ... | @@ -83,6 +83,7 @@ export const addStudentManually = new ValidatedMethod({ |
83 | 83 | section: data.section, |
84 | 84 | bloodGroup: data.bloodGroup, |
85 | 85 | community: data.community, |
86 | + relationship: data.relation, | |
86 | 87 | }); |
87 | 88 | } |
88 | 89 | if(newStudentId){ |
... | ... | @@ -98,7 +99,7 @@ export const addStudentManually = new ValidatedMethod({ |
98 | 99 | section: data.section, |
99 | 100 | bloodGroup: data.bloodGroup, |
100 | 101 | community: data.community, |
101 | - parent: [{id: newParentUserId, relatinship: data.relation}] | |
102 | + parent: [{id: newParentUserId, relationship: data.relation}] | |
102 | 103 | }); |
103 | 104 | } |
104 | 105 | return {newStudentId}; | ... | ... |