Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 15571 Rev 15574
Línea 1... Línea 1...
1
<?php
1
<?php
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
 
-
 
5
$roleName = $currentUser->getUserTypeId();
Línea 5... Línea 6...
5
$roleName = $currentUser->getUserTypeId();
6
$routeDatatable = $this->url('reports/users-blocked');
Línea 55... Línea 56...
55
$this->inlineScript()->captureStart();
56
$this->inlineScript()->captureStart();
56
echo <<<JS
57
echo <<<JS
57
jQuery( document ).ready(function( $ ) {
58
jQuery( document ).ready(function( $ ) {
Línea 58... Línea 59...
58
 
59
 
59
 
60
 
60
    // $.fn.loadData = function() {
61
    $.fn.loadData = function() {
61
    //     NProgress.start(); 
62
        NProgress.start(); 
62
    //     $.ajax({
63
        $.ajax({
63
    //         'dataType'  : 'json',
64
            'dataType'  : 'json',
64
    //         'accept'    : 'application/json',
65
            'accept'    : 'application/json',
65
    //         'method'    : 'get',
66
            'method'    : 'get',
66
    //         'url'       :  $('#form-filter').attr('action'), 
67
            'url'       :  $('#form-filter').attr('action'), 
67
    //         'data'      :  $('#form-filter').serialize(),
68
            'data'      :  $('#form-filter').serialize(),
Línea 68... Línea 69...
68
    //     }).done(function(response) {
69
        }).done(function(response) {
69
    //         if(response['success']) {
70
            if(response['success']) {
Línea 70... Línea 71...
70
 
71
 
71
 
72
 
Línea 72... Línea 73...
72
 
73
 
Línea 73... Línea 74...
73
    //            $('#gridTable tbody').empty();
74
               $('#gridTable tbody').empty();
74
    //             if(response['data']['items']) { 
75
                if(response['data']['items']) { 
75
                    
76
                    
76
    //                 $('#gridTable tbody').append(
77
                    $('#gridTable tbody').append(
77
    //                     $( "#itemRowTemplate" ).render( response['data']['items'] )
78
                        $( "#itemRowTemplate" ).render( response['data']['items'] )
78
    
79
    
79
    //                 );
80
                    );
80
        
81
        
81
    //             } else {
82
                } else {
82
    //                 $('#gridTable tbody').append(
83
                    $('#gridTable tbody').append(
83
    //                     $( "#itemEmptyRowTemplate" ).render([])
84
                        $( "#itemEmptyRowTemplate" ).render([])
84
    //                 );
85
                    );
85
 
86
 
86
    //             }
87
                }
87
 
88
 
88
    //             if(response['data']['link_download']) {
89
                if(response['data']['link_download']) {
89
    //                 $('button.btn-download').data('href', response['data']['link_download']);
90
                    $('button.btn-download').data('href', response['data']['link_download']);
90
    //                 $('button.btn-download').show();
91
                    $('button.btn-download').show();
91
 
92
 
92
    //             } else {
93
                } else {
93
    //                  $('button.btn-download').hide();
94
                     $('button.btn-download').hide();
94
    //             }
95
                }
95
 
96
 
96
    //         } else {
97
            } else {
97
    //             if(jQuery.type(response['data']) == 'string') {
98
                if(jQuery.type(response['data']) == 'string') {
98
    //                 $.fn.showError(response['data']);
99
                    $.fn.showError(response['data']);
99
    //             } else  {
100
                } else  {
100
    //                 $.each(response['data'], function( fieldname, errors ) {
101
                    $.each(response['data'], function( fieldname, errors ) {
101
    //                     $.fn.showFormErrorValidator('#form-filter #' + fieldname, errors);
102
                        $.fn.showFormErrorValidator('#form-filter #' + fieldname, errors);
102
    //                 });
103
                    });
103
    //             }
104
                }
-
 
105
            }
-
 
106
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
107
            $.fn.showError(textStatus);
-
 
108
        }).always(function() {
-
 
109
            NProgress.done();
-
 
110
        });
-
 
111
        return false;
-
 
112
    }
-
 
113
 
-
 
114
 
-
 
115
 
-
 
116
 
-
 
117
 
-
 
118
 
-
 
119
 
-
 
120
 
-
 
121
    var gridTable = $('#gridTable').dataTable( {
-
 
122
            'processing': true,
-
 
123
            'serverSide': true,
-
 
124
            'searching': true,
-
 
125
            'order': [[ 0, 'asc' ]],
-
 
126
            'ordering':  true,
-
 
127
            'ordenable' : true,
-
 
128
            'responsive': true,
-
 
129
            'select' : false,
-
 
130
        	'paging': true,
-
 
131
            'pagingType': 'simple_numbers',
-
 
132
    		'ajax': {
-
 
133
    			'url' : '$routeDatatable',
-
 
134
    			'type' : 'get',
-
 
135
                'beforeSend': function (request) {
-
 
136
                  NProgress.start();
-
 
137
                },
-
 
138
                'dataFilter': function(response) {
-
 
139
                    var response = jQuery.parseJSON( response );
-
 
140
                    
-
 
141
                    var json                = {};
-
 
142
                    json.recordsTotal       = 0;
-
 
143
                    json.recordsFiltered    = 0;
-
 
144
                    json.data               = [];
-
 
145
                    
-
 
146
                    
-
 
147
                    if(response.success) {
-
 
148
                        json.recordsTotal       = response.data.total;
-
 
149
                        json.recordsFiltered    = response.data.total;
-
 
150
                        json.data               = response.data.items;
-
 
151
                    } else {
-
 
152
                        $.fn.showError(response.data)
-
 
153
                    }
-
 
154
                    
-
 
155
                    return JSON.stringify( json );
-
 
156
                }
-
 
157
    		},
-
 
158
            'language' : {
-
 
159
                'sProcessing':     'LABEL_DATATABLE_SPROCESSING',
-
 
160
                'sLengthMenu':     'LABEL_DATATABLE_SLENGTHMENU',
-
 
161
                'sZeroRecords':    'LABEL_DATATABLE_SZERORECORDS',
-
 
162
                'sEmptyTable':     'LABEL_DATATABLE_SEMPTYTABLE',
-
 
163
                'sInfo':           'LABEL_DATATABLE_SINFO',
-
 
164
                'sInfoEmpty':      'LABEL_DATATABLE_SINFOEMPTY',
-
 
165
                'sInfoFiltered':   'LABEL_DATATABLE_SINFOFILTERED',
-
 
166
                'sInfoPostFix':    '',
-
 
167
                'sSearch':         'LABEL_DATATABLE_SSEARCH',
-
 
168
                'sUrl':            '',
-
 
169
                'sInfoThousands':  ',',
-
 
170
                'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
-
 
171
                'oPaginate': {
-
 
172
                    'sFirst':    'LABEL_DATATABLE_SFIRST',
-
 
173
                    'sLast':     'LABEL_DATATABLE_SLAST',
-
 
174
                    'sNext':     'LABEL_DATATABLE_SNEXT',
-
 
175
                    'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
-
 
176
                },
-
 
177
                'oAria': {
-
 
178
                    'sSortAscending':  ': LABEL_DATATABLE_SSORTASCENDING',
-
 
179
                    'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
-
 
180
                },
-
 
181
            },
-
 
182
            'drawCallback': function( settings ) {
-
 
183
                NProgress.done();
-
 
184
                $('button.btn-delete').confirmation({
-
 
185
                    rootSelector: 'button.btn-delete',
-
 
186
                    title : 'LABEL_ARE_YOU_SURE',
-
 
187
                    singleton : true,
-
 
188
                    btnOkLabel: 'LABEL_YES',
-
 
189
                    btnCancelLabel: 'LABEL_NO',
-
 
190
                    onConfirm: function(value) {
-
 
191
                        action = $(this).data('href');
-
 
192
                        NProgress.start();
-
 
193
                        $.ajax({
-
 
194
                            'dataType'  : 'json',
-
 
195
                            'accept'    : 'application/json',
-
 
196
                            'method'    : 'post',
-
 
197
                            'url'       :  action,
-
 
198
                        }).done(function(response) {
-
 
199
                            if(response['success']) {
-
 
200
                                $.fn.showSuccess(response['data']);
-
 
201
                                gridTable.api().ajax.reload(null, false);
-
 
202
                            } else {
-
 
203
                                $.fn.showError(response['data']);
-
 
204
                            }
-
 
205
                        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
206
                            $.fn.showError(textStatus);
-
 
207
                        }).always(function() {
-
 
208
                            NProgress.done();
-
 
209
                        });
-
 
210
                    },
-
 
211
                });
-
 
212
            },
-
 
213
            'aoColumns': [
-
 
214
                { 'mDataProp': 'code' },
-
 
215
                { 'mDataProp': 'title' },
-
 
216
                { 'mDataProp': 'status' },
-
 
217
                { 'mDataProp': 'actions' },
-
 
218
    	    ],
-
 
219
            'columnDefs': [
-
 
220
                {
-
 
221
                    'targets': 0,
-
 
222
                    'className' : 'text-vertical-middle',
-
 
223
                },
-
 
224
                {
-
 
225
                    'targets': 1,
-
 
226
                    'className' : 'text-vertical-middle',
-
 
227
                },
-
 
228
                {
-
 
229
                    'targets': -2,
-
 
230
                    'orderable': false,
-
 
231
                    'className' : 'text-center',
-
 
232
                      'render' : function ( data, type, row ) {
-
 
233
                      
-
 
234
                        checked = data == 'a' ? ' checked="checked" ' : '';
-
 
235
                        return '<div class="checkbox checkbox-success">' +
-
 
236
                            '<input class="styled" type="checkbox" ' + checked + ' disabled="disabled">' +
-
 
237
                            '<label ></label></div>';
-
 
238
                    }
-
 
239
                },
-
 
240
                {
-
 
241
                    'targets': -1,
-
 
242
                    'orderable': false,
-
 
243
                    'render' : function ( data, type, row ) {
-
 
244
                        s = '';
-
 
245
                        
-
 
246
                        if(allowEdit &&  data['link_edit']) {
-
 
247
                            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>&nbsp;';
-
 
248
                        }
-
 
249
                        if(allowDelete && data['link_delete']) {
-
 
250
                            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>&nbsp;';
-
 
251
                        }
-
 
252
                        return s;
-
 
253
                    }
-
 
254
                }
-
 
255
              ],
-
 
256
        });
-
 
257
 
-
 
258
 
-
 
259
 
Línea 104... Línea 260...
104
    //         }
260
 
105
    //     }).fail(function( jqXHR, textStatus, errorThrown) {
261
 
106
    //         $.fn.showError(textStatus);
262