<?php
include "inc/check_session.php";
include "../lib/functions_class.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>iBlog | Profile</title>
<!-- FAVICONS -->
<link rel="shortcut icon" href="../uploads/favicon/<?php echo $DB->get_settingdata('favicon');?>" type="image/x-icon">
<!-- Bootstrap -->
<link href="plugins/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
<link href="plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<!-- iCheck -->
<link href="plugins/iCheck/skins/flat/green.css" rel="stylesheet">
<!-- bootstrap-progressbar -->
<link href="plugins/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet">
<!-- jVectorMap -->
<link href="css/maps/jquery-jvectormap-2.0.3.css" rel="stylesheet"/>
<!-- Alert, Info, Confirm Plugin -->
<link href="plugins/lobibox/lobibox.min.css" rel="stylesheet">
<!-- Custom Theme Style -->
<link href="css/custom.css" rel="stylesheet">
<style>
label{
margin-right:15px;
}
</style>
</head>
<body class="nav-md">
<div class="container body">
<div class="main_container">
<?php include "inc/header.php";?>
<?php
$uid = $_SESSION['aid'];
$fetch = $DB->output_editmember($uid);
$fname = $fetch[0]['first_name'];
$lname = $fetch[0]['last_name'];
$phone = $fetch[0]['phone'];
$email = $fetch[0]['email'];
$country = $fetch[0]['country'];
$arr = explode(",", $country);
$cid = $arr[0];
$country = $arr[1];
$state = $fetch[0]['state'];
$city = $fetch[0]['city'];
$postal_code = $fetch[0]['postal_code'];
$address_one = $fetch[0]['address_one'];
$address_two = $fetch[0]['address_two'];
$dob = $fetch[0]['dob'];
$marital_stat = $fetch[0]['marital_stat'];
$profile_pic = $fetch[0]['profile_pic'];
?>
<?php include "inc/top_nav.php";?>
<!-- page content -->
<div class="right_col" role="main">
<div class="">
<div class="page-title">
<div class="title_left">
<!--<h3>Pricing Tables</h3>-->
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_content">
<div class="col-md-3 col-sm-3 col-xs-12 profile_left">
<div class="profile_img">
<!-- end of image cropping -->
<div id="crop-avatar">
<!-- Current avatar -->
<img src="<?php if($profile_pic == ''){echo "images/user.png";}else{echo "../uploads/profile/".$profile_pic;}?>" height="200px" class="img-responsive avatar-view" alt="Avatar" title="Change the avatar">
</div>
</div>
</div>
<div class="col-md-4 col-sm-3 col-xs-12 profile_left">
<div class="profile_img">
<h3><?php echo $fname." ".$lname;?></h3>
<ul class="list-unstyled user_data">
<li>
<i class="fa fa-map-marker user-profile-icon"></i> <?php echo $address_one;?>,
<?php if($address_two != ''){echo $address_two.", ";}?> <?php echo $city.", ".$state.", ".
$country;?>
</li>
<li>
<i class="fa fa-map-pin user-profile-icon"></i> <?php echo $postal_code;?>
</li>
<li>
<i class="fa fa-envelope-o user-profile-icon"></i> <?php echo $email;?>
</li>
<li>
<i class="fa fa-mobile user-profile-icon"></i> <?php echo $phone;?>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_content">
<div class="" role="tabpanel" data-example-id="togglable-tabs">
<ul id="myTab" class="nav nav-tabs bar_tabs" role="tablist">
<li role="presentation" class="active">
<a href="#tab_content1" id="home-tab" role="tab" data-toggle="tab" aria-expanded="true">Edit Profile</a>
</li>
<li role="presentation" class="">
<a href="#tab_content2" role="tab" id="profile-tab" data-toggle="tab" aria-expanded="false">Change Password</a>
</li>
</ul>
<div id="myTabContent" class="tab-content">
<div role="tabpanel" class="tab-pane fade active in" id="tab_content1" aria-labelledby="home-tab">
<?php include "inc/edit_profile.php";?>
</div>
<div role="tabpanel" class="tab-pane fade" id="tab_content2" aria-labelledby="profile-tab">
<?php include "inc/change_password.php";?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /page content -->
<?php include "inc/footer.php";?>
</div>
</div>
<!-- jQuery -->
<script src="plugins/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="plugins/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/lib/fastclick.js"></script>
<!-- NProgress -->
<script src="plugins/nprogress/nprogress.js"></script>
<!-- Alert, Info Or Confirm Plugin -->
<script src="plugins/lobibox/lobibox.js"></script>
<script>
$("form#updateprofile").submit(function(){
var formData = new FormData($(this)[0]);
deleteimg();
$.ajax({
url: "controller/profile_ajax.php",
type: 'POST',
data: formData,
async: false,
success: function(data){
if(data == 2){
Lobibox.alert('info', {msg: "Profile Updated Successfully"});
window.location.reload();
}else{
Lobibox.alert('error', {msg: data});
}
},
cache: false,
contentType: false,
processData: false,
});
return false;
});
//Change Password
$("#changepass").submit(function (event){
event.preventDefault();
$.ajax({
url:'controller/change_password_ajax.php',
type:'POST',
data:$(this).serialize(),
success: function(data){
if(data == 1){
Lobibox.alert('info', {msg: "Password Changed Successfully"});
$('input[type=password]').val("");
}
else{
Lobibox.alert('error', {msg: data});
}
}
});
});
//Get State
$("#country").change(function () {
$("#state").html("<option>Please Wait....</option>");
var country = $(this).val();
var a = country.split(",");
var cid = a[0];
$.post("controller/geo_ajax.php",{action:"getstate",cid:cid},function(data){
$("#state").html(data);
})
});
//Image Reader
$("#file").change(function () {
readURL(this);
});
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#img').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
//Image Delete If Update
function deleteimg(){
var fimg = $('#profile_pic').val();
var file = $('#file').val().length;
if(file != 0){
$.post("controller/profile_ajax.php",{action:"deleteimg",img:fimg},function(){
})
}
}
</script>
<!-- Custom Theme Scripts -->
<script src="js/custom.js"></script>
</body>
</html>