Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 15539 Rev 15546
Línea 5... Línea 5...
5
$roleName = $currentUser->getUserTypeId();
5
$roleName = $currentUser->getUserTypeId();
Línea 6... Línea 6...
6
 
6
 
7
 
7
 
-
 
8
$routeAdd       = $this->url('discovery-contacts/add');
Línea 8... Línea 9...
8
$routeAdd       = $this->url('discovery-contacts/add');
9
$routeDatatable = $this->url('discovery-contacts');
Línea 9... Línea 10...
9
$routeDatatable = $this->url('discovery-contacts');
10
$routeUpload    = $this->url('discovery-contacts/upload');
10
 
11
 
11
 
12
 
12
$allowInteractionAdd    = $acl->isAllowed($roleName, 'discovery-contacts/interactions/add') ? 1 : 0;
13
$allowInteractionAdd    = $acl->isAllowed($roleName, 'discovery-contacts/interactions/add') ? 1 : 0;
-
 
14
 
Línea 13... Línea 15...
13
 
15
$allowAdd           = $acl->isAllowed($roleName, 'discovery-contacts/add') ? 1 : 0;
14
$allowAdd               = $acl->isAllowed($roleName, 'discovery-contacts/add') ? 1 : 0;
16
$allowEdit      = $acl->isAllowed($roleName, 'discovery-contacts/edit') ? 1 : 0;
Línea 40... Línea 42...
40
$this->inlineScript()->appendFile($this->basePath('plugins/intl-tel-input/build/js/intlTelInput-jquery.js'));
42
$this->inlineScript()->appendFile($this->basePath('plugins/intl-tel-input/build/js/intlTelInput-jquery.js'));
41
$utilsScript = $this->basePath('plugins/intl-tel-input/build/js/utils.js');
43
$utilsScript = $this->basePath('plugins/intl-tel-input/build/js/utils.js');
Línea 42... Línea 44...
42
 
44
 
Línea -... Línea 45...
-
 
45
$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.min.js'));
-
 
46
 
-
 
47
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/css/fileinput.min.css'));
-
 
48
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.css'));
-
 
49
 
-
 
50
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/piexif.js'));
-
 
51
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/sortable.js'));
-
 
52
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/fileinput.js'));
-
 
53
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/locales/es.js'));
-
 
54
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/fa/theme.js'));
-
 
55
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fa/theme.js'));
-
 
56
 
-
 
57
 
-
 
58
$this->headStyle()->captureStart();
-
 
59
echo <<<CSS
-
 
60
 
-
 
61
#table-wrapper {
-
 
62
  width: 100%;
-
 
63
  height: 300px;
-
 
64
  overflow: auto;
-
 
65
}
-
 
66
 
-
 
67
#table-wrapper table {
-
 
68
  border-collapse: separate;
-
 
69
  border-spacing: 0;
-
 
70
}
-
 
71
 
-
 
72
#table-wrapper table thead {
-
 
73
  flex: 0 0 auto;
-
 
74
}
-
 
75
 
-
 
76
#table-wrapper table thead th,
-
 
77
#table-wrapper table tbody td {
-
 
78
 
-
 
79
}
-
 
80
 
-
 
81
/*
-
 
82
style=""
-
 
83
#gridTableUploadContacts {
-
 
84
    display: flex;
-
 
85
    flex-flow: column;
-
 
86
    width: 100%;
-
 
87
}
-
 
88
 
-
 
89
#gridTableUploadContacts thead {
-
 
90
    flex: 0 0 auto;
-
 
91
}
-
 
92
 
-
 
93
#gridTableUploadContacts tbody {
-
 
94
    flex: 1 1 auto;
-
 
95
    display: block;
-
 
96
    overflow-y: auto;
-
 
97
    overflow-x: auto;
-
 
98
}
-
 
99
 
-
 
100
#gridTableUploadContacts tr {
-
 
101
    width: 100%;
-
 
102
    display: table;
-
 
103
    table-layout: fixed;
-
 
104
*/
-
 
105
}
-
 
106
CSS;
43
$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.min.js'));
107
$this->headStyle()->captureEnd();
44
 
108
 
45
$this->inlineScript()->captureStart();
109
$this->inlineScript()->captureStart();
Línea 758... Línea 822...
758
            utilsScript: "$utilsScript",
822
            utilsScript: "$utilsScript",
759
            formatOnDisplay: true,
823
            formatOnDisplay: true,
760
            separateDialCode: false,
824
            separateDialCode: false,
761
        });
825
        });
Línea -... Línea 826...
-
 
826
 
-
 
