Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev Autor Línea Nro. Línea
1 www 1
<?php
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser    = $this->currentUserHelper();
4
$roleName       = $currentUser->getUserTypeId();
5
 
6
$routeDatatable = $this->url('microlearning/access-for-students');
7
 
8
$allowRevoke = $acl->isAllowed($roleName, 'microlearning/access-for-students/revoke') ? 1 : 0;
9
$allowUnlimit = $acl->isAllowed($roleName, 'microlearning/access-for-students/unlimit') ? 1 : 0;
10
$allowUpload = $acl->isAllowed($roleName, 'microlearning/access-for-students/upload') ? 1 : 0;
11
$allowCancel = $acl->isAllowed($roleName, 'microlearning/access-for-students/cancel') ? 1 : 0;
12
$allowReactive = $acl->isAllowed($roleName, 'microlearning/access-for-students/reactive') ? 1 : 0;
13
$allowNotification = $acl->isAllowed($roleName, 'microlearning/access-for-students/notification') ? 1 : 0;
14
 
16822 efrain 15
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));
16
$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.js'));
1 www 17
 
16822 efrain 18
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.css'));
19
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.css'));
1 www 20
 
16822 efrain 21
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net/jquery.dataTables.js'));
22
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.js'));
23
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/dataTables.responsive.min.js'));
24
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.min.js'));
1 www 25
 
16822 efrain 26
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
27
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
1 www 28
 
16822 efrain 29
$this->inlineScript()->appendFile($this->basePath('assets/vendors/moment/moment-with-locales.min.js'));
30
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css'));
31
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js'));
32
 
33
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-fileinput/css/fileinput.min.css'));
34
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fas/theme.css'));
35
 
16843 efrain 36
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/piexif.js'));
37
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/sortable.js'));
16822 efrain 38
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/fileinput.js'));
39
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/locales/es.js'));
40
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/fas/theme.js'));
41
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fas/theme.js'));
42
 
1 www 43
$this->headStyle()->captureStart();
44
echo <<<CSS
45
 
46
 
16983 efrain 47
#gridTableUploadOk {
1 www 48
    display: flex;
49
    flex-flow: column;
50
    width: 100%;
51
}
52
 
16983 efrain 53
#gridTableUploadOk thead {
1 www 54
    flex: 0 0 auto;
55
}
56
 
16983 efrain 57
#gridTableUploadOk tbody {
1 www 58
    flex: 1 1 auto;
59
    display: block;
60
    overflow-y: auto;
61
    overflow-x: hidden;
62
}
63
 
16983 efrain 64
#gridTableUploadOk tr {
1 www 65
    width: 100%;
66
    display: table;
67
    table-layout: fixed;
68
}
16983 efrain 69
 
70
#gridTableUploadError {
71
    display: flex;
72
    flex-flow: column;
73
    width: 100%;
74
}
75
 
76
#gridTableUploadError thead {
77
    flex: 0 0 auto;
78
}
79
 
80
#gridTableUploadError tbody {
81
    flex: 1 1 auto;
82
    display: block;
83
    overflow-y: auto;
84
    overflow-x: hidden;
85
}
86
 
87
#gridTableUploadError tr {
88
    width: 100%;
89
    display: table;
90
    table-layout: fixed;
91
}
92
 
1 www 93
CSS;
94
$this->headStyle()->captureEnd();
95
 
96
$this->inlineScript()->captureStart();
97
echo <<<JS
98
 
99
 
