<!DOCTYPE html>
    <%- include("partials/header.ejs") %>
    <body>
        <title>Stock Management | Bodega</title>

	<h1  class="title">Tabla de Stock de productos </h1>
        <div class ="table-container">
            <table class = "table table-striped table-bordered" id = "sortTable">
                <thead>
                    <tr>
                        <th scope="col">#</th>
                        <th scope ="col">nombre</th>
                        <th scope ="col">stock (Actualizar)</th>
                    </tr>
                </thead>
                <tbody>
                <% for(var i=0; i < prods.length; i++) { %>
                    <tr>
                        <div id="prod<%= prods[i].codigo %>">
                            <td><%= prods[i].codigo %></td>
                            <td><%= prods[i].nombre %></td>
                            <td>
                                <p><%= prods[i].stock %></p>
                                <form method="POST" role="form" action="/">
                                    <div class="form-group" style="width: 8rem;">
                                        <input name="codigo" type="hidden" value="<%= prods[i].codigo %>">
                                        <input type="number" name="stock" class="form-control" placeholder="<%= prods[i].stock %>">
                                        <button type="submit" class="btn btn-outline-dark">Modificar</button>
                                    </div>
                                </form>
                            </td>
                        </div> 
                    </tr>
                <% } %>
                </tbody>
            </table>
        </div>
        <script>
            $('#sortTable').DataTable();
        </script>
    </body>
</html>
