<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Infolink Connection Email</title>
  <style type="text/css">
  body {
   padding-top: 0 !important;
   padding-bottom: 0 !important;
   padding-top: 0 !important;
   padding-bottom: 0 !important;
   margin:0 !important;
   width: 100% !important;
   -webkit-text-size-adjust: 100% !important;
   -ms-text-size-adjust: 100% !important;
   -webkit-font-smoothing: antialiased !important;
 }
 .tableContent img {
   border: 0 !important;
   display: block !important;
   outline: none !important;
 }
 a{
  color:#382F2E;
}

p, h1,h2,ul,ol,li,div{
  margin:0;
  padding:0;
}

h1,h2{
  font-weight: normal;
  background:transparent !important;
  border:none !important;
}

@media only screen and (max-width:480px)
		
{
		
table[class="MainContainer"], td[class="cell"] 
	{
		width: 100% !important;
		height:auto !important; 
	}
td[class="specbundle"] 
	{
		width: 100% !important;
		float:left !important;
		font-size:13px !important;
		line-height:17px !important;
		display:block !important;
		padding-bottom:15px !important;
	}	
td[class="specbundle2"] 
	{
		width:80% !important;
		float:left !important;
		font-size:13px !important;
		line-height:17px !important;
		display:block !important;
		padding-bottom:10px !important;
		padding-left:10% !important;
		padding-right:10% !important;
	}
		
td[class="spechide"] 
	{
		display:none !important;
	}
	    img[class="banner"] 
	{
	          width: 100% !important;
	          height: auto !important;
	}
		td[class="left_pad"] 
	{
			padding-left:15px !important;
			padding-right:15px !important;
	}
		 
}
	
@media only screen and (max-width:540px) 

{
		
table[class="MainContainer"], td[class="cell"] 
	{
		width: 100% !important;
		height:auto !important; 
	}
td[class="specbundle"] 
	{
		width: 100% !important;
		float:left !important;
		font-size:13px !important;
		line-height:17px !important;
		display:block !important;
		padding-bottom:15px !important;
	}	
td[class="specbundle2"] 
	{
		width:80% !important;
		float:left !important;
		font-size:13px !important;
		line-height:17px !important;
		display:block !important;
		padding-bottom:10px !important;
		padding-left:10% !important;
		padding-right:10% !important;
	}
		
td[class="spechide"] 
	{
		display:none !important;
	}
	    img[class="banner"] 
	{
	          width: 100% !important;
	          height: auto !important;
	}
		td[class="left_pad"] 
	{
			padding-left:15px !important;
			padding-right:15px !important;
	}
		
}

.contentEditable h2.big,.contentEditable h1.big{
  font-size: 26px !important;
}

 .contentEditable h2.bigger,.contentEditable h1.bigger{
  font-size: 37px !important;
}

td,table{
  vertical-align: top;
}
td.middle{
  vertical-align: middle;
}

a.link1{
  font-size:13px;
  color:#27A1E5;
  line-height: 24px;
  text-decoration:none;
}
a{
  text-decoration: none;
}

.link2{
color:#ffffff;
border-top:10px solid #27A1E5;
border-bottom:10px solid #27A1E5;
border-left:18px solid #27A1E5;
border-right:18px solid #27A1E5;
border-radius:3px;
-moz-border-radius:3px;
-webkit-border-radius:3px;
background:#27A1E5;
}

.link3{
color:#555555;
border:1px solid #cccccc;
padding:10px 18px;
border-radius:3px;
-moz-border-radius:3px;
-webkit-border-radius:3px;
background:#ffffff;
}

.link4{
color:#27A1E5;
line-height: 24px;
}

h2,h1{
line-height: 20px;
}
p{
  font-size: 14px;
  line-height: 21px;
  /*color:#AAAAAA;*/
}

.contentEditable li{
 
}

.appart p{
 
}
.bgItem{
background: #ffffff;
}
.bgBody{
background: #3B5998;
}

img { 
  outline:none; 
  text-decoration:none; 
  -ms-interpolation-mode: bicubic;
  width: auto;
  max-width: 100%; 
  clear: both; 
  display: block;
  float: none;
}