100
jQuery( document ).ready(function( $ ) {
101
 
102
        var routeUpload = '';
103
        var routeNotification = '';
104
 
105
        $.validator.setDefaults({
106
            debug: true,
107
            highlight: function(element) {
108
                $(element).addClass('is-invalid');
109
            },
110
            unhighlight: function(element) {
111
                $(element).removeClass('is-invalid');
112
            },
113
            errorElement: 'span',
114
            errorClass: 'error invalid-feedback',
115
            errorPlacement: function(error, element) {
116
                if(element.parent('.btn-file').length) {
117
                    error.insertAfter(element.parent().parent());
118
                } else if(element.parent('.toggle').length) {
119
                    error.insertAfter(element.parent().parent());
120
                } else {
121
                    error.insertAfter(element.parent());
122
                }
123
            }
124
        });
125
 
126
 
127
        var allowRevoke   = $allowRevoke;
128
        var allowUnlimit  = $allowUnlimit;
129
        var allowCancel   = $allowCancel;
130
        var allowReactive = $allowReactive;
131
        var allowUpload   = $allowUpload;
132
        var allowNotification = $allowNotification;
133
 
134
        var gridTable = $('#gridTable').dataTable( {
135
            'processing': true,
136
            'serverSide': true,
137
            'searching': true,
138
            'order': [[ 1, 'asc' ]],
139
            'ordering':  true,
140
            'ordenable' : true,
141
            'responsive': true,
142
            'select' : false,
143
        	'paging': true,
144
            'pagingType': 'simple_numbers',
145
            'lengthMenu': [ [10, 25, 50, -1], [10, 25, 50, 'All'] ],
146
    		'ajax': {
147
    			'url' : '$routeDatatable',
148
    			'type' : 'get',
149
                'data': function ( d ) {
150
                    d.topic_uuid = $('#form-filter #topic_uuid').val();
151
                },
152
                'beforeSend': function (request) {
153
                  NProgress.start();
154
                },
155
                'dataFilter': function(response) {
156
                    var response = jQuery.parseJSON( response );
157
 
158
                    var json                = {};
159
                    json.recordsTotal       = 0;
160
                    json.recordsFiltered    = 0;
161
                    json.data               = [];
162
 
163
                    if(response.success) {
17248 stevensc 164
                        $('#form-topic-add').attr('action', response.data.link_add );
1 www 165
 
166
                        routeUpload = response.data.link_upload;
167
                        routeNotification = response.data.link_notification;
168
 
169
                        if(response.data.link_upload) {
170
                            $('button.btn-upload').removeAttr('disabled');
171
                        } else {
172
                            $('button.btn-upload').attr('disabled', 'disabled');
173
                        }
174
 
175
                        if(response.data.link_notification) {
176
                            $('button.btn-notification').removeAttr('disabled');
177
                        } else {
178
                            $('button.btn-notification').attr('disabled', 'disabled');
179
                        }
180
 
181
                        json.recordsTotal       = response.data.total;
182
                        json.recordsFiltered    = response.data.total;
183
                        json.data               = response.data.items;
184
                    } else {
185
                        $.fn.showError(response.data)
186
                    }
187
 
188
                    return JSON.stringify( json );
189
                }
190
    		},
191
            'language' : {
192
                'sProcessing':     'LABEL_DATATABLE_SPROCESSING',
193
                'sLengthMenu':     'LABEL_DATATABLE_SLENGTHMENU',
194
                'sZeroRecords':    'LABEL_DATATABLE_SZERORECORDS',
195
                'sEmptyTable':     'LABEL_DATATABLE_SEMPTYTABLE',
196
                'sInfo':           'LABEL_DATATABLE_SINFO',
197
                'sInfoEmpty':      'LABEL_DATATABLE_SINFOEMPTY',
198
                'sInfoFiltered':   'LABEL_DATATABLE_SINFOFILTERED',
199
                'sInfoPostFix':    '',
200
                'sSearch':         'LABEL_DATATABLE_SSEARCH',
201
                'sUrl':            '',
202
                'sInfoThousands':  ',',
203
                'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
204
                'oPaginate': {
205
                    'sFirst':    'LABEL_DATATABLE_SFIRST',
206
                    'sLast':     'LABEL_DATATABLE_SLAST',
207
                    'sNext':     'LABEL_DATATABLE_SNEXT',
208
                    'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
209
                },
210
                'oAria': {
211
                    'sSortAscending':  ': LABEL_DATATABLE_SSORTASCENDING',
212
                    'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
213
                },
214
            },
215
            'drawCallback': function( settings ) {
216
                NProgress.done();
16822 efrain 217
 
1 www 218
            },
219
            'aoColumns': [
220
                { 'mDataProp': 'uuid' },
221
                { 'mDataProp': 'first_name' },
222
                { 'mDataProp': 'last_name' },
223
                { 'mDataProp': 'email' },
224
                { 'mDataProp': 'details' },
225
                { 'mDataProp': 'actions' },
226
    	    ],
227
            'columnDefs': [
228
                {
229
                    'targets': 0,
230
                    'orderable': false,
231
                    'render' : function ( data, type, row ) {
232
                        s = '<input type="checkbox" class="chk-customer" value="' + data + '">';
233
                        return s;
234
                    }
235
                },
236
                {
237
                    'targets': -2,
238
                    'orderable': false,
239
                    'render' : function ( data, type, row ) {
240
                        s = '';
241
                        if(data['access']) {
242
                            s = s + 'LABEL_ACCESS : ' + data['access'] + '<br>';
243
                        }
244
                        if(data['paid_from']) {
245
                            s = s + 'LABEL_PAID_FROM : ' + data['paid_from'] + '<br>';
246
                        }
247
                        if(data['paid_to']) {
248
                            s = s + 'LABEL_PAID_TO : ' + data['paid_to'] + '<br>';
249
                        }
250
                        if(data['added_on']) {
251
                            s = s + 'LABEL_ADDED_ON : ' + data['added_on'] + '<br>';
252
                        }
253
                        if(data['updated_on']) {
254
                            s = s + 'LABEL_UPDATED_ON : ' + data['updated_on'] + '<br>';
255
                        }
256
 
257
                        return s;
258
                    }
259
                },
260
 
261
 
262
                {
263
                    'targets': -1,
264
                    'orderable': false,
265
                    'render' : function ( data, type, row ) {
266
                        s = '';
267
 
268
                        if(allowRevoke && data['link_revoke']  ) {
269
                            s = s + '<button class="btn btn-danger btn-sm btn-revoke" data-href="' + data['link_revoke']+ '" data-toggle="tooltip" title="LABEL_REVOKE"><i class="fa fa-times"></i> LABEL_REVOKE </button>&nbsp;';
270
                        }
271
                        if(allowCancel && data['link_cancel']  ) {
272
                            s = s + '<button class="btn btn-danger btn-sm btn-cancel" data-href="' + data['link_cancel']+ '" data-toggle="tooltip" title="LABEL_CANCEL"><i class="fa fa-times"></i> LABEL_CANCEL </button>&nbsp;';
273
                        }
274
                        if(allowUnlimit && data['link_unlimit']  ) {
275
                            s = s + '<button class="btn btn-primary btn-sm btn-unlimit" data-href="' + data['link_unlimit']+ '" data-toggle="tooltip" title="LABEL_UNLIMIT"><i class="fa fa-check"></i> LABEL_UNLIMIT </button>&nbsp;';
276
                        }
277
                        if(allowReactive && data['link_reactive']  ) {
278
                            s = s + '<button class="btn btn-success btn-sm btn-reactive" data-href="' + data['link_reactive']+ '" data-toggle="tooltip" title="LABEL_REACTIVE"><i class="fa fa-check"></i> LABEL_REACTIVE </button>&nbsp;';
279
                        }
280
 
281
 
282
                        return s;
283
                    }
284
                }
285
              ],
286
        });
287
 
288
 
289
    $('body').on('click', 'button.btn-notification', function(e) {
290
        e.preventDefault();
291
 
292
        var customer_uuids = [];
293
        $.each($('input[type="checkbox"].chk-customer:checked'), function(index, element) {
294
            customer_uuids.push($(this).val());
295
        });
296
 
297
        if(customer_uuids.length == 0) {
298
            $.fn.showError('ERROR_NOT_SELECTED_CUSTOMERS');
299
            return;
300
        }
301
 
302
        var href = $(this).data('href');
303
        $('#notificationPushModal').modal('show');
304
        $('#form-push-notification').attr('action', href);
305
 
306
    });
307
 
308
 
309
    $('#chk-customer-all').click(function(e) {
310
       // e.preventDefault();
311
 
312
        var checked = $(this).prop('checked');
313
        $.each($('input[type="checkbox"].chk-customer'), function(index, element) {
314
           $(this).prop('checked', checked);
315
        });
316
 
317
 
318
    });
319
 
320
    $('body').on('click', 'input[type="checkbox"].chk-customer', function(e) {
321
        var checked = $(this).prop('checked');
322
        if(!checked) {
323
            $('#chk-customer-all').prop('checked', false );
324
        }
325
    });
326
 
327
var validatorPushNotification = $('#form-push-notification').validate({
328
        debug: true,
329
        onclick: false,
330
        onkeyup: false,
331
        onfocusout: false,
332
        ignore: [],
333
        rules: {
334
            'push_template_id' : {
335
                required: true,
336
 
337
            },
338
        },
339
 
340
        submitHandler: function(form)
341
        {
342
            var customer_uuids = [];
343
            $.each($('input[type="checkbox"].chk-customer:checked'), function(index, element) {
344
                customer_uuids.push($(this).val());
345
            });
346
 
347
            if(customer_uuids.length == 0) {
348
                $.fn.showError('ERROR_NOT_SELECTED_CUSTOMERS');
349
                return;
350
            }
351
 
352
            var push_template_id = $('#form-push-notification #push_template_id').val();
353
 
354
            $('input[type="submit"]').prop('disabled', true);
355
            NProgress.start();
356
            $.ajax({
357
                'dataType'  : 'json',
358
                'accept'    : 'application/json',
359
                'method'    : 'post',
360
                'url'       : routeNotification,
361
                'data'      : {
362
                    'push_template_id' : push_template_id,
363
                    'customer_uuids' : customer_uuids
364
 
365
                },
366
            }).done(function(response) {
367
                if(response['success']) {
368
                    if(response['data']['push_to_send'] == 1) {
369
                        $.fn.showSuccess(response['data']['push_to_send'] + ' LABEL_PUSH_IN_QUEUE');
370
                    } else {
371
                        $.fn.showSuccess(response['data']['push_to_send'] + ' LABEL_PUSHES_IN_QUEUE');
372
                    }
373
 
374
 
375
                    $('#notificationPushModal').modal('hide');
376
                } else {
377
                    validatorPushNotification.resetForm();
378
                    if(jQuery.type(response['data']) == 'string') {
379
                        $.fn.showError(response['data']);
380
                    } else  {
381
                        $.each(response['data'], function( fieldname, errors ) {
382
                            $.fn.showFormErrorValidator('#form-push-notification #' + fieldname, errors);
383
                        });
384
                    }
385
                }
386
            }).fail(function( jqXHR, textStatus, errorThrown) {
387
                $.fn.showError(textStatus);
388
            }).always(function() {
389
 
390
                NProgress.done();
391
            });
392
            return false;
393
        },
394
        invalidHandler: function(form, validator) {
395
 
396
        }
397
    });
398
 
399
 
17248 stevensc 400
    var validatorTopicCustomer = $('#form-topic-customer').validate({
1 www 401
        debug: true,
402
        onclick: false,
403
        onkeyup: false,
404
        onfocusout: false,
405
        ignore: [],
406
        rules: {
407
            'file' : {
408
                required: true,
409
                extension: 'xls|xlsx',
410
                accept: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel'
411
            },
412
        },
413
 
414
        submitHandler: function(form)
415
        {
416
            NProgress.start();
417
            var formdata = false;
418
            if (window.FormData){
419
                formdata = new FormData(form);
420
            }
421
            formdata.append('step','validation');
422
 
423
 
424
            $.ajax({
425
                'dataType'  : 'json',
426
                'accept'    : 'application/json',
427
                'method'    : 'post',
428
                'url'       :  routeUpload,
429
                'data'      :  formdata,
430
                'processData': false,
431
                'contentType': false,
432
            }).done(function(response) {
433
                if(response['success']) {
434
 
435
                    $('#table-upload-customers-key').val(response['data']['key']);
436
                    $('#table-upload-customers-topic').val(response['data']['topic']);
437
 
16983 efrain 438
                    $('#gridTableUploadOk tbody').empty();
1 www 439
 
16983 efrain 440
                    $.each(response['data']['items']['ok'], function(index, item) {
1 www 441
 
442
 
443
                        var s = '<tr>';
16983 efrain 444
                        s = s + '<td>' + item['id'] + '</td>';
1 www 445
                        s = s + '<td>' + item['first_name'] + '</td>';
446
                        s = s + '<td>' + item['last_name'] + '</td>';
447
                        s = s + '<td>' + item['email'] + '</td>';
17248 stevensc 448
                        s = s + '<td class="text-right">' + item['assigned_topics'] + '</td>';
1 www 449
                        s = s + '</tr>';
450
 
16983 efrain 451
                        $('#gridTableUploadOk tbody').append(s);
1 www 452
 
453
 
16983 efrain 454
                    });
455
 
456
                    $.each(response['data']['items']['error'], function(index, item) {
1 www 457
 
16983 efrain 458
 
459
                        var s = '<tr>';
460
                        s = s + '<td>' + item['id'] + '</td>';
461
                        s = s + '<td>' + item['first_name'] + '</td>';
462
                        s = s + '<td>' + item['last_name'] + '</td>';
463
                        s = s + '<td>' + item['email'] + '</td>';
464
                        s = s + '<td>' + item['status'] + '</td>';
465
                        s = s + '</tr>';
466
 
467
                        $('#gridTableUploadError tbody').append(s);
468
 
469
 
470
                    });
471
 
17248 stevensc 472
                    $('#modalTopicCustomer').modal('hide');
1 www 473
                    $('#modalUploadCustomers').modal('show');
474
 
475
 
476
 
477
                } else {
17248 stevensc 478
                    validatorTopicCustomer.resetForm();
1 www 479
                    if(jQuery.type(response['data']) == 'string') {
480
                        $.fn.showError(response['data']);
481
                    } else  {
482
                        $.each(response['data'], function( fieldname, errors ) {
17248 stevensc 483
                            $.fn.showFormErrorValidator('#form-topic-customer #' + fieldname, errors);
1 www 484
                        });
485
                    }
486
                }
487
            }).fail(function( jqXHR, textStatus, errorThrown) {
488
                $.fn.showError(textStatus);
489
            }).always(function() {
490
 
491
                NProgress.done();
492
            });
493
            return false;
494
        },
495
        invalidHandler: function(form, validator) {
496
 
497
        }
498
    });
499
 
500
 
17248 stevensc 501
    $('#form-topic-customer #file').fileinput({
1 www 502
        theme: 'fas',
503
        language: 'es',
504
        showUpload: false,
505
        dropZoneEnabled: false,
506
        maxFileCount: 1,
507
        allowedFileExtensions: ['xls', 'xlsx'],
508
    });
509
 
510
    $('body').on('click', 'button.btn-upload', function(e) {
511
        e.preventDefault();
512
 
17248 stevensc 513
        $('#form-topic-customer #file').fileinput('reset');
514
        $('#form-topic-customer #file').val('');
1 www 515
 
17248 stevensc 516
        $('#modalTopicCustomer').modal('show');
1 www 517
    });
518
 
519
    $('body').on('click', 'button.btn-upload-customers-step2', function(e) {
520
        e.preventDefault();
521
        NProgress.start();
522
 
523
        $.ajax({
524
            'dataType'  : 'json',
525
            'accept'    : 'application/json',
526
            'method'    : 'post',
527
            'url'       :  routeUpload,
528
            'data'      :  {
529
                'step' : 'process',
530
                'key' : $('#table-upload-customers-key').val(),
531
            }
532
        }).done(function(response) {
533
            if(response['success']) {
15457 efrain 534
 
16983 efrain 535
                var anchor = window.document.createElement("a");
536
                anchor.href = 'data:application/octet-stream;charset=utf-8;base64,' + response['data']['csv_base64_content'] ;
537
                anchor.download = response['data']['csv_filename'];
538
                document.body.appendChild(anchor);
539
                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
540
                document.body.removeChild(anchor);
541
 
15457 efrain 542
                var s = response['data']['users_processed'] + ' LABEL_USTUDENTS_PROCESED <br>' +
543
                response['data']['users_assigned'] + ' LABEL_STUDENTS_ASSIGNED <br>' +
544
                response['data']['users_previous'] + ' LABEL_USTUDENTS_PREVIOUS <br>' +
17248 stevensc 545
                response['data']['users_in_the_topic'] + ' LABEL_STUDENTS_TOTAL';
15457 efrain 546
 
547
                $.fn.showSuccess(s);
548
 
1 www 549
                 gridTable.api().ajax.reload(null, false);
550
                $('#modalUploadCustomers').modal('hide');
551
            } else {
552
                $.fn.showError(response['data']);
553
            }
554
        }).fail(function( jqXHR, textStatus, errorThrown) {
555
            $.fn.showError(textStatus);
556
        }).always(function() {
557
            NProgress.done();
558
        });
559
        return false;
560
    });
561
 
562
    $('body').on('click', 'button.btn-refresh', function(e) {
563
        e.preventDefault();
564
        gridTable.api().ajax.reload(null, false);
565
    });
16822 efrain 566
 
567
     $('body').on('click', 'button.btn-delete', function(e) {
568
        e.preventDefault();
569
        var action = $(this).data('href');
570
 
571
 
572
          swal.fire({
573
            title: 'LABEL_ARE_YOU_SURE',
574
            icon: 'question',
575
            cancelButtonText: 'LABEL_NO',
576
            showCancelButton: true,
577
            confirmButtonText: 'LABEL_YES'
578
          }).then((result) => {
579
            if (result.isConfirmed) {
580
 
581
                    NProgress.start();
582
                    $.ajax({
583
                        'dataType'  : 'json',
584
                        'accept'    : 'application/json',
585
                        'method'    : 'post',
586
                        'url'       :  action,
587
                    }).done(function(response) {
588
                        if(response['success']) {
589
                            $.fn.showSuccess(response['data']);
590
                            gridTable.api().ajax.reload(null, false);
591
                        } else {
592
                            $.fn.showError(response['data']);
593
                        }
594
                    }).fail(function( jqXHR, textStatus, errorThrown) {
595
                        $.fn.showError(textStatus);
596
                    }).always(function() {
597
                        NProgress.done();
598
                    });
599
            }
600
       });
601
    });
602
 
603
    $('body').on('click', 'button.btn-unlimit', function(e) {
604
        e.preventDefault();
605
        var action = $(this).data('href');
606
 
607
 
608
          swal.fire({
609
            title: 'LABEL_ARE_YOU_SURE',
610
            icon: 'question',
611
            cancelButtonText: 'LABEL_NO',
612
            showCancelButton: true,
613
            confirmButtonText: 'LABEL_YES'
614
          }).then((result) => {
615
            if (result.isConfirmed) {
616
 
617
                    NProgress.start();
618
                    $.ajax({
619
                        'dataType'  : 'json',
620
                        'accept'    : 'application/json',
621
                        'method'    : 'post',
622
                        'url'       :  action,
623
                    }).done(function(response) {
624
                        if(response['success']) {
625
                            $.fn.showSuccess(response['data']);
626
                            gridTable.api().ajax.reload(null, false);
627
                        } else {
628
                            $.fn.showError(response['data']);
629
                        }
630
                    }).fail(function( jqXHR, textStatus, errorThrown) {
631
                        $.fn.showError(textStatus);
632
                    }).always(function() {
633
                        NProgress.done();
634
                    });
635
            }
636
       });
637
    });
1 www 638
});
639
JS;
640
$this->inlineScript()->captureEnd();
641
?>
642
 
