-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added search functionality and users can see their applications
Showing
11 changed files
with
206 additions
and
48 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react'; | ||
import { withRouter } from "react-router"; | ||
import { status, json } from '../utilities/requestHandlers'; | ||
import { Typography, Space, Button, List, Col, Row } from 'antd'; | ||
import UserContext from '../contexts/user'; | ||
import ApplicationItem from './applicationitem'; | ||
|
||
const { Title } = Typography; | ||
|
||
class ApplicationGrid extends React.Component { | ||
|
||
static contextType = UserContext; | ||
|
||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
applications: [] | ||
} | ||
} | ||
|
||
componentDidMount() { | ||
const id = this.context.user.ID; | ||
const username = this.context.user.username | ||
const password = this.context.user.password | ||
fetch(`https://animal-hello-3000.codio-box.uk/api/v1/applications/account/${id}`, { | ||
method: 'GET', | ||
headers: { | ||
"Authorization": "Basic " + btoa(username + ":" + password) | ||
}, | ||
}) | ||
.then(status) | ||
.then(json) | ||
.then(application => { | ||
this.setState({applications:application}) | ||
}) | ||
.catch(err => { | ||
console.log(`Fetch error for application ${id}`) | ||
}); | ||
}; | ||
|
||
render() { | ||
if (!this.state.applications.length) { | ||
if(!this.state.found){ | ||
return <h3>No applications found</h3> | ||
} else { | ||
return <h3>Loading applications...</h3> | ||
} | ||
} | ||
const allApplications = this.state.applications.map(application => { | ||
return ( | ||
<div style={{ padding: '2% 20%' }} key={application.ID}> | ||
<List | ||
className="demo-loadmore-list"> | ||
<ApplicationItem {...application} /> | ||
</List> | ||
</div> | ||
) | ||
}); | ||
|
||
return( | ||
<> | ||
{allApplications} | ||
</> | ||
); | ||
} | ||
} | ||
|
||
export default ApplicationGrid; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react'; | ||
import { List } from 'antd'; | ||
import {Link} from "react-router-dom"; | ||
|
||
class ApplicationItem extends React.Component { | ||
|
||
render() { | ||
|
||
return( | ||
<List.Item | ||
actions={[<Link to={'/applications/' + this.props.ID}><a>View</a></Link>]}> | ||
<List.Item.Meta | ||
title={<h2>{this.props.companyName}</h2>} | ||
description='Congratulations this application has been approved.' | ||
/> | ||
<div>{this.props.ID}, {this.props.userID}</div> | ||
</List.Item> | ||
); | ||
return( | ||
<List.Item | ||
actions={[<Link to={'/applications/' + this.props.ID}><a>View</a></Link>]}> | ||
<List.Item.Meta | ||
title={<h2>{this.props.companyName}</h2>} | ||
description='This application is pending approval.' | ||
/> | ||
<div>{this.props.dateCreated}</div> | ||
</List.Item> | ||
); | ||
} | ||
|
||
|
||
} | ||
|
||
export default ApplicationItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters