Virtualdata.blade.php 3.18 KB
<?php
use App\Models\CRMCall;
use App\Models\User;
use App\Jobs\KHRMSLib;

$attempts = CRMCall::where('userstatus','!=','InboundDROP')->where('created_at','>',date('Y-m-d',time()))->where('user_id','=',Auth::user()->id)->count();
print_r(($attempts));

$Contacts = CRMCall::where('userstatus','NOT IN',"('NORECORD','InboundDROP')")->where('created_at','>',date('Y-m-d',time()))->where('user_id','=',Auth::user()->id)->count();
$uniqueContacts = DB::select("select count(distinct(number)) as uniquecount from crmcalls where userstatus NOT IN ('InboundDROP','NORECORD') and user_id=".Auth::user()->id." group by number");

/**
	Output Products
**/
//$Product = DB::table('output_products')->select('id','name','status')->where('status', '1')->get();
//print_r($Product);
//print_r($uniqueContacts);
//include(resource_path().'/views/layout/module/virtualchannel/VirtualFieldsArray.php');
//print_r($Product);

//echo "<div>Virtual</div>";
?>
<div class="container">
	 <div style="text-align:center">
    	<h2>Virtual Channels</h2>
    	<p></p>
 	 </div>

	<div class="row">
    	<div class="column">
<form class="form-horizontal">
<div class="table-responsive" style="background: #fff;">

					<table class="table">	
						<thead>
							<tr>
								<th>No.of Attempts</th>
								<th><?php echo $attempts;  ?></th>
							</tr>
							<tr>
								<th>No.of Contacts</th>
								<th><?php echo $Contacts; ?></th>
							</tr>
							<tr>
								<th>Unique Contacts</th>
								<th><?php foreach($uniqueContacts as $uniquecounts){echo $uniquecounts->uniquecount; } ?></th>
							</tr>
							<tr>
								<th>Income Achievement</th>
								<th></th>
							</tr>
							<tr>
								<th>Product</th>
								<th>LG</th>
								<th>Expected Amount(If Applicable)</th>
								<th>LC</th>
								<th>Amount(If Applicable)</th>
							</tr>
						</thead>
						<tbody>
							<?php							 
	//include(resource_path().'/views/layout/module/virtualchannel/VirtualFieldsArray.php'); 
	foreach ($products as $key => $value) {
		//print_r($value);
		//print_r($ProductType);
		$i=1;
	 ?>
	 				<tr>
	 					<td><?php echo $value->name; ?></td>
	 					<td><input type="number" name="lg[<?php echo $value->name; ?>]"></td>
	 					<td><input type="text" name="lg-amt[<?php echo $value->name; ?>]"></td>
	 					<td><input type="number" name="lc[<?php echo $value->name; ?>]"></td>
	 					<td><input type="text" name="lc-amt[<?php echo $value->name; ?>]"></td>
	 				</tr>
	 			<?php 
	 			} ?>

	 				<tr>
	 					<td><button type="submit" class="btn btn-primary" onclick='createOutputReport();return false;'>Save</button></td></tr>
	 			</tbody>
					</table>
					
				</div>
</form>

<script>

function createOutputReport()
{
  var putdata="csrftoken={!!Session::token()!!}";
  putdata+="&lc="+$("#lc").val();

  doAjax('user',putdata,'__fake__div__','ajax_users_create','singlethis','POST',function(retstr)
  {
		if(retstr.responseText.indexOf('Error')<0)
		{
			simpleNotification("success","topRight","User Created Successfully");
			doAjax('user/'+retstr.responseText+'/edit','','userformdiv','ajax_users_create','singlethis','GET');
		}
		else
		{
			simpleNotification("error","topRight",retstr.responseText);
		}
  });
}

</script>


</div>
</div>
</div>