avatar
Butt shb2

Guest 18 4th Dec, 2019

MARKUP 5.64 KB
                                           
                         import React from 'react'
import RegisterForm from './RegisterForm'
import { Switch, Radio, Button, Typography } from 'antd'
import { connect } from 'react-redux'
import { push } from 'react-router-redux'
import './style.scss'
import { ENGLISH_LABELS, URDU_LABELS } from '../../../constants/labels.constants'

const { Title } = Typography
const {state1} = this.props.location.loginErrorFlag

class Register extends React.Component {
  state = {
    language: 'english',
    gender: '',
    validIqama: '',
    IsIqamaRegistered : false
  }



  genderCheck = () => {
    if (this.state.gender === '' || this.state.validIqama === '') {



      return (

       
        <div className="text-center mt-3" defaultValue="">
{console.log(state1)}

          <Title level={4}>
            {this.state.language === 'english'
              ? ENGLISH_LABELS.SELECT_GENDER_TEXT
              : URDU_LABELS.SELECT_GENDER_TEXT} 
          </Title>
          <Radio.Group
            className="text-center mt-2 mb-3"
            onChange={e => this.setState({ gender: e.target.value })}
          >
            <Radio value="male">
              {this.state.language === 'english' ? ENGLISH_LABELS.MALE : URDU_LABELS.MALE}
            </Radio>
            <Radio className="ml-5" value="female">
              {this.state.language === 'english' ? ENGLISH_LABELS.FEMALE : URDU_LABELS.FEMALE}
            </Radio>
          </Radio.Group>
          <Title level={4} className="mt-3">
            {this.state.language === 'english'
              ? ENGLISH_LABELS.VALID_IQAMA
              : URDU_LABELS.VALID_IQAMA}
          </Title>
          <Radio.Group
            className="text-center mt-2 mb-3"
            onChange={e => this.setState({ validIqama: e.target.value })}
          >
            <Radio value="yes">{this.state.language === 'english' ? 'Yes' : 'جی ہاں'}</Radio>
            <Radio className="ml-5" value="no">
              {this.state.language === 'english' ? 'No' : 'نہیں'}
            </Radio>
          </Radio.Group>
        </div>
      )
    } else if (this.state.gender === 'male' && this.state.validIqama === 'yes') {
      return <RegisterForm language={this.state.language} />
    } else if (this.state.gender === 'female' || this.state.validIqama === 'no') {
      return (
        <div className="text-center mt-3">
          {this.state.gender === 'female' ? (
            <Title level={4} type="danger">
              {this.state.language === 'english'
                ? ENGLISH_LABELS.FEMALE_VOLUNTEERS_TEXT
                : URDU_LABELS.FEMALE_VOLUNTEERS_TEXT}
            </Title>
          ) : (
            undefined
          )}
          {this.state.validIqama === 'no' ? (
            <Title level={4} type="danger">
              {this.state.language === 'english'
                ? ENGLISH_LABELS.VALID_IQAMA_TEXT
                : URDU_LABELS.VALID_IQAMA_TEXT}
            </Title>
          ) : (
            undefined
          )}
          <Button onClick={() => this.props.goToLogin()} className="mt-2 mb-3">
            Go Back
          </Button>
        </div>
      )
    }
  }

  render() {
    return (
      <div className="login login--fullscreen">
        <div className="login__block">
          <div className="row">
            <div className="col-xl-12">
              <div className="login__block__promo text-black text-center">
                <h1 className="mb-3 text-black">
                  <a href="/">
                    <img src="resources/images/logo-login.png" alt="PHVG Razakar" />
                  </a>
                  <br />
                  <br />
                  <strong>WELCOME TO PHVG RAZAKAR</strong>
                </h1>
              </div>
              <div className="login__block__inner">
                <div className="login__block__form">
                  <div className="float-right">
                    <Switch
                      onChange={checked =>
                        checked
                          ? this.setState({ language: 'urdu' })
                          : this.setState({ language: 'english' })
                      }
                    />
                    <span className="ml-3">اردو</span>
                  </div>
                  <h4 className="text-uppercase">
                    <strong>Register with us</strong>
                  </h4>
                  <br />
                  {this.genderCheck()}
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    )
  }
}
const mapStateToProps = state => ({
  requiredData: state.reducer.requiredData,
})
const mapDispatchToProps = dispatch => ({
  goToLogin: () => {
    dispatch(push('/'))
  },
})
export default connect(
  mapStateToProps,
  mapDispatchToProps,
)(Register)
                      
                                       
To share this paste please copy this url and send to your friends
RAW Paste Data
Recent Pastes