forked from laisgarc/podcome
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnew-restaurant.html
More file actions
179 lines (161 loc) · 6.88 KB
/
new-restaurant.html
File metadata and controls
179 lines (161 loc) · 6.88 KB
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
172
173
174
175
176
177
178
179
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<link rel="shortcut icon" href="imgs/logo.png">
<title>Comer Melhor</title>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet">
<link rel="stylesheet" href="css/form.css">
<script>
function createRestaurant() {
const user = document.getElementById("user").value;
const password = document.getElementById("password").value;
const name = document.getElementById("restaurant_name").value;
const address = document.getElementById("restaurant_address").value;
const contact = document.getElementById("restaurant_contact").value;
let price = '';
let restriction = '';
let delivery = false;
const price_radio_buttons = document.querySelectorAll('input[name="price"]');
for (const price_radio_button of price_radio_buttons) {
if (price_radio_button.checked) {
price = price_radio_button.value;
break;
}
}
const restriction_radio_buttons = document.querySelectorAll('input[name="restriction"]');
for (const restriction_radio_button of restriction_radio_buttons) {
if (restriction_radio_button.checked) {
restriction = restriction_radio_button.value;
break;
}
}
const delivery_radio_buttons = document.querySelectorAll('input[name="delivery"]');
for (const delivery_radio_button of delivery_radio_buttons) {
if (delivery_radio_buttons.checked) {
if(delivery_radio_buttons.value=="possui_entrega"){
delivery = true;
}
else{
delivery = false;
}
}
}
let xhttp = new XMLHttpRequest();
xhttp.open("POST", "http://127.0.0.1:8080/api/v1/restaurantes/adicionar", true);
xhttp.setRequestHeader("Content-type", "application/json");
infos = JSON.stringify({
"nome":name,
"endereco":address,
"restricao":restriction,
"latitude":-23.581292,
"longitude":-46.677041,
"preco":price,
"nota":4,
"temEntrega":delivery,
"contato":contact,
"usuario":user,
"senha":password
});
xhttp.send(infos);
}
</script>
</head>
<body>
<div class="testbox">
<form>
<div class="banner">
<h1>Novo Restaurante</h1>
</div>
<br/>
<div class="item">
<label for="user">Usuario<span>*</span></label>
<input id="user" type="text" name="restaurant_name" />
</div>
<div class="item">
<label for="password">Senha<span>*</span></label>
<input id="password" type="text" name="restaurant_name" />
</div>
<div class="item">
<label for="restaurant_name"> Nome do Restaurante<span>*</span></label>
<input id="restaurant_name" type="text" name="restaurant_name" />
</div>
<div class="item">
<label for="restaurant_address">Endereço do Restaurante<span>*</span></label>
<input id="restaurant_address" type="text" name="restaurant_address" />
</div>
<div class="item">
<label for="restaurant_contact">Contato do Restaurante<span>*</span></label>
<input id="restaurant_contact" type="text" name="restaurant_contact" />
</div>
<div class="question">
<label>Faixa de preço do seu restaurante:</label>
<div class="question-answer">
<div>
<input type="radio" value="$" id="$" name="price"/>
<label for="$" class="radio"><span>$</span></label>
</div>
<div>
<input type="radio" value="$$" id="$$" name="price"/>
<label for="$$" class="radio"><span>$$</span></label>
</div>
<div>
<input type="radio" value="$$$" id="$$$" name="price"/>
<label for="$$$" class="radio"><span>$$$</span></label>
</div>
<div>
<input type="radio" value="$$$$" id="$$$$" name="price"/>
<label for="$$$$" class="radio"><span>$$$$</span></label>
</div>
<div>
<input type="radio" value="$$$$$" id="$$$$$" name="price"/>
<label for="$$$$$" class="radio"><span>$$$$$</span></label>
</div>
</div>
</div>
<div class="question">
<label>Qual desses é verdade sobre seu restaurante?</label>
<div class="question-answer">
<div>
<input type="radio" value="feira_livre" id="feira_livre" name="restriction"/>
<label for="feira_livre" class="radio"><span>Meu restaurante faz parte de uma feira livre.</span></label>
</div>
<div>
<input type="radio" value="vegano" id="vegano" name="restriction"/>
<label for="vegano" class="radio"><span>Meu restaurante possui pratos para veganos.</span></label>
</div>
<div>
<input type="radio" value="celiaco" id="celiaco" name="restriction"/>
<label for="celiaco" class="radio"><span>Meu restaurante possui pratos para celíacos.</span></label>
</div>
<div>
<input type="radio" value="diabetico" id="diabetico" name="restriction"/>
<label for="diabetico" class="radio"><span>Meu restaurante possui pratos para diabéticos.</span></label>
</div>
<div>
<input type="radio" value="lactose" id="lactose" name="restriction"/>
<label for="lactose" class="radio"><span>Meu restaurante possui pratos para intolerantes à lactose.</span></label>
</div>
</div>
</div>
<div class="question">
<label>Restaurante possui entrega?</label>
<div class="question-answer">
<div>
<input type="radio" value="possui_entrega" id="possui_entrega" name="delivery"/>
<label for="possui_entrega" class="radio"><span>Sim.</span></label>
</div>
<div>
<input type="radio" value="nao_possui_entrega" id="nao_possui_entrega" name="delivery"/>
<label for="nao_possui_entrega" class="radio"><span>Não.</span></label>
</div>
</div>
</div>
<div>
<button type="submit" onclick="createRestaurant()" formaction="/login.html">Criar Restaurante</button>
<button type='submit' formaction="/index.html"> Voltar </button>
</div>
</form>
</div>
</body>
</html>