Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15222 | Rev 16248 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 15222 Rev 15460
Línea 6... Línea 6...
6
 
6
 
7
 
7
 
8
//$routeAdd       = $this->url('users/add');
8
//$routeAdd       = $this->url('users/add');
-
 
9
$routeDatatable = $this->url('users');
Línea 9... Línea 10...
9
$routeDatatable = $this->url('users');
10
$routeDashboard = $this->url('dashboard');
10
$routeDashboard = $this->url('dashboard');
11
$routeUpload    = $this->url('users/upload');
-
 
12
 
Línea 11... Línea 13...
11
 
13
 
12
 
14
$allowChangePassword    = $acl->isAllowed($roleName, 'users/change-password') ? 1 : 0;
Línea 13... Línea 15...
13
$allowChangePassword    = $acl->isAllowed($roleName, 'users/change-password') ? 1 : 0;
15
$allowUnblock           = $acl->isAllowed($roleName, 'users/unblock') ? 1 : 0;
Línea 36... Línea 38...
36
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
38
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
Línea 37... Línea 39...
37
 
39
 
38
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
40
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
Línea -... Línea 41...
-
 
41
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
-
 
42
 
-
 
43
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/css/fileinput.min.css'));
-
 
44
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fa/theme.css'));
-
 
45
 
-
 
46
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/piexif.js'));
-
 
47
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/sortable.js'));
-
 
48
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/fileinput.js'));
-
 
49
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/locales/es.js'));
-
 
50
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/fa/theme.js'));
Línea 39... Línea 51...
39
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
51
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fa/theme.js'));
Línea 40... Línea 52...
40
 
52
 
Línea 114... Línea 126...
114
        };
126
        };
Línea 115... Línea 127...
115
 
127
 
116
        var allowChangePassword = $allowChangePassword;
128
        var allowChangePassword = $allowChangePassword;
Línea 117... Línea -...
117
        var allowUnblock = $allowUnblock;
-
 
118
 
-
 
Línea 119... Línea 129...
119
 
129
        var allowUnblock = $allowUnblock;
120
 
130
 
121
        
131
        
122
        var gridTable = $('#gridTable').dataTable( {
132
        var gridTable = $('#gridTable').dataTable( {
Línea 359... Línea 369...
359
            e.preventDefault();
369
            e.preventDefault();
360
            gridTable.api().ajax.reload(null, false);
370
            gridTable.api().ajax.reload(null, false);
361
        });
371
        });
Línea -... Línea 372...
-
 
372
        
-
 
373
 
-
 
374
 
-
 
375
    $('body').on('click', 'button.btn-cancel-modal', function(e) {
-
 
376
        e.preventDefault();
-
 
377
        $('#modalFormUploadUsers').modal('hide');
-
 
378
        $('#modalChangePassword').modal('hide');
362
        
379
    });
363
 
380
 
364
        $('body').on('click', 'button.btn-cancel', function(e) {
381
        $('body').on('click', 'button.btn-cancel', function(e) {
365
            e.preventDefault();
382
            e.preventDefault();
Línea 370... Línea 387...
370
            e.preventDefault();
387
            e.preventDefault();
371
            var href = $(this).data('href');
388
            var href = $(this).data('href');
372
            window.open(href, '_blank');
389
            window.open(href, '_blank');
373
        });
390
        });
Línea -... Línea 391...
-
 
391
 
-
 
