Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 1 | Rev 15457 | 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
 
15
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
16
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
17
 
18
 
19
$this->inlineScript()->appendFile($this->basePath('plugins/bootbox/bootbox.min.js'));
20
 
21
 
22
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
23
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
24
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
25
 
26
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
27
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
28
 
29
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
30
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
31
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
32
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
33
 
34
 
35
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
36
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
37
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
38
 
39
 
40
 
41
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
42
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
43
 
44
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
45
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
46
 
47
$this->inlineScript()->appendFile($this->basePath('plugins/moment/moment-with-locales.min.js'));
48
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css'));
49
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js'));
50
 
51
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/css/fileinput.min.css'));
52
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.css'));
53
 
54
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/piexif.js'));
55
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/sortable.js'));
56
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/fileinput.js'));
57
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/locales/es.js'));
58
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/fas/theme.js'));
59
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.js'));
60
 
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();
238
                $('button.btn-revoke').confirmation({
239
                    rootSelector: 'button.btn-revoke',
240
                    title : 'LABEL_ARE_YOU_SURE',
241
                    singleton : true,
242
                    btnOkLabel: 'LABEL_YES',
243
                    btnCancelLabel: 'LABEL_NO',
244
                    onConfirm: function(value) {
245
                        action = $(this).data('href');
246
                        NProgress.start();
247
                        $.ajax({
248
                            'dataType'  : 'json',
249
                            'accept'    : 'application/json',
250
                            'method'    : 'post',
251
                            'url'       :  action,
252
                        }).done(function(response) {
253
                            if(response['success']) {
254
                                $.fn.showSuccess(response['data']);
255
                                gridTable.api().ajax.reload(null, false);
256
                            } else {
257
                                $.fn.showError(response['data']);
258
                            }
259
                        }).fail(function( jqXHR, textStatus, errorThrown) {
260
                            $.fn.showError(textStatus);
261
                        }).always(function() {
262
                            NProgress.done();
263
                        });
264
                    },
265
                });
266
                $('button.btn-unlimit').confirmation({
267
                    rootSelector: 'button.btn-unlimit',
268
                    title : 'LABEL_ARE_YOU_SURE',
269
                    singleton : true,
270
                    btnOkLabel: 'LABEL_YES',
271
                    btnCancelLabel: 'LABEL_NO',
272
                    onConfirm: function(value) {
273
                        action = $(this).data('href');
274
                        NProgress.start();
275
                        $.ajax({
276
                            'dataType'  : 'json',
277
                            'accept'    : 'application/json',
278
                            'method'    : 'post',
279
                            'url'       :  action,
280
                        }).done(function(response) {
281
                            if(response['success']) {
282
                                $.fn.showSuccess(response['data']);
283
                                gridTable.api().ajax.reload(null, false);
284
                            } else {
285
                                $.fn.showError(response['data']);
286
                            }
287
                        }).fail(function( jqXHR, textStatus, errorThrown) {
288
                            $.fn.showError(textStatus);
289
                        }).always(function() {
290
                            NProgress.done();
291
                        });
292
                    },
293
                });
294
            },
295
            'aoColumns': [
296
                { 'mDataProp': 'uuid' },
297
                { 'mDataProp': 'first_name' },
298
                { 'mDataProp': 'last_name' },
299
                { 'mDataProp': 'email' },
300
                { 'mDataProp': 'details' },
301
                { 'mDataProp': 'actions' },
302
    	    ],
