<?php include 'connection.php';
session_start();
if (!isset($_SESSION['is_logged_in'])) {
    header("Location:login.php");
    die();
    }
date_default_timezone_set('Asia/Calcutta');
$today = date("d/m/Y");
$today1 = date("d/m");
$currentmonth = date(m);

?>
<?php 

$query = "select * from users where username = '". $_SESSION["LOGIN_NAME"]."' AND password = '".$_SESSION["EMPLOYEE_PASSWORD"]."'";
//echo $query;
		                 $result = mysql_query($query,$conn);
						 while($row=mysql_fetch_array($result))
	                                              	{
													$staff_name = $row['full_name'];
													  $full_name = $row['full_name'];
													  $avatar = $row['avatar'];
													  $department_name = $row['department_name'];
													  $staff_id  = $row['id'];
													  $username = $row['username'];
													  $our_company = $row['our_company'];
													  $designation = $row['designation'];
													  $sales_group = $row['sales_group'];
													  $head = $row['head'];
													  $region = $row['region'];
													  $district = $row['district'];
													  $email = $row['email'];
													  $mobile_no = $row['mobile_no'];
													  $staff_id_self  = $row['id'];
													  //echo $Branch;
													  }	
													   ?>	
													   
													   <?php
$sql = mysql_query("select * from customer_master where customer_id = '".$_REQUEST['customer_id']."' and id='".$_REQUEST['id']."'"); 
while($row = mysql_fetch_array($sql))
{
$customer_name = $row['customer_name'];

$comptype = $row['comptype'];
$category = $row['category'];
$paccname = $row['paccname'];
$industry = $row['industry'];
$subindustry = $row['subindustry'];

$turnover = $row['turnover'];
$website = $row['website'];
$credittime = $row['credittime'];
$creditlimit = $row['creditlimit'];
$last_modified = $row['last_modified'];
$created_by = $row['created_by'];

$billing_address = $row['billing_address'];
$bcity = $row['bcity'];
$bstate = $row['bstate'];
$bcountry = $row['bcountry'];
$bpin = $row['bpin'];
$bphone = $row['bphone'];
$bfax = $row['bfax'];
$bemail = $row['bemail'];
$description = $row['description'];
$acccode= $row['acccode'];
$dispname = $row['dispname'];
$lsrc = $row['lsrc'];
$assigned_to = $row['assigned_to'];
$last_year_turnover = $row['last_year_turnover'];
$Outstanding = $row['Outstanding'];
$bgst_no = $row['bgst_no'];
$sgst_no = $row['sgst_no'];
$pan_no = $row['pan_no'];

$shipping_address = $row['shipping_address'];
$scity = $row['scity'];
$sstate = $row['sstate'];
$scountry = $row['scountry'];
$spin = $row['spin'];
$sphone = $row['sphone'];
$sfax = $row['sfax'];
$semail = $row['semail'];
$sdistrict = $row['sdistrict'];
$bdistrict = $row['bdistrict'];
$tertiary=$row['tertiary'];
$segment=$row['segment'];
$bstate_code=$row['bstate_code'];
}
?>
<!DOCTYPE html>
<html>
<head><? include('sahavas_dropdown_function.php');?>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>THREESTAR - CRM</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.6 -->
  <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="plugins/daterangepicker/daterangepicker.css">
  <!-- bootstrap datepicker -->
  <link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
  <!-- iCheck for checkboxes and radio inputs -->
  <link rel="stylesheet" href="plugins/iCheck/all.css">
  <!-- Bootstrap Color Picker -->
  <link rel="stylesheet" href="plugins/colorpicker/bootstrap-colorpicker.min.css">
  <!-- Bootstrap time Picker -->
  <link rel="stylesheet" href="plugins/timepicker/bootstrap-timepicker.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
  <!-- jvectormap -->
  <link rel="stylesheet" href="plugins/jvectormap/jquery-jvectormap-1.2.2.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
  <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
  <style>
  table {
  border: 1px solid #ccc;
  border-collapse: collapse;
  margin: 0;
  padding: 0;
  table-layout: fixed;
}
table caption {
  font-size: 1.2em;
  margin: .5em 0 .75em;
}
table tr {
  
  border: 1px solid #ddd;
  padding: .35em;
}
table th,
table td {
  padding: .625em;
  
}
table th {
  font-size: .9em;
  letter-spacing: .0em;
  text-transform: uppercase;
}
@media screen and (max-width: 600px) {
  table {
    border: 0;
  }
  table caption {
    font-size: 1.8em;
  }
  table thead {
    border: none;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
  }
  table tr {
    border-bottom: 3px solid #ddd;
    display: block;
    margin-bottom: .625em;
  }
  table td {
    border-bottom: 1px solid #ddd;
    display: block;
    font-size: .9em;
    
  }
  table td:before {
    /*
    * aria-label has no advantage, it won't be read inside a table
    content: attr(aria-label);
    */
    content: attr(data-label);
    float: left;
    font-weight: bold;
    text-transform: uppercase;
  }
  table td:last-child {
    border-bottom: 0;
  }
}