392
var validatorUploadUsers = $('#form-upload-users').validate({
-
 
393
        debug: true,
-
 
394
        onclick: false,
-
 
395
        onkeyup: false,
-
 
396
        onfocusout: false,
-
 
397
        ignore: [],
-
 
398
        rules: {
-
 
399
            'file' : {
-
 
400
                required: true,
-
 
401
                extension: 'xls|xlsx',
-
 
402
                accept: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel'
-
 
403
            },       
-
 
404
        },
-
 
405
        
-
 
406
        submitHandler: function(form)
-
 
407
        {
-
 
408
            NProgress.start();
-
 
409
            var formdata = false;
-
 
410
            if (window.FormData){
-
 
411
                formdata = new FormData(form);
-
 
412
            }
-
 
413
            formdata.append('step','validation');
-
 
414
 
-
 
415
 
-
 
416
            $.ajax({
-
 
417
                'dataType'  : 'json',
-
 
418
                'accept'    : 'application/json',
-
 
419
                'method'    : 'post',
-
 
420
                'url'       : '$routeUpload',
-
 
421
                'data'      :  formdata,
-
 
422
                'processData': false,
-
 
423
                'contentType': false,
-
 
424
            }).done(function(response) {
-
 
425
                if(response['success']) {
-
 
426
 
-
 
427
                    $('#table-upload-users-key').val(response['data']['key']);
-
 
428
    
-
 
429
                    $('#gridTableUploadUsers tbody').empty();
-
 
430
                    
-
 
431
                    $.each(response['data']['items'], function(index, item) {
-
 
432
    
-
 
433
    
-
 
434
                        var s = '<tr>';
-
 
435
                        s = s + '<td>' + item['first_name'] + '</td>';
-
 
436
                        s = s + '<td>' + item['last_name'] + '</td>';
-
 
437
                        s = s + '<td>' + item['email'] + '</td>';
-
 
438
                        s = s + '<td>' + item['password'] + '</td>';
-
 
439
                        s = s + '<td>' + item['is_adult'] + '</td>';
-
 
440
                        s = s + '</tr>';
-
 
441
    
-
 
442
                        $('#gridTableUploadUsers tbody').append(s);
-
 
443
                
-
 
444
    
-
 
445
                    });    
-
 
446
    
-
 
447
                    $('#modalFormUploadUsers').modal('hide');
-
 
448
                    $('#modalUploadUsers').modal('show');
-
 
449
 
-
 
450
 
-
 
451
                    
-
 
452
                } else {
-
 
453
                    validatorUploadUsers.resetForm();
-
 
454
                    if(jQuery.type(response['data']) == 'string') {
-
 
455
                        $.fn.showError(response['data']);
-
 
456
                    } else  {
-
 
457
                        $.each(response['data'], function( fieldname, errors ) {
-
 
458
                            $.fn.showFormErrorValidator('#form-upload-users #' + fieldname, errors);
-
 
459
                        });
-
 
460
                    }
-
 
461
                }
-
 
462
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
463
                $.fn.showError(textStatus);
-
 
464
            }).always(function() {
-
 
465
               
-
 
466
                NProgress.done();
-
 
467
            });
-
 
468
            return false;
-
 
469
        },
-
 
470
        invalidHandler: function(form, validator) {
-
 
471
        
-
 
472
        }
-
 
473
    });
-
 
474
 
-
 
475
    $('#form-upload-users #file').fileinput({
-
 
476
        theme: 'fa',
-
 
477
        language: 'es',
-
 
478
        showUpload: false,
-
 
479
        dropZoneEnabled: false,
-
 
480
        maxFileCount: 1,
-
 
481
        allowedFileExtensions: ['xls', 'xlsx'],
-
 
482
    });
-
 
483
 
-
 
484
    $('body').on('click', 'button.btn-upload', function(e) {
-
 
485
        e.preventDefault();
-
 
486
 
-
 
487
        $('#form-upload-users #file').fileinput('reset');
-
 
488
        $('#form-upload-users #file').val('');
-
 
489
 
-
 
490
        $('#modalFormUploadUsers').modal('show');
-
 
491
    });
-
 
492
 
-
 
493
    $('body').on('click', 'button.btn-upload-users-step2', function(e) {
-
 
494
        e.preventDefault();
-
 
495
        NProgress.start();
-
 
496
 
-
 
497
        $.ajax({
-
 
498
            'dataType'  : 'json',
-
 
499
            'accept'    : 'application/json',
-
 
500
            'method'    : 'post',
-
 
501
            'url'       : '$routeUpload',
-
 
502
            'data'      :  {
-
 
503
                'step' : 'process',
-
 
504
                'key' : $('#table-upload-users-key').val(),   
-
 
505
            }
-
 
506
        }).done(function(response) {
-
 
507
            if(response['success']) {
-
 
508
                if(response['data']['users_created'] == 1) {
-
 
509
                    $.fn.showSuccess(response['data']['users_created'] + ' LABEL_USER_CREATED');
-
 
510
                } else {
-
 
511
                    $.fn.showSuccess(response['data']['users_created'] + ' LABEL_USERS_CREATED');
-
 
512
                }    
-
 
513
                 gridTable.api().ajax.reload(null, false);
-
 
514
                $('#modalUploadUsers').modal('hide');
-
 
515
            } else {
-
 
516
                $.fn.showError(response['data']);
-
 
517
            }
-
 
518
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
519
            $.fn.showError(textStatus);
-
 
520
        }).always(function() {
-
 
521
            NProgress.done();
-
 
522
        });
-
 
523
        return false;
Línea 374... Línea 524...
374
 
524
    });
375
 
525
 
Línea 400... Línea 550...
400
 
550
 
401
<section class="content">
551
<section class="content">
402
	<div class="container-fluid">
552
	<div class="container-fluid">
403
    	<div class="row">
553
    	<div class="row">
404
        	<div class="col-12">
554
        	<div class="col-12">
-
 
555
				<div class="card">     
405
				<div class="card">                    
556
 
406
					<div class="card-body">
557
					<div class="card-body">
407
        	    		<table id="gridTable" class="table   table-hover">
558
        	    		<table id="gridTable" class="table   table-hover">
408
                      		<thead>
559
                      		<thead>
409
        						<tr>
560
        						<tr>
Línea 418... Línea 569...
418
                         	</tbody>
569
                         	</tbody>
419
                    	</table>
570
                    	</table>
420
                   	</div>
571
                   	</div>
421
                   	<div class="card-footer clearfix">
572
                   	<div class="card-footer clearfix">
422
                   		<div style="float:right;">
