MINI MINI MANI MO

Path : /var/www/html/sistemas/spid/resources/views/sistemaVotos/
File Upload :
Current File : /var/www/html/sistemas/spid/resources/views/sistemaVotos/proyeccion.blade.php

<style>
    .main {
        width: 100%;
        color: #000000 !important;
        column-count:2;
        column-rule: 1px solid #bbb;
        column-width: auto;
        margin: 1px   1px   1px   1px !important;
    @import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');
        font-size:  10px!important;
        font-family: "Roboto", sans-serif!important;
        font-weight: 700!important;
        font-style:normal!important;
    }
    td, th {
        padding: 3px 3px !important;
        font-size: 10px!important;
        text-align: left;
    }
</style>
@extends('layoutPr')
@section('title')
    Iniciar Asistencia
@endsection
@section('content')
    <div class="container">
        <div class="section">
            <div class="card">
                <div class="card-content" style='background-image: url("{{asset('spid/images/logo/fondo_pleno.png')}}"); background-repeat: no-repeat; background-size: cover; '>
                    <div id="votos" style="display: none;">
                        {{-- COUNT DE VOTACION --}}
                        {{-- @if(count($votacion)) --}}
{{--                        <div class="row">--}}
{{--                                <p style="font-size: 18px;"><strong>Voto: @if(count($temaVotos)) {{$temaVotos[0]->votacion}} @endif</strong> </p>--}}
{{--                        </div>--}}
                        <div id="actualizaTema" class="row" style="display: none">
                            <table>
                                <tr>
                                    <td width="20px"><p style="font-size: 20px; text-align: left; color: black;"><b>Voto: </b></p></td>
                                    <td id="temaVotoN"></td>
                                </tr>
                            </table>
                        </div>

                        <div id ="totalesVotos" class="row" >
                            <center>
                                <table style=" table-layout: fixed; width: 100%; align-items: left;">
                                    <tr>
                                        <td style="background-color: #4CAF50; color: white; width:50px; word-wrap: break-word; font-weight: bold;" id="consenso1">FAVOR: {{$favor}}</td>
                                        <td style="background-color: #FFC107; color: white; width:50px; word-wrap: break-word; font-weight: bold;" id="abstencion1">ABSTENCIÓN: {{$abstencion}} </td>
                                        <td style="background-color: #DC3545; color: white; width:50px; word-wrap: break-word; font-weight: bold;" id="disenso1">CONTRA: {{$contra}} </td>
                                        <td style="background-color: #DDDDDD; color: white; width:50px; word-wrap: break-word; font-weight: bold;" id="totalv1">TOTAL: {{$totalVotos}} </td>
                                    </tr>
                                </table>
                            </center>
                        </div>
                        <div class="row">

