Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16932 | Rev 16972 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
15399 efrain 1
<?php
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser    = $this->currentUserHelper();
4
 
5
$roleName = $currentUser->getUserTypeId();
6
 
7
 
8
$routeAdd       = $this->url('discovery-contacts/add');
9
$routeDatatable = $this->url('discovery-contacts');
15546 efrain 10
$routeUpload    = $this->url('discovery-contacts/upload');
15399 efrain 11
 
12
 
13
$allowInteractionAdd    = $acl->isAllowed($roleName, 'discovery-contacts/interactions/add') ? 1 : 0;
14
 
15546 efrain 15
$allowAdd           = $acl->isAllowed($roleName, 'discovery-contacts/add') ? 1 : 0;
16
$allowEdit      = $acl->isAllowed($roleName, 'discovery-contacts/edit') ? 1 : 0;
17
$allowDelete    = $acl->isAllowed($roleName, 'discovery-contacts/delete',) ? 1 : 0;
18
$allowView      = $acl->isAllowed($roleName, 'discovery-contacts/view',) ? 1 : 0;
19
$allowUpload    = $acl->isAllowed($roleName, 'discovery-contacts/upload') ? 1 : 0;
15399 efrain 20
 
21
 
16822 efrain 22
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));
23
$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.js'));
15399 efrain 24
 
25
 
16864 efrain 26
 
16929 efrain 27
 
28
 
29
 
16822 efrain 30
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.css'));
16864 efrain 31
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.css'));
15399 efrain 32
 
16822 efrain 33
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net/jquery.dataTables.js'));
34
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.js'));
16864 efrain 35
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/dataTables.responsive.min.js'));
36
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.min.js'));
15399 efrain 37
 
38
 
16864 efrain 39
 
16822 efrain 40
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
41
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
15399 efrain 42
 
43
 
44
 
45
 
16822 efrain 46
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/intl-tel-input/build/css/intlTelInput.css'));
47
$this->inlineScript()->appendFile($this->basePath('assets/vendors/intl-tel-input/build/js/intlTelInput-jquery.js'));
48
$utilsScript = $this->basePath('assets/vendors/intl-tel-input/build/js/utils.js');
15546 efrain 49
 
16822 efrain 50
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jsrender/jsrender.min.js'));
15546 efrain 51
 
16822 efrain 52
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-fileinput/css/fileinput.min.css'));
53
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fas/theme.css'));
15546 efrain 54
 
16843 efrain 55
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/piexif.js'));
56
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/plugins/sortable.js'));
16822 efrain 57
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/fileinput.js'));
58
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/js/locales/es.js'));
59
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/fa/theme.js'));
60
$this->inlineScript()->appendFile($this->basePath('assets/vendors/bootstrap-fileinput/themes/explorer-fa/theme.js'));
61
 
62
 
15546 efrain 63
$this->headStyle()->captureStart();
64
echo <<<CSS
65
 
66
#table-wrapper {
67
  width: 100%;
68
  height: 300px;
69
  overflow: auto;
70
}
71
 
72
#table-wrapper table {
73
  border-collapse: separate;
74
  border-spacing: 0;
75
}
76
 
77
#table-wrapper table thead {
78
  flex: 0 0 auto;
79
}
80
 
81
#table-wrapper table thead th,
82
#table-wrapper table tbody td {
83
 
84
}
85
 
86
/*
87
style=""
88
#gridTableUploadContacts {
89
    display: flex;
90
    flex-flow: column;
91
    width: 100%;
92
}
93
 
94
#gridTableUploadContacts thead {
95
    flex: 0 0 auto;
96
}
97
 
98
#gridTableUploadContacts tbody {
99
    flex: 1 1 auto;
100
    display: block;
101
    overflow-y: auto;
102
    overflow-x: auto;
103
}
104
 
105
#gridTableUploadContacts tr {
106
    width: 100%;
107
    display: table;
108
    table-layout: fixed;
109
*/
110
}
111
CSS;
112
$this->headStyle()->captureEnd();
113
 
