Skip to content

Commit

Permalink
changes made
Browse files Browse the repository at this point in the history
  • Loading branch information
piano-man committed Oct 20, 2018
1 parent 39f7f1d commit 2578553
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 41 deletions.
18 changes: 15 additions & 3 deletions poolpal_backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ app.get('/notifications/:emailid',function(req,res){
result.push(requestmap[i])
}
}
console.log(result)
res.send({"result":result})
})

Expand Down Expand Up @@ -165,7 +164,6 @@ app.get('/confirmations/:emailid',function(req,res){
result.push(requestmap[i])
}
}
console.log(result)
res.send({"result":result})
})

Expand All @@ -192,7 +190,21 @@ app.get('/endtrip/:emailid',function(req,res){
procurermap.splice(i,1);
})


app.get('/getotp/:reqid',function(req,res){
var id = req.params.reqid
var l = requestmap.length
var i
var otp
for(i = 0 ; i < l ; i++)
{
if(requestmap[i].request_id==id)
{
otp = requestmap[i].otp
break
}
}
res.send({"result":otp})
})



Expand Down
2 changes: 1 addition & 1 deletion poolpal_frontend/src/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default class Home extends Component {
<Row>
<Col s={4} offset="s4" className="center-align">
<MediaBox
src="./images/user.png"
src="https://raw.githubusercontent.com/faheemzunjani/PoolPal/master/poolpal_frontend/src/images/user.png"
caption="User"
className="circle responsive-img"
/>
Expand Down
2 changes: 1 addition & 1 deletion poolpal_frontend/src/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default class Login extends Component {
<Row>
<Col s={4} offset="s4" className="blue-grey lighten-5 center-align">
<MediaBox
src="/images/icon.png"
src="https://raw.githubusercontent.com/faheemzunjani/PoolPal/master/poolpal_frontend/src/images/icon.png"
className="circle valign-wrapper responsive-img"
/>
</Col>
Expand Down
82 changes: 46 additions & 36 deletions poolpal_frontend/src/TripEnd.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default class HospitalRecords extends Component{
super(props)
//this.getPatientList = this.getPatientList.bind(this)
this.getAcceptedRequests = this.getAcceptedRequests.bind(this)
this.requestfinish = this.requestfinish.bind(this)
this.state = {

}
Expand Down Expand Up @@ -66,6 +67,31 @@ export default class HospitalRecords extends Component{
var rec = JSON.stringify(item)
let response = fetch(`http://localhost:5000/requestAccepted/${this.props.match.params.id}/${rec}`)
}
async requestfinish(record)
{
let response = await fetch(`http://localhost:5000/getotp/${record.request_id}`)
let resp_json = await response.json()
var act_otp = resp_json.result
var otp = document.getElementById('otp').value
console.log(act_otp);
console.log(otp);
if(act_otp==otp)
{
alert(`${record.depositedAmount} has been transferred into your account`)
this.props.history.goBack()
this.props.history.goBack()
}
else{
while(act_otp!=otp)
{
var totp = prompt("Please enter the correct otp")
otp = totp
}
alert(`${record.depositedAmount} has been transferred into your account`)
this.props.history.goBack()
this.props.history.goBack()
}
}

renderList(record){
return(
Expand All @@ -75,60 +101,44 @@ export default class HospitalRecords extends Component{
<div>
<Modal
header={record.item}
actions={
<div>
<Button
onClick={() => this.modifylist(record)}
flat
modal="close"
waves="light"
className="grey-text text-darken-4"
>
Finish
</Button>
<Button
flat
modal="close"
waves="light"
className="grey-text text-darken-4"
>
Dismiss
</Button>
</div>
}
trigger={
<Button className="white black-text">{record.item}</Button>
}
>
<p>
<form onSubmit={this.requestsend}>
<Row>
<Col s={10} offset="s1">
<Col s={12}>
<label>Amount Paid</label>
</Col>
<Input
s={12}
id="item"
type="text"
className="validate"
placeholder="Enter amount paid"
/>
</Col>
<Col s={10} offset="s1">
<Col s={12}>
<label>OTP</label>
</Col>
<Input
s={12}
id="description"
id="otp"
type="text"
className="validate"
placeholder="Enter OTP"
/>
</Col>
</Row>
</form>
{/* <Button
onClick={() => this.modifylist(record)}
flat
modal="close"
waves="light"
className="grey-text text-darken-4"
>
Finish
</Button> */}
<Button
onClick={() => this.requestfinish(record)}
flat
modal="close"
waves="light"
className="grey-text text-darken-4"
>
Finish
</Button>

</p>
</Modal>
<Row style={filler4} />
Expand Down

0 comments on commit 2578553

Please sign in to comment.