render() {
    if (this.state.redirect) {
        return <Redirect to={this.state.redirect} />
    }

    return (
        <Container>
            <h1 className="h2">Recipient's Details</h1>
            <Form onSubmit={this.handleSubmit}>
                <Row className="mb-3">
                    <Form.Group as={Col}>
                        <Form.Label htmlFor="first_name">First Name</Form.Label>
                        <Form.Control type="text" name="first_name"
                            onChange={this.handleChange} required placeholder="Enter First Name" />
                    </Form.Group>

                    <Form.Group as={Col}>
                        <Form.Label htmlFor="last_name">Last Name</Form.Label>
                        <Form.Control type="text" name="last_name"
                        onChange={this.handleChange} required placeholder="Enter Last Name" />
                    </Form.Group>
                </Row>

                <Row className="mb-3">
                    <Form.Group as={Col} className="mb-3" controlId="formGridPhone">
                        <Form.Label>Phone Number</Form.Label>
                        
                        <Form.Control  type="tel" pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}"
                        onChange={this.handlePhoneChange} value={this.state.phone}
                        required placeholder="402-345-6789" name="phone" maxlength="12"/>
                    </Form.Group>

                    <Form.Group as={Col}>
                        <Form.Label htmlFor="quantity">Quantity</Form.Label> 
                        <Form.Control type="number" onChange={this.handleChange} 
                        required name="quantity" min="1"/>
                    </Form.Group>
                </Row>

                

                <Form.Group className="mb-3">
                    <Form.Label htmlFor="address">Address</Form.Label>
                    <Form.Control type="text" name="location" id="address"
                    onChange={this.handleObjectChange} required placeholder="1234 Main St" />
                </Form.Group>

                <Row className="mb-3" key="address_data">
                    <Form.Group as={Col} >
                        <Form.Label htmlFor="room_number">Apartment Number</Form.Label>
                        <Form.Control type="text" name="location" id="room_number"
                        onChange={this.handleObjectChange} placeholder="Apt #" />
                    </Form.Group>
                    
                    <Form.Group as={Col}>
                        <Form.Label htmlFor="is_center">Central Location?</Form.Label> 
                        <Form.Select onChange={this.handleObjectChange}
                            name="location" id="is_center" >
                            <option>No</option>
                            <option>Yes</option>
                        </Form.Select>
                    </Form.Group>
                </Row>

                <Row className="mb-3">
                    <Form.Group as={Col}>
                        <Form.Label htmlFor="city">City</Form.Label>
                        <Form.Control type="text" name="location" id="city"
                        onChange={this.handleObjectChange} required />
                    </Form.Group>

                    <Form.Group as={Col} >
                        <Form.Label htmlFor="state">State</Form.Label>
                        <Form.Select onChange={this.handleObjectChange}
                           required name="location" id="state">
                        { this.states.map( s => 
                            <option>{s}</option>
                        )}
                        </Form.Select>
                    </Form.Group>

                    <Form.Group as={Col}>
                        <Form.Label htmlFor="zipcode">Zip</Form.Label>
                        <Form.Control type="text" pattern="[0-9]{5}" onChange={this.handleZipcodeChange} 
                            required name="location" id="zipcode" placeholder="#####" maxlength="5"/>
                    </Form.Group>
                </Row>

                <Row className="mb-3">
                <InputGroup>
                    <InputGroup.Text>Comments</InputGroup.Text>
                    <FormControl as="textarea" aria-label="With textarea" 
                    value={this.state.comments}
                                name="comments" onChange={this.handleChange}/>
                </InputGroup>
                </Row>

                <Form.Group className="mb-3" id="formGridCheckbox">
                    <Row><Form.Label>Languages</Form.Label></Row>
                        { this.languages.map( l => 
                            <Form.Check type="checkbox" inline label={l} id={l}
                                 name="language" onChange={this.handleLanguageChange}  
                                 checked={this.checkLanguage(l)} />
                        )}
                </Form.Group>

                <Button variant="primary" className="mr-4" type="submit">Submit</Button>
                <Link to="/data">
                    <Button variant="secondary">Cancel</Button>
                </Link>
            </Form>
        </Container>
        );
    }
