| 1 |
www |
1 |
<?php
|
|
|
2 |
$acl = $this->viewModel()->getRoot()->getVariable('acl');
|
|
|
3 |
$currentUser = $this->currentUserHelper();
|
|
|
4 |
|
|
|
5 |
$roleName = $currentUser->getUserTypeId();
|
|
|
6 |
|
| 16822 |
efrain |
7 |
|
| 1 |
www |
8 |
$routeDatatable = $this->url('followers');
|
|
|
9 |
|
|
|
10 |
|
| 16822 |
efrain |
11 |
$allowDelete = $acl->isAllowed($roleName, 'followers/delete') ? 1 : 0;
|
| 11215 |
stevensc |
12 |
|
| 16841 |
efrain |
13 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));
|
|
|
14 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.js'));
|
| 15194 |
stevensc |
15 |
|
| 16822 |
efrain |
16 |
|
| 16966 |
efrain |
17 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.css'));
|
|
|
18 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.css'));
|
| 16822 |
efrain |
19 |
|
| 16966 |
efrain |
20 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net/jquery.dataTables.js'));
|
|
|
21 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.js'));
|
|
|
22 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/dataTables.responsive.min.js'));
|
|
|
23 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.min.js'));
|
| 16822 |
efrain |
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
|
| 16966 |
efrain |
30 |
|
| 16822 |
efrain |
31 |
$this->inlineScript()->captureStart();
|
|
|
32 |
echo <<<JS
|
|
|
33 |
jQuery( document ).ready(function( $ ) {
|
|
|
34 |
|
|
|
35 |
var allowDelete = $allowDelete;
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
var gridTable = $('#gridTable').dataTable( {
|
|
|
39 |
'processing': true,
|
|
|
40 |
'serverSide': true,
|
|
|
41 |
'searching': true,
|
|
|
42 |
'order': [[ 1, 'asc' ]],
|
|
|
43 |
'ordering': true,
|
|
|
44 |
'ordenable' : true,
|
|
|
45 |
'responsive': true,
|
|
|
46 |
'select' : false,
|
|
|
47 |
'paging': true,
|
|
|
48 |
'pagingType': 'simple_numbers',
|
|
|
49 |
'ajax': {
|
|
|
50 |
'url' : '$routeDatatable',
|
|
|
51 |
'type' : 'get',
|
|
|
52 |
'beforeSend': function (request) {
|
|
|
53 |
NProgress.start();
|
|
|
54 |
},
|
|
|
55 |
'dataFilter': function(response) {
|
|
|
56 |
var response = jQuery.parseJSON( response );
|
|
|
57 |
|
|
|
58 |
var json = {};
|
|
|
59 |
json.recordsTotal = 0;
|
|
|
60 |
json.recordsFiltered = 0;
|
|
|
61 |
json.data = [];
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
if(response.success) {
|
|
|
65 |
json.recordsTotal = response.data.total;
|
|
|
66 |
json.recordsFiltered = response.data.total;
|
|
|
67 |
json.data = response.data.items;
|
|
|
68 |
} else {
|
|
|
69 |
$.fn.showError(response.data)
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
return JSON.stringify( json );
|
|
|
73 |
}
|
|
|
74 |
},
|
|
|
75 |
'language' : {
|
|
|
76 |
'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
|
|
|
77 |
'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
|
|
|
78 |
'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
|
|
|
79 |
'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
|
|
|
80 |
'sInfo': 'LABEL_DATATABLE_SINFO',
|
|
|
81 |
'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
|
|
|
82 |
'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
|
|
|
83 |
'sInfoPostFix': '',
|
|
|
84 |
'sSearch': 'LABEL_DATATABLE_SSEARCH',
|
|
|
85 |
'sUrl': '',
|
|
|
86 |
'sInfoThousands': ',',
|
|
|
87 |
'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
|
|
|
88 |
'oPaginate': {
|
|
|
89 |
'sFirst': 'LABEL_DATATABLE_SFIRST',
|
|
|
90 |
'sLast': 'LABEL_DATATABLE_SLAST',
|
|
|
91 |
'sNext': 'LABEL_DATATABLE_SNEXT',
|
|
|
92 |
'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
|
|
|
93 |
},
|
|
|
94 |
'oAria': {
|
|
|
95 |
'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
|
|
|
96 |
'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
|
|
|
97 |
},
|
|
|
98 |
},
|
|
|
99 |
'drawCallback': function( settings ) {
|
|
|
100 |
NProgress.done();
|
|
|
101 |
|
|
|
102 |
},
|
|
|
103 |
'aoColumns': [
|
|
|
104 |
{ 'mDataProp': 'first_name' },
|
|
|
105 |
{ 'mDataProp': 'last_name' },
|
|
|
106 |
{ 'mDataProp': 'email' },
|
|
|
107 |
{ 'mDataProp': 'actions' },
|
|
|
108 |
],
|
|
|
109 |
'columnDefs': [
|
|
|
110 |
{
|
|
|
111 |
'targets': 0,
|
|
|
112 |
'className' : 'text-vertical-middle',
|
|
|
113 |
},
|
|
|
114 |
{
|
|
|
115 |
'targets': 1,
|
|
|
116 |
'className' : 'text-vertical-middle',
|
|
|
117 |
},
|
|
|
118 |
{
|
|
|
119 |
'targets': 2,
|
|
|
120 |
'className' : 'text-vertical-middle',
|
|
|
121 |
},
|
|
|
122 |
{
|
|
|
123 |
'targets': -1,
|
|
|
124 |
'orderable': false,
|
|
|
125 |
'render' : function ( data, type, row ) {
|
|
|
126 |
s = ' ';
|
|
|
127 |
|
|
|
128 |
if(allowDelete && data['link_delete']) {
|
|
|
129 |
s = s + '<button class="btn btn-danger btn-delete" data-href="' + data['link_delete']+ '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-times"></i> LABEL_DELETE </button> ';
|
|
|
130 |
}
|
|
|
131 |
|
|
|
132 |
return s;
|
|
|
133 |
}
|
|
|
134 |
}
|
|
|
135 |
|
|
|
136 |
],
|
|
|
137 |
});
|
|
|
138 |
|
|
|
139 |
$('body').on('click', 'button.btn-refresh', function(e) {
|
|
|
140 |
e.preventDefault();
|
|
|
141 |
gridTable.api().ajax.reload(null, false);
|
|
|
142 |
});
|
|
|
143 |
|
|
|
144 |
$('body').on('click', 'button.btn-delete', function(e) {
|
|
|
145 |
e.preventDefault();
|
|
|
146 |
var action = $(this).data('href');
|
|
|
147 |
|
|
|
148 |
|
|
|
149 |
swal.fire({
|
|
|
150 |
title: 'LABEL_ARE_YOU_SURE',
|
|
|
151 |
icon: 'question',
|
|
|
152 |
cancelButtonText: 'LABEL_NO',
|
|
|
153 |
showCancelButton: true,
|
|
|
154 |
confirmButtonText: 'LABEL_YES'
|
|
|
155 |
}).then((result) => {
|
|
|
156 |
if (result.isConfirmed) {
|
|
|
157 |
|
|
|
158 |
NProgress.start();
|
|
|
159 |
$.ajax({
|
|
|
160 |
'dataType' : 'json',
|
|
|
161 |
'accept' : 'application/json',
|
|
|
162 |
'method' : 'post',
|
|
|
163 |
'url' : action,
|
|
|
164 |
}).done(function(response) {
|
|
|
165 |
if(response['success']) {
|
|
|
166 |
$.fn.showSuccess(response['data']);
|
|
|
167 |
gridTable.api().ajax.reload(null, false);
|
|
|
168 |
} else {
|
|
|
169 |
$.fn.showError(response['data']);
|
|
|
170 |
}
|
|
|
171 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
172 |
$.fn.showError(textStatus);
|
|
|
173 |
}).always(function() {
|
|
|
174 |
NProgress.done();
|
|
|
175 |
});
|
|
|
176 |
}
|
|
|
177 |
});
|
|
|
178 |
|
|
|
179 |
|
|
|
180 |
});
|
|
|
181 |
|
|
|
182 |
});
|
|
|
183 |
JS;
|
|
|
184 |
$this->inlineScript()->captureEnd();
|
| 7545 |
stevensc |
185 |
?>
|
| 7707 |
stevensc |
186 |
|
| 16822 |
efrain |
187 |
|
|
|
188 |
<div class="container">
|
|
|
189 |
<div class="row">
|
| 16891 |
efrain |
190 |
<div class="col-12 mt-3">
|
| 16822 |
efrain |
191 |
<div class="card">
|
| 16967 |
efrain |
192 |
<div class="card-header">
|
|
|
193 |
<h6 class="card-title">LABEL_FOLLOWERS</h6>
|
|
|
194 |
</div>
|
| 16822 |
efrain |
195 |
<div class="card-body">
|
| 16845 |
efrain |
196 |
<table id="gridTable" class="table table-bordered">
|
| 16822 |
efrain |
197 |
<thead>
|
|
|
198 |
<tr>
|
|
|
199 |
<th>LABEL_FIRST_NAME</th>
|
|
|
200 |
<th>LABEL_LAST_NAME</th>
|
|
|
201 |
<th>LABEL_EMAIL</th>
|
|
|
202 |
<th>LABEL_ACTIONS</th>
|
|
|
203 |
</tr>
|
|
|
204 |
</thead>
|
|
|
205 |
<tbody>
|
|
|
206 |
</tbody>
|
|
|
207 |
</table>
|
|
|
208 |
</div>
|
|
|
209 |
<div class="card-footer clearfix">
|
|
|
210 |
<div style="float:right;">
|
| 16992 |
efrain |
211 |
<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-sync"></i> LABEL_REFRESH </button>
|
| 16822 |
efrain |
212 |
</div>
|
|
|
213 |
</div>
|
|
|
214 |
</div>
|
|
|
215 |
</div>
|
|
|
216 |
</div>
|
|
|
217 |
</div>
|