</style>	<script type="text/javascript">
function executeOnSubmit()
{

var status = check();
if(status == false)
{
alert('Please enter Valid Mobile No');
return false;
}

var status2 = checkall();
if(status2 == false)
{
alert('Please enter Valid Order No');
return false;
}

var res = confirm("Do you really wish to submit the form contents?");

if(res)
return true;
else
return false;
}


</script>											   
<script type="text/javascript" src="jquery.min.js"></script>
   <script src="jquery-ui.js"></script>
   <link rel="stylesheet" href="jquery-ui.css">

</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<? depat_check($department_name,$designation);?>

<script src="jquery.min.js"></script>
   <script src="jquery-ui.js"></script>
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        Dashboard &nbsp; &nbsp; &nbsp; &nbsp;<a href="view_all_contacts.php?customer_id=<?php echo $_REQUEST['customer_id']?>&&id=<? echo $_REQUEST['id']?>" title="Click To Edit" class="btn btn-success"><span class="glyphicon glyphicon glyphicon-edit"></span>&nbsp;Go Back</a>
        
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
        <li class="active">Edit Account</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
	<form name="frmdetail" action="update_contacts.php" method="post"  onSubmit="return executeOnSubmit();">
	<input name="customer_id" id="customer_id" value="<?php echo $_REQUEST['customer_id']?>" type="hidden">
<input name="id" id="id" value="<?php echo $_REQUEST['id']?>" type="hidden">

      <div class="row">
			<div class="col-sm-12">
				<div class="search-list">
					<div class="search-header">
						<div class="col-sm-12 left">
							<div class="col-xs-12"style="background:#007E50;">
								<h5 style="color:#FFFFFF">
								&nbsp;
						<? $sql = mysql_query("select * from customer_master where customer_id = '".$_REQUEST['customer_id']."' "); 
while($row = mysql_fetch_array($sql))
{
$customer_name = $row['customer_name'];

$address = $row['address'];	
}?> <? echo $customer_name?> </h5></div>
							
						</div>
					</div>
					 <div  class="col-xs-12" id="squareboxcontent1" style="">
						<div>
							<table class="table table-bordered">
								<tbody>
									<tr>
								        
								        <td class="col-sm-12">
								        	<div class="panel panel-default">
										      <div class="panel-heading"><b> <span class="glyphicon glyphicon-phone-alt"></span> Contact Details</b> </div>
							<input id="contact_id" name="customer_id" value="<?php echo $_REQUEST['customer_id']?>" type="hidden">
							<?php $sql3 = "select * from contact_person where customer_id = '".$_REQUEST['customer_id']."' AND contact_id = '".$_REQUEST['contact_id']."'"; 
$re13 = mysql_query($sql3);
while($row = mysql_fetch_array($re13))
{
$name1 = $row['name'];
$saul1 = $row['saul'];
$bday = $row['bday'];
$remark = $row['remark'];
$gender = $row['gender'];
$contact_types = $row['contact_types'];
$mobile_no = $row['mobile_no'];
$office_phone = $row['office_phone'];
$email1 = $row['email'];
$department = $row['department'];
$designation1 = $row['designation'];
$twitterid = $row['twitterid'];
$linkedinid = $row['linkedinid'];

}
?>

										      <div class="panel-body">

												<div class="panel-body">

												<ul class="list-group">
												  <li class="list-group-item">
													  <div class="row">
													  <div class="col-sm-1" style="margin-right:10px;">
													  		<div class="form-group">
															

										        				<label for="firstname">Saul</label>
										        				
														<select class="form-control" name="saul" id="saul" onChange="setGenderNew()" style="width:70px;">
															<option selected="selected" value="<?php echo $saul1 ?>"><?php echo $saul1 ?></option>
																	        <option value="Mr.">Mr.</option>
															                <option value="Ms.">Ms.</option>
															                <option value="Mrs.">Mrs.</option>
															                <option value="Dr.">Dr.</option>
															                <option value="Prof.">Prof.</option>
															                
															                
														                </select>
														  			
									    					</div>
													  	</div>
													  	<div class="col-sm-3">
													  		
														  			<div class="form-group">
											        						<label for="gender">Name</label>
																			<input id="contact_id" name="contact_id" value="<?php echo $_REQUEST['contact_id']?>" type="hidden">
										
																	<input class="form-control" id="name" name="name" type="text" value="<?php echo $name1?>">
															             </div>
														  		
													  	</div>
														<div class="col-sm-1" style="margin-right:10px;">
													  		<div class="form-group">
										        				<label for="dept">Gender</label>
										        				<select class="form-control" id="gender" name="gender" style="width:70px;">
																		    	<option selected="selected" value="<?php echo $gender?>"><?php echo $gender?></option>
																		         <option value="Male">Male</option>
																			     <option value="Female">Female</option>
															                </select>
									    					</div>
													  	</div>
													  	<div class="col-sm-3">
													  		<div class="form-group">
										        				<label for="dept">Department</label>
								 <input class="form-control" id="department" name="department" type="text" value="<?php echo $department ?>">
									    					</div>
													  	</div>
													  	<div class="col-sm-3">
													  		<div class="form-group">
										        				<label for="desg">Designation</label>
							<input class="form-control" id="designation" name="designation" type="text" value="<?php echo $designation1 ?>">
									    					</div>
													  	</div>
													  </div>
												  </li>
												  <li class="list-group-item">
													  <div class="row">
													  	<div class="col-sm-3">
													  		<div class="form-group">
										        				<label for="contacttype">Contact Types</label>
										        				<select class="form-control" name="contact_types" id="contact_types">
											<option selected="selected" value="<?php echo $contact_types ?>"><?php echo $contact_types ?></option>
													                
																	<option value="Decision Maker">Decision Maker</option>
																	
																	<option value="Influencer">Influencer</option>
																	
																	<option value="Recommender">Recommender</option>
																	
																	<option value="User">User</option>
																	
																	<option value="Purchase Officer">Purchase Officer</option>
																	
																 </select>
									    					</div>
													  	</div>
													  	<div class="col-sm-3">
													  		<div class="form-group">
										        				<label for="cemail">Email</label>
										        <input class="form-control" id="email" name="email" value="<?php echo $email1 ?>" type="text">
									    					</div>
													  	</div>
													  	<div class="col-sm-3">
													  		<div class="form-group">
										        				<label for="cphone">Office Phone</label>
										<input class="form-control" id="office_phone" name="office_phone" value="<?php echo $office_phone ?>" type="text">
									    					</div>
													  	</div>
													  	<div class="col-sm-3">
													  		<div class="form-group">
										        				<label for="mobile">Mobile No</label>
							<input class="form-control" id="mobile"  required onKeyPress="javascript:return isNumber7(event)" onkeyup="check(); return false;" name="mobile_no" value="<?php echo $mobile_no ?>" type="text" maxlength="10">
									    				<span id="message"></span>
									    					 <script type="text/javascript">