303
            'columnDefs': [
304
                {
305
                    'targets': 0,
306
                    'orderable': false,
307
                    'render' : function ( data, type, row ) {
308
                        s = '<input type="checkbox" class="chk-customer" value="' + data + '">';
309
                        return s;
310
                    }
311
                },
312
                {
313
                    'targets': -2,
314
                    'orderable': false,
315
                    'render' : function ( data, type, row ) {
316
                        s = '';
317
                        if(data['access']) {
318
                            s = s + 'LABEL_ACCESS : ' + data['access'] + '<br>';
319
                        }
320
                        if(data['paid_from']) {
321
                            s = s + 'LABEL_PAID_FROM : ' + data['paid_from'] + '<br>';
322
                        }
323
                        if(data['paid_to']) {
324
                            s = s + 'LABEL_PAID_TO : ' + data['paid_to'] + '<br>';
325
                        }
326
                        if(data['added_on']) {
327
                            s = s + 'LABEL_ADDED_ON : ' + data['added_on'] + '<br>';
328
                        }
329
                        if(data['updated_on']) {
330
                            s = s + 'LABEL_UPDATED_ON : ' + data['updated_on'] + '<br>';
331
                        }
332
 
333
                        return s;
334
                    }
335
                },
336
 
337
 
338
                {
339
                    'targets': -1,
340
                    'orderable': false,
341
                    'render' : function ( data, type, row ) {
342
                        s = '';
343
 
344
                        if(allowRevoke && data['link_revoke']  ) {
345
                            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;';
346
                        }
347
                        if(allowCancel && data['link_cancel']  ) {
348
                            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;';
349
                        }
350
                        if(allowUnlimit && data['link_unlimit']  ) {
351
                            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;';
352
                        }
353
                        if(allowReactive && data['link_reactive']  ) {
354
                            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;';
355
                        }
356
 
357
 
358
                        return s;
359
                    }
360
                }
361
              ],
362
        });
363
 
364
    $('#form-filter #topic_uuid').change(function(e) {
365
        e.preventDefault();
366
 
367
        $('#form-filter #capsule_uuid').empty();
368
        gridTable.api().ajax.reload(null, false);
369
    })
370
 
371
 
372
    $('#form-filter #capsule_uuid').change(function(e) {
373
        e.preventDefault();
374
 
375
        gridTable.api().ajax.reload(null, false);
376
    })
377
 
378
    $('body').on('click', 'button.btn-notification', function(e) {
379
        e.preventDefault();
380
 
381
        var customer_uuids = [];
382
        $.each($('input[type="checkbox"].chk-customer:checked'), function(index, element) {
383
            customer_uuids.push($(this).val());
384
        });
385
 
386
        if(customer_uuids.length == 0) {
387
            $.fn.showError('ERROR_NOT_SELECTED_CUSTOMERS');
388
            return;
389
        }
390
 
391
        var href = $(this).data('href');
392
        $('#notificationPushModal').modal('show');
393
        $('#form-push-notification').attr('action', href);
394
 
395
    });
396
 
397
 
398
    $('#chk-customer-all').click(function(e) {
399
       // e.preventDefault();
400
 
401
        var checked = $(this).prop('checked');
402
        $.each($('input[type="checkbox"].chk-customer'), function(index, element) {
403
           $(this).prop('checked', checked);
404
        });
405
 
406
 
407
    });
408
 
409
    $('body').on('click', 'input[type="checkbox"].chk-customer', function(e) {
410
        var checked = $(this).prop('checked');
411
        if(!checked) {
412
            $('#chk-customer-all').prop('checked', false );
413
        }
414
    });
415
 
416
var validatorPushNotification = $('#form-push-notification').validate({
417
        debug: true,
418
        onclick: false,
419
        onkeyup: false,
420
        onfocusout: false,
421
        ignore: [],
422
        rules: {
423
            'push_template_id' : {
424
                required: true,
425
 
426
            },
427
        },
428
 
429
        submitHandler: function(form)
430
        {
431
            var customer_uuids = [];
432
            $.each($('input[type="checkbox"].chk-customer:checked'), function(index, element) {
433
                customer_uuids.push($(this).val());
434
            });
435
 
436
            if(customer_uuids.length == 0) {
437
                $.fn.showError('ERROR_NOT_SELECTED_CUSTOMERS');
438
                return;
439
            }
440
 
441
            var push_template_id = $('#form-push-notification #push_template_id').val();
442
 
443
            $('input[type="submit"]').prop('disabled', true);
444
            NProgress.start();
445
            $.ajax({
446
                'dataType'  : 'json',
447
                'accept'    : 'application/json',
448
                'method'    : 'post',
449
                'url'       : routeNotification,
450
                'data'      : {
451
                    'push_template_id' : push_template_id,
452
                    'customer_uuids' : customer_uuids
453
 
454
                },
455
            }).done(function(response) {
456
                if(response['success']) {
457
                    if(response['data']['push_to_send'] == 1) {
458
                        $.fn.showSuccess(response['data']['push_to_send'] + ' LABEL_PUSH_IN_QUEUE');
459
                    } else {
460
                        $.fn.showSuccess(response['data']['push_to_send'] + ' LABEL_PUSHES_IN_QUEUE');
461
                    }
462
 
463
 
464
                    $('#notificationPushModal').modal('hide');
465
                } else {
466
                    validatorPushNotification.resetForm();
467
                    if(jQuery.type(response['data']) == 'string') {
468
                        $.fn.showError(response['data']);
469
                    } else  {
470
                        $.each(response['data'], function( fieldname, errors ) {
471
                            $.fn.showFormErrorValidator('#form-push-notification #' + fieldname, errors);
472
                        });
473
                    }
474
                }
475
            }).fail(function( jqXHR, textStatus, errorThrown) {
476
                $.fn.showError(textStatus);
477
            }).always(function() {
478
 
479
                NProgress.done();
480
            });
481
            return false;
482
        },
483
        invalidHandler: function(form, validator) {
484
 
485
        }
486
    });
487
 
488
 
489
    var validatorCapsuleCustomer = $('#form-capsule-customer').validate({
490
        debug: true,
491
        onclick: false,
492
        onkeyup: false,
493
        onfocusout: false,
494
        ignore: [],
495
        rules: {
496
            'file' : {
497
                required: true,
498
                extension: 'xls|xlsx',
499
                accept: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel'
500
            },
501
        },
502
 
503
        submitHandler: function(form)
504
        {
505
            NProgress.start();
506
            var formdata = false;
507
            if (window.FormData){
508
                formdata = new FormData(form);
509
            }
510
            formdata.append('step','validation');
511
 
512
 
513
            $.ajax({
514
                'dataType'  : 'json',
515
                'accept'    : 'application/json',
516
                'method'    : 'post',
517
                'url'       :  routeUpload,
518
                'data'      :  formdata,
519
                'processData': false,
520
                'contentType': false,
521
            }).done(function(response) {
522
                if(response['success']) {
523
 
524
                    $('#table-upload-customers-key').val(response['data']['key']);
525
                    $('#table-upload-customers-topic').val(response['data']['topic']);
526
          			$('#table-upload-customers-capsule').val(response['data']['capsule']);
527
 
528
                    $('#gridTableUploadCustomers tbody').empty();
529
 
530
                    $.each(response['data']['items'], function(index, item) {
531
 
532
 
533
                        var s = '<tr>';
534
                        s = s + '<td>' + item['first_name'] + '</td>';
535
                        s = s + '<td>' + item['last_name'] + '</td>';
536
                        s = s + '<td>' + item['email'] + '</td>';
537
                        s = s + '<td class="text-right">' + item['assigned_capsules'] + '</td>';
538
                        s = s + '</tr>';
539
 
540
                        $('#gridTableUploadCustomers tbody').append(s);
541
 
542
 
543
                    });
544
 
545
                    $('#modalCapsuleCustomer').modal('hide');
546
                    $('#modalUploadCustomers').modal('show');
547
 
548
 
549
 
550
                } else {
551
                    validatorCapsuleCustomer.resetForm();
552
                    if(jQuery.type(response['data']) == 'string') {
553
                        $.fn.showError(response['data']);
554
                    } else  {
555
                        $.each(response['data'], function( fieldname, errors ) {
556
                            $.fn.showFormErrorValidator('#form-capsule-customer #' + fieldname, errors);
557
                        });
558
                    }
559
                }
560
            }).fail(function( jqXHR, textStatus, errorThrown) {
561
                $.fn.showError(textStatus);
562
            }).always(function() {
563
 
564
                NProgress.done();
565
            });
566
            return false;
567
        },
568
        invalidHandler: function(form, validator) {
569
 
570
        }
571
    });