</style>
</head>
<body paddingwidth="0" paddingheight="0" style="padding-top: 0; padding-bottom: 0; padding-top: 0; padding-bottom: 0; background-repeat: repeat; width: 100% !important; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; -webkit-font-smoothing: antialiased;" offset="0" toppadding="0" leftpadding="0">
  <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#3B5998">
  <tbody>
      <tr>
	  <td height="15"></td>
	  </tr>
    <tr> <!-- tr1 Start -->
      <td>
		<table width="700" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#ffffff" style="font-family:helvetica, sans-serif;" class="MainContainer">
			<!-- =============== START HEADER =============== -->
		  <tbody>
			<tr>
			  <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
		  <tbody>
			<tr>
			  <td valign="top" width="20">&nbsp;</td>
			  <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
		  <tbody>
			<tr>
			  <td class="movableContentContainer">
			  <div class="movableContent" style="border: 0px; padding-top: 0px; position: relative;">
			  <table width="100%" border="0" cellspacing="0" cellpadding="0">
				  <tbody>
					<tr>
					  <td height="5"></td>
					</tr>
					<tr>
					  <td>
					  <table width="100%" border="0" cellspacing="0" cellpadding="0">
						  <tbody>
							<tr>
							  <td valign="top">
								
							  </td>
							  <td valign="top" width="90" class="spechide">&nbsp;</td>
							  <td valign="middle" style='vertical-align: middle;' width='150'>
								  <img src="{{ asset('public/backend/dist/img/infolink_logo.jpg') }}" alt="Logo" title="Logo" data-max-width="100">
								</td>
							</tr>
						  </tbody>
						</table>
					</td>
					</tr>
					
					<tr>
					   <td><hr style='height:1px;background:#82BEFA;border:none;'></td>
					</tr>
				  </tbody>
				</table>
			  </div>
			  <!-- =============== END HEADER =============== -->
			  
			<!-- =============== START BODY =============== -->
			  
			  <div class="movableContent" style="border: 0px; padding-top: 0px; position: relative;">
			  <table width="100%" border="0" cellspacing="0" cellpadding="0">
			  <tbody>
				<tr>
				  <td>
				  <p>
					<?php
					$get_connection             = DB::table('connection_list')->where('connection_id',$connection_id)->first();
					
					//$get_connection_billing     = $this->connection_model->list_of_connection_billing($connection_id);
					$client_info 	            = DB::table('client')->where('client_id',$client_id)->first();
					$get_connection_notification  = DB::table("connection_notification_details")->where("connection_id", $connection_id)->first();
					$get_connection_network    = DB::table("connection_network_details")->where("connection_id", $connection_id)->first();
					$get_connection_physical    = DB::table("connection_physical_details")->where("connection_id", $connection_id)->first();
					$get_connection_device    = DB::table("connection_client_device")->where("connection_id", $connection_id)->first();

					$notification 	= DB::table('notification')->where('id',15)->first();
					
					$link_status = $get_connection[0]->link_status;
					if($link_status == 1){
						$status = 'Active';
					}elseif($link_status == 2){
						$status = 'Inactive';
					}elseif($link_status == 3){
						$status = 'Pending';
					}elseif($link_status == 4){
						$status = 'Cancel';
					}
					
					$branch = DB::table('branch')->where('branch_id',$client_info->branch_id)->first();
					if($branch != 'null'){
						$branch_name = $branch->branch_name;
					}else{
						$branch_name = '';
					}
					
					$address_id = $get_connection->client_address_id;
        			$address_query = DB::table('client_address')->where('client_address_id',$address_id)->first();
        			if($address_query != 'null'){
        			    $connection_address = $address_query->house.','.$address_query->road.','.$address_query->district.','.$address_query->police_station.','.$address_query->post_office.','.$address_query->post_code;
        			}else{
        			  $connection_address = '';  
        			}
					
					$connection_details = "<h3>Connection Details</h3>
											Connection Address : {$connection_address} <br/>
											Latitude : {$get_connection->latitude} <br/>
											Longitude : {$get_connection->longitude} <br/>
											Contact Person Name : {$get_connection->contact_person_name} <br/>
											Contact Number : {$get_connection->contact_number} <br/>
											Link Status : <b>{$status}</b> <br/>
											Branch : <b>{$branch_name}</b>
										";
					$connection_details .= "<h3>Connection Network Details</h3><b><u>IPv4</u></b><br/>
											Network : {$get_connection_network->network} <br/>
											Primary IP : {$get_connection_network->primary_ip} <br/>
											IP Addresses : {$get_connection_network->ip_address} <br/>
											Subnet : {$get_connection_network->subnet} <br/>
											Gateway : {$get_connection_network->gateway} <br/>
										";
					if($get_connection_network->ip_six_address !=''){
					$connection_details .= "<br/><b><u>IPv6</u></b><br/>IP Address : {$get_connection_network->ip_six_address} <br/>";
					}
					if($get_connection_network->ip_six_primary_ip !=''){
					$connection_details .= "Primary IP : {$get_connection_network->ip_six_primary_ip} <br/>";
					}
					if($get_connection_network->ip_six_subnet_prefix_length !=''){
					$connection_details .= "Subnet Prefix Length : {$get_connection_network->ip_six_subnet_prefix_length} <br/>";
					}
					if($get_connection_network->ip_six_default_gateway !=''){
					$connection_details .= "Default Gateway : {$get_connection_network->ip_six_default_gateway} <br/>";
					}
					if($get_connection_network->ip_six_dns_server !=''){
					$connection_details .= "Preferred DNS Server : {$get_connection_network->ip_six_dns_server} <br/>";
					}
					
					if($get_connection_notification != 'null'){
					
						$connection_details .= "<h3>Connection Notification Details</h3>Name : ";
						if($get_connection_notification->cn_name) {
							$connection_details .= $get_connection_notification->cn_name."<br/>";
						}
						$connection_details .= "Email : ";
						
						if($get_connection_notification->cn_email){
							$connection_details .= $get_connection_notification->cn_email."<br/>";
						}
						
						$connection_details .= "Phone : ";
						
						if($get_connection_notification->cn_phone){
							$connection_details .= $get_connection_notification->cn_phone."<br/>";
						}
					}
					
					if($get_connection_device != 'null'){
						$connection_details .= "<h3>Client Device Details</h3>Device Title : ";
						if($get_connection_device->device_title){
							$connection_details .= $get_connection_device->device_title."<br/>";
						}
						
						$connection_details .= "Serial : ";
						if($get_connection_device->serial){
							$connection_details .= $get_connection_device->serial."<br/>";
						}
						
						$connection_details .= "IP : ";
						if($get_connection_device->ip){
							$connection_details .= $get_connection_device->ip."<br/>";
						}
						
						$connection_details .= "Username : ";
						if($get_connection_device->username){
							$connection_details .= $get_connection_device->username."<br/>";
						}
						
						$connection_details .= "Password : ";
						if($get_connection_device->password){
							$connection_details .= $get_connection_device->password;
						}
					}
					
					$m      = str_replace('[[client_title]]',$client_info->client_title,$notification->message);
					$m1      = str_replace('[[client_id]]',"<font color='red'>IL-C".$client_info->client_id."</font>",$m);
					$m2      = str_replace('[[connection_id]]',"<font color='red'>CID".$connection_id."</font>",$m1);
					$m3      = str_replace('[[connection_details]]',$connection_details,$m2);
					
					echo $m3;
					
					?>
					</p>
				  </td>
				</tr>
				<!-- <tr><td height='5' colspan="3"></td></tr>
				<tr><td colspan="3"><hr style='height:1px;background:#82BEFA;border:none;'></td></tr> -->
			  </tbody>
			</table>
			  </div>
			  
			  <!-- =============== END BODY =============== -->
			  
			  </td>
			</tr>
		  </tbody>
		</table>
		</td>
			  <td valign="top" width="20">&nbsp;</td>
			</tr>
		  </tbody>
		</table>
		</td>
			</tr>
		  </tbody>
		</table>
		</td>
    </tr> <!-- tr1 End -->
    <tr>
					  <td height="15"></td>
					</tr>
  </tbody>
</table>

  </body>
  </html>
