Skip to content

Commit

Permalink
meeting app
Browse files Browse the repository at this point in the history
  • Loading branch information
MAfzalKhan1997 committed Nov 22, 2018
1 parent 6dbbf71 commit ac2743c
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 35 deletions.
14 changes: 13 additions & 1 deletion src/Components/AppBar/AppBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import firebase from '../../Config/firebase'
import GetDirection from '../GetDirection/GetDirection';
import './AppBar.css'

import moment from "moment";
import 'typeface-roboto';

import React from 'react';
Expand Down Expand Up @@ -298,6 +299,17 @@ class MyAppBar extends React.Component {
</div>
);

let meetingTime = notificationObj.selectedDate
// console.log(value.nickName1, meetingTime)
let nowTime = new Date()
// console.log(nowTime)
let timeDiff = moment(nowTime).diff(meetingTime);
console.log('request', timeDiff)

// if(timeDiff > 0 && value.status === 'PENDING' ){
// this.setMeeting(value, index, 'CANCELLED')
// }

return (
<div className={classes.root}>

Expand Down Expand Up @@ -369,7 +381,7 @@ class MyAppBar extends React.Component {
</Toolbar>
</AppBar>

{userProfile &&
{userProfile && timeDiff < 0 &&
<Modal
aria-labelledby="simple-modal-title"
aria-describedby="simple-modal-description"
Expand Down
16 changes: 15 additions & 1 deletion src/Components/DashComp/DashComp.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,18 @@
width: 90% !important;

}
}
}


@media (max-width: 425px) { .fontDecrease{

font-size: 85% !important;

}}

/* @media (max-width: 425px) { .dec{
width: 50px !important;
height: 50px !important;
}} */
53 changes: 38 additions & 15 deletions src/Components/DashComp/DashMeetings/DashMeetings.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ const styles = theme => ({
link: {
color: theme.palette.primary.main,
textDecoration: 'none',
'&:hover': {
textDecoration: 'underline',
},
textTransform: 'capitalize',
fontWeight: 'bolder',
// '&:hover': {
// textDecoration: 'underline',
// },
},
bigAvatar: {
// boxShadow: '0 0 40px rgb(155, 0, 72)',
Expand Down Expand Up @@ -110,6 +112,10 @@ class DashMeetings extends Component {
const { meeters } = this.state;
const userProfile = JSON.parse(localStorage.getItem("userProfile"));

// this.setState({
// meeters:[]
// })

firebase.database().ref(`/meetingsArea/${userProfile.uid}/meetingsSec`).on('child_added', (data) => {

meeters.push(data.val())
Expand Down Expand Up @@ -228,12 +234,10 @@ class DashMeetings extends Component {

{meeters.map((value, index) => {
let meetings = []
let meetingsKey = []

let data = value.meetings
for (let key in data) {
// console.log(data[key])
meetingsKey.push(key)
meetings.push(data[key])
// console.log(meetings)
}
Expand Down Expand Up @@ -277,6 +281,24 @@ class DashMeetings extends Component {
let timeDiff = moment(nowTime).diff(meetingTime);
console.log('meeting', timeDiff)


let status;

if (value.postStatus1 !== 'null' && value.postStatus2 !== 'null') {
if (value.postStatus1 === 'yes' && value.postStatus2 === 'yes') {
status = 'SUCCESSFULL'
}
if (value.postStatus1 === 'no' && value.postStatus2 === 'no') {
status = 'UNSUCCESSFULL'
}
if (value.postStatus1 !== value.postStatus2) {
status = 'COMPLICATED'
}
}
else {
status = value.status
}

return <div key={index} >

{timeDiff > 0 && value.postStatus1 === 'null' &&
Expand Down Expand Up @@ -347,20 +369,21 @@ class DashMeetings extends Component {
<div className={classes.helper}>
<Typography variant="body1">{value.selectedLoc.location.address}</Typography>
<Typography variant="caption">
Status:{value.status}
Status: <span className={classes.link}>{status.toLowerCase()}</span>
</Typography>
</div>
</ExpansionPanelDetails>

<div style={{ marginTop: '-10px' }}>
<AddToCalendar
event={event}
buttonTemplate={icon}
listItems={items}
buttonLabel="Add to Calendar"
/>
</div>

{(value.status !== 'CANCELLED' && value.status !== 'PENDING') &&
<div style={{ marginTop: '-10px' }}>
<AddToCalendar
event={event}
buttonTemplate={icon}
listItems={items}
buttonLabel="Add to Calendar"
/>
</div>
}
<Divider />
<ExpansionPanelActions>
<Button size="small"
Expand Down
63 changes: 45 additions & 18 deletions src/Components/DashComp/DashRequests/DashRequests.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ const styles = theme => ({
link: {
color: theme.palette.primary.main,
textDecoration: 'none',
'&:hover': {
textDecoration: 'underline',
},
textTransform: 'capitalize',
fontWeight: 'bolder',
// '&:hover': {
// textDecoration: 'underline',
// },
},
bigAvatar: {
// boxShadow: '0 0 40px rgb(155, 0, 72)',
Expand Down Expand Up @@ -131,9 +133,9 @@ class DashRequests extends Component {
this.getData()
}

setMeeting(meeting, status) {
setMeeting(meeting, index, status) {

// const { meetingsKey } = this.state;
const { meetings } = this.state;

const meetingObj = {

Expand Down Expand Up @@ -169,7 +171,10 @@ class DashRequests extends Component {
return firebase.database().ref().update(updates)
.then(resp => {
console.log(status, resp)
// this.getData()
meetings[index] = meetingObj
this.setState({
meetings,
})
})


Expand Down Expand Up @@ -259,6 +264,27 @@ class DashRequests extends Component {
// console.log(nowTime)
let timeDiff = moment(nowTime).diff(meetingTime);
console.log('request', timeDiff)

if(timeDiff > 0 && value.status === 'PENDING' ){
this.setMeeting(value, index, 'CANCELLED')
}

let status;

if (value.postStatus1 !== 'null' && value.postStatus2 !== 'null') {
if (value.postStatus1 === 'yes' && value.postStatus2 === 'yes') {
status = 'SUCCESSFULL'
}
if (value.postStatus1 === 'no' && value.postStatus2 === 'no') {
status = 'UNSUCCESSFULL'
}
if (value.postStatus1 !== value.postStatus2) {
status = 'COMPLICATED'
}
}
else {
status = value.status
}

return <div key={index}>

Expand Down Expand Up @@ -346,31 +372,32 @@ class DashRequests extends Component {
<div className={classes.helper}>
<Typography variant="body1">{value.selectedLoc.location.address}</Typography>
<Typography variant="caption">
Status:{value.status}
Status: <span className={classes.link}>{status.toLowerCase()}</span>
</Typography>
</div>
</ExpansionPanelDetails>

<div style={{ marginTop: '-10px' }}>
<AddToCalendar
event={event}
buttonTemplate={icon}
listItems={items}
buttonLabel="Add to Calendar"
/>
</div>

{(value.status !== 'CANCELLED' && value.status !== 'PENDING') &&
<div style={{ marginTop: '-10px' }}>
<AddToCalendar
event={event}
buttonTemplate={icon}
listItems={items}
buttonLabel="Add to Calendar"
/>
</div>
}
<Divider />
<ExpansionPanelActions>
<Button size="small" disabled={value.status !== 'PENDING' ? true : false}
onClick={() => this.setMeeting(value, 'CANCELLED')}
onClick={() => this.setMeeting(value, index, 'CANCELLED')}
>
Cancel
</Button>

<Button size="small" color="primary"
disabled={value.status !== 'PENDING' ? true : false}
onClick={() => this.setMeeting(value, 'ACCEPTED')}
onClick={() => this.setMeeting(value, index, 'ACCEPTED')}
>
Accept
</Button>
Expand Down

0 comments on commit ac2743c

Please sign in to comment.