Commit 6adcdac35e0ac355b1687b492a47668a6fff1380
1 parent
ddc029ad3a
Exists in
master
second commit
Showing
5 changed files
with
236 additions
and
1 deletions
Show diff stats
imports/client/app/routes.js
... | ... | @@ -45,6 +45,7 @@ import { AdminComposeMailController } from '/imports/client/views/org/admi |
45 | 45 | import { AdminSentMailController } from '/imports/client/views/org/admin/mailbox/sent/index' |
46 | 46 | import { AdminImportantMailController } from '/imports/client/views/org/admin/mailbox/important/index' |
47 | 47 | |
48 | +import { FeeInfoController } from '/imports/client/views/org/admin/finance/feestrucure/index' | |
48 | 49 | |
49 | 50 | //students |
50 | 51 | |
... | ... | @@ -85,6 +86,10 @@ const getOrgAdminRoutes = () => ( |
85 | 86 | <Route name="mail-sent" path = "/mail/sent" component = {AdminSentMailController} /> |
86 | 87 | <Route name="mail-important" path = "/mail/important" component = {AdminImportantMailController} /> |
87 | 88 | </Route> |
89 | + <Route> | |
90 | + <IndexRoute component = {AdminUsersListController} /> | |
91 | + <Route name="feestructure" path = "/fee/feestructure" component = {FeeInfoController} /> | |
92 | + </Route> | |
88 | 93 | <Route path="*" component = { NotFound } /> |
89 | 94 | </Route> |
90 | 95 | </Router> | ... | ... |
imports/client/views/org/admin/app/module/Sidebar.js
... | ... | @@ -70,6 +70,12 @@ export class AdminSidebar extends Component { |
70 | 70 | <MenuItem eventKey={4.2}>Class Info</MenuItem> |
71 | 71 | </LinkContainer> |
72 | 72 | </NavDropdown> |
73 | + <NavDropdown eventKey={5} title="Finance" name="Finance" id="finance"> | |
74 | + <LinkContainer to="/fee/feestructure" exact="true"> | |
75 | + <MenuItem eventKey={4.1}>Fee Structure</MenuItem> | |
76 | + </LinkContainer> | |
77 | + | |
78 | + </NavDropdown> | |
73 | 79 | {/** <NavDropdown eventKey={3} title="Academic" name="Academic" id="academic"> |
74 | 80 | <MenuItem eventKey={3.1}>Layout 1</MenuItem> |
75 | 81 | <MenuItem eventKey={3.2}>Layout 2</MenuItem> | ... | ... |
imports/client/views/org/admin/finance/feestrucure/FeeStructureView.js
... | ... | @@ -0,0 +1,172 @@ |
1 | +const ReactDataGrid = require('react-data-grid'); | |
2 | +import {BootstrapTable, TableHeaderColumn} from 'react-bootstrap-table'; | |
3 | +import _ from 'lodash'; | |
4 | +import { Meteor } from 'meteor/meteor'; | |
5 | + | |
6 | +import React, { Component } from 'react'; | |
7 | +const { Editors, Toolbar, Formatters } = require('react-data-grid-addons'); | |
8 | +import { Modal, Button } from 'react-bootstrap'; | |
9 | +const { AutoComplete: AutoCompleteEditor, DropDownEditor } = Editors; | |
10 | +const { ImageFormatter } = Formatters; | |
11 | +const faker = require('faker'); | |
12 | +import update from 'react-addons-update'; | |
13 | +faker.locale = 'en_GB'; | |
14 | + | |
15 | +const titles = ['Ajay', 'Deepak', 'Raghu', 'Satheesh', 'Bharath']; | |
16 | + | |
17 | +export const Example = React.createClass({ | |
18 | + | |
19 | + showModal() { | |
20 | + this.setState({show: true}); | |
21 | + }, | |
22 | + | |
23 | + hideModal() { | |
24 | + this.setState({show: false}); | |
25 | + }, | |
26 | + onUpdate(key, value) { | |
27 | + this.setState({[key]: value}); | |
28 | + }, | |
29 | + | |
30 | + | |
31 | + getInitialState() { | |
32 | + // super(props); | |
33 | + this._columns = [ | |
34 | + { | |
35 | + key: 'id', | |
36 | + name: 'S.No.', | |
37 | + width: 80, | |
38 | + resizable: true | |
39 | + }, | |
40 | + { | |
41 | + key: 'roles', | |
42 | + name: 'Roles', | |
43 | + editable: true, | |
44 | + width: 325, | |
45 | + resizable: true | |
46 | + }, | |
47 | + { | |
48 | + key: 'roledesc', | |
49 | + name: 'Role Description', | |
50 | + editable: true, | |
51 | + width: 380, | |
52 | + resizable: true | |
53 | + }, | |
54 | + { | |
55 | + key: 'stafflist', | |
56 | + name: 'Staffs', | |
57 | + editor: <DropDownEditor options={titles}/>, | |
58 | + width: 335, | |
59 | + resizable: true, | |
60 | + events: { | |
61 | + onDoubleClick: function() { | |
62 | + console.log('The user double clicked on title column'); | |
63 | + } | |
64 | + } | |
65 | + } | |
66 | + ]; | |
67 | + return { rows: this.createRows(5), show: false }; | |
68 | + }, | |
69 | + | |
70 | + | |
71 | + createRows(numberOfRows) { | |
72 | + let rows = []; | |
73 | + for (let i = 0; i < numberOfRows; i++) { | |
74 | + rows[i] = this.createFakeRowObjectData(i); | |
75 | + } | |
76 | + return rows; | |
77 | + }, | |
78 | + | |
79 | + createFakeRowObjectData(index) { | |
80 | + return { | |
81 | + id: index+1, | |
82 | + roles: faker.name.firstName(), | |
83 | + stafflist: faker.name.prefix(), | |
84 | + roledesc: faker.lorem.sentence() | |
85 | + }; | |
86 | + }, | |
87 | + | |
88 | + getColumns() { | |
89 | + let clonedColumns = this._columns.slice(); | |
90 | + clonedColumns[1].events = { | |
91 | + onClick: (ev, args) => { | |
92 | + const idx = args.idx; | |
93 | + const rowIdx = args.rowIdx; | |
94 | + this.grid.openCellEditor(rowIdx, idx); | |
95 | + } | |
96 | + | |
97 | + }, | |
98 | + | |
99 | + clonedColumns[2].events = { | |
100 | + onClick: (ev, args) => { | |
101 | + const idx = args.idx; | |
102 | + const rowIdx = args.rowIdx; | |
103 | + this.grid.openCellEditor(rowIdx, idx); | |
104 | + } | |
105 | + | |
106 | + }, | |
107 | + | |
108 | + clonedColumns[3].events = { | |
109 | + onClick: (ev, args) => {this.showModal()} | |
110 | + }; | |
111 | + | |
112 | + return clonedColumns; | |
113 | + }, | |
114 | + | |
115 | + handleGridRowsUpdated({ fromRow, toRow, updated }) { | |
116 | + let rows = this.state.rows.slice(); | |
117 | + | |
118 | + for (let i = fromRow; i <= toRow; i++) { | |
119 | + let rowToUpdate = rows[i]; | |
120 | + let updatedRow = update(rowToUpdate, {$merge: updated}); | |
121 | + rows[i] = updatedRow; | |
122 | + } | |
123 | + | |
124 | + this.setState({ rows }); | |
125 | + }, | |
126 | + | |
127 | + handleAddRow({ newRowIndex }) { | |
128 | + const newRow = { | |
129 | + value: newRowIndex, | |
130 | + userStory: '', | |
131 | + developer: '', | |
132 | + epic: '' | |
133 | + }; | |
134 | + | |
135 | + let rows = this.state.rows.slice(); | |
136 | + rows = update(rows, {$push: [newRow]}); | |
137 | + this.setState({ rows }); | |
138 | + }, | |
139 | + | |
140 | + getRowAt(index) { | |
141 | + if (index < 0 || index > this.getSize()) { | |
142 | + return undefined; | |
143 | + } | |
144 | + | |
145 | + return this.state.rows[index]; | |
146 | + }, | |
147 | + getSize() { | |
148 | + return this.state.rows.length; | |
149 | + }, | |
150 | + | |
151 | + | |
152 | + render() { | |
153 | + return ( | |
154 | + | |
155 | + <div className="appLayout-box"> | |
156 | + <div className="page-container"> | |
157 | + <div className="col-md-12"> | |
158 | + <div className="userrolescontent"> | |
159 | + <BootstrapTable striped hover condensed pagination> | |
160 | + <TableHeaderColumn isKey dataField='id'>Product ID</TableHeaderColumn> | |
161 | + <TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn> | |
162 | + <TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn> | |
163 | + </BootstrapTable> | |
164 | + </div> | |
165 | + </div> | |
166 | + </div> | |
167 | + </div> | |
168 | + | |
169 | + | |
170 | + ); | |
171 | + } | |
172 | +}); | ... | ... |
imports/client/views/org/admin/finance/feestrucure/index.js
... | ... | @@ -0,0 +1,52 @@ |
1 | +// import { StudentDataController } from '/imports/client/views/org/admin/students/index' | |
2 | +import _ from 'lodash'; | |
3 | +import { | |
4 | + composeWithTracker, | |
5 | + compose, | |
6 | + composeAll | |
7 | + } from 'react-komposer'; | |
8 | +import { Loading } from '/imports/client/components/Loading'; | |
9 | + | |
10 | +import { Orgs } from '/imports/collections/orgs/index'; | |
11 | +import { Users } from '/imports/collections/users/index'; | |
12 | +import { Example } from './FeeStructureView'; | |
13 | +import { Students } from '/imports/collections/students/index'; | |
14 | + | |
15 | + | |
16 | +const meteorTick = (props, onData) => { | |
17 | + Shelf.layout.set({ | |
18 | + bulb: 'FINANCE', | |
19 | + subbulb: 'FEESTRUCTURE', | |
20 | + }); | |
21 | + const handles = [ | |
22 | + Meteor.subscribe('users.current'), | |
23 | + Meteor.subscribe('orgs.current') | |
24 | + ]; | |
25 | + | |
26 | + if(_.every(handles, (handle) => (handle.ready()) )) { | |
27 | + const user = Users.current(); | |
28 | + const org = Orgs.current(); | |
29 | + onData(null, { | |
30 | + data: { | |
31 | + user: user, | |
32 | + org: org | |
33 | + }, | |
34 | + }); | |
35 | + } | |
36 | + | |
37 | + return () => { | |
38 | + _.each(handles, (handle) => handle.stop() ); | |
39 | + }; | |
40 | +}; | |
41 | + | |
42 | + | |
43 | +const reduxTick = (props, onData) => { | |
44 | + onData(null, { | |
45 | + data: {} | |
46 | + }); | |
47 | +}; | |
48 | + | |
49 | +export const FeeInfoController = composeAll( | |
50 | + composeWithTracker(meteorTick, Loading), | |
51 | + compose(reduxTick, Loading), | |
52 | +)(Example); | ... | ... |
package.json
... | ... | @@ -84,7 +84,7 @@ |
84 | 84 | "react-addons-transition-group": "^15.4.2", |
85 | 85 | "react-bootstrap": "^0.30.8", |
86 | 86 | "react-bootstrap-date-picker": "^4.0.0", |
87 | - "react-bootstrap-table": "^3.1.6", | |
87 | + "react-bootstrap-table": "^3.2.2", | |
88 | 88 | "react-burger-menu": "^1.10.14", |
89 | 89 | "react-data-grid": "^2.0.31", |
90 | 90 | "react-data-grid-addons": "^2.0.31", | ... | ... |