Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16910 | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

<?php
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
$currentUser    = $this->currentUserHelper();

$routeReports = $this->url('microlearning/reports/comments-for-capsule'); 

$roleName = $currentUser->getUserTypeId();


$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.js'));
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jsrender/jsrender.js'));



$this->inlineScript()->captureStart();
echo <<<JS
jQuery( document ).ready(function( $ ) {
    
    $.fn.changeFilter = function() {
        NProgress.start(); 
        $.ajax({
            'dataType'  : 'json',
            'accept'    : 'application/json',
            'method'    : 'get',
            'url'       :  $('#form-filter').attr('action'), 
            'data'      :  $('#form-filter').serialize(),
        }).done(function(response) {
            if(response['success']) {

                $('#tableStudents tbody').empty();
                $('#tableStudents tbody').append(
                    $( "#progressRowTemplate" ).render( response['data'] )

                );
    

            } else {
                if(jQuery.type(response['data']) == 'string') {
                    $.fn.showError(response['data']);
                } else  {
                    $.each(response['data'], function( fieldname, errors ) {
                        $.fn.showFormErrorValidator('#form-slide-video-edit #' + fieldname, errors);
                    });
                }
            }
        }).fail(function( jqXHR, textStatus, errorThrown) {
            $.fn.showError(textStatus);
        }).always(function() {
            NProgress.done();
        });
        return false;
    }

    $('#form-filter #topic_uuid').change(function(e) {
        e.preventDefault();

        $('#form-filter #capsule_uuid').empty();
        $.fn.changeFilter();
    })


    $('#form-filter #capsule_uuid').change(function(e) {
        e.preventDefault();

        $.fn.changeFilter();
    })


    $.fn.changeFilter();
        
});
JS;
$this->inlineScript()->captureEnd();
?>

<div class="container">
        <div class="card" id="">
                <div class="card-header">
                        <h6 class="card-title">LABEL_COMMENTS_FOR_CAPSULE</h6>
                </div>
                
                <?php 
                        $form = $this->form;
                        $form->setAttributes([
                            'name'    => 'form-filter',
                            'id'      => 'form-filter',
                        ]);
    
                        $form->prepare();
                        echo $this->form()->openTag($form);
                        ?>              
                        
                <div class="card-body">
                                <div class="row">
                                <div class="col-6  mt-3">
                       
                                    <?php
                                    $element = $form->get('topic_uuid');
                                   
                                    $element->setOptions(['label' => 'LABEL_TOPIC']);
                                    
                                    $element->setAttributes(['class' => 'form-control']);
                                    echo $this->formLabel($element);
                                    echo $this->formSelect($element);
                                    ?>
                        </div>  
                        <div class="col-6  mt-3">
                       
                                    <?php
                                    $element = $form->get('capsule_uuid');
                                    $element->setOptions(['label' => 'LABEL_CAPSULE']);
                                    $element->setAttributes(['class' => 'form-control']);
                                    echo $this->formLabel($element);
                                    echo $this->formSelect($element);
                                    ?>
                        </div>                          
                </div>
                     <div class="row">
                        <div class="col-12 mt-3">
                        
                                        <table id="gridTable" class="table   table-bordered">
                                <thead>
                                                        <tr>
                                                                        <th style="width: 12%">LABEL_FIRST_NAME</th>
                                                                        <th style="width: 12%">LABEL_LAST_NAME</th>
                                                                        <th style="width: 16%">LABEL_EMAIL_NAME</th>
                                                                <th style="width: 10%">LABEL_RATING</th>
                                                <th style="width: 50%">LABEL_COMMENT</th>

                                </tr>
                                </thead>
                                <tbody>
                                </tbody>
                        </table>
                        
                        </div>
                     </div>
                </div>
                <div class="card-footer text-right">
                        <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-sync"></i> LABEL_REFRESH  </button>
                                    <?php if($allowUpload) : ?>
                                        <button type="button" class="btn btn-primary btn-upload"><i class="fa fa-upload"></i> LABEL_UPLOAD  </button>
                                    <?php endif; ?>
                                    <?php if($allowNotification) : ?>
                                        <button type="button" class="btn btn-primary btn-notification"><i class="fa fa-tablet"></i> LABEL_NOTIFICATION </button>
                                    <?php endif; ?>
                </div>
                
                <?php echo $this->form()->closeTag($form); ?>
        </div>
</div>



  



<script id="progressRowTemplate" type="text/x-jsrender">
    <tr>
        <td style="width: 12%">
            {{>first_name}}
        </td>
        <td style="width: 12%">
             {{>last_name}}
        </td>
        <td style="width: 16%">
            {{>email}}
        </td>

        <td style="width: 20%">
            LABEL_REPORTS_FIRST_DATE 
            <br> 
            {{>first_date}} {{>first_time}}
            <br>
            LABEL_REPORTS_LAST_DATE
            <br> 
            {{>last_date}} {{>last_time}}
        </td>
        <td style="width: 12%">
            <div class="progress progress-xs progress-striped active">
                <div class="progress-bar bg-primary" style="width: {{>total_capsules_percentaje}}%"></div>
            </div>
        </td>
        <td style="width: 8%" class="text-right">{{>total_capsules_percentaje}}</td>
    </tr> 
</script>