From 0e40093aca3fca7f701778669cb6cbd8ae99f845 Mon Sep 17 00:00:00 2001 From: Hugo Oliveira Date: Fri, 9 Feb 2024 16:52:09 +0000 Subject: [PATCH] Update #9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Formulário finalizado, com todas as restrições necessárias --- high-green-power/src/App.tsx | 67 +++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/high-green-power/src/App.tsx b/high-green-power/src/App.tsx index aad511d..34f63d3 100644 --- a/high-green-power/src/App.tsx +++ b/high-green-power/src/App.tsx @@ -7,7 +7,7 @@ import { Box, Container, Grid, Typography, Button, Stepper, Step, StepLabel } fr import { useFormik } from 'formik'; import { useState } from "react"; import { matchIsValidTel } from 'mui-tel-input'; -//import axios from "axios"; +import axios from "axios"; interface dados { @@ -132,6 +132,7 @@ function App() { zipcode: values.codigoPostal, location: values.cidade, country: values.pais, + email: values.emailDP, contacts: [{ name: values.nomePessoaContacto, email: values.emailPessoaContacto, @@ -144,17 +145,17 @@ function App() { console.log('Dados API:', extractedData); - /*try { + try { // Make a POST request using Axios - const response = await axios.post('https://dev-hgp-sgi.streamline.pt/api/entities', extractedData); + const response = await axios.post('https://dev-hgp-sgi.streamline.pt/api/pendings', extractedData); console.log('Data submitted successfully', response.data); } catch (error) { // Handle errors console.error('Error submitting data:', error); - }*/ - + } + }; const formik = useFormik ({ @@ -205,6 +206,7 @@ function App() { } if (formik.values.tiporegisto == '1'){ + formik.values.empresa = '', formik.values.nomePessoaContacto = formik.values.representante; formik.values.telemovelPC = formik.values.telemovelDP; formik.values.emailPessoaContacto = formik.values.emailDP; @@ -265,59 +267,62 @@ function App() { ))} -
- - - {getStepContent(activeStep)} - + + + + {getStepContent(activeStep)} + - {validationErrors.map((error, index) => ( - ( + - {error} - - ))} + {error} + + ))} - {(activeStep < steps.length - 1) && ( + + {(activeStep > 0) && (activeStep < steps.length) && ( - )} - + {(activeStep === steps.length - 1) && ( - - )} - - {(activeStep > 0) && (activeStep < steps.length) && ( + {(activeStep < steps.length - 1) && ( - )} - +
+ +