|
|
@ -7,6 +7,7 @@ import { Box, Container, Grid, Typography, Button, Stepper, Step, StepLabel } fr
|
|
|
|
import { useFormik } from 'formik';
|
|
|
|
import { useFormik } from 'formik';
|
|
|
|
import { useState } from "react";
|
|
|
|
import { useState } from "react";
|
|
|
|
import { matchIsValidTel } from 'mui-tel-input';
|
|
|
|
import { matchIsValidTel } from 'mui-tel-input';
|
|
|
|
|
|
|
|
import axios from "axios";
|
|
|
|
|
|
|
|
|
|
|
|
interface dados {
|
|
|
|
interface dados {
|
|
|
|
|
|
|
|
|
|
|
@ -115,9 +116,35 @@ function App() {
|
|
|
|
...schemaStep3.fields,
|
|
|
|
...schemaStep3.fields,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const onSubmit = (values: dados) => {
|
|
|
|
const onSubmit = async (values: dados) => {
|
|
|
|
console.log('Dados: ', values);
|
|
|
|
// Extract the specific data you want from the form values
|
|
|
|
}
|
|
|
|
const extractedData = {
|
|
|
|
|
|
|
|
name: values.empresa,
|
|
|
|
|
|
|
|
address: values.morada,
|
|
|
|
|
|
|
|
taxNumber: values.nif,
|
|
|
|
|
|
|
|
legal: values.representante,
|
|
|
|
|
|
|
|
line: values.andar,
|
|
|
|
|
|
|
|
zipcode: values.codigoPostal,
|
|
|
|
|
|
|
|
location: values.cidade,
|
|
|
|
|
|
|
|
country: values.pais,
|
|
|
|
|
|
|
|
contacts: [{
|
|
|
|
|
|
|
|
name: values.nomePessoaContacto,
|
|
|
|
|
|
|
|
email: values.emailPessoaContacto,
|
|
|
|
|
|
|
|
phone: values.telemovelPC,
|
|
|
|
|
|
|
|
}]
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
// Make a POST request using Axios
|
|
|
|
|
|
|
|
const response = await axios.post('https://dev-hgp-sgi.streamline.pt/api/entities', extractedData);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log('Data submitted successfully', response.data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
|
|
// Handle errors
|
|
|
|
|
|
|
|
console.error('Error submitting data:', error);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const formik = useFormik<dados> ({
|
|
|
|
const formik = useFormik<dados> ({
|
|
|
|
validateOnMount: true,
|
|
|
|
validateOnMount: true,
|
|
|
|