Sindbad~EG File Manager
@extends('layouts.app')
@section('content')
<?php use App\User;
use App\Respuesta1;
?>
<div class="container">
<div class="row card">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<h3 align="center">Respuestasaa</h3> <br><button onclick="exportTableToExcel('tblData', 'members-data')">Exportar Excel</button><br>
</div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 card-body"> <!-- para que sea responsive-->
<div class="table-responsive">
<table class="table table-striped table-bordered table-condensed table-hover" id="tblData">
<thead> <!-- titulo cabecera-->
<th>Usuario </th>
@foreach ($cuestionante as $cue)
<th>{{$cue->cuestionante}}</th>
@endforeach
</thead>
@php
var_dump($usuarios);die();
@endphp
@foreach ($usuarios as $usu)
<tr>
<td>
<?php
$nombre=User::findOrFail($usu->user_id);
?>
{{$nombre->username}}
</td>
@foreach ($cuestionante as $cue)
<?php
$respuesta = Respuesta1::where('user_id','=',$usu->user_id)->where('id_cuestionante','=',$cue->id)->first();
?>
@if($respuesta)
@if($cue->id == 5000 || $cue->id == 6000 || $cue->id == 7000)
@php
$megusta = unserialize($respuesta->respuesta);
$cantidad = count($megusta);
$dato="";
for($i=0; $i < $cantidad; $i++){
$dato=$dato." *".$megusta[$i]." || ";
}
@endphp
<td>
{{$dato}}
</td>
@else
<td>
{{$respuesta->respuesta}}
</td>
@endif
@else
<td>Ninguno</td>
@endif
@endforeach
</tr>
@endforeach
</table>
</div>
{{$usuarios->render()}}
</div>
</div>
</div>
<script>
function exportTableToExcel(tableID, filename = ''){
var downloadLink;
var dataType = 'application/vnd.ms-excel';
var tableSelect = document.getElementById(tableID);
var tableHTML = tableSelect.outerHTML.replace(/ /g, '%20');
// Specify file name
filename = filename?filename+'.xls':'excel_data.xls';
// Create download link element
downloadLink = document.createElement("a");
document.body.appendChild(downloadLink);
if(navigator.msSaveOrOpenBlob){
var blob = new Blob(['ufeff', tableHTML], {
type: dataType
});
navigator.msSaveOrOpenBlob( blob, filename);
}else{
// Create a link to the file
downloadLink.href = 'data:' + dataType + ', ' + tableHTML;
// Setting the file name
downloadLink.download = filename;
//triggering the function
downloadLink.click();
}
}
</script>
@endsection
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists