forked from goautodial/v4.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtelephonylistandcallrecording.php
513 lines (455 loc) · 20.6 KB
/
telephonylistandcallrecording.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
<?php
require_once('./php/UIHandler.php');
require_once('./php/CRMDefaults.php');
require_once('./php/LanguageHandler.php');
include('./php/Session.php');
$ui = \creamy\UIHandler::getInstance();
$lh = \creamy\LanguageHandler::getInstance();
$user = \creamy\CreamyUser::currentUser();
?>
<html>
<head>
<meta charset="UTF-8">
<title>Goautodial Contacts & Call Recordings</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<!-- Call for standardized css -->
<?php print $ui->standardizedThemeCSS();?>
<!-- DATA TABLES -->
<link href="css/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<!-- Bootstrap Player -->
<link href="css/bootstrap-player.css" rel="stylesheet" type="text/css" />
<?php print $ui->creamyThemeCSS(); ?>
<!-- datetime picker -->
<link rel="stylesheet" src="js/dashboard/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css">
<!-- Data Tables -->
<script src="js/plugins/datatables/jquery.dataTables.js" type="text/javascript"></script>
<script src="js/plugins/datatables/dataTables.bootstrap.js" type="text/javascript"></script>
<!-- Date Picker -->
<script type="text/javascript" src="js/dashboard/eonasdan-bootstrap-datetimepicker/build/js/moment.js"></script>
<script type="text/javascript" src="js/dashboard/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js"></script>
<!-- Bootstrap Player -->
<script src="js/bootstrap-player.js" type="text/javascript"></script>
<!-- SELECT2-->
<link rel="stylesheet" src="js/dashboard/select2/dist/css/select2.css">
<link rel="stylesheet" src="js/dashboard/select2-bootstrap-theme/dist/select2-bootstrap.css">
<style type="text/css">
.select2-container{
width: 100% !important;
}
</style>
</head>
<?php print $ui->creamyBody(); ?>
<div class="wrapper">
<!-- header logo: style can be found in header.less -->
<?php print $ui->creamyHeader($user); ?>
<!-- Left side column. contains the logo and sidebar -->
<?php print $ui->getSidebar($user->getUserId(), $user->getUserName(), $user->getUserRole(), $user->getUserAvatar()); ?>
<!-- Right side column. Contains the navbar and content of the page -->
<aside class="right-side">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<?php $lh->translateText("telephony"); ?>
<small><?php $lh->translateText("contacts_call_recordings_management"); ?></small>
</h1>
<ol class="breadcrumb">
<li><a href="./index.php"><i class="fa fa-phone"></i> <?php $lh->translateText("home"); ?></a></li>
<li><?php $lh->translateText("telephony"); ?></li>
<li class="active"><?php $lh->translateText("contacts_call_recordings"); ?>
</ol>
</section>
<?php
$lists = $ui->API_goGetAllLists();
$callrecs = $ui->API_getListAllRecordings();
?>
<!-- Main content -->
<section class="content">
<div class="panel panel-default">
<div class="panel-body">
<legend>List & Call Recordings</legend>
<div class="col-lg-9">
<div role="tabpanel">
<ul role="tablist" class="nav nav-tabs nav-justified">
<!-- Lists panel tabs-->
<li role="presentation" class="ul_list_tab <?php if(!isset($_GET['search'])){echo 'active';}?>">
<a href="#list_tab" aria-controls="list_tab" role="tab" data-toggle="tab" class="bb0">
<sup><span class="fa fa-users"></span></sup> Lists</a>
</li>
<!-- Call Recordings panel tab -->
<li role="presentation" class="ul_callrecordings_tab <?php if(isset($_GET['search'])){echo 'active';}?>">
<a href="#callrecordings_tab" aria-controls="callrecordings_tab" role="tab" data-toggle="tab" class="bb0">
<sup><span class="fa fa-phone-square"></span></sup> Call Recordings </a>
</li>
</ul>
<!-- Tab panes-->
<div class="tab-content bg-white">
<!--==== Lists ====-->
<div id="list_tab" role="tabpanel" class="tab-pane ul_list_tab <?php if(!isset($_GET['search'])){echo 'active';}?>">
<table class="table table-striped table-bordered table-hover" id="table_lists">
<thead>
<tr>
<th>List ID</th>
<th class='hide-on-low hide-on-medium'>Name</th>
<th class='hide-on-low hide-on-medium'>Status</th>
<th class='hide-on-low'>Last Call Date</th>
<th class='hide-on-low hide-on-medium'>Leads Count</th>
<th class='hide-on-low hide-on-medium'>Campaign</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
for($i=0;$i < count($lists->list_id);$i++){
if($lists->active[$i] == "Y"){
$lists->active[$i] = "Active";
}else{
$lists->active[$i] = "Inactive";
}
$action_LISTS = $ui->getUserActionMenuForLists($output->list_id[$i], $output->list_name[$i]);
?>
<tr>
<td><a class='edit-ingroup' data-id="<?php echo $ingroup->group_id[$i];?>"><?php echo $lists->list_id[$i];?></a></td>
<td class='hide-on-low hide-on-medium'><?php echo $lists->list_name[$i];?></td>
<td class='hide-on-low hide-on-medium'><?php echo $lists->active[$i];?></td>
<td class='hide-on-low'><?php echo $lists->list_lastcalldate[$i];?></td>
<td class='hide-on-low hide-on-medium'><?php echo $lists->tally[$i];?></td>
<td class='hide-on-low hide-on-medium'><?php echo $lists->campaign_id[$i];?></td>
<td><?php echo $action_LISTS;?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<!--==== Call Recordings ====-->
<div id="callrecordings_tab" class="tab-pane ul_callrecordings_tab <?php if(isset($_GET['search'])){echo 'active';}?>">
<table class="table table-striped table-bordered table-hover" id="table_callrecs">
<thead>
<tr>
<th>Date</th>
<th class='hide-on-medium hide-on-low'>Customer</th>
<th class='hide-on-medium hide-on-low'>Phone Number</th>
<th class='hide-on-medium hide-on-low'>Agent</th>
<th class='hide-on-medium hide-on-low'>Duration</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
for($i=0;$i < count($callrecs->list_id);$i++){
$d1 = strtotime($callrecs->start_last_local_call_time[$i]);
$d2 = strtotime($callrecs->end_last_local_call_time[$i]);
$diff = abs($d2 - $d1);
$action_Call = $ui->getUserActionMenuForCallRecording($callrecs->uniqueid[$i], $callrecs->location[$i]);
?>
<tr>
<td><?php echo $callrecs->end_last_local_call_time[$i];?></a></td>
<td class='hide-on-medium hide-on-low'><?php echo $callrecs->full_name[$i];?></td>
<td class='hide-on-medium hide-on-low'><?php echo $callrecs->phone_number[$i];?></td>
<td class='hide-on-medium hide-on-low'><?php echo $callrecs->users[$i];?></td>
<td><?php echo gmdate('H:i:s', $diff); ?></td>
<td><?php echo $action_Call;?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-lg-3">
<h3 class="m0 pb-lg">Filters</h3>
<form id="search_form">
<div class="form-group mb-xl">
<input type="text" placeholder="Search Phone, Agent or Customer Last Name" id="search_general" class="form-control mb">
<div class="clearfix">
<div class="pull-right">
<label class="checkbox-inline c-checkbox" for="search_phone">
<input id="search_phone" type="checkbox" checked>
<span class="fa fa-check"></span> Phone
</label>
<label class="checkbox-inline c-checkbox" for="search_agent">
<input id="search_agent" type="checkbox" checked>
<span class="fa fa-check"></span> Agent</label>
<label class="checkbox-inline c-checkbox" for="search_lastname">
<input id="search_lastname" type="checkbox" checked>
<span class="fa fa-check"></span> Customer Lastname
</label>
</div>
</div>
</div>
<div class="form-group">
<label>Start Date:</label>
<div class="form-group">
<div class='input-group date' id='datetimepicker1'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<!-- <span class="glyphicon glyphicon-calendar"></span>-->
<span class="fa fa-calendar"></span>
</span>
</div>
</div>
</div>
<div class="form-group">
<label>End Date:</label>
<div class="form-group">
<div class='input-group date' id='datetimepicker2'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<!-- <span class="glyphicon glyphicon-calendar"></span>-->
<span class="fa fa-calendar"></span>
</span>
</div>
</div>
</div>
</form>
<button type="button" class="pull-left btn btn-default" id="search_button">Search</button>
</div><!-- ./filters -->
</div><!-- /.body -->
</div><!-- /.panel -->
</section><!-- /.content -->
</aside><!-- /.right-side -->
<?php print $ui->getRightSidebar($user->getUserId(), $user->getUserName(), $user->getUserAvatar()); ?>
</div><!-- ./wrapper -->
<!-- FIXED ACTION BUTTON -->
<div class="action-button-circle" data-toggle="modal" data-target="#list-modal">
<?php print $ui->getCircleButton("list_and_call_recording", "plus"); ?>
</div>
<?php
/*
* APIs for add form
*/
$campaign = $ui->API_getListAllCampaigns();
$next_list = max($lists->list_id);
$next_list = $next_list + 1;
$next_listname = "ListID ".$next_list;
$datenow = date("j-n-Y");
$next_listdesc = "Auto-generated - ListID - ".$datenow;
?>
<div class="modal fade" id="list-modal" tabindex="-1"aria-labelledby="list-modal" >
<div class="modal-dialog" role="document">
<div class="modal-content" style="border-radius:5px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title animate-header" id="scripts"><b>Call Recordings Wizard >> Add New Call Recordings</b></h4>
</div>
<div class="modal-body wizard-content" style="min-height: 50%; overflow-y:auto; overflow-x:hidden;">
<form action="CreateTelephonyUser.php" method="POST" id="create_form" class="form-horizontal " role="form">
<input type="hidden" name="log_user" value="<?=$_SESSION['user']?>" />
<input type="hidden" name="log_group" value="<?=$_SESSION['usergroup']?>" />
<!-- STEP 1 -->
<div class="wizard-step">
<div class="form-group">
<label class="col-sm-3 control-label" for="auto_generate">Auto-generated:</label>
<div class="col-sm-9">
<label class="col-sm-2 checkbox-inline c-checkbox" for="auto_generate">
<input type="checkbox" id="auto_generate" checked>
<span class="fa fa-check"></span>
</label>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="list_id">List ID:</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="list_id" id="list_id" placeholder="List ID" value="<?php echo $next_list;?>" disabled />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="list_name">List Name:</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="list_name" id="list_name" placeholder="List Name" value="<?php echo $next_listname;?>" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="list_desc">List Description:</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="list_desc" id="list_desc" placeholder="List Description" value="<?php echo $next_listdesc;?>"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="status">Campaign: </label>
<div class="col-sm-9">
<select name="status" class="form-control select2">
<?php
for($i=0; $i < count($campaign->campaign_id);$i++){
echo "<option value='".$campaign->campaign_id[$i]."'> ".$campaign->campaign_name[$i]." </option>";
}
?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="status">Active: </label>
<div class="col-sm-9">
<select name="status" class="form-control select2">
<option value="Y" selected>Yes</option>
<option value="N" >No</option>
</select>
</div>
</div>
</div>
</form>
</div> <!-- end of modal body -->
<!-- NOTIFICATIONS -->
<div id="notifications">
<div class="output-message-success" style="display:none;">
<div class="alert alert-success alert-dismissible" role="alert">
<strong>Success!</strong> New Agent added.
</div>
</div>
<div class="output-message-error" style="display:none;">
<div class="alert alert-danger alert-dismissible" role="alert">
<strong>Error!</strong> Something went wrong please see input data on form or if agent already exists.
</div>
</div>
<div class="output-message-incomplete" style="display:none;">
<div class="alert alert-danger alert-dismissible" role="alert">
Please fill-up all the fields correctly and do not leave any fields with (<strong> * </strong>) blank.
</div>
</div>
</div>
<div class="modal-footer">
<!-- The wizard button will be inserted here. -->
<button type="button" class="btn btn-default wizard-button-exit" data-dismiss="modal" style="display: inline-block;">Cancel</button>
<input type="submit" class="btn btn-primary" id="submit_usergroup" value="Submit" style="display: inline-block;">
</div>
</div>
</div>
</div><!-- end of modal -->
<!-- Modal -->
<div id="call-playback-modal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title"><b>Call Recording Playback</b></h4>
</div>
<div class="modal-body">
<div class="audio-player"></div>
<!-- <audio controls>
<source src="http://www.w3schools.com/html/horse.ogg" type="audio/ogg" />
<source src="http://www.w3schools.com/html/horse.mp3" type="audio/mpeg" />
<a href="http://www.w3schools.com/html/horse.mp3">horse</a>
</audio> -->
</div>
<div class="modal-footer">
<a href="" class="btn btn-primary download-audio-file" download>Download File</a>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
<!-- End of modal content -->
</div>
</div>
<!-- End of modal -->
<?php print $ui->standardizedThemeJS();?>
<!-- SELECT2-->
<script src="js/dashboard/select2/dist/js/select2.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.select2-1').select2({ theme: 'bootstrap' });
$('#table_lists').dataTable();
$('#table_callrecs').DataTable( {
deferRender: true,
select: true,
stateSave: true
});
$('#list-modal').wizard();
// $('#call-playback-modal').modal('show');
$('#auto_generate').on('change', function() {
// alert( this.value ); // or $(this).val()
if($('#auto_generate').is(":checked")){
$('#list_id').val("<?php echo $next_list;?>");
$('#list_name').val("<?php echo $next_listname;?>");
$('#list_desc').val("<?php echo $next_listdesc;?>");
$('#list_id').prop("disabled", true);
}
if(!$('#auto_generate').is(":checked")){
$('#list_id').val("");
$('#list_name').val("");
$('#list_desc').val("");
$('#list_id').prop("disabled", false);
}
});
$('#datetimepicker1').datetimepicker({
icons: {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down',
previous: 'fa fa-chevron-left',
next: 'fa fa-chevron-right',
today: 'fa fa-crosshairs',
clear: 'fa fa-trash'
}
});
$('#datetimepicker2').datetimepicker({
icons: {
time: 'fa fa-clock-o',
date: 'fa fa-calendar',
up: 'fa fa-chevron-up',
down: 'fa fa-chevron-down',
previous: 'fa fa-chevron-left',
next: 'fa fa-chevron-right',
today: 'fa fa-crosshairs',
clear: 'fa fa-trash'
}
});
$(document).on('click','#search_button',function() {
//$('#search').click(function(){
$('#search_button').prop("disabled", true);
var Asearch_phone = "";
var Asearch_agent = "";
var Asearch_customer = "";
if($('#search_phone').is(":checked")){
Asearch_phone = $('#search_general').val();
}
if($('#search_agent').is(":checked")){
Asearch_agent = $('#search_general').val();
}
if($('#search_lastname').is(":checked")){
Asearch_customer = $('#search_general').val();
}
//$('#search_form').serialize(),
$.ajax({
url: "search.php",
type: 'POST',
data: {
search : $('#search_general').val(),
search_phone : Asearch_phone,
search_agent : Asearch_agent,
search_customer : Asearch_customer,
},
success: function(data) {
$('#search_button').prop("disabled", false);
console.log(data);
if(data != ""){
//window.location.replace("telephonylistandcallrecording.php?search="+data);
}else{
//window.location.replace("telephonylistandcallrecording.php");
}
}
});
});
$('.play_audio').click(function(){
var audioFile = $(this).attr('data-location');
var sourceFile = '<audio class="audio_file" controls>';
sourceFile += '<source src="'+ audioFile +'" type="audio/mpeg" download="true"/>';
sourceFile += '</audio>';
$('.download-audio-file').attr('href', audioFile);
$('.audio-player').html(sourceFile);
$('#call-playback-modal').modal('show');
var aud = $('.audio_file').get(0);
aud.play();
});
$('#call-playback-modal').on('hidden.bs.modal', function () {
var aud = $('.audio_file').get(0);
aud.pause();
});
});
</script>
</body>
</html>