| Path : /var/www/html/sistemas/spid/resources/views/votaciones/ |
| Current File : /var/www/html/sistemas/spid/resources/views/votaciones/verVotos.blade.php |
<style>
.main {
width: 100%;
color: #000000 !important;
font-weight: bold;
column-count: 2;
column-rule: 1px solid #bbb;
column-width: auto;
margin: 1px 1px 1px 1px !important;
}
td,
th {
padding: 2px 2px !important;
}
</style>
@extends('layout')
@section('title')
REGISTRO VOTOS
@endsection
@section('content')
<div class="card-body">
<div class="container">
<div class="section">
<div class="height-30vh">
<center>
<img src="{{asset('spid/images/logo/congeso.jpg')}}" alt="materialize" width="40%" heigth="40%" style="border-radius:15px;"/>
</center>
</div>
</div>
</div>
</div>
<div class="container">
<div class="section">
<div class="card">
<div class="section section-data-tables">
<div class="card-content">
<div class="card-body s12">
@if (count($votacion))
<h4 class="text-align center">Registro de Votación</h4>
<table width='100%' bor style='border-collapse:collapse'>
<tbody>
<tr>
<td>
<h6><strong>EVENTO: {{ $eventoActual[0]->nombreEvento }}</strong></h6>
</td>
<td>
<h6><strong>VOTO: {{$tema->votacion}}</strong></h6>
</td>
<td>
<h6><strong>FECHA: {{ \Carbon\Carbon::parse($eventoActual[0]->fechaEvento)->format('d-m-Y') }} </strong></h6>
</td>
</tr>
</tbody>
</table>
<div class='main'>
<table width='100%' border="0">
@foreach ($votacion as $voto)
<tr>
@if ($voto->mensaje == 'SIN REGISTRO')
<?php $style = 'background-color:#C6C6C6;'; ?>
@elseif($voto->mensaje == 'ABSTENCION')
<?php $style = 'background-color:#E0A800;'; ?>
@elseif($voto->mensaje == 'CONTRA')
<?php $style = 'background-color:#DC3545;'; ?>
@elseif($voto->mensaje == 'FAVOR')
<?php $style = 'background-color:#218838;'; ?>
@endif
<td style="{{ $style }}">
<p style="color:black; text-align: justify-all">
{{ $voto->nombre }}
{{ $voto->ap_pat }}
{{ $voto->ap_mat }}
/ {{$voto->partido}}</p>
</td>
<td>
<a onclick="favor({{ $voto->id }})"
class="btn btn-xs btn-warning"
style="background-color:#218838;"> <i
class="material-icons">file_upload</i></a>
<a onclick="contra({{ $voto->id }})"
class="btn btn-xs btn-warning"
style="background-color:#DC3545;"> <i
class="material-icons">file_download</i></a>
<a onclick="abstencion({{ $voto->id }})"
class="btn btn-xs btn-warning"
style="background-color:#E0A800;"> <i
class="material-icons">fast_forward</i></a>
<a onclick="sinRegistro({{ $voto->id }})"
class="btn btn-xs btn-warning"
style="background-color:#5A6268;"> <i
class="material-icons">fast_rewind</i></a>
</td>
</tr>
@endforeach
</table>
</div>
<br>
<div class="row">
<div class="col s4">
<a onclick="terminarVotacion({{ 1 }});" class="btn">Terminar
votación</a>
</div>
<div class="col s4">
<a onclick="terminarVotacion({{ 1 }});"
class="btn btn-xs btn-warning">Nueva votación</a>
</div>
<div class="col s4">
<a onclick="imprimirpdfVotacion();" class="btn btn-xs btn-warning">Imprimir
votación</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="loader1" style="display: none;" class="loader1"><img
style="position: relative; left: 43%; top: 40%; width: 10%; height: 10%;"
src="{{ asset('spid/images/logo/cube.gif') }}">
<p style="position: relative; left: 43%; top: 40%;">...TERMINANDO</p>
</div>
<div id="loader" style="display: none;" class="loader"><img
style="position: relative; left: 43%; top: 40%; width: 10%; height: 10%;"
src="{{ asset('spid/images/logo/cube.gif') }}">
<p style="position: relative; left: 43%; top: 40%;">...Generando PDF</p>
</div>
</div>
@endif
@endsection
@push('scripts')
<script type="text/javascript">
function imprimirpdfVotacion() {
console.log('entre a imprimri vota');
$.ajax({
type: 'GET',
data: {},
url: "{{ url('imprimirvotos') }}",
xhrFields: {
responseType: 'blob'
},
beforeSend: function() {
$(".loader").show()
},
success: function(response) {
var blob = new Blob([response]);
console.log(blob);
var link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = "votacion.pdf";
link.click();
$(".loader").hide();
},
error: function(blob) {
console.log(blob);
}
});
}
function favor(id) {
var id = id;
$.ajax({
type: 'GET',
data: {
id
},
url: "{{ url('consenso') }}",
success: function(response) {
location.reload();
},
error: function(xhr, status, error) {}
});
}
function contra(id) {
var id = id;
$.ajax({
type: 'GET',
data: {
id
},
url: "{{ url('disenso') }}",
success: function(response) {
location.reload();
},
error: function(xhr, status, error) {}
});
}
function abstencion(id) {
var id = id;
$.ajax({
type: 'GET',
data: {
id
},
url: "{{ url('abstencion') }}",
success: function(response) {
location.reload();
},
error: function(xhr, status, error) {}
});
}
function sinRegistro(id) {
var id = id;
$.ajax({
type: 'GET',
data: {
id
},
url: "{{ url('sinRegistro') }}",
success: function(response) {
location.reload();
},
error: function(xhr, status, error) {}
});
}
function terminarVotacion(id) {
var id = id;
$.ajax({
url: "{{ url('terminarVotacion') }}",
type: 'GET',
data: {
id
},
beforeSend: function() {
$(".loader1").show()
},
success: function(response) {
$(".loader1").hide();
window.location.href = window.location.origin + '/votos';
},
error: function(xhr, status, error) {
alert('ocurrio un error');
}
})
}
</script>
@endpush