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
16815 stevensc 1
<?php
1 www 2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser    = $this->currentUserHelper();
4
 
5
$roleName = $currentUser->getUserTypeId();
6
 
7
 
8
//$routeAdd       = $this->url('users/add');
9
$routeDatatable = $this->url('users');
10
$routeDashboard = $this->url('dashboard');
15460 efrain 11
$routeUpload    = $this->url('users/upload');
1 www 12
 
13
 
14
$allowChangePassword    = $acl->isAllowed($roleName, 'users/change-password') ? 1 : 0;
15
$allowUnblock           = $acl->isAllowed($roleName, 'users/unblock') ? 1 : 0;
15460 efrain 16
$allowUpload            = $acl->isAllowed($roleName, 'users/upload') ? 1 : 0;
16248 efrain 17
$allowChangeType        = $acl->isAllowed($roleName, 'users/change-type') ? 1 : 0;
1 www 18
 
16822 efrain 19
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));
20
$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.js'));
1 www 21
 
16822 efrain 22
$this->inlineScript()->appendFile($this->basePath('assets/vendors/ckeditor/ckeditor.js'));
1 www 23
 
24
 
16822 efrain 25
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/jquery.validate.js'));
26
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/additional-methods.js'));
27
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/localization/messages_es.js'));
1 www 28
 
16822 efrain 29
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.css'));
30
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.css'));
1 www 31
 
16822 efrain 32
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net/jquery.dataTables.js'));
33
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.js'));
34
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/dataTables.responsive.min.js'));
35
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.min.js'));
1 www 36
 
37
 
16822 efrain 38
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
39
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
1 www 40
 
41
 
42
 
15460 efrain 43
 
16822 efrain 44
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-fileinput/css/fileinput.min.css'));
45
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fa/theme.css'));
15460 efrain 46
 
16843 efrain 47
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/piexif.js'));
48
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/sortable.js'));
16822 efrain 49
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/fileinput.js'));
50
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/locales/es.js'));
51
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/fa/theme.js'));
52
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fa/theme.js'));
53
 
54
 
1 www 55
$status_active = \LeadersLinked\Model\User::STATUS_ACTIVE;
56
 
57
$blocked = \LeadersLinked\Model\User::BLOCKED_YES;
58
 
59
$email_verified = \LeadersLinked\Model\User::EMAIL_VERIFIED_YES;
60
 
61
$this->inlineScript()->captureStart();
62
echo <<<JS
63
    jQuery( document ).ready(function( $ ) {
64
        $.validator.addMethod('passwordStrengthCheck', function(value) {
65
            return /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$^x%x*-]).{6,16}$/.test(value)
66
        }, 'ERROR_PASSWORD_STRENGTH');
67
 
68
        $.validator.setDefaults({
69
            debug: true,
70
            highlight: function(element) {
71
                $(element).closest('.sn-field').addClass('sn-field-has-error');
72
            },
73
            unhighlight: function(element) {
74
                $(element).closest('.sn-field').removeClass('sn-field-has-error');
75
            },
76
            errorElement: 'div',
77
            errorClass: 'sn-field-invalid-feedback',
78
            errorPlacement: function(error, element) {
79
                console.log(element);
80
 
81
                if(element.parent('.sn-field').length) {
82
                    error.insertAfter(element.parent());
83
                } else if (element.parent('.fgt-sec').length) {
84
                    error.insertAfter(element.parent());
85
                } else {
86
                    error.insertAfter(element);
87
                }
88
            }
89
        });
90
 
91
        $.validator.setDefaults({
92
            debug: true,
93
            highlight: function(element) {
94
                $(element).addClass('form-group-has-error');
95
            },
96
            unhighlight: function(element) {
97
                $(element).removeClass('form-group-has-error');
98
            },
99
            errorElement: 'div',
100
            errorClass: 'form-group-invalid-feedback',
101
            errorPlacement: function(error, element) {
102
                if(element.parent('.form-group').length) {
103
                    error.insertAfter(element.parent());
104
                } else if(element.parent('.toggle').length) {
105
                    error.insertAfter(element.parent().parent());
106
                } else {
107
                    error.insertAfter(element);
108
                }
109
            }
110
        });
111
 
