You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
3.8KB

  1. <?= $this->extend('templates/baseAdmin') ?>
  2. <?= $this->section('headLibraries') ?>
  3. <link rel="stylesheet" href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css">
  4. <link rel="stylesheet" href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css">
  5. <?= $this->endSection() ?>
  6. <?= $this->section('content') ?>
  7. <h1><?= $tituloEncuesta ?></h1>
  8. <div class="card">
  9. <div class="card-body">
  10. <table id="table-respuestas" class="table table-bordered table-striped">
  11. <thead>
  12. <th>ID Prestador</th>
  13. <th>Nombre</th>
  14. <th>Fecha</th>
  15. <?php foreach ($preguntas as $pregunta) : ?>
  16. <th><?= $pregunta['question'] ?></th>
  17. <?php endforeach ?>
  18. </thead>
  19. <tbody>
  20. <?php foreach ($respuestas as $user) : ?>
  21. <tr>
  22. <td><?= $user[0][0]['idprestador'] ?></td>
  23. <td><?= $user[0][0]['nombre'] . ' ' . $user[0][0]['apaterno'] . ' ' . $user[0][0]['amaterno'] ?></td>
  24. <td><?= $user[0][0]['created_at'] ?></td>
  25. <?php foreach ($user as $respuesta) : ?>
  26. <!-- Respuestas de opción múltiple -->
  27. <?php if ($respuesta[0]['type'] === '3') : ?>
  28. <td>
  29. <?php foreach ($respuesta as $opcion) : ?>
  30. <?= $opcion['answer'] ?>
  31. <br>
  32. <?php endforeach ?>
  33. </td>
  34. <?php else : ?>
  35. <td><?= $respuesta[0]['answer'] ?></td>
  36. <?php endif ?>
  37. <?php endforeach ?>
  38. </tr>
  39. <?php endforeach ?>
  40. </tbody>
  41. </table>
  42. </div>
  43. </div>
  44. <?= $this->endSection() ?>
  45. <?= $this->section('scripts') ?>
  46. <script src="https://code.jquery.com/jquery-3.5.1.js"></script>
  47. <script src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js"></script>
  48. <script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
  49. <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
  50. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
  51. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
  52. <script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
  53. <script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
  54. <script>
  55. $(document).ready(function() {
  56. $('#table-respuestas').DataTable({
  57. dom: 'Bfrtip',
  58. buttons: [
  59. 'excel', 'pdf',
  60. ],
  61. language: {
  62. "decimal": "",
  63. "emptyTable": "No hay información",
  64. "info": "Mostrando _START_ a _END_ de _TOTAL_ registros",
  65. "infoEmpty": "Mostrando 0 to 0 of 0 registros",
  66. "infoFiltered": "(Filtrado de _MAX_ total registros)",
  67. "infoPostFix": "",
  68. "thousands": ",",
  69. "lengthMenu": "Mostrar _MENU_ registros",
  70. "loadingRecords": "Cargando...",
  71. "processing": "Procesando...",
  72. "search": "Buscar:",
  73. "zeroRecords": "No se encontraron resultados",
  74. "paginate": {
  75. "first": "Primero",
  76. "last": "Ultimo",
  77. "next": "Siguiente",
  78. "previous": "Anterior"
  79. }
  80. },
  81. });
  82. });
  83. </script>
  84. <?= $this->endSection() ?>