16891 efrain 643
<div class="container">
644
	<div class="card" id="">
645
	 	<div class="card-header">
646
	 		<h6 class="card-title">LABEL_ACCESS_FOR_STUDENTS</h6>
647
	 	</div>
648
 
649
	 	<?php
1 www 650
                        $form = $this->form;
651
            	        $form->setAttributes([
652
                            'name'    => 'form-filter',
653
                            'id'      => 'form-filter',
654
                        ]);
655
 
656
                        $form->prepare();
657
                        echo $this->form()->openTag($form);
16891 efrain 658
                        ?>
659
 
660
	 	<div class="card-body">
661
	 		<div class="row">
662
                            <div class="col-6 mt-3 ">
663
 
1 www 664
                                    <?php
665
                                    $element = $form->get('topic_uuid');
666
 
667
                                    $element->setOptions(['label' => 'LABEL_TOPIC']);
668
 
669
                                    $element->setAttributes(['class' => 'form-control']);
670
                                    echo $this->formLabel($element);
671
                                    echo $this->formSelect($element);
672
                                    ?>
16891 efrain 673
 
1 www 674
                            </div>
16891 efrain 675
	 		</div>
676
 
677
	 		<div class="row">
678
	 	         <div class="col-12 mt-3">
679
 
680
	 	         	<table id="gridTable" class="table   table-bordered">
