
<div class="shadow border border-secondary rounded"
    style=" max-height: 530px;">

    <div class="text-center row justify-content-end p-2">
        <div class="col-10">
            <b class="display-6 text-light ">Lista de
                Semillas</b>
        </div>
        <div class="col-auto my-2 px-3">
            <button type="button"
                class="btn"
                style="background-color: rgb(76, 175, 80);"
                data-bs-toggle="modal"
                data-bs-target="#modCrear">Crear</button>
            <%- include('./modal.ejs') %>
        </div>

    </div>

    <div>

        <table class="table table-borderless text-center table-dark "
            style="width: 998px; height: 400px; display: grid; overflow-x: hidden; ">

            <thead class="border border-secondary text-light container"
                style=" width: 998px; height: 42px;">
                <tr class="row">
                    <th class="col-1">ID</th>
                    <th class="col-2">Nombre de semilla</th>
                    <th class="col-3">Fecha de plantado</th>
                    <th class="col-1">PH ideal</th>
                    <th class="col-2">Cantidad semilla</th>
                    <th class="col-2">Acciones</th>
                </tr>
            </thead>

            <tbody class="text-light container text-center"
                style="width: 998px; max-height: 400px; display: grid; overflow-x: auto;">
                <% dataSemilla.forEach(item => { %>
                <tr class="row align-items-start">
                    <td class="col-1">
                        <%= item.idSemilla %>
                    </td>
                    <td class="col-2">
                        <%= item.nombreSemilla %>
                    </td>
                    <td class="col-3">
                        <%= item.fechaPlantado %>
                    </td>
                    <td class="col-1">
                        <%= item.phIdeal %> pH
                    </td>
                    <td class="col-2">
                        <%= item.cantidadSemilla %> kg.
                    </td>

                    <td class="col-3">

                        <div class="container">
                            <div class="row">
                                <div class="col-auto">
                                    <button type="button"
                                        class="btn"
                                        style="background-color: rgb(76, 175, 80);"
                                        data-bs-toggle="modal"
                                        data-bs-target="#del<%- item.idSemilla %>">Borrar</button>
                                </div>

                                <div class="modal fade"
                                    id="del<%= item.idSemilla %>" tabindex="-1"
                                    aria-labelledby="exampleModalLabel"
                                    aria-hidden="true">
                                    <div class="modal-dialog">
                                        <div class="modal-content bg-dark">
                                            <div class="modal-header">
                                                <h5 class="modal-title"
                                                    id="exampleModalLabel">Borrar
                                                    Semilla</h5>
                                                <button type="button"
                                                    class="btn-close"
                                                    data-bs-dismiss="modal"
                                                    aria-label="Close"></button>
                                            </div>
                                            <div class="modal-body fs-5">
                                                <p>¿Estás seguro de borrar la
                                                    semilla con ID: <b><%-
                                                        item.idSemilla%></b>?</p>
                                            </div>
                                            <div class="modal-footer">
                                                <button type="button"
                                                    class="btn btn-secondary"
                                                    data-bs-dismiss="modal">Cancelar</button>
                                                <form
                                                    action="/home/createseed/delete/<%- item.idSemilla %>"
                                                    method="post">
                                                    <button type="submit"
                                                        class="btn btn-danger">Borrar</button>
                                                </form>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <!-- MODIFICAR -->
                                <div class="col-auto">
                                    <button type="button"
                                        class="btn"
                                        style="background-color: rgb(76, 175, 80);"
                                        data-bs-toggle="modal"
                                        data-bs-target="#mod<%- item.idSemilla %>">Modificar</button>
                                </div>

                                <div class="modal fade"
                                    id="mod<%= item.idSemilla %>" tabindex="-1"
                                    aria-labelledby="exampleModalLabel"
                                    aria-hidden="true">
                                    <div class="modal-dialog">
                                        <div class="modal-content bg-dark">
                                            <div class="modal-header">
                                                <h5 class="modal-title"
                                                    id="exampleModalLabel">Borrar
                                                    Semilla</h5>
                                                <button type="button"
                                                    class="btn-close"
                                                    data-bs-dismiss="modal"
                                                    aria-label="Close"></button>
                                            </div>
                                            <div class="modal-body fs-5">
                                                <%- include('./form.ejs') %>
                                            </div>
                                            <div class="modal-footer">
                                                <button type="button"
                                                    class="btn btn-secondary"
                                                    data-bs-dismiss="modal">Cancelar</button>
                                                <form
                                                    action="/home/createseed/update/<%- item.idSemilla %>"
                                                    method="post">
                                                    <button type="submit"
                                                        class="btn btn-primary">Modificar</button>
                                                </form>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                            </div>
                        </div>

                    </td>
                </tr>
                <% }) %>
            </tbody>
        </table>

    </div>

</div>
