forked from CSCDP/family-context-api
-
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.
Merge pull request CSCDP#9 from SocialFinanceDigitalLabs/populate-det…
…ails-from-endpoint FAM-49: Populate personal details from api
- Loading branch information
Showing
6 changed files
with
58 additions
and
16 deletions.
There are no files selected for viewing
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 @@ | ||
[0224/172050.165:ERROR:crash_report_database_win.cc(428)] unexpected header |
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 |
---|---|---|
@@ -1,23 +1,46 @@ | ||
import React from 'react'; | ||
import BasicDetails from '../components/BasicDetails'; | ||
import PersonDetails from '../models/PersonDetails'; | ||
import { RouteComponentProps } from 'react-router-dom'; | ||
import ApiClient from '../clients/ApiClient'; | ||
import BackButton from '../components/BackButton'; | ||
import ServiceInvolvementDetailsSummary from '../models/ServiceInvolvementDetailsSummary'; | ||
import ServiceInvolvement from '../components/ServiceInvolvement'; | ||
import ServiceInvolvementDetails from '../models/ServiceInvolvementDetails'; | ||
import { RouteComponentProps } from 'react-router-dom'; | ||
import BackButton from '../components/BackButton'; | ||
|
||
const IndividualPage: React.FC<RouteComponentProps> = (props) => { | ||
let person: PersonDetails = { address: "17 Lighthorne Road \n Stockport \n SK3 0QD", dateOfBirth: "10/07/2012", ethnicity: "Jedi", firstName: "Charlie", gender: "Male", id: 10, lastName: "Brooks" } | ||
let serviceInvolvementDetailsSummary: ServiceInvolvementDetailsSummary = { service:"Adult Social Care", syncedDuraction: "31/10/2017-04/11/2019", syncedWith: "CIS", correctAsOf: "04/11/2019 at 23.59"} | ||
let serviceInvolvementDetails: ServiceInvolvementDetails = {serviceInvolvementDetailsSummary: serviceInvolvementDetailsSummary, serviceInvolvementContent: person} | ||
return ( | ||
<div className="IndividualPage"> | ||
{BackButton(props)} | ||
<BasicDetails personDetails={person}></BasicDetails> | ||
<ServiceInvolvement serivceInvolvementDetails={serviceInvolvementDetails} /> | ||
</div> | ||
); | ||
interface PersonParams { | ||
personId?: string | ||
} | ||
|
||
class IndividualPage extends React.Component<RouteComponentProps<PersonParams> & { client: ApiClient }, PersonDetails> { | ||
|
||
constructor(props: RouteComponentProps<PersonParams> & { client: ApiClient }) { | ||
super(props); | ||
this.state = { address: "loading...", ethnicity: "loading...", firstName: "loading...", gender: "loading...", id: -1, lastName: "loading...", dateOfBirth: "loading..." } | ||
} | ||
|
||
|
||
componentDidMount() { | ||
let personId = this.props.match.params.personId | ||
if (personId) { | ||
this.props.client.getPerson(personId).then(personDetails => { | ||
this.setState(personDetails); | ||
}); | ||
} | ||
} | ||
|
||
render() { | ||
let serviceInvolvementDetailsSummary: ServiceInvolvementDetailsSummary = { service: "Adult Social Care", syncedDuraction: "31/10/2017-04/11/2019", syncedWith: "CIS", correctAsOf: "04/11/2019 at 23.59" } | ||
let serviceInvolvementDetails: ServiceInvolvementDetails = { serviceInvolvementDetailsSummary: serviceInvolvementDetailsSummary, serviceInvolvementContent: this.state } | ||
|
||
return ( | ||
<div className="IndividualPage"> | ||
<BackButton {...this.props} /> | ||
<BasicDetails personDetails={this.state}></BasicDetails> | ||
<ServiceInvolvement serivceInvolvementDetails={serviceInvolvementDetails} /> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default IndividualPage; |