/**
 * The render method used to display the component. 
 * @returns The HTML to be rendered.
 */
The render method used to display the component.
@returns The HTML to be rendered.
The render method used to display the component . @returns The HTML to be rendered .
render() {
    if (this.state.redirect) {
        return <Redirect to={this.state.redirect} />
    }
    return (
        <Container>
            <h1 className="h2">Recipient's Details</h1>
            <Form onSubmit={this.handleSubmit}>
                <Row className="mb-3">
                    <Form.Group as={Col}>
                        <Form.Label htmlFor="first_name">First Name</Form.Label>
                        <Form.Control type="text" name="first_name"
                            onChange={this.handleChange} required placeholder="Enter First Name" />
                    </Form.Group>
                    <Form.Group as={Col}>
                        <Form.Label htmlFor="last_name">Last Name</Form.Label>
                        <Form.Control type="text" name="last_name"
                        onChange={this.handleChange} required placeholder="Enter Last Name" />
                    </Form.Group>
                </Row>
                <Row className="mb-3">
                    <Form.Group as={Col} className="mb-3" controlId="formGridPhone">
                        <Form.Label>Phone Number</Form.Label>
                        <Form.Control  type="tel" pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}"
                        onChange={this.handlePhoneChange} value={this.state.phone}
                        required placeholder="402-345-6789" name="phone" maxlength="12"/>
                    </Form.Group>
                    <Form.Group as={Col}>
                        <Form.Label htmlFor="quantity">Quantity</Form.Label> 
                        <Form.Control type="number" onChange={this.handleChange} 
                        required name="quantity" min="1"/>
                    </Form.Group>
                </Row>
                <Form.Group className="mb-3">
                    <Form.Label htmlFor="address">Address</Form.Label>
                    <Form.Control type="text" name="location" id="address"
                    onChange={this.handleObjectChange} required placeholder="1234 Main St" />
                </Form.Group>
                <Row className="mb-3" key="address_data">
                    <Form.Group as={Col} >
                        <Form.Label htmlFor="room_number">Apartment Number</Form.Label>
                        <Form.Control type="text" name="location" id="room_number"
                        onChange={this.handleObjectChange} placeholder="Apt #" />
                    </Form.Group>
                    <Form.Group as={Col}>
                        <Form.Label htmlFor="is_center">Central Location?</Form.Label> 
                        <Form.Select onChange={this.handleObjectChange}
                            name="location" id="is_center" >
                            <option>No</option>
                            <option>Yes</option>
                        </Form.Select>
                    </Form.Group>
                </Row>
                <Row className="mb-3">
                    <Form.Group as={Col}>
                        <Form.Label htmlFor="city">City</Form.Label>
                        <Form.Control type="text" name="location" id="city"
                        onChange={this.handleObjectChange} required />
                    </Form.Group>
                    <Form.Group as={Col} >
                        <Form.Label htmlFor="state">State</Form.Label>
                        <Form.Select onChange={this.handleObjectChange}
                           required name="location" id="state">
                        { this.states.map( s => 
                            <option>{s}</option>
                        )}
                        </Form.Select>
                    </Form.Group>
                    <Form.Group as={Col}>
                        <Form.Label htmlFor="zipcode">Zip</Form.Label>
                        <Form.Control type="text" pattern="[0-9]{5}" onChange={this.handleZipcodeChange} 
                            required name="location" id="zipcode" placeholder="#####" maxlength="5"/>
                    </Form.Group>
                </Row>
                <Row className="mb-3">
                <InputGroup>
                    <InputGroup.Text>Comments</InputGroup.Text>
                    <FormControl as="textarea" aria-label="With textarea" 
                    value={this.state.comments}
                                name="comments" onChange={this.handleChange}/>
                </InputGroup>
                </Row>
                <Form.Group className="mb-3" id="formGridCheckbox">
                    <Row><Form.Label>Languages</Form.Label></Row>
                        { this.languages.map( l => 
                            <Form.Check type="checkbox" inline label={l} id={l}
                                 name="language" onChange={this.handleLanguageChange}  
                                 checked={this.checkLanguage(l)} />
                        )}
                </Form.Group>
                <Button variant="primary" className="mr-4" type="submit">Submit</Button>
                <Link to="/data">
                    <Button variant="secondary">Cancel</Button>
                </Link>
            </Form>
        </Container>
        );
    }
