import React from "react"; import { Formik } from "formik"; import * as Yup from "yup"; import axios from "axios"; import Head from "next/head"; import { EanfrageSchema } from "../components/forms/schemas.jsx"; import IntroForm from "../components/forms/eanfrageforms/introform.jsx"; import ContactPersonForm from "../components/forms/eanfrageforms/contactperson.jsx"; import PartForm from "../components/forms/eanfrageforms/partform.jsx"; import Summary from "../components/forms/eanfrageforms/summary.jsx"; export default class Eanfrage extends React.Component { constructor(props) { super(props); this._renderStepContent = this._renderStepContent.bind(this); this._handleForward = this._handleForward.bind(this); this._handleBackwards = this._handleBackwards.bind(this); this.state = { rescode: null, statustext: null, activeStep: 0, disabled: false, }; } _renderStepContent( step, values, isSubmitting, handleChange, handleBlur, touched, errors, setFieldValue ) { switch (step) { case 0: return ; case 1: return ( ); case 2: return ( ); case 3: return ; default: return
Not Found
; } } _handleForward() { this.setState({ activeStep: this.state.activeStep + 1, }); } _handleBackwards() { this.setState({ activeStep: this.state.activeStep - 1, }); } render() { return ( <> eAnfrage - Prothmann GmbH
{ console.log(values, errors); // const data = values; // try { // const res = await axios({ // method: "post", // url: "/api/contactsend", // headers: { // "Content-Type": "application/json", // }, // data, // }); // this.setState({ // status: "Ihre Nachricht wurde erfolgreich versendet", // res: res.status, // }); // } catch (error) { // this.setState({ // status: // "Beim versenden ist ein Fehler aufgetreten! Bitte versuchen Sie es in einigen Minuten noch einmal oder schicken Sie und direkt eine e-Mail.", // res: res.status, // }); // } }} > {({ values, errors, touched, handleChange, handleBlur, handleSubmit, isSubmitting, setFieldValue, }) => (
{this._renderStepContent( this.state.activeStep, values, isSubmitting, handleChange, handleBlur, touched, errors, setFieldValue )}
{this.state.activeStep !== 3 ? ( ) : ( )}
)}
); } }