| 16758 |
efrain |
1 |
<?php
|
|
|
2 |
$acl = $this->viewModel()->getRoot()->getVariable('acl');
|
|
|
3 |
$currentUser = $this->currentUserHelper();
|
|
|
4 |
|
|
|
5 |
$routeReports = $this->url('discovery-contacts/report');
|
|
|
6 |
$routeDownload = $this->url('discovery-contacts/report/download');
|
|
|
7 |
|
|
|
8 |
$roleName = $currentUser->getUserTypeId();
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
|
|
|
12 |
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
|
|
|
13 |
$this->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.js'));
|
|
|
14 |
|
|
|
15 |
/*
|
|
|
16 |
$this->headStyle()->captureStart();
|
|
|
17 |
echo <<<CSS
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
#tableContact {
|
|
|
21 |
display: flex;
|
|
|
22 |
flex-flow: column;
|
|
|
23 |
width: 100%;
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
#tableContact thead {
|
|
|
27 |
flex: 0 0 auto;
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
#tableContact tbody {
|
|
|
31 |
flex: 1 1 auto;
|
|
|
32 |
display: block;
|
|
|
33 |
overflow-y: auto;
|
|
|
34 |
overflow-x: hidden;
|
|
|
35 |
}
|
|
|
36 |
|
|
|
37 |
#tableContact tr {
|
|
|
38 |
width: 100%;
|
|
|
39 |
display: table;
|
|
|
40 |
table-layout: fixed;
|
|
|
41 |
}
|
|
|
42 |
CSS;
|
|
|
43 |
$this->headStyle()->captureEnd();
|
|
|
44 |
*/
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
$this->inlineScript()->captureStart();
|
|
|
49 |
echo <<<JS
|
|
|
50 |
jQuery( document ).ready(function( $ ) {
|
|
|
51 |
|
|
|
52 |
$.fn.changeFilter = function() {
|
|
|
53 |
NProgress.start();
|
|
|
54 |
$.ajax({
|
|
|
55 |
'dataType' : 'json',
|
|
|
56 |
'accept' : 'application/json',
|
|
|
57 |
'method' : 'get',
|
|
|
58 |
'url' : $('#form-filter').attr('action'),
|
|
|
59 |
'data' : $('#form-filter').serialize(),
|
|
|
60 |
}).done(function(response) {
|
|
|
61 |
if(response['success']) {
|
|
|
62 |
|
|
|
63 |
$('#tableContactBody').empty();
|
|
|
64 |
$('#tableContactBody').html(
|
|
|
65 |
$('#tableTemplate').render(response['data'])
|
|
|
66 |
);
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
} else {
|
|
|
70 |
if(jQuery.type(response['data']) == 'string') {
|
|
|
71 |
$.fn.showError(response['data']);
|
|
|
72 |
} else {
|
|
|
73 |
$.each(response['data'], function( fieldname, errors ) {
|
|
|
74 |
$.fn.showFormErrorValidator('#form #' + fieldname, errors);
|
|
|
75 |
});
|
|
|
76 |
}
|
|
|
77 |
}
|
|
|
78 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
79 |
$.fn.showError(textStatus);
|
|
|
80 |
}).always(function() {
|
|
|
81 |
NProgress.done();
|
|
|
82 |
});
|
|
|
83 |
return false;
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
$('#btn-report').click(function(e) {
|
|
|
88 |
e.preventDefault();
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
$.fn.changeFilter();
|
|
|
92 |
});
|
|
|
93 |
|
|
|
94 |
$('#btn-download').click(function(e) {
|
|
|
95 |
e.preventDefault();
|
|
|
96 |
|
|
|
97 |
|
|
|
98 |
NProgress.start();
|
|
|
99 |
$.ajax({
|
|
|
100 |
'dataType' : 'json',
|
|
|
101 |
'method' : 'get',
|
|
|
102 |
'url' : '$routeDownload',
|
|
|
103 |
'data' : $('#form-filter').serialize(),
|
|
|
104 |
}).done(function(response) {
|
|
|
105 |
if(response['success']) {
|
|
|
106 |
var anchor = window.document.createElement("a");
|
|
|
107 |
anchor.href = 'data:application/octet-stream;charset=utf-8;base64,' + response['data']['content'] ;
|
|
|
108 |
anchor.download = response['data']['basename'];
|
|
|
109 |
document.body.appendChild(anchor);
|
|
|
110 |
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
|
|
|
111 |
document.body.removeChild(anchor);
|
|
|
112 |
} else {
|
|
|
113 |
$.fn.showError(response['data']);
|
|
|
114 |
}
|
|
|
115 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
116 |
showError(textStatus);
|
|
|
117 |
}).always(function() {
|
|
|
118 |
NProgress.done();
|
|
|
119 |
});
|
|
|
120 |
|
|
|
121 |
|
|
|
122 |
});
|
|
|
123 |
|
|
|
124 |
|
|
|
125 |
});
|
|
|
126 |
JS;
|
|
|
127 |
$this->inlineScript()->captureEnd();
|
|
|
128 |
?>
|
|
|
129 |
|
|
|
130 |
<!-- Content Header (Page header) -->
|
|
|
131 |
<section class="content-header">
|
|
|
132 |
<div class="container-fluid">
|
|
|
133 |
<div class="row mb-2">
|
|
|
134 |
<div class="col-sm-12">
|
|
|
135 |
<h1>LABEL_REPORTS</h1>
|
|
|
136 |
</div>
|
|
|
137 |
</div>
|
|
|
138 |
</div><!-- /.container-fluid -->
|
|
|
139 |
</section>
|
|
|
140 |
|
|
|
141 |
<section class="content">
|
|
|
142 |
<div class="container-fluid">
|
|
|
143 |
<div class="row">
|
|
|
144 |
<div class="col-12">
|
|
|
145 |
<div class="card card-primary">
|
|
|
146 |
<div class="card-header">
|
|
|
147 |
|
|
|
148 |
<!-- /.card-tools -->
|
|
|
149 |
</div>
|
|
|
150 |
<!-- /.card-header -->
|
|
|
151 |
<div class="card-body">
|
|
|
152 |
<form name="form-filter" id="form-filter" action="<?php echo $routeReports ?>">
|
|
|
153 |
|
|
|
154 |
<div class="row">
|
|
|
155 |
<div class="col-md-6 col-sm-12">
|
|
|
156 |
<div class="form-group">
|
|
|
157 |
<?php
|
|
|
158 |
$element = $form->get('first_name');
|
|
|
159 |
$element->setOptions(['label' => 'LABEL_FIRST_NAME' ]);
|
|
|
160 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
161 |
|
|
|
162 |
echo $this->formLabel($element);
|
|
|
163 |
echo $this->formText($element);
|
|
|
164 |
?>
|
|
|
165 |
</div>
|
|
|
166 |
</div>
|
|
|
167 |
|
|
|
168 |
<div class="col-md-6 col-sm-12">
|
|
|
169 |
<div class="form-group">
|
|
|
170 |
<?php
|
|
|
171 |
$element = $form->get('last_name');
|
|
|
172 |
$element->setOptions(['label' => 'LABEL_LAST_NAME' ]);
|
|
|
173 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
174 |
|
|
|
175 |
echo $this->formLabel($element);
|
|
|
176 |
echo $this->formText($element);
|
|
|
177 |
?>
|
|
|
178 |
</div>
|
|
|
179 |
</div>
|
|
|
180 |
</div>
|
|
|
181 |
|
|
|
182 |
<div class="row">
|
|
|
183 |
<div class="col-md-6 col-sm-12">
|
|
|
184 |
<div class="form-group">
|
|
|
185 |
<?php
|
|
|
186 |
$element = $form->get('personal_email');
|
|
|
187 |
$element->setOptions(['label' => 'LABEL_PERSONAL_EMAIL' ]);
|
|
|
188 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
189 |
|
|
|
190 |
echo $this->formLabel($element);
|
|
|
191 |
echo $this->formText($element);
|
|
|
192 |
?>
|
|
|
193 |
</div>
|
|
|
194 |
</div>
|
|
|
195 |
|
|
|
196 |
<div class="col-md-6 col-sm-12">
|
|
|
197 |
<div class="form-group">
|
|
|
198 |
<?php
|
|
|
199 |
$element = $form->get('corporate_email');
|
|
|
200 |
$element->setOptions(['label' => 'LABEL_CORPORATE_EMAIL' ]);
|
|
|
201 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
202 |
|
|
|
203 |
echo $this->formLabel($element);
|
|
|
204 |
echo $this->formText($element);
|
|
|
205 |
?>
|
|
|
206 |
</div>
|
|
|
207 |
</div>
|
|
|
208 |
</div>
|
|
|
209 |
|
|
|
210 |
<div class="row">
|
|
|
211 |
<div class="col-md-6 col-sm-12">
|
|
|
212 |
<div class="form-group">
|
|
|
213 |
<?php
|
|
|
214 |
$element = $form->get('company');
|
|
|
215 |
$element->setOptions(['label' => 'LABEL_COMPANY' ]);
|
|
|
216 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
217 |
|
|
|
218 |
echo $this->formLabel($element);
|
|
|
219 |
echo $this->formText($element);
|
|
|
220 |
?>
|
|
|
221 |
</div>
|
|
|
222 |
</div>
|
|
|
223 |
|
|
|
224 |
<div class="col-md-6 col-sm-12">
|
|
|
225 |
<div class="form-group">
|
|
|
226 |
<?php
|
|
|
227 |
$element = $form->get('position');
|
|
|
228 |
$element->setOptions(['label' => 'LABEL_POSITION' ]);
|
|
|
229 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
230 |
|
|
|
231 |
echo $this->formLabel($element);
|
|
|
232 |
echo $this->formText($element);
|
|
|
233 |
?>
|
|
|
234 |
</div>
|
|
|
235 |
</div>
|
|
|
236 |
</div>
|
|
|
237 |
|
|
|
238 |
<div class="row">
|
|
|
239 |
<div class="col-md-6 col-sm-12">
|
|
|
240 |
<div class="form-group">
|
|
|
241 |
<?php
|
|
|
242 |
$element = $form->get('country');
|
|
|
243 |
$element->setOptions(['label' => 'LABEL_COUNTRY' ]);
|
|
|
244 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
245 |
|
|
|
246 |
echo $this->formLabel($element);
|
|
|
247 |
echo $this->formText($element);
|
|
|
248 |
?>
|
|
|
249 |
</div>
|
|
|
250 |
</div>
|
|
|
251 |
|
|
|
252 |
<div class="col-md-6 col-sm-12">
|
|
|
253 |
<div class="form-group">
|
|
|
254 |
<?php
|
|
|
255 |
$element = $form->get('state');
|
|
|
256 |
$element->setOptions(['label' => 'LABEL_STATE' ]);
|
|
|
257 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
258 |
|
|
|
259 |
echo $this->formLabel($element);
|
|
|
260 |
echo $this->formText($element);
|
|
|
261 |
?>
|
|
|
262 |
</div>
|
|
|
263 |
</div>
|
|
|
264 |
</div>
|
|
|
265 |
|
|
|
266 |
<div class="row">
|
|
|
267 |
<div class="col-md-6 col-sm-12">
|
|
|
268 |
<div class="form-group">
|
|
|
269 |
<?php
|
|
|
270 |
$element = $form->get('city');
|
|
|
271 |
$element->setOptions(['label' => 'LABEL_CITY' ]);
|
|
|
272 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
273 |
|
|
|
274 |
echo $this->formLabel($element);
|
|
|
275 |
echo $this->formText($element);
|
|
|
276 |
?>
|
|
|
277 |
</div>
|
|
|
278 |
</div>
|
|
|
279 |
|
|
|
280 |
<div class="col-md-6 col-sm-12">
|
|
|
281 |
<div class="form-group">
|
|
|
282 |
<?php
|
|
|
283 |
$element = $form->get('phone');
|
|
|
284 |
$element->setOptions(['label' => 'LABEL_PHONE' ]);
|
|
|
285 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
286 |
|
|
|
287 |
echo $this->formLabel($element);
|
|
|
288 |
echo $this->formText($element);
|
|
|
289 |
?>
|
|
|
290 |
</div>
|
|
|
291 |
</div>
|
|
|
292 |
</div>
|
|
|
293 |
|
|
|
294 |
<div class="row">
|
|
|
295 |
<div class="col-md-6 col-sm-12">
|
|
|
296 |
<div class="form-group">
|
|
|
297 |
<?php
|
|
|
298 |
$element = $form->get('phone_extension');
|
|
|
299 |
$element->setOptions(['label' => 'LABEL_PHONE_EXTENSION' ]);
|
|
|
300 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
301 |
|
|
|
302 |
echo $this->formLabel($element);
|
|
|
303 |
echo $this->formText($element);
|
|
|
304 |
?>
|
|
|
305 |
</div>
|
|
|
306 |
</div>
|
|
|
307 |
|
|
|
308 |
<div class="col-md-6 col-sm-12">
|
|
|
309 |
<div class="form-group">
|
|
|
310 |
<?php
|
|
|
311 |
$element = $form->get('celular');
|
|
|
312 |
$element->setOptions(['label' => 'LABEL_CELULAR' ]);
|
|
|
313 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
314 |
|
|
|
315 |
echo $this->formLabel($element);
|
|
|
316 |
echo $this->formText($element);
|
|
|
317 |
?>
|
|
|
318 |
</div>
|
|
|
319 |
</div>
|
|
|
320 |
</div>
|
|
|
321 |
|
|
|
322 |
<div class="row">
|
|
|
323 |
<div class="col-md-6 col-sm-12">
|
|
|
324 |
<div class="form-group">
|
|
|
325 |
<?php
|
|
|
326 |
$element = $form->get('whatsapp');
|
|
|
327 |
$element->setOptions(['label' => 'LABEL_WHATSAPP' ]);
|
|
|
328 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
329 |
|
|
|
330 |
echo $this->formLabel($element);
|
|
|
331 |
echo $this->formText($element);
|
|
|
332 |
?>
|
|
|
333 |
</div>
|
|
|
334 |
</div>
|
|
|
335 |
|
|
|
336 |
<div class="col-md-6 col-sm-12">
|
|
|
337 |
<div class="form-group">
|
|
|
338 |
<?php
|
|
|
339 |
$element = $form->get('linkedin');
|
|
|
340 |
$element->setOptions(['label' => 'LABEL_LINKEDIN' ]);
|
|
|
341 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
342 |
|
|
|
343 |
echo $this->formLabel($element);
|
|
|
344 |
echo $this->formText($element);
|
|
|
345 |
?>
|
|
|
346 |
</div>
|
|
|
347 |
</div>
|
|
|
348 |
</div>
|
|
|
349 |
|
|
|
350 |
<div class="row">
|
|
|
351 |
<div class="col-md-6 col-sm-12">
|
|
|
352 |
<div class="form-group">
|
|
|
353 |
<?php
|
|
|
354 |
$element = $form->get('sector');
|
|
|
355 |
$element->setOptions(['label' => 'LABEL_SECTOR' ]);
|
|
|
356 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
357 |
|
|
|
358 |
echo $this->formLabel($element);
|
|
|
359 |
echo $this->formText($element);
|
|
|
360 |
?>
|
|
|
361 |
</div>
|
|
|
362 |
</div>
|
|
|
363 |
|
|
|
364 |
<div class="col-md-6 col-sm-12">
|
|
|
365 |
<button id="btn-report" class="btn btn-primary"> LABEL_REPORT </button>
|
|
|
366 |
<button id="btn-download" class="btn btn-primary"> LABEL_DOWNLOAD </button>
|
|
|
367 |
</div>
|
|
|
368 |
</div>
|
|
|
369 |
|
|
|
370 |
</form>
|
|
|
371 |
</div>
|
|
|
372 |
<!-- /.card-body -->
|
|
|
373 |
</div>
|
|
|
374 |
</div>
|
|
|
375 |
</div>
|
|
|
376 |
|
|
|
377 |
<div class="row">
|
|
|
378 |
<div class="col-12">
|
|
|
379 |
|
|
|
380 |
<div class="card">
|
|
|
381 |
<!-- /.card-header -->
|
|
|
382 |
<div class="card-body p-0">
|
|
|
383 |
<div style="height: 300px;overflow: scroll;">
|
|
|
384 |
<table id="tableContact" style="width: 100%" class="table table-bordered table-hover">
|
|
|
385 |
<thead>
|
|
|
386 |
<tr>
|
|
|
387 |
|
|
|
388 |
<th nowrap>LABEL_FIRST_NAME</th>
|
|
|
389 |
<th nowrap>LABEL_LAST_NAME</th>
|
|
|
390 |
<th nowrap>LABEL_PERSONAL_EMAIL</th>
|
|
|
391 |
<th nowrap>LABEL_CORPORATE_EMAIL</th>
|
|
|
392 |
<th nowrap>LABEL_COMPANY</th>
|
|
|
393 |
<th nowrap>LABEL_POSITION</th>
|
|
|
394 |
<th nowrap>LABEL_COUNTRY</th>
|
|
|
395 |
<th nowrap>LABEL_STATE</th>
|
|
|
396 |
<th nowrap>LABEL_CITY</th>
|
|
|
397 |
<th nowrap>LABEL_PHONE</th>
|
|
|
398 |
<th nowrap>LABEL_PHONE_EXTENSION</th>
|
|
|
399 |
<th nowrap>LABEL_CELULAR</th>
|
|
|
400 |
<th nowrap>LABEL_WHATSAPP</th>
|
|
|
401 |
<th nowrap>LABEL_LINKEDIN</th>
|
|
|
402 |
<th nowrap>LABEL_SECTOR</th>
|
|
|
403 |
</tr>
|
|
|
404 |
|
|
|
405 |
</thead>
|
|
|
406 |
<tbody id="tableContactBody" >
|
|
|
407 |
|
|
|
408 |
</tbody>
|
|
|
409 |
|
|
|
410 |
</table>
|
|
|
411 |
</div>
|
|
|
412 |
</div>
|
|
|
413 |
<!-- /.card-body -->
|
|
|
414 |
</div>
|
|
|
415 |
|
|
|
416 |
|
|
|
417 |
</div>
|
|
|
418 |
</div>
|
|
|
419 |
</div>
|
|
|
420 |
</section>
|
|
|
421 |
|
|
|
422 |
|
|
|
423 |
|
|
|
424 |
<script id="tableTemplate" type="text/x-jsrender">
|
|
|
425 |
{{for items}}
|
|
|
426 |
<tr>
|
|
|
427 |
<td>{{:first_name}}</td>
|
|
|
428 |
<td>{{:last_name}}</td>
|
|
|
429 |
<td>{{:personal_email}}</td>
|
|
|
430 |
<td>{{:corporate_email}}</td>
|
|
|
431 |
<td>{{:company}}</td>
|
|
|
432 |
<td>{{:position}}</td>
|
|
|
433 |
<td>{{:country}}</td>
|
|
|
434 |
<td>{{:state}}</td>
|
|
|
435 |
<td>{{:city}}</td>
|
|
|
436 |
<td>{{:phone}}</td>
|
|
|
437 |
<td>{{:phone_extension}}</td>
|
|
|
438 |
<td>{{:celular}}</td>
|
|
|
439 |
<td>{{:whatsapp}}</td>
|
|
|
440 |
<td>{{:linkedin}}</td>
|
|
|
441 |
<td>{{:sector}}</td>
|
|
|
442 |
</tr>
|
|
|
443 |
{{/for}}
|
|
|
444 |
</script>
|
|
|
445 |
|
|
|
446 |
|
|
|
447 |
|
|
|
448 |
|
|
|
449 |
|
|
|
450 |
|