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');
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
$allowInteractionAdd = $acl->isAllowed($roleName, 'discovery-contacts/interactions/add') ? 1 : 0;
|
|
|
13 |
|
|
|
14 |
$allowAdd = $acl->isAllowed($roleName, 'discovery-contacts/add') ? 1 : 0;
|
|
|
15 |
$allowEdit = $acl->isAllowed($roleName, 'discovery-contacts/edit') ? 1 : 0;
|
|
|
16 |
$allowDelete = $acl->isAllowed($roleName, 'discovery-contacts/delete',) ? 1 : 0;
|
|
|
17 |
$allowView = $acl->isAllowed($roleName, 'discovery-contacts/view',) ? 1 : 0;
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
|
|
|
21 |
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
|
|
|
22 |
|
|
|
23 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
|
|
|
24 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
|
|
|
25 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
|
|
|
26 |
|
|
|
27 |
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
|
|
|
28 |
|
|
|
29 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
|
|
|
30 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
|
|
|
34 |
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
|
|
|
35 |
|
|
|
36 |
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
|
|
|
37 |
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
|
|
|
38 |
|
|
|
39 |
$this->headLink()->appendStylesheet($this->basePath('plugins/intl-tel-input/build/css/intlTelInput.css'));
|
|
|
40 |
$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');
|
|
|
42 |
|
|
|
43 |
$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.min.js'));
|
|
|
44 |
|
|
|
45 |
$this->inlineScript()->captureStart();
|
|
|
46 |
echo <<<JS
|
|
|
47 |
jQuery( document ).ready(function( $ ) {
|
|
|
48 |
|
|
|
49 |
|
|
|
50 |
$.validator.addMethod("isIntlPhoneNumber", function(value, element) {
|
|
|
51 |
if(!value || value.length == '') {
|
|
|
52 |
return true;
|
|
|
53 |
} else {
|
|
|
54 |
return $(element).intlTelInput('isValidNumber');
|
|
|
55 |
}
|
|
|
56 |
}, 'ERROR_INTERNATIONAL_PHONE_FORMAT_IS_INVALID');
|
|
|
57 |
|
|
|
58 |
$.validator.setDefaults({
|
|
|
59 |
debug: true,
|
|
|
60 |
highlight: function(element) {
|
|
|
61 |
$(element).addClass('is-invalid');
|
|
|
62 |
},
|
|
|
63 |
unhighlight: function(element) {
|
|
|
64 |
$(element).removeClass('is-invalid');
|
|
|
65 |
},
|
|
|
66 |
errorElement: 'span',
|
|
|
67 |
errorClass: 'error invalid-feedback',
|
|
|
68 |
errorPlacement: function(error, element) {
|
|
|
69 |
if(element.parent('.form-group').length) {
|
|
|
70 |
error.insertAfter(element);
|
|
|
71 |
} else if(element.parent('.toggle').length) {
|
|
|
72 |
error.insertAfter(element.parent().parent());
|
|
|
73 |
} else {
|
|
|
74 |
error.insertAfter(element.parent());
|
|
|
75 |
}
|
|
|
76 |
}
|
|
|
77 |
});
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
|
82 |
$.fn.showFormErrorValidator = function(fieldname, errors) {
|
|
|
83 |
var field = $(fieldname);
|
|
|
84 |
if(field) {
|
|
|
85 |
$(field).addClass('is-invalid');
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
var error = $('<span id="' + fieldname +'-error" class="error invalid-feedback">' + errors + '</div>');
|
|
|
89 |
if(field.parent('.form-group').length) {
|
|
|
90 |
error.insertAfter(field);
|
|
|
91 |
} else if(field.parent('.toggle').length) {
|
|
|
92 |
error.insertAfter(field.parent().parent());
|
|
|
93 |
} else {
|
|
|
94 |
error.insertAfter(field.parent());
|
|
|
95 |
}
|
|
|
96 |
}
|
|
|
97 |
};
|
|
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
|
102 |
var allowEdit = $allowEdit;
|
|
|
103 |
var allowDelete = $allowDelete;
|
|
|
104 |
var allowView = $allowView;
|
|
|
105 |
|
|
|
106 |
var linkInteractions = '';
|
|
|
107 |
var linkInteractionsAdd = '';
|
|
|
108 |
var linkLogs = '';
|
|
|
109 |
|
|
|
110 |
var pageInteractions = 0;
|
|
|
111 |
var pageLogs = 0;
|
|
|
112 |
|
|
|
113 |
|
|
|
114 |
$.fn.loadLogs = function() {
|
|
|
115 |
NProgress.start();
|
|
|
116 |
var action = $(this).data('href');
|
|
|
117 |
|
|
|
118 |
$.ajax({
|
|
|
119 |
'dataType' : 'json',
|
|
|
120 |
'method' : 'get',
|
|
|
121 |
'url' : linkLogs,
|
|
|
122 |
'data' : {
|
|
|
123 |
'page' : pageLogs
|
|
|
124 |
}
|
|
|
125 |
}).done(function(response) {
|
|
|
126 |
if(response['success']) {
|
|
|
127 |
|
|
|
128 |
pagination = {
|
|
|
129 |
has_previous_page : response['data']['current']['page'] > 1,
|
|
|
130 |
has_next_page : response['data']['current']['page'] < response['data']['total']['page'],
|
|
|
131 |
}
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
if(pageLogs > response['data']['total']['page']) {
|
|
|
135 |
pageLogs = response['data']['total']['page'];
|
|
|
136 |
}
|
|
|
137 |
|
|
|
138 |
$('#discovery-contacts-pagination-logs').empty();
|
|
|
139 |
$('#discovery-contacts-pagination-logs').append($('#logPaginationTemplate').render(pagination));
|
|
|
140 |
|
|
|
141 |
|
|
|
142 |
$('#grid-discovery-contacts-tabs-logs').empty();
|
|
|
143 |
$('#grid-discovery-contacts-tabs-logs').append(
|
|
|
144 |
$('#logTemplate').render(response['data']['current'])
|
|
|
145 |
);
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
|
149 |
} else {
|
|
|
150 |
$.fn.showError(response['data']);
|
|
|
151 |
}
|
|
|
152 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
153 |
$.fn.showError(textStatus);
|
|
|
154 |
}).always(function() {
|
|
|
155 |
NProgress.done();
|
|
|
156 |
});
|
|
|
157 |
|
|
|
158 |
};
|
|
|
159 |
|
|
|
160 |
$.fn.loadInteractions = function() {
|
|
|
161 |
NProgress.start();
|
|
|
162 |
|
|
|
163 |
$.ajax({
|
|
|
164 |
'dataType' : 'json',
|
|
|
165 |
'method' : 'get',
|
|
|
166 |
'url' : linkInteractions,
|
|
|
167 |
'data' : {
|
|
|
168 |
'page' : pageInteractions
|
|
|
169 |
}
|
|
|
170 |
}).done(function(response) {
|
|
|
171 |
if(response['success']) {
|
|
|
172 |
|
|
|
173 |
pagination = {
|
|
|
174 |
has_previous_page : response['data']['current']['page'] > 1,
|
|
|
175 |
has_next_page : response['data']['current']['page'] < response['data']['total']['page'],
|
|
|
176 |
}
|
|
|
177 |
|
|
|
178 |
if(pageInteractions > response['data']['total']['page']) {
|
|
|
179 |
pageInteractions = response['data']['total']['page'];
|
|
|
180 |
}
|
|
|
181 |
|
|
|
182 |
$('#discovery-contacts-pagination-interactions').empty();
|
|
|
183 |
$('#discovery-contacts-pagination-interactions').append($('#interactionPaginationTemplate').render(pagination));
|
|
|
184 |
|
|
|
185 |
|
|
|
186 |
$('#grid-discovery-contacts-tabs-interactions').empty();
|
|
|
187 |
$('#grid-discovery-contacts-tabs-interactions').append(
|
|
|
188 |
$('#interactionTemplate').render(response['data']['current'])
|
|
|
189 |
);
|
|
|
190 |
|
|
|
191 |
|
|
|
192 |
|
|
|
193 |
|
|
|
194 |
|
|
|
195 |
} else {
|
|
|
196 |
$.fn.showError(response['data']);
|
|
|
197 |
}
|
|
|
198 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
199 |
$.fn.showError(textStatus);
|
|
|
200 |
}).always(function() {
|
|
|
201 |
NProgress.done();
|
|
|
202 |
});
|
|
|
203 |
|
|
|
204 |
};
|
|
|
205 |
|
|
|
206 |
var gridTable = $('#gridTable').dataTable( {
|
|
|
207 |
'processing': true,
|
|
|
208 |
'serverSide': true,
|
|
|
209 |
'searching': true,
|
|
|
210 |
'order': [[ 0, 'asc' ]],
|
|
|
211 |
'ordering': true,
|
|
|
212 |
'ordenable' : true,
|
|
|
213 |
'responsive': true,
|
|
|
214 |
'select' : false,
|
|
|
215 |
'paging': true,
|
|
|
216 |
'pagingType': 'simple_numbers',
|
|
|
217 |
'ajax': {
|
|
|
218 |
'url' : '$routeDatatable',
|
|
|
219 |
'type' : 'get',
|
|
|
220 |
'beforeSend': function (request) {
|
|
|
221 |
NProgress.start();
|
|
|
222 |
},
|
|
|
223 |
'dataFilter': function(response) {
|
|
|
224 |
var response = jQuery.parseJSON( response );
|
|
|
225 |
|
|
|
226 |
var json = {};
|
|
|
227 |
json.recordsTotal = 0;
|
|
|
228 |
json.recordsFiltered = 0;
|
|
|
229 |
json.data = [];
|
|
|
230 |
|
|
|
231 |
|
|
|
232 |
if(response.success) {
|
|
|
233 |
json.recordsTotal = response.data.total;
|
|
|
234 |
json.recordsFiltered = response.data.total;
|
|
|
235 |
json.data = response.data.items;
|
|
|
236 |
} else {
|
|
|
237 |
$.fn.showError(response.data)
|
|
|
238 |
}
|
|
|
239 |
|
|
|
240 |
return JSON.stringify( json );
|
|
|
241 |
}
|
|
|
242 |
},
|
|
|
243 |
'language' : {
|
|
|
244 |
'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
|
|
|
245 |
'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
|
|
|
246 |
'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
|
|
|
247 |
'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
|
|
|
248 |
'sInfo': 'LABEL_DATATABLE_SINFO',
|
|
|
249 |
'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
|
|
|
250 |
'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
|
|
|
251 |
'sInfoPostFix': '',
|
|
|
252 |
'sSearch': 'LABEL_DATATABLE_SSEARCH',
|
|
|
253 |
'sUrl': '',
|
|
|
254 |
'sInfoThousands': ',',
|
|
|
255 |
'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
|
|
|
256 |
'oPaginate': {
|
|
|
257 |
'sFirst': 'LABEL_DATATABLE_SFIRST',
|
|
|
258 |
'sLast': 'LABEL_DATATABLE_SLAST',
|
|
|
259 |
'sNext': 'LABEL_DATATABLE_SNEXT',
|
|
|
260 |
'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
|
|
|
261 |
},
|
|
|
262 |
'oAria': {
|
|
|
263 |
'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
|
|
|
264 |
'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
|
|
|
265 |
},
|
|
|
266 |
},
|
|
|
267 |
'drawCallback': function( settings ) {
|
|
|
268 |
NProgress.done();
|
|
|
269 |
$('button.btn-delete').confirmation({
|
|
|
270 |
rootSelector: 'button.btn-delete',
|
|
|
271 |
title : 'LABEL_ARE_YOU_SURE',
|
|
|
272 |
singleton : true,
|
|
|
273 |
btnOkLabel: 'LABEL_YES',
|
|
|
274 |
btnCancelLabel: 'LABEL_NO',
|
|
|
275 |
onConfirm: function(value) {
|
|
|
276 |
action = $(this).data('href');
|
|
|
277 |
NProgress.start();
|
|
|
278 |
$.ajax({
|
|
|
279 |
'dataType' : 'json',
|
|
|
280 |
'accept' : 'application/json',
|
|
|
281 |
'method' : 'post',
|
|
|
282 |
'url' : action,
|
|
|
283 |
}).done(function(response) {
|
|
|
284 |
if(response['success']) {
|
|
|
285 |
$.fn.showSuccess(response['data']);
|
|
|
286 |
gridTable.api().ajax.reload(null, false);
|
|
|
287 |
} else {
|
|
|
288 |
$.fn.showError(response['data']);
|
|
|
289 |
}
|
|
|
290 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
291 |
$.fn.showError(textStatus);
|
|
|
292 |
}).always(function() {
|
|
|
293 |
NProgress.done();
|
|
|
294 |
});
|
|
|
295 |
},
|
|
|
296 |
});
|
|
|
297 |
},
|
|
|
298 |
'aoColumns': [
|
|
|
299 |
{ 'mDataProp': 'first_name' },
|
|
|
300 |
{ 'mDataProp': 'last_name' },
|
|
|
301 |
{ 'mDataProp': 'corporate_email' },
|
|
|
302 |
{ 'mDataProp': 'actions' },
|
|
|
303 |
],
|
|
|
304 |
'columnDefs': [
|
|
|
305 |
{
|
|
|
306 |
'targets': -1,
|
|
|
307 |
'orderable': false,
|
|
|
308 |
'render' : function ( data, type, row ) {
|
|
|
309 |
s = '';
|
|
|
310 |
|
|
|
311 |
if(allowEdit && data['link_edit']) {
|
|
|
312 |
s = s + '<button class="btn btn-primary btn-edit" data-href="' + data['link_edit']+ '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button> ';
|
|
|
313 |
}
|
|
|
314 |
if(allowDelete && data['link_delete']) {
|
|
|
315 |
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> ';
|
|
|
316 |
}
|
|
|
317 |
if(allowView && data['link_view']) {
|
|
|
318 |
s = s + '<button class="btn btn-default btn-view" data-href="' + data['link_view']+ '" data-toggle="tooltip" title="LABEL_VIEW"><i class="fa fa-external-link"></i> LABEL_VIEW </button> ';
|
|
|
319 |
}
|
|
|
320 |
return s;
|
|
|
321 |
}
|
|
|
322 |
}
|
|
|
323 |
],
|
|
|
324 |
});
|
|
|
325 |
|
|
|
326 |
|
|
|
327 |
|
|
|
328 |
|
|
|
329 |
var validator = $('#form').validate({
|
|
|
330 |
debug: true,
|
|
|
331 |
onclick: false,
|
|
|
332 |
onkeyup: false,
|
|
|
333 |
ignore: [],
|
|
|
334 |
rules: {
|
|
|
335 |
'first_name': {
|
|
|
336 |
required: true,
|
|
|
337 |
maxlength: 128,
|
|
|
338 |
},
|
|
|
339 |
'last_name': {
|
|
|
340 |
required: true,
|
|
|
341 |
maxlength: 128,
|
|
|
342 |
},
|
|
|
343 |
'corporate_email': {
|
|
|
344 |
required: true,
|
|
|
345 |
maxlength: 250,
|
|
|
346 |
email: true,
|
|
|
347 |
|
|
|
348 |
},
|
|
|
349 |
'company': {
|
|
|
350 |
required: true,
|
|
|
351 |
maxlength: 128,
|
|
|
352 |
},
|
|
|
353 |
'position': {
|
|
|
354 |
required: true,
|
|
|
355 |
maxlength: 128,
|
|
|
356 |
},
|
|
|
357 |
'country': {
|
|
|
358 |
required: true,
|
|
|
359 |
maxlength: 128,
|
|
|
360 |
},
|
|
|
361 |
'state': {
|
|
|
362 |
required: false,
|
|
|
363 |
maxlength: 128,
|
|
|
364 |
},
|
|
|
365 |
'city': {
|
|
|
366 |
required: false,
|
|
|
367 |
maxlength: 128,
|
|
|
368 |
},
|
|
|
369 |
'personal_email': {
|
|
|
370 |
required: false,
|
|
|
371 |
maxlength: 128,
|
|
|
372 |
email: true,
|
|
|
373 |
},
|
|
|
374 |
'phone': {
|
|
|
375 |
required: false,
|
|
|
376 |
maxlength: 25,
|
|
|
377 |
isIntlPhoneNumber: true,
|
|
|
378 |
},
|
|
|
379 |
'phone_extension': {
|
|
|
380 |
required: false,
|
|
|
381 |
maxlength: 5,
|
|
|
382 |
},
|
|
|
383 |
'celular': {
|
|
|
384 |
required: false,
|
|
|
385 |
maxlength: 25,
|
|
|
386 |
isIntlPhoneNumber: true,
|
|
|
387 |
},
|
|
|
388 |
'whatsapp': {
|
|
|
389 |
required: false,
|
|
|
390 |
maxlength: 25,
|
|
|
391 |
isIntlPhoneNumber: true,
|
|
|
392 |
},
|
|
|
393 |
'linkedin': {
|
|
|
394 |
required: false,
|
|
|
395 |
maxlength: 256,
|
|
|
396 |
url: true,
|
|
|
397 |
},
|
|
|
398 |
},
|
|
|
399 |
submitHandler: function(form)
|
|
|
400 |
{
|
|
|
401 |
data = {
|
|
|
402 |
first_name : $('#form #first_name').val(),
|
|
|
403 |
last_name : $('#form #last_name').val(),
|
|
|
404 |
corporate_email : $('#form #corporate_email').val(),
|
|
|
405 |
company : $('#form #company').val(),
|
|
|
406 |
position : $('#form #position').val(),
|
|
|
407 |
country : $('#form #country').val(),
|
|
|
408 |
state : $('#form #state').val(),
|
|
|
409 |
city : $('#form #city').val(),
|
|
|
410 |
personal_email : $('#form #personal_email').val(),
|
|
|
411 |
phone : $('#form #phone').intlTelInput('getNumber'),
|
|
|
412 |
phone_extension : $('#form #phone_extension').val(),
|
|
|
413 |
celular : $('#form #celular').intlTelInput('getNumber'),
|
|
|
414 |
whatsapp : $('#form #whatsapp').intlTelInput('getNumber'),
|
|
|
415 |
linkedin : $('#form #linkedin').val(),
|
|
|
416 |
};
|
|
|
417 |
|
|
|
418 |
$('#modal .btn-primary').attr('disabled', true)
|
|
|
419 |
$.ajax({
|
|
|
420 |
'dataType' : 'json',
|
|
|
421 |
'accept' : 'application/json',
|
|
|
422 |
'method' : 'post',
|
|
|
423 |
'url' : $('#form').attr('action'),
|
|
|
424 |
'data' : data
|
|
|
425 |
}).done(function(response) {
|
|
|
426 |
NProgress.start();
|
|
|
427 |
if(response['success']) {
|
|
|
428 |
$.fn.showSuccess(response['data']);
|
|
|
429 |
|
|
|
430 |
$('#form-row').hide();
|
|
|
431 |
$('#listing-row').show();
|
|
|
432 |
|
|
|
433 |
|
|
|
434 |
|
|
|
435 |
gridTable.api().ajax.reload(null, false);
|
|
|
436 |
} else {
|
|
|
437 |
validator.resetForm();
|
|
|
438 |
if(jQuery.type(response['data']) == 'string') {
|
|
|
439 |
$.fn.showError(response['data']);
|
|
|
440 |
} else {
|
|
|
441 |
$.each(response['data'], function( fieldname, errors ) {
|
|
|
442 |
$.fn.showFormErrorValidator('#form #' + fieldname, errors);
|
|
|
443 |
});
|
|
|
444 |
}
|
|
|
445 |
}
|
|
|
446 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
447 |
$.fn.showError(textStatus);
|
|
|
448 |
}).always(function() {
|
|
|
449 |
NProgress.done();
|
|
|
450 |
$('#modal .btn-primary').removeAttr('disabled')
|
|
|
451 |
});
|
|
|
452 |
return false;
|
|
|
453 |
},
|
|
|
454 |
invalidHandler: function(form, validator) {
|
|
|
455 |
|
|
|
456 |
}
|
|
|
457 |
});
|
|
|
458 |
|
|
|
459 |
var validatorInteraction = $('#form-interaction').validate({
|
|
|
460 |
debug: true,
|
|
|
461 |
onclick: false,
|
|
|
462 |
onkeyup: false,
|
|
|
463 |
ignore: [],
|
|
|
464 |
rules: {
|
|
|
465 |
'notes': {
|
|
|
466 |
required: true,
|
|
|
467 |
},
|
|
|
468 |
'interaction_type_id': {
|
|
|
469 |
required: true,
|
|
|
470 |
|
|
|
471 |
},
|
|
|
472 |
},
|
|
|
473 |
submitHandler: function(form)
|
|
|
474 |
{
|
|
|
475 |
|
|
|
476 |
$.ajax({
|
|
|
477 |
'dataType' : 'json',
|
|
|
478 |
'accept' : 'application/json',
|
|
|
479 |
'method' : 'post',
|
|
|
480 |
'url' : $('#form-interaction').attr('action'),
|
|
|
481 |
'data' : $('#form-interaction').serialize()
|
|
|
482 |
}).done(function(response) {
|
|
|
483 |
NProgress.start();
|
|
|
484 |
if(response['success']) {
|
|
|
485 |
$.fn.showSuccess(response['data']);
|
|
|
486 |
|
|
|
487 |
$('#modal-interaction').modal('hide');
|
|
|
488 |
|
|
|
489 |
|
|
|
490 |
$.fn.loadInteractions();
|
|
|
491 |
$.fn.loadLogs();
|
|
|
492 |
} else {
|
|
|
493 |
validator.resetForm();
|
|
|
494 |
if(jQuery.type(response['data']) == 'string') {
|
|
|
495 |
$.fn.showError(response['data']);
|
|
|
496 |
} else {
|
|
|
497 |
$.each(response['data'], function( fieldname, errors ) {
|
|
|
498 |
$.fn.showFormErrorValidator('#form-interaction #' + fieldname, errors);
|
|
|
499 |
});
|
|
|
500 |
}
|
|
|
501 |
}
|
|
|
502 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
503 |
$.fn.showError(textStatus);
|
|
|
504 |
}).always(function() {
|
|
|
505 |
NProgress.done();
|
|
|
506 |
|
|
|
507 |
});
|
|
|
508 |
return false;
|
|
|
509 |
},
|
|
|
510 |
invalidHandler: function(form, validator) {
|
|
|
511 |
|
|
|
512 |
}
|
|
|
513 |
});
|
|
|
514 |
|
|
|
515 |
$('body').on('click', 'button.btn-add-interaction', function(e) {
|
|
|
516 |
e.preventDefault();
|
|
|
517 |
|
|
|
518 |
$('#form-interaction').attr('action', linkInteractionsAdd);
|
|
|
519 |
$('#form-interaction #notes').val('');
|
|
|
520 |
$('#form-interaction #status').val('');
|
|
|
521 |
|
|
|
522 |
validator.resetForm();
|
|
|
523 |
$('#modal-interaction').modal('show');
|
|
|
524 |
});
|
|
|
525 |
|
|
|
526 |
|
|
|
527 |
$('body').on('click', 'button.btn-cancel-interaction', function(e) {
|
|
|
528 |
e.preventDefault();
|
|
|
529 |
$('#modal-interaction').modal('hide');
|
|
|
530 |
});
|
|
|
531 |
|
|
|
532 |
$('body').on('click', 'button.btn-delete-interaction', function(e) {
|
|
|
533 |
e.preventDefault();
|
|
|
534 |
var action = $(this).data('href');
|
|
|
535 |
NProgress.start();
|
|
|
536 |
$.ajax({
|
|
|
537 |
'dataType' : 'json',
|
|
|
538 |
'accept' : 'application/json',
|
|
|
539 |
'method' : 'post',
|
|
|
540 |
'url' : action,
|
|
|
541 |
}).done(function(response) {
|
|
|
542 |
if(response['success']) {
|
|
|
543 |
$.fn.showSuccess(response['data']);
|
|
|
544 |
|
|
|
545 |
$.fn.loadLogs();
|
|
|
546 |
$.fn.loadInteractions();
|
|
|
547 |
} else {
|
|
|
548 |
$.fn.showError(response['data']);
|
|
|
549 |
}
|
|
|
550 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
551 |
$.fn.showError(textStatus);
|
|
|
552 |
}).always(function() {
|
|
|
553 |
NProgress.done();
|
|
|
554 |
});
|
|
|
555 |
|
|
|
556 |
});
|
|
|
557 |
|
|
|
558 |
|
|
|
559 |
$('body').on('click', 'button.btn-add', function(e) {
|
|
|
560 |
e.preventDefault();
|
|
|
561 |
|
|
|
562 |
$('span[id="form-title"]').html('LABEL_ADD');
|
|
|
563 |
$('#form').attr('action', '$routeAdd');
|
|
|
564 |
$('#form #first_name').val('');
|
|
|
565 |
$('#form #last_name').val('');
|
|
|
566 |
$('#form #corporate_email').val('');
|
|
|
567 |
$('#form #company').val('');
|
|
|
568 |
$('#form #position').val('');
|
|
|
569 |
$('#form #country').val('');
|
|
|
570 |
$('#form #state').val('');
|
|
|
571 |
$('#form #city').val('');
|
|
|
572 |
$('#form #personal_email').val('');
|
|
|
573 |
$('#form #phone').intlTelInput('setNumber', '');
|
|
|
574 |
$('#form #phone_extension').val('');
|
|
|
575 |
$('#form #celular').intlTelInput('setNumber', '');
|
|
|
576 |
$('#form #whatsapp').intlTelInput('setNumber', '');
|
|
|
577 |
$('#form #linkedin').val('');
|
|
|
578 |
|
|
|
579 |
validator.resetForm();
|
|
|
580 |
|
|
|
581 |
|
|
|
582 |
$('#listing-row').hide();
|
|
|
583 |
$('#form-row').show();
|
|
|
584 |
|
|
|
585 |
});
|
|
|
586 |
|
|
|
587 |
$('body').on('click', 'button.btn-edit', function(e) {
|
|
|
588 |
e.preventDefault();
|
|
|
589 |
NProgress.start();
|
|
|
590 |
var action = $(this).data('href');
|
|
|
591 |
|
|
|
592 |
$.ajax({
|
|
|
593 |
'dataType' : 'json',
|
|
|
594 |
'method' : 'get',
|
|
|
595 |
'url' : action,
|
|
|
596 |
}).done(function(response) {
|
|
|
597 |
if(response['success']) {
|
|
|
598 |
|
|
|
599 |
$('span[id="form-title"]').html('LABEL_EDIT');
|
|
|
600 |
$('#form').attr('action', action);
|
|
|
601 |
$('#form #first_name').val(response['data']['first_name']);
|
|
|
602 |
$('#form #last_name').val(response['data']['last_name']);
|
|
|
603 |
$('#form #corporate_email').val(response['data']['corporate_email']);
|
|
|
604 |
$('#form #company').val(response['data']['company']);
|
|
|
605 |
$('#form #position').val(response['data']['position']);
|
|
|
606 |
$('#form #country').val(response['data']['country']);
|
|
|
607 |
$('#form #state').val(response['data']['state']);
|
|
|
608 |
$('#form #city').val(response['data']['city']);
|
|
|
609 |
$('#form #personal_email').val(response['data']['personal_email']);
|
|
|
610 |
$('#form #phone').intlTelInput('setNumber', response['data']['phone']);
|
|
|
611 |
$('#form #phone_extension').val(response['data']['phone_extension']);
|
|
|
612 |
$('#form #celular').intlTelInput('setNumber', response['data']['celular']);
|
|
|
613 |
$('#form #whatsapp').intlTelInput('setNumber', response['data']['whatsapp']);
|
|
|
614 |
$('#form #linkedin').val(response['data']['linkedin']);
|
|
|
615 |
|
|
|
616 |
validator.resetForm();
|
|
|
617 |
|
|
|
618 |
|
|
|
619 |
$('#listing-row').hide();
|
|
|
620 |
$('#form-row').show();
|
|
|
621 |
} else {
|
|
|
622 |
$.fn.showError(response['data']);
|
|
|
623 |
}
|
|
|
624 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
625 |
$.fn.showError(textStatus);
|
|
|
626 |
}).always(function() {
|
|
|
627 |
NProgress.done();
|
|
|
628 |
});
|
|
|
629 |
});
|
|
|
630 |
|
|
|
631 |
|
|
|
632 |
$('body').on('click', 'a.class-btn-log-previous', function(e) {
|
|
|
633 |
e.preventDefault();
|
|
|
634 |
|
|
|
635 |
if( pageLogs > 1) {
|
|
|
636 |
pageLogs = pageLogs - 1;
|
|
|
637 |
$.fn.loadLogs();
|
|
|
638 |
|
|
|
639 |
}
|
|
|
640 |
});
|
|
|
641 |
|
|
|
642 |
$('body').on('click', 'a.class-btn-log-next', function(e) {
|
|
|
643 |
e.preventDefault();
|
|
|
644 |
pageLogs = pageLogs + 1;
|
|
|
645 |
$.fn.loadLogs();
|
|
|
646 |
});
|
|
|
647 |
|
|
|
648 |
$('body').on('click', 'a.class-btn-interaction-previous', function(e) {
|
|
|
649 |
e.preventDefault();
|
|
|
650 |
|
|
|
651 |
if( pageInteractions > 1) {
|
|
|
652 |
pageInteractions = v - 1;
|
|
|
653 |
$.fn.loadInteractions();
|
|
|
654 |
|
|
|
655 |
}
|
|
|
656 |
});
|
|
|
657 |
|
|
|
658 |
$('body').on('click', 'a.class-btn-interaction-next', function(e) {
|
|
|
659 |
e.preventDefault();
|
|
|
660 |
pageInteractions = pageInteractions + 1;
|
|
|
661 |
$.fn.loadInteractions();
|
|
|
662 |
});
|
|
|
663 |
|
|
|
664 |
$('body').on('click', 'button.btn-view', function(e) {
|
|
|
665 |
e.preventDefault();
|
|
|
666 |
NProgress.start();
|
|
|
667 |
var action = $(this).data('href');
|
|
|
668 |
|
|
|
669 |
$.ajax({
|
|
|
670 |
'dataType' : 'json',
|
|
|
671 |
'method' : 'get',
|
|
|
672 |
'url' : action,
|
|
|
673 |
}).done(function(response) {
|
|
|
674 |
if(response['success']) {
|
|
|
675 |
|
|
|
676 |
|
|
|
677 |
$('#interactions-first_name').val(response['data']['first_name']);
|
|
|
678 |
$('#interactions-last_name').val(response['data']['last_name']);
|
|
|
679 |
$('#interactions-corporate_email').val(response['data']['corporate_email']);
|
|
|
680 |
$('#interactions-company').val(response['data']['company']);
|
|
|
681 |
$('#interactions-position').val(response['data']['position']);
|
|
|
682 |
$('#interactions-country').val(response['data']['country']);
|
|
|
683 |
$('#interactions-state').val(response['data']['state']);
|
|
|
684 |
$('#interactions-city').val(response['data']['city']);
|
|
|
685 |
$('#interactions-personal_email').val(response['data']['personal_email']);
|
|
|
686 |
$('#interactions-phone').val(response['data']['phone']);
|
|
|
687 |
$('#interactions-phone_extension').val(response['data']['phone_extension']);
|
|
|
688 |
$('#interactions-celular').val(response['data']['celular']);
|
|
|
689 |
$('#interactions-whatsapp').val(response['data']['whatsapp']);
|
|
|
690 |
$('#interactions-linkedin').val(response['data']['linkedin']);
|
|
|
691 |
|
|
|
692 |
linkInteractions = response['data']['link_interactions'];
|
|
|
693 |
linkInteractionsAdd = response['data']['link_interactions_add'];
|
|
|
694 |
linkLogs = response['data']['link_logs'];
|
|
|
695 |
|
|
|
696 |
pageInteractions = 0;
|
|
|
697 |
pageLogs = 0;
|
|
|
698 |
|
|
|
699 |
|
|
|
700 |
|
|
|
701 |
|
|
|
702 |
$.fn.loadLogs();
|
|
|
703 |
$.fn.loadInteractions();
|
|
|
704 |
|
|
|
705 |
|
|
|
706 |
|
|
|
707 |
$('#listing-row').hide();
|
|
|
708 |
$('#interactions-row').show();
|
|
|
709 |
} else {
|
|
|
710 |
$.fn.showError(response['data']);
|
|
|
711 |
}
|
|
|
712 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
713 |
$.fn.showError(textStatus);
|
|
|
714 |
}).always(function() {
|
|
|
715 |
NProgress.done();
|
|
|
716 |
});
|
|
|
717 |
});
|
|
|
718 |
|
|
|
719 |
$('body').on('click', 'button.btn-refresh', function(e) {
|
|
|
720 |
e.preventDefault();
|
|
|
721 |
gridTable.api().ajax.reload(null, false);
|
|
|
722 |
});
|
|
|
723 |
|
|
|
724 |
|
|
|
725 |
$('body').on('click', 'button.btn-cancel', function(e) {
|
|
|
726 |
|
|
|
727 |
|
|
|
728 |
e.preventDefault();
|
|
|
729 |
$('#form-row').hide();
|
|
|
730 |
$('#listing-row').show();
|
|
|
731 |
});
|
|
|
732 |
|
|
|
733 |
$('body').on('click', 'button.btn-close-view', function(e) {
|
|
|
734 |
|
|
|
735 |
|
|
|
736 |
e.preventDefault();
|
|
|
737 |
$('#interactions-row').hide();
|
|
|
738 |
$('#listing-row').show();
|
|
|
739 |
});
|
|
|
740 |
|
|
|
741 |
|
|
|
742 |
|
|
|
743 |
$('#form #phone').intlTelInput({
|
|
|
744 |
utilsScript: "$utilsScript",
|
|
|
745 |
formatOnDisplay: true,
|
|
|
746 |
separateDialCode: false,
|
|
|
747 |
});
|
|
|
748 |
|
|
|
749 |
|
|
|
750 |
|
|
|
751 |
$('#form #celular').intlTelInput({
|
|
|
752 |
utilsScript: "$utilsScript",
|
|
|
753 |
formatOnDisplay: true,
|
|
|
754 |
separateDialCode: false,
|
|
|
755 |
});
|
|
|
756 |
|
|
|
757 |
$('#form #whatsapp').intlTelInput({
|
|
|
758 |
utilsScript: "$utilsScript",
|
|
|
759 |
formatOnDisplay: true,
|
|
|
760 |
separateDialCode: false,
|
|
|
761 |
});
|
|
|
762 |
|
|
|
763 |
});
|
|
|
764 |
JS;
|
|
|
765 |
$this->inlineScript()->captureEnd();
|
|
|
766 |
?>
|
|
|
767 |
|
|
|
768 |
|
|
|
769 |
|
|
|
770 |
|
|
|
771 |
<section class="content" id="listing-row">
|
|
|
772 |
<div class="container-fluid">
|
|
|
773 |
<div class="row">
|
|
|
774 |
<div class="col-12">
|
|
|
775 |
<div class="card">
|
|
|
776 |
<div class="card-header">
|
|
|
777 |
<h2>LABEL_CONTACTS</h2>
|
|
|
778 |
</div>
|
|
|
779 |
<div class="card-body">
|
|
|
780 |
<table id="gridTable" class="table table-striped table-hover">
|
|
|
781 |
<thead>
|
|
|
782 |
<tr>
|
|
|
783 |
<th>LABEL_FIRST_NAME</th>
|
|
|
784 |
<th>LABEL_LAST_NAME</th>
|
|
|
785 |
<th>LABEL_CORPORATE_EMAIL</th>
|
|
|
786 |
<th>LABEL_ACTIONS</th>
|
|
|
787 |
</tr>
|
|
|
788 |
</thead>
|
|
|
789 |
<tbody>
|
|
|
790 |
</tbody>
|
|
|
791 |
</table>
|
|
|
792 |
</div>
|
|
|
793 |
<div class="card-footer clearfix">
|
|
|
794 |
<div style="float:right;">
|
|
|
795 |
<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
|
|
|
796 |
<?php if ($allowAdd) : ?>
|
|
|
797 |
<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
|
|
|
798 |
<?php endif; ?>
|
|
|
799 |
</div>
|
|
|
800 |
</div>
|
|
|
801 |
</div>
|
|
|
802 |
</div>
|
|
|
803 |
</div>
|
|
|
804 |
</div>
|
|
|
805 |
</section>
|
|
|
806 |
|
|
|
807 |
<section class="content" id="form-row" style="display: none">
|
|
|
808 |
<div class="container-fluid">
|
|
|
809 |
<div class="row">
|
|
|
810 |
<div class="col-12">
|
|
|
811 |
<div class="card">
|
|
|
812 |
|
|
|
813 |
<div class="card-header">
|
|
|
814 |
<h2>LABEL_CONTACT - <span id="form-title"></span></h2>
|
|
|
815 |
</div>
|
|
|
816 |
<div class="card-body">
|
|
|
817 |
<?php
|
|
|
818 |
$form = $this->form;
|
|
|
819 |
$form->setAttributes([
|
|
|
820 |
'method' => 'post',
|
|
|
821 |
'action' => $routeAdd,
|
|
|
822 |
'name' => 'form',
|
|
|
823 |
'id' => 'form',
|
|
|
824 |
]);
|
|
|
825 |
$form->prepare();
|
|
|
826 |
echo $this->form()->openTag($form);
|
|
|
827 |
?>
|
|
|
828 |
<div class="row">
|
|
|
829 |
<div class="col-sm-6">
|
|
|
830 |
<div class="form-group">
|
|
|
831 |
<?php
|
|
|
832 |
$label = 'LABEL_FIRST_NAME';
|
|
|
833 |
$field = 'first_name';
|
|
|
834 |
|
|
|
835 |
$element = $form->get($field);
|
|
|
836 |
$element->setAttributes(['id' => $field, 'class' => 'form-control', 'class' => 'form-control']);
|
|
|
837 |
$element->setOptions(['label' => $label]);
|
|
|
838 |
echo $this->formLabel($element);
|
|
|
839 |
echo $this->formText($element);
|
|
|
840 |
?>
|
|
|
841 |
</div>
|
|
|
842 |
</div>
|
|
|
843 |
<div class="col-sm-6">
|
|
|
844 |
<div class="form-group">
|
|
|
845 |
<?php
|
|
|
846 |
$label = 'LABEL_LAST_NAME';
|
|
|
847 |
$field = 'last_name';
|
|
|
848 |
|
|
|
849 |
$element = $form->get($field);
|
|
|
850 |
$element->setAttributes(['id' => $field, 'class' => 'form-control', 'class' => 'form-control']);
|
|
|
851 |
$element->setOptions(['label' => $label]);
|
|
|
852 |
echo $this->formLabel($element);
|
|
|
853 |
echo $this->formText($element);
|
|
|
854 |
?>
|
|
|
855 |
</div>
|
|
|
856 |
</div>
|
|
|
857 |
</div>
|
|
|
858 |
<div class="row">
|
|
|
859 |
<div class="col-sm-6">
|
|
|
860 |
<div class="form-group">
|
|
|
861 |
<?php
|
|
|
862 |
|
|
|
863 |
$label = 'LABEL_CORPORATE_EMAIL';
|
|
|
864 |
$field = 'corporate_email';
|
|
|
865 |
|
|
|
866 |
$element = $form->get($field);
|
|
|
867 |
$element->setAttributes(['id' => $field, 'class' => 'form-control', 'class' => 'form-control']);
|
|
|
868 |
$element->setOptions(['label' => $label]);
|
|
|
869 |
echo $this->formLabel($element);
|
|
|
870 |
echo $this->formText($element);
|
|
|
871 |
?>
|
|
|
872 |
</div>
|
|
|
873 |
</div>
|
|
|
874 |
<div class="col-sm-6">
|
|
|
875 |
<div class="form-group">
|
|
|
876 |
<?php
|
|
|
877 |
$label = 'LABEL_COMPANY';
|
|
|
878 |
$field = 'company';
|
|
|
879 |
|
|
|
880 |
$element = $form->get($field);
|
|
|
881 |
$element->setAttributes(['id' => $field, 'class' => 'form-control', 'class' => 'form-control']);
|
|
|
882 |
$element->setOptions(['label' => $label]);
|
|
|
883 |
echo $this->formLabel($element);
|
|
|
884 |
echo $this->formText($element);
|
|
|
885 |
?>
|
|
|
886 |
</div>
|
|
|
887 |
</div>
|
|
|
888 |
</div>
|
|
|
889 |
<div class="row">
|
|
|
890 |
<div class="col-sm-6">
|
|
|
891 |
<div class="form-group">
|
|
|
892 |
<?php
|
|
|
893 |
$label = 'LABEL_POSITION';
|
|
|
894 |
$field = 'position';
|
|
|
895 |
|
|
|
896 |
|
|
|
897 |
$element = $form->get($field);
|
|
|
898 |
$element->setAttributes(['id' => $field, 'class' => 'form-control', 'class' => 'form-control']);
|
|
|
899 |
$element->setOptions(['label' => $label]);
|
|
|
900 |
echo $this->formLabel($element);
|
|
|
901 |
echo $this->formText($element);
|
|
|
902 |
?>
|
|
|
903 |
</div>
|
|
|
904 |
</div>
|
|
|
905 |
<div class="col-sm-6">
|
|
|
906 |
<div class="form-group">
|
|
|
907 |
<?php
|
|
|
908 |
$label = 'LABEL_COUNTRY';
|
|
|
909 |
$field = 'country';
|
|
|
910 |
$element = $form->get($field);
|
|
|
911 |
$element->setAttributes(['id' => $field, 'class' => 'form-control', 'class' => 'form-control']);
|
|
|
912 |
$element->setOptions(['label' => $label]);
|
|
|
913 |
echo $this->formLabel($element);
|
|
|
914 |
echo $this->formText($element);
|
|
|
915 |
?>
|
|
|
916 |
</div>
|
|
|
917 |
</div>
|
|
|
918 |
</div>
|
|
|
919 |
<div class="row">
|
|
|
920 |
<div class="col-sm-6">
|
|
|
921 |
<div class="form-group">
|
|
|
922 |
<?php
|
|
|
923 |
$label = 'LABEL_STATE';
|
|
|
924 |
$field = 'state';
|
|
|
925 |
|
|
|
926 |
|
|
|
927 |
$element = $form->get($field);
|
|
|
928 |
$element->setAttributes(['id' => $field, 'class' => 'form-control', 'class' => 'form-control']);
|
|
|
929 |
$element->setOptions(['label' => $label]);
|
|
|
930 |
echo $this->formLabel($element);
|
|
|
931 |
echo $this->formText($element);
|
|
|
932 |
?>
|
|
|
933 |
</div>
|
|
|
934 |
</div>
|
|
|
935 |
<div class="col-sm-6">
|
|
|
936 |
<div class="form-group">
|
|
|
937 |
<?php
|
|
|
938 |
$label = 'LABEL_CITY';
|
|
|
939 |
$field = 'city';
|
|
|
940 |
|
|
|
941 |
$element = $form->get($field);
|
|
|
942 |
$element->setAttributes(['id' => $field, 'class' => 'form-control', 'class' => 'form-control']);
|
|
|
943 |
$element->setOptions(['label' => $label]);
|
|
|
944 |
echo $this->formLabel($element);
|
|
|
945 |
echo $this->formText($element);
|
|
|
946 |
?>
|
|
|
947 |
</div>
|
|
|
948 |
</div>
|
|
|
949 |
</div>
|
|
|
950 |
<div class="row">
|
|
|
951 |
<div class="col-sm-6">
|
|
|
952 |
<div class="form-group">
|
|
|
953 |
<?php
|
|
|
954 |
$label = 'LABEL_PHONE';
|
|
|
955 |
$field = 'phone';
|
|
|
956 |
|
|
|
957 |
|
|
|
958 |
|
|
|
959 |
|
|
|
960 |
$element = $form->get($field);
|
|
|
961 |
$element->setAttributes(['id' => $field, 'class' => 'form-control', 'class' => 'form-control']);
|
|
|
962 |
$element->setOptions(['label' => $label]);
|
|
|
963 |
echo $this->formLabel($element);
|
|
|
964 |
echo '<br>';
|
|
|
965 |
echo $this->formText($element);
|
|
|
966 |
?>
|
|
|
967 |
</div>
|
|
|
968 |
</div>
|
|
|
969 |
<div class="col-sm-6">
|
|
|
970 |
<div class="form-group">
|
|
|
971 |
<?php
|
|
|
972 |
$label = 'LABEL_PHONE_EXTENSION';
|
|
|
973 |
$field = 'phone_extension';
|
|
|
974 |
|
|
|
975 |
|
|
|
976 |
$element = $form->get($field);
|
|
|
977 |
$element->setAttributes(['id' => $field, 'class' => 'form-control', 'class' => 'form-control']);
|
|
|
978 |
$element->setOptions(['label' => $label]);
|
|
|
979 |
|
|
|
980 |
echo $this->formLabel($element);
|
|
|
981 |
|
|
|
982 |
echo $this->formText($element);
|
|
|
983 |
?>
|
|
|
984 |
</div>
|
|
|
985 |
</div>
|
|
|
986 |
</div>
|
|
|
987 |
<div class="row">
|
|
|
988 |
<div class="col-sm-6">
|
|
|
989 |
<div class="form-group">
|
|
|
990 |
<?php
|
|
|
991 |
$label = 'LABEL_PERSONAL_EMAIL';
|
|
|
992 |
$field = 'personal_email';
|
|
|
993 |
|
|
|
994 |
|
|
|
995 |
|
|
|
996 |
|
|
|
997 |
$element = $form->get($field);
|
|
|
998 |
$element->setAttributes(['id' => $field, 'class' => 'form-control', 'class' => 'form-control']);
|
|
|
999 |
$element->setOptions(['label' => $label]);
|
|
|
1000 |
echo $this->formLabel($element);
|
|
|
1001 |
echo $this->formText($element);
|
|
|
1002 |
?>
|
|
|
1003 |
</div>
|
|
|
1004 |
</div>
|
|
|
1005 |
<div class="col-sm-6">
|
|
|
1006 |
<div class="form-group">
|
|
|
1007 |
<?php
|
|
|
1008 |
$label = 'LABEL_CELULAR';
|
|
|
1009 |
$field = 'celular';
|
|
|
1010 |
|
|
|
1011 |
$element = $form->get($field);
|
|
|
1012 |
$element->setAttributes(['id' => $field, 'class' => 'form-control', 'class' => 'form-control']);
|
|
|
1013 |
$element->setOptions(['label' => $label]);
|
|
|
1014 |
echo $this->formLabel($element);
|
|
|
1015 |
echo '<br>';
|
|
|
1016 |
echo $this->formText($element);
|
|
|
1017 |
?>
|
|
|
1018 |
</div>
|
|
|
1019 |
</div>
|
|
|
1020 |
</div>
|
|
|
1021 |
<div class="row">
|
|
|
1022 |
<div class="col-sm-6">
|
|
|
1023 |
<div class="form-group">
|
|
|
1024 |
<?php
|
|
|
1025 |
$label = 'LABEL_WHATSAPP';
|
|
|
1026 |
$field = 'whatsapp';
|
|
|
1027 |
|
|
|
1028 |
$element = $form->get($field);
|
|
|
1029 |
$element->setAttributes(['id' => $field, 'class' => 'form-control', 'class' => 'form-control']);
|
|
|
1030 |
$element->setOptions(['label' => $label]);
|
|
|
1031 |
echo $this->formLabel($element);
|
|
|
1032 |
echo '<br>';
|
|
|
1033 |
echo $this->formText($element);
|
|
|
1034 |
?>
|
|
|
1035 |
</div>
|
|
|
1036 |
</div>
|
|
|
1037 |
<div class="col-sm-6">
|
|
|
1038 |
<div class="form-group">
|
|
|
1039 |
<?php
|
|
|
1040 |
$label = 'LABEL_LINKEDIN';
|
|
|
1041 |
$field = 'linkedin';
|
|
|
1042 |
|
|
|
1043 |
$element = $form->get($field);
|
|
|
1044 |
$element->setAttributes(['id' => $field, 'class' => 'form-control', 'class' => 'form-control']);
|
|
|
1045 |
$element->setOptions(['label' => $label]);
|
|
|
1046 |
echo $this->formLabel($element);
|
|
|
1047 |
echo $this->formText($element);
|
|
|
1048 |
?>
|
|
|
1049 |
</div>
|
|
|
1050 |
</div>
|
|
|
1051 |
|
|
|
1052 |
|
|
|
1053 |
|
|
|
1054 |
</div>
|
|
|
1055 |
|
|
|
1056 |
</div>
|
|
|
1057 |
<div class="card-footer clearfix">
|
|
|
1058 |
<div style="float:right;">
|
|
|
1059 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
|
|
1060 |
<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
|
|
|
1061 |
</div>
|
|
|
1062 |
</div>
|
|
|
1063 |
<?php echo $this->form()->closeTag($form); ?>
|
|
|
1064 |
</div>
|
|
|
1065 |
</div>
|
|
|
1066 |
</div>
|
|
|
1067 |
</div>
|
|
|
1068 |
</section>
|
|
|
1069 |
|
|
|
1070 |
|
|
|
1071 |
|
|
|
1072 |
<section class="content" id="interactions-row" style="display: none">
|
|
|
1073 |
<div class="container-fluid">
|
|
|
1074 |
<div class="row">
|
|
|
1075 |
<div class="col-12">
|
|
|
1076 |
<h2>LABEL_CONTACT</h2>
|
|
|
1077 |
</div>
|
|
|
1078 |
</div>
|
|
|
1079 |
<div class="row">
|
|
|
1080 |
<div class="col-12">
|
|
|
1081 |
<div class="card card-primary card-outline card-tabs">
|
|
|
1082 |
<div class="card-header p-0 pt-1 border-bottom-0">
|
|
|
1083 |
|
|
|
1084 |
<div class="row">
|
|
|
1085 |
<?php
|
|
|
1086 |
$fields = [
|
|
|
1087 |
'LABEL_FIRST_NAME' => 'interactions-first_name',
|
|
|
1088 |
'LABEL_LAST_NAME' => 'interactions-last_name',
|
|
|
1089 |
'LABEL_CORPORATE_EMAIL' => 'interactions-corporate_email',
|
|
|
1090 |
'LABEL_COMPANY' => 'interactions-company',
|
|
|
1091 |
'LABEL_POSITION' => 'interactions-position',
|
|
|
1092 |
'LABEL_COUNTRY' => 'interactions-country',
|
|
|
1093 |
'LABEL_STATE' => 'interactions-state',
|
|
|
1094 |
'LABEL_CITY' => 'interactions-city',
|
|
|
1095 |
'LABEL_PHONE' => 'interactions-phone',
|
|
|
1096 |
'LABEL_PHONE_EXTENSION' => 'interactions-phone_extension',
|
|
|
1097 |
'LABEL_PERSONAL_EMAIL' => 'interactions-personal_email',
|
|
|
1098 |
'LABEL_CELULAR' => 'interactions-celular',
|
|
|
1099 |
'LABEL_WHATSAPP' => 'interactions-whatsapp',
|
|
|
1100 |
'LABEL_LINKEDIN' => 'interactions-linkedin',
|
|
|
1101 |
|
|
|
1102 |
|
|
|
1103 |
];
|
|
|
1104 |
foreach($fields as $label => $field) :
|
|
|
1105 |
|
|
|
1106 |
?>
|
|
|
1107 |
|
|
|
1108 |
<div class="col-sm-6">
|
|
|
1109 |
<div class="form-group">
|
|
|
1110 |
<label for="<?php echo $field ?>"><?php echo $label ?></label>
|
|
|
1111 |
<input type="text" id="<?php echo $field ?>" class="form-control" value="" readonly="readonly" />
|
|
|
1112 |
</div>
|
|
|
1113 |
</div>
|
|
|
1114 |
|
|
|
1115 |
<?php endforeach; ?>
|
|
|
1116 |
|
|
|
1117 |
</div>
|
|
|
1118 |
|
|
|
1119 |
<ul class="nav nav-tabs" id="custom-tabs-three-tab" role="tablist">
|
|
|
1120 |
<li class="nav-item">
|
|
|
1121 |
<a class="nav-link active" id="discovery-contacts-tabs-interactions-tab" data-toggle="pill" href="#discovery-contacts-tabs-interactions" role="tab" aria-controls="discovery-contacts-tabs-interactions" aria-selected="false">LABEL_INTERACTIONS</a>
|
|
|
1122 |
</li>
|
|
|
1123 |
<li class="nav-item">
|
|
|
1124 |
<a class="nav-link" id="discovery-contacts-tabs-logs-tab" data-toggle="pill" href="#discovery-contacts-tabs-logs" role="tab" aria-controls="discovery-contacts-tabs-logs" aria-selected="false">LABEL_LOGS</a>
|
|
|
1125 |
</li>
|
|
|
1126 |
</ul>
|
|
|
1127 |
</div>
|
|
|
1128 |
|
|
|
1129 |
<div class="card-body">
|
|
|
1130 |
<div class="tab-content" id="custom-tabs-three-tabContent">
|
|
|
1131 |
<div class="tab-pane fade show active" id="discovery-contacts-tabs-interactions" role="tabpanel" aria-labelledby="discovery-contacts-tabs-interactions-tab">
|
|
|
1132 |
<table class="table table-striped table-hover">
|
|
|
1133 |
<thead>
|
|
|
1134 |
<tr>
|
|
|
1135 |
<th>LABEL_FIRST_NAME</th>
|
|
|
1136 |
<th>LABEL_LAST_NAME</th>
|
|
|
1137 |
<th>LABEL_EMAIL</th>
|
|
|
1138 |
<th>LABEL_DATE</th>
|
|
|
1139 |
<th>LABEL_ACTIONS</th>
|
|
|
1140 |
</tr>
|
|
|
1141 |
</thead>
|
|
|
1142 |
<tbody id="grid-discovery-contacts-tabs-interactions">
|
|
|
1143 |
</tbody>
|
|
|
1144 |
</table>
|
|
|
1145 |
<br>
|
|
|
1146 |
<ul id="discovery-contacts-pagination-interactions" class="pagination pagination-sm m-0 float-right">
|
|
|
1147 |
|
|
|
1148 |
</ul>
|
|
|
1149 |
|
|
|
1150 |
|
|
|
1151 |
|
|
|
1152 |
</div>
|
|
|
1153 |
<div class="tab-pane fade" id="discovery-contacts-tabs-logs" role="tabpanel" aria-labelledby="discovery-contacts-tabs-logs-tab">
|
|
|
1154 |
<table class="table table-striped table-hover">
|
|
|
1155 |
<thead>
|
|
|
1156 |
<tr>
|
|
|
1157 |
<th>LABEL_FIRST_NAME</th>
|
|
|
1158 |
<th>LABEL_LAST_NAME</th>
|
|
|
1159 |
<th>LABEL_EMAIL</th>
|
|
|
1160 |
<th>LABEL_ACTIVITY</th>
|
|
|
1161 |
</tr>
|
|
|
1162 |
</thead>
|
|
|
1163 |
<tbody id="grid-discovery-contacts-tabs-logs">
|
|
|
1164 |
</tbody>
|
|
|
1165 |
</table>
|
|
|
1166 |
<br>
|
|
|
1167 |
<ul id="discovery-contacts-pagination-logs" class="pagination pagination-sm m-0 float-right">
|
|
|
1168 |
|
|
|
1169 |
</ul>
|
|
|
1170 |
|
|
|
1171 |
</div>
|
|
|
1172 |
</div>
|
|
|
1173 |
</div>
|
|
|
1174 |
|
|
|
1175 |
|
|
|
1176 |
|
|
|
1177 |
<div class="card-footer clearfix">
|
|
|
1178 |
<div style="float:right;">
|
|
|
1179 |
<button type="button" class="btn btn-primary btn-close-view"><i class="fa fa-chevron-left"></i> LABEL_BACK </button>
|
|
|
1180 |
<?php if ($allowInteractionAdd) : ?>
|
|
|
1181 |
<button type="button" class="btn btn-primary btn-add-interaction"><i class="fa fa-plus"></i> LABEL_ADD </button>
|
|
|
1182 |
<?php endif; ?>
|
|
|
1183 |
</div>
|
|
|
1184 |
</div>
|
|
|
1185 |
</div>
|
|
|
1186 |
</div>
|
|
|
1187 |
</div>
|
|
|
1188 |
</div>
|
|
|
1189 |
</section>
|
|
|
1190 |
|
|
|
1191 |
<!-- The Modal -->
|
|
|
1192 |
<div class="modal" id="modal-interaction">
|
|
|
1193 |
<div class="modal-dialog modal-xl">
|
|
|
1194 |
<div class="modal-content">
|
|
|
1195 |
|
|
|
1196 |
<!-- Modal Header -->
|
|
|
1197 |
<div class="modal-header">
|
|
|
1198 |
<h4 class="modal-title">LABEL_INTERACTION</h4>
|
|
|
1199 |
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
|
1200 |
</div>
|
|
|
1201 |
|
|
|
1202 |
<!-- Modal body -->
|
|
|
1203 |
<div class="modal-body">
|
|
|
1204 |
<?php
|
|
|
1205 |
$form = $this->formInteraction;
|
|
|
1206 |
$form->setAttributes([
|
|
|
1207 |
'method' => 'post',
|
|
|
1208 |
'name' => 'form-interaction',
|
|
|
1209 |
'id' => 'form-interaction'
|
|
|
1210 |
]);
|
|
|
1211 |
|
|
|
1212 |
$form->prepare();
|
|
|
1213 |
echo $this->form()->openTag($form);
|
|
|
1214 |
?>
|
|
|
1215 |
<div class="form-group">
|
|
|
1216 |
<?php
|
|
|
1217 |
$element = $form->get('interaction_type_id');
|
|
|
1218 |
$element->setOptions(['label' => 'LABEL_INTERACTION_TYPE']);
|
|
|
1219 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
1220 |
|
|
|
1221 |
echo $this->formLabel($element);
|
|
|
1222 |
echo $this->formSelect($element);
|
|
|
1223 |
?>
|
|
|
1224 |
</div>
|
|
|
1225 |
|
|
|
1226 |
<div class="form-group">
|
|
|
1227 |
<?php
|
|
|
1228 |
$element = $form->get('notes');
|
|
|
1229 |
$element->setOptions(['label' => 'LABEL_NOTES']);
|
|
|
1230 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
1231 |
|
|
|
1232 |
echo $this->formLabel($element);
|
|
|
1233 |
echo $this->formTextArea($element);
|
|
|
1234 |
?>
|
|
|
1235 |
</div>
|
|
|
1236 |
|
|
|
1237 |
<div class="text-right">
|
|
|
1238 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
|
|
1239 |
<button type="button" class="btn btn-light btn-cancel-interaction">LABEL_CANCEL</button>
|
|
|
1240 |
</div>
|
|
|
1241 |
<?php echo $this->form()->closeTag($form); ?>
|
|
|
1242 |
</div>
|
|
|
1243 |
|
|
|
1244 |
|
|
|
1245 |
</div>
|
|
|
1246 |
</div>
|
|
|
1247 |
</div>
|
|
|
1248 |
|
|
|
1249 |
|
|
|
1250 |
|
|
|
1251 |
<script id="interactionTemplate" type="text/x-jsrender">
|
|
|
1252 |
{{for items}}
|
|
|
1253 |
<tr>
|
|
|
1254 |
<td>{{>first_name}}</td>
|
|
|
1255 |
<td>{{>last_name}}</td>
|
|
|
1256 |
<td>{{>email}}</td>
|
|
|
1257 |
<td> {{>added_on}}</td>
|
|
|
1258 |
<td>
|
|
|
1259 |
<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>
|
|
|
1260 |
</td>
|
|
|
1261 |
</tr>
|
|
|
1262 |
<tr>
|
|
|
1263 |
<td colspan="2">
|
|
|
1264 |
{{>name}}
|
|
|
1265 |
</td>
|
|
|
1266 |
<td colspan="3">
|
|
|
1267 |
{{>notes}}
|
|
|
1268 |
</td>
|
|
|
1269 |
</tr>
|
|
|
1270 |
{{/for}}
|
|
|
1271 |
</script>
|
|
|
1272 |
|
|
|
1273 |
|
|
|
1274 |
<script id="logTemplate" type="text/x-jsrender">
|
|
|
1275 |
{{for items}}
|
|
|
1276 |
<tr>
|
|
|
1277 |
<td>{{>first_name}}</td>
|
|
|
1278 |
<td>{{>last_name}}</td>
|
|
|
1279 |
<td>{{>email}}</td>
|
|
|
1280 |
<td>{{>added_on}}</td>
|
|
|
1281 |
|
|
|
1282 |
|
|
|
1283 |
</td>
|
|
|
1284 |
</tr>
|
|
|
1285 |
<tr>
|
|
|
1286 |
<td colspan="2">
|
|
|
1287 |
{{>activity}}
|
|
|
1288 |
</td>
|
|
|
1289 |
|
|
|
1290 |
<td colspan="2">
|
|
|
1291 |
{{>details}}
|
|
|
1292 |
</td>
|
|
|
1293 |
</tr>
|
|
|
1294 |
{{/for}}
|
|
|
1295 |
</script>
|
|
|
1296 |
|
|
|
1297 |
<script id="logPaginationTemplate" type="text/x-jsrender">
|
|
|
1298 |
{{if has_previous_page}}
|
|
|
1299 |
<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>
|
|
|
1300 |
{{/if}}
|
|
|
1301 |
|
|
|
1302 |
{{if has_next_page}}
|
|
|
1303 |
<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>
|
|
|
1304 |
{{/if}}
|
|
|
1305 |
</script>
|
|
|
1306 |
|
|
|
1307 |
<script id="interactionPaginationTemplate" type="text/x-jsrender">
|
|
|
1308 |
{{if has_previous_page}}
|
|
|
1309 |
<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>
|
|
|
1310 |
{{/if}}
|
|
|
1311 |
|
|
|
1312 |
{{if has_next_page}}
|
|
|
1313 |
<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>
|
|
|
1314 |
{{/if}}
|
|
|
1315 |
</script>
|