| 15387 |
efrain |
1 |
<?php
|
|
|
2 |
$acl = $this->viewModel()->getRoot()->getVariable('acl');
|
|
|
3 |
$currentUser = $this->currentUserHelper();
|
|
|
4 |
|
|
|
5 |
$roleName = $currentUser->getUserTypeId();
|
| 15574 |
anderson |
6 |
$routeDatatable = $this->url('reports/users-blocked');
|
| 15387 |
efrain |
7 |
|
|
|
8 |
$allowDownload = $acl->isAllowed($roleName, 'reports/users-blocked/excel') ? 1 : 0;
|
| 15582 |
anderson |
9 |
$allowDelete = $acl->isAllowed($roleName, 'reports/users-blocked/delete') ? 1 : 0;
|
|
|
10 |
$allowEdit = $acl->isAllowed($roleName, 'reports/users-blocked/edit') ? 1 : 0;
|
| 15387 |
efrain |
11 |
|
|
|
12 |
|
|
|
13 |
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
|
|
|
14 |
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
|
|
|
15 |
$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.js'));
|
|
|
16 |
|
| 15570 |
anderson |
17 |
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
|
|
|
18 |
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
|
|
|
19 |
|
|
|
20 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
|
|
|
21 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
|
|
|
22 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
|
|
|
23 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
|
|
|
24 |
|
| 15387 |
efrain |
25 |
$this->headStyle()->captureStart();
|
|
|
26 |
echo <<<CSS
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
#tableStudents {
|
|
|
30 |
display: flex;
|
|
|
31 |
flex-flow: column;
|
|
|
32 |
width: 100%;
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
#tableStudents thead {
|
|
|
36 |
flex: 0 0 auto;
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
#tableStudents tbody {
|
|
|
40 |
flex: 1 1 auto;
|
|
|
41 |
display: block;
|
|
|
42 |
overflow-y: auto;
|
|
|
43 |
overflow-x: hidden;
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
#tableStudents tr {
|
|
|
47 |
width: 100%;
|
|
|
48 |
display: table;
|
|
|
49 |
table-layout: fixed;
|
|
|
50 |
}
|
|
|
51 |
CSS;
|
|
|
52 |
$this->headStyle()->captureEnd();
|
|
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
|
56 |
$this->inlineScript()->captureStart();
|
|
|
57 |
echo <<<JS
|
|
|
58 |
jQuery( document ).ready(function( $ ) {
|
|
|
59 |
|
|
|
60 |
|
| 15574 |
anderson |
61 |
$.fn.loadData = function() {
|
|
|
62 |
NProgress.start();
|
|
|
63 |
$.ajax({
|
|
|
64 |
'dataType' : 'json',
|
|
|
65 |
'accept' : 'application/json',
|
|
|
66 |
'method' : 'get',
|
|
|
67 |
'url' : $('#form-filter').attr('action'),
|
|
|
68 |
'data' : $('#form-filter').serialize(),
|
|
|
69 |
}).done(function(response) {
|
|
|
70 |
if(response['success']) {
|
| 15387 |
efrain |
71 |
|
|
|
72 |
|
|
|
73 |
|
| 15574 |
anderson |
74 |
$('#gridTable tbody').empty();
|
|
|
75 |
if(response['data']['items']) {
|
| 15387 |
efrain |
76 |
|
| 15574 |
anderson |
77 |
$('#gridTable tbody').append(
|
|
|
78 |
$( "#itemRowTemplate" ).render( response['data']['items'] )
|
| 15387 |
efrain |
79 |
|
| 15574 |
anderson |
80 |
);
|
| 15387 |
efrain |
81 |
|
| 15574 |
anderson |
82 |
} else {
|
|
|
83 |
$('#gridTable tbody').append(
|
|
|
84 |
$( "#itemEmptyRowTemplate" ).render([])
|
|
|
85 |
);
|
| 15387 |
efrain |
86 |
|
| 15574 |
anderson |
87 |
}
|
| 15387 |
efrain |
88 |
|
| 15574 |
anderson |
89 |
if(response['data']['link_download']) {
|
|
|
90 |
$('button.btn-download').data('href', response['data']['link_download']);
|
|
|
91 |
$('button.btn-download').show();
|
| 15387 |
efrain |
92 |
|
| 15574 |
anderson |
93 |
} else {
|
|
|
94 |
$('button.btn-download').hide();
|
|
|
95 |
}
|
| 15387 |
efrain |
96 |
|
| 15574 |
anderson |
97 |
} else {
|
|
|
98 |
if(jQuery.type(response['data']) == 'string') {
|
|
|
99 |
$.fn.showError(response['data']);
|
|
|
100 |
} else {
|
|
|
101 |
$.each(response['data'], function( fieldname, errors ) {
|
|
|
102 |
$.fn.showFormErrorValidator('#form-filter #' + fieldname, errors);
|
|
|
103 |
});
|
|
|
104 |
}
|
|
|
105 |
}
|
|
|
106 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
107 |
$.fn.showError(textStatus);
|
|
|
108 |
}).always(function() {
|
|
|
109 |
NProgress.done();
|
|
|
110 |
});
|
|
|
111 |
return false;
|
|
|
112 |
}
|
| 15387 |
efrain |
113 |
|
|
|
114 |
|
| 15574 |
anderson |
115 |
|
|
|
116 |
|
|
|
117 |
|
|
|
118 |
|
| 15582 |
anderson |
119 |
var allowEdit = $allowEdit;
|
|
|
120 |
var allowDelete = $allowDelete;
|
| 15584 |
anderson |
121 |
|
| 15574 |
anderson |
122 |
var gridTable = $('#gridTable').dataTable( {
|
|
|
123 |
'processing': true,
|
|
|
124 |
'serverSide': true,
|
|
|
125 |
'searching': true,
|
|
|
126 |
'order': [[ 0, 'asc' ]],
|
|
|
127 |
'ordering': true,
|
|
|
128 |
'ordenable' : true,
|
|
|
129 |
'responsive': true,
|
|
|
130 |
'select' : false,
|
|
|
131 |
'paging': true,
|
|
|
132 |
'pagingType': 'simple_numbers',
|
|
|
133 |
'ajax': {
|
|
|
134 |
'url' : '$routeDatatable',
|
|
|
135 |
'type' : 'get',
|
|
|
136 |
'beforeSend': function (request) {
|
|
|
137 |
NProgress.start();
|
|
|
138 |
},
|
|
|
139 |
'dataFilter': function(response) {
|
|
|
140 |
var response = jQuery.parseJSON( response );
|
|
|
141 |
|
|
|
142 |
var json = {};
|
|
|
143 |
json.recordsTotal = 0;
|
|
|
144 |
json.recordsFiltered = 0;
|
|
|
145 |
json.data = [];
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
if(response.success) {
|
|
|
149 |
json.recordsTotal = response.data.total;
|
|
|
150 |
json.recordsFiltered = response.data.total;
|
|
|
151 |
json.data = response.data.items;
|
|
|
152 |
} else {
|
|
|
153 |
$.fn.showError(response.data)
|
|
|
154 |
}
|
|
|
155 |
|
|
|
156 |
return JSON.stringify( json );
|
|
|
157 |
}
|
|
|
158 |
},
|
|
|
159 |
'language' : {
|
|
|
160 |
'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
|
|
|
161 |
'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
|
|
|
162 |
'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
|
|
|
163 |
'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
|
|
|
164 |
'sInfo': 'LABEL_DATATABLE_SINFO',
|
|
|
165 |
'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
|
|
|
166 |
'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
|
|
|
167 |
'sInfoPostFix': '',
|
|
|
168 |
'sSearch': 'LABEL_DATATABLE_SSEARCH',
|
|
|
169 |
'sUrl': '',
|
|
|
170 |
'sInfoThousands': ',',
|
|
|
171 |
'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
|
|
|
172 |
'oPaginate': {
|
|
|
173 |
'sFirst': 'LABEL_DATATABLE_SFIRST',
|
|
|
174 |
'sLast': 'LABEL_DATATABLE_SLAST',
|
|
|
175 |
'sNext': 'LABEL_DATATABLE_SNEXT',
|
|
|
176 |
'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
|
|
|
177 |
},
|
|
|
178 |
'oAria': {
|
|
|
179 |
'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
|
|
|
180 |
'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
|
|
|
181 |
},
|
|
|
182 |
},
|
|
|
183 |
'drawCallback': function( settings ) {
|
|
|
184 |
NProgress.done();
|
|
|
185 |
$('button.btn-delete').confirmation({
|
|
|
186 |
rootSelector: 'button.btn-delete',
|
|
|
187 |
title : 'LABEL_ARE_YOU_SURE',
|
|
|
188 |
singleton : true,
|
|
|
189 |
btnOkLabel: 'LABEL_YES',
|
|
|
190 |
btnCancelLabel: 'LABEL_NO',
|
|
|
191 |
onConfirm: function(value) {
|
|
|
192 |
action = $(this).data('href');
|
|
|
193 |
NProgress.start();
|
|
|
194 |
$.ajax({
|
|
|
195 |
'dataType' : 'json',
|
|
|
196 |
'accept' : 'application/json',
|
|
|
197 |
'method' : 'post',
|
|
|
198 |
'url' : action,
|
|
|
199 |
}).done(function(response) {
|
|
|
200 |
if(response['success']) {
|
|
|
201 |
$.fn.showSuccess(response['data']);
|
|
|
202 |
gridTable.api().ajax.reload(null, false);
|
|
|
203 |
} else {
|
|
|
204 |
$.fn.showError(response['data']);
|
|
|
205 |
}
|
|
|
206 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
207 |
$.fn.showError(textStatus);
|
|
|
208 |
}).always(function() {
|
|
|
209 |
NProgress.done();
|
|
|
210 |
});
|
|
|
211 |
},
|
|
|
212 |
});
|
|
|
213 |
},
|
|
|
214 |
'aoColumns': [
|
| 15575 |
anderson |
215 |
{ 'mDataProp': 'first_name' },
|
|
|
216 |
{ 'mDataProp': 'last_name' },
|
| 15574 |
anderson |
217 |
{ 'mDataProp': 'status' },
|
| 15587 |
anderson |
218 |
|
| 15574 |
anderson |
219 |
],
|
|
|
220 |
'columnDefs': [
|
|
|
221 |
{
|
|
|
222 |
'targets': 0,
|
|
|
223 |
'className' : 'text-vertical-middle',
|
|
|
224 |
},
|
|
|
225 |
{
|
|
|
226 |
'targets': 1,
|
|
|
227 |
'className' : 'text-vertical-middle',
|
|
|
228 |
},
|
|
|
229 |
{
|
|
|
230 |
'targets': -2,
|
|
|
231 |
'orderable': false,
|
|
|
232 |
'className' : 'text-center',
|
|
|
233 |
'render' : function ( data, type, row ) {
|
|
|
234 |
|
|
|
235 |
checked = data == 'a' ? ' checked="checked" ' : '';
|
|
|
236 |
return '<div class="checkbox checkbox-success">' +
|
|
|
237 |
'<input class="styled" type="checkbox" ' + checked + ' disabled="disabled">' +
|
|
|
238 |
'<label ></label></div>';
|
|
|
239 |
}
|
|
|
240 |
},
|
|
|
241 |
{
|
|
|
242 |
'targets': -1,
|
|
|
243 |
'orderable': false,
|
| 15584 |
anderson |
244 |
// 'render' : function ( data, type, row ) {
|
|
|
245 |
// s = '';
|
| 15574 |
anderson |
246 |
|
| 15584 |
anderson |
247 |
// if(allowEdit && data['link_edit']) {
|
|
|
248 |
// 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> ';
|
|
|
249 |
// }
|
|
|
250 |
// if(allowDelete && data['link_delete']) {
|
|
|
251 |
// s = s + '<button class="btn btn-delete" data-href="' + data['link_delete']+ '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button> ';
|
|
|
252 |
// }
|
|
|
253 |
// return s;
|
|
|
254 |
// }
|
| 15574 |
anderson |
255 |
}
|
|
|
256 |
],
|
|
|
257 |
});
|
|
|
258 |
|
|
|
259 |
|
|
|
260 |
|
|
|
261 |
|
|
|
262 |
|
|
|
263 |
|
|
|
264 |
|
|
|
265 |
|
|
|
266 |
|
|
|
267 |
|
|
|
268 |
|
|
|
269 |
|
|
|
270 |
|
| 15387 |
efrain |
271 |
$('button.btn-download').click(function(e) {
|
|
|
272 |
e.preventDefault();
|
|
|
273 |
var action = $(this).data('href');
|
|
|
274 |
|
|
|
275 |
NProgress.start();
|
|
|
276 |
$.ajax({
|
|
|
277 |
'dataType' : 'json',
|
|
|
278 |
'method' : 'get',
|
|
|
279 |
'url' : action,
|
|
|
280 |
}).done(function(response) {
|
|
|
281 |
if(response['success']) {
|
|
|
282 |
var anchor = window.document.createElement("a");
|
|
|
283 |
anchor.href = 'data:application/octet-stream;charset=utf-8;base64,' + response['data']['content'] ;
|
|
|
284 |
anchor.download = response['data']['basename'];
|
|
|
285 |
document.body.appendChild(anchor);
|
|
|
286 |
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-access
|
|
|
287 |
document.body.removeChild(anchor);
|
|
|
288 |
} else {
|
|
|
289 |
$.fn.showError(response['data']);
|
|
|
290 |
}
|
|
|
291 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
292 |
showError(textStatus);
|
|
|
293 |
}).always(function() {
|
|
|
294 |
NProgress.done();
|
|
|
295 |
});
|
|
|
296 |
|
|
|
297 |
|
|
|
298 |
});
|
|
|
299 |
|
|
|
300 |
|
|
|
301 |
$('button.btn-refresh').click(function(e) {
|
|
|
302 |
e.preventDefault();
|
|
|
303 |
$.fn.loadData();
|
|
|
304 |
|
|
|
305 |
|
|
|
306 |
});
|
|
|
307 |
|
|
|
308 |
|
|
|
309 |
|
|
|
310 |
$.fn.loadData();
|
|
|
311 |
$('button.btn-download').hide();
|
|
|
312 |
|
|
|
313 |
});
|
|
|
314 |
JS;
|
|
|
315 |
$this->inlineScript()->captureEnd();
|
|
|
316 |
?>
|
|
|
317 |
|
|
|
318 |
<!-- Content Header (Page header) -->
|
|
|
319 |
<section class="content-header">
|
| 15570 |
anderson |
320 |
<div class="container-fluid">
|
|
|
321 |
<div class="row mb-2">
|
|
|
322 |
<div class="col-sm-12">
|
|
|
323 |
<h1>LABEL_REPORTS_USERS_BLOCKED</h1>
|
|
|
324 |
</div>
|
|
|
325 |
</div>
|
|
|
326 |
</div><!-- /.container-fluid -->
|
| 15387 |
efrain |
327 |
</section>
|
|
|
328 |
|
|
|
329 |
<section class="content">
|
| 15570 |
anderson |
330 |
<div class="container-fluid">
|
|
|
331 |
<div class="row">
|
|
|
332 |
<div class="col-12">
|
|
|
333 |
<div class="card">
|
|
|
334 |
<div class="card-header">
|
|
|
335 |
<div class="col-md-12 col-sm-12">
|
|
|
336 |
<div style="float:right;">
|
|
|
337 |
<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
|
|
|
338 |
<?php if ($allowDownload) : ?>
|
| 15387 |
efrain |
339 |
|
| 15570 |
anderson |
340 |
<button type="button" class="btn btn-info btn-download"><i class="fa fa-download"></i> LABEL_DOWNLOAD </button>
|
|
|
341 |
<?php endif; ?>
|
|
|
342 |
</div>
|
|
|
343 |
</div>
|
|
|
344 |
</div>
|
|
|
345 |
<div class="card-body">
|
|
|
346 |
<table id="gridTable" class="table table-hover">
|
|
|
347 |
<thead>
|
|
|
348 |
<tr>
|
|
|
349 |
<th style="width: 25%">LABEL_FIRST_NAME</th>
|
|
|
350 |
<th style="width: 25%">LABEL_LAST_NAME</th>
|
|
|
351 |
<th style="width: 30%">LABEL_EMAIL</th>
|
|
|
352 |
<th style="width: 20%">LABEL_REPORTS_LAST_ACTIVITY</th>
|
| 15387 |
efrain |
353 |
|
| 15570 |
anderson |
354 |
|
| 15387 |
efrain |
355 |
</tr>
|
| 15570 |
anderson |
356 |
</thead>
|
|
|
357 |
<tbody>
|
|
|
358 |
</tbody>
|
|
|
359 |
</table>
|
|
|
360 |
</div>
|
|
|
361 |
</div>
|
|
|
362 |
</div>
|
|
|
363 |
</div>
|
|
|
364 |
</div>
|
|
|
365 |
</section>
|
| 15387 |
efrain |
366 |
|
|
|
367 |
|
|
|
368 |
|
| 15570 |
anderson |
369 |
|
| 15387 |
efrain |
370 |
<script id="itemRowTemplate" type="text/x-jsrender">
|
|
|
371 |
<tr>
|
|
|
372 |
<td style="width: 25%">
|
|
|
373 |
{{>first_name}}
|
|
|
374 |
</td>
|
|
|
375 |
<td style="width: 25%">
|
|
|
376 |
{{>last_name}}
|
|
|
377 |
</td>
|
|
|
378 |
<td style="width: 30%">
|
|
|
379 |
{{>email}}
|
|
|
380 |
</td>
|
|
|
381 |
<td style="width: 30%">
|
|
|
382 |
{{>last_activity_on}}
|
|
|
383 |
</td>
|
|
|
384 |
|
|
|
385 |
|
|
|
386 |
|
|
|
387 |
</tr>
|
|
|
388 |
</script>
|
|
|
389 |
|
|
|
390 |
|
|
|
391 |
<script id="itemEmptyRowTemplate" type="text/x-jsrender">
|
|
|
392 |
<tr>
|
|
|
393 |
<td colspan="4">
|
|
|
394 |
LABEL_NOT_RECORDS_FOUND
|
|
|
395 |
</td>
|
|
|
396 |
</tr>
|
| 15570 |
anderson |
397 |
</script>
|