Rev 16891 | Ir a la última revisión | 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/devices-and-access');$roleName = $currentUser->getUserTypeId();$allowDownload = $acl->isAllowed($roleName, 'microlearning/reports/devices-and-access/excel') ? 1 : 0;$this->headLink()->appendStylesheet($this->basePath('vendors/font-awesome/css/font-awesome.css'));$this->headLink()->appendStylesheet($this->basePath('plugins/select2/css/select2.min.css'));$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css'));$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/select2.min.js'));$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.js'));$this->headStyle()->captureStart();echo <<<CSS#tableDevices {display: flex;flex-flow: column;width: 100%;}#tableDevices thead {flex: 0 0 auto;}#tableDevices tbody {flex: 1 1 auto;display: block;overflow-y: auto;overflow-x: hidden;}#tableDevices tr {width: 100%;display: table;table-layout: fixed;}CSS;$this->headStyle()->captureEnd();$this->inlineScript()->captureStart();echo <<<JSjQuery( 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']) {$('#tableDevices tbody').empty();$('#tableDevices tbody').append($( "#deviceRowTemplate" ).render( response['data']['items'] ));if(response['data']['link_download']) {$('button.btn-download').data('href', response['data']['link_download']);$('button.btn-download').show();} else {$('button.btn-download').hide();}} 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 select').change(function(e) {e.preventDefault();$.fn.changeFilter();});$('#form-filter select').select2({theme: 'bootstrap4',width: '100%',});$('#form-filter #student_type_id').change(function(e) {e.preventDefault();$.fn.changeFilter();});$('button.btn-refresh').click(function(e) {e.preventDefault();$.fn.changeFilter();});$('button.btn-download').click(function(e) {e.preventDefault();var action = $(this).data('href');NProgress.start();$.ajax({'dataType' : 'json','method' : 'get','url' : action,}).done(function(response) {if(response['success']) {var anchor = window.document.createElement("a");anchor.href = 'data:application/octet-stream;charset=utf-8;base64,' + response['data']['content'] ;anchor.download = response['data']['basename'];document.body.appendChild(anchor);anchor.click(); // IE: "Access is denied"; see: https://connect.microsoft.com/IE/feedback/details/797361/ie-10-treats-blob-url-as-cross-origin-and-denies-accessdocument.body.removeChild(anchor);} else {$.fn.showError(response['data']);}}).fail(function( jqXHR, textStatus, errorThrown) {showError(textStatus);}).always(function() {NProgress.done();});});$.fn.changeFilter();});JS;$this->inlineScript()->captureEnd();?><!-- Content Header (Page header) --><section class="content-header"><div class="container-fluid"><div class="row mb-2"><div class="col-sm-12"><h1>LABEL_DEVICES_AND_ACCESS</h1></div></div></div><!-- /.container-fluid --></section><section class="content"><div class="container-fluid"><div class="row"><div class="col-12"><div class="card card-primary collapsed-card"><div class="card-header"><h3 class="card-title"><button type="button" data-card-widget="collapse"><i class="fa fa-filter"></i> LABEL_FILTERS</button></h3><!-- /.card-tools --></div><!-- /.card-header --><div class="card-body"><form name="form-filter" id="form-filter" action="<?php echo $routeReports ?>"><?php$fields = [['label' => 'LABEL_COMPANIES','name' => 'company_id',],['label' => 'LABEL_FUNCTIONS','name' => 'function_id',],['label' => 'LABEL_GROUPS','name' => 'group_id',],['label' => 'LABEL_INSTITUTIONS','name' => 'institution_id',],['label' => 'LABEL_PROGRAMS','name' => 'program_id',],['label' => 'LABEL_PARTNERS','name' => 'partner_id',],['label' => 'LABEL_SECTORS','name' => 'sector_id',],['label' => 'LABEL_STUDENT_TYPES','name' => 'student_type_id',],];$column = 0;foreach($fields as $field) :if($column == 0) {echo '<div class="row">';}$column++;?><div class="col-md-6 col-sm-12"><div class="form-group"><?php$element = $form->get( $field['name'] );$element->setOptions(['label' => $field['label'] ]);$element->setAttributes(['class' => 'form-control']);echo $this->formLabel($element);echo $this->formSelect($element);?></div></div><?phpif($column == 2) {$column = 0;echo '</div>';}?><?php endforeach; ?><?php if($column) {echo '</div>';}?></form></div><!-- /.card-body --></div></div></div><div class="row"><div class="col-12"><div class="card"><div class="card-header"><divclass="col-md-12 col-sm-12"><div style="float:right;"><button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button><?php if($allowDownload) : ?><button type="button" class="btn btn-info btn-download"><i class="fa fa-download"></i> LABEL_DOWNLOAD </button><?php endif;?></div></div></div><div class="card-body p-0"><table class="table table-responsive" id="tableDevices" ><thead><tr><th>LABEL_FIRST_NAME</th><th>LABEL_LAST_NAME</th><th>LABEL_EMAIL</th></tr></thead><tbody></tbody></table></div><!-- /.card-body --></div></div></div></div></section><script id="deviceRowTemplate" type="text/x-jsrender"><tr><td> {{>first_name}} </td><td> {{>last_name}} </td><td> {{>email}} </td></tr><tr><td colspan="3"><table class="table table-bordered"><thead><tr><td>Marca</td><td>Fabricante</td><td>Modelo</td><td>Plataforma</td><td>Versión</td><td>Push</td><td>Ult.uso</td></tr></thead><tbody><tr><td>{{>brand}}</td><td>{{>manufacturer}}</td><td>{{>model}}</td><td>{{>platform}}</td><td>{{>version}}</td><td>{{>token}}</td><td>{{>updated_on}}</td></tr><tbody></table></td></tr></script>