Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.05 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import { Container, Row, Col, Card, CardBody, FormGroup, Button, Breadcrumb, BreadcrumbItem } from 'reactstrap';
  3. import { AvForm, AvField, AvInput } from 'availity-reactstrap-validation';
  4. import { Link, withRouter } from 'react-router-dom';
  5. import { connect } from 'react-redux';
  6. import { activateAuthLayout } from '../../store/actions';
  7.  
  8. class TFSupport extends Component {
  9. constructor(props){
  10. super(props);
  11. this.state = {
  12. 'name': '',
  13. 'email': '',
  14. 'phone': '',
  15. 'orgnization': '',
  16. 'ticket': '',
  17. 'submitted': false,
  18. }
  19. this.changeField = this.changeField.bind(this)
  20. this.submitTicket = this.submitTicket.bind(this)
  21. this.resetField = this.resetField.bind(this)
  22. }
  23.  
  24. changeField(){
  25.  
  26. }
  27.  
  28. submitTicket(){
  29.  
  30. // also turn the submitted true
  31. // after 3 seconds, change to false
  32. }
  33.  
  34. resetField(){
  35. this.setState({
  36. 'name': '',
  37. 'email': '',
  38. 'phone': '',
  39. 'orgnization': '',
  40. 'ticket': '',
  41. })
  42. }
  43.  
  44. componentDidMount() {
  45. this.props.activateAuthLayout();
  46. }
  47.  
  48. render(){
  49. return(
  50. <React.Fragment>
  51. <Container fluid>
  52.  
  53. <div className="page-title-box">
  54. <Row className="align-items-center">
  55. <Col sm='6'>
  56. <h4 className="page-title">Submit Support Ticket</h4>
  57. <Breadcrumb>
  58. <BreadcrumbItem><Link to="/dashboard">Dashboard</Link></BreadcrumbItem>
  59. <BreadcrumbItem active>Support</BreadcrumbItem>
  60. </Breadcrumb>
  61. </Col>
  62. </Row>
  63. </div>
  64.  
  65. <Row>
  66. <Col md="12">
  67. <Card>
  68. <CardBody>
  69. <h4 className="mt-0 header-title">Support Ticket</h4>
  70. <p className="text-muted m-b-30">Please detail the issue and Trueface will reach out ASAP.</p>
  71.  
  72. <AvForm>
  73. <AvField
  74. name="name"
  75. label="Name "
  76. type="text"
  77. errorMessage="Please enter name"
  78. validate={{ required: { value: true } }}
  79. onChange={this.changeField}
  80. />
  81. <AvField
  82. name="email"
  83. label="Email "
  84. type="email"
  85. errorMessage="Invalid Email"
  86. validate = {{ required: { value: true }, email: { value: true } }}
  87. onChange={this.changeField}
  88. />
  89. <AvField
  90. name="phone"
  91. label="Phone "
  92. type="number"
  93. errorMessage="Invalid Phone Number"
  94. validate = {{ required: { value: true }, pattern: { value: '^[0-9]+$', errorMessage: 'Only Digits' } }}
  95. />
  96. <AvField
  97. name="organization"
  98. label="Organization "
  99. type="text"
  100. errorMessage="Please Enter Organization"
  101. validate={{ required: { value: true } }}
  102. onChange={this.changeField}
  103. />
  104. <AvInput
  105. name="ticket"
  106. label="Ticket "
  107. type="textarea"
  108. errorMessage="Please Enter Ticket"
  109. validate={{ required: { value: true } }}
  110. onChange={this.changeField}
  111. />
  112. <FormGroup className="mb-0">
  113. <div>
  114. <Button
  115. type="submit"
  116. color="primary"
  117. className="mr-1"
  118. >
  119. Submit
  120. </Button>{' '}
  121. <Button
  122. type="reset"
  123. color="secondary"
  124. onClick={this.resetField}
  125. >
  126. Cancel
  127. </Button>
  128. </div>
  129. </FormGroup>
  130. </AvForm>
  131. </CardBody>
  132. { this.state.submitted && <h6>Ticket Submitted</h6>}
  133. </Card>
  134. </Col>
  135. </Row>
  136. </Container>
  137. </React.Fragment>
  138. )
  139. }
  140. }
  141.  
  142. export default withRouter(connect(null, { activateAuthLayout })(TFSupport));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement