Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 17008 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 17008 Rev 17019
Línea 3... Línea 3...
3
$currentUser    = $this->currentUserHelper();
3
$currentUser    = $this->currentUserHelper();
Línea 4... Línea 4...
4
 
4
 
Línea 5... Línea 5...
5
$roleName = $currentUser->getUserTypeId();
5
$roleName = $currentUser->getUserTypeId();
-
 
6
 
6
 
7
 
Línea 7... Línea 8...
7
 
8
$routeAdd       = $this->url('habits/users/add');
8
$routeAdd   = $this->url('habits/users/add');
9
$routeUpload    = $this->url('habits/users/upload');
9
$routeDatatable = $this->url('habits/users');
-
 
10
 
-
 
11
$allowAdd               = $acl->isAllowed($roleName, 'habits/users/add') ? 1 : 0;
-
 
12
$allowDelete            = $acl->isAllowed($roleName, 'habits/users/delete') ? 1 : 0;
10
$routeDatatable = $this->url('habits/users');
Línea 13... Línea 11...
13
 
11
 
14
 
12
$allowAdd       = $acl->isAllowed($roleName, 'habits/users/add') ? 1 : 0;
Línea 32... Línea 30...
32
 
30
 
33
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
31
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
Línea -... Línea 32...
-
 
32
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
-
 
33
 
-
 
34
 
-
 
35
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-fileinput/css/fileinput.min.css'));
-
 
36
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fas/theme.css'));
-
 
37
 
-
 
38
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/piexif.js'));
-
 
39
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/sortable.js'));
-
 
40
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/fileinput.js'));
-
 
41
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/locales/es.js'));
-
 
42
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/fas/theme.js'));
-
 
43
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fas/theme.js'));
-
 
44
 
Línea 34... Línea 45...
34
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
45
 
35
 
46
 
36
 
47
 
Línea 37... Línea 48...
37
 
48
 
Línea -... Línea 49...
-
 
49
 
-
 
50
$this->inlineScript()->appendFile($this->basePath('assets/vendors/select2/js/select2.js'));
-
 
51
$this->inlineScript()->appendFile($this->basePath('assets/vendors/select2/js/i18n/es.js'));
Línea -... Línea 52...
-
 
52
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/select2/css/select2.css'));
-
 
53
 
-
 
54
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/select2-bootstrap5-theme/select2-bootstrap-5-theme.css'));
-
 
55
 
-
 
56
$this->headStyle()->captureStart();
-
 
57
echo <<<CSS
-
 
58
 
-
 
59
 
-
 
60
#gridTableUsers {
-
 
61
    display: flex;
-
 
62
    flex-flow: column;
-
 
63
    width: 100%;
-
 
64
}
-
 
65
 
-
 
66
#gridTableUsers thead {
-
 
67
    flex: 0 0 auto;
-
 
68
}
-
 
69
 
-
 
70
#gridTableUsers tbody {
-
 
71
    flex: 1 1 auto;
-
 
72
    display: block;
-
 
73
    overflow-y: auto;
-
 
74
    overflow-x: hidden;
-
 
75
}
-
 
76
 
-
 
77
#gridTableUsers tr {
-
 
78
    width: 100%;
-
 
79
    display: table;
-
 
80
    table-layout: fixed;
-
 
81
}
-
 
82
.imagen-contaner{
-
 
83
	border:1px solid rgb(200,200,200);
Línea 38... Línea 84...
38
 
84
	border-radius:5px;
39
$this->inlineScript()->appendFile($this->basePath('assets/vendors/select2/js/select2.js'));
85
	padding:10px;
40
$this->inlineScript()->appendFile($this->basePath('assets/vendors/select2/js/i18n/es.js'));
86
	display:flex;
Línea 238... Línea 284...
238
        });
284
        });
Línea 239... Línea 285...
239
 
285
 
240
        
286
        
241
        
287
        
-
 
288
 
242
 
289
    $('body').on('click', 'button.btn-cancel', function(e) {
-
 
290
            e.preventDefault();
-
 
291
            $('#modal').modal('hide');
Línea 243... Línea 292...
243
        $('body').on('click', 'button.btn-cancel', function(e) {
292
        $('#modalFormUploadUsers').modal('hide');
244
            e.preventDefault();
293
    });
245
            $('#modal').modal('hide');
294
 
Línea 289... Línea 338...
289
            width: '100%',
338
            width: '100%',
290
            dropdownParent: $('#modal'),
339
            dropdownParent: $('#modal'),
291
        });
340
        });
Línea -... Línea 341...
-
 
341
 
-
 
342
 
-
 
343
var validatorUploadUsers = $('#form-upload-users').validate({
-
 
344
        debug: true,
-
 
345
        onclick: false,
-
 
346
        onkeyup: false,
-
 
347
        onfocusout: false,
-
 
348
        ignore: [],
-
 
349
        rules: {
-
 
350
            'file' : {
-
 
351
                required: true,
-
 
352
                extension: 'xls|xlsx',
-
 
353
                accept: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel'
-
 
354
            },       
-
 
355
        },
-
 
356
        
-
 
357
        submitHandler: function(form)
-
 
358
        {
-
 
359
            NProgress.start();
-
 
360
            var formdata = false;
-
 
361
            if (window.FormData){
-
 
362
                formdata = new FormData(form);
-
 
363
            }
-
 
364
            formdata.append('step','validation');
-
 
365
 
-
 
366
 
-
 
367
            $.ajax({
-
 
368
                'dataType'  : 'json',
-
 
369
                'accept'    : 'application/json',
-
 
370
                'method'    : 'post',
-
 
371
                'url'       : '$routeUpload',
-
 
372
                'data'      :  formdata,
-
 
373
                'processData': false,
-
 
374
                'contentType': false,
-
 
375
            }).done(function(response) {
-
 
376
                if(response['success']) {
-
 
377
 
-
 
378
                    $('#table-upload-users-key').val(response['data']['key']);
-
 
379
    
-
 
380
                    $('#gridTableUploadUsers tbody').empty();
-
 
381
                    
-
 
382
                    $.each(response['data']['items'], function(index, item) {
-
 
383
    
-
 
384
    
-
 
385
                        var s = '<tr>';
-
 
386
                        s = s + '<td>' + item['first_name'] + '</td>';
-
 
387
                        s = s + '<td>' + item['last_name'] + '</td>';
-
 
388
                        s = s + '<td>' + item['email'] + '</td>';
-
 
389
                        s = s + '<td>' + item['password'] + '</td>';
-
 
390
                        s = s + '<td>' + item['is_adult'] + '</td>';
-
 
391
                        s = s + '</tr>';
-
 
392
    
-
 
393
                        $('#gridTableUploadUsers tbody').append(s);
-
 
394
                
-
 
395
    
-
 
396
                    });    
-
 
397
    
-
 
398
                    $('#modalFormUploadUsers').modal('hide');
-
 
399
                    $('#modalUploadUsers').modal('show');
-
 
400
 
-
 
401
 
-
 
402
                    
-
 
403
                } else {
-
 
404
                    validatorUploadUsers.resetForm();
-
 
405
                    if(jQuery.type(response['data']) == 'string') {
-
 
406
                        $.fn.showError(response['data']);
-
 
407
                    } else  {
-
 
408
                        $.each(response['data'], function( fieldname, errors ) {
-
 
409
                            $.fn.showFormErrorValidator('#form-upload-users #' + fieldname, errors);
-
 
410
                        });
-
 
411
                    }
-
 
412
                }
-
 
413
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
414
                $.fn.showError(textStatus);
-
 
415
            }).always(function() {
-
 
416
               
-
 
417
                NProgress.done();
-
 
418
            });
-
 
419
            return false;
-
 
420
        },
-
 
421
        invalidHandler: function(form, validator) {
-
 
422
        
-
 
423
        }
-
 
424
    });
-
 
425
 
-
 
426
 
-
 
427
    $('#form-upload-users #file').fileinput({
-
 
428
        theme: 'fa',
-
 
429
        language: 'es',
-
 
430
        showUpload: false,
-
 
431
        dropZoneEnabled: false,
-
 
432
        maxFileCount: 1,
-
 
433
        allowedFileExtensions: ['xls', 'xlsx'],
-
 
434
    });
-
 
435
 
-
 
436
    $('body').on('click', 'button.btn-upload', function(e) {
-
 
437
        e.preventDefault();
-
 
438
 
-
 
439
        $('#form-upload-users #file').fileinput('reset');
-
 
440
        $('#form-upload-users #file').val('');
-
 
441
 
-
 
442
        $('#modalFormUploadUsers').modal('show');
-
 
443
    });
-
 
444
 
-
 
445
    $('body').on('click', 'button.btn-upload-users-step2', function(e) {
-
 
446
        e.preventDefault();
-
 
447
        NProgress.start();
-
 
448
 
-
 
449
        $.ajax({
-
 
450
            'dataType'  : 'json',
-
 
451
            'accept'    : 'application/json',
-
 
452
            'method'    : 'post',
-
 
453
            'url'       : '$routeUpload',
-
 
454
            'data'      :  {
-
 
455
                'step' : 'process',
-
 
456
                'key' : $('#table-upload-users-key').val(),   
-
 
457
            }
-
 
458
        }).done(function(response) {
-
 
459
            if(response['success']) {
-
 
460
                if(response['data']['users_created'] == 1) {
-
 
461
                    $.fn.showSuccess(response['data']['users_created'] + ' LABEL_USER_CREATED');
-
 
462
                } else {
-
 
463
                    $.fn.showSuccess(response['data']['users_created'] + ' LABEL_USERS_CREATED');
-
 
464
                }    
-
 
465
                 gridTable.api().ajax.reload(null, false);
-
 
466
                $('#modalUploadUsers').modal('hide');
-
 
467
            } else {
-
 
468
                $.fn.showError(response['data']);
-
 
469
            }
-
 
470
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
471
            $.fn.showError(textStatus);
-
 
472
        }).always(function() {
-
 
473
            NProgress.done();
-
 
474
        });
Línea 292... Línea 475...
292
 
475
        return false;
293
 
476
    });
294
 
477
 
295
    });
478
    });
Línea 324... Línea 507...
324
       	</div>
507
       	</div>
325
      	 <div class="card-footer text-right">
508
      	 <div class="card-footer text-right">
326
         	 <?php if ($allowAdd) : ?>
509
         	 <?php if ($allowAdd) : ?>
327
       		<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
510
       		<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
328
          	<?php endif; ?>
511
          	<?php endif; ?>
-
 
512
          	 <?php if ($allowUpload) : ?>
-
 
513
       		<button type="button" class="btn btn-primary btn-upload"><i class="fa fa-upload"></i> LABEL_UPLOAD </button>
-
 
514
          	<?php endif; ?>
329
           	<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-sync"></i> LABEL_REFRESH </button>
515
           	<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-sync"></i> LABEL_REFRESH </button>
330
     	</div>
516
     	</div>
331
	</div>
517
	</div>
332
</div>
518
</div>
Línea 333... Línea 519...
333
 
519
 
334
 
520
 
335
 
521
 
336
<!-- The Modal -->
522
<!-- The Modal -->
Línea 337... Línea 523...
337
<div class="modal" id="modal">
523
<div class="modal" id="modal">
338
    <div class="modal-dialog  modal-sm">
524
    <div class="modal-dialog  modal-lx">
339
        <div class="modal-content">
525
        <div class="modal-content">
340
 
526
 
341
            <!-- Modal Header -->
527
            <!-- Modal Header -->
Línea 342... Línea 528...
342
            <div class="modal-header">
528
            <div class="modal-header">
343
                <h6 class="modal-title">LABEL_KNOWLEDGE_AREA_CATEGORY_USERS</h6>
529
                <h6 class="modal-title">LABEL_USER</h6>
Línea 387... Línea 573...
387
            <?php echo $this->form()->closeTag($form); ?>
573
            <?php echo $this->form()->closeTag($form); ?>
388
        </div>
574
        </div>
Línea 389... Línea 575...
389
 
575
 
-
 
576
 
-
 
577
    </div>
-
 
578
</div>
-
 
579
 
-
 
580
 
-
 
581
<div class="modal" id="modalFormUploadUsers">
-
 
582
    <div class="modal-dialog  modal-xl">
-
 
583
        <div class="modal-content">
-
 
584
 
-
 
585
            <!-- Modal Header -->
-
 
586
            <div class="modal-header">
-
 
587
                <h6 class="modal-title">LABEL_UPLOAD</h6>
-
 
588
            </div>
-
 
589
 
-
 
590
			 <?php
-
 
591
                $form = $this->formUploadUsers;
-
 
592
                $form->setAttributes([
-
 
593
                    'method'    => 'post',
-
 
594
                    'name'      => 'form-upload-users',
-
 
595
                    'id'        => 'form-upload-users'
-
 
596
                ]);
-
 
597
 
-
 
598
                $form->prepare();
-
 
599
                echo $this->form()->openTag($form);
-
 
600
                ?>
-
 
601
            <!-- Modal body -->
-
 
602
            <div class="modal-body">
-
 
603
              
-
 
604
 
-
 
605
                <div class="row">
-
 
606
                	<div class="col-12  mt-3">
-
 
607
 
-
 
608
 
-
 
609
                    <?php
-
 
610
                    $element = $form->get('file');
-
 
611
                    $element->setOptions(['label' => 'LABEL_EXCEL']);
-
 
612
                    echo $this->formLabel($element);
-
 
613
                    ?>
-
 
614
                    <div class="file-loading">
-
 
615
                        <?php
-
 
616
 
-
 
617
                        $element->setAttributes(['class' => 'form-control', 'accept' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel']);
-
 
618
                        echo $this->formFile($element);
-
 
619
                        ?>
-
 
620
                        </div>
-
 
621
                    </div>
-
 
622
                </div>
-
 
623
 
-
 
624
 
-
 
625
 
-
 
626
      
-
 
627
            </div>
-
 
628
          	<div class="modal-footer text-right">
-
 
629
                    <button type="submit" class="btn btn-sm btn-primary">LABEL_UPLOAD</button>
-
 
630
                    <button type="button" class="btn btn-sm btn-light btn-cancel">LABEL_CANCEL</button>
-
 
631
      		</div>
-
 
632
        	<?php echo $this->form()->closeTag($form); ?>
-
 
633
        </div>
-
 
634
    </div>
-
 
635
</div>
-
 
636
 
-
 
637
 
-
 
638
 
-
 
639
<!-- The Modal -->
-
 
640
<div class="modal" id="modalUploadUsers">
-
 
641
    <div class="modal-dialog modal-xl">
-
 
642
        <div class="modal-content">
-
 
643
 
-
 
644
            <!-- Modal Header -->
-
 
645
            <div class="modal-header">
-
 
646
                <h6 class="modal-title">LABEL_USERS_FOR_COMPANY</h6>
-
 
647
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
-
 
648
            </div>
-
 
649
 
-
 
650
            <!-- Modal body -->
-
 
651
            <div class="modal-body">
-
 
652
                <form>
-
 
653
                    <input type="hidden" name="table-upload-users-key" id="table-upload-users-key">
-
 
654
                </form>
-
 
655
                <div class="row">
-
 
656
                	<div class="col-12  mt-3" style="height: 300px;overflow: scroll;">
-
 
657
                    	<table id="gridTableUploadUsers" style="width: 100%" class="table table-bordered">
-
 
658
                            <thead>
-
 
659
                                <tr>
-
 
660
                                    <th>LABEL_FIRST_NAME</th>
-
 
661
                                    <th>LABEL_LAST_NAME</th>
-
 
662
                                    <th>LABEL_EMAIL</th>
-
 
663
                                    <th>LABEL_PASSWORD</th>
-
 
664
                                    <th>LABEL_IS_ADULT</th>
-
 
665
                                </tr>
-
 
666
                            </thead>
-
 
667
                            <tbody>
-
 
668
                            </tbody>
-
 
669
                        </table>
-
 
670
                    
-
 
671
                	</div>
-
 
672
                </div>
-
 
673
 
-
 
674
 
-
 
675
            </div>
-
 
676
 
-
 
677
            <!-- Modal footer -->
-
 
678
            <div class="modal-footer text-right">
-
 
679
                <button type="submit" class="btn btn-sm btn-primary btn-upload-users-step2">LABEL_SAVE</button>
-
 
680
                <button type="button" class="btn btn-sm btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
-
 
681
            </div>
-
 
682
 
390
 
683
        </div>
391
    </div>
684
    </div>