112
        $.fn.showFormErrorValidator = function(fieldname, errors) {
113
            var field = $(fieldname);
114
            if(field) {
115
                $(field).addClass('form-group-has-error');
116
 
117
 
118
                var error = $('<div id="' + fieldname +'-error" class="form-group-invalid-feedback">' + errors + '</div>');
119
                if(field.parent('.form-group').length) {
120
                    error.insertAfter(field.parent());
121
                } else  if(field.parent('.toggle').length) {
122
                    error.insertAfter(field.parent().parent());
123
                } else {
124
                    error.insertAfter(field);
125
                }
126
            }
127
        };
128
 
129
        var allowChangePassword = $allowChangePassword;
130
        var allowUnblock = $allowUnblock;
16248 efrain 131
        var allowChangeType = $allowChangeType;
1 www 132
 
133
 
134
        var gridTable = $('#gridTable').dataTable( {
135
            'processing': true,
136
            'serverSide': true,
137
            'searching': true,
138
            'order': [[ 1, 'asc' ]],
139
            'ordering':  true,
140
            'ordenable' : true,
141
            'responsive': true,
142
            'select' : false,
143
        	'paging': true,
144
            'pagingType': 'simple_numbers',
145
    		'ajax': {
146
    			'url' : '$routeDatatable',
147
    			'type' : 'get',
148
                'beforeSend': function (request) {
149
                  NProgress.start();
150
                },
16299 efrain 151
                'data' : function(data) {
152
                    data.network_id = $('#form-filter #network_id').val();
153
                } ,
1 www 154
                'dataFilter': function(response) {
155
                    var response = jQuery.parseJSON( response );
156
 
157
                    var json                = {};
158
                    json.recordsTotal       = 0;
159
                    json.recordsFiltered    = 0;
160
                    json.data               = [];
161
 
162
 
163
                    if(response.success) {
164
                        json.recordsTotal       = response.data.total;
165
                        json.recordsFiltered    = response.data.total;
166
                        json.data               = response.data.items;
167
                    } else {
168
                        $.fn.showError(response.data)
169
                    }
170
 
171
                    return JSON.stringify( json );
172
                }
173
    		},
174
            'language' : {
175
                'sProcessing':     'LABEL_DATATABLE_SPROCESSING',
176
                'sLengthMenu':     'LABEL_DATATABLE_SLENGTHMENU',
177
                'sZeroRecords':    'LABEL_DATATABLE_SZERORECORDS',
178
                'sEmptyTable':     'LABEL_DATATABLE_SEMPTYTABLE',
179
                'sInfo':           'LABEL_DATATABLE_SINFO',
180
                'sInfoEmpty':      'LABEL_DATATABLE_SINFOEMPTY',
181
                'sInfoFiltered':   'LABEL_DATATABLE_SINFOFILTERED',
182
                'sInfoPostFix':    '',
183
                'sSearch':         'LABEL_DATATABLE_SSEARCH',
184
                'sUrl':            '',
185
                'sInfoThousands':  ',',
186
                'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
187
                'oPaginate': {
188
                    'sFirst':    'LABEL_DATATABLE_SFIRST',
189
                    'sLast':     'LABEL_DATATABLE_SLAST',
190
                    'sNext':     'LABEL_DATATABLE_SNEXT',
191
                    'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
192
                },
193
                'oAria': {
194
                    'sSortAscending':  ': LABEL_DATATABLE_SSORTASCENDING',
195
                    'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
196
                },
197
            },
198
            'drawCallback': function( settings ) {
199
                NProgress.done();
16822 efrain 200
 
1 www 201
            },
202
            'aoColumns': [
203
                { 'mDataProp': 'first_name' },
204
                { 'mDataProp': 'last_name' },
205
                { 'mDataProp': 'email' },
206
                { 'mDataProp': 'details' },
207
                { 'mDataProp': 'actions' },
208
    	    ],
209
            'columnDefs': [
210
                {
211
                    'targets': 0,
212
                    'className' : 'text-vertical-middle',
213
                    'render' : function ( data, type, row ) {
16299 efrain 214
                        if(row['actions']['link_profile']) {
215
                            var s =  data + '<br>';
216
                            s = s + '<button class="btn btn-default btn-view-profile" data-href="' +row['actions']['link_profile']+ '"><i class="fa fa-external-link"></button>';
217
 
218
                        } else {
219
                            var s =  data;
220
 
221
                        }
222
 
1 www 223
                         return s;
224
                    }
225
                },
226
                {
227
                    'targets': 1,
228
                    'className' : 'text-vertical-middle',
229
                },
230
                {
231
                    'targets': 2,
232
                    'className' : 'text-vertical-middle',
233
                },
234
                {
235
                    'targets': -2,
236
                    'orderable': false,
237
                    'render' : function ( data, type, row ) {
238
                        var s =  'LABEL_STATUS : ' + data['status'] + '<br>';
239
                        s = s + 'LABEL_BLOCKED : ' + data['blocked'] + '<br>';
240
                        s = s + 'LABEL_EMAIL_VERIFIED : ' + data['email_verified'] + '<br>';
241
                        s = s + 'LABEL_LOGIN_ATTEMP : ' + data['login_attempt'] + '<br>';
16248 efrain 242
                        s = s + 'LABEL_TYPE : ' + data['user_type'] + '<br>';
1 www 243
                        return s;
244
                    }
245
                },
246
                {
247
                    'targets': -1,
248
                    'orderable': false,
249
                    'render' : function ( data, type, row ) {
250
                        s = '';
251
 
252
                        if(allowChangePassword && data['link_change_password']) {
253
                            s = s + '<button class="btn btn-primary btn-change-password" data-href="' + data['link_change_password']+ '" data-toggle="tooltip" title="LABEL_CHANGE_PASSWORD"><i class="fa fa-key"></i> LABEL_PASSWORD </button>&nbsp;';
254
                        }
255
                        if(allowUnblock && data['link_unblock']) {
256
                            s = s + '<button class="btn btn-info btn-unblock" data-href="' + data['link_unblock']+ '" data-toggle="tooltip" title="LABEL_UNBLOCK"><i class="fa fa-unlock"></i> LABEL_UNBLOCK </button>&nbsp;';
257
                        }
16248 efrain 258
                        if(allowChangeType && data['link_change_type']) {
259
                            s = s + '<button class="btn btn-info btn-change-type" data-href="' + data['link_change_type']+ '" data-toggle="tooltip" title="LABEL_CHANGE_TYPE"><i class="fa fa-superpowers"></i> LABEL_CHANGE_TYPE </button>&nbsp;';
260
                        }
261
 
262
 
1 www 263
                        return s;
264
                    }
265
                }
266
 
267
            ],
268
        });
269
 
270
        var validatorChangePassword = $('#form-change-password').validate({
271
            debug: true,
272
            onclick: false,
273
            onkeyup: false,
274
            ignore: [':hidden'],
275
            rules: {
276
 
277
                'password': {
278
                    required: true,
279
                    minlength: 6,
280
                    maxlength: 16,
281
                    passwordStrengthCheck: true,
282
                },
283
                'confirmation' : {
284
                    required: true,
285
                    minlength: 6,
286
                    maxlength: 16,
287
                    equalTo: '#form-change-password #password'
288
                },
289
            },
290
            submitHandler: function(form)
291
            {
292
                NProgress.start();
293
                $.ajax({
294
                    'dataType'  : 'json',
295
                    'accept'    : 'application/json',
296
                    'method'    : 'post',
297
                    'url'       : $('#form-change-password').attr('action'),
298
                    'data'      : $('#form-change-password').serialize()
299
                 }).done(function(response) {
300
                    if(response.success) {
301
                        $.fn.showSuccess(response.data);
302
 
303
                        $('#modalChangePassword').modal('hide');
304
                         gridTable.api().ajax.reload(null, false);
305
                    } else {
306
                        if(jQuery.type(response.data) == 'string') {
307
                            $.fn.showError(response.data)
308
                        } else  {
309
                            $.each(response.data, function( fieldname, errors ) {
310
                                $.fn.showFormErrorValidator('#form-change-password #' + fieldname, errors);
311
                            });
312
                        }
313
                    }
314
                }).fail(function( jqXHR, textStatus, errorThrown) {
315
                    $.fn.showError(textStatus)
316
 
317
                }).always(function() {
318
                    NProgress.done();
319
                })
320
            },
321
            invalidHandler: function(form, validator) {
322
            }
323
        });
324
 
