<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
	<title>Edit Customer Plot | Admin Panel</title>

	<!-- Favicons -->
<link rel="shortcut icon" type="image/x-icon" href="../UserProfile/images/logo/logo.png">

	<!-- Bootstrap CSS -->
	<link rel="stylesheet" href="assets/plugins/bootstrap/css/bootstrap.min.css">

	<!-- Fontawesome CSS -->
	<link rel="stylesheet" href="assets/plugins/fontawesome/css/fontawesome.min.css">
	<link rel="stylesheet" href="assets/plugins/fontawesome/css/all.min.css">
	 
	<!-- Animate CSS -->
	<link rel="stylesheet" href="assets/css/animate.min.css">

	<!-- Main CSS -->
	<link rel="stylesheet" href="assets/css/admin.css">
		<!-- Datatables CSS -->
	<link rel="stylesheet" href="assets/plugins/datatables/datatables.min.css">

</head>

<body>
	<div class="main-wrapper">
	
		<!-- Header -->
	<?php include 'include/header.php'; ?>
		<!-- /Header -->
		
		<!-- Sidebar -->
		<?php include 'include/leftmenu.php'; ?>
		<!-- /Sidebar -->
		
		<div class="page-wrapper">
			<div class="content container-fluid">
			
				<!-- Page Header -->
				<div class="page-header">
					<div class="row">
						<div class="col">
							<h5 class="page-title text-white">Set Customer Plot</h5>
    					
						</div>
					
					</div>
				</div>
				
					<form action="Apk/SetCustomerPlot" method="post" id="frmreg">
                	<div class="row">
						<div class="col-sm-12">
							<div class="card">
								<div class="card-header">
									<h6 class="card-title">Set Customer Plo </h6>
								<span style="color:red">	<?php echo $_REQUEST['msg']; ?></span>
								</div>
								<div class="card-body">

									<div class="table-responsive">
										<div class="card filter-card">
						<div class="card-body pb-0">
							<div class="row filter-row">
							    
							    <div class="col-sm-6 col-md-4">
									<div class="form-group">
										<label>Select Project</label>
									<select id="project" name="project" class="form-control" required onChange="get_plot();" onClick="get_plot();">
									    <option value="" selected disabled value>Select Project</option>
									    <?php
									    $strP="Select * from tbl_prject_master order by project_name";
									    $resP=mysqli_query($connection,$strP);
									    while($row=mysqli_fetch_array($resP))
									    {
									        ?>
									        <option value="<?php echo $row['project_id']; ?>"><?php echo $row['project_name']; ?></option>
									        <?php
									    }
									    ?>
									</select>
									</div>
								</div>
								
								<div class="col-sm-6 col-md-4">
									<div class="form-group">
										<label>Select Plot</label>
									<select id="plotCode" name="plotCode" class="form-control" required >
								
									</select>
									</div>
										<input type="hidden" name="plot_code" id="plot_code">
								</div>
									
									<div class="col-sm-6 col-md-3">
									<div class="form-group">
										<label>Customer Id</label>
								 <input type="text" class="form-control" id="member_user_id"  maxlength="10" minlength="10" style="text-transform:uppercase;background-color:#FFFFFF" placeholder="" name="member_user_id"  required onBlur="get_customer();" onkeyup="get_customer();">
									</div>
								</div>
									<div class="col-sm-6 col-md-5">
									<div class="form-group">
										<label>Customer Name</label>
									 <input type="text" class="form-control" id="member_name" placeholder="Customer Name" name="member_name" style="background-color:#FFFFFF"   readonly="true" required>
									</div>
								</div>
							</div>	
							<div class="row filter-row">
								<div class="col-sm-4 col-md-3">
									<div class="form-group">
							      
										<button class="btn btn-primary btn-rounded" id="btnsubmit" type="submit"  style="width:150px;padding-top:10px">Submit</button>
									
									</div>
								
								</div>
							    	<div class="col-sm-6 col-md-6">
									<div class="form-group">
							      <span id="lblmsg" style="color:red; margin-left:10px"></span>
									</div>
									
								</div>

							</div>
						</div>
					</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				    </form>
	<!-- jQuery -->
	<script src="assets/js/jquery-3.5.0.min.js"></script>

	<!-- Bootstrap Core JS -->
	<script src="assets/js/popper.min.js"></script>
	<script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>

	<!-- Slimscroll JS -->
	<script src="assets/plugins/slimscroll/jquery.slimscroll.min.js"></script>
		<script src="assets/plugins/datatables/jquery.dataTables.min.js"></script>
	<script src="assets/plugins/datatables/datatables.min.js"></script> 

	<!-- Custom JS -->
	<script src="assets/js/admin.js"></script>
	<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script>
function get_plot()
{
	var project_id=$("#project").val();
    var dataString = 'project_id='+ project_id;
	//alert(dataString);
		$.ajax
		({
			type: "POST",
			url: "getPlotsAll.php",
			data: dataString,
			cache: false,
			success: function(data)
			{
			//	alert(data);
				$("#plotCode").html(data);
			} 
		});
}

function get_customer()
{
	var member_id=$("#member_user_id").val();
	var dataString = 'member_id='+ member_id;
	//alert(dataString);
		$.ajax
		({
			type: "POST",
			url: "getCustomerDetails.php",
			data: dataString,
			cache: false,
			success: function(data)
			{
				//alert(data);
				var ArrayName=data.split("%");
				$("#member_name").val(ArrayName[0]);
				// $("#sponcer_id").val(ArrayName[1]);
				// $("#sponsor_name").val(ArrayName[2]);
				// $("#promoter_id").val(ArrayName[3]);
				// $("#promoter_name").val(ArrayName[4]);
				
			} 
		});
}

</script>
</body>

</html>
