Proyectos de Subversion LeadersLinked - Backend

Rev

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