572
 
573
 
574
    $('#form-capsule-customer #file').fileinput({
575
        theme: 'fas',
576
        language: 'es',
577
        showUpload: false,
578
        dropZoneEnabled: false,
579
        maxFileCount: 1,
580
        allowedFileExtensions: ['xls', 'xlsx'],
581
    });
582
 
583
    $('body').on('click', 'button.btn-upload', function(e) {
584
        e.preventDefault();
585
 
586
        $('#form-capsule-customer #file').fileinput('reset');
587
        $('#form-capsule-customer #file').val('');
588
 
589
        $('#modalCapsuleCustomer').modal('show');
590
    });
591
 
592
    $('body').on('click', 'button.btn-upload-customers-step2', function(e) {
593
        e.preventDefault();
594
        NProgress.start();
595
 
596
        $.ajax({
597
            'dataType'  : 'json',
598
            'accept'    : 'application/json',
599
            'method'    : 'post',
600
            'url'       :  routeUpload,
601
            'data'      :  {
602
                'step' : 'process',
603
                'key' : $('#table-upload-customers-key').val(),
604
            }
605
        }).done(function(response) {
606
            if(response['success']) {
607
                if(response['data']['users_assigned'] == 1) {
608
                    $.fn.showSuccess(response['data']['users_assigned'] + ' LABEL_CUSTOMER_ASSIGNED');
609
                } else {
610
                    $.fn.showSuccess(response['data']['users_assigned'] + ' LABEL_CUSTOMERS_ASSIGNED');
611
                }
612
                 gridTable.api().ajax.reload(null, false);
613
                $('#modalUploadCustomers').modal('hide');
614
            } else {
615
                $.fn.showError(response['data']);
616
            }
617
        }).fail(function( jqXHR, textStatus, errorThrown) {
618
            $.fn.showError(textStatus);
619
        }).always(function() {
620
            NProgress.done();
621
        });
622
        return false;
623
    });
624
 
625
    $('body').on('click', 'button.btn-refresh', function(e) {
626
        e.preventDefault();
627
        gridTable.api().ajax.reload(null, false);
628
    });
629
});
630
JS;
631
$this->inlineScript()->captureEnd();
632
?>
633
 
634
 
635
<!-- Content Header (Page header) -->
636
<section class="content-header">
637
	<div class="container-fluid">
638
    	<div class="row mb-2">
639
        	<div class="col-sm-12">
640
            	<h1>LABEL_ACCESS_FOR_STUDENTS</h1>
641
			</div>
642
		</div>
643
	</div><!-- /.container-fluid -->
644
</section>
645
 
646
<section class="content">
647
	<div class="container-fluid">
648
    	<div class="row">
649
        	<div class="col-12">
650
				<div class="card">
651
					<div class="card-header">
652
						<?php
653
                        $form = $this->form;
654
            	        $form->setAttributes([
655
                            'name'    => 'form-filter',
656
                            'id'      => 'form-filter',
657
                        ]);
658
 
659
                        $form->prepare();
660
                        echo $this->form()->openTag($form);
661
                        ?>
662
                        <div class="row">
663
                            <div class="col-md-6 col-sm-12">
664
                                <div class="form-group">
665
                                    <?php
666
                                    $element = $form->get('topic_uuid');
667
 
668
                                    $element->setOptions(['label' => 'LABEL_TOPIC']);
