From 6adcdac35e0ac355b1687b492a47668a6fff1380 Mon Sep 17 00:00:00 2001 From: Sunny Negi Date: Sat, 29 Apr 2017 12:55:16 +0530 Subject: [PATCH] second commit --- imports/client/app/routes.js | 5 + .../client/views/org/admin/app/module/Sidebar.js | 6 + .../admin/finance/feestrucure/FeeStructureView.js | 172 +++++++++++++++++++++ .../views/org/admin/finance/feestrucure/index.js | 52 +++++++ package.json | 2 +- 5 files changed, 236 insertions(+), 1 deletion(-) create mode 100644 imports/client/views/org/admin/finance/feestrucure/FeeStructureView.js create mode 100644 imports/client/views/org/admin/finance/feestrucure/index.js diff --git a/imports/client/app/routes.js b/imports/client/app/routes.js index 0b483e2..a646cdc 100644 --- a/imports/client/app/routes.js +++ b/imports/client/app/routes.js @@ -45,6 +45,7 @@ import { AdminComposeMailController } from '/imports/client/views/org/admi import { AdminSentMailController } from '/imports/client/views/org/admin/mailbox/sent/index' import { AdminImportantMailController } from '/imports/client/views/org/admin/mailbox/important/index' +import { FeeInfoController } from '/imports/client/views/org/admin/finance/feestrucure/index' //students @@ -85,6 +86,10 @@ const getOrgAdminRoutes = () => ( + + + + diff --git a/imports/client/views/org/admin/app/module/Sidebar.js b/imports/client/views/org/admin/app/module/Sidebar.js index ec4bf91..55d2e8e 100644 --- a/imports/client/views/org/admin/app/module/Sidebar.js +++ b/imports/client/views/org/admin/app/module/Sidebar.js @@ -70,6 +70,12 @@ export class AdminSidebar extends Component { Class Info + + + Fee Structure + + + {/** Layout 1 Layout 2 diff --git a/imports/client/views/org/admin/finance/feestrucure/FeeStructureView.js b/imports/client/views/org/admin/finance/feestrucure/FeeStructureView.js new file mode 100644 index 0000000..8390003 --- /dev/null +++ b/imports/client/views/org/admin/finance/feestrucure/FeeStructureView.js @@ -0,0 +1,172 @@ +const ReactDataGrid = require('react-data-grid'); +import {BootstrapTable, TableHeaderColumn} from 'react-bootstrap-table'; +import _ from 'lodash'; +import { Meteor } from 'meteor/meteor'; + +import React, { Component } from 'react'; +const { Editors, Toolbar, Formatters } = require('react-data-grid-addons'); +import { Modal, Button } from 'react-bootstrap'; +const { AutoComplete: AutoCompleteEditor, DropDownEditor } = Editors; +const { ImageFormatter } = Formatters; +const faker = require('faker'); +import update from 'react-addons-update'; +faker.locale = 'en_GB'; + +const titles = ['Ajay', 'Deepak', 'Raghu', 'Satheesh', 'Bharath']; + +export const Example = React.createClass({ + + showModal() { + this.setState({show: true}); + }, + + hideModal() { + this.setState({show: false}); + }, + onUpdate(key, value) { + this.setState({[key]: value}); + }, + + + getInitialState() { + // super(props); + this._columns = [ + { + key: 'id', + name: 'S.No.', + width: 80, + resizable: true + }, + { + key: 'roles', + name: 'Roles', + editable: true, + width: 325, + resizable: true + }, + { + key: 'roledesc', + name: 'Role Description', + editable: true, + width: 380, + resizable: true + }, + { + key: 'stafflist', + name: 'Staffs', + editor: , + width: 335, + resizable: true, + events: { + onDoubleClick: function() { + console.log('The user double clicked on title column'); + } + } + } + ]; + return { rows: this.createRows(5), show: false }; + }, + + + createRows(numberOfRows) { + let rows = []; + for (let i = 0; i < numberOfRows; i++) { + rows[i] = this.createFakeRowObjectData(i); + } + return rows; + }, + + createFakeRowObjectData(index) { + return { + id: index+1, + roles: faker.name.firstName(), + stafflist: faker.name.prefix(), + roledesc: faker.lorem.sentence() + }; + }, + + getColumns() { + let clonedColumns = this._columns.slice(); + clonedColumns[1].events = { + onClick: (ev, args) => { + const idx = args.idx; + const rowIdx = args.rowIdx; + this.grid.openCellEditor(rowIdx, idx); + } + + }, + + clonedColumns[2].events = { + onClick: (ev, args) => { + const idx = args.idx; + const rowIdx = args.rowIdx; + this.grid.openCellEditor(rowIdx, idx); + } + + }, + + clonedColumns[3].events = { + onClick: (ev, args) => {this.showModal()} + }; + + return clonedColumns; + }, + + handleGridRowsUpdated({ fromRow, toRow, updated }) { + let rows = this.state.rows.slice(); + + for (let i = fromRow; i <= toRow; i++) { + let rowToUpdate = rows[i]; + let updatedRow = update(rowToUpdate, {$merge: updated}); + rows[i] = updatedRow; + } + + this.setState({ rows }); + }, + + handleAddRow({ newRowIndex }) { + const newRow = { + value: newRowIndex, + userStory: '', + developer: '', + epic: '' + }; + + let rows = this.state.rows.slice(); + rows = update(rows, {$push: [newRow]}); + this.setState({ rows }); + }, + + getRowAt(index) { + if (index < 0 || index > this.getSize()) { + return undefined; + } + + return this.state.rows[index]; + }, + getSize() { + return this.state.rows.length; + }, + + + render() { + return ( + +
+
+
+
+ + Product ID + Product Name + Product Price + +
+
+
+
+ + + ); + } +}); diff --git a/imports/client/views/org/admin/finance/feestrucure/index.js b/imports/client/views/org/admin/finance/feestrucure/index.js new file mode 100644 index 0000000..2bf66a8 --- /dev/null +++ b/imports/client/views/org/admin/finance/feestrucure/index.js @@ -0,0 +1,52 @@ +// 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 { Example } from './FeeStructureView'; +import { Students } from '/imports/collections/students/index'; + + +const meteorTick = (props, onData) => { + Shelf.layout.set({ + bulb: 'FINANCE', + subbulb: 'FEESTRUCTURE', + }); + const handles = [ + Meteor.subscribe('users.current'), + Meteor.subscribe('orgs.current') + ]; + + if(_.every(handles, (handle) => (handle.ready()) )) { + const user = Users.current(); + const org = Orgs.current(); + onData(null, { + data: { + user: user, + org: org + }, + }); + } + + return () => { + _.each(handles, (handle) => handle.stop() ); + }; +}; + + +const reduxTick = (props, onData) => { + onData(null, { + data: {} + }); +}; + +export const FeeInfoController = composeAll( + composeWithTracker(meteorTick, Loading), + compose(reduxTick, Loading), +)(Example); diff --git a/package.json b/package.json index 33e1dfa..d94c9d3 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "react-addons-transition-group": "^15.4.2", "react-bootstrap": "^0.30.8", "react-bootstrap-date-picker": "^4.0.0", - "react-bootstrap-table": "^3.1.6", + "react-bootstrap-table": "^3.2.2", "react-burger-menu": "^1.10.14", "react-data-grid": "^2.0.31", "react-data-grid-addons": "^2.0.31", -- 2.0.0