<commit_before>import React, {Component} from 'react';
import Errors from './Errors.jsx';
import FullMemberDeclarationText from './declaration-text/FullMemberDeclarationText.jsx';
import OtherMemberDeclarationText from './declaration-text/OtherMemberDeclarationText.jsx';

export default class ConfirmDetails extends Component {
    constructor(props) {
        super(props);
        this.getFullAddress = this.getFullAddress.bind(this);
        this.submitMember = this.submitMember.bind(this);
        this.getDeclaration = this.getDeclaration.bind(this);
        this.state = {
            errors: []
        };
    }

    getFullAddress(addressObj){
        return addressObj.address + ', '
            + addressObj.suburb + ', '
            + addressObj.state + ', '
            + addressObj.country + ', '
            + addressObj.postcode;
    }

    submitMember() {
        if(this.refs.declarationConfirmation.checked) {
            this.props.postAndContinue(this.props.formValues);
        }
        else {
            this.setState({errors:["Please click the declaration checkbox and check that your details are correct before continuing."]});
        }
    }

    getDeclaration() {
      if(this.props.formValues.membershipType === 'full'){
          return <FullMemberDeclarationText />;
      }
      return <OtherMemberDeclarationText />;
    }

    render() {
        return <fieldset>
            <h1 className="form-title">Confirm</h1>

            <div className="form-body">
                <Errors invalidFields={this.state.errors} />
                <div className="heading">
                    <h2 className="sub-title">Declaration </h2>
                    <i> Read the following and click the checkbox below.</i>
                </div>
                <div className="declaration">
                  {this.getDeclaration()}
                </div>
                <label className={this.state.errors.length > 0 ? "invalid" : ""} id="checkbox_declaration">
                    <input type="checkbox" name="circumstance" ref="declarationConfirmation"/>
                    <b>I confirm that I am enrolled to vote in federal elections and consent to my information being sent
                    to the Australian Electoral Commission.</b><span className="mandatoryField">* </span>
                </label>
                <div className="heading">
                    <h2 className="sub-title">Check Your Details</h2>
                    <i>Please enter all the data you have entered is correct. It is a serious offence to make a false declaration.</i>
                </div>
                <div className="declaration">
                    <div className="declaration-text">
                        <b> Name: </b> {this.props.formValues.firstName} {this.props.formValues.lastName} <br/>
                        <b> DOB: </b> {this.props.formValues.dateOfBirth} <br/>
                        <b> Gender: </b> {this.props.formValues.gender} <br/>
                        <b> Residential Address: </b> {this.getFullAddress(this.props.formValues.residentialAddress)} <br/>
                        <b> Postal Address: </b> {this.getFullAddress(this.props.formValues.postalAddress)} <br/>
                        <b> Email: </b> {this.props.formValues.email} <br/>
                        <b> Phone: </b> {this.props.formValues.primaryPhoneNumber} <br/>
                    </div>
                </div>
                <div className="navigation">
                    <button onClick={this.submitMember}>My details are correct</button>
                    <p>or <a onClick={this.props.previousStep} href="#">go back to change your details</a></p>
                </div>
            </div>
        </fieldset>
    }
}<commit_msg>Added id to back button<commit_after>import React, {Component} from 'react';
import Errors from './Errors.jsx';
import FullMemberDeclarationText from './declaration-text/FullMemberDeclarationText.jsx';
import OtherMemberDeclarationText from './declaration-text/OtherMemberDeclarationText.jsx';

export default class ConfirmDetails extends Component {
    constructor(props) {
        super(props);
        this.getFullAddress = this.getFullAddress.bind(this);
        this.submitMember = this.submitMember.bind(this);
        this.getDeclaration = this.getDeclaration.bind(this);
        this.state = {
            errors: []
        };
    }

    getFullAddress(addressObj){
        return addressObj.address + ', '
            + addressObj.suburb + ', '
            + addressObj.state + ', '
            + addressObj.country + ', '
            + addressObj.postcode;
    }

    submitMember() {
        if(this.refs.declarationConfirmation.checked) {
            this.props.postAndContinue(this.props.formValues);
        }
        else {
            this.setState({errors:["Please click the declaration checkbox and check that your details are correct before continuing."]});
        }
    }

    getDeclaration() {
      if(this.props.formValues.membershipType === 'full'){
          return <FullMemberDeclarationText />;
      }
      return <OtherMemberDeclarationText />;
    }

    render() {
        return <fieldset>
            <h1 className="form-title">Confirm</h1>

            <div className="form-body">
                <Errors invalidFields={this.state.errors} />
                <div className="heading">
                    <h2 className="sub-title">Declaration </h2>
                    <i> Read the following and click the checkbox below.</i>
                </div>
                <div className="declaration">
                  {this.getDeclaration()}
                </div>
                <label className={this.state.errors.length > 0 ? "invalid" : ""} id="checkbox_declaration">
                    <input type="checkbox" name="circumstance" ref="declarationConfirmation"/>
                    <b>I confirm that I am enrolled to vote in federal elections and consent to my information being sent
                    to the Australian Electoral Commission.</b><span className="mandatoryField">* </span>
                </label>
                <div className="heading">
                    <h2 className="sub-title">Check Your Details</h2>
                    <i>Please enter all the data you have entered is correct. It is a serious offence to make a false declaration.</i>
                </div>
                <div className="declaration">
                    <div className="declaration-text">
                        <b> Name: </b> {this.props.formValues.firstName} {this.props.formValues.lastName} <br/>
                        <b> DOB: </b> {this.props.formValues.dateOfBirth} <br/>
                        <b> Gender: </b> {this.props.formValues.gender} <br/>
                        <b> Residential Address: </b> {this.getFullAddress(this.props.formValues.residentialAddress)} <br/>
                        <b> Postal Address: </b> {this.getFullAddress(this.props.formValues.postalAddress)} <br/>
                        <b> Email: </b> {this.props.formValues.email} <br/>
                        <b> Phone: </b> {this.props.formValues.primaryPhoneNumber} <br/>
                    </div>
                </div>
                <div className="navigation">
                    <button onClick={this.submitMember}>My details are correct</button>
                    <p>or <a onClick={this.props.previousStep} id='go-back' href="#">go back to change your details</a></p>
                </div>
            </div>
        </fieldset>
    }
}
{'fraction_non_alphanumeric': 0.12279069767441861, 'fraction_numerical': 0.0018604651162790699, 'mean_word_length': 1.8935024990388312, 'pattern_counts': {'":': 0, '<': 129, '<?xml version=': 0, '>': 131, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3601113', 'n_tokens_mistral': 1981, 'n_tokens_neox': 1887, 'n_words': 441}