<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Responder</title>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/style.css">
</head>
<body>
    <nav class="navbar navbar-light bg-primary">
        <a class="navbar-brand" href="/">
            <img id="logo" src="/img/logo.png" alt="Logo do site">
        </a>
    </nav>
    <div class="container">
        <hr>
        <h1><%= pergunta.titulo %></h1>
        <p><%= pergunta.descricao %></p>
        <hr>
        <form method="POST" action="/resposta">
            <textarea name="corpo" placeholder="Digite sua resposta" class="form-control"></textarea>
            <input type="hidden" name="idpergunta" value="<%= pergunta.id %>">
            <button type="submit" class="btn btn-ptimary">Responder</button>
        </form>
        <hr>
        <h3>Resposta: </h3>
        <% resposta.forEach(resposta => { %>
            <br>
            <div class="card">
                <div class="card-body">
                    <%= resposta.createdAt %>
                    <p><%= resposta.corpo %></p>
                </div>
            </div>

        <% }) %>
    </div>
</body>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
</html>