1 www 681
                      		<thead>
682
        						<tr>
683
        							<th><input type="checkbox" id="chk-customer-all"></th>
684
                                	<th>LABEL_FIRST_NAME</th>
685
                                	<th>LABEL_LAST_NAME</th>
686
                                	<th>LABEL_EMAIL</th>
687
                                  	<th>LABEL_DETAILS</th>
688
                                  	<th>LABEL_ACTIONS</th>
689
                                </tr>
690
                       		</thead>
691
                         	<tbody>
692
                         	</tbody>
693
                    	</table>
16891 efrain 694
 
695
	 	         </div>
696
	 	     </div>
697
	 	</div>
698
	 	<div class="card-footer text-right">
17178 stevensc 699
	 	    <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-sync"></i> LABEL_REFRESH  </button>
700
            <?php if($allowUpload) : ?>
701
                <button type="button" class="btn btn-primary btn-upload"><i class="fa fa-upload"></i> LABEL_UPLOAD  </button>
702
            <?php endif; ?>
703
            <?php if($allowNotification) : ?>
704
                <button type="button" class="btn btn-primary btn-notification"><i class="fa fa-tablet"></i> LABEL_NOTIFICATION </button>
705
            <?php endif; ?>
16891 efrain 706
	 	</div>
707
	 	<?php echo $this->form()->closeTag($form); ?>