669
 
670
                                    $element->setAttributes(['class' => 'form-control']);
671
                                    echo $this->formLabel($element);
672
                                    echo $this->formSelect($element);
673
                                    ?>
674
                                </div>
675
                            </div>
676
                            <div class="col-md-6 col-sm-12">
677
                                <div class="form-group">
678
                                    <?php
679
                                    $element = $form->get('capsule_uuid');
680
                                    $element->setOptions(['label' => 'LABEL_CAPSULE']);
681
                                    $element->setAttributes(['class' => 'form-control']);
682
                                    echo $this->formLabel($element);
683
                                    echo $this->formSelect($element);
684
                                    ?>
685
                                </div>
686
                            </div>
687
                            <div
688
                                class="col-md-12 col-sm-12"
689
                            >
690
                                <div style="float:right;">
691
                                    <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
692
                                    <?php if($allowUpload) : ?>
693
                                        <button type="button" class="btn btn-primary btn-upload"><i class="fa fa-upload"></i> LABEL_UPLOAD  </button>
694
                                    <?php endif; ?>
695
                                    <?php if($allowNotification) : ?>
696
                                        <button type="button" class="btn btn-primary btn-notification"><i class="fa fa-tablet"></i> LABEL_NOTIFICATION </button>
697
                                    <?php endif; ?>
698
                                </div>
699
                            </div>
700
                        </div>
701
						<?php echo $this->form()->closeTag($form); ?>
702
					</div>
703
					<div class="card-body">
20 steven 704
        	    		<table id="gridTable" class="table   table-hover">
1 www 705
                      		<thead>
706
        						<tr>
707
        							<th><input type="checkbox" id="chk-customer-all"></th>
708
                                	<th>LABEL_FIRST_NAME</th>
709
                                	<th>LABEL_LAST_NAME</th>
710
                                	<th>LABEL_EMAIL</th>
711
                                  	<th>LABEL_DETAILS</th>
712
                                  	<th>LABEL_ACTIONS</th>
713
                                </tr>
714
                       		</thead>
715
                         	<tbody>
716
                         	</tbody>
717
                    	</table>
718
                   	</div>
719
          		</div>
720
           	</div>
721
        </div>
722
 	</div>
723
</section>
724
 
725
<!-- The Modal -->
726
<div class="modal" id="notificationPushModal">
727
	<div class="modal-dialog modal-sm">
728
    	<div class="modal-content">
729
 
730
            <!-- Modal Header -->
731
      		<div class="modal-header">
732
        		<h4 class="modal-title">LABEL_PUSH_NOTIFICATION</h4>
733
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
734
      		</div>
735
 
736
            <!-- Modal body -->
737
      		<div class="modal-body">
738
				<?php
739
				        $form = $this->formPushNotification;
740
                        $form->setAttributes([
741
                            'method'    => 'post',
742
                            'name'      => 'form-push-notification',
743
                            'id'        => 'form-push-notification',
744
                        ]);
745
 
746
                        $form->prepare();
747
                        echo $this->form()->openTag($form);
748
                        ?>
749
                        <div class="form-group">
750
                        	<?php
751
                            $element = $form->get('push_template_id');
752
                            $element->setAttributes([
753
                                'class' => 'form-control'
754
                            ]);
755
                            $element->setLabelAttributes([
756
                                'class' => 'form-label'
757
                            ]);
758
                            $element->setOptions([
759
                                'label' => 'LABEL_TYPE'
760
                            ]);
761
                            echo $this->formLabel($element);
762
                            echo $this->formSelect($element);
763
                            ?>
764
    					</div>
765
 
766
        				<button type="submit" class="btn btn-primary">LABEL_SEND</button>
767
               			<?php
768
                        echo $this->form()->closeTag($form);
769
                        ?>
770
 
771
      		</div>
772
 
773
            <!-- Modal footer -->
774
      		<div class="modal-footer">
