Browse Source

Opción para descargar PDF o Excel

encuestas-excel
Sergio 2 years ago
parent
commit
2484732678
2 changed files with 39 additions and 33 deletions
  1. +35
    -31
      app/Views/Admin/respuestasGenerales.php
  2. +4
    -2
      app/Views/templates/baseAdmin.php

+ 35
- 31
app/Views/Admin/respuestasGenerales.php View File

@@ -1,10 +1,15 @@
<?= $this->extend('templates/baseAdmin') ?> <?= $this->extend('templates/baseAdmin') ?>


<?= $this->section('content') ?>

<?= $this->section('headLibraries') ?>


<link rel="stylesheet" href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css"> <link rel="stylesheet" href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css"> <link rel="stylesheet" href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css">


<?= $this->endSection() ?>

<?= $this->section('content') ?>

<h1><?= $tituloEncuesta ?></h1> <h1><?= $tituloEncuesta ?></h1>


<div class="card"> <div class="card">
@@ -48,6 +53,13 @@
</div> </div>
</div> </div>





<?= $this->endSection() ?>

<?= $this->section('scripts') ?>

<script src="https://code.jquery.com/jquery-3.5.1.js"></script> <script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script> <script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
@@ -62,38 +74,30 @@
$('#table-respuestas').DataTable({ $('#table-respuestas').DataTable({
dom: 'Bfrtip', dom: 'Bfrtip',
buttons: [ buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
'excel', 'pdf',
],
language: {
"decimal": "",
"emptyTable": "No hay información",
"info": "Mostrando _START_ a _END_ de _TOTAL_ registros",
"infoEmpty": "Mostrando 0 to 0 of 0 registros",
"infoFiltered": "(Filtrado de _MAX_ total registros)",
"infoPostFix": "",
"thousands": ",",
"lengthMenu": "Mostrar _MENU_ registros",
"loadingRecords": "Cargando...",
"processing": "Procesando...",
"search": "Buscar:",
"zeroRecords": "No se encontraron resultados",
"paginate": {
"first": "Primero",
"last": "Ultimo",
"next": "Siguiente",
"previous": "Anterior"
}
},
}); });
}); });
// document.addEventListener('DOMContentLoaded', function() {
// let table = new DataTable('#table-respuestas', {
// 'buttons': ['excel'],
// 'searching': true,
// 'ordering': true,
// 'language': {
// "decimal": "",
// "emptyTable": "No hay información",
// "info": "Mostrando _START_ a _END_ de _TOTAL_ registros",
// "infoEmpty": "Mostrando 0 to 0 of 0 registros",
// "infoFiltered": "(Filtrado de _MAX_ total registros)",
// "infoPostFix": "",
// "thousands": ",",
// "lengthMenu": "Mostrar _MENU_ registros",
// "loadingRecords": "Cargando...",
// "processing": "Procesando...",
// "search": "Buscar:",
// "zeroRecords": "No se encontraron resultados",
// "paginate": {
// "first": "Primero",
// "last": "Ultimo",
// "next": "Siguiente",
// "previous": "Anterior"
// }
// },
// 'order': [],
// });
// });
</script> </script>


<?= $this->endSection() ?> <?= $this->endSection() ?>

+ 4
- 2
app/Views/templates/baseAdmin.php View File

@@ -18,8 +18,7 @@ scratch. This page gets rid of all links and provides the needed markup only.
<!-- Theme style --> <!-- Theme style -->
<link rel="stylesheet" href="dist/css/adminlte.min.css"> <link rel="stylesheet" href="dist/css/adminlte.min.css">


<link rel="stylesheet" media="screen" href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css" />
<link rel="stylesheet" media="screen" href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.dataTables.min.css" />
<?= $this->renderSection('headLibraries') ?>




</head> </head>
@@ -167,6 +166,9 @@ scratch. This page gets rid of all links and provides the needed markup only.
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script> <script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App --> <!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script> <script src="dist/js/adminlte.min.js"></script>

<?= $this->renderSection('scripts') ?>

</body> </body>


</html> </html>

Loading…
Cancel
Save