573
                   		<div style="float:right;">
-
 
574
                   			 <?php if ($allowUpload) : ?>
-
 
575
           						<button type="button" class="btn btn-sm btn-primary btn-upload"><i class="fa fa-upload"></i> LABEL_UPLOAD </button>
-
 
576
                             <?php endif; ?>
423
							<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
577
							<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
424
						</div>
578
						</div>
425
                 	</div>
579
                 	</div>
426
          		</div>
580
          		</div>
427
           	</div>     
581
           	</div>     
Línea 521... Línea 675...
521
    	</div>
675
    	</div>
522
	</div>
676
	</div>
523
</div> 			
677
</div> 			
Línea -... Línea 678...
-
 
678
 
-
 
679
 
-
 
680
<!-- The Modal -->
-
 
681
<div class="modal" id="modalFormUploadUsers">
-
 
682
    <div class="modal-dialog  modal-xl">
-
 
683
        <div class="modal-content">
-
 
684
 
-
 
685
            <!-- Modal Header -->
-
 
686
            <div class="modal-header">
-
 
687
                <h3 class="modal-title">LABEL_UPLOAD</h3>
-
 
688
            </div>
-
 
689
 
-
 
690
            <!-- Modal body -->
-
 
691
            <div class="modal-body">
-
 
692
                <?php
-
 
693
                $form = $this->formUploadUsers;
-
 
694
                $form->setAttributes([
-
 
695
                    'method'    => 'post',
-
 
696
                    'name'      => 'form-upload-users',
-
 
697
                    'id'        => 'form-upload-users'
-
 
698
                ]);
-
 
699
 
-
 
700
                $form->prepare();
-
 
701
                echo $this->form()->openTag($form);
-
 
702
                ?>
-
 
703
 
-
 
704
                <div class="form-group">
-
 
705
 
-
 
706
 
-
 
707
                    <?php
-
 
708
                    $element = $form->get('file');
-
 
709
                    $element->setOptions(['label' => 'LABEL_EXCEL']);
-
 
710
                    echo $this->formLabel($element);
-
 
711
                    ?>
-
 
712
                    <div class="file-loading">
-
 
713
                        <?php
-
 
714
                        $element->setAttributes(['class' => 'form-control', 'accept' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.ms-excel']);
-
 
715
                        echo $this->formFile($element);
-
 
716
                        ?>
-
 
717
                    </div>
-
 
718
                </div>
-
 
719
 
-
 
720
 
-
 
721
 
-
 
722
                <div class="form-group">
-
 
723
                    <button type="submit" class="btn btn-sm btn-primary">LABEL_UPLOAD</button>
-
 
724
                    <button type="button" class="btn btn-sm btn-light btn-cancel-modal">LABEL_CANCEL</button>
-
 
725
                </div>
-
 
726
                <?php echo $this->form()->closeTag($form); ?>
-
 
727
            </div>
-
 
728
 
-
 
729
        </div>
-
 
730
    </div>
-
 
731
</div>
-
 
732
 
-
 
733
 
-
 
734
<!-- The Modal -->
-
 
735
<div class="modal" id="modalUploadUsers">
-
 
736
    <div class="modal-dialog modal-xl">
-
 
737
        <div class="modal-content">
-
 
738
 
-
 
739
            <!-- Modal Header -->
-
 
740
            <div class="modal-header">
-
 
741
                <h3 class="modal-title">LABEL_USERS</h3>
-
 
742
                <button type="button" class="close" data-dismiss="modal">&times;</button>
-
 
743
            </div>
-
 
744
 
-
 
745
            <!-- Modal body -->
-
 
746
            <div class="modal-body">
-
 
747
                <form>
-
 
748
                    <input type="hidden" name="table-upload-users-key" id="table-upload-users-key">
-
 
749
                </form>
-
 
750
                <div style="height: 300px;overflow: scroll;">
-
 
751
                    <table id="gridTableUploadUsers" style="width: 100%" class="table table-bordered table-hover">
-
 
752
                        <thead>
-
 
753
                            <tr>
-
 
754
                                <th>LABEL_FIRST_NAME</th>
-
 
755
                                <th>LABEL_LAST_NAME</th>
-
 
756
                                <th>LABEL_EMAIL</th>
-
 
757
                                <th>LABEL_PASSWORD</th>
-
 
758
                                <th>LABEL_IS_ADULT</th>
-
 
759
                            </tr>
-
 
760
                        </thead>
-
 
761
                        <tbody>
-
 
762
                        </tbody>
-
 
763
                    </table>
-
 
764
                </div>
-
 
765
 
-
 
766
            </div>
-
 
767
 
-
 
768
            <!-- Modal footer -->
-
 
769
            <div class="modal-footer">
-
 
770
                <button type="submit" class="btn btn-sm btn-primary btn-upload-users-step2">LABEL_SAVE</button>
-
 
771
                <button type="button" class="btn btn-sm btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
-
 
772
            </div>
-
 
773
 
-
 
774
        </div>
-
 
775
    </div>