827
var validatorContactUpload = $('#form-contact-upload').validate({
-
 
828
        debug: true,
-
 
829
        onclick: false,
-
 
830
        onkeyup: false,
-
 
831
        onfocusout: false,
-
 
832
        ignore: [],
-
 
833
        rules: {
-
 
834
            'file' : {
-
 
835
                required: true,
-
 
836
                extension: 'xls|xlsx',
-
 
837
                accept: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel'
-
 
838
            },       
-
 
839
        },
-
 
840
        
-
 
841
        submitHandler: function(form)
-
 
842
        {
-
 
843
            NProgress.start();
-
 
844
            var formdata = false;
-
 
845
            if (window.FormData){
-
 
846
                formdata = new FormData(form);
-
 
847
            }
-
 
848
            formdata.append('step','validation');
-
 
849
 
-
 
850
 
-
 
851
            $.ajax({
-
 
852
                'dataType'  : 'json',
-
 
853
                'accept'    : 'application/json',
-
 
854
                'method'    : 'post',
-
 
855
                'url'       :  '$routeUpload',
-
 
856
                'data'      :  formdata,
-
 
857
                'processData': false,
-
 
858
                'contentType': false,
-
 
859
            }).done(function(response) {
-
 
860
                if(response['success']) {
-
 
861
 
-
 
862
                    $('#table-upload-contacts-key').val(response['data']['key']);
-
 
863
                    $('#table-upload-contacts-topic').val(response['data']['topic']);
-
 
864
          			$('#table-upload-contacts-capsule').val(response['data']['capsule']);
-
 
865
    
-
 
866
                    $('#gridTableUploadContacts tbody').html($('#uploadContactTemplate').render(response['data']))
-
 
867
 
-
 
868
                    $('#modalContactUpload').modal('hide');
-
 
869
                    $('#modalContactUploadTable').modal('show');
-
 
870
 
-
 
871
 
-
 
872
                    
-
 
873
                } else {
-
 
874
                    validatorContactUpload.resetForm();
-
 
875
                    if(jQuery.type(response['data']) == 'string') {
-
 
876
                        $.fn.showError(response['data']);
-
 
877
                    } else  {
-
 
878
                        $.each(response['data'], function( fieldname, errors ) {
-
 
879
                            $.fn.showFormErrorValidator('#form-contact-upload #' + fieldname, errors);
-
 
880
                        });
-
 
881
                    }
-
 
882
                }
-
 
883
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
884
                $.fn.showError(textStatus);
-
 
885
            }).always(function() {
-
 
886
               
-
 
887
                NProgress.done();
-
 
888
            });
-
 
889
            return false;
-
 
890
        },
-
 
891
        invalidHandler: function(form, validator) {
-
 
892
        
-
 
893
        }
-
 
894
    });
-
 
895
 
-
 
896
 
-
 
897
    $('body').on('click', 'button.btn-upload', function(e) {
-
 
898
        e.preventDefault();
-
 
899
 
-
 
900
        $('#form-contact-upload #file').fileinput('reset');
-
 
901
        $('#form-contact-upload #file').val('');
-
 
902
 
-
 
903
        $('#modalContactUpload').modal('show');
-
 
904
    });
-
 
905
 
-
 
906
 
-
 
907
    $('#form-contact-upload #file').fileinput({
-
 
908
        theme: 'fa',
-
 
909
        language: 'es',
-
 
910
        showUpload: false,
-
 
911
        dropZoneEnabled: false,
-
 
912
        maxFileCount: 1,
-
 
913
        allowedFileExtensions: ['xls', 'xlsx'],
-
 
914
    });
-
 
915
 
-
 
916
    $('body').on('click', 'button.btn-upload', function(e) {
-
 
917
        e.preventDefault();
-
 
918
 
-
 
919
        $('#form-contact-upload #file').fileinput('reset');
-
 
920
        $('#form-contact-upload #file').val('');
-
 
921
 
-
 
922
        $('#modalContactUpload').modal('show');
-
 
923
    });
-
 
924
 
-
 
925
    $('body').on('click', 'button.btn-upload-contacts-step2', function(e) {
-
 
926
        e.preventDefault();
-
 
927
        NProgress.start();
-
 
928
 
-
 
929
        $.ajax({
-
 
930
            'dataType'  : 'json',
-
 
931
            'accept'    : 'application/json',
-
 
932
            'method'    : 'post',
-
 
933
            'url'       : '$routeUpload',
-
 
934
            'data'      :  {
-
 
935
                'step' : 'process',
-
 
936
                'key' : $('#table-upload-contacts-key').val(),   
-
 
937
            }
-
 
938
        }).done(function(response) {
-
 
939
            if(response['success']) {
-
 
940
 
-
 
941
                var s = response['data']['new_contacts'] + ' LABEL_NEW_CONTACTS <br>' + 
-
 
942
                response['data']['error_contacts'] + ' LABEL_ERROR_CONTACTS <br>' + 
-
 
943
                response['data']['duplicate_contacts'] + ' LABEL_DUPLICATE_CONTACTS <br>';
-
 
944
                
-
 
945
 
-
 
946
 
-
 
947
                $.fn.showSuccess(s);
-
 
948
                  
-
 
949
                 gridTable.api().ajax.reload(null, false);
-
 
950
                $('#modalContactUploadTable').modal('hide');
-
 
951
            } else {
-
 
952
                $.fn.showError(response['data']);
-
 
953
            }
-
 
954
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
955
            $.fn.showError(textStatus);
-
 
956
        }).always(function() {
-
 
957
            NProgress.done();
-
 
958
        });
-
 
959
        return false;
-
 
960
    });
