Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16845 | Rev 16929 | 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
 
16891 efrain 654
<div class="container">
655
	<div class="card" id="">
656
	 	<div class="card-header">
657
	 		<h6 class="card-title">LABEL_ACCESS_FOR_STUDENTS</h6>
658
	 	</div>
659
 
660
	 	<?php
1 www 661
                        $form = $this->form;
662
            	        $form->setAttributes([
663
                            'name'    => 'form-filter',
664
                            'id'      => 'form-filter',
665
                        ]);
666
 
667
                        $form->prepare();
668
                        echo $this->form()->openTag($form);
16891 efrain 669
                        ?>
670
 
671
	 	<div class="card-body">
672
	 		<div class="row">
673
                            <div class="col-6 mt-3 ">
674
 
1 www 675
                                    <?php
676
                                    $element = $form->get('topic_uuid');
677
 
678
                                    $element->setOptions(['label' => 'LABEL_TOPIC']);
679
 
680
                                    $element->setAttributes(['class' => 'form-control']);
681
                                    echo $this->formLabel($element);
682
                                    echo $this->formSelect($element);
683
                                    ?>
16891 efrain 684
 
1 www 685
                            </div>
16891 efrain 686
                            <div class="col-6 mt-3">
687
 
1 www 688
                                    <?php
689
                                    $element = $form->get('capsule_uuid');
690
                                    $element->setOptions(['label' => 'LABEL_CAPSULE']);
691
                                    $element->setAttributes(['class' => 'form-control']);
692
                                    echo $this->formLabel($element);
693
                                    echo $this->formSelect($element);
694
                                    ?>
16891 efrain 695
 
1 www 696
                            </div>
16891 efrain 697
	 		</div>
698
 
699
	 		<div class="row">
700
	 	         <div class="col-12 mt-3">
701
 
702
	 	         	<table id="gridTable" class="table   table-bordered">
1 www 703
                      		<thead>
704
        						<tr>
705
        							<th><input type="checkbox" id="chk-customer-all"></th>
706
                                	<th>LABEL_FIRST_NAME</th>
707
                                	<th>LABEL_LAST_NAME</th>
708
                                	<th>LABEL_EMAIL</th>
709
                                  	<th>LABEL_DETAILS</th>
710
                                  	<th>LABEL_ACTIONS</th>
711
                                </tr>
712
                       		</thead>
713
                         	<tbody>
714
                         	</tbody>
715
                    	</table>
16891 efrain 716
 
717
	 	         </div>
718
	 	     </div>
719
	 	</div>
720
	 	<div class="card-footer text-right">
721
	 	      <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
722
                                    <?php if($allowUpload) : ?>
723
                                        <button type="button" class="btn btn-primary btn-upload"><i class="fa fa-upload"></i> LABEL_UPLOAD  </button>
724
                                    <?php endif; ?>
725
                                    <?php if($allowNotification) : ?>
726
                                        <button type="button" class="btn btn-primary btn-notification"><i class="fa fa-tablet"></i> LABEL_NOTIFICATION </button>
727
                                    <?php endif; ?>
728
	 	</div>
729
	 	<?php echo $this->form()->closeTag($form); ?>
730
	</div>
731
</div>
1 www 732
 
16891 efrain 733
 
734
 
1 www 735
<!-- The Modal -->
736
<div class="modal" id="notificationPushModal">
737
	<div class="modal-dialog modal-sm">
738
    	<div class="modal-content">
739
 
740
            <!-- Modal Header -->
741
      		<div class="modal-header">
16845 efrain 742
        		<h6 class="modal-title">LABEL_PUSH_NOTIFICATION</h6>
16822 efrain 743
        		<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
1 www 744
      		</div>
745
 
16891 efrain 746
	<?php
1 www 747
				        $form = $this->formPushNotification;
748
                        $form->setAttributes([
749
                            'method'    => 'post',
750
                            'name'      => 'form-push-notification',
751
                            'id'        => 'form-push-notification',
752
                        ]);
753
 
754
                        $form->prepare();
755
                        echo $this->form()->openTag($form);
756
                        ?>
16891 efrain 757
      		<div class="modal-body">
758
 
759
                        <div class="row">
760
                        	<div class="col-12 mt-3">
1 www 761
                        	<?php
762
                            $element = $form->get('push_template_id');
763
                            $element->setAttributes([
764
                                'class' => 'form-control'
765
                            ]);
766
                            $element->setLabelAttributes([
767
                                'class' => 'form-label'
768
                            ]);
769
                            $element->setOptions([
770
                                'label' => 'LABEL_TYPE'
771
                            ]);
772
                            echo $this->formLabel($element);
773
                            echo $this->formSelect($element);
774
                            ?>
16891 efrain 775
                            </div>
1 www 776
    					</div>
777
 
16891 efrain 778
 
