<?php
	session_start();
	if($_SESSION['rid'])
	{
		$userid=$_SESSION['rid'];
		include'connection.php';
		include'time.php';
	}
	else
	{
		header('location:../login.php');
	}
	
	$quUsr="select * from retailer where Userid='$userid'";
	$reUsr=mysqli_query($con,$quUsr);
	$dataUsr=mysqli_fetch_array($reUsr);
	$UsrName=$dataUsr['Name'];
	$UsrMobile=$dataUsr['Mobile'];
	$UsrEmail=$dataUsr['Email'];
	$UsrAddress=$dataUsr['Address'];
	$UsrPincode=$dataUsr['Pincode'];
	$UsrBusinessname=$dataUsr['Businessname'];
	$UsrPan=$dataUsr['Pan'];
	$UsrGst=$dataUsr['Gst'];
	$UsrState=$dataUsr['State'];
	$UsrCity=$dataUsr['City'];
?>	
<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Change Profile</title>

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

    <!-- MetisMenu CSS -->
    <link href="vendor/metisMenu/metisMenu.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="dist/css/sb-admin-2.css" rel="stylesheet">
    <link href="dist/css/my-css-code.css" rel="stylesheet">

    <!-- Morris Charts CSS -->
    <link href="vendor/morrisjs/morris.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
<style>
	.content{background:; width:100%; float:left;}
	.content1{background:; text-align:center; width:48%; padding:15px; border-radius:3px; float:left;}
	.content2{background:; float:right; text-align:center; width:48%; padding:15px; border-radius:3px;}
	
	
.msg-div{background:#f4f4fd; color:; width:400px; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); border-radius:10px; text-align:center; 
border:solid black 5px; z-index:9999; padding:10px;}
#okIcon{color:green; font-size:100px;}
#usrid{display:none;}
.btnPopup{background:dodgerblue; color:white; font-size:20px; padding:5px 20px;}

.input-container{background:; height:35px; margin-top:20px;}
.input-title{background:dodgerblue; border:solid gray 1px; border-right:none; color:white;height:35px; width:30%; float:left; line-height:35px; text-align:right; padding-right:15px;}
.txtarea-title{background:dodgerblue; border:solid gray 1px; border-right:none; color:white;height:70px; width:30%; float:left; line-height:35px; text-align:right; padding-right:15px;}
.input-field{background:white; color:black; height:35px; width:70%; border:solid gray 1px; padding-left:15px;}
.txtarea-field{background:white; color:black; height:70px; width:70%; border:solid gray 1px; padding-left:15px;}
.input-div{background:#bab8b8; color:white; height:35px; text-align:; line-height:35px;}
.input-submit{background:dodgerblue; color:white; border:solid gray 1px; width:100%; height:; font-size:25px; }
.input-submit:hover{background:white; color:dodgerblue;}


	@media (max-width: 768px)
	{
		.content1{width:100%;}
		.content2{width:100%;}
		.msg-div{width:95%; position:fixed;}
	}

</style>
</head>

<body onload="GetBal()">

    <div id="wrapper">
        <!-- Navigation -->
		<?php
			include'navigation.php';
		?>
        <!-- Navigation -->
        <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">Change User's Profile</h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="content">
                        <script>
                            function confrm()
                            {
                            	if (confirm('Do you want to save changes?') == true)
                                {
                                   
        		                    var usrid = document.getElementById("usrid").value;
        		                    
        		                    var pan = document.getElementById("pan").value;
        		                    var city = document.getElementById("city").value;
        		                    var address = document.getElementById("address").value;
        		                    var bizName = document.getElementById("bizName").value;
        		                    var email = document.getElementById("email").value;
        		                    var gst = document.getElementById("gst").value;
        		                    var state = document.getElementById("state").value;
        		                    var pinCode = document.getElementById("pinCode").value;
        		                    
                                    var xmlhttp2 = new XMLHttpRequest();
                                    xmlhttp2.open("GET", "ajax_change_profile.php?usrid="+usrid+"&pan="+pan+"&city="+city+"&address="+address+"&bizName="+bizName+"&email="+email+"&gst="+gst+"&state="+state+"&pinCode="+pinCode, false);
                                   
                                    
                                    xmlhttp2.send(null);
                                    var result = xmlhttp2.responseText;
                                    
                                    document.getElementById("msgDiv").innerHTML = result;
            
                           		}
                            	else 
                                {
                           			var result = 'no';
                           		}
                            }
                        </script>
                        <div id="msgDiv"></div>
                
				<div class="content1">
				    <input type="hide" id="usrid" value="<?php echo $userid; ?>">
					<div class="input-container">
						<div class="input-title">User Name :</div>
						<div class="input-div"><?php echo $UsrName; ?></div>
					</div>
					<div class="input-container">
						<div class="input-title">Mobile No. :</div>
						<div class="input-div"><?php echo $UsrMobile; ?></div>
					</div>
					<div class="input-container">
						<div class="input-title">Pan No. :</div>
						<input class="input-field" type="text" id="pan" value="<?php echo $UsrPan; ?>">
					</div>
					<div class="input-container">
						<div class="input-title">City :</div>
						<input class="input-field" type="text" id="city" value="<?php echo $UsrCity; ?>">
					</div>
					<div class="input-container">
						<div class="txtarea-title">Address :</div>
						<textarea class="txtarea-field" id="address" ><?php echo $UsrAddress; ?></textarea>
					</div>
				</div>
				<div class="content2">
					<div class="input-container">
						<div class="input-title">Business Type :</div>
						<input class="input-field" type="text" id="bizName" value="<?php echo $UsrBusinessname; ?>">
					</div>
					<div class="input-container">
						<div class="input-title">E-Mail :</div>
						<input class="input-field" type="text" id="email" value="<?php echo $UsrEmail; ?>">
					</div>
					<div class="input-container">
						<div class="input-title">Gst No. :</div>
						<input class="input-field" type="text" id="gst" value="<?php echo $UsrGst; ?>">
					</div>
					<div class="input-container">
						<div class="input-title">State :</div>
						<input class="input-field" type="text" id="state" value="<?php echo $UsrState; ?>">
					</div>
					<div class="input-container">
						<div class="input-title">PIN CODE :</div>
						<input class="input-field" type="text" id="pinCode" value="<?php echo $UsrPincode; ?>">
					</div>
					<div class="input-container">
						<input class="input-submit" type="submit" name="submit"  onclick="confrm()">
					</div>
				</div>
				
			</div>
            <!-- /.row -->
            
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

    <!-- jQuery -->
    <script src="vendor/jquery/jquery.min.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="vendor/bootstrap/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="vendor/metisMenu/metisMenu.min.js"></script>

    <!-- Morris Charts JavaScript -->
    <script src="vendor/raphael/raphael.min.js"></script>
    <script src="vendor/morrisjs/morris.min.js"></script>
    <script src="data/morris-data.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="dist/js/sb-admin-2.js"></script>

</body>

</html>