708
	</div>
709
</div>
1 www 710
 
16891 efrain 711
 
712
 
1 www 713
<!-- The Modal -->
714
<div class="modal" id="notificationPushModal">
715
	<div class="modal-dialog modal-sm">
716
    	<div class="modal-content">
717
 
718
            <!-- Modal Header -->
719
      		<div class="modal-header">
16845 efrain 720
        		<h6 class="modal-title">LABEL_PUSH_NOTIFICATION</h6>
16822 efrain 721
        		<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
1 www 722
      		</div>
723
 
16891 efrain 724
	<?php
1 www 725
				        $form = $this->formPushNotification;
726
                        $form->setAttributes([
727
                            'method'    => 'post',
728
                            'name'      => 'form-push-notification',
729
                            'id'        => 'form-push-notification',
730
                        ]);
731
 
732
                        $form->prepare();
733
                        echo $this->form()->openTag($form);
734
                        ?>
16891 efrain 735
      		<div class="modal-body">
736
 
737
                        <div class="row">
738
                        	<div class="col-12 mt-3">
1 www 739
                        	<?php
740
                            $element = $form->get('push_template_id');
741
                            $element->setAttributes([
742
                                'class' => 'form-control'
743
                            ]);
744
                            $element->setLabelAttributes([
745
                                'class' => 'form-label'
746
                            ]);