-
 
961
 
762
 
962
 
763
    });
963
    });
764
JS;
964
JS;
765
$this->inlineScript()->captureEnd();
965
$this->inlineScript()->captureEnd();
Línea 791... Línea 991...
791
                        </table>
991
                        </table>
792
                    </div>
992
                    </div>
793
                    <div class="card-footer clearfix">
993
                    <div class="card-footer clearfix">
794
                        <div style="float:right;">
994
                        <div style="float:right;">
795
                            <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
995
                            <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
-
 
996
                      		<?php if($allowUpload) : ?>
-
 
997
                          	<button type="button" class="btn btn-primary btn-upload"><i class="fa fa-upload"></i> LABEL_UPLOAD  </button>
-
 
998
                   			<?php endif; ?>
796
                            <?php if ($allowAdd) : ?>
999
                            <?php if ($allowAdd) : ?>
797
                                <button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
1000
                            <button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
798
                            <?php endif; ?>
1001
                            <?php endif; ?>
799
                        </div>
1002
                        </div>
800
                    </div>
1003
                    </div>
801
                </div>
1004
                </div>
802
            </div>
1005
            </div>
Línea 1245... Línea 1448...
1245
        </div>
1448
        </div>
1246
    </div>
1449
    </div>
1247
</div>
1450
</div>
Línea -... Línea 1451...
-
 
1451
 
-
 
1452
 
-
 
1453
<!-- The Modal -->
-
 
1454
<div class="modal" id="modalContactUpload">
-
 
1455
	<div class="modal-dialog  modal-xl">
-
 
1456
    	<div class="modal-content">
-
 
1457
 
-
 
1458
            <!-- Modal Header -->
-
 
1459
      		<div class="modal-header">
-
 
1460
        		<h4 class="modal-title">LABEL_UPLOAD</h4>
-
 
1461
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
-
 
1462
      		</div>
-
 
1463
 
-
 
1464
            <!-- Modal body -->
-
 
1465
      		<div class="modal-body">
-
 
1466
       			 <?php 
-
 
1467
       			      $form = $this->contactUploadForm;
-
 
1468
            		$form->setAttributes([
-
 
1469
                        'method'    => 'post',
-
 
1470
                        'name'      => 'form-contact-upload',
-
 
1471
                        'id'        => 'form-contact-upload'
-
 
1472
                    ]);
-
 
1473
    
-
 
1474
                    $form->prepare();
-
 
1475
                    echo $this->form()->openTag($form);
-
 
1476
                ?>					
-
 
1477
 
-
 
1478
				<div class="form-group">
-
 
1479
                	
-
 
1480
                		
-
 
1481
                 		<?php 
-
 
1482
                        $element = $form->get('file');
-
 
1483
                        $element->setOptions(['label' => 'LABEL_EXCEL']);
-
 
1484
                        echo $this->formLabel($element);
-
 
1485
                        ?>
-
 
1486
                        <div class="file-loading">
-
 
1487
                        <?php 
-
 
1488
                        $element->setAttributes(['class' => 'form-control', 'accept' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.ms-excel']);
-
 
1489
                        echo $this->formFile($element);
-
 
1490
                        ?>
-
 
1491
                	</div>
-
 
1492
          		</div>
-
 
1493
 
-
 
1494
 
-
 
1495
								
-
 
1496
        		<div class="form-group">
-
 
1497
                	<button type="submit" class="btn btn-primary">LABEL_UPLOAD</button>
-
 
1498
             		<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
-
 
1499
           		</div>
-
 
1500
    			<?php echo $this->form()->closeTag($form); ?>
-
 
1501
      		</div>
-
 
1502
 
-
 
1503
            <!-- Modal footer -->
-
 
1504
      		<div class="modal-footer">
-
 
1505
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
-
 
1506
      		</div>
-
 
1507
 
-
 
1508
    	</div>
-
 
1509
	</div>
-
 
1510
</div> 
-
 
1511
 
-
 
1512
 
-
 
1513
 
-
 
1514
<!-- The Modal -->
-
 
1515
<div class="modal" id="modalContactUploadTable">
-
 
1516
	<div class="modal-dialog modal-xl">
-
 
1517
    	<div class="modal-content">
-
 
1518
 
-
 
1519
            <!-- Modal Header -->
-
 
1520
      		<div class="modal-header">
-
 
1521
        		<h4 class="modal-title">LABEL_CONTACTS</h4>
-
 
1522
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
-
 
1523
      		</div>
-
 
1524
 
-
 
1525
            <!-- Modal body -->
-
 
1526
      		<div class="modal-body">
-
 
1527
      			<form>
-
 
1528
      				<input type="hidden" name="table-upload-contacts-key" id="table-upload-contacts-key">
-
 
1529
      			</form>
-
 
1530
      			
-
 
1531
      			
-
 
1532
      			
-
 
1533
      			<div id="table-wrapper"> 
-
 
1534
    				<table id="gridTableUploadContacts" class="table table-bordered table-hover">
-
 
1535
                		<thead>
-
 
1536
                			<tr>
-
 
1537
                          		<th>LABEL_FIRST_NAME</th>
-
 
1538
                         		<th>LABEL_LAST_NAME</th>
-
 
1539
                             	<th>LABEL_EMAIL</th>
-
 
1540
                           		<th>LABEL_CORPORATE_EMAIL</th>
-
 
1541
                                <th>LABEL_COMPANY</th>
-
 
1542
                                <th>LABEL_POSITION</th>
-
 
1543
                                <th>LABEL_COUNTRY</th>
-
 
1544
                                <th>LABEL_STATE</th>
-
 
1545
                                <th>LABEL_CITY</th>
-
 
1546
                                <th>LABEL_PHONE</th>
-
 
1547
                                <th>LABEL_PHONE_EXTENSION</th>
-
 
1548
                                <th>LABEL_PERSONAL_EMAIL</th>
-
 
1549
                                <th>LABEL_CELULAR</th>
-
 
1550
                                <th>LABEL_WHATSAPP</th>
-
 
1551
                                <th>LABEL_LINKEDIN</th>
-
 
1552
 
-
 
1553
                 			</tr>
-
 
1554
                      	</thead>
-
 
1555
                   		<tbody>
-
 
1556
                   		</tbody>
-
 
1557
             		</table>
-
 
1558
         		</div>
-
 
1559
       			
-
 
1560
      		</div>
-
 
1561
 
-
 
1562
            <!-- Modal footer -->
-
 
1563
      		<div class="modal-footer">
-
 
1564
      			<button type="submit" class="btn btn-primary btn-upload-contacts-step2">LABEL_SAVE</button>
-
 
1565
        		<button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
-
 
1566
      		</div>
-
 
1567
 
-
 
1568
    	</div>
-
 
1569
	</div>
Línea 1248... Línea 1570...
1248
 
1570
</div> 
1249
 
1571
 
1250
 
1572
 
1251
<script id="interactionTemplate" type="text/x-jsrender">
1573
<script id="interactionTemplate" type="text/x-jsrender">
Línea 1297... Línea 1619...
1297
    </tr>
1619
    </tr>
Línea 1298... Línea 1620...
1298
 
1620
 
1299
    {{/for}}
1621
    {{/for}}
Línea -... Línea 1622...
-
 
1622
</script>
-
 
1623
 
-
 
1624
 
-
 
1625
<script id="uploadContactTemplate" type="text/x-jsrender">
-
 
1626
    {{for items}}
-
 
1627
    <tr>
-
 
1628
        <td>{{>first_name}}</td>
-
 
1629
        <td>{{>last_name}}</td>
-
 
1630
        <td>{{>email_personal}}</td>
-
 
1631
        <td>{{>email_company}}</td>
-
 
1632
        <td>{{>company}}</td>
-
 
1633
        <td>{{>position}}</td>
-
 
1634
        <td>{{>country}}</td>
-
 
1635
        <td>{{>state}}</td>
-
 
1636
        <td>{{>city}}</td>
-
 
1637
        <td>{{>phone}}</td>
-
 
1638
        <td>{{>extension}}</td>
-
 
1639
        <td>{{>movil}}</td>
-
 
1640
        <td>{{>whatsapp}}</td>
-
 
1641
        <td>{{>linkedin}}</td>
-
 
1642
 
-
 
1643
    </tr>
-
 
1644
 
-
 
1645
 
-
 
1646
    {{/for}}
1300
</script>
1647
</script>
1301
 
1648
 
1302
<script id="logPaginationTemplate" type="text/x-jsrender">
1649
<script id="logPaginationTemplate" type="text/x-jsrender">
1303
    {{if has_previous_page}}
1650
    {{if has_previous_page}}