Skip to content

Post events #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 51 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
e99647d
chore: Update firebase, react, react-dom.
dheeraj-coding Dec 15, 2018
3ddcb6c
feat: Implement post events feature.
dheeraj-coding Dec 15, 2018
7c18952
fix: Fix format and lint issues.
dheeraj-coding Dec 15, 2018
e72f1a3
Implement new editable table using react-table.
dheeraj-coding Jan 12, 2019
2284e0b
Add error messages to the table 1
dheeraj-coding Jan 12, 2019
5f28be9
Implement tables for both credit and debit.
dheeraj-coding Jan 12, 2019
ff5a4bd
Implement the form with new Fields.
dheeraj-coding Jan 13, 2019
d16ee15
fix: Handlenotes missing
dheeraj-coding Jan 27, 2019
b77955d
Add notifications in travis
bhawesh96 Dec 15, 2018
2563d30
Create .github/config.yml
rsarky Dec 16, 2018
81b1f26
Removes MenuIcon from AppBarComponent.js
nids98 Dec 16, 2018
55e4dbc
Change the test script to just check whether code follows guidelines
rsarky Dec 18, 2018
cd9e5c3
Settings for Travis deploy
rsarky Dec 18, 2018
a349c62
fix: use baseURL based on environment
bhawesh96 Dec 21, 2018
28472ed
[skip ci] Update readme
bhawesh96 Dec 23, 2018
de1b252
Feat: Actions on events by SC
bhawesh96 Dec 25, 2018
95fa6cb
fix: standardise start_date, end_date
bhawesh96 Dec 27, 2018
ff0efcc
Feat: Post Event detail only description
bhawesh96 Dec 26, 2018
3c08281
fix: Reduce maximum rooms allowed
bhawesh96 Dec 27, 2018
8793d5a
Fix: Reduce booking period to 20 days
bhawesh96 Dec 27, 2018
a85510e
fix: Block some rooms for SC.
rsarky Jan 3, 2019
912138d
fix: Disable editing club name abbrv
bhawesh96 Jan 1, 2019
1d486be
Fix: Blunder of missing else
bhawesh96 Jan 1, 2019
9985f35
fix: change blocked rooms as per SC direction.
rsarky Jan 3, 2019
6b51883
fix: Temporarily block ground floor NLH rooms (booked for OEs)
rsarky Jan 7, 2019
72d2f3d
fix: Unblock blocked rooms.
rsarky Jan 7, 2019
7e09730
fix: Fixes bug caused by 2 rooms in AB5
rsarky Jan 5, 2019
28c3370
fix: Change string to integer for 53101 and 53102
rsarky Jan 9, 2019
f60faa7
fix: Fix receipt URL bug on migration from AWS to firebase
rsarky Jan 6, 2019
df8bf93
feat: Add admin page for Student Council.
rsarky Jan 11, 2019
7c1dd04
fix: Critical bug fix involving the room booking logic
rsarky Jan 14, 2019
addbcc5
fix: Remove duplicated room, AB5 505
rsarky Jan 14, 2019
946850c
fix: Update phone numbers
rsarky Jan 14, 2019
c74422d
[3202,3205] NLH rooms disabled
Arushi1912 Jan 18, 2019
bd8534a
refactor: Move addition of rooms to the database logic to a new function
rsarky Jan 24, 2019
994d160
refactor: Move logic to get date array from start till end date of an…
rsarky Jan 24, 2019
6338754
feat: Show approved rooms in a different color(pink) in the View
rsarky Jan 24, 2019
15b0e71
feat: Format the room string for the events in View Bookings
rsarky Jan 24, 2019
59b2685
style: Trivial style fix
rsarky Jan 25, 2019
a6e088b
fix (EventExportDialog) : Fix spelling mistake in snackbar message
rsarky Jan 26, 2019
5d41858
fix: Fix logical error in color coding approved rooms
rsarky Jan 27, 2019
ba322a7
feat: Add support to block rooms without hardcoding.
rsarky Jan 27, 2019
4e9d0ae
fix: Pass properly formatted date arguments to getDateArr in addAppro…
rsarky Jan 27, 2019
e3e376e
fix: Uncomment all commented rooms
rsarky Jan 27, 2019
76e9ed2
feat: Handle blocked rooms in View Bookings
rsarky Jan 27, 2019
69a48e1
feat: Add support for Floor Incharge to view room bookings
rsarky Jan 27, 2019
0ee738e
feat: Add support for Security Officer to view room bookings
rsarky Jan 29, 2019
8d57a33
Feature: Allow clubs to cancel event bookings
nids98 Jan 16, 2019
3ca5ead
style: Styles fixes
rsarky Feb 4, 2019
d149378
Merge remote-tracking branch 'upstream/master'
dheeraj-coding Mar 15, 2019
b192f94
Fix: Remove old post event dialog and use new Post Event implementation
dheeraj-coding Mar 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,096 changes: 503 additions & 593 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@
"dependencies": {
"axios": "^0.17.1",
"env-cmd": "^8.0.2",
"firebase": "^4.13.1",
"firebase": "^5.7.0",
"history": "^4.7.2",
"material-ui": "^0.20.0",
"material-ui-datatables": "^0.18.2",
"material-ui-table-edit": "^3.0.3",
"moment": "^2.19.4",
"react": "^15.4.2",
"mui-editable-table": "^0.3.3",
"react": "^15.4.0",
"react-collapsible": "^2.0.3",
"react-dom": "^15.4.2",
"react-dom": "^15.4.0",
"react-loading": "^1.0.3",
"react-moment": "^0.6.8",
"react-redux": "^5.0.6",
"react-router": "^3.0.5",
"react-router-dom": "^4.2.2",
"react-table": "^6.8.6",
"react-table-material": "^0.1.0",
"react-tap-event-plugin": "^3.0.3",
"react-tooltip": "^3.4.0",
"redux": "^3.7.2",
"redux-logger": "^3.0.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { connect } from 'react-redux'
import { firebaseDB } from '../../../firebaseConfig'
import SearchSortContainer from './SearchSortContainer'
import ViewEventDialog from '../../Dialogs/ViewEventDialogComponent'
import PostEventDetailDialog from '../../Dialogs/PostEventDetailDialogComponent'
import FlagIcon from 'material-ui/svg-icons/action/report-problem'
import NAIcon from 'material-ui/svg-icons/action/restore'
import DashIcon from 'material-ui/svg-icons/content/remove'
Expand All @@ -33,7 +32,7 @@ import moment from 'moment'
import CancelEventDialog from '../../Dialogs/CancelEventDialogComponent'

class MyEventsComponent extends Component {
constructor (props) {
constructor(props) {
super(props)
this.showDialog = this.showDialog.bind(this)
this.showPostEventDetailDialog = this.showPostEventDetailDialog.bind(this)
Expand All @@ -45,6 +44,7 @@ class MyEventsComponent extends Component {
this.uploadPostEventDetail = this.uploadPostEventDetail.bind(this)
this.showCancelEventDialog = this.showCancelEventDialog.bind(this)
this.onEventDelete = this.onEventDelete.bind(this)
this.handlePostEvent = this.handlePostEvent.bind(this)

this.state = {
fixedHeader: true,
Expand All @@ -68,7 +68,7 @@ class MyEventsComponent extends Component {
}
}

handleIcon (event, state, msg) {
handleIcon(event, state, msg) {
if (state === 'pending') { return <PendingIcon style={{ color: '#FBC02D' }} hoverColor={'#F57F17'} data-tip='Pending' /> }
if (state === 'approved') { return <CheckCircleIcon style={{ color: '#558B2F' }} hoverColor={'#33691E'} data-tip='Approved' /> }
if (state === 'flagged') { return <FlagIcon style={{ color: '#D50000', cursor: 'pointer' }} onClick={() => { this.showDialog(event) }} data-multiline data-tip={'Flagged - ' + msg} hoverColor={'red'} /> }
Expand All @@ -77,35 +77,35 @@ class MyEventsComponent extends Component {
if (state === 'prevRejected') { return <DashIcon style={{ color: '#b71c1c' }} data-tip='Previously rejected' /> }
}

onEventDelete (myArrx) {
onEventDelete(myArrx) {
this.setState({ myArrx: myArrx })
}

showDialog (event) {
showDialog(event) {
this.setState({ dialogOpen: true })
this.setState({ currentEvent: event })
}

showPostEventDetailDialog (event) {
showPostEventDetailDialog(event) {
this.setState({ postEventDetailDialogOpen: true, currentEvent: event })
}

showCancelEventDialog (event) {
showCancelEventDialog(event) {
this.setState({ cancelDialogopen: true, currentEvent: event })
}

handleDialogClose () {
handleDialogClose() {
this.setState({ dialogOpen: false, postEventDetailDialogOpen: false, cancelDialogopen: false })
}

uploadPostEventDetail (event, message) {
uploadPostEventDetail(event, message) {
this.handleDialogClose()
firebaseDB.ref('/events/').child(event.key + '/postEventDetail').set(message)
const { dispatch } = this.props
dispatch({ type: 'TOASTER', message: 'Post event details updated', toastOpen: true })
}

nextEvent () {
nextEvent() {
let keys = Object.keys(this.state.myArrx)
let pos = keys.indexOf(this.state.currentEvent.key) + 1
if (pos === Object.keys(this.state.myArrx).length) {
Expand All @@ -116,14 +116,14 @@ class MyEventsComponent extends Component {
this.setState({ currentEvent: nextEvent })
}

handleSearch (content) {
handleSearch(content) {
this.setState({ searchContent: content })
var myArrx = this.state.originalArr
myArrx = Object.values(myArrx).filter(_event => _event.title.toLowerCase().includes(content.toLowerCase()))
this.setState({ myArrx })
}

handleSort () {
handleSort() {
if (this.state.dateSort === 'des') { this.setState({ dateSort: 'asc' }) } else { this.setState({ dateSort: 'des' }) }
var scope = this
var myArrx = this.state.originalArr
Expand All @@ -136,7 +136,13 @@ class MyEventsComponent extends Component {
this.setState({ myArrx })
}

filterAndStore (arr) {
handlePostEvent(currEvent) {
const { dispatch } = this.props
dispatch({ type: 'POST_EVENT', currEvent: currEvent })
hashHistory.push('/dashboard/postEventDetails')
}

filterAndStore(arr) {
for (let [key, value] of Object.entries(arr)) {
if (value.FA_appr && value.AD_appr && value.SO_appr) {
this.state.approvedArr[key] = value
Expand All @@ -147,7 +153,7 @@ class MyEventsComponent extends Component {
}
}

componentWillReceiveProps (newProps) {
componentWillReceiveProps(newProps) {
if (newProps.filter === 'pending') {
const { pendingArr } = this.state
this.setState({ myArr: pendingArr })
Expand All @@ -160,7 +166,7 @@ class MyEventsComponent extends Component {
}
}

componentWillMount () {
componentWillMount() {
if (!this.props.user) {
hashHistory.push('/auth')
return
Expand Down Expand Up @@ -207,7 +213,7 @@ class MyEventsComponent extends Component {
}, this)
}

render () {
render() {
return (
<div style={{ display: 'flex', justifyContent: 'start', flexDirection: 'column', alignItems: 'center', backgroundColor: '', height: '100%' }}>

Expand All @@ -217,7 +223,6 @@ class MyEventsComponent extends Component {

<ViewEventDialog open={this.state.dialogOpen} currentEvent={this.state.currentEvent} handleClose={this.handleDialogClose} nextEvent={this.nextEvent} />

<PostEventDetailDialog open={this.state.postEventDetailDialogOpen} currentEvent={this.state.currentEvent} handleClose={this.handleDialogClose} uploadPostEventDetail={this.uploadPostEventDetail} />

<CancelEventDialog open={this.state.cancelDialogopen} currentEvent={this.state.currentEvent} handleClose={this.handleDialogClose} allevents={this.state.myArrx} onEventDelete={this.onEventDelete} />

Expand All @@ -241,14 +246,14 @@ class MyEventsComponent extends Component {
style={{ color: '#000', fontWeight: 700, display: 'flex', alignItems: 'center', width: '18%' }}
hidden={this.props.isMobile}
>
START DATE
START DATE
<IconButton data-tip='Sort by date' onClick={this.handleSort} style={{ padding: 0, height: 20, width: 20, marginLeft: 5 }}>{this.state.dateSort != null ? (this.state.dateSort === 'asc' ? <UpArrow viewBox='0 0 30 30' /> : <DownArrow viewBox='0 0 30 30' />) : <SortIcon viewBox='0 0 30 30' />}</IconButton>
</TableHeaderColumn>
<TableHeaderColumn
style={{ color: '#000', fontWeight: 700, alignItems: 'center', width: '18%' }}
hidden={this.props.isMobile}
>
END DATE
END DATE
</TableHeaderColumn>
<TableHeaderColumn style={{ color: '#000', fontWeight: 700, width: this.props.isMobile ? '13%' : '9%' }}>SC</TableHeaderColumn>
<TableHeaderColumn style={{ color: '#000', fontWeight: 700, width: this.props.isMobile ? '13%' : '9%' }}>FA</TableHeaderColumn>
Expand All @@ -265,9 +270,9 @@ class MyEventsComponent extends Component {
>

{this.state.fetching &&
<div style={{ textAlign: 'center', marginTop: '10%' }}>
<CircularProgress size={60} />
</div>
<div style={{ textAlign: 'center', marginTop: '10%' }}>
<CircularProgress size={60} />
</div>
}

{
Expand All @@ -289,20 +294,24 @@ class MyEventsComponent extends Component {
useLayerForClickAway
>
<MenuItem primaryText='View' onClick={() => this.showDialog(event)} />
<MenuItem hidden={!event.receiptURL} primaryText='Post Event Details' onClick={() => this.showPostEventDetailDialog(event)} />
<MenuItem hidden={!event.receiptURL} primaryText='Download Receipt' onClick={() => { window.location = (event.receiptURL) }} />
<MenuItem hidden={moment(new Date(), 'DD-MM-YYYY').isAfter(moment(event.startDate, 'DD-MM-YYYY'))} primaryText='Cancel Event' onClick={() => this.showCancelEventDialog(event)} />
<MenuItem
hidden={!event.receiptURL}
primaryText='Post Event Detail'
onClick={() => this.handlePostEvent(event)}
/>
</IconMenu>}
</TableRowColumn>
</TableRow>
)
}, this)) : (

<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', marginTop: this.props.isMobile ? '15%' : '2%', textAlign: 'center', minHeight: 250 }} hidden={this.state.fetching}>
<img src={require(this.state.searchContent.length > 0 ? '../../../assets/empty-state.gif' : '../../../assets/empty-state.gif')} style={{ width: this.props.isMobile ? '70%' : '30%', marginBottom: 10 }} />
<p>{this.state.searchContent.length > 0 ? 'No events for this search' : 'No events found'}</p>
</div>
)
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', marginTop: this.props.isMobile ? '15%' : '2%', textAlign: 'center', minHeight: 250 }} hidden={this.state.fetching}>
<img src={require(this.state.searchContent.length > 0 ? '../../../assets/empty-state.gif' : '../../../assets/empty-state.gif')} style={{ width: this.props.isMobile ? '70%' : '30%', marginBottom: 10 }} />
<p>{this.state.searchContent.length > 0 ? 'No events for this search' : 'No events found'}</p>
</div>
)
}

</TableBody>
Expand All @@ -314,7 +323,7 @@ class MyEventsComponent extends Component {
}
}

function mapStateToProps (state) {
function mapStateToProps(state) {
const { openSideNav, isMobile, filter } = state.toggler
const { user, verified, vals } = state.authentication
return {
Expand Down
Loading