MINI MINI MANI MO
<?php $__env->startSection('title', 'MCG - Iniciativas'); ?>
<?php $__env->startSection('vendor-style'); ?>
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('vendors/data-tables/css/jquery.dataTables.min.css')); ?>">
<link rel="stylesheet" type="text/css"
href="<?php echo e(asset('vendors/data-tables/extensions/responsive/css/responsive.dataTables.min.css')); ?>">
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('vendors/data-tables/css/select.dataTables.min.css')); ?>">
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('vendors/sweetalert/sweetalert.css')); ?>">
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('vendors/flag-icon/css/flag-icon.min.css')); ?>">
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('vendors/dropify/css/dropify.min.css')); ?>">
<?php $__env->stopSection(); ?>
<?php $__env->startSection('page-style'); ?>
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('css/pages/app-invoice.css')); ?>">
<link rel="stylesheet" href="<?php echo e(asset('vendors/select2/select2.min.css')); ?>" type="text/css">
<link rel="stylesheet" href="<?php echo e(asset('vendors/select2/select2-materialize.css')); ?>" type="text/css">
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('css/pages/form-select2.css')); ?>">
<link rel="stylesheet" type="text/css" href="<?php echo e(asset('vendors/dropify/css/dropify.min.css')); ?>">
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<!-- invoice list -->
<section class="invoice-list-wrapper section">
<!-- create invoice button-->
<!-- Options and filter dropdown button-->
<div class="seaction">
<div class="row">
<div class="col s12 m12 l12">
<div id="button-trigger2" class="card card card-default scrollspy">
<div class="card-content">
<div class="invoice-create-btn">
<button class="btn btn-import-votacion">
<i class="material-icons">cloud_upload</i>
</button>
</div>
<?php if(count($iniciativa->votacion)): ?>
<br>
<div class="invoice-create-btn">
<button class="btn btn-delete-votacion">
Eliminar votación
</button>
</div>
<?php endif; ?>
<!-- create invoice button-->
<div class="row">
<div class="input-field col s8">
<strong>Iniciativa No. <?php echo e($iniciativa->folio); ?></strong>
<h4><?php echo e($iniciativa->iniciativa); ?></h4>
</div>
</div>
<br>
<div class="row">
<div class="input-field col s8">
<strong>Si desea agregar un diputado presione el boton. <i class="material-icons" id="addDip">add</i></strong>
<div class="row">
<div class="input-field col s6">
<div class="form-group">
<label class="control-label" style=" color: #960948;"><strong>Diputados:</strong></label>
<select class="validate select2 browser-default text-uppercase" id="SelectDip" >
<option value="0" selected>Selecciona una opcion</option>
<?php $__currentLoopData = $dip; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value=<?php echo e($item->id); ?>><?php echo e($item->apaterno); ?> <?php echo e($item->amaterno); ?> <?php echo e($item->nombres); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
</div>
</div>
</div>
</div>
<br>
<?php echo Form::open(['route'=>['mcg.votaciones_save', base64_encode(base64_encode($iniciativa->id))], 'method'=>'PUT', 'role' => 'form','id' => 'form-votaciones']); ?>
<?php if($decretos != '[]'): ?>
<div class="row">
<div class="input-field col s6">
<div class="form-group">
<label class="control-label" style=" color: #960948;"><strong>Decretos:</strong></label>
<select class="validate select2 browser-default text-uppercase" id="SelectDecre" >
<option value="0" data-iniciativa="<?php echo e(base64_encode(base64_encode($iniciativa->id))); ?>" <?php echo e($tipo == "0" ? "selected " : ""); ?>>INICIATIVA</option>
<?php $__currentLoopData = $decretos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value=<?php echo e($item->id); ?> data-iniciativa="<?php echo e(base64_encode(base64_encode($iniciativa->id))); ?>" <?php echo e($tipo == $item->id ? "selected ":""); ?> ><?php echo e($item->num_decreto); ?>-<?php echo e($item->nombre_decreto); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
</div>
</div>
<?php endif; ?>
<div class="responsive-table">
<table class="table white border-radius-4 pt-1">
<thead>
<tr>
<th style="width: 10%">
<span>#</span>
</th>
<th style="width: 40%">Diputado</th>
<th style="width: 10%">Partido</th>
<th>Sentido</th>.
<th>Acciones</th>
</tr>
</thead>
<tbody id="TableDip">
<?php $__currentLoopData = $diputados; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr id="diputado<?php echo e($item->id); ?>">
<td><?php echo e($key+1); ?></td>
<td class="numero" data-dip=<?php echo e($item->id); ?> data-codificado=<?php echo e($item->name_field); ?> ><?php echo e($item->apaterno); ?> <?php echo e($item->amaterno); ?> <?php echo e($item->nombres); ?> </td>
<td>
<img width="50%"
src="<?php echo e(asset("/storage/img/partidos/".$item->partido->emblema)); ?>">
</td>
<td>
<div class="row">
<div class="input-field col s8" id="RowDip<?php echo e($item->id); ?>">
<?php echo Form::select($item->name_field, $sentidos,
$tipo == 0 ? ($item->votacion()->whereIdIniciativa($iniciativa->id)->first() ? $item->votacion()->whereIdIniciativa($iniciativa->id)->first()->voto : 1) : ($item->votacionesDecretos()->whereIdDecretos($tipo)->first() ? $item->votacionesDecretos()->whereIdDecretos($tipo)->first()->voto : 1),
['class' => 'form-control text-uppercase sentido', "form" => "form-votaciones"]); ?>
<!--<div style="display: none;"> <?php echo Form::text($item->name_field,$tipo,['class' => 'form-control text-uppercase', 'placeholder' => 'LXI', 'id' => 'tema_iniciativa', 'readonly' => true,"form" => "form-votaciones"]); ?></div>-->
</div>
</div>
</td>
<td class="boton" >
<i class="material-icons">delete</i>
</td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>
</table>
<div style="display: none;"> <?php echo Form::text("tipo",$tipo,['class' => 'form-control text-uppercase', 'placeholder' => 'LXI', 'id' => 'tema_iniciativa', 'readonly' => true,"form" => "form-votaciones"]); ?></div>
<div class="row">
<div class="col s12">
<button class="btn cyan waves-effect waves-light right"
id="submit">
Guardar
<i class="material-icons right">save</i>
</button>
</div>
</div>
</div>
<?php echo Form::close(); ?>
</div>
</div>
</div>
</div>
</div>
</section>
<div id="modal-import" class="modal">
<div class="modal-header">
<h5 class="ml-2">Cambiar estatus</h5>
</div>
<div class="modal-content">
<form method="POST" id="form-import"
action="<?php echo e(route('mcg.votaciones_import', base64_encode(base64_encode($iniciativa->id)))); ?>"
enctype="multipart/form-data">
<?php echo e(method_field('PUT')); ?>
<?php echo e(csrf_field()); ?>
<div class="row">
<div class="col">
<div class="switch">
<label>
Iniciativa
<input type="checkbox" name="tipo">
<span class="lever"></span>
Punto de acuerdo
</label>
</div>
</div>
</div>
<div class="row mt-5">
<div class="col s12 m12 l12">
<?php echo Form::file('excel', ['class' => 'dropify', 'id' => 'input-file-now']); ?>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn green save-import">Guardar</button>
<a href="#!" class="modal-action modal-close waves-effect waves-green btn cerrar">Cerrar</a>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('vendor-script'); ?>
<script src="<?php echo e(asset('vendors/data-tables/js/jquery.dataTables.min.js')); ?>"></script>
<script src="<?php echo e(asset('vendors/data-tables/extensions/responsive/js/dataTables.responsive.min.js')); ?>"></script>
<script src="<?php echo e(asset('vendors/data-tables/js/dataTables.select.min.js')); ?>"></script>
<script src="<?php echo e(asset('vendors/sweetalert/sweetalert.min.js')); ?>"></script>
<script src="<?php echo e(asset('vendors/dropify/js/dropify.min.js')); ?>"></script>
<script src="<?php echo e(asset('js/scripts/form-file-uploads.js')); ?>"></script>
<script src="<?php echo e(asset('vendors/select2/select2.full.min.js')); ?>"></script>
<script src="<?php echo e(asset('js/scripts/form-select2.js')); ?>"></script>
<script src="<?php echo e(asset('vendors/dropify/js/dropify.min.js')); ?>"></script>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('page-script'); ?>
<script>
var datoDip;
var contador=0;
$(document).ready(function () {
$("#modal-import").modal();
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$(".select2").select2();
$('.select3-size-sm').select2({
dropdownAutoWidth: true,
width: '100%',
containerCssClass: 'select-sm'
});
<?php if(session('votacion') == 'ok'): ?>
Swal.fire({
title: 'Operación exitosa',
text: '¡Votación registrada correctamente!',
icon: 'success',
})
<?php endif; ?>
$(document).on('change', '#SelectDecre', function(event) {
console.log('hi');
console.log($("#SelectDecre option:selected").val());
//$("#tema_iniciativa").val($("#SelectDecre option:selected").val());
if($("#SelectDecre option:selected").val() != 0){
location.href = "/mcg/iniciativas/votacion/"+$("#SelectDecre option:selected").data("iniciativa")+"/"+$("#SelectDecre option:selected").val()
}else{
location.href = "/mcg/iniciativas/votacion/"+$("#SelectDecre option:selected").data("iniciativa")+"/0"
}
//
/*console.log($("#servicio option:selected").val());
console.log($("#servicio option:selected").data("comision"));
console.log($("#servicio option:selected").data("subtem"));
let tema = $("#servicio option:selected").val()+'/0'
$("#form-asistencia-tema").attr('action', '<?php echo e(url('')); ?>/mcg/comisiones/votaciones/'+btoa(btoa($("#servicio option:selected").data("comision")))+'/'+btoa(btoa(tema))).submit();
*/
});
$(".btn-import-votacion").click(function () {
$("#modal-import").modal("open");
});
$(".save-import").click(function () {
$("#form-import").submit();
})
$(document).on("click", '#addDip', function () {
var nombreDiputado = $('#SelectDip option:selected').text();
var noDip = $("#SelectDip").val();
const estatus = <?php echo json_encode($sentidos, 15, 512) ?>;
if(contador == 0){
contador = <?php echo json_encode($key, 15, 512) ?> + 2;
}else{
contador += 1;
}
$.get( "<?php echo e(asset("mcg/diputado")); ?>/"+ noDip, function( data ) {
var cod = btoa(btoa(data.id));
var tr = $('<tr id="diputado'+data.id+'" >')
tr.append('<td>'+contador+'</td>')
tr.append('<td class="numero" data-dip='+data.id+' data-codificado='+btoa(btoa(data.id)) + '>'+nombreDiputado+'</td>')
tr.append('<td><img width="50%" src=" http://legislativoedomex.gob.mx/storage/img/partidos/'+data.partido.emblema+'"></td>')
tr.append('<td><div class="row"><div class="input-field col s8" id="RowDip'+data.id+'"><select class="select2 form-control text-uppercase sentido " id="Dinamic'+data.id+'" name="' + cod + '[]" "form"="form-asistencia"></select></div></div></td>')
tr.append('<td class="boton" ><i class="material-icons">delete</i></td>')
tr.append('</tr>')
$('#TableDip').append(tr)
$.each(estatus, function (i, item) {
$('#Dinamic'+data.id).append($('<option>', {
value: i,
text : item
}));
});
$(".select2").select2();
});
// $("#SelectDip").val(0).trigger("change");
// $("#SelectComision").val(0).trigger("change");
});
$(document).on("click", '.boton', function () {
console.log("hola marti");
var valores = "";
var codificado = null;
var comisionDelete = null;
$(this).parents("tr").find(".numero").each(function() {
valores += $(this).data('dip');
codificado = $(this).data('codificado');
}); //F55B5B
console.log(valores);
console.log(codificado);
var no = valores;
$('#diputado'+valores).css('background-color', '#F19595');
$("#RowDip"+no).append('<div style="display: none;"> <input class="form-control text-uppercase" placeholder="LXI" id="legislatura" readonly="true" form="form-votaciones" name="' + codificado + '" type="text" value="0"></div>');
});
});
$("#submit").click(function () {
let favor = 0;
let contra = 0;
let abstencion = 0;
let sinRegistro = 0;
$(".sentido").each(function (i, v) {
let val = parseInt(v.value);
if (val === 1) {
favor++;
} else if (val === 2) {
contra++;
} else if (val === 3) {
abstencion++;
} else {
sinRegistro++;
}
});
let html = "¿Desea guardar la siguiente información?<br>";
html += "<strong>Votos a favor: " + favor + "</strong><br>";
html += "<strong>Votos en contra: " + contra + "</strong><br>";
html += "<strong>Abstenciones: " + abstencion + "</strong><br>";
html += "<strong>Sin registro: " + sinRegistro + "</strong>";
Swal.fire({
title: "Confirmación",
html: html,
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Aceptar'
}).then((result) => {
if (result.isConfirmed) {
$("#form-votaciones").submit();
}
})
});
$(".btn-delete-votacion").click(function () {
Swal.fire({
title: "Confirmación",
text: "¿Desea eliminar la votación?",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Aceptar'
}).then((result) => {
if (result.isConfirmed) {
location.href = "<?php echo e(route("mcg.votaciones_delete", base64_encode(base64_encode($iniciativa->id)))); ?>"
}
})
});
<?php if(session('error')): ?>
Swal.fire({
icon: 'error',
title: 'No existe registro',
showConfirmButton: false,
timer: 1500
})
<?php endif; ?>
<?php if(session('success')): ?>
Swal.fire({
icon: 'success',
title: 'Votación guardada exitosamente',
showConfirmButton: false,
timer: 1500
})
<?php endif; ?>
<?php if(session('dleteVotacion')): ?>
Swal.fire({
icon: 'success',
title: "Exito",
text: 'Votación eliminada exitosamente',
showConfirmButton: false,
timer: 1500
})
<?php endif; ?>
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('../Administrador/layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/legislaedomex/public_html/legislativoedomex/resources/views/Administrador/iniciativas/votacion/create.blade.php ENDPATH**/ ?>
OHA YOOOO