-
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 changes for normal users to see their applications
Showing
14 changed files
with
519 additions
and
51 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Binary file not shown.
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 |
---|---|---|
@@ -1,30 +1,26 @@ | ||
import React from 'react'; | ||
import { Card } from 'antd'; | ||
import NavImage from './navimage'; | ||
import {Link} from "react-router-dom"; | ||
|
||
const { Meta } = Card; | ||
|
||
class ApplicationCard extends React.Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
render() { | ||
const imagesrc = "https://animal-hello-3000.codio-box.uk/api/v1/applications" + this.props.image | ||
console.log(this.props.image) | ||
const applicationID = this.props.ID; | ||
const companyName = this.props.companyName | ||
return ( | ||
<Link to={`/application/${applicationID}`}> | ||
<Card | ||
style={{ width: 320 }} | ||
cover={<NavImage alt={`Application ${applicationID}`} src={this.props.imageURL} to={`/applications/${applicationID}`} />} | ||
hoverable={true}> | ||
|
||
<Meta title={this.props.companyName} description={this.props.status} /> | ||
</Card> | ||
</Link> | ||
<Link to={`/application/${applicationID}`}> | ||
<Card | ||
style={{ width: 320, textAlign: "center", paddingTop: "50px"}} | ||
cover={<p> {`${companyName}`}</p>} | ||
hoverable={true}> | ||
</Card> | ||
</Link> | ||
); | ||
} | ||
} | ||
|
||
export default ApplicationCard; | ||
export default ApplicationCard; |
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,88 @@ | ||
import React from 'react'; | ||
import { withRouter } from 'react-router'; | ||
import { Image, Row, Col, Typography, Space, Button, Form, Input } from 'antd'; | ||
import { status, json } from '../utilities/requestHandlers'; | ||
import { Component } from 'react'; | ||
import Select from 'react-select'; | ||
import ReactDOM from "react-dom"; | ||
|
||
import ApplicationCard from './applicationcard'; | ||
|
||
import UserContext from '../contexts/user'; | ||
import {useContext} from 'react'; | ||
|
||
window.$name = "" | ||
|
||
|
||
const { Title, Paragraph } = Typography; | ||
|
||
const formItemLayout = { | ||
labelCol: { xs: { span: 24 }, sm: { span: 6 } }, | ||
wrapperCol: { xs: { span: 24 }, sm: { span: 12 } } | ||
}; | ||
|
||
class ApplicationForUsers extends React.Component { | ||
|
||
static contextType = UserContext; | ||
|
||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
application: {} | ||
} | ||
} | ||
|
||
componentDidMount() { | ||
const id = this.props.match.params.id; // available using withRouter() | ||
const username = this.context.user.username | ||
const password = this.context.user.password | ||
fetch(`https://animal-hello-3000.codio-box.uk/api/v1/applications/myapplications/${id}`, { | ||
method: 'GET', | ||
headers: { | ||
"Authorization": "Basic " + btoa(username + ":" + password) | ||
}, | ||
}) | ||
.then(status) | ||
.then(json) | ||
.then(application => { | ||
window.$id = id; | ||
this.setState({application:application}) | ||
}) | ||
.catch(err => { | ||
console.log(`Fetch error for application ${id}`) | ||
}); | ||
}; | ||
|
||
render() { | ||
if (!this.state.application) { | ||
return <h3>Loading application...</h3> | ||
} | ||
const application = this.state.application; | ||
|
||
return( | ||
|
||
<div> | ||
<Row type="flex" justify="space-around" align="middle"> | ||
<Col span={6} align="center"> | ||
<Image width={200} alt="Application" src={application.imageURL} /> | ||
</Col> | ||
<Col span={12}> | ||
<Title>{application.companyName}</Title> | ||
<Paragraph>Company Registration Number: {application.crn}</Paragraph> | ||
<Paragraph>Address: {application.address}</Paragraph> | ||
<Paragraph>Email: {application.email}</Paragraph> | ||
<Paragraph>Founded in: {application.dateFunded}</Paragraph> | ||
<Paragraph>Created In: {application.dateCreated}</Paragraph> | ||
<Paragraph>Status: {application.status}</Paragraph> | ||
</Col> | ||
<Col span={6} align="center"> | ||
</Col> | ||
</Row> | ||
</div> | ||
|
||
); | ||
} | ||
|
||
} | ||
|
||
export default withRouter(ApplicationForUsers); |
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
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,11 @@ | ||
const proxy = require("http-proxy-middleware"); | ||
|
||
module.exports = function(app) { | ||
app.use( | ||
proxy("api/v1", { | ||
target: "https://animal-hello-3000.codio-box.uk", | ||
secure: false, | ||
changeOrigin: true | ||
}) | ||
); | ||
}; |