Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15570 | Rev 15574 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
15387 efrain 1
<?php
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser    = $this->currentUserHelper();
4
 
5
$roleName = $currentUser->getUserTypeId();
6
 
7
$allowDownload  = $acl->isAllowed($roleName, 'reports/users-blocked/excel') ? 1 : 0;
8
 
9
 
10
 
11
 
12
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
13
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
14
$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.js'));
15
 
15570 anderson 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'));
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'));
22
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
23
 
15387 efrain 24
$this->headStyle()->captureStart();
25
echo <<<CSS
26
 
27
 
28
#tableStudents {
29
    display: flex;
30
    flex-flow: column;
31
    width: 100%;
32
}
33
 
34
#tableStudents thead {
35
    flex: 0 0 auto;
36
}
37
 
38
#tableStudents tbody {
39
    flex: 1 1 auto;
40
    display: block;
41
    overflow-y: auto;
42
    overflow-x: hidden;
43
}
44
 
45
#tableStudents tr {
46
    width: 100%;
47
    display: table;
48
    table-layout: fixed;
49
}
50
CSS;
51
$this->headStyle()->captureEnd();
52
 
53
 
54
 
55
$this->inlineScript()->captureStart();
56
echo <<<JS
57
jQuery( document ).ready(function( $ ) {
58
 
59
 
15571 anderson 60
    // $.fn.loadData = function() {
61
    //     NProgress.start();
62
    //     $.ajax({
63
    //         'dataType'  : 'json',
64
    //         'accept'    : 'application/json',
65
    //         'method'    : 'get',
66
    //         'url'       :  $('#form-filter').attr('action'),
67
    //         'data'      :  $('#form-filter').serialize(),
68
    //     }).done(function(response) {
69
    //         if(response['success']) {
15387 efrain 70
 
71
 
72
 
15571 anderson 73
    //            $('#gridTable tbody').empty();
74
    //             if(response['data']['items']) {
15387 efrain 75
 
15571 anderson 76
    //                 $('#gridTable tbody').append(
77
    //                     $( "#itemRowTemplate" ).render( response['data']['items'] )
15387 efrain 78
 
15571 anderson 79
    //                 );
15387 efrain 80
 
15571 anderson 81
    //             } else {
82
    //                 $('#gridTable tbody').append(
83
    //                     $( "#itemEmptyRowTemplate" ).render([])
84
    //                 );
15387 efrain 85
 
15571 anderson 86
    //             }
15387 efrain 87
 
15571 anderson 88
    //             if(response['data']['link_download']) {
89
    //                 $('button.btn-download').data('href', response['data']['link_download']);
90
    //                 $('button.btn-download').show();
15387 efrain 91
 
15571 anderson 92
    //             } else {
93
    //                  $('button.btn-download').hide();
94
    //             }
15387 efrain 95
 
15571 anderson 96
    //         } else {
97
    //             if(jQuery.type(response['data']) == 'string') {
98
    //                 $.fn.showError(response['data']);
99
    //             } else  {
100
    //                 $.each(response['data'], function( fieldname, errors ) {
101
    //                     $.fn.showFormErrorValidator('#form-filter #' + fieldname, errors);
102
    //                 });
103
    //             }
104
    //         }
105
    //     }).fail(function( jqXHR, textStatus, errorThrown) {
106
    //         $.fn.showError(textStatus);
107
    //     }).always(function() {
108
    //         NProgress.done();
109
    //     });
110
    //     return false;
111
    // }
15387 efrain 112
 
113
 
114
    $('button.btn-download').click(function(e) {
115
        e.preventDefault();
116
        var action   = $(this).data('href');
117
 
118
        NProgress.start();
119
        $.ajax({
120
            'dataType'  : 'json',
121
            'method'    : 'get',
122
            'url'       :  action,
123
        }).done(function(response) {
124
            if(response['success']) {
125
                var anchor = window.document.createElement("a");
126
                anchor.href = 'data:application/octet-stream;charset=utf-8;base64,' + response['data']['content'] ;
127
                anchor.download = response['data']['basename'];
128
                document.body.appendChild(anchor);
129
                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
130
                document.body.removeChild(anchor);
131
            } else {
132
                $.fn.showError(response['data']);
133
            }
134
        }).fail(function( jqXHR, textStatus, errorThrown) {
135
            showError(textStatus);
136
        }).always(function() {
137
            NProgress.done();
138
        });
139
 
140
 
141
    });
142
 
143
 
144
    $('button.btn-refresh').click(function(e) {
145
        e.preventDefault();
146
        $.fn.loadData();
147
 
148
 
149
    });
150
 
151
 
152
 
153
    $.fn.loadData();
154
    $('button.btn-download').hide();
155
 
156
});
157
JS;
158
$this->inlineScript()->captureEnd();
159
?>
160
 
161
<!-- Content Header (Page header) -->
162
<section class="content-header">
15570 anderson 163
    <div class="container-fluid">
164
        <div class="row mb-2">
165
            <div class="col-sm-12">
166
                <h1>LABEL_REPORTS_USERS_BLOCKED</h1>
167
            </div>
168
        </div>
169
    </div><!-- /.container-fluid -->
15387 efrain 170
</section>
171
 
172
<section class="content">
15570 anderson 173
    <div class="container-fluid">
174
        <div class="row">
175
            <div class="col-12">
176
                <div class="card">
177
                    <div class="card-header">
178
                        <div class="col-md-12 col-sm-12">
179
                            <div style="float:right;">
180
                                <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
181
                                <?php if ($allowDownload) :  ?>
15387 efrain 182
 
15570 anderson 183
                                    <button type="button" class="btn btn-info btn-download"><i class="fa fa-download"></i> LABEL_DOWNLOAD </button>
184
                                <?php endif; ?>
185
                            </div>
186
                        </div>
187
                    </div>
188
                    <div class="card-body">
189
                        <table id="gridTable" class="table   table-hover">
190
                            <thead>
191
                                <tr>
192
                                    <th style="width: 25%">LABEL_FIRST_NAME</th>
193
                                    <th style="width: 25%">LABEL_LAST_NAME</th>
194
                                    <th style="width: 30%">LABEL_EMAIL</th>
195
                                    <th style="width: 20%">LABEL_REPORTS_LAST_ACTIVITY</th>
15387 efrain 196
 
15570 anderson 197
 
15387 efrain 198
                                </tr>
15570 anderson 199
                            </thead>
200
                            <tbody>
201
                            </tbody>
202
                        </table>
203
                    </div>
204
                </div>
205
            </div>
206
        </div>
207
    </div>
208
</section>
15387 efrain 209
 
210
 
211
 
15570 anderson 212
 
15387 efrain 213
<script id="itemRowTemplate" type="text/x-jsrender">
214
    <tr>
215
        <td style="width: 25%">
216
            {{>first_name}}
217
        </td>
218
        <td style="width: 25%">
219
             {{>last_name}}
220
        </td>
221
        <td style="width: 30%">
222
            {{>email}}
223
        </td>
224
        <td style="width: 30%">
225
            {{>last_activity_on}}
226
        </td>
227
 
228
 
229
 
230
    </tr>
231
</script>
232
 
233
 
234
<script id="itemEmptyRowTemplate" type="text/x-jsrender">
235
    <tr>
236
        <td colspan="4">
237
            LABEL_NOT_RECORDS_FOUND
238
        </td>
239
    </tr>
15570 anderson 240
</script>