Rev 15619 | Rev 16842 | 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();$roleName = $currentUser->getUserTypeId();$routeDatatable = $this->url('reports/users-blocked');$allowDownload = $acl->isAllowed($roleName, 'reports/users-blocked/excel') ? 1 : 0;//$allowEdit = $acl->isAllowed($roleName, 'reports/users-blocked/edit') ? 1 : 0;//$allowDelete = $acl->isAllowed($roleName, 'reports/users-blocked/delete') ? 1 : 0;$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->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));$this->headStyle()->captureStart();echo <<<CSS#tableStudents {display: flex;flex-flow: column;width: 100%;}#tableStudents thead {flex: 0 0 auto;}#tableStudents tbody {flex: 1 1 auto;display: block;overflow-y: auto;overflow-x: hidden;}#tableStudents tr {width: 100%;display: table;table-layout: fixed;}CSS;$this->headStyle()->captureEnd();$this->inlineScript()->captureStart();echo <<<JSjQuery( document ).ready(function( $ ) {$.fn.loadData = 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']) {$('#gridTable tbody').empty();if(response['data']['items']) {$('#gridTable tbody').append($( "#itemRowTemplate" ).render( response['data']['items'] ));} else {$('#gridTable tbody').append($( "#itemEmptyRowTemplate" ).render([]));}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-filter #' + fieldname, errors);});}}}).fail(function( jqXHR, textStatus, errorThrown) {$.fn.showError(textStatus);}).always(function() {NProgress.done();});return false;}// var allowEdit = $allowEdit;// var allowDelete = $allowDelete;var gridTable = $('#gridTable').dataTable( {'processing': true,'serverSide': true,'searching': true,'order': [[ 0, 'asc' ]],'ordering': true,'ordenable' : true,'responsive': true,'select' : false,'paging': true,'pagingType': 'simple_numbers','ajax': {'url' : '$routeDatatable','type' : 'get','beforeSend': function (request) {NProgress.start();},'dataFilter': function(response) {var response = jQuery.parseJSON( response );var json = {};json.recordsTotal = 0;json.recordsFiltered = 0;json.data = [];if(response.success) {json.recordsTotal = response.data.total;json.recordsFiltered = response.data.total;json.data = response.data.items;} else {$.fn.showError(response.data)}return JSON.stringify( json );}},'language' : {'sProcessing': 'LABEL_DATATABLE_SPROCESSING','sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU','sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS','sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE','sInfo': 'LABEL_DATATABLE_SINFO','sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY','sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED','sInfoPostFix': '','sSearch': 'LABEL_DATATABLE_SSEARCH','sUrl': '','sInfoThousands': ',','sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS','oPaginate': {'sFirst': 'LABEL_DATATABLE_SFIRST','sLast': 'LABEL_DATATABLE_SLAST','sNext': 'LABEL_DATATABLE_SNEXT','sPrevious': 'LABEL_DATATABLE_SPREVIOUS'},'oAria': {'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING','sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'},},'drawCallback': function( settings ) {NProgress.done();$('button.btn-delete').confirmation({rootSelector: 'button.btn-delete',title : 'LABEL_ARE_YOU_SURE',singleton : true,btnOkLabel: 'LABEL_YES',btnCancelLabel: 'LABEL_NO',onConfirm: function(value) {action = $(this).data('href');NProgress.start();$.ajax({'dataType' : 'json','accept' : 'application/json','method' : 'post','url' : action,}).done(function(response) {if(response['success']) {$.fn.showSuccess(response['data']);gridTable.api().ajax.reload(null, false);} else {$.fn.showError(response['data']);}}).fail(function( jqXHR, textStatus, errorThrown) {$.fn.showError(textStatus);}).always(function() {NProgress.done();});},});},'aoColumns': [{ 'mDataProp': 'first_name' },{ 'mDataProp': 'last_name' },{ 'mDataProp': 'email' },{ 'mDataProp': 'last_activity_on' },{ 'mDataProp': 'actions' },],'columnDefs': [{'targets': 0,'className' : 'text-vertical-middle',},{'targets': 1,'orderable': false,'className' : 'text-vertical-middle',},{'targets': -2,'orderable': false,'className' : 'text-center','render' : function ( data, type, row ) {checked = data == 'a' ? ' checked="checked" ' : '';return '<div class="checkbox checkbox-success">' +'<input class="styled" type="checkbox" ' + checked + ' disabled="disabled">' +'<label ></label></div>';}},{'targets': -1,'orderable': false,'render' : function ( data, type, row ) {s = '';/*if(allowEdit) {s = s + '<button class="btn btn-primary btn-edit" data-href="' + data['link_edit']+ '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button> ';}if(allowDelete) {s = s + '<button class="btn btn-danger btn-delete" data-href="' + data['link_delete']+ '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button> ';}*/return s;}}],});$('button.btn-refresh').click(function(e) {e.preventDefault();$.fn.loadData();});$.fn.loadData();$('button.btn-download').hide();});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_REPORTS_USERS_BLOCKED</h1></div></div></div><!-- /.container-fluid --></section><section class="content"><div class="container-fluid"><div class="row"><div class="col-12"><div class="card"><div class="card-header"><div class="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"><table id="gridTable" class="table table-hover"><thead><tr><th style="width: 25%">LABEL_FIRST_NAME</th><th style="width: 25%">LABEL_LAST_NAME</th><th style="width: 30%">LABEL_EMAIL</th><th style="width: 20%">LABEL_REPORTS_LAST_ACTIVITY</th><th>LABEL_ACTIONS</th></tr></thead><tbody></tbody></table></div></div></div></div></div></section><script id="itemRowTemplate" type="text/x-jsrender"><tr><td style="width: 25%">{{>first_name}}</td><td style="width: 25%">{{>last_name}}</td><td style="width: 30%">{{>email}}</td><td style="width: 30%">{{>last_activity_on}}</td></tr></script><script id="itemEmptyRowTemplate" type="text/x-jsrender"><tr><td colspan="4">LABEL_NOT_RECORDS_FOUND</td></tr></script>