Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from "react";
- import PropTypes from "prop-types";
- import { graphql, createFragmentContainer } from "react-relay";
- import AdditionalEdit from "../edit";
- class AdditionalFormContainer extends React.PureComponent {
- static propTypes = {
- additionalInfo: PropTypes.instanceOf(Object).isRequired,
- };
- flattenData = (additionalInfo) => {
- const {
- insurance_company,
- insurance_number,
- date_last_medical_check,
- blood_type: { value: blood_type },
- health_issues,
- } = additionalInfo.medical_information;
- return {
- insurance_company,
- insurance_number,
- date_last_medical_check,
- blood_type,
- health_issues,
- };
- };
- render() {
- const { additionalInfo, ...rest } = this.props;
- const flatAdditionalInfo = this.flattenData(this.props.additionalInfo);
- return <AdditionalEdit additionalInfo={flatAdditionalInfo} {...rest} />;
- }
- }
- // TODO: find/add missing fields in query - driving license type/number
- // other/previous employment and safety training
- export default createFragmentContainer(
- AdditionalFormContainer,
- graphql`
- fragment AdditionalInformation_additionalInfo on Person {
- medical_information {
- blood_type {
- value
- }
- health_issues
- date_last_medical_check
- insurance_company
- insurance_number
- }
- }
- `,
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement