searchrecordings.blade.php 3.42 KB
<?php
use App\Models\CRMCallArchive;
use App\Models\CRMCall;
use App\Models\User;
use App\Jobs\KHRMSLib;

$wakka = new KHRMSLib();
$dashboarduser=Auth::user();

$clmnlst = array("lan","number");

if(Input::get("getCallRec")=="1")
{
	$calllog=CRMCallArchive::find(Input::get("calllog"));
	$tdata=json_decode($calllog->data,true);
	echo '<audio controls src="dialer/playrecfile?calllog='.$calllog->id.'" />';
	return;
}

if(Input::has("submit"))
{
if(isset($_GET['key']))$key=$_GET['key'];

if(isset($_GET['value']))$value=$_GET['value'];

$alist=CRMCallArchive::where($key,'=', $value);
$alist=$alist->get();

$userarr=array();
$i=sizeof($alist);$i=1;
$totaltime=0;$ttlovr10=0;$ttlovr5=0;$ttlovr1=0;$ttlovr0=0;$outstr="";$usrcnt=0;
$totaltimeIn=0;$ttlovr10In=0;$ttlovr5In=0;$ttlovr1In=0;$ttlovr0In=0;$usrcntIn=0;
$actionarr=array();$actionarrIn=array();

foreach($alist as $aline)
{
	$tpostdata=json_decode($aline->data,true);
        $created=date("Y-m-d H:i:s",strtotime($aline->created_at)-($dashboarduser->timezone*60));
	if(isset($tpostdata['recFolder']))
	{
	$recstr='';
	if($dashboarduser->moduleACL("Dialer",false,false,true))
	{
		if(isset($tpostdata['recFolder']))$recstr.="<a href=# onclick='getCallRec(".$aline->id.");return false;' title='Size : ".round($aline->recsize/1024,0)." KB'><i class='fa fa-play-circle'></i> &nbsp;</a>"; 
		
		$recstr.="<a href='dialer/playrecfile?calllog=$aline->id&out=wav' title='' target='_blank'><i class='fa fa-download'></i> &nbsp;</a><span id='recspan_".$aline->id."'</span>";
	}

	$outstr.="<tr><td>".$i."</td>
	<td>$created</td>
	<td>$recstr</td>
</tr>";

$i++;
		}
	}
}
?>

<div class=innerAll>
	<style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style>
	<script>

		$(document).ready(function()
		{
			if(!$('#dialoglog').hasClass('ui-dialog-content'))
			{
				$('#dialoglog').dialog({
					autoOpen: false,
					width: '70%',
					buttons: {
						"Ok": function() { 
							$(this).dialog("close"); 
						}, 
						"Cancel": function() { 
							$(this).dialog("close"); 
						} 
					}
				});
			}

		});
	</script>

	<div style="float:left;width:50%">
		<select id="key">
			<?php foreach($clmnlst as $c){$s="";if($c==$key)$s='selected';echo "<option value='$c' $s>$c</option>";} ?>
        </select>

		<input id=val name="val" type="text" value='<?php echo $value; ?>'> 

		<button class="btn btn-sm btn-default" onclick='showRecordingList();return false;' title='Download' style='margin-top:-8px'><i class='fa fa-search'></i> Search</button>
	</div>

	<div style="clear:both"></div>
	<hr>

<script>
	function showRecordingList()
	{
		var key = $("#key").val();
		var val = $("#val").val();

		if(key == "" || val == "")
		{
			simpleNotification('Alert','topRight','<span class="fa fa-exclamation-triangle"></span> Oops..Something is not right!');
			return;
		}

		doAjax('dialer/searchrecordings?submit=1&key='+key+'&value='+val,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');
	}

	function getCallRec(id)
	{
		doAjax("dialer/searchrecordings","getCallRec=1&calllog="+id,'recspan_'+id,'rec_ajax','singlefail','GET');
	}
</script>

<br/>
<div style='clear:both'></div>
	<div style='overflow:auto'>
		<table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'>
			<thead>
				<tr>
					<th>#</th>
					<th>Date</th>
					<th>Recording</th>
				</tr>
			</thead>
			<?php echo $outstr; ?>
		</table>
	</div>
</div>