import React, { Component } from "react"; import { withRouter, } from "react-router-dom"; import { Row, Col, } from 'react-bootstrap' class PhonePage extends Component { constructor(props) { super(props); this.textInputTelefono = React.createRef(); this.state = { inputTel: '', inputAlias: '', editPhoneStatus: false, indexInput: 0 } } componentDidMount() { const { formValidate } = this.props.initState; const { isValidate,input } = formValidate; if(isValidate){ if(input==="telefono"){ this.textInputTelefono.current.focus(); } } } onChangeParentData(opt, event) { const { arrDatos } = this.props.initState const { telefono } = arrDatos if(opt === 'titulo') telefono.titulo = event.target.value; this.props.initsetState({ arrDatos }) } onAdd() { const { arrDatos } = this.props.initState const { telefono } = arrDatos const { inputTel, inputAlias } = this.state if(inputTel === '' || inputAlias === '') { alert('Datos incompletos') return false } telefono.telefono.push({ telefono: inputTel, titulo: inputAlias, }) this.props.initsetState({ arrDatos }) this.setState({ inputTel: '', inputAlias: '', }) this.checkMarkValues(); } onDeleteEmail(index) { let { arrDatos } = this.props.initState let { telefono } = arrDatos telefono.telefono.splice(index, 1); this.props.initsetState({ arrDatos }) } onEditPhone(index){ if(this.state.editPhoneStatus==false){ this.state.indexInput = index this.setState({ editPhoneStatus: true }) }else{ this.setState({ editPhoneStatus: false }) } } checkMarkValues(){ const { arrDatos,arrCheck } = this.props.initState const { email,telefono,whatsapp } = arrDatos if(email.email.length > 0 && telefono.telefono.length > 0 && whatsapp.whatsapp.length > 0){ arrCheck[4].checkMark = true; }else{ arrCheck[4].checkMark = false; } } makeList(item, index) { const { arrDatos } = this.props.initState const { telefono } = arrDatos return (
{item.titulo}
) }{item.telefono}
) }{item.mensaje}
Teléfono
Leyenda del Botón
Alias
Número de teléfono *
{ this.onAdd(); } } style={{backgroundColor:"#ff0350 !important;",color:"#fff"}} >Agregar teléfono