747
                            $element->setOptions([
748
                                'label' => 'LABEL_TYPE'
749
                            ]);
750
                            echo $this->formLabel($element);
751
                            echo $this->formSelect($element);
752
                            ?>
16891 efrain 753
                            </div>
1 www 754
    					</div>
755
 
16891 efrain 756
 
757
 
1 www 758
 
759
      		</div>
760
 
761
            <!-- Modal footer -->
16891 efrain 762
      		<div class="modal-footer text-right">
763
      		<button type="submit" class="btn btn-primary">LABEL_SEND</button>
1 www 764
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
765
      		</div>
16891 efrain 766
      		<?php
767
                        echo $this->form()->closeTag($form);
768
                        ?>
1 www 769
 
770
    	</div>
771
	</div>
772
</div>
773
 
774
 
775
<!-- The Modal -->
17248 stevensc 776
<div class="modal" id="modalTopicCustomer">
1 www 777
	<div class="modal-dialog  modal-xl">
778
    	<div class="modal-content">
779
 
780
            <!-- Modal Header -->
781
      		<div class="modal-header">
16845 efrain 782
        		<h6 class="modal-title">LABEL_UPLOAD</h6>
16822 efrain 783
        		<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
1 www 784
      		</div>
785
 
16891 efrain 786
 <?php