function isNumber7(evt) {
        var iKeyCode = (evt.which) ? evt.which : evt.keyCode
        if (iKeyCode != 46 && iKeyCode > 31 && (iKeyCode < 48 || iKeyCode > 57))
            return false;

        return true;
    }   

  function check()
{

    var pass1 = document.getElementById('mobile');

    var message = document.getElementById('message');
   var goodColor = "#0C6";
    var badColor = "#FF9B37";

    if(mobile.value.length!=10){

        mobile.style.backgroundColor = badColor;
        message.style.color = badColor;
        message.innerHTML = "required 10 digits, match requested format!"
		return false;
    }
	
	 if(mobile.value.length==10){
	 mobile.style.backgroundColor = goodColor;
        message.style.color = goodColor;
	 message.innerHTML = " "
	 return true;

	}
	}
   </script>	</div>
													  	</div>
														
														
														
														
													  </div>
												  </li>
												  <li class="list-group-item">
												  	<div class="row">
													  	<div class="col-sm-4">
													  		<div class="form-group">
										        				<label for="linkedinid">LinkedIn</label>
								<input class="form-control" id="linkedinid" name="linkedinid" value="<?php echo $linkedinid ?>" type="text">
									    					</div>
													  	</div>
													  	<div class="col-sm-4">
													  		<div class="form-group">
										        				<label for="twitterid">Twitter</label>
							<input class="form-control" id="twitterid" name="twitterid" value="<?php echo $twitterid ?>" type="text">
									    					</div>
													  	</div>
														
														<div class="col-sm-4">
													  		<div class="form-group">
										        				<label for="twitterid">B'day</label>
										        				<input type="text" id="datepicker" class="form-control date-picker" name="bday" value="<?php echo $bday?>">
									    					</div>
													  	</div>
														
													  </div>
												  </li>
												  <li class="list-group-item">
												  	<div class="row">
													  	<div class="col-sm-12">
													  		<div class="form-group">
										        				<label for="remark">Remark </label>
			<textarea class="form-control" rows="2" id="remark" name="remark" style="resize: vertical;"><?php echo $remark ?></textarea>
									    					</div>
													  	</div>
													  </div>
												  </li>
												  
												</ul>
												
										      </div>
												
										      </div>
											 
										    </div>
								        </td>
									</tr>
								</tbody>
								
					</div></tr>
							</table>
						</div>	
					</div>
				</div>
			</div>
		
      <div class="row">
			<div class="col-sm-12">
				<div class="filter-header" align="right">
					<div class="col-sm-12 ">
						
	          			<input type="submit" name="Submit" value="Save" class="btn bg-btn-save"/>
	          			
          				
					
						 
					</div>
				</div>
			</div>
		</div></form>
    </section></div>
    <!-- /.content -->
  <!-- /.content-wrapper -->
<script type="text/javascript" src="js/date-time-picker.js"></script>

     <? include'footer.php'; ?>
