Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15194 | Rev 16841 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

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