Commit bd176c04 by Marcos Teles

Inserindo HTML do cadastro

parent cff0ab04
<!DOCTYPE html> <!DOCTYPE html>
<html lang="pt-BR"> <html lang="pt-BR">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
...@@ -9,26 +10,48 @@ ...@@ -9,26 +10,48 @@
<link href="https://fonts.googleapis.com/css2?family=Lexend:wght@100..900&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Lexend:wght@100..900&display=swap" rel="stylesheet">
<title>Dishly</title> <title>Dishly</title>
</head> </head>
<body> <body>
<h1>Cadastro com Imagem</h1> <h1>Cadastro com Imagem</h1>
<div class="actions">
<a href="/" class="btn btn-primary">Voltar</a>
</div>
<form id="formCadastro"> <form id="formCadastro">
<input type="text" id="nome" placeholder="Digite o nome" required> <input type="text" id="nome" placeholder="Digite o nome" required><br>
<input type="text" id="procoes" placeholder="Porcões" required> <input type="text" id="porcoes" placeholder="Porções" required><br>
<input type="text" id="procoes" placeholder="Tempo de preparo" required> <input type="text" id="tempo" placeholder="Tempo de preparo" required><br>
<input type="text" id="procoes" placeholder="Descrição da receita" required> <textarea id="descricao" placeholder="Descrição da receita" required></textarea><br>
<input type="text" id="procoes" placeholder="Ingredientes utilizados" required> <input type="text" id="ad_ingrediente" placeholder="Ingrediente">
<button onclick="adicionar()">Adicionar</button>
<input type="text" id="procoes" placeholder="Modo de preparo" required> <br><br>
<textarea id="ingredientes" rows="10" cols="30" readonly></textarea><br>
<script>
function adicionar() {
let texto = document.getElementById("ad_ingrediente").value;
let textarea = document.getElementById("ingredientes");
<input type="file" id="imagem" accept="image/*" required> textarea.value += "- " + texto + "\n";
document.getElementById("ad_ingrediente").value = "";
}
</script>
<textarea id="preparo" placeholder="Modo de preparo" required></textarea><br>
<input type="file" id="imagem" accept="image/*" required><br>
<button type="submit">Cadastrar</button> <button type="submit">Cadastrar</button>
</form> </form>
<button type="reset">Apagar Dados</button>
<div class="cards" id="lista"></div> <div class="cards" id="lista"></div>
...@@ -36,7 +59,7 @@ ...@@ -36,7 +59,7 @@
const form = document.getElementById("formCadastro"); const form = document.getElementById("formCadastro");
const lista = document.getElementById("lista"); const lista = document.getElementById("lista");
form.addEventListener("submit", function(e) { form.addEventListener("submit", function (e) {
e.preventDefault(); e.preventDefault();
const nome = document.getElementById("nome").value; const nome = document.getElementById("nome").value;
...@@ -46,7 +69,7 @@ ...@@ -46,7 +69,7 @@
const leitor = new FileReader(); const leitor = new FileReader();
leitor.onload = function(evento) { leitor.onload = function (evento) {
const card = document.createElement("div"); const card = document.createElement("div");
card.classList.add("card"); card.classList.add("card");
...@@ -66,4 +89,5 @@ ...@@ -66,4 +89,5 @@
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment