Ei kuvausta

table.html 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <html>
  2. <!-- empieza los includes -->
  3. <head>
  4. <title>Draft</title>
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <meta charset="UTF-8">
  7. <link rel="icon" href="/../Icon.ico" sizes="32x32">
  8. <!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> -->
  9. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
  10. <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
  11. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
  12. <!-- <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> -->
  13. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
  14. <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
  15. <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular-sanitize.js"></script>
  16. <!-- el .css -->
  17. <link rel="stylesheet" href="{{ url_for('static', filename='estilo.css') }}" />
  18. <!-- los .js que quiero usar -->
  19. <script type="text/javascript" src="{{ url_for('static', filename=jscript) }}"></script>
  20. <script>
  21. // la variable 'pagina' la usa el javascript para que el run.py sepa cual python file abrir.
  22. // este python file se encarga de comunicarse con la base de datos.
  23. table.value("pagina", "{{pagina}}")
  24. </script>
  25. {% raw %}
  26. <!-- {{headers}} -->
  27. <!-- {{tabla}} -->
  28. <!-- {{info}} -->
  29. <!-- {{modal}} -->
  30. <!-- {{modal_content}} -->
  31. {% endraw %}
  32. </head>
  33. <!-- termina los includes -->
  34. <body ng-app="table" ng-controller="tableController">
  35. <nav class="navbar navbar-dark bg-dark navbar-expand">
  36. {% raw %}
  37. <a class="navbar-brand" href="{{info.dash_link}}">{{info.dash_name}}</a>
  38. {% endraw %}
  39. </nav>
  40. <div class="container-fluid">
  41. <div class="row" >
  42. <h1>
  43. {% raw %}
  44. {{info.dash_sub_name}}
  45. {% endraw %}
  46. </h1>
  47. </div>
  48. <div class="row" >
  49. <div class="col-2" >
  50. <div class="topnav">
  51. <!-- ################################ con ayuda de w3schools:
  52. How TO - Filter/Search Table-->
  53. <input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search..">
  54. <script>
  55. function myFunction() {
  56. // Declare variables
  57. var input, filter, table, tr, td1, td2, td3, i, txtValue1, txtValue2, txtValue3;
  58. input = document.getElementById("myInput");
  59. filter = input.value.toUpperCase();
  60. table = document.getElementById("tabla");
  61. tr = table.getElementsByTagName("tr");
  62. // Loop through all table rows, and hide those who don't match the search query
  63. for (i = 0; i < tr.length; i++) {
  64. td1 = tr[i].getElementsByTagName("td")[0];
  65. td2 = tr[i].getElementsByTagName("td")[1];
  66. td3 = tr[i].getElementsByTagName("td")[2];
  67. if (td1 || td2 || td3) {
  68. txtValue1 = td1.textContent || td1.innerText;
  69. txtValue2 = td2.textContent || td2.innerText;
  70. txtValue3 = td3.textContent || td3.innerText;
  71. if ((txtValue1.toUpperCase().indexOf(filter) > -1) ||
  72. (txtValue2.toUpperCase().indexOf(filter) > -1) ||
  73. (txtValue3.toUpperCase().indexOf(filter) > -1)) {
  74. tr[i].style.display = "";
  75. } else {
  76. tr[i].style.display = "none";
  77. }
  78. }
  79. }
  80. }
  81. </script>
  82. <!-- ################################ -->
  83. </div>
  84. </div>
  85. <div class="col-2" >
  86. <!-- <button href='./' type="submit">Submit</button> -->
  87. </div>
  88. <div class="col-4" >
  89. {% raw %}
  90. <a class="btn button boton mr-4" href="{{info.add_link}}">{{info.add}}</a>
  91. {% endraw %}
  92. </div>
  93. </div>
  94. <div class="row" >
  95. <div class="col" >
  96. <table id='tabla'>
  97. <tr>
  98. {% raw %}
  99. <th ng-repeat="header in headers" class="header2">{{header.nombre}}</th>
  100. {% endraw %}
  101. </tr>
  102. <tr ng-repeat="row in tabla">
  103. {% raw %}
  104. <!-- la proxima linea asume que las entradas en la tabla tienen un id unico con -->
  105. <!-- el mismo nombre de identificador a traves de los javascript, json, etc. -->
  106. <td ng-repeat="stat in row" ng-if="stat != row.user_id">
  107. <div ng-bind-html="stat"></div>
  108. </td>
  109. <td><button type="button" class="btn2 boton mr-4" name="button" data-toggle="modal" data-target="#myModalv{{row.user_id}}">Ver mas</button></td>
  110. <td><a type="button" class="btn2 boton mr-4" href="{{info.dir2}}{{row.user_id}}">Editar</a></td>
  111. {% endraw %}
  112. </tr>
  113. </table>
  114. </div>
  115. </div>
  116. </div>
  117. </body>
  118. <!-- comienza modal -->
  119. {% raw %}
  120. <div ng-repeat="row in modal_content" id="myModalv{{row.user_id}}" class="modal fade">
  121. <div class="modal-dialog">
  122. <!-- Modal content-->
  123. <div class="modal-content">
  124. <div class="modal-header bg2">
  125. <button type="button" class="close" data-dismiss="modal">&times;</button>
  126. <h4 class="modal-title">{{modal.infoName}}</h4>
  127. </div>
  128. <div class="modal-body bg1">
  129. <!-- <div ng-bind-html="stat"></div> -->
  130. <form action="#">
  131. <div ng-repeat="(key, value) in row" ng-if="value != row.user_id">
  132. <label for="{{key}}">{{key}}:</label><br>
  133. <input type="text" id="{{key}}" name="{{key}}" value="{{value}}" readonly><br>
  134. </div>
  135. </form>
  136. </div>
  137. <div class="modal-footer bg2">
  138. <button type="button" class="btn btn-default boton" data-dismiss="modal">Close</button>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. {% endraw %}
  144. <!-- termina modal -->
  145. </html>