Crear tabla con lista de respuestas
This commit is contained in:
parent
df7295f7ae
commit
6f3d980784
@ -74,6 +74,7 @@ $routes->group('admin', ['filter' => 'admin_filter'], static function ($routes)
|
||||
$routes->get('encuesta/(:segment)', 'Admin::encuesta/$1', ['as' => 'admin_encuesta']);
|
||||
$routes->match(['get', 'post'], 'encuesta/editar/(:segment)', 'Admin::editarEncuesta/$1', ['as' => 'admin_encuesta_editar']);
|
||||
$routes->get('encuesta/eliminar/(:segment)', 'Admin::eliminarEncuesta/$1', ['as' => 'admin_encuesta_eliminar']);
|
||||
$routes->get('respuestas/', 'Admin::respuestas', ['as' => 'admin_respuestas']);
|
||||
|
||||
// PREGUNTAS
|
||||
$routes->match(['get', 'post'], 'encuesta/(:segment)/pregunta/', 'Admin::nuevaPregunta/$1', ['as' => 'admin_pregunta_nueva']);
|
||||
|
@ -7,6 +7,7 @@ use App\Models\EncuestaModel;
|
||||
use App\Models\PreguntaModel;
|
||||
use App\Models\PrestadorModel;
|
||||
use App\Models\PrestadorSolicitudModel as ModelsPrestadorSolicitudModel;
|
||||
use App\Models\SurveyUserModel;
|
||||
use App\Models\UserModel;
|
||||
|
||||
class Admin extends BaseController
|
||||
@ -298,6 +299,20 @@ class Admin extends BaseController
|
||||
));
|
||||
}
|
||||
|
||||
public function respuestas()
|
||||
{
|
||||
$respuestas = model(SurveyUserModel::class)->find();
|
||||
$encuestas = model(EncuestaModel::class)->find();
|
||||
$prestadores = model(PrestadorModel::class)->getPrestadoresActivos();
|
||||
|
||||
$data = [
|
||||
'respuestas' => $respuestas,
|
||||
'encuestas' => $encuestas,
|
||||
'prestadores' => $prestadores,
|
||||
];
|
||||
return view('Admin/respuestas', $data);
|
||||
}
|
||||
|
||||
// PREGUNTAS
|
||||
|
||||
public function nuevaPregunta($id)
|
||||
|
70
app/Views/Admin/respuestas.php
Normal file
70
app/Views/Admin/respuestas.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?= $this->extend('templates/baseAdmin') ?>
|
||||
|
||||
<?= $this->section('content') ?>
|
||||
|
||||
<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/dataTables.bootstrap5.min.js"></script>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<table id="table-solicitudes" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<th>Encuesta ID</th>
|
||||
<th>Prestador ID</th>
|
||||
<th>Fecha</th>
|
||||
<th>Respuestas</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($respuestas as $respuesta) : ?>
|
||||
<tr>
|
||||
<td><?= $respuesta['survey_id'] ?></td>
|
||||
<td><?= $respuesta['user_id'] ?></td>
|
||||
<td><?= $respuesta['created_at'] ?></td>
|
||||
<td>
|
||||
<a href="#" class="btn btn-info">Ver respuestas</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
let table = new DataTable('#table-solicitudes', {
|
||||
'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>
|
||||
|
||||
<?= $this->endSection() ?>
|
@ -85,6 +85,12 @@ scratch. This page gets rid of all links and provides the needed markup only.
|
||||
<p>Lista</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="<?= route_to('admin_respuestas') ?>" class="nav-link">
|
||||
<i class="far fa-circle nav-icon"></i>
|
||||
<p>Respuestas</p>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
|
Loading…
x
Reference in New Issue
Block a user