779
 
1 www 780
 
781
      		</div>
782
 
783
            <!-- Modal footer -->
16891 efrain 784
      		<div class="modal-footer text-right">
785
      		<button type="submit" class="btn btn-primary">LABEL_SEND</button>
1 www 786
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
787
      		</div>
16891 efrain 788
      		<?php
789
                        echo $this->form()->closeTag($form);
790
                        ?>
1 www 791
 
792
    	</div>
793
	</div>
794
</div>
795
 
796
 
797
<!-- The Modal -->
798
<div class="modal" id="modalCapsuleCustomer">
799
	<div class="modal-dialog  modal-xl">
800
    	<div class="modal-content">
801
 
802
            <!-- Modal Header -->
803
      		<div class="modal-header">
16845 efrain 804
        		<h6 class="modal-title">LABEL_UPLOAD</h6>
16822 efrain 805
        		<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
1 www 806
      		</div>
807
 
16891 efrain 808
 <?php
1 www 809
                    $form = $this->formCapsuleCustomer;
810
            		$form->setAttributes([
811
                        'method'    => 'post',
812
                        'name'      => 'form-capsule-customer',
813
                        'id'        => 'form-capsule-customer'
814
                    ]);
815
 
816
                    $form->prepare();
817
                    echo $this->form()->openTag($form);
16891 efrain 818
                ?>
819
      		<div class="modal-body">
820
 
1 www 821
 
16891 efrain 822
				<div class="row">
823
                	<div class="col-12 mt-3">
1 www 824
 
825
                 		<?php
826
                        $element = $form->get('file');
827
                        $element->setOptions(['label' => 'LABEL_EXCEL']);
828
                        echo $this->formLabel($element);
829
                        ?>
830
                        <div class="file-loading">
831
                        <?php
16768 efrain 832
                        $element->setAttributes(['class' => 'form-control', 'accept' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel']);
1 www 833
                        echo $this->formFile($element);
834
                        ?>
16891 efrain 835
                        </div>
1 www 836
                	</div>
837
          		</div>
838
 
16891 efrain 839
 
1 www 840
      		</div>
841
 
842
            <!-- Modal footer -->
16891 efrain 843
      		<div class="modal-footer text-right">
844
      			<button type="submit" class="btn btn-primary">LABEL_UPLOAD</button>
1 www 845
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
846
      		</div>
16891 efrain 847
      		<?php echo $this->form()->closeTag($form); ?>
1 www 848
 
849
    	</div>
850
	</div>
851
</div>
852
 
853
 
854
 
855
<!-- The Modal -->
856
<div class="modal" id="modalUploadCustomers">
857
	<div class="modal-dialog modal-xl">
858
    	<div class="modal-content">
859
 
860
            <!-- Modal Header -->
861
      		<div class="modal-header">
16845 efrain 862
        		<h6 class="modal-title">LABEL_CUSTOMERS</h6>
16822 efrain 863
        		<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
1 www 864
      		</div>
865
 
866
            <!-- Modal body -->
867
      		<div class="modal-body">
868
      			<form>
869
      				<input type="hidden" name="table-upload-customers-key" id="table-upload-customers-key">
16891 efrain 870
      				<div class="row">
871
      					<div class="col-12 mt-3">
1 www 872
      					<label>LABEL_TOPIC</label>
873
      					<input type="text" readonly="readonly" id="table-upload-customers-topic" class="form-control" >
16891 efrain 874
      					</div>
1 www 875
      				</div>
16891 efrain 876
      				<div class="row">
877
      					<div class="col-12 mt-3">
1 www 878
      					<label>LABEL_CAPSULE</label>
879
      					<input type="text" readonly="readonly" id="table-upload-customers-capsule" class="form-control" >
16891 efrain 880
      					</div>
1 www 881
      				</div>
882
      			</form>
15457 efrain 883
 
16891 efrain 884
      			<div class="row">
885
      				<div class="col-12 mt-3">
886
 
887
 
1 www 888
      			<div style="height: 300px;overflow: scroll;">
16822 efrain 889
    				<table id="gridTableUploadCustomers" style="width: 100%" class="table table-bordered">
15457 efrain 890
                		<thead>
891
                			<tr>
892
                          		<th>LABEL_FIRST_NAME</th>
893
                         		<th>LABEL_LAST_NAME</th>
894
                             	<th>LABEL_EMAIL</th>
895
                           		<th>LABEL_CAPSULES</th>
896
                 			</tr>
897
                      	</thead>
898
                   		<tbody>
899
                   		</tbody>
900
             		</table>
1 www 901
         		</div>
16891 efrain 902
      				</div>
903
      			</div>
904
 
1 www 905
 
906
      		</div>
907
 
908
            <!-- Modal footer -->
16891 efrain 909
      		<div class="modal-footer text-right">
1 www 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