render ( ) { if ( this . state . redirect ) { return < Redirect to = { this . state . redirect } / > } return ( < Container > < h1 className = "h2" > Recipient's Details < / h1 > < Form onSubmit = { this . handleSubmit } > < Row className = "mb-3" > < Form . Group as = { Col } > < Form . Label htmlFor = "first_name" > First Name < / Form . Label > < Form . Control type = "text" name = "first_name" onChange = { this . handleChange } required placeholder = "Enter First Name" / > < / Form . Group > < Form . Group as = { Col } > < Form . Label htmlFor = "last_name" > Last Name < / Form . Label > < Form . Control type = "text" name = "last_name" onChange = { this . handleChange } required placeholder = "Enter Last Name" / > < / Form . Group > < / Row > < Row className = "mb-3" > < Form . Group as = { Col } className = "mb-3" controlId = "formGridPhone" > < Form . Label > Phone Number < / Form . Label > < Form . Control type = "tel" pattern = "[0-9]{3}-[0-9]{3}-[0-9]{4}" onChange = { this . handlePhoneChange } value = { this . state . phone } required placeholder = "402-345-6789" name = "phone" maxlength = "12" / > < / Form . Group > < Form . Group as = { Col } > < Form . Label htmlFor = "quantity" > Quantity < / Form . Label > < Form . Control type = "number" onChange = { this . handleChange } required name = "quantity" min = "1" / > < / Form . Group > < / Row > < Form . Group className = "mb-3" > < Form . Label htmlFor = "address" > Address < / Form . Label > < Form . Control type = "text" name = "location" id = "address" onChange = { this . handleObjectChange } required placeholder = "1234 Main St" / > < / Form . Group > < Row className = "mb-3" key = "address_data" > < Form . Group as = { Col } > < Form . Label htmlFor = "room_number" > Apartment Number < / Form . Label > < Form . Control type = "text" name = "location" id = "room_number" onChange = { this . handleObjectChange } placeholder = "Apt #" / > < / Form . Group > < Form . Group as = { Col } > < Form . Label htmlFor = "is_center" > Central Location? < / Form . Label > < Form . Select onChange = { this . handleObjectChange } name = "location" id = "is_center" > < option > No < / option > < option > Yes < / option > < / Form . Select > < / Form . Group > < / Row > < Row className = "mb-3" > < Form . Group as = { Col } > < Form . Label htmlFor = "city" > City < / Form . Label > < Form . Control type = "text" name = "location" id = "city" onChange = { this . handleObjectChange } required / > < / Form . Group > < Form . Group as = { Col } > < Form . Label htmlFor = "state" > State < / Form . Label > < Form . Select onChange = { this . handleObjectChange } required name = "location" id = "state" > { this . states . map ( s => < option > { s } < / option > ) } < / Form . Select > < / Form . Group > < Form . Group as = { Col } > < Form . Label htmlFor = "zipcode" > Zip < / Form . Label > < Form . Control type = "text" pattern = "[0-9]{5}" onChange = { this . handleZipcodeChange } required name = "location" id = "zipcode" placeholder = "#####" maxlength = "5" / > < / Form . Group > < / Row > < Row className = "mb-3" > < InputGroup > < InputGroup . Text > Comments < / InputGroup . Text > < FormControl as = "textarea" aria-label = "With textarea" value = { this . state . comments } name = "comments" onChange = { this . handleChange } / > < / InputGroup > < / Row > < Form . Group className = "mb-3" id = "formGridCheckbox" > < Row > < Form . Label > Languages < / Form . Label > < / Row > { this . languages . map ( l => < Form . Check type = "checkbox" inline label = { l } id = { l } name = "language" onChange = { this . handleLanguageChange } checked = { this . checkLanguage ( l ) } / > ) } < / Form . Group > < Button variant = "primary" className = "mr-4" type = "submit" > Submit < / Button > < Link to = "/data" > < Button variant = "secondary" > Cancel < / Button > < / Link > < / Form > < / Container > ) ; }
The render method used to display the component.
The render method used to display the component .