<?php
include"initialize_page.php";
include"systemfunctions.php";
?>
<?php include('resources/header.php') ?>
	<title></title>
	<meta name="keywords" content="" />
	<meta name="description" content="" />
<?php include('resources/css-file.php') ?>
<?php include('resources/navigation.php') ?> 
<!-- Dashboard wrapper starts -->
<div class="dashboard-wrapper">
	<div class="main-container">				
		<div class="row">
			<div class="col-sm-12 ac-summ">
				<h2>Personal Profile</h2>
			</div>
		</div>
		<div class="row gutter">
			<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
				<ul class="boxli">
				<li>
					<h4>My Profile</h4>
					<p>View or edit your profile details</p>
					<form method="post" action="" id="addcustom">
						<div class="form-group">
							<input type="hidden" name="q" value="update_userdetails" class="form-control">
						</div>                                      
						<div class="form-group">
							<label>User Name</label>
							<input class="form-control" type="text" value="<?php echo user_details($user_id,'x_fname');  ?> <?php echo user_details($user_id,'x_lname');  ?>" readonly />
						</div>
						<div class="form-group">
							<label>Email ID</label>
							<input class="form-control" type="text" value="<?php echo user_details($user_id,'x_email');  ?>" readonly />
						</div>
						<div class="form-group">
							<label>Phone Number</label>
							<input class="form-control" type="text" name="uphonenumber" value="<?php echo user_details($user_id,'x_phonenumber');  ?>" required>
						</div>
						<div class="form-group">
							<label>Address</label>
							 <textarea class="form-control" rows="3" required name="uaddress"><?php echo user_details($user_id,'x_address');  ?></textarea>
						</div>
						<div class="form-group">
							<label>City</label>
							<input class="form-control" type="text" name="ucity" required value="<?php echo user_details($user_id,'x_city');  ?>" >
						</div>
						<div class="form-group">
							<label>State</label>
							<input class="form-control" type="text" name="ustate" required value="<?php echo user_details($user_id,'x_state');  ?>" >
						</div>
						<div class="form-group">
							<label>Zip Code</label>
							<input class="form-control" type="text" required name="uzip" value="<?php echo user_details($user_id,'x_zip');  ?>" >
						</div>
						<button class="btn btn-info">Update Profile</button>
					</form>
				</li>
				</ul>	
			</div>
		</div>	
		</br>
	</div>
	<!-- Main container ends -->
</div>
<!-- Dashboard wrapper ends -->
<?php include('resources/footer.php') ?>
<?php include('resources/js-file.php') ?>
<script src="js/jQuery.style.switcher.js"></script>

<script type="text/javascript">
	 $(document).ready(function() {
    $("#addcustom").on('submit',(function(e) {
e.preventDefault();

$.ajax({
url: "controller.php", // Url to which the request is send
type: "POST",             // Type of request to be send, called as method
data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values)
contentType: false,       // The content type used when sending data to the server.
cache: false,             // To unable request pages to be cached
processData:false,        // To send DOMDocument or non processed data file it is set to false
success: function(data)   // A function to be called if request succeeds
{
	//alert(data);
	if(data==0)
	{
		alert("Please fill all fields...");
	}
	if(data==1)
	{
		alert("Edited Successfully..");
		window.location.href='<?php  echo website_settingdata('x_weburl'); ?>user/user-profile.php';
	}
	if(data=="emailexist")
	{
	alert("Email already exist please change..");	
	}
	
}
});
}));
});
	
	</script>