775
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
776
      		</div>
777
 
778
    	</div>
779
	</div>
780
</div>
781
 
782
 
783
<!-- The Modal -->
784
<div class="modal" id="modalCapsuleCustomer">
785
	<div class="modal-dialog  modal-xl">
786
    	<div class="modal-content">
787
 
788
            <!-- Modal Header -->
789
      		<div class="modal-header">
790
        		<h4 class="modal-title">LABEL_UPLOAD</h4>
791
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
792
      		</div>
793
 
794
            <!-- Modal body -->
795
      		<div class="modal-body">
796
       			 <?php
797
                    $form = $this->formCapsuleCustomer;
798
            		$form->setAttributes([
799
                        'method'    => 'post',
800
                        'name'      => 'form-capsule-customer',
801
                        'id'        => 'form-capsule-customer'
802
                    ]);
803
 
804
                    $form->prepare();
805
                    echo $this->form()->openTag($form);
806
                ?>
807
 
808
				<div class="form-group">
809
 
810
 
811
                 		<?php
812
                        $element = $form->get('file');
813
                        $element->setOptions(['label' => 'LABEL_EXCEL']);
814
                        echo $this->formLabel($element);
815
                        ?>
816
                        <div class="file-loading">
817
                        <?php
818
                        $element->setAttributes(['class' => 'form-control', 'accept' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.ms-excel']);
819
                        echo $this->formFile($element);
820
                        ?>
821
                	</div>
822
          		</div>
823
 
824
 
825
 
826
        		<div class="form-group">
827
                	<button type="submit" class="btn btn-primary">LABEL_UPLOAD</button>
828
             		<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
829
           		</div>
830
    			<?php echo $this->form()->closeTag($form); ?>
831
      		</div>
832
 
833
            <!-- Modal footer -->
834
      		<div class="modal-footer">
835
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
836
      		</div>
837
 
838
    	</div>
839
	</div>
840
</div>
841
 
842
 
843
 
844
<!-- The Modal -->
845
<div class="modal" id="modalUploadCustomers">
846
	<div class="modal-dialog modal-xl">
847
    	<div class="modal-content">
848
 
849
            <!-- Modal Header -->
850
      		<div class="modal-header">
851
        		<h4 class="modal-title">LABEL_CUSTOMERS</h4>
852
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
853
      		</div>
854
 
855
            <!-- Modal body -->
856
      		<div class="modal-body">
857
      			<form>
858
      				<input type="hidden" name="table-upload-customers-key" id="table-upload-customers-key">
859
      				<div class="form-group">
860
      					<label>LABEL_TOPIC</label>
861
      					<input type="text" readonly="readonly" id="table-upload-customers-topic" class="form-control" >
862
      				</div>
863
      				<div class="form-group">
864
      					<label>LABEL_CAPSULE</label>
865
      					<input type="text" readonly="readonly" id="table-upload-customers-capsule" class="form-control" >
866
      				</div>
867
      			</form>
868
      			<div style="height: 300px;overflow: scroll;">
869
				<table id="gridTableUploadCustomers" style="width: 100%" class="table table-bordered table-hover">
870
            		<thead>
871
            			<tr>
872
                      		<th>LABEL_FIRST_NAME</th>
873
                     		<th>LABEL_LAST_NAME</th>
874
                         	<th>LABEL_EMAIL</th>
875
                       		<th>LABEL_CAPSULES</th>
876
             			</tr>
877
                  	</thead>
878
               		<tbody>
879
               		</tbody>
880
         		</table>
881
         		</div>
882
 
883
      		</div>
884
 
885
            <!-- Modal footer -->
886
      		<div class="modal-footer">
887
      			<button type="submit" class="btn btn-primary btn-upload-customers-step2">LABEL_SAVE</button>
888
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
889
      		</div>
890
 
891
    	</div>
892
	</div>
893
</div>
894
 
895
 
896
 
897
 
898