  <div class="modal fade bd-example-modal-lg" id="myModal2" role="dialog">
    <div class="modal-dialog modal-xl">   
      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <!--<h1 class="modal-title">Modal Header</h1> -->
        </div>
        <div class="modal-body">
          <div class="container">
            <div class="row">
              <div class="col-lg-12">
                <div class="card shadow-lg p-3 mb-5 bg-white ">
                  <div class="card-header">Listado de Maquinas disponibles</div>
                  <div class="card-body">
                    <!-- COMIENZO DEL FORMULARIO -->
                    <form id="lismaquinasform" action="" method="POST" class="needs-validation" novalidate>
                      <div class="container mt-3">
                        <h2>Listado de Maquinas</h2>
                        <input class="form-control" id="myInput" type="text" value = "" placeholder="Search..">
                        <br>
                        <table class="table table-hover">
                          <thead>
                            <tr>
                              <th>ID</th>
                              <th>Descripcion</th>
                              <th>codigo</th>
                            </tr>
                          </thead>
                          <tbody id="myTable">
                            {{#each lista}}
                            {{#each lista_maquinas}}
                            <tr>
                              <td> {{id_maquina}}</td>
                              <td> {{descripcion}}</td>
                              <td >{{codigo}}</td>
                            </tr>
                            {{/each}}
                            {{/each}}
                          </tbody>
                        </table>
                      </div>
                    </form>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
      </div>
    </div>
  </div>
{{!-- scripts para el catalogo de maquinas --}}
  <script>

    $(document).ready(function () {
      $("#myInput").on("keyup", function () {
        var value = $(this).val().toLowerCase();
        
        $("#myTable tr").filter(function () {
          $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
        });
      });
    });    
    
 </script>

 
<script>

var table = document.getElementById('myTable');
for(var i = 0; i < table.rows.length; i++) {
  table.rows[i].addEventListener('click', function() {
    var id_maq = '';
    var des_maquina = '';
    id_maq = this.cells[0].innerHTML;
    des_maquina = this.cells[1].innerHTML;
    document.getElementsByName('idmaquina')[0].value = id_maq.trim();
    document.getElementsByName('des-maquina')[0].value = des_maquina.trim();
    $("#myModal2").modal("hide");
  });
}
</script>
