MINI MINI MANI MO

Path : /var/www/html/sistemas/saplxi/storage/framework/views/
File Upload :
Current File : /var/www/html/sistemas/saplxi/storage/framework/views/bd032d9616c6a91d7cb3e7a9cb63ef0bdda443ee.php

<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')); ?>">

<div class="section">
    <div class="card">
        <div class="card-content">
            <h5>Comisiones</h5>
            <div class="row">
                <div class="input-field col s4">
                    <div class="form-group">
                        <label class="control-label" style=" color:  #960948;"><strong>Comision: </strong></label>
                        <?php echo Form::select('comision[id_comision]', $comisiones,  isset($comision) ? ($comision->comision_unida ?  json_decode($comision->id_comision) : $comision->id_comision ) : null,['class' => 'select2 browser-default form-control text-uppercase', 'id' => 'id_comision', 'name' => 'comisiones[]', 'required' => true, "multiple" => "multiple"]); ?>

                    </div>
                </div>
              
                <div class="input-field col s4">
                    <div class="form-group">
                        <label class="control-label" style=" color:  #960948;"><strong>Legislatura:
                            </strong></label>
                        <?php echo Form::text('comision[legislatura]', isset($comision) ? $comision->legislatura : "LXI", ['class' => 'form-control text-uppercase', 'placeholder' => 'LXI', 'id' => 'legislatura', 'readonly' => true]); ?>

                    </div>
                </div>
                <div class="input-field col s4">
                    <div class="form-group">
                        <label class="control-label" style=" color:  #960948;"><strong>Fecha: </strong></label>
                        <?php echo Form::datetimeLocal('comision[date]',isset($comision)  ? \Carbon\Carbon::createFromDate($comision->date)->format("Y-m-d\TH:i") : null,['class' => 'form-control text-uppercase ', 'placeholder' => 'P. Ej. Orozco', 'id' => 'date', 'required' => true]); ?>

                    </div>
                </div>

            </div>
            <div class="row">
                
                <div class="input-field col s4">
                    <div class="form-group">
                        <label class="control-label" style=" color:  #960948;"><strong>Reunion No. : </strong></label>
                        <?php echo Form::number('comision[sesion]', isset($comision) ? $comision->sesion : $last, ['class' => 'form-control text-uppercase', 'id' => 'sesion']); ?>

                    </div>
                </div>
                <div class="input-field col s4">
                    <div class="form-group">
                        <label class="control-label" style=" color:  #960948;"><strong>Año:</strong></label>
                        <?php echo Form::select('comision[id_sesion]', isset($an) ?  $an  : [], isset($comision) ? $comision->id_sesion : null, ['class' => 'validate select2 browser-default  text-uppercase', 'placeholder' => 'Selecciona una opción', 'id' => 'legis_year', 'required' => true]); ?>

                    </div>
                </div>
                <div class="input-field col s4">
                    <div class="form-group">
                        <label class="control-label" style=" color:  #960948;"><strong>Periodo:</strong></label>
                        <?php echo Form::select('comision[id_periodo]', isset($periodo) ?  $periodo  : [], isset($comision) ? $comision->id_periodo : null, ['class' => 'validate select2 browser-default  text-uppercase', 'placeholder' => 'Selecciona una opción', 'id' => 'periodo', 'required' => true]); ?>

                    </div>
                </div>
            </div>
            <div class="row">
               
                              
            </div>
            <div class="row">
                <div class="input-field col s4">
                    <div class="form-group">
                        <label class="control-label" style=" color:  #960948;"><strong>Tipo de tema:</strong></label><br><br>
                        <?php echo Form::select('tipo[tema]', ['0' => 'SELECCIONA UNA OPCION', '1' => 'INICIATIVA', '2' => 'PUNTOS DE ACUERDO', '3' => 'OTRO TEMA'], null,['class' => 'select2 browser-default form-control text-uppercase', 'id' => 'tipo_tema', 'name' => 'tipoTemas', 'required' => true]); ?>

                        
                    </div>
                </div>  
                <div style="display: none;" id="TemaSubtemas">
                    <div class="input-field col s4" id="SelecTema" >
                        <div class="form-group">
                            <i class="material-icons prefix" id="AddtemaComision">add</i>
                            <label class="control-label" style=" color:  #960948;"><strong>Tema:</strong></label><br><br>
                                <div id="selectIniciativa" style="display: none;"><?php echo Form::select('comision[id_comision]', $iniciativas, null,['class' => 'select2 browser-default form-control text-uppercase', 'id' => 'id_iniciativa', 'name' => 'iniciativas[]', 'placeholder' => 'SELECCIONA UNA OPCION', 'required' => true]); ?></div>
                                <div id="selectPuntosAcuerdos" style="display: none;"><?php echo Form::select('comision[id_comision]', $puntosAcuerdos, null,['class' => 'select2 browser-default form-control text-uppercase', 'id' => 'id_puntos_acuerdos', 'name' => 'puntosAcuerdos[]', 'placeholder' => 'SELECCIONA UNA OPCION', 'required' => true]); ?></div>
                                <div id="selecTexto" style="display: none;"><?php echo Form::text('tema[tema]', isset($comision) ? $comision->tema : null, ['class' => 'form-control text-uppercase', 'placeholder' => 'E.j. tema comision', 'id' => 'temaTXTCom']); ?></div>
                        </div>
                    </div>
                    <div class="input-field col s4" id="SelecSubtema" >
                        <div class="form-group">
                            <label class="control-label" style=" color:  #960948;"><strong>Subtema:</strong></label><br>
                            <!--<div id="selecTexto" ><?php echo Form::text('tema[subtema]', isset($comision) ? $comision->subtema : null, ['class' => 'form-control text-uppercase', 'placeholder' => 'E.j. tema comision', 'id' => 'SubtemaTXTCom']); ?></div>-->
                                <div class="chips chips-initial"></div>
                        </div>
                    </div>
                    
                    
               
                </div>
                <input type="text" value="Hello" name="comisionesTema[]"  id="temasInput" style="display: none;">
            </div>
            <div class="row">
                <label class="control-label" style=" color:  #960948;"><strong>Temas:</strong></label>
                <!--<ul class="collapsible" data-collapsible="accordion" id="AccoTema"></ul>-->
                <div class="responsive-table">
                    <table class="table invoice-data-table white border-radius-4 pt-1" id="tableservicios">
                        <thead>
                        <tr>
                            <th>
                                No.
                            </th>
                            <th>Tema</th>
                            <th>Subtema</th>
                            <th>Eliminar</th>
                        </tr>
                        </thead>

                        <tbody id="temasTables">
                            <?php if(isset($comision)): ?>
                                <?php $i=1; ?>
                                <?php $__currentLoopData = $temas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr data-control="<?php echo e($i); ?>" id="<?php echo e($value->id); ?>">
                                        <td><?php echo e($i); ?></td>
                                        <td><?php if($value->tipo == 1 || $value->tipo == 2): ?><?php echo e($value->Iniciativa->iniciativa); ?><?php else: ?><?php echo e($value->tema); ?><?php endif; ?></td>
                                        <td><?php if(count($value->subTemas)): ?><?php $__currentLoopData = $value->subTemas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php echo e($item->subtema); ?>, <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php else: ?> Sin subtema <?php endif; ?></td>
                                        <td><div class="invoice-action"><a onClick="eliminarCollapsible(<?php echo e($value->id); ?>)"><i class="material-icons">delete</i></a></div></td>
                                    </tr>
                                    <?php $i++ ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                
                            <?php endif; ?>
                        
                            

                        </tbody>
                    </table>
                </div>
            </div>
            <br>
            <div class="row">
                <div class="col s12 m4 l3">
                    <label class="control-label" style=" color:  #960948;">
                        <strong>
                            Orden del día
                        </strong>
                    </label>
                </div>
                <div class="col s12 m8 l9">
                    <?php echo Form::file('orden', ['class' => 'dropify', 'id' => 'orden']); ?>

                </div>
            </div>
            <div class="row">
                <div class="col s12 m4 l3">
                    <label class="control-label" style=" color:  #960948;">
                        <strong>
                            Acta de la sesión
                        </strong>
                    </label>
                </div>
                <div class="col s12 m8 l9">
                    <?php echo Form::file('acta', ['class' => 'dropify', 'id' => 'acta']); ?>

                </div>
            </div>
            <div class="row">
                <div class="col s12 m4 l3">
                    <label class="control-label" style=" color:  #960948;">
                        <strong>
                            Versión 
                        </strong>
                    </label>
                </div>
                <div class="col s12 m8 l9">
                    <?php echo Form::file('version', ['class' => 'dropify', 'id' => 'version']); ?>

                </div>
            </div>
            <div class="row">
                <div class="col s12">
                    <center>
                        <button class="btn cyan waves-effect waves-light right" id="btnSubmit" type="submit">Guardar
                            <i class="material-icons right">save</i>
                        </button>
                    </center>
                </div>
            </div>
        </div>

    </div>
