|
|
|
@ -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<dados> ({
|
|
|
|
@ -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() {
|
|
|
|
|
))}
|
|
|
|
|
</Stepper>
|
|
|
|
|
|
|
|
|
|
<form onSubmit={formik.handleSubmit}>
|
|
|
|
|
|
|
|
|
|
<Box sx={{ pb: 2 }}>
|
|
|
|
|
{getStepContent(activeStep)}
|
|
|
|
|
</Box>
|
|
|
|
|
<form onSubmit={formik.handleSubmit}>
|
|
|
|
|
|
|
|
|
|
<Box sx={{ pb: 2 }}>
|
|
|
|
|
{getStepContent(activeStep)}
|
|
|
|
|
</Box>
|
|
|
|
|
|
|
|
|
|
{validationErrors.map((error, index) => (
|
|
|
|
|
<Box
|
|
|
|
|
{validationErrors.map((error, index) => (
|
|
|
|
|
<Box
|
|
|
|
|
sx={{ mt: 1, color: 'red'}}
|
|
|
|
|
key={index}>
|
|
|
|
|
{error}
|
|
|
|
|
</Box>
|
|
|
|
|
))}
|
|
|
|
|
{error}
|
|
|
|
|
</Box>
|
|
|
|
|
))}
|
|
|
|
|
|
|
|
|
|
{(activeStep < steps.length - 1) && (
|
|
|
|
|
<Box
|
|
|
|
|
style={{
|
|
|
|
|
display: 'flex',
|
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
marginTop: '3rem',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
{(activeStep > 0) && (activeStep < steps.length) && (
|
|
|
|
|
<Button
|
|
|
|
|
type="button"
|
|
|
|
|
variant="contained"
|
|
|
|
|
onClick={handleNext}
|
|
|
|
|
sx={{ mt: 3, ml: 1 }}
|
|
|
|
|
onClick={handleBack}
|
|
|
|
|
>
|
|
|
|
|
Avançar
|
|
|
|
|
Retroceder
|
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{(activeStep === steps.length - 1) && (
|
|
|
|
|
|
|
|
|
|
<Button
|
|
|
|
|
type="submit"
|
|
|
|
|
variant="contained"
|
|
|
|
|
sx={{ mt: 3, ml: 1 }}
|
|
|
|
|
>
|
|
|
|
|
Finalizar
|
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{(activeStep > 0) && (activeStep < steps.length) && (
|
|
|
|
|
|
|
|
|
|
{(activeStep < steps.length - 1) && (
|
|
|
|
|
<Button
|
|
|
|
|
type="button"
|
|
|
|
|
variant="contained"
|
|
|
|
|
onClick={handleBack}
|
|
|
|
|
sx={{ mt: 3, ml: 1 }}
|
|
|
|
|
onClick={handleNext}
|
|
|
|
|
style={{ marginLeft: 'auto' }}
|
|
|
|
|
>
|
|
|
|
|
Retroceder
|
|
|
|
|
Avançar
|
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
</form>
|
|
|
|
|
</Box>
|
|
|
|
|
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
|
|
|
|