325
        $('body').on('click', 'button.btn-change-password', function(e) {
326
            e.preventDefault();
327
 
328
            NProgress.start();
329
            var action = $(this).data('href');
330
 
331
            $.ajax({
332
                'dataType'  : 'json',
333
                'accept'    : 'application/json',
334
                'method'    : 'get',
335
                'url'       :  action,
336
            }).done(function(response) {
337
                if(response['success']) {
338
 
339
                    $('#form-change-password').attr('action', action);
340
                    $('#form-change-password #first_name').val(response['data']['first_name']);
341
                    $('#form-change-password #last_name').val(response['data']['last_name']);
342
                    $('#form-change-password #email').val(response['data']['email']);
343
                    $('#form-change-password #password').val('');
344
                    $('#form-change-password #confirmation').val('');
345
                    validatorChangePassword.resetForm();
346
 
347
                    $('#modalChangePassword').modal('show');
348
                } else {
349
                    $.fn.showError(response['data']);
350
                }
351
            }).fail(function( jqXHR, textStatus, errorThrown) {
352
                $.fn.showError(textStatus);
353
            }).always(function() {
354
                NProgress.done();
355
            });
356
 
357
        });
16248 efrain 358
 
359
        var validatorChangeType = $('#form-change-type').validate({
360
            debug: true,
361
            onclick: false,
362
            onkeyup: false,
363
            ignore: [':hidden'],
364
            rules: {
365
 
366
                'usertype_id': {
367
                    required: true,
368
                },
369
            },
370
            submitHandler: function(form)
371
            {
372
                NProgress.start();
373
                $.ajax({
374
                    'dataType'  : 'json',
375
                    'accept'    : 'application/json',
376
                    'method'    : 'post',
377
                    'url'       : $('#form-change-type').attr('action'),
378
                    'data'      : $('#form-change-type').serialize()
379
                 }).done(function(response) {
380
                    if(response.success) {
381
                        $.fn.showSuccess(response.data);
382
 
383
                        $('#modalChangeType').modal('hide');
384
                         gridTable.api().ajax.reload(null, false);
385
                    } else {
386
                        if(jQuery.type(response.data) == 'string') {
387
                            $.fn.showError(response.data)
388
                        } else  {
389
                            $.each(response.data, function( fieldname, errors ) {
390
                                $.fn.showFormErrorValidator('#form-change-type #' + fieldname, errors);
391
                            });
392
                        }
393
                    }
394
                }).fail(function( jqXHR, textStatus, errorThrown) {
395
                    $.fn.showError(textStatus)
396
 
397
                }).always(function() {
398
                    NProgress.done();
399
                })
400
            },
401
            invalidHandler: function(form, validator) {
402
            }
403
        });
404
 
405
        $('body').on('click', 'button.btn-change-type', function(e) {
406
            e.preventDefault();
407
 
408
            NProgress.start();
409
            var action = $(this).data('href');
410
 
411
            $.ajax({
412
                'dataType'  : 'json',
413
                'accept'    : 'application/json',
414
                'method'    : 'get',
415
                'url'       :  action,
416
            }).done(function(response) {
417
                if(response['success']) {
418
 
419
                    $('#form-change-type').attr('action', action);
420
                    $('#form-change-type #usertype_id').val(response['data']['usertype_id']);
421
                    validatorChangeType.resetForm();
422
 
423
                    $('#modalChangeType').modal('show');
424
                } else {
425
                    $.fn.showError(response['data']);
426
                }
427
            }).fail(function( jqXHR, textStatus, errorThrown) {
428
                $.fn.showError(textStatus);
429
            }).always(function() {
430
                NProgress.done();
431
            });
432
 
433
        });
1 www 434
 
435
        $('body').on('click', 'button.btn-refresh', function(e) {
436
            e.preventDefault();
437
            gridTable.api().ajax.reload(null, false);
438
        });
439
 
16822 efrain 440
 $('body').on('click', 'button.btn-unblock', function(e) {
441
        e.preventDefault();
442
        var action = $(this).data('href');
1 www 443
 
15460 efrain 444
 
16822 efrain 445
          swal.fire({
446
            title: 'LABEL_ARE_YOU_SURE',
447
            icon: 'question',
448
            cancelButtonText: 'LABEL_NO',
449
            showCancelButton: true,
450
            confirmButtonText: 'LABEL_YES'
451
          }).then((result) => {
452
            if (result.isConfirmed) {
453
 
454
                    NProgress.start();
455
                    $.ajax({
456
                        'dataType'  : 'json',
457
                        'accept'    : 'application/json',
458
                        'method'    : 'post',
459
                        'url'       :  action,
460
                    }).done(function(response) {
461
                        if(response['success']) {
462
                            $.fn.showSuccess(response['data']);
463
                            gridTable.api().ajax.reload(null, false);
464
                        } else {
465
                            $.fn.showError(response['data']);
466
                        }
467
                    }).fail(function( jqXHR, textStatus, errorThrown) {
468
                        $.fn.showError(textStatus);
469
                    }).always(function() {
470
                        NProgress.done();
471
                    });
472
            }
473
       });
474
    });