</div>
</div>
<?php $__env->startPush('scripts'); ?>
    <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>
    <script src="<?php echo e(asset('js/scripts/form-file-uploads.js')); ?>"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tagsinput/0.8.0/bootstrap-tagsinput.min.js" integrity="sha512-9UR1ynHntZdqHnwXKTaOm1s6V9fExqejKvg5XMawEMToW4sSw+3jtLrYfZPijvnwnnE8Uol1O9BcAskoxgec+g==" crossorigin="anonymous"></script>
    <script type="text/javascript">
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
        var array_temas = [];

        $(document).ready(function () {

            $(".select2").select2();
            $('.select3-size-sm').select2({
                dropdownAutoWidth: true,
                width: '100%',
                containerCssClass: 'select-sm'
            });
            $('.timepicker').datepicker();
            document.addEventListener('DOMContentLoaded', function() {
                var elems = document.querySelectorAll('.chips');
                var instances = M.Chips.init(elems, options);
            });

            $('.chips').chips();
            $('.chips-initial').chips({
                placeholder: 'Agregar subtema',
                secondaryPlaceholder: '+Agregar',
            });
            var j = 1;
            var tipoTema;
            <?php if(isset($comision)): ?>
                const temas = <?php echo json_encode($temas, 15, 512) ?>;
                var subtema = [];
                $.each(temas, function( index, value ) {
                    /*console.log(value)
                    console.log(value.sub_temas.length)
                    /*let $option = $('<option />', {text: value, value: value, selected: 'selected'});
                    $('.select3-size-sm').prepend($option);*/
                    if(value.sub_temas.length != 0){
                        $.each(value.sub_temas, function( index, value ) {
                            subtema.push(value.subtema);
                        });
                    }else{
                        subtema = [];
                    }
                    array_temas.push({
                        tema: value.tema,
                        subtema: subtema,
                        control: j,
                        tipo: value.tipo
                    });
                    j++;
                });
               
            <?php endif; ?>
            
            $("#tipo_tema").on('change', function(){
                tipoTema  = $(this).val()
                console.log(tipoTema)
                if(tipoTema == 1){
                    $("#selectIniciativa").show()
                    $("#selecTexto").hide()
                    $("#TemaSubtemas").show()
                    $("#selectPuntosAcuerdos").hide()

                }else if(tipoTema == 2){
                    $("#selectPuntosAcuerdos").show()
                    $("#selectIniciativa").hide()
                    $("#TemaSubtemas").show()
                    $("#selecTexto").hide()

                }else if(tipoTema == 0){
                    $("#selecTexto").hide()
                    $("#selectIniciativa").hide()
                    $("#TemaSubtemas").hide()
                    $("#selectIniciativa").hide()
                    $("#selectPuntosAcuerdos").hide()

                }else if(tipoTema == 3){
                    $("#selecTexto").show()
                    $("#selectIniciativa").hide()
                    $("#TemaSubtemas").show()
                    $("#selectIniciativa").hide()
                    $("#selectPuntosAcuerdos").hide()
                }
            });

            $("#AddtemaComision").on('click', function () {
               
                //var arr = JSON.stringify(M.Chips.getInstance($('.chips')).chipsData)
                var arr = M.Chips.getInstance($('.chips')).chipsData;
                var texto;
                var subtema = [];
                for (var key in arr){
                   subtema.push(arr[key].tag)
                }
          
                 
                if(tipoTema == 1){
                    array_temas.push({
                        tema: $("#id_iniciativa").val(),
                        subtema: subtema,
                        control: j,
                        tipo: 1
                    });
                    texto = $('#id_iniciativa option:selected').text();
                    $("#id_iniciativa").val("").trigger("change");
               

                }else if(tipoTema == 2){
                    array_temas.push({
                        tema: $("#id_puntos_acuerdos").val(),
                        subtema: subtema,
                        control: j,
                        tipo: 2
                    });
                    texto = $('#id_puntos_acuerdos option:selected').text();
                    $("#id_puntos_acuerdos").val("").trigger("change");

                }else if(tipoTema == 3){
                    array_temas.push({
                        tema: $("#temaTXTCom").val(),
                        subtema: subtema,
                        control: j,
                        tipo: 0
                    });
                    texto = $('#temaTXTCom').val();
                    $("#temaTXTCom").val("");
                }

                if(texto == 'SELECCIONA UNA OPCION' || texto == '' ){
                    Swal.fire({
                        title: "Advertencia",
                        text: "Selecciona un tema",
                        icon: 'warning',
                        confirmButtonColor: '#3085d6',
                        confirmButtonText: 'Ok'
                    });
                    array_temas.pop()
                }else{
                    let index = array_temas.length - 1;
                    $("#temasTables").append('<tr data-control="'+j+' "id="'+index+'"><td>'+j+'</td><td>'+texto+'</td><td>'+( subtema.length != 0 ? subtema.join() : 'Sin Subtema')+'</td><td><div class="invoice-action"><a onClick="eliminarCollapsible('+index+')"><i class="material-icons">delete</i></a></div></td></tr>');
                    $("#temaTXTCom").val("")
                    j++
                    $('.chips').chips();
                    $('.chips-initial').chips({
                        placeholder: 'Agregar subtema',
                        secondaryPlaceholder: '+Agregar',
                    });
                    $("#tipo_tema").val(0).trigger("change");
                }
                
               
            });
 
        
            $("#btnSubmit").on('click', function(e){
                e.preventDefault()
                console.log(array_temas)
                $("#temasInput").val(JSON.stringify(array_temas))
                /*if(array_temas.length == 0){
                    Swal.fire({
                        title: "Advertencia",
                        text: "No hay temas seleccionados para esta reunion",
                        icon: 'warning',
                        confirmButtonColor: '#3085d6',
                        confirmButtonText: 'Ok'
                    });
                }else{
                    $("#FormComisiones").submit();
                }*/
                $("#FormComisiones").submit();
            });

        });

        function eliminarCollapsible(index){
            //console.log(index)
            var select = $("#"+index).data('control');
            var eliminado;
            array_temas.forEach(function(elemento, indice, array) {
                console.log(elemento.control)
                if(elemento.control == select){
                    eliminado = indice
                }
            });
            array_temas.splice(eliminado, 1);
            $("#"+index).remove()
           
        }
    </script>
<?php $__env->stopPush(); ?>
<?php /**PATH /home/legislaedomex/public_html/legislativoedomex/resources/views/Administrador/comisiones/form.blade.php ENDPATH**/ ?>

OHA YOOOO