File: /var/www/html/xfacil.desafio.com.py/resources/views/livewire/reaccionesafteroffice.blade.php
<div>
<?php
use Illuminate\Support\Facades\DB;
use App\Models\Emoticonafteroffice;
?>
<h1 align="center">Reacciones de las After Office - <button onclick="fnExcelReport()" class="btn btn-success">Descargar reacciones</button></h1>
<div class="card">
<div class="card-header">
<div class="col-md-12">
<input wire:model="search" class="form-control" type="search" placeholder="Buscar" />
</div>
</div>
<div class="card-body">
<table class="table table-bordered" id="headerTable">
<thead>
<tr>
<th>After Office</th>
<th>Reacciones</th>
<th>Opciones</th>
</tr>
</thead>
<tbody>
@foreach($afters as $value)
<tr>
<td>
{{ $value->titulo }}
</td>
<?php
$megusta = Emoticonafteroffice::where('emocion','me-gusta')->where('afteroffice_id',$value->id)->count();
$meencanta = Emoticonafteroffice::where('emocion','me-encanta')->where('afteroffice_id',$value->id)->count();
$medivierta = Emoticonafteroffice::where('emocion','me-divierta')->where('afteroffice_id',$value->id)->count();
$measombra = Emoticonafteroffice::where('emocion','me-asombra')->where('afteroffice_id',$value->id)->count();
$meentristece = Emoticonafteroffice::where('emocion','me-entristece')->where('afteroffice_id',$value->id)->count();
$meenoja = Emoticonafteroffice::where('emocion','me-enoja')->where('afteroffice_id',$value->id)->count();
$usuariosmegusta = DB::table('emoticonafteroffices as e')
->join('users as u','e.usuario_id','u.id')
->select('u.name')
->where('emocion','me-gusta')
->where('afteroffice_id',$value->id)->get();
$usuariosmeencanta = DB::table('emoticonafteroffices as e')
->join('users as u','e.usuario_id','u.id')
->select('u.name')
->where('emocion','me-encanta')
->where('afteroffice_id',$value->id)->get();
$usuariosmedivierta = DB::table('emoticonafteroffices as e')
->join('users as u','e.usuario_id','u.id')
->select('u.name')
->where('emocion','me-divierta')
->where('afteroffice_id',$value->id)->get();
$usuariosmeasombra = DB::table('emoticonafteroffices as e')
->join('users as u','e.usuario_id','u.id')
->select('u.name')
->where('emocion','me-asombra')
->where('afteroffice_id',$value->id)->get();
$usuariosmeentristece = DB::table('emoticonafteroffices as e')
->join('users as u','e.usuario_id','u.id')
->select('u.name')
->where('emocion','me-entristece')
->where('afteroffice_id',$value->id)->get();
$usuariosmeenoja = DB::table('emoticonafteroffices as e')
->join('users as u','e.usuario_id','u.id')
->select('u.name')
->where('emocion','me-enoja')
->where('afteroffice_id',$value->id)->get();
?>
<td>
<img src="{{ asset('imagenes/reacciones/me-gusta.png') }}" width="30px"><span style="display:none">Me gusta</span> ({{ $megusta }})
<img src="{{ asset('imagenes/reacciones/me-encanta.png') }}" width="30px"><span style="display:none">Me encanta</span> ({{ $meencanta }})
<img src="{{ asset('imagenes/reacciones/me-divierta.png') }}" width="30px"><span style="display:none">Me divierta</span> ({{ $medivierta }})
<img src="{{ asset('imagenes/reacciones/me-asombra.png') }}" width="30px"><span style="display:none">Me asombra</span> ({{ $measombra }})
<img src="{{ asset('imagenes/reacciones/me-entristece.png') }}" width="30px"><span style="display:none">Me entristece</span> ({{ $meentristece }})
<img src="{{ asset('imagenes/reacciones/me-enoja.png') }}" width="30px"><span style="display:none">Me enoja</span> ({{ $meenoja }})
</td>
<td>
<button type="button" class="btn btn-success btn-sm" data-toggle="modal" data-target="#exampleModal{{ $value->id}}">Ver detalles</button>
<!-- Modal -->
<div class="modal fade" id="exampleModal{{ $value->id}}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">
Reacciones
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<table class="table table-bordered">
<thead>
<tr>
<th><img src="{{ asset('imagenes/reacciones/me-gusta.png') }}" width="30px"><span style="display:none">Me gusta</span> ({{ $megusta }})</th>
<th><img src="{{ asset('imagenes/reacciones/me-encanta.png') }}" width="30px"><span style="display:none">Me encanta</span> ({{ $meencanta }})</th>
<th><img src="{{ asset('imagenes/reacciones/me-divierta.png') }}" width="30px"><span style="display:none">Me divierta</span> ({{ $medivierta }})</th>
<th><img src="{{ asset('imagenes/reacciones/me-asombra.png') }}" width="30px"><span style="display:none">Me asombra</span> ({{ $measombra }})</th>
<th><img src="{{ asset('imagenes/reacciones/me-entristece.png') }}" width="30px"><span style="display:none">Me entristece</span> ({{ $meentristece }})</th>
<th><img src="{{ asset('imagenes/reacciones/me-enoja.png') }}" width="30px"><span style="display:none">Me enoja</span> ({{ $meenoja }})</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
@foreach($usuariosmegusta as $megusta)
<li>{{$megusta->name}}</li>
@endforeach
</ul>
</td>
<td>
<ul>
@foreach($usuariosmeencanta as $meencanta)
<li>{{$meencanta->name}}</li>
@endforeach
</ul>
</td>
<td>
<ul>
@foreach($usuariosmedivierta as $medivierta)
<li>{{$medivierta->name}}</li>
@endforeach
</ul>
</td>
<td>
<ul>
@foreach($usuariosmeasombra as $measombra)
<li>{{$measombra->name}}</li>
@endforeach
</ul>
</td>
<td>
<ul>
@foreach($usuariosmeentristece as $meentristece)
<li>{{$meentristece->name}}</li>
@endforeach
</ul>
</td>
<td>
<ul>
@foreach($usuariosmeenoja as $meenoja)
<li>{{$meenoja->name}}</li>
@endforeach
</ul>
</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cerrar</button>
</div>
</div>
</div>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="card-footer">
<div class="col-12">
{{ $afters->links() }}
</div>
</div>
</div>
</div>