{{--                            <form class="col s3" style="background-color: #DDDDDD;">--}}
                            <form class="col s9" >
                            </form>
                            <form class="col s3" >
                               <h3><div id="countdown"></div></h3>
                            </form>
                            <input type='hidden' name='tiempo' id='tiempo' value=' @if(count($temaVotos)){{$temaVotos[0]->tiempoVotacion}}@endif'>
                            <form class="col s9">
                            </form>
                        </div>
                        <div class="main">
                            <table width='100%' border="0" id="tablaEstatusvotos">
                                @foreach($votacion as $voto)
                                    <tr>
                                        @if($voto->mensaje == 'FAVOR')
                                            <?php $style = "background-color:#4CAF50;"; ?>
                                        @elseif($voto->mensaje == 'CONTRA')
                                            <?php $style = "background-color:#DC3545;"; ?>
                                        @elseif($voto->mensaje == 'ABSTENCION')
                                            <?php $style = "background-color:#E0A800;"; ?>
                                        @elseif($voto->mensaje == 'SIN REGISTRO')
                                            <?php $style = "background-color:#DDDDDD;"; ?>
                                        @endif
                                        <td style="{{$style}}">
                                            <p style="color:black; font-size: 6px;">{{mb_strtoupper($voto->parlamentario->nombre)}} {{mb_strtoupper($voto->parlamentario->ap_pat)}} {{mb_strtoupper($voto->parlamentario->ap_mat)}}</p>
                                        </td>
                                    </tr>
                                @endforeach
                            </table>
                        </div>
                        {{-- @endif --}}
                    </div>
                    <div id="aistencia" style="display: none;">
                        <div class="row">
                            <form class="col s12">
                                <table id="tablatvotos">
                                    <tr>
                                        <td width="33%" style="text-align: right; color: black;"><h3>TIEMPO</h3></td>

                                        <td width="33%">
                                            <form class="col s3" style="background-color: #DDDDDD;">
                                                <h3 style=" color: black;"><div id="countdownA"></div></h3>
                                            </form>
                                            <input type='hidden' name='tiempoA' id='tiempoA' value=' @if(count($asistencias)){{$asistencias[0]->tiempoVotacion}}@endif'></td>
                                        <td style="background-color: #DDDDDD; color: black; width:50px; word-wrap: break-word; font-weight: bold; font-size: 20px;" id="totalAsistencias23" width="33%"><strong>TOTAL ASISTENCIAS:</strong> {{$totalAsistencias}}</td>
                                        {{-- <td align="left"><button type='submit' class='btn btn-success' name='boton' style="background-color: #DDDDDD;"><strong></strong></button> </td> --}}
                                    </tr>
                                </table>
                            </form>
                        </div>

                        <div class="row">
                            <form class="col s3">
                                <table style="display: none">
                                    <tr>
                                        <td><button type='submit' class='btn btn-success' name='boton' STYLE="background-color: #97194B;"><strong>Levantar mano </strong></button> </td>
                                        <td><button type='submit' class='btn btn-success' name='boton' style="background-color: #97194B;"><strong>Bajar mano </strong></button> </td>
                                    </tr>
                                </table>
                            </form>
                            <form class="col s4">
                            </form>
                            {{-- <form class="col s5">
                                <table>
                                    <tr>
                                        <td><a onclick="asistencia(1);" class='btn btn-success' style="background-color: #4CAF50;"><strong>ASISTENCIA </strong></a></td>
                                    </tr>
                                </table>
                            </form> --}}
                        </div>
                        <div class="main">

                            <table width='100%' border="0" id="tablaAsistencia23">
                                @foreach($asistencias as $asistencia)
                                    <tr>
                                        @if($asistencia->mensaje == 'ASISTENCIA')
                                            <?php $style = "background-color:#4CAF50;"; ?>
                                        @elseif($asistencia->mensaje == 'PENDIENTE')
                                            <?php $style = "background-color:#DDDDDD;"; ?>
                                        @endif
                                        <td style="{{$style}}">
                                            <p style="color:black; font-size: 16px!important;">{{mb_strtoupper($asistencia->parlamentario->nombre)}} {{mb_strtoupper($asistencia->parlamentario->ap_pat)}} {{mb_strtoupper($asistencia->parlamentario->ap_mat)}} </p>
                                        </td>
                                    </tr>
                                @endforeach
                            </table>
                        </div>
                        {{-- @endif --}}
                    </div>
                    <div id="nada" style="display: none;">
                        <div class="row">
                            {{-- @if(!count($asistencias) and !count($votacion)) --}}
                            <form class="col S12">
                                <center><img src="{{asset('spid/images/logo/congreso.svg')}}" alt="materialize" width="100%" heigth="150%" style="border-radius:5px;"/></center>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                            </form>
                        </div>
                        <div class="row">
                            <div class="col s10" ></div>
                            <div class="col s2">
                                <img src="{{asset('spid/images/logo/spid.png')}}"
                                     srcset="{{asset('spid/images/logo/spid.png')}} 480w, {{asset('spid/images/logo/spid.png')}} 768w, {{asset('spid/images/logo/spid.png')}} 1024w"
                                     sizes="(max-width: 480px) 50vw, (max-width: 768px) 50vw, 50vw"
                                     alt="Imagen ajustada">
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
@endsection
@push('scripts')
    <script type="text/javascript">




        // $(document).ready(function() {
        //     function actualizar(){location.reload(true);}
        //     setInterval("actualizaTotalesVotos()",10000);
        //     $.ajaxSetup({ cache: false });
        // });

        // $(document).ready(function() {
        //     function actualizar(){location.reload(true);}
        //     setInterval("actualizaListaVotacion()",10000);
        //     $.ajaxSetup({ cache: false });
        // });

        // $(document).ready(function() {
        //     function actualizar(){location.reload(true);}
        //     setInterval("actualizaAs()",10000);
        //     $.ajaxSetup({ cache: false });
        // });

        //   $(document).ready(function() {
        //     function actualizar(){location.reload(true);}
        //     setInterval("actasistot()",10000);
        //     $.ajaxSetup({ cache: false });
        // });

        // $(document).ready(function() {
        // function actualizar(){location.reload(true);}
        // setInterval("validaEventos()",10000);
        // $.ajaxSetup({ cache: false });
        // });
        // $(document).ready(function() {
        // function actualizar(){location.reload(true);}
        // setInterval("oconse2()",10000);
        // $.ajaxSetup({ cache: false });
        // });


        /*     $(document).ready(function() {
             function actualizar(){location.reload(true);}
             setInterval("odise2()",10000);
             $.ajaxSetup({ cache: false });
             });
     */
          //window.onload = validaEventos;

        $(document).ready(function() {


            function oconse2(){
                $.ajax({
                    type: 'GET',
                    data :{},
                    url :   "{{ url('levantaCon2') }}",
                    success: function (response) {
                        var json = $.parseJSON(response);
                        if(json[0].status=='vacio'){
                            $("#ocons2").empty();
                        }else{
                            $("#ocons2").empty();
                            $.each(json, function(i, item) {
                                $('#ocons2').append('<TR><td>'+item.nombre.toUpperCase() + ' '+item.ap_pat.toUpperCase()+  ' ' + item.ap_mat.toUpperCase() + ' / ' + ' '+ item.creado+'</td></TR>');
                            });
                        }

                    },error: function(xhr, status, error) {
                    }
                });
            }
            function odise2(){
                $.ajax({
                    type: 'GET',
                    data :{},
                    url :   "{{ url('levantaDis2') }}",
                    success: function (response) {
                        var json = $.parseJSON(response);
                        if(json[0].status=='vacio'){
                            $("#odis2").empty();
                        }else{
                            $("#odis2").empty();
                            $.each(json, function(i, item) {
                                $('#odis2').append('<TR><td>'+item.nombre.toUpperCase() + ' '+item.ap_pat.toUpperCase()+  ' ' + item.ap_mat.toUpperCase() + ' / ' + ' '+ item.creado+'</td></TR>');
                            });
                        }

                    },error: function(xhr, status, error) {
                    }
                });
            }


            function validaEventos(){
                $.ajax({
                    type: 'GET',
                    data :{},
                    url :   "{{ url('validaEventosActivos2') }}",
                    success: function (response) {
                        var json = $.parseJSON(response);
                        if(json[0].asistencias == '0' && json[0].votacion == '0'){
                            document.getElementById("votos").style= "display: none";
                            document.getElementById("aistencia").style= "display: none";
                            document.getElementById("nada").style= "display: block";
                            document.getElementById("actualizaTema").style= "display: none";
                            oconse2();
                        }else if(json[0].asistencias > '0' && json[0].votacion == '0'){
                            document.getElementById("nada").style= "display: none";
                            document.getElementById("votos").style= "display: none";
                            document.getElementById("aistencia").style= "display: block";
                            document.getElementById('actualizaTema').style= "display: none";

                            actasistot();
                            actualizaAs();
                        }else if(json[0].votacion > '0' && json[0].asistencias == '0'){
                            document.getElementById("nada").style= "display: none";
                            document.getElementById("aistencia").style= "display: none";
                            document.getElementById("votos").style= "display: block";
                            document.getElementById('actualizaTema').style= "display: block";
                            actualizaListaVotacion();
                            actualizaTotalesVotos();
                            actualizaTemaF();
                           //atualiza
                        }
                    },error: function(xhr, status, error) {
                    }
                });
            }

            function actasistot(){
                $.ajax({
                    type: 'GET',
                    data :{},
                    url :   "{{ url('actasistot') }}",
                    success: function (response) {
                        var json = $.parseJSON(response);
                        $('#totalAsistencias23').replaceWith(' <td style="background-color: #DDDDDD; color: black; width:50px; word-wrap: break-word; font-weight: bold; font-size: 20px;" id="totalAsistencias23"><p style="font-size: 18px;"> TOTAL ASISTENCIAS: ' + json[0].asistenciast + '</p></td>');
                    },error: function(xhr, status, error) {
                    }
                });
            }


            function actualizaAs(){

                $.ajax({
                    type: 'GET',
                    data :{},
                    url :   "{{ url('actualizaAsistencias') }}",
                    success: function (response) {
                        var json = $.parseJSON(response);

                        $("#tablaAsistencia23").empty();
                        $.each(json, function(i, item) {
                            if(item.mensaje == 'ASISTENCIA'){
                                var style = "background-color:#4CAF50;";
                            }else{
                                var style = "background-color:#DDDDDD;";
                            }
                            $('#tablaAsistencia23').append('<TR><td style="'+style+'"><p style="color:black; font-size: 16px!important; text-align: left;"> '+item.name.toUpperCase() + ' ' +item.ap_pat.toUpperCase()+  ' ' + item.ap_mat.toUpperCase()+' </p></td></TR>');

                        });
                    },error: function(xhr, status, error) {
                    }
                });
            }
            function actualizaTotalesVotos(){

                // totalesVotos
                $.ajax({
                    type: 'GET',
                    data :{},
                    url :   "{{ url('actualizaTotalesVotos') }}",
                    success: function (response) {
                        var json = $.parseJSON(response);
                        $('#consenso1').replaceWith(' <td style="background-color: #4CAF50; color: black; width:50px; word-wrap: break-word; font-weight: bold;" id="consenso1"><p style="font-size: 16px;"> FAVOR: ' + json[0].votacionFavor + '</p></td>');
                        $('#disenso1').replaceWith(' <td style="background-color: #DC3545; color: black; width:50px; word-wrap: break-word; font-weight: bold;" id="disenso1"><p style="font-size: 16px;"> CONTRA: ' + json[0].votacionContra + '</p></td>');
                        $('#abstencion1').replaceWith(' <td style="background-color: #FFC107; color: black; width:50px; word-wrap: break-word; font-weight: bold;" id="abstencion1"><p style="font-size: 16px;"> ABST: ' + json[0].votacionAbsten + '</p></td>');
                        $('#totalv1').replaceWith(' <td style="background-color: #DDDDDD; color: black; width:50px; word-wrap: break-word; font-weight: bold;" id="totalv1"><p style="font-size: 16px;"> TOTAL: ' + json[0].totalVotos + '</p></td>');

                    },error: function(xhr, status, error) {
                    }
                });
            }
            //gis
            function actualizaTemaF(){
                $.ajax({
                    type: 'GET',
                    data :{},
                    url :   "{{ url('actualizaTemaVotos') }}",
                    success: function (response) {
                        var json = $.parseJSON(response);
                        $('#temaVotoN').replaceWith(' <td style=" color: black; width:50px; word-wrap: break-word; font-weight: bold;" id="temaVotoN"><p style="font-size: 20px;color: black"><b>' + json[0].temaV + '</b></p></td>');
                    },error: function(xhr, status, error) {
                    }
                });
            }


            function actualizaListaVotacion(){
                $.ajax({
                    type: 'GET',
                    data :{},
                    url :   "{{ url('actualizaListaVotacion') }}",
                    success: function (response) {
                        var json = $.parseJSON(response);

                        $("#tablaEstatusvotos").empty();
                        $.each(json, function(i, item) {
                            if(item.mensaje == 'FAVOR'){
                                var style = "background-color:#4CAF50;";
                            }else if(item.mensaje == 'CONTRA'){
                                var style = "background-color:#DC3545;";
                            }else if(item.mensaje == 'ABSTENCION'){
                                var style = "background-color:#FFC107;";
                            }else if(item.mensaje == 'SIN REGISTRO'){
                                var style = "background-color:#DDDDDD;";
                            }
                            $('#tablaEstatusvotos').append('<TR><td style="'+style+'"><p style="color:black; font-size: 16px; text-align: left;"> '+item.name.toUpperCase() +' '+item.ap_pat.toUpperCase()+  ' ' + item.ap_mat.toUpperCase()+' '+'</p></td></TR>');
                        });
                    },error: function(xhr, status, error) {
                    }
                });
            }
            setInterval(validaEventos,1000);
        });

        function favor(id){
            var id = id;
            $.ajax({
                type: 'GET',
                data :{id},
                url :   "{{ url('consensoU') }}",
                success: function (response) {
                    location.reload();
                },error: function(xhr, status, error) {
                }
            });
        }

        function contra(id){
            var id = id;
            $.ajax({
                type: 'GET',
                data :{id},
                url :   "{{ url('disensoU') }}",
                success: function (response) {
                    location.reload();
                },error: function(xhr, status, error) {
                }
            });
        }

        function abstencion(id){
            var id = id;
            $.ajax({
                type: 'GET',
                data :{id},
                url :   "{{ url('abstencionU') }}",
                success: function (response) {
                    location.reload();
                },error: function(xhr, status, error) {
                }
            });
        }

        function sinRegistro(id){
            var id = id;
            $.ajax({
                type: 'GET',
                data :{id},
                url :   "{{ url('sinRegistroU') }}",
                success: function (response) {
                    location.reload();
                },error: function(xhr, status, error) {
                }
            });
        }

        function asistencia(id){
            var id = id;
            $.ajax({
                type: 'GET',
                data :{id},
                url :   "{{ url('asistenciaU') }}",
                success: function (response) {
                    location.reload();
                },error: function(xhr, status, error) {
                }
            });
        }
        $(document).ready(function() {
            var end1 = document.getElementById('tiempo').value;
            var end = new Date(end1);
            var _second = 1000;
            var _minute = _second * 60;
            var _hour = _minute * 60;
            var _day = _hour * 24;
            var timer;

            function showRemainingV() {
                var now = new Date();

                if(end < now){
                    var distance = 0;
                }else{
                    var distance = end - now;
                }

                if (distance <= 0)  {
                    clearInterval(timer);
                    document.getElementById('countdown').innerHTML = '00:00';
                    //document.getElementById('barraVotos').style.display="none";

                    return;
                } else if (distance == "NaN") {
                    clearInterval(timer);
                    document.getElementById('countdown').innerHTML = '';
                    return;
                }

                var minutes = Math.floor((distance % _hour) / _minute);
                var seconds = Math.floor((distance % _minute) / _second);
                if (seconds < 10) {
                    seconds = '0' + seconds;
                }

                document.getElementById('countdown').innerHTML = minutes + ':';
                document.getElementById('countdown').innerHTML += seconds;
            }
            timer = setInterval(showRemainingV, 1000);

            var endA = document.getElementById('tiempoA').value;
            var endA = new Date(endA);
            var _second = 1000;
            var _minute = _second * 60;
            var _hour = _minute * 60;
            var _day = _hour * 24;
            var timer;

            function showRemaining() {
                var now = new Date();

                if(endA < now){
                    var distance = 0;
                }else{
                    var distance = endA - now;
                }

                if (distance <= 0)  {
                    clearInterval(timer);
                    document.getElementById('countdownA').innerHTML = '00:00';
                    return;
                } else if (distance == "NaN") {
                    clearInterval(timer);
                    document.getElementById('countdownA').innerHTML = '';
                    return;
                }

                var minutes = Math.floor((distance % _hour) / _minute);
                var seconds = Math.floor((distance % _minute) / _second);
                if (seconds < 10) {
                    seconds = '0' + seconds;
                }

                document.getElementById('countdownA').innerHTML = minutes + ':';
                document.getElementById('countdownA').innerHTML += seconds;
            }
            timer = setInterval(showRemaining, 1000);
        });
    </script>
@endpush

OHA YOOOO