475
 
16842 efrain 476
    $('body').on('click', 'button.btn-cancel', function(e) {
15460 efrain 477
        e.preventDefault();
478
        $('#modalFormUploadUsers').modal('hide');
479
        $('#modalChangePassword').modal('hide');
16842 efrain 480
        $('#modalUploadUsers').modal('hide');
481
        $('#modalChangeType').modal('hide');
15460 efrain 482
    });
483
 
1 www 484
 
485
        $('body').on('click', 'button.btn-view-profile', function(e) {
486
            e.preventDefault();
487
            var href = $(this).data('href');
488
            window.open(href, '_blank');
489
        });
490
 
16299 efrain 491
    var validatorUploadUsers = $('#form-upload-users').validate({
15460 efrain 492
        debug: true,
493
        onclick: false,
494
        onkeyup: false,
495
        onfocusout: false,
496
        ignore: [],
497
        rules: {
498
            'file' : {
499
                required: true,
500
                extension: 'xls|xlsx',
501
                accept: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel'
502
            },
503
        },
504
 
505
        submitHandler: function(form)
506
        {
507
            NProgress.start();
508
            var formdata = false;
509
            if (window.FormData){
510
                formdata = new FormData(form);
511
            }
512
            formdata.append('step','validation');
1 www 513
 
514
 
15460 efrain 515
            $.ajax({
516
                'dataType'  : 'json',
517
                'accept'    : 'application/json',
518
                'method'    : 'post',
519
                'url'       : '$routeUpload',
520
                'data'      :  formdata,
521
                'processData': false,
522
                'contentType': false,
523
            }).done(function(response) {
524
                if(response['success']) {
1 www 525
 
15460 efrain 526
                    $('#table-upload-users-key').val(response['data']['key']);
527
 
528
                    $('#gridTableUploadUsers 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>' + item['password'] + '</td>';
538
                        s = s + '<td>' + item['is_adult'] + '</td>';
539
                        s = s + '</tr>';
540
 
541
                        $('#gridTableUploadUsers tbody').append(s);
542
 
543
 
544
                    });
545
 
546
                    $('#modalFormUploadUsers').modal('hide');
547
                    $('#modalUploadUsers').modal('show');
548
 
549
 
550
 
551
                } else {
552
                    validatorUploadUsers.resetForm();
553
                    if(jQuery.type(response['data']) == 'string') {
554
                        $.fn.showError(response['data']);
555
                    } else  {
556
                        $.each(response['data'], function( fieldname, errors ) {
557
                            $.fn.showFormErrorValidator('#form-upload-users #' + fieldname, errors);
558
                        });
559
                    }
560
                }
561
            }).fail(function( jqXHR, textStatus, errorThrown) {
562
                $.fn.showError(textStatus);
563
            }).always(function() {
564
 
565
                NProgress.done();
566
            });
567
            return false;
568
        },
569
        invalidHandler: function(form, validator) {
570
 
571
        }
1 www 572
    });
15460 efrain 573
 
574
    $('#form-upload-users #file').fileinput({
575
        theme: 'fa',
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-upload-users #file').fileinput('reset');
587
        $('#form-upload-users #file').val('');
588
 
589
        $('#modalFormUploadUsers').modal('show');
590
    });
591
 
592
    $('body').on('click', 'button.btn-upload-users-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-users-key').val(),
604
            }