17248 stevensc 787
                    $form = $this->formTopicCustomer;
1 www 788
            		$form->setAttributes([
789
                        'method'    => 'post',
17248 stevensc 790
                        'name'      => 'form-topic-customer',
791
                        'id'        => 'form-topic-customer'
1 www 792
                    ]);
793
 
794
                    $form->prepare();
795
                    echo $this->form()->openTag($form);
16891 efrain 796
                ?>
797
      		<div class="modal-body">
798
 
1 www 799
 
16891 efrain 800
				<div class="row">
801
                	<div class="col-12 mt-3">
1 www 802
 
803
                 		<?php
804
                        $element = $form->get('file');
805
                        $element->setOptions(['label' => 'LABEL_EXCEL']);
806
                        echo $this->formLabel($element);
807
                        ?>
808
                        <div class="file-loading">
809
                        <?php
16768 efrain 810
                        $element->setAttributes(['class' => 'form-control', 'accept' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel']);
1 www 811
                        echo $this->formFile($element);
812
                        ?>
16891 efrain 813
                        </div>
1 www 814
                	</div>
815
          		</div>
816
 
16891 efrain 817
 
1 www 818
      		</div>
819
 
820
            <!-- Modal footer -->
16891 efrain 821
      		<div class="modal-footer text-right">
822
      			<button type="submit" class="btn btn-primary">LABEL_UPLOAD</button>
1 www 823
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
824
      		</div>
16891 efrain 825
      		<?php echo $this->form()->closeTag($form); ?>
1 www 826
 
827
    	</div>
828
	</div>
829
</div>
830
 
831
 
832
 
833
<!-- The Modal -->
834
<div class="modal" id="modalUploadCustomers">
835
	<div class="modal-dialog modal-xl">
836
    	<div class="modal-content">
837
 
838
            <!-- Modal Header -->
839
      		<div class="modal-header">
16845 efrain 840
        		<h6 class="modal-title">LABEL_CUSTOMERS</h6>
16822 efrain 841
        		<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
1 www 842
      		</div>
843
 
844
            <!-- Modal body -->
845
      		<div class="modal-body">
846
      			<form>
847
      				<input type="hidden" name="table-upload-customers-key" id="table-upload-customers-key">
16891 efrain 848
      				<div class="row">
849
      					<div class="col-12 mt-3">
1 www 850
      					<label>LABEL_TOPIC</label>
851
      					<input type="text" readonly="readonly" id="table-upload-customers-topic" class="form-control" >
16891 efrain 852
      					</div>
1 www 853
      				</div>
854
      			</form>
15457 efrain 855
 
16891 efrain 856
      			<div class="row">
857
      				<div class="col-12 mt-3">
858
 
859
 
16983 efrain 860
      					<ul class="nav nav-tabs" id="myTab" role="tablist">
861
                  			<li class="nav-item">
862
                    			<a class="nav-link active" id="items-ok-tab" data-bs-toggle="tab" href="#items-ok" role="tab" aria-controls="items-ok" aria-selected="true">LABEL_USERS</a>
863
                  			</li>
864
                  			<li class="nav-item">
865
                    			<a class="nav-link" id="items-error-tab" data-bs-toggle="tab" href="#items-error" role="tab" aria-controls="items-error" aria-selected="false">LABEL_ERRORS</a>
866
                  			</li>
867
                		</ul>
868
                		<div class="tab-content border border-top-0 p-3" id="myTabContent">
869
                  			<div class="tab-pane fade show active" id="items-ok" role="tabpanel" aria-labelledby="items-ok-tab">
870
 
871
                  				<div style="height: 300px;overflow: scroll;">
872
                    				<table id="gridTableUploadOk" style="width: 100%" class="table table-bordered">
873
                                		<thead>
874
                                			<tr>
875
                                				<th>LABEL_ID</th>
876
                                          		<th>LABEL_FIRST_NAME</th>
877
                                         		<th>LABEL_LAST_NAME</th>
878
                                             	<th>LABEL_EMAIL</th>
17248 stevensc 879
                                           		<th>LABEL_TOPICS</th>
16983 efrain 880
                                 			</tr>
881
                                      	</thead>
882
                                   		<tbody>
883
                                   		</tbody>
884
                             		</table>
885
                         		</div>
886
 
887
                  			</div>
888
                 			<div class="tab-pane fade" id="items-error" role="tabpanel" aria-labelledby="items-error-tab">
889
                 				<div style="height: 300px;overflow: scroll;">
890
                    				<table id="gridTableUploadError" style="width: 100%" class="table table-bordered">
891
                                		<thead>
892
                                			<tr>
893
                                				<th>LABEL_ID</th>
894
                                          		<th>LABEL_FIRST_NAME</th>
895
                                         		<th>LABEL_LAST_NAME</th>
896
                                             	<th>LABEL_EMAIL</th>
897
                                             	<th>LABEL_STATUS</th>
898
                                 			</tr>
899
                                      	</thead>
900
                                   		<tbody>
901
                                   		</tbody>
902
                             		</table>
903
                         		</div>
904
 
905
                 			</div>
906
                		</div>
907
 
908
 
909
 
16891 efrain 910
      				</div>
911
      			</div>
912
 
1 www 913
 
914
      		</div>
915
 
916
            <!-- Modal footer -->
16891 efrain 917
      		<div class="modal-footer text-right">
1 www 918
      			<button type="submit" class="btn btn-primary btn-upload-customers-step2">LABEL_SAVE</button>
919
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
920
      		</div>
921
 
922
    	</div>
923
	</div>
924
</div>
925
 
926
 
927
 
928
 
929