15399 efrain 114
$this->inlineScript()->captureStart();
115
echo <<<JS
116
    jQuery( document ).ready(function( $ ) {
117
 
118
 
119
        $.validator.addMethod("isIntlPhoneNumber", function(value, element) {
120
            if(!value || value.length == '') {
121
                return true;
122
            }  else {
123
                return $(element).intlTelInput('isValidNumber');
124
            }
125
        },  'ERROR_INTERNATIONAL_PHONE_FORMAT_IS_INVALID');
126
 
127
 
128
 
129
 
130
 
131
        var allowEdit   = $allowEdit;
132
        var allowDelete = $allowDelete;
133
        var allowView = $allowView;
134
 
135
        var linkInteractions = '';
136
        var linkInteractionsAdd = '';
137
        var linkLogs = '';
138
 
139
        var pageInteractions = 0;
140
        var pageLogs = 0;
141
 
142
 
143
        $.fn.loadLogs = function() {
144
            NProgress.start();
145
            var action = $(this).data('href');
146
 
147
            $.ajax({
148
                'dataType'  : 'json',
149
                'method'    : 'get',
150
                'url'       : linkLogs,
151
                'data'      : {
152
                    'page' : pageLogs
153
                }
154
            }).done(function(response) {
155
                if(response['success']) {
156
 
157
                    pagination = {
158
                        has_previous_page : response['data']['current']['page'] > 1,
159
                        has_next_page : response['data']['current']['page'] < response['data']['total']['page'],
160
                    }
161
 
162
 
163
                    if(pageLogs > response['data']['total']['page']) {
164
                        pageLogs = response['data']['total']['page'];
165
                    }
166
 
167
                    $('#discovery-contacts-pagination-logs').empty();
168
                    $('#discovery-contacts-pagination-logs').append($('#logPaginationTemplate').render(pagination));
169
 
170
 
171
                    $('#grid-discovery-contacts-tabs-logs').empty();
172
                    $('#grid-discovery-contacts-tabs-logs').append(
173
                        $('#logTemplate').render(response['data']['current'])
174
                    );
175
 
176
 
177
 
178
                } else {
179
                    $.fn.showError(response['data']);
180
                }
181
            }).fail(function( jqXHR, textStatus, errorThrown) {
182
                $.fn.showError(textStatus);
183
            }).always(function() {
184
                NProgress.done();
185
            });
186
 
187
        };
188
 
189
    $.fn.loadInteractions = function() {
190
            NProgress.start();
191
 
192
            $.ajax({
193
                'dataType'  : 'json',
194
                'method'    : 'get',
195
                'url'       : linkInteractions,
196
                'data'      : {
197
                    'page' : pageInteractions
198
                }
199
            }).done(function(response) {
200
                if(response['success']) {
201
 
202
                    pagination = {
203
                        has_previous_page : response['data']['current']['page'] > 1,
204
                        has_next_page : response['data']['current']['page'] < response['data']['total']['page'],
205
                    }
206
 
207
                    if(pageInteractions > response['data']['total']['page']) {
208
                        pageInteractions = response['data']['total']['page'];
209
                    }
210
 
211
                    $('#discovery-contacts-pagination-interactions').empty();
212
                    $('#discovery-contacts-pagination-interactions').append($('#interactionPaginationTemplate').render(pagination));
213
 
214
 
215
                    $('#grid-discovery-contacts-tabs-interactions').empty();
216
                    $('#grid-discovery-contacts-tabs-interactions').append(
217
                        $('#interactionTemplate').render(response['data']['current'])
218
                    );
219
 
220
 
221
 
222
 
223
 
224
                } else {
225
                    $.fn.showError(response['data']);
226
                }
227
            }).fail(function( jqXHR, textStatus, errorThrown) {
228
                $.fn.showError(textStatus);
229
            }).always(function() {
230
                NProgress.done();
231
            });
232
 
233
        };
234
 
235
     var gridTable = $('#gridTable').dataTable( {
236
            'processing': true,
237
            'serverSide': true,
238
            'searching': true,
239
            'order': [[ 0, 'asc' ]],
240
            'ordering':  true,
241
            'ordenable' : true,
242
            'responsive': true,
243
            'select' : false,
244
        	'paging': true,
245
            'pagingType': 'simple_numbers',
246
    		'ajax': {
247
    			'url' : '$routeDatatable',
248
    			'type' : 'get',
249
                'beforeSend': function (request) {
250
                  NProgress.start();
251
                },
252
                'dataFilter': function(response) {
253
                    var response = jQuery.parseJSON( response );
254
 
255
                    var json                = {};
256
                    json.recordsTotal       = 0;
257
                    json.recordsFiltered    = 0;
258
                    json.data               = [];
259
 
16477 anderson 260
 
15399 efrain 261
                    if(response.success) {
262
                        json.recordsTotal       = response.data.total;
263
                        json.recordsFiltered    = response.data.total;
264
                        json.data               = response.data.items;
265
                    } else {
266
                        $.fn.showError(response.data)
267
                    }
268
 
269
                    return JSON.stringify( json );
270
                }
271
    		},
272
            'language' : {
273
                'sProcessing':     'LABEL_DATATABLE_SPROCESSING',
274
                'sLengthMenu':     'LABEL_DATATABLE_SLENGTHMENU',
275
                'sZeroRecords':    'LABEL_DATATABLE_SZERORECORDS',
276
                'sEmptyTable':     'LABEL_DATATABLE_SEMPTYTABLE',
277
                'sInfo':           'LABEL_DATATABLE_SINFO',
278
                'sInfoEmpty':      'LABEL_DATATABLE_SINFOEMPTY',
279
                'sInfoFiltered':   'LABEL_DATATABLE_SINFOFILTERED',
280
                'sInfoPostFix':    '',
281
                'sSearch':         'LABEL_DATATABLE_SSEARCH',
282
                'sUrl':            '',
283
                'sInfoThousands':  ',',
284
                'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
285
                'oPaginate': {
286
                    'sFirst':    'LABEL_DATATABLE_SFIRST',
287
                    'sLast':     'LABEL_DATATABLE_SLAST',
288
                    'sNext':     'LABEL_DATATABLE_SNEXT',
289
                    'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
290
                },
291
                'oAria': {
292
                    'sSortAscending':  ': LABEL_DATATABLE_SSORTASCENDING',
293
                    'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
294
                },
295
            },
296
            'drawCallback': function( settings ) {
297
                NProgress.done();
16822 efrain 298
 
15399 efrain 299
            },
300
            'aoColumns': [
301
                { 'mDataProp': 'corporate_email' },
15624 anderson 302
                { 'mDataProp': 'company' },
15626 anderson 303
                { 'mDataProp': 'country' },
15627 anderson 304
                { 'mDataProp': 'sector' },
16766 efrain 305
                { 'mDataProp': 'scholarship' },
15399 efrain 306
                { 'mDataProp': 'actions' },
307
    	    ],
308
            'columnDefs': [
309
                {
310
                    'targets': -1,
311
                    'orderable': false,
312
                    'render' : function ( data, type, row ) {
313
                        s = '';
314
 
315
                        if(allowEdit && data['link_edit']) {
16906 efrain 316
                            s = s + '<button class="btn btn-primary btn-edit" data-href="' + data['link_edit']+ '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pen"></i> LABEL_EDIT </button>&nbsp;';
15399 efrain 317
                        }
318
                        if(allowDelete && data['link_delete']) {
319
                            s = s + '<button class="btn btn-danger btn-delete" data-href="' + data['link_delete']+ '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button>&nbsp;';
320
                        }
321
                        if(allowView && data['link_view']) {
16932 efrain 322
                            s = s + '<button class="btn btn-secondary btn-view" data-href="' + data['link_view']+ '" data-toggle="tooltip" title="LABEL_VIEW"><i class="fa fa-external-link-alt"></i> LABEL_VIEW </button>&nbsp;';
15399 efrain 323
                        }
324
                        return s;
325
                    }
326
                }
327
              ],
328
        });
329
 
330
 
331
 
332
 
333
        var validator = $('#form').validate({
334
            debug: true,
335
            onclick: false,
336
            onkeyup: false,
337
            ignore: [],
338
            rules: {
339
                'first_name': {
16766 efrain 340
                    required: false,
15399 efrain 341
                    maxlength: 128,
342
                },
343
                'last_name': {
16766 efrain 344
                    required: false,
15399 efrain 345
                    maxlength: 128,
346
                },
347
                'corporate_email': {
348
                    required: true,
349
                    maxlength: 250,
350
                    email: true,
351
 
352
                },
353
                'company': {
354
                    required: true,
355
                    maxlength: 128,
356
                },
357
                'position': {
358
                    required: true,
359
                    maxlength: 128,
360
                },
361
                'country': {
362
                    required: true,
363
                    maxlength: 128,
364
                },
365
                'state': {
366
                    required: false,
367
                    maxlength: 128,
368
                },
369
                'city': {
370
                    required: false,
371
                    maxlength: 128,
372
                },
373
                'personal_email': {
374
                    required: false,
375
                    maxlength: 128,
376
                    email: true,
377
                },
378
                'phone': {
379
                    required: false,
380
                    maxlength: 25,
381
                    isIntlPhoneNumber: true,
382
                },
383
                'phone_extension': {
384
                    required: false,
385
                    maxlength: 5,
386
                },
387
                'celular': {
388
                    required: false,
389
                    maxlength: 25,
390
                    isIntlPhoneNumber: true,
391
                },
392
                'whatsapp': {
393
                    required: false,
394
                    maxlength: 25,
395
                    isIntlPhoneNumber: true,
396
                },
397
                'linkedin': {
398
                    required: false,
15831 efrain 399
                    maxlength: 250,
15399 efrain 400
                    url: true,
401
                },
15831 efrain 402
                'sector': {
403
                    required: false,
404
                    maxlength: 250,
405
                },
16766 efrain 406
                'scholarship': {
407
                    required: false,
408
                },
15399 efrain 409
            },
410
            submitHandler: function(form)
411
            {
412
                data = {
413
                    first_name :  $('#form #first_name').val(),
414
                    last_name :  $('#form #last_name').val(),
415
                    corporate_email :  $('#form #corporate_email').val(),
416
                    company :  $('#form #company').val(),
417
                    position :  $('#form #position').val(),
418
                    country :  $('#form #country').val(),
419
                    state :  $('#form #state').val(),
420
                    city :  $('#form #city').val(),
421
                    personal_email :  $('#form #personal_email').val(),
422
                    phone :  $('#form #phone').intlTelInput('getNumber'),
423
                    phone_extension :  $('#form #phone_extension').val(),
424
                    celular :  $('#form #celular').intlTelInput('getNumber'),
425
                    whatsapp :  $('#form #whatsapp').intlTelInput('getNumber'),
426
                    linkedin :  $('#form #linkedin').val(),
15831 efrain 427
                    sector :  $('#form #sector').val(),
16766 efrain 428
                    scholarship: $('#form #scholarship').val(),
15399 efrain 429
                };
430
 
431
                $('#modal .btn-primary').attr('disabled', true)
432
                $.ajax({
433
                    'dataType'  : 'json',
434
                    'accept'    : 'application/json',
435
                    'method'    : 'post',
436
                    'url'       :  $('#form').attr('action'),
437
                    'data'      :  data
438
                }).done(function(response) {
439
                    NProgress.start();
440
                    if(response['success']) {
441
                        $.fn.showSuccess(response['data']);
442
 
443
                        $('#form-row').hide();
444
                        $('#listing-row').show();
445
 
446
 
447
 
448
                        gridTable.api().ajax.reload(null, false);
449
                    } else {
450
                        validator.resetForm();
451
                        if(jQuery.type(response['data']) == 'string') {
452
                            $.fn.showError(response['data']);
453
                        } else  {
454
                            $.each(response['data'], function( fieldname, errors ) {
455
                                $.fn.showFormErrorValidator('#form #' + fieldname, errors);
456
                            });
457
                        }
458
                    }
459
                }).fail(function( jqXHR, textStatus, errorThrown) {
460
                    $.fn.showError(textStatus);
461
                }).always(function() {
462
                    NProgress.done();
463
                    $('#modal .btn-primary').removeAttr('disabled')
464
                });
465
                return false;
466
            },
467
            invalidHandler: function(form, validator) {
468
 
469
            }
470
        });
471
 
472
        var validatorInteraction = $('#form-interaction').validate({
473
            debug: true,
474
            onclick: false,
475
            onkeyup: false,
476
            ignore: [],
477
            rules: {
478
                'notes': {
479
                    required: true,
480
                },
481
                'interaction_type_id': {
482
                    required: true,
483
 
484
                },
485
            },
486
            submitHandler: function(form)
487
            {
488
 
489
                $.ajax({
490
                    'dataType'  : 'json',
491
                    'accept'    : 'application/json',
492
                    'method'    : 'post',
493
                    'url'       :  $('#form-interaction').attr('action'),
494
                    'data'      :  $('#form-interaction').serialize()
495
                }).done(function(response) {
496
                    NProgress.start();
497
                    if(response['success']) {
498
                        $.fn.showSuccess(response['data']);
499
 
500
                        $('#modal-interaction').modal('hide');
501
 
502
 
503
                        $.fn.loadInteractions();
504
                        $.fn.loadLogs();
505
                    } else {
506
                        validator.resetForm();
507
                        if(jQuery.type(response['data']) == 'string') {
508
                            $.fn.showError(response['data']);
509
                        } else  {
510
                            $.each(response['data'], function( fieldname, errors ) {
511
                                $.fn.showFormErrorValidator('#form-interaction #' + fieldname, errors);
512
                            });
513
                        }
514
                    }
515
                }).fail(function( jqXHR, textStatus, errorThrown) {
516
                    $.fn.showError(textStatus);
517
                }).always(function() {
518
                    NProgress.done();
519
 
520
                });
521
                return false;
522
            },
523
            invalidHandler: function(form, validator) {
524
 
525
            }
526
        });
527
 
528
        $('body').on('click', 'button.btn-add-interaction', function(e) {
529
            e.preventDefault();
530
 
531
            $('#form-interaction').attr('action', linkInteractionsAdd);
532
            $('#form-interaction #notes').val('');
533
            $('#form-interaction #status').val('');
534
 
535
            validator.resetForm();
536
            $('#modal-interaction').modal('show');
537
        });
538
 
539
 
540
        $('body').on('click', 'button.btn-cancel-interaction', function(e) {
541
            e.preventDefault();
542
            $('#modal-interaction').modal('hide');
543
        });
544
 
545
        $('body').on('click', 'button.btn-delete-interaction', function(e) {
546
            e.preventDefault();
547
            var action = $(this).data('href');
548
            NProgress.start();
549
            $.ajax({
550
                'dataType'  : 'json',
551
                'accept'    : 'application/json',
552
                'method'    : 'post',
553
                'url'       :  action,
554
            }).done(function(response) {
555
                if(response['success']) {
556
                    $.fn.showSuccess(response['data']);
557
 
558
                    $.fn.loadLogs();
559
                    $.fn.loadInteractions();
560
                } else {
561
                    $.fn.showError(response['data']);
562
                }
563
            }).fail(function( jqXHR, textStatus, errorThrown) {
564
                $.fn.showError(textStatus);
565
            }).always(function() {
566
                NProgress.done();
567
            });
568
 
569
        });
570
 
571
 
572
        $('body').on('click', 'button.btn-add', function(e) {
573
            e.preventDefault();
574
 
16840 efrain 575
 
15399 efrain 576
            $('#form').attr('action', '$routeAdd');
577
            $('#form #first_name').val('');
578
            $('#form #last_name').val('');
579
            $('#form #corporate_email').val('');
580
            $('#form #company').val('');
581
            $('#form #position').val('');
582
            $('#form #country').val('');
583
            $('#form #state').val('');
584
            $('#form #city').val('');
585
            $('#form #personal_email').val('');
586
            $('#form #phone').intlTelInput('setNumber', '');
587
            $('#form #phone_extension').val('');
588
            $('#form #celular').intlTelInput('setNumber', '');
589
            $('#form #whatsapp').intlTelInput('setNumber', '');
590
            $('#form #linkedin').val('');
15831 efrain 591
            $('#form #sector').val('');
16766 efrain 592
            $('#form #scholarship').val('');
15399 efrain 593
 
594
            validator.resetForm();
595
 
596
 
597
            $('#listing-row').hide();
598
            $('#form-row').show();
599
 
600
        });
601
 
602
        $('body').on('click', 'button.btn-edit', function(e) {
603
            e.preventDefault();
604
            NProgress.start();
605
            var action = $(this).data('href');
606
 
607
            $.ajax({
608
                'dataType'  : 'json',
609
                'method'    : 'get',
610
                'url'       :  action,
611
            }).done(function(response) {
612
                if(response['success']) {
613
 
16840 efrain 614
 
15399 efrain 615
                    $('#form').attr('action', action);
616
                    $('#form #first_name').val(response['data']['first_name']);
617
                    $('#form #last_name').val(response['data']['last_name']);
618
                    $('#form #corporate_email').val(response['data']['corporate_email']);
619
                    $('#form #company').val(response['data']['company']);
620
                    $('#form #position').val(response['data']['position']);
621
                    $('#form #country').val(response['data']['country']);
622
                    $('#form #state').val(response['data']['state']);
623
                    $('#form #city').val(response['data']['city']);
624
                    $('#form #personal_email').val(response['data']['personal_email']);
625
                    $('#form #phone').intlTelInput('setNumber', response['data']['phone']);
626
                    $('#form #phone_extension').val(response['data']['phone_extension']);
627
                    $('#form #celular').intlTelInput('setNumber', response['data']['celular']);
628
                    $('#form #whatsapp').intlTelInput('setNumber', response['data']['whatsapp']);
629
                    $('#form #linkedin').val(response['data']['linkedin']);
15831 efrain 630
                    $('#form #sector').val(response['data']['sector']);
16766 efrain 631
                    $('#form #scholarship').val(response['data']['scholarship']);
15399 efrain 632
 
16766 efrain 633
 
15399 efrain 634
                    validator.resetForm();
635
 
636
 
637
                    $('#listing-row').hide();
638
                    $('#form-row').show();
639
                } else {
640
                    $.fn.showError(response['data']);
641
                }
642
            }).fail(function( jqXHR, textStatus, errorThrown) {
643
                $.fn.showError(textStatus);
644
            }).always(function() {
645
                NProgress.done();
646
            });
647
        });
648
 
649
 
650
        $('body').on('click', 'a.class-btn-log-previous', function(e) {
651
            e.preventDefault();
652
 
653
            if( pageLogs  > 1) {
654
                pageLogs  =  pageLogs  - 1;
655
                $.fn.loadLogs();
656
 
657
            }
658
        });
659
 
660
        $('body').on('click', 'a.class-btn-log-next', function(e) {
661
            e.preventDefault();
662
            pageLogs  =  pageLogs  + 1;
663
             $.fn.loadLogs();
664
        });
665
 
666
        $('body').on('click', 'a.class-btn-interaction-previous', function(e) {
667
            e.preventDefault();
668
 
669
            if( pageInteractions  > 1) {
670
                pageInteractions  =  v  - 1;
671
                $.fn.loadInteractions();
672
 
673
            }
674
        });
675
 
676
        $('body').on('click', 'a.class-btn-interaction-next', function(e) {
677
            e.preventDefault();
678
            pageInteractions  =  pageInteractions  + 1;
679
             $.fn.loadInteractions();
680
        });
681
 
682
        $('body').on('click', 'button.btn-view', function(e) {
683
            e.preventDefault();
684
            NProgress.start();
685
            var action = $(this).data('href');
686
 
687
            $.ajax({
688
                'dataType'  : 'json',
689
                'method'    : 'get',
690
                'url'       :  action,
691
            }).done(function(response) {
692
                if(response['success']) {
693
 
694
 
695
                    $('#interactions-first_name').val(response['data']['first_name']);
696
                    $('#interactions-last_name').val(response['data']['last_name']);
697
                    $('#interactions-corporate_email').val(response['data']['corporate_email']);
698
                    $('#interactions-company').val(response['data']['company']);
699
                    $('#interactions-position').val(response['data']['position']);
700
                    $('#interactions-country').val(response['data']['country']);
701
                    $('#interactions-state').val(response['data']['state']);
702
                    $('#interactions-city').val(response['data']['city']);
703
                    $('#interactions-personal_email').val(response['data']['personal_email']);
704
                    $('#interactions-phone').val(response['data']['phone']);
705
                    $('#interactions-phone_extension').val(response['data']['phone_extension']);
706
                    $('#interactions-celular').val(response['data']['celular']);
707
                    $('#interactions-whatsapp').val(response['data']['whatsapp']);
708
                    $('#interactions-linkedin').val(response['data']['linkedin']);
15831 efrain 709
                    $('#interactions-sector').val(response['data']['sector']);
16766 efrain 710
                    $('#interactions-scholarship').val(response['data']['scholarship']);
15399 efrain 711
 
16766 efrain 712
 
713
 
15399 efrain 714
                    linkInteractions = response['data']['link_interactions'];
715
                    linkInteractionsAdd = response['data']['link_interactions_add'];
716
                    linkLogs = response['data']['link_logs'];
717
 
718
                    pageInteractions = 0;
719
                    pageLogs = 0;
720
 
721
 
722
 
723
 
724
                    $.fn.loadLogs();
725
                    $.fn.loadInteractions();
726
 
727
 
728
 
729
                    $('#listing-row').hide();
730
                    $('#interactions-row').show();
731
                } else {
732
                    $.fn.showError(response['data']);
733
                }
734
            }).fail(function( jqXHR, textStatus, errorThrown) {
735
                $.fn.showError(textStatus);
736
            }).always(function() {
737
                NProgress.done();
738
            });
739
        });
740
 
741
        $('body').on('click', 'button.btn-refresh', function(e) {
742
            e.preventDefault();
743
            gridTable.api().ajax.reload(null, false);
744
        });
745
 
746
 
747
        $('body').on('click', 'button.btn-cancel', function(e) {
748
 
749
 
750
            e.preventDefault();
751
            $('#form-row').hide();
752
            $('#listing-row').show();
753
        });
754
 
755
        $('body').on('click', 'button.btn-close-view', function(e) {
756
 
757
 
758
            e.preventDefault();
759
            $('#interactions-row').hide();
760
            $('#listing-row').show();
761
        });
762
 
16822 efrain 763
    $('body').on('click', 'button.btn-delete', function(e) {
764
        e.preventDefault();
765
        var action = $(this).data('href');
15399 efrain 766
 
16822 efrain 767
 
768
          swal.fire({
769
            title: 'LABEL_ARE_YOU_SURE',
770
            icon: 'question',
771
            cancelButtonText: 'LABEL_NO',
772
            showCancelButton: true,
773
            confirmButtonText: 'LABEL_YES'
774
          }).then((result) => {
775
            if (result.isConfirmed) {
776
 
777
                    NProgress.start();
778
                    $.ajax({
779
                        'dataType'  : 'json',
780
                        'accept'    : 'application/json',
781
                        'method'    : 'post',
782
                        'url'       :  action,
783
                    }).done(function(response) {
784
                        if(response['success']) {
785
                            $.fn.showSuccess(response['data']);
786
                            gridTable.api().ajax.reload(null, false);
787
                        } else {
788
                            $.fn.showError(response['data']);
789
                        }
790
                    }).fail(function( jqXHR, textStatus, errorThrown) {
791
                        $.fn.showError(textStatus);
792
                    }).always(function() {
793
                        NProgress.done();
794
                    });
795
                }
796
           });
797
        });
798
 
15399 efrain 799
 
800
        $('#form #phone').intlTelInput({
801
            utilsScript: "$utilsScript",
802
            formatOnDisplay: true,
803
             separateDialCode: false,
804
        });
805
 
806
 
807
 
808
       $('#form #celular').intlTelInput({
809
            utilsScript: "$utilsScript",
810
            formatOnDisplay: true,
811
            separateDialCode: false,
812
        });
813
 
814
        $('#form #whatsapp').intlTelInput({
815
            utilsScript: "$utilsScript",
816
            formatOnDisplay: true,
817
            separateDialCode: false,
818
        });
819
 
15546 efrain 820
var validatorContactUpload = $('#form-contact-upload').validate({
821
        debug: true,
822
        onclick: false,
823
        onkeyup: false,
824
        onfocusout: false,
825
        ignore: [],
826
        rules: {
827
            'file' : {
828
                required: true,
829
                extension: 'xls|xlsx',
830
                accept: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel'
831
            },
832
        },
833
 
834
        submitHandler: function(form)
835
        {
836
            NProgress.start();
837
            var formdata = false;
838
            if (window.FormData){
839
                formdata = new FormData(form);
840
            }
841
            formdata.append('step','validation');
842
 
843
 
844
            $.ajax({
845
                'dataType'  : 'json',
846
                'accept'    : 'application/json',
847
                'method'    : 'post',
848
                'url'       :  '$routeUpload',
849
                'data'      :  formdata,
850
                'processData': false,
851
                'contentType': false,
852
            }).done(function(response) {
853
                if(response['success']) {
854
 
855
                    $('#table-upload-contacts-key').val(response['data']['key']);
856
                    $('#table-upload-contacts-topic').val(response['data']['topic']);
857
          			$('#table-upload-contacts-capsule').val(response['data']['capsule']);
858
 
859
                    $('#gridTableUploadContacts tbody').html($('#uploadContactTemplate').render(response['data']))
860
 
861
                    $('#modalContactUpload').modal('hide');
862
                    $('#modalContactUploadTable').modal('show');
863
 
864
 
865
 
866
                } else {
867
                    validatorContactUpload.resetForm();
868
                    if(jQuery.type(response['data']) == 'string') {
869
                        $.fn.showError(response['data']);
870
                    } else  {
871
                        $.each(response['data'], function( fieldname, errors ) {
872
                            $.fn.showFormErrorValidator('#form-contact-upload #' + fieldname, errors);
873
                        });
874
                    }
875
                }
876
            }).fail(function( jqXHR, textStatus, errorThrown) {
877
                $.fn.showError(textStatus);
878
            }).always(function() {
879
 
880
                NProgress.done();
881
            });
882
            return false;
883
        },
884
        invalidHandler: function(form, validator) {
885
 
886
        }
15399 efrain 887
    });
15546 efrain 888
 
889
 
890
    $('body').on('click', 'button.btn-upload', function(e) {
891
        e.preventDefault();
892
 
893
        $('#form-contact-upload #file').fileinput('reset');
894
        $('#form-contact-upload #file').val('');
895
 
896
        $('#modalContactUpload').modal('show');
897
    });
898
 
899
 
900
    $('#form-contact-upload #file').fileinput({
901
        theme: 'fa',
902
        language: 'es',
903
        showUpload: false,
904
        dropZoneEnabled: false,
905
        maxFileCount: 1,
906
        allowedFileExtensions: ['xls', 'xlsx'],
907
    });
908
 
909
    $('body').on('click', 'button.btn-upload', function(e) {
910
        e.preventDefault();
911
 
912
        $('#form-contact-upload #file').fileinput('reset');
913
        $('#form-contact-upload #file').val('');
914
 
915
        $('#modalContactUpload').modal('show');
916
    });
917
 
918
    $('body').on('click', 'button.btn-upload-contacts-step2', function(e) {
919
        e.preventDefault();
920
        NProgress.start();
921
 
922
        $.ajax({
923
            'dataType'  : 'json',
924
            'accept'    : 'application/json',
925
            'method'    : 'post',
926
            'url'       : '$routeUpload',
927
            'data'      :  {
928
                'step' : 'process',
929
                'key' : $('#table-upload-contacts-key').val(),
930
            }
931
        }).done(function(response) {
932
            if(response['success']) {
933
 
934
                var s = response['data']['new_contacts'] + ' LABEL_NEW_CONTACTS <br>' +
935
                response['data']['error_contacts'] + ' LABEL_ERROR_CONTACTS <br>' +
936
                response['data']['duplicate_contacts'] + ' LABEL_DUPLICATE_CONTACTS <br>';
937
 
938
 
16971 efrain 939
                var anchor = window.document.createElement("a");
940
                anchor.href = 'data:application/octet-stream;charset=utf-8;base64,' + response['data']['csv_base64_content'] ;
941
                anchor.download = response['data']['csv_filename'];
942
                document.body.appendChild(anchor);
943
                anchor.click();  // IE: "Access is denied"; see: https://connect.microsoft.com/IE/feedback/details/797361/ie-10-treats-blob-url-as-cross-origin-and-denies-access
944
                document.body.removeChild(anchor);
15546 efrain 945
 
16971 efrain 946
 
15546 efrain 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
 
962
 
963
    });
15399 efrain 964
JS;
965
$this->inlineScript()->captureEnd();
966
?>
967
 
16864 efrain 968
<div class="container">
969
	<div class="card" id="listing-row">
970
	 	<div class="card-header">
971
	 		<h6 class="card-title">LABEL_CONTACTS</h6>
972
	 	</div>
973
	 	<div class="card-body">
974
	 		<div class="row">
975
	 	         <div class="col-12 mt-3">
976
 
16912 efrain 977
	 	          <table id="gridTable" class="table  table-bordered">
15399 efrain 978
                            <thead>
979
                                <tr>
980
                                    <th>LABEL_CORPORATE_EMAIL</th>
15625 anderson 981
                                    <th>LABEL_COMPANY</th>
15626 anderson 982
                                    <th>LABEL_COUNTRY</th>
15627 anderson 983
                                    <th>LABEL_SECTOR</th>
16766 efrain 984
                           			<th>LABEL_SCHOLARSHIP</th>
15399 efrain 985
                                    <th>LABEL_ACTIONS</th>
986
                                </tr>
987
                            </thead>
988
                            <tbody>
989
                            </tbody>
990
                        </table>
16864 efrain 991
 
992
	 	         </div>
993
	 	     </div>
994
	 	</div>
995
	 	<div class="card-footer text-right">
996
			<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
997
  			<?php if ($allowUpload) : ?>
998
       		<button type="button" class="btn btn-primary btn-upload"><i class="fa fa-upload"></i> LABEL_UPLOAD </button>
999
       		<?php endif; ?>
1000
      		<?php if ($allowAdd) : ?>
1001
         	<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
1002
           	<?php endif; ?>
1003
	 	</div>
1004
	</div>
1005
 
1006
	<div class="card" id="form-row" style="display: none">
1007
	 	<div class="card-header">
1008
	 		<h6 class="card-title">LABEL_CONTACT</h6>
1009
	 	</div>
1010
 
1011
 		<?php
1012
        $form = $this->form;
1013
        $form->setAttributes([
1014
            'method' => 'post',
1015
            'action' => $routeAdd,
1016
            'name' => 'form',
1017
            'id' => 'form',
1018
        ]);
1019
        $form->prepare();
1020
        echo $this->form()->openTag($form);
1021
        ?>
1022
	 	<div class="card-body">
1023
			<div class="row">
1024
       			<div class="col-6 mt-3">
1025
             		<?php
1026
                    $label = 'LABEL_FIRST_NAME';
1027
                    $field = 'first_name';
15399 efrain 1028
 
16864 efrain 1029
                    $element = $form->get($field);
1030
                    $element->setAttributes(['id' => $field, 'class' => 'form-control']);
1031
                    $element->setOptions(['label' => $label]);
1032
                    echo $this->formLabel($element);
1033
                    echo $this->formText($element);
1034
                ?>
1035
       			</div>
1036
             	<div class="col-6 mt-3">
1037
					<?php
1038
                    $label = 'LABEL_LAST_NAME';
1039
                    $field = 'last_name';
15399 efrain 1040
 
16864 efrain 1041
                    $element = $form->get($field);
1042
                    $element->setAttributes(['id' => $field, 'class' => 'form-control']);
1043
                    $element->setOptions(['label' => $label]);
1044
                    echo $this->formLabel($element);
1045
                    echo $this->formText($element);
1046
                    ?>
1047
            	</div>
1048
         	</div>
1049
			<div class="row">
1050
           		<div class="col-6 mt-3">
1051
              		<?php
1052
                        $label = 'LABEL_CORPORATE_EMAIL';
1053
                        $field = 'corporate_email';
15532 stevensc 1054
 
16864 efrain 1055
                        $element = $form->get($field);
1056
                        $element->setAttributes(['id' => $field, 'class' => 'form-control']);
1057
                        $element->setOptions(['label' => $label]);
1058
                        echo $this->formLabel($element);
1059
                        echo $this->formText($element);
1060
                    ?>
1061
            	</div>
1062
           		<div class="col-6 mt-3">
1063
                 	<?php
1064
                    $label = 'LABEL_COMPANY';
1065
                    $field = 'company';
15532 stevensc 1066
 
16864 efrain 1067
                    $element = $form->get($field);
1068
                    $element->setAttributes(['id' => $field, 'class' => 'form-control']);
1069
                    $element->setOptions(['label' => $label]);
1070
                    echo $this->formLabel($element);
1071
                    echo $this->formText($element);
1072
                    ?>
1073
            	</div>
1074
         	</div>
1075
       		<div class="row">
1076
             	<div class="col-6 mt-3">
1077
                	<?php
1078
                    $label = 'LABEL_POSITION';
1079
                    $field = 'position';
15532 stevensc 1080
 
1081
 
16864 efrain 1082
                    $element = $form->get($field);
1083
                    $element->setAttributes(['id' => $field, 'class' => 'form-control']);
1084
                    $element->setOptions(['label' => $label]);
1085
                    echo $this->formLabel($element);
1086
                    echo $this->formText($element);
1087
                    ?>
1088
           		</div>
1089
          		<div class="col-6 mt-3">
1090
            		<?php
1091
                    $label = 'LABEL_SECTOR';
1092
                    $field = 'sector';
15532 stevensc 1093
 
16864 efrain 1094
                    $element = $form->get($field);
1095
                    $element->setAttributes(['id' => $field, 'class' => 'form-control']);
1096
                    $element->setOptions(['label' => $label]);
1097
                    echo $this->formLabel($element);
1098
                    echo '<br>';
1099
                    echo $this->formText($element);
1100
                    ?>
1101
           		</div>
1102
       		</div>
1103
			<div class="row">
16930 efrain 1104
              	<div class="col-6 mt-3">
16864 efrain 1105
       				<?php
1106
                    $label = 'LABEL_COUNTRY';
1107
                    $field = 'country';
1108
                    $element = $form->get($field);
1109
                    $element->setAttributes(['id' => $field, 'class' => 'form-control']);
1110
                    $element->setOptions(['label' => $label]);
1111
                    echo $this->formLabel($element);
1112
                    echo $this->formText($element);
1113
                    ?>
1114
           		</div>
16930 efrain 1115
                <div class="col-6 mt-3">
16864 efrain 1116
             		<?php
1117
                    $label = 'LABEL_STATE';
1118
                    $field = 'state';
15532 stevensc 1119
 
1120
 
16864 efrain 1121
                    $element = $form->get($field);
1122
                    $element->setAttributes(['id' => $field, 'class' => 'form-control']);
1123
                    $element->setOptions(['label' => $label]);
1124
                    echo $this->formLabel($element);
1125
                    echo $this->formText($element);
1126
                    ?>
1127
              	</div>
1128
        	</div>
1129
			<div class="row">
16930 efrain 1130
               	<div class="col-6 mt-3">
16864 efrain 1131
                 	 <?php
1132
                    $label = 'LABEL_CITY';
1133
                    $field = 'city';
15831 efrain 1134
 
16864 efrain 1135
                    $element = $form->get($field);
1136
                    $element->setAttributes(['id' => $field, 'class' => 'form-control']);
1137
                    $element->setOptions(['label' => $label]);
1138
                    echo $this->formLabel($element);
1139
                    echo $this->formText($element);
1140
                    ?>
1141
           		</div>
16930 efrain 1142
       			<div class="col-6 mt-3">
16864 efrain 1143
                	<?php
1144
                    $label = 'LABEL_PHONE';
1145
                    $field = 'phone';
15399 efrain 1146
 
16864 efrain 1147
                    $element = $form->get($field);
1148
                    $element->setAttributes(['id' => $field, 'class' => 'form-control']);
1149
                    $element->setOptions(['label' => $label]);
1150
                    echo $this->formLabel($element);
1151
                    echo '<br>';
1152
                    echo $this->formText($element);
1153
                    ?>
1154
            	</div>
1155
            </div>
1156
     		<div class="row">
16930 efrain 1157
        		 <div class="col-6 mt-3">
16864 efrain 1158
                 	<?php
1159
                    $label = 'LABEL_PHONE_EXTENSION';
1160
                    $field = 'phone_extension';
15532 stevensc 1161
 
1162
 
16864 efrain 1163
                    $element = $form->get($field);
1164
                    $element->setAttributes(['id' => $field, 'class' => 'form-control']);
1165
                    $element->setOptions(['label' => $label]);
15532 stevensc 1166
 
16864 efrain 1167
                    echo $this->formLabel($element);
1168
                    echo $this->formText($element);
1169
                    ?>
1170
           		</div>
1171
 
16930 efrain 1172
        		<div class="col-6 mt-3">
16864 efrain 1173
                	<?php
1174
                    $label = 'LABEL_PERSONAL_EMAIL';
1175
                    $field = 'personal_email';
15532 stevensc 1176
 
1177
 
16864 efrain 1178
                    $element = $form->get($field);
1179
                    $element->setAttributes(['id' => $field, 'class' => 'form-control']);
1180
                    $element->setOptions(['label' => $label]);
1181
                    echo $this->formLabel($element);
1182
                    echo $this->formText($element);
1183
                    ?>
1184
              	</div>
1185
     		</div>
1186
          	<div class="row">
1187
            	<div class="col-sm-6">
1188
              		<?php
1189
                    $label = 'LABEL_CELULAR';
1190
                    $field = 'celular';
15532 stevensc 1191
 
16864 efrain 1192
                    $element = $form->get($field);
1193
                    $element->setAttributes(['id' => $field, 'class' => 'form-control']);
1194
                    $element->setOptions(['label' => $label]);
1195
                    echo $this->formLabel($element);
1196
                    echo '<br/>';
1197
                    echo $this->formText($element);
1198
                    ?>
1199
            	</div>
16930 efrain 1200
                <div class="col-6 mt-3">
16864 efrain 1201
               		<?php
1202
                    $label = 'LABEL_WHATSAPP';
1203
                    $field = 'whatsapp';
15532 stevensc 1204
 
16864 efrain 1205
                    $element = $form->get($field);
1206
                    $element->setAttributes(['id' => $field, 'class' => 'form-control']);
1207
                    $element->setOptions(['label' => $label]);
1208
                    echo $this->formLabel($element);
1209
                    echo '<br/>';
1210
                    echo $this->formText($element);
1211
                    ?>
1212
             	</div>
1213
        	</div>
1214
     		<div class="row">
16930 efrain 1215
      			<div class="col-6 mt-3">
16864 efrain 1216
            		<?php
1217
                    $label = 'LABEL_LINKEDIN';
1218
                    $field = 'linkedin';
15532 stevensc 1219
 
16864 efrain 1220
                    $element = $form->get($field);
1221
                    $element->setAttributes(['id' => $field, 'class' => 'form-control']);
1222
                    $element->setOptions(['label' => $label]);
1223
                    echo $this->formLabel($element);
1224
                    echo $this->formText($element);
1225
                    ?>
1226
               	 </div>
16930 efrain 1227
                 <div class="col-6 mt-3">
16864 efrain 1228
              		<?php
1229
                    $label = 'LABEL_SCHOLARSHIP';
1230
                    $field = 'scholarship';
15532 stevensc 1231
 
16864 efrain 1232
                    $element = $form->get($field);
1233
                    $element->setAttributes(['id' => $field, 'class' => 'form-control']);
1234
                    $element->setOptions(['label' => $label]);
1235
                    echo $this->formLabel($element);
1236
                    echo $this->formSelect($element);
1237
                    ?>
1238
            	</div>
1239
          	</div>
15532 stevensc 1240
 
16864 efrain 1241
	 	</div>
1242
	 	<div class="card-footer text-right">
1243
 			<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
1244
       		<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
1245
	 	</div>
1246
 
1247
	 	<?php echo $this->form()->closeTag($form); ?>
1248
	</div>
1249
 
1250
 
1251
 
1252
 
1253
	<div class="card"  id="interactions-row" style="display: none">
1254
	 	<div class="card-header">
1255
	 		<h6 class="card-title">LABEL_CONTACT</h6>
1256
	 	</div>
1257
	 	<div class="card-body">
1258
	 	<?php
1259
                            $col = 0;
15532 stevensc 1260
                            $fields = [
1261
                                'LABEL_FIRST_NAME' => 'interactions-first_name',
1262
                                'LABEL_LAST_NAME' => 'interactions-last_name',
1263
                                'LABEL_CORPORATE_EMAIL' => 'interactions-corporate_email',
1264
                                'LABEL_COMPANY' => 'interactions-company',
1265
                                'LABEL_POSITION' => 'interactions-position',
1266
                                'LABEL_COUNTRY' => 'interactions-country',
1267
                                'LABEL_STATE' => 'interactions-state',
1268
                                'LABEL_CITY' => 'interactions-city',
1269
                                'LABEL_PHONE' => 'interactions-phone',
1270
                                'LABEL_PHONE_EXTENSION' => 'interactions-phone_extension',
1271
                                'LABEL_PERSONAL_EMAIL' => 'interactions-personal_email',
1272
                                'LABEL_CELULAR' => 'interactions-celular',
1273
                                'LABEL_WHATSAPP' => 'interactions-whatsapp',
1274
                                'LABEL_LINKEDIN' => 'interactions-linkedin',
16766 efrain 1275
                                'LABEL_SCHOLARSHIP' => 'interactions-scholarship',
15532 stevensc 1276
 
1277
 
1278
                            ];
1279
                            foreach ($fields as $label => $field) :
1280
 
16864 efrain 1281
                            if(0 == $col):
15532 stevensc 1282
                            ?>
16864 efrain 1283
                            <div class="row">
1284
                            <?php endif; $col++; ?>
15532 stevensc 1285
 
16930 efrain 1286
                                <div class="col-6 mt-3">
1287
 
15532 stevensc 1288
                                        <label for="<?php echo $field ?>"><?php echo $label ?></label>
1289
                                        <input type="text" id="<?php echo $field ?>" class="form-control" value="" readonly="readonly" />
16930 efrain 1290
 
15532 stevensc 1291
                                </div>
1292
 
16864 efrain 1293
                            <?php if($col == 2) : ?>
1294
 
1295
                            </div>
1296
                            <?php $col = 0; endif; ?>
1297
                            <?php  endforeach; ?>
1298
 
1299
	 		<div class="row">
1300
	 	         <div class="col-12 mt-3">
1301
 
1302
    	 	         <ul class="nav nav-tabs" id="myTab" role="tablist">
1303
                      <li class="nav-item">
1304
                        <a class="nav-link active" id="discovery-contacts-tabs-interactions-tab" data-bs-toggle="tab" href="#discovery-contacts-tabs-interactions" role="tab" aria-controls="discovery-contacts-tabs-interactions" aria-selected="true">LABEL_INTERACTIONS</a>
1305
                      </li>
1306
                      <li class="nav-item">
1307
                        <a class="nav-link" id="discovery-contacts-tabs-logs-tab" data-bs-toggle="tab" href="#discovery-contacts-tabs-logs" role="tab" aria-controls="discovery-contacts-tabs-logs" aria-selected="false">LABEL_LOGS</a>
1308
                      </li>
15399 efrain 1309
 
16864 efrain 1310
                    </ul>
1311
                    <div class="tab-content border border-top-0 p-3" id="myTabContent">
1312
                      <div class="tab-pane fade show active" id="discovery-contacts-tabs-interactions" role="tabpanel" aria-labelledby="discovery-contacts-tabs-interactions-tab">
1313
                      	<div class="row">
1314
                      		<div class="col-12 mt-3">
16912 efrain 1315
                      		 	<table class="table  table-bordered">
15532 stevensc 1316
                                    <thead>
15399 efrain 1317
                                        <tr>
1318
                                            <th>LABEL_FIRST_NAME</th>
1319
                                            <th>LABEL_LAST_NAME</th>
1320
                                            <th>LABEL_EMAIL</th>
1321
                                            <th>LABEL_DATE</th>
1322
                                            <th>LABEL_ACTIONS</th>
1323
                                        </tr>
1324
                                    </thead>
1325
                                    <tbody id="grid-discovery-contacts-tabs-interactions">
1326
                                    </tbody>
15532 stevensc 1327
                                </table>
16864 efrain 1328
 
1329
                      		</div>
1330
                      	</div>
1331
                     	<div class="row">
1332
                      		<div class="col-12 mt-3">
1333
                      			<ul id="discovery-contacts-pagination-interactions" class="pagination pagination-sm m-0 float-right">
15532 stevensc 1334
 
1335
                                </ul>
16864 efrain 1336
                      		</div>
1337
                      	</div>
1338
                      </div>
1339
 
1340
                      <div class="tab-pane fade" id="discovery-contacts-tabs-logs" role="tabpanel" aria-labelledby="discovery-contacts-tabs-logs-tab">
1341
                     	<div class="row">
1342
                      		<div class="col-12 mt-3">
16912 efrain 1343
                      			<table class="table  table-bordered">
15532 stevensc 1344
                                    <thead>
15399 efrain 1345
                                        <tr>
1346
                                            <th>LABEL_FIRST_NAME</th>
1347
                                            <th>LABEL_LAST_NAME</th>
1348
                                            <th>LABEL_EMAIL</th>
1349
                                            <th>LABEL_ACTIVITY</th>
1350
                                        </tr>
1351
                                    </thead>
1352
                                    <tbody id="grid-discovery-contacts-tabs-logs">
1353
                                    </tbody>
15532 stevensc 1354
                                </table>
16864 efrain 1355
                          	</div>
1356
                      	</div>
1357
                     	<div class="row">
1358
                      		<div class="col-12 mt-3">
15532 stevensc 1359
                                <ul id="discovery-contacts-pagination-logs" class="pagination pagination-sm m-0 float-right">
15399 efrain 1360
 
15532 stevensc 1361
                                </ul>
16864 efrain 1362
                      		</div>
1363
                      	</div>
1364
                      </div>
1365
 
15532 stevensc 1366
                    </div>
16864 efrain 1367
 
1368
	 	         </div>
1369
	 	     </div>
1370
	 	</div>
1371
	 	<div class="card-footer text-right">
1372
 
1373
	 	</div>
1374
	</div>
1375
</div>
15532 stevensc 1376
 
1377
 
1378
 
15399 efrain 1379
 
16864 efrain 1380
 
1381
 
1382
 
1383
 
15399 efrain 1384
<!-- The Modal -->
1385
<div class="modal" id="modal-interaction">
1386
    <div class="modal-dialog  modal-xl">
1387
        <div class="modal-content">
1388
 
1389
            <!-- Modal Header -->
1390
            <div class="modal-header">
16845 efrain 1391
                <h6 class="modal-title">LABEL_INTERACTION</h6>
16822 efrain 1392
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
15399 efrain 1393
            </div>
1394
 
16864 efrain 1395
<?php
15399 efrain 1396
                $form = $this->formInteraction;
1397
                $form->setAttributes([
1398
                    'method'    => 'post',
1399
                    'name'      => 'form-interaction',
1400
                    'id'        => 'form-interaction'
1401
                ]);
1402
 
1403
                $form->prepare();
1404
                echo $this->form()->openTag($form);
1405
                ?>
16864 efrain 1406
            <div class="modal-body">
1407
 
1408
                <div class="row">
1409
                	<div class="col-12 mt-3">
15399 efrain 1410
                    <?php
1411
                    $element = $form->get('interaction_type_id');
1412
                    $element->setOptions(['label' => 'LABEL_INTERACTION_TYPE']);
1413
                    $element->setAttributes(['class' => 'form-control']);
15532 stevensc 1414
 
15399 efrain 1415
                    echo $this->formLabel($element);
1416
                    echo $this->formSelect($element);
1417
                    ?>
16864 efrain 1418
                    </div>
15399 efrain 1419
                </div>
15532 stevensc 1420
 
16864 efrain 1421
                <div class="row">
1422
                	<div class="col-12 mt-3">
15399 efrain 1423
                    <?php
1424
                    $element = $form->get('notes');
1425
                    $element->setOptions(['label' => 'LABEL_NOTES']);
1426
                    $element->setAttributes(['class' => 'form-control']);
1427
 
1428
                    echo $this->formLabel($element);
1429
                    echo $this->formTextArea($element);
1430
                    ?>
16864 efrain 1431
                    </div>
15399 efrain 1432
                </div>
15532 stevensc 1433
 
16864 efrain 1434
 
1435
            </div>
1436
 
1437
        	<div class="modal-footer text-right">
15399 efrain 1438
                    <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
1439
                    <button type="button" class="btn btn-light btn-cancel-interaction">LABEL_CANCEL</button>
1440
                </div>
1441
                <?php echo $this->form()->closeTag($form); ?>
1442
        </div>
1443
    </div>
1444
</div>
1445
 
1446
 
15546 efrain 1447
<!-- The Modal -->
1448
<div class="modal" id="modalContactUpload">
15624 anderson 1449
    <div class="modal-dialog  modal-xl">
1450
        <div class="modal-content">
15399 efrain 1451
 
15546 efrain 1452
            <!-- Modal Header -->
15624 anderson 1453
            <div class="modal-header">
16845 efrain 1454
                <h6 class="modal-title">LABEL_UPLOAD</h6>
16822 efrain 1455
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
15624 anderson 1456
            </div>
15546 efrain 1457
 
16864 efrain 1458
  				<?php
15624 anderson 1459
                $form = $this->contactUploadForm;
1460
                $form->setAttributes([
1461
                    'method'    => 'post',
1462
                    'name'      => 'form-contact-upload',
1463
                    'id'        => 'form-contact-upload'
1464
                ]);
15546 efrain 1465
 
15624 anderson 1466
                $form->prepare();
1467
                echo $this->form()->openTag($form);
1468
                ?>
16864 efrain 1469
 
1470
            <div class="modal-body">
1471
 
15624 anderson 1472
 
16864 efrain 1473
                <div class="row">
1474
                	<div class="col-12 mt-3">
15624 anderson 1475
 
16864 efrain 1476
 
15624 anderson 1477
                        <?php
16864 efrain 1478
                        $element = $form->get('file');
1479
                        $element->setOptions(['label' => 'LABEL_EXCEL']);
1480
                        echo $this->formLabel($element);
15546 efrain 1481
                        ?>
16864 efrain 1482
                        <div class="file-loading">
1483
                            <?php
1484
                            $element->setAttributes(['class' => 'form-control', 'accept' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel']);
1485
                            echo $this->formFile($element);
1486
                            ?>
1487
                        </div>
15624 anderson 1488
                    </div>
16864 efrain 1489
              	</div>
15546 efrain 1490
 
1491
 
15624 anderson 1492
            </div>
1493
 
15546 efrain 1494
            <!-- Modal footer -->
16891 efrain 1495
            <div class="modal-footer text-right">
16864 efrain 1496
	            <button type="submit" class="btn btn-primary">LABEL_UPLOAD</button>
1497
 
15624 anderson 1498
                <button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
1499
            </div>
16864 efrain 1500
   			<?php echo $this->form()->closeTag($form); ?>
1501
 
15546 efrain 1502
 
15624 anderson 1503
        </div>
1504
    </div>
1505
</div>
15546 efrain 1506
 
1507
 
1508
 
1509
<!-- The Modal -->
1510
<div class="modal" id="modalContactUploadTable">
15624 anderson 1511
    <div class="modal-dialog modal-xl">
1512
        <div class="modal-content">
15546 efrain 1513
 
1514
            <!-- Modal Header -->
15624 anderson 1515
            <div class="modal-header">
16845 efrain 1516
                <h6 class="modal-title">LABEL_CONTACTS</h6>
16822 efrain 1517
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
15624 anderson 1518
            </div>
15546 efrain 1519
 
1520
            <!-- Modal body -->
16454 anderson 1521
            <div class="modal-body">
1522
                <form>
1523
                    <input type="hidden" name="table-upload-contacts-key" id="table-upload-contacts-key">
1524
                </form>
16864 efrain 1525
 
1526
                <div class="row">
1527
                	<div class="col-12 mt-3">
1528
 
1529
 
1530
                        <div id="table-wrapper">
1531
                            <table id="gridTableUploadContacts" class="table table-bordered">
1532
                                <thead>
1533
                                    <tr>
1534
                                        <th>LABEL_FIRST_NAME</th>
1535
                                        <th>LABEL_LAST_NAME</th>
1536
                                        <th>LABEL_PERSONAL_EMAIL</th>
1537
                                        <th>LABEL_CORPORATE_EMAIL</th>
1538
                                        <th>LABEL_COMPANY</th>
1539
                                        <th>LABEL_POSITION</th>
1540
                                        <th>LABEL_SECTOR</th>
1541
                                        <th>LABEL_COUNTRY</th>
1542
                                        <th>LABEL_STATE</th>
1543
                                        <th>LABEL_CITY</th>
1544
                                        <th>LABEL_PHONE</th>
1545
                                        <th>LABEL_PHONE_EXTENSION</th>
1546
                                        <th>LABEL_CELULAR</th>
1547
                                        <th>LABEL_WHATSAPP</th>
1548
                                        <th>LABEL_LINKEDIN</th>
1549
            							<th>LABEL_SECTOR</th>
1550
                      					<th>LABEL_SCHOLARSHIP</th>
1551
                                    </tr>
1552
                                </thead>
1553
                                <tbody>
1554
                                </tbody>
1555
                            </table>
1556
                        </div>
1557
 
1558
                	</div>
1559
 
1560
                </div>
16454 anderson 1561
 
1562
 
1563
 
15546 efrain 1564
 
15624 anderson 1565
            </div>
1566
 
15546 efrain 1567
            <!-- Modal footer -->
16891 efrain 1568
            <div class="modal-footer text-right">
15624 anderson 1569
                <button type="submit" class="btn btn-primary btn-upload-contacts-step2">LABEL_SAVE</button>
1570
                <button type="button" class="btn btn-danger" data-dismiss="modal">LABEL_CLOSE</button>
1571
            </div>
15546 efrain 1572
 
15624 anderson 1573
        </div>
1574
    </div>
1575
</div>
15546 efrain 1576
 
1577
 
15399 efrain 1578
<script id="interactionTemplate" type="text/x-jsrender">
1579
    {{for items}}
15532 stevensc 1580
    <tr>
1581
        <td>{{>first_name}}</td>
1582
        <td>{{>last_name}}</td>
1583
        <td>{{>email}}</td>
1584
        <td> {{>added_on}}</td>
1585
        <td>
1586
            <button class="btn btn-danger btn-delete-interaction" data-href="{{>link_delete}}" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button>
1587
        </td>
1588
    </tr>
1589
    <tr>
1590
        <td colspan="2">
1591
            {{>name}}
1592
        </td>
1593
        <td colspan="3">
1594
            {{>notes}}
1595
        </td>
1596
    </tr>
15399 efrain 1597
    {{/for}}
1598
</script>
1599
 
1600
 
1601
<script id="logTemplate" type="text/x-jsrender">
1602
    {{for items}}
15532 stevensc 1603
    <tr>
1604
        <td>{{>first_name}}</td>
1605
        <td>{{>last_name}}</td>
1606
        <td>{{>email}}</td>
15533 stevensc 1607
        <td>
15534 stevensc 1608
            {{>activity}} -
1609
            {{>added_on}}
15532 stevensc 1610
        </td>
15533 stevensc 1611
    </tr>
15532 stevensc 1612
 
15533 stevensc 1613
    <tr>
1614
        <td>
1615
        </td>
1616
        <td>
1617
        </td>
1618
        <td>
1619
        </td>
1620
 
1621
        <td>
15532 stevensc 1622
            {{>details}}
1623
        </td>
15533 stevensc 1624
    </tr>
15532 stevensc 1625
 
15399 efrain 1626
    {{/for}}
1627
</script>
1628
 
15546 efrain 1629
 
1630
<script id="uploadContactTemplate" type="text/x-jsrender">
1631
    {{for items}}
1632
    <tr>
1633
        <td>{{>first_name}}</td>
1634
        <td>{{>last_name}}</td>
1635
        <td>{{>email_personal}}</td>
1636
        <td>{{>email_company}}</td>
1637
        <td>{{>company}}</td>
1638
        <td>{{>position}}</td>
15831 efrain 1639
        <td>{{>sector}}</td>
15546 efrain 1640
        <td>{{>country}}</td>
1641
        <td>{{>state}}</td>
1642
        <td>{{>city}}</td>
1643
        <td>{{>phone}}</td>
1644
        <td>{{>extension}}</td>
1645
        <td>{{>movil}}</td>
1646
        <td>{{>whatsapp}}</td>
1647
        <td>{{>linkedin}}</td>
16766 efrain 1648
        <td>{{>sector}}</td>
1649
        <td>{{>scholarship}}</td>
15546 efrain 1650
    </tr>
1651
 
1652
 
1653
    {{/for}}
1654
</script>
1655
 
15399 efrain 1656
<script id="logPaginationTemplate" type="text/x-jsrender">
1657
    {{if has_previous_page}}
15532 stevensc 1658
    <li class="page-item"><a class="page-link class-btn-log-previous" href="#"> <i class="fa fa-chevron-left" aria-hidden="true"></i> LABEL_PREVIOUS </a></li>
15399 efrain 1659
    {{/if}}
1660
 
1661
    {{if has_next_page}}
15532 stevensc 1662
    <li class="page-item"><a class="page-link class-btn-log-next" href="#"> LABEL_NEXT <i class="fa fa-chevron-right" aria-hidden="true"></i> </a></li>
15399 efrain 1663
    {{/if}}
1664
</script>
1665
 
1666
<script id="interactionPaginationTemplate" type="text/x-jsrender">
1667
    {{if has_previous_page}}
15532 stevensc 1668
    <li class="page-item"><a class="page-link class-btn-interaction-previous" href="#"> <i class="fa fa-chevron-left" aria-hidden="true"></i> LABEL_PREVIOUS </a></li>
15399 efrain 1669
    {{/if}}
1670
 
1671
    {{if has_next_page}}
15532 stevensc 1672
    <li class="page-item"><a class="page-link class-btn-interaction-next" href="#"> LABEL_NEXT <i class="fa fa-chevron-right" aria-hidden="true"></i> </a></li>
15399 efrain 1673
    {{/if}}
1674
</script>