-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformulario.html
171 lines (160 loc) · 8.05 KB
/
formulario.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Defina Seu Estilo</title>
<link rel="stylesheet" href="css/estilos.css">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
</head>
<body>
<header class="formu">
<div class="logo">
<a href="index.html">
<img src="imagens/logo-form.png" alt="Logo">
</a>
</div>
<nav class="navigation">
<a href="#"><a href="index.html">Início</a>
</nav>
</header>
<main class="escolha">
<section class="hero">
<h1>Defina Seu Estilo</h1>
<p>Descubra o estilo perfeito para cada ocasião.</p>
</section>
<section class="form-section">
<form id="preferencesForm">
<div class="form-group">
<label for="genero">Qual é o seu gênero?</label>
<select id="genero" name="genero">
<option value="Masculino">Masculino</option>
<option value="Feminino">Feminino</option>
<option value="Outro">Prefiro não dizer</option>
</select>
</div>
<div class="form-group">
<label for="tipoCorporal">Qual é o seu tipo de corpo?</label>
<select id="tipoCorporal" name="tipoCorporal">
<option value="Small">Small</option>
<option value="Mid size">Mid size</option>
<option value="Plus size">Plus size</option>
</select>
</div>
<div class="form-group">
<label for="formatoCorporal">Qual é o seu formato de corpo?</label>
<select id="formatoCorporal" name="formatoCorporal">
<option value="Ampulheta">Ampulheta</option>
<option value="Triângulo">Triângulo</option>
<option value="Triângulo invertido">Triângulo invertido</option>
<option value="Oval">Oval</option>
<option value="Retângulo">Retângulo</option>
</select>
</div>
<div class="form-group">
<label for="estiloPrincipal">Qual é o seu estilo principal?</label>
<select id="estiloPrincipal" name="estiloPrincipal">
<option value="Elegante/Clássico">Elegante/Clássico</option>
<option value="Vintage/Retrô">Vintage/Retrô</option>
<option value="Urbano/Streetwear">Urbano/Streetwear</option>
<option value="Boho/Despojado">Boho/Despojado</option>
<option value="Casual">Casual</option>
<option value="Esportivo">Esportivo</option>
<option value="Minimalista">Minimalista</option>
</select>
</div>
<div class="form-group">
<label for="pecaFrequente">Qual peça de roupa você usa com mais frequência?</label>
<select id="pecaFrequente" name="pecaFrequente">
<option value="Camisa">Camisa</option>
<option value="Calça">Calça</option>
<option value="Saia">Saia</option>
<option value="Vestido">Vestido</option>
<option value="Outro">Outro</option>
</select>
</div>
<div class="form-group">
<label for="corPreferida">Qual cor você prefere usar?</label>
<select id="corPreferida" name="corPreferida">
<option value="Branco">Branco</option>
<option value="Preto">Preto</option>
<option value="Cinza">Cinza</option>
<option value="Vermelho">Vermelho</option>
<option value="Verde">Verde</option>
<option value="Rosa">Rosa</option>
<option value="Roxo">Roxo</option>
<option value="Amarelo">Amarelo</option>
<option value="Laranja">Laranja</option>
<option value="Marrom">Marrom</option>
<option value="Outro">Outro</option>
</select>
</div>
<div class="form-group">
<label for="estiloEvitar">Há algum estilo que você gostaria de evitar?</label>
<select id="estiloEvitar" name="estiloEvitar">
<option value="Elegante/Clássico">Elegante/Clássico</option>
<option value="Vintage/Retrô">Vintage/Retrô</option>
<option value="Urbano/Streetwear">Urbano/Streetwear</option>
<option value="Boho/Despojado">Boho/Despojado</option>
<option value="Casual">Casual</option>
<option value="Esportivo">Esportivo</option>
<option value="Minimalista">Minimalista</option>
</select>
</div>
<div class="form-group">
<label for="ocasiaoComum">Qual a ocasião mais comum para se vestir?</label>
<select id="ocasiaoComum" name="ocasiaoComum">
<option value="Trabalho">Trabalho</option>
<option value="Festa">Festa</option>
<option value="Evento social">Evento social</option>
<option value="Academia">Academia</option>
<option value="Casual diário">Casual diário</option>
<option value="Outro">Outro</option>
</select>
</div>
<button type="submit" class="link-botao">Enviar</button>
</form>
</section>
</main>
<script>
document.getElementById('preferencesForm').addEventListener('submit', async (e) => {
e.preventDefault();
const token = localStorage.getItem('token');
if (!token) {
alert('Você precisa estar logado para salvar suas preferências');
window.location.href = 'entrar.html';
return;
}
const formData = {
tipoCorporal: document.getElementById('tipoCorporal').value,
formatoCorporal: document.getElementById('formatoCorporal').value,
estiloPrincipal: document.getElementById('estiloPrincipal').value,
pecaFrequente: document.getElementById('pecaFrequente').value,
corPreferida: document.getElementById('corPreferida').value,
estiloEvitar: document.getElementById('estiloEvitar').value,
ocasiaoComum: document.getElementById('ocasiaoComum').value
};
try {
const response = await fetch('https://backend-style-btm7.onrender.com/preferences', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify(formData)
});
if (response.ok) {
alert('Preferências salvas com sucesso!');
window.location.href = 'perfil.html';
} else {
const data = await response.json();
alert(data.error || 'Erro ao salvar preferências');
}
} catch (error) {
console.error('Erro:', error);
alert('Erro ao salvar preferências');
}
});
</script>
</body>
</html>