605
        }).done(function(response) {
606
            if(response['success']) {
607
                if(response['data']['users_created'] == 1) {
608
                    $.fn.showSuccess(response['data']['users_created'] + ' LABEL_USER_CREATED');
609
                } else {
610
                    $.fn.showSuccess(response['data']['users_created'] + ' LABEL_USERS_CREATED');
611
                }
612
                 gridTable.api().ajax.reload(null, false);
613
                $('#modalUploadUsers').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
 
16299 efrain 626
    $('#form-filter #network_id').change(function(e) {
627
        e.preventDefault();
15460 efrain 628
 
16299 efrain 629
        gridTable.api().ajax.reload(null, false);
15460 efrain 630
    });
16299 efrain 631
 
632
 
633
});
1 www 634
JS;
635
$this->inlineScript()->captureEnd();
636
?>
637
 
16815 stevensc 638
 
16840 efrain 639
<div class="container">
640
 	<div class="card">
641
 
642
 
643
 		<div class="card-body">
644
 			<h6 class="card-title">LABEL_USERS</h6>
645
 
646
        	<div class="row">
16841 efrain 647
         		<div class="col-12  mt-3">
16840 efrain 648
         			<?php
16299 efrain 649
                        $form = $this->formFilter;
16815 stevensc 650
                        $form->setAttributes([
16299 efrain 651
                            'method'    => 'post',
652
                            'name'      => 'form-filter',
653
                            'id'        => 'form-filter'
654
                        ]);
16815 stevensc 655
 
16299 efrain 656
                        $form->prepare();
657
                        echo $this->form()->openTag($form);
16815 stevensc 658
                        ?>
16840 efrain 659
           			<table class="table">
660
                    	<thead>
661
						</thead>
662
                        <tbody>
663
                        	<tr>
664
                            	<th>LABEL_PRIVATE_NETWORKS</th>
665
                                <td>
16815 stevensc 666
                                        <?php
667
                                        $element = $form->get('network_id');
668
                                        $element->setAttributes(['class' => 'form-control']);
669
                                        echo $this->formSelect($element);
670
                                        ?>
16840 efrain 671
                               	</td>
672
                            </tr>
673
                       	</tbody>
1 www 674
 
16840 efrain 675
                   	</table>
676
             		<?php echo $this->form()->closeTag($form); ?>
1 www 677
 
16840 efrain 678
             	</div>
679
			</div>
680
			<div class="row">
16841 efrain 681
         		<div class="col-12  mt-3">
16845 efrain 682
                        <table id="gridTable" class="table   table-bordered">
16815 stevensc 683
                            <thead>
684
                                <tr>
685
                                    <th>LABEL_FIRST_NAME</th>
686
                                    <th>LABEL_LAST_NAME</th>
687
                                    <th>LABEL_EMAIL</th>
688
                                    <th>LABEL_DETAILS</th>
689
                                    <th>LABEL_ACTIONS</th>
690
                                </tr>
691
                            </thead>
692
                            <tbody>
693
                            </tbody>
694
                        </table>
16840 efrain 695
            	</div>
696
            </div>
697
            <div class="card-footer  text-right">
698
     			<?php if ($allowUpload) : ?>
699
            	<button type="button" class="btn btn-sm btn-primary btn-upload"><i class="fa fa-upload"></i> LABEL_UPLOAD </button>
700
            	<?php endif; ?>
701
         		<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
16815 stevensc 702
            </div>
703
        </div>
704
    </div>
16840 efrain 705
</div>
16815 stevensc 706
 
707
 
1 www 708
<!-- The Modal -->
709
<div class="modal" id="modalChangePassword">
16815 stevensc 710
    <div class="modal-dialog">
711
        <div class="modal-content">
1 www 712
 
713
            <!-- Modal Header -->
16815 stevensc 714
            <div class="modal-header">
16845 efrain 715
                <h6 class="modal-title">LABEL_USERS</h6>
16822 efrain 716
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
16815 stevensc 717
            </div>
1 www 718
 
16840 efrain 719
 
1 www 720
            <!-- Modal body -->
16815 stevensc 721
                <?php
722
                $form = $this->formChangePassword;
723
                $form->setAttributes([
724
                    'method'    => 'post',
725
                    'name'      => 'form-change-password',
726
                    'id'        => 'form-change-password'
727
                ]);
1 www 728
 
16815 stevensc 729
                $form->prepare();
730
                echo $this->form()->openTag($form);
731
                ?>
16840 efrain 732
            <div class="modal-body">
733
 
734
      			<div class="row">
16841 efrain 735
                	<div class="col-12  mt-3">
16815 stevensc 736
                    <?php
737
                    $element = $form->get('first_name');
738
                    $element->setOptions(['label' => 'LABEL_FIRST_NAME']);
739
                    $element->setAttributes(['class' => 'form-control', 'readonly' => 'readonly']);
1 www 740
 
16815 stevensc 741
                    echo $this->formLabel($element);
742
                    echo $this->formText($element);
743
                    ?>
16840 efrain 744
                    </div>
16815 stevensc 745
                </div>
16840 efrain 746
				<div class="row">
16841 efrain 747
                	<div class="col-12  mt-3">
16815 stevensc 748
                    <?php
749
                    $element = $form->get('last_name');
750
                    $element->setOptions(['label' => 'LABEL_LAST_NAME']);
751
                    $element->setAttributes(['class' => 'form-control', 'readonly' => 'readonly']);
1 www 752
 
16815 stevensc 753
                    echo $this->formLabel($element);
754
                    echo $this->formText($element);
755
                    ?>
16840 efrain 756
                    </div>
16815 stevensc 757
                </div>
16840 efrain 758
				<div class="row">
16841 efrain 759
                	<div class="col-12  mt-3">
16815 stevensc 760
                    <?php
761
                    $element = $form->get('email');
762
                    $element->setOptions(['label' => 'LABEL_EMAIL']);
763
                    $element->setAttributes(['class' => 'form-control', 'readonly' => 'readonly']);
764
 
765
                    echo $this->formLabel($element);
766
                    echo $this->formText($element);
767
                    ?>
16840 efrain 768
                    </div>
16815 stevensc 769
                </div>
16840 efrain 770
				<div class="row">
16841 efrain 771
                	<div class="col-12  mt-3">
16815 stevensc 772
                    <?php
773
                    $element = $form->get('password');
774
                    $element->setOptions(['label' => 'LABEL_PASSWORD']);
775
                    $element->setAttributes(['class' => 'form-control']);
776
 
777
                    echo $this->formLabel($element);
778
                    echo $this->formPassword($element);
779
                    ?>
16840 efrain 780
                    </div>
16815 stevensc 781
                </div>
16840 efrain 782
                <div class="row">
16841 efrain 783
                	<div class="col-12  mt-3">
16815 stevensc 784
                    <?php
785
                    $element = $form->get('confirmation');
786
                    $element->setOptions(['label' => 'LABEL_CONFIRMATION']);
787
                    $element->setAttributes(['class' => 'form-control']);
788
 
789
                    echo $this->formLabel($element);
790
                    echo $this->formPassword($element);
791
                    ?>
16840 efrain 792
                    </div>
16815 stevensc 793
                </div>
794
 
16840 efrain 795
 
16815 stevensc 796
            </div>
797
 
1 www 798
            <!-- Modal footer -->
16840 efrain 799
            <div class="modal-footer text-right">
800
   				<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
16842 efrain 801
                <button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
16815 stevensc 802
            </div>
16840 efrain 803
            <?php echo $this->form()->closeTag($form); ?>
1 www 804
 
16815 stevensc 805
        </div>
806
    </div>
807
</div>
1 www 808
 
809
 
15460 efrain 810
<!-- The Modal -->
811
<div class="modal" id="modalFormUploadUsers">
812
    <div class="modal-dialog  modal-xl">
813
        <div class="modal-content">
1 www 814
 
15460 efrain 815
            <!-- Modal Header -->
816
            <div class="modal-header">
817
                <h3 class="modal-title">LABEL_UPLOAD</h3>
818
            </div>
16840 efrain 819
                          <?php
15460 efrain 820
                $form = $this->formUploadUsers;
821
                $form->setAttributes([
822
                    'method'    => 'post',
823
                    'name'      => 'form-upload-users',
824
                    'id'        => 'form-upload-users'
825
                ]);
826
 
827
                $form->prepare();
828
                echo $this->form()->openTag($form);
829
                ?>
830
 
16840 efrain 831
            <!-- Modal body -->
832
            <div class="modal-body">
833
 
15460 efrain 834
 
16840 efrain 835
                <div class="row">
16841 efrain 836
                	<div class="col-12  mt-3">
15460 efrain 837
 
16840 efrain 838
 
15460 efrain 839
                    <?php
840
                    $element = $form->get('file');
841
                    $element->setOptions(['label' => 'LABEL_EXCEL']);
842
                    echo $this->formLabel($element);
843
                    ?>
844
                    <div class="file-loading">
845
                        <?php
16768 efrain 846
                        $element->setAttributes(['class' => 'form-control', 'accept' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel']);
15460 efrain 847
                        echo $this->formFile($element);
848
                        ?>
849
                    </div>
16840 efrain 850
                    </div>
15460 efrain 851
                </div>
852
 
853
 
854
 
16840 efrain 855
 
856
            </div>
16891 efrain 857
			<div class="modal-footer text-right">
15460 efrain 858
                    <button type="submit" class="btn btn-sm btn-primary">LABEL_UPLOAD</button>
16842 efrain 859
                    <button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
15460 efrain 860
                </div>
861
                <?php echo $this->form()->closeTag($form); ?>
862
        </div>
863
    </div>
864
</div>
865
 
866
 
867
<!-- The Modal -->
868
<div class="modal" id="modalUploadUsers">
869
    <div class="modal-dialog modal-xl">
870
        <div class="modal-content">
871
 
872
            <!-- Modal Header -->
873
            <div class="modal-header">
874
                <h3 class="modal-title">LABEL_USERS</h3>
16822 efrain 875
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
15460 efrain 876
            </div>
877
 
878
            <!-- Modal body -->
879
            <div class="modal-body">
880
                <form>
881
                    <input type="hidden" name="table-upload-users-key" id="table-upload-users-key">
882
                </form>
16840 efrain 883
                <div class="row">
16841 efrain 884
                    <div class="col-12  mt-3" style="height: 300px;overflow: scroll;">
16840 efrain 885
                        <table id="gridTableUploadUsers" style="width: 100%" class="table table-bordered">
886
                            <thead>
887
                                <tr>
888
                                    <th>LABEL_FIRST_NAME</th>
889
                                    <th>LABEL_LAST_NAME</th>
890
                                    <th>LABEL_EMAIL</th>
891
                                    <th>LABEL_PASSWORD</th>
892
                                    <th>LABEL_IS_ADULT</th>
893
                                </tr>
894
                            </thead>
895
                            <tbody>
896
                            </tbody>
897
                        </table>
898
                    </div>
15460 efrain 899
                </div>
900
 
901
            </div>
902
 
903
            <!-- Modal footer -->
16840 efrain 904
            <div class="modal-footer text-right">
15460 efrain 905
                <button type="submit" class="btn btn-sm btn-primary btn-upload-users-step2">LABEL_SAVE</button>
16842 efrain 906
                <button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
15460 efrain 907
            </div>
908
 
909
        </div>
910
    </div>
911
</div>
912
 
913
 
16248 efrain 914
 
915
<!-- The Modal -->
916
<div class="modal" id="modalChangeType">
16815 stevensc 917
    <div class="modal-dialog">
918
        <div class="modal-content">
16248 efrain 919
 
920
            <!-- Modal Header -->
16815 stevensc 921
            <div class="modal-header">
16845 efrain 922
                <h6 class="modal-title">LABEL_USERS</h6>
16822 efrain 923
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
16815 stevensc 924
            </div>
16248 efrain 925
 
16840 efrain 926
       <?php
16815 stevensc 927
                $form = $this->formChangeType;
928
                $form->setAttributes([
929
                    'method'    => 'post',
930
                    'name'      => 'form-change-type',
931
                    'id'        => 'form-change-type'
932
                ]);
16248 efrain 933
 
16815 stevensc 934
                $form->prepare();
935
                echo $this->form()->openTag($form);
936
                ?>
16840 efrain 937
            <!-- Modal body -->
938
            <div class="modal-body">
939
 
940
                <div class="row">
16841 efrain 941
                	<div class="col-12  mt-3">
16815 stevensc 942
                    <?php
943
                    $element = $form->get('usertype_id');
944
                    $element->setOptions(['label' => 'LABEL_USER_TYPE']);
945
                    $element->setAttributes(['class' => 'form-control', 'readonly' => 'readonly']);
946
 
947
                    echo $this->formLabel($element);
948
                    echo $this->formSelect($element);
949
                    ?>
16840 efrain 950
                    </div>
16815 stevensc 951
                </div>
16840 efrain 952
 
953
 
16815 stevensc 954
            </div>
955
 
16248 efrain 956
            <!-- Modal footer -->
16891 efrain 957
            <div class="modal-footer text-right">
16840 efrain 958
					<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
959
                    <button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
16815 stevensc 960
            </div>
16840 efrain 961
            <?php echo $this->form()->closeTag($form); ?>
16248 efrain 962
 
16815 stevensc 963
        </div>
964
    </div>
965
</div>