File: /home/imensosw/www/imenso.co/demo/resume-maker/profile.php
<?php
ob_start();
require('include/initalizedb.php');
include("header-member.php");
include_once('site_url.php');
?>
<div class="loader"></div>
<body class="back_color">
<?php include("sidebar.php"); ?>
<div class="main_wrp">
<?php
include("login_header.php");
if(!isset($_SESSION['session_id'])) {
echo "Google";
header("Location:".PATH);
exit;
}
$user_id = $_SESSION['session_id'];
?>
<div id="profile_main" class="col-lg-11">
<div class="profile_wrap ">
<div class="profile_inner">
<div class="row">
<div class="col-lg-4">
<div class="profile_side_br">
<ul id="nav-tabs-wrapper" class="profile_option">
<li class="active"><a href="#tab1" data-toggle="tab">Profile & Password</a></li>
<li><a href="#tab2" data-toggle="tab"> Onboarding Information </a></li>
<li><a href="#tab3" data-toggle="tab"> Tracking </a></li>
<li><a href="#tab4" data-toggle="tab"> Billing </a></li>
</ul>
</div>
</div>
<div class="col-lg-8 margin_b3">
<div class="profile_inner_containe tab-content">
<div class="profile_div tab-pane active" role="tabpanel" id="tab1">
<h2 class="pofile_head mar_0">Profile & Password</h2>
<div class="btm_line"></div>
<?php
$res = $db->select("select * from users where id = $user_id");
/* echo "<pre>";
print_r($res);
echo "</pre>"; */
// echo "Hello";
?>
<form class="" id="password-form">
<div class="row">
<div class="col-md-8">
<p>Name</p>
<div class="form-group">
<input type="text" class="form-control input_text" id="inputname" placeholder="Your Name" value="<?php echo $res[0]['firstName']; ?>">
</div>
<div class="form-group">
<label for="login-pass" class="login-field-icon fui-lock"></label>
<input id="login-pass" placeholder="New Password" class="form-control input_text" type="password">
</div>
<div class="form-group">
<label for="login-pass" class="login-field-icon fui-lock"></label>
<input id="login-pass-cnf" placeholder="Confirm new password" value="" class="form-control input_text" type="password">
</div>
</div>
</div>
<div class="row ">
<div class="col-lg-12">
<input class="comm_btn_design green_btn_back" type="submit" name="submit" value="Update Details"/>
<div id="message"></div>
</div>
</div>
</form>
<h2 class="pofile_head mar_0">Profile pic</h2>
<div class="btm_line"></div>
<!--<form>-->
<div class="row">
<div class="col-md-12">
<!--<a href="#" data-toggle="modal" data-target="#profile-modal" >-->
<?php
$lastid = $db->select("select max(id) as lastid from cv_user_resumes where user_id = $user_id");
if(!empty($lastid[0]['lastid'])){ $picpath = 'profile-image/'.$user_id.'/'.$lastid[0]['lastid'].'/profile-pic.png';}
else{ $picpath = 'profile-image/'.$user_id.'/profile-pic.png'; }
?>
<a href="javascript:;">
<div class="profile_image col-sm-3" id="profile-photo-onboard_" style="background:url('<?php echo $picpath; ?>')"></div>
</a>
<!--<a data-toggle="modal" data-target="#profile-modal" class="comm_btn_design normal_btn_back margin_t1" href="#" > Choose image </a>
<br/>
<input type="button" id="update-profile-button" value="Update profile Pic" class="comm_btn_design normal_btn_back margin_t1"/>-->
</div>
</div>
<!--</form>-->
<div class="btm_line"></div>
<div class="row ">
<div class="col-lg-12">
<a data-toggle="modal" data-target="#delete-modal" class="comm_btn_design green_btn_back" href="#"> Delete account </a>
</div>
</div>
</div>
<script>
$("#password-form").on("submit",function(e){
$('#message').html('Loading ...').fadeIn();
// alert( result );
// window.open(resultImg);
// alert(image.width + ' × ' + image.height);
// exit;
// if($('#login-pass').val() == "") {
// alert('Password field must contain value');
// return false;
// }
if($('#login-pass').val() != $('#login-pass-cnf').val()) {
alert("Password and login password did not matched");
return false;
}
$.ajax({
type: "POST",
url: "ajax-update-personal-details.php",
data: {
name: $('#inputname').val(),
password: $('#login-pass').val()
// pic: resultImg
},
dataType: "JSON",
success: function(response) {
if(response.type == 'success') {
alert(response.type);
// location.reload();
} else {
alert('Error!');
}
$('#message').html('').fadeIn();
}
});
return false;
});
</script>
<script>
$("#update-profile-button").on("click",function(e){
var image = document.createElement('img');
var val = $('#profile-photo-onboard').css('background-image');
var myString = val.substring(4, val.length-1);
var resultImg = myString.slice(1, -1);
$.ajax({
type: "POST",
url: "ajax-update-personal-detail-pic.php",
data: {
pic: resultImg
},
dataType: "JSON",
success: function(response) {
if(response.type == 'success') {
alert(response.type);
// location.reload();
} else {
alert('Error!');
}
$('#message').html('').fadeIn();
}
});
return false;
});
</script>
<div role="tabpanel" class="onboarding_div tab-pane" id="tab2">
<h2 class="pofile_head mar_0"> Onboarding Information </h2>
<div class="btm_line"></div>
<div class="row">
<div class="col-lg-8">
<?php
$resOnboard = $db->select("select * from user_onboard_details where user_id = $user_id");
/* echo "<pre>";
print_r($resOnboard);
echo "</pre>"; */
// echo "Hello";
?>
<form id="update-onboard">
<div class="onboarding_contain">
<p> What is your career field? </p>
<select class="form-control input_text" name="career" id="career">
<option value="Software" <?php if( $resOnboard[0]['career'] == "Software") { echo "selected"; }?>>Software & IT</option>
<option value="Marketing" <?php if( $resOnboard[0]['career'] == "Marketing") { echo "selected"; }?>>Marketing</option>
<option value="Sales" <?php if( $resOnboard[0]['career'] == "Sales") { echo "selected"; }?>>Sales</option>
<option value="Business" <?php if( $resOnboard[0]['career'] == "Business") { echo "selected"; }?>>Business</option>
</select>
<p class="margin_t1"> How would you describe your experience in the field? </p>
<select class="form-control input_text" name="experience" id="experience">
<option value="Intern" <?php if( $resOnboard[0]['experience'] == "Intern") { echo "selected"; }?>>Intern</option>
<option value="Junior" <?php if( $resOnboard[0]['experience'] == "Junior") { echo "selected"; }?>>Junior</option>
<option value="Intermediate" <?php if( $resOnboard[0]['experience'] == "Intermediate") { echo "selected"; }?>>Intermediate</option>
<option value="Senior" <?php if( $resOnboard[0]['experience'] == "Senior") { echo "selected"; }?>>Senior</option>
<option value="Manager" <?php if( $resOnboard[0]['experience'] == "Manager") { echo "selected"; }?>>Manager</option>
</select>
</div>
<div class="margin_t1">
<!--
<a class="comm_btn_design green_btn_back " href="#"> Save Changes </a>
-->
<input class="comm_btn_design green_btn_back" type="submit" name="submit" value="Save Changes"/>
</div>
</form>
</div>
<div class="col-lg-4"></div>
</div>
</div>
<script>
$("#update-onboard").on("submit",function(e){
$.ajax({
type: "POST",
url: "ajax-update-onboard.php",
data: {
career: $('#career').val(),
experience: $('#experience').val(),
},
dataType: "JSON",
success: function(response) {
if(response.type == 'success') {
alert(response.type);
// location.reload();
} else {
alert('Error!');
}
}
});
return false;
});
</script>
<div role="tabpanel" class="tracking_div tab-pane" id="tab3">
<h2 class="pofile_head mar_0"> Tracking Settings </h2>
<div class="btm_line"></div>
<form id="update-tracking">
<div class="row">
<div class="col-lg-12">
<div class="tracking_contain">
<p>
<?php
if($res[0]['track'] == 1) {
$trackingStatus = "checked";
} else {
$trackingStatus = "";
}
?>
<input type="checkbox" id="test1" name="trackingData" <?=$trackingStatus?>/>
<label for="test1"> Don’t anonymously track me for product improvement purposes </label>
</p>
</div>
<div class="margin_t1">
<!--
<a class="comm_btn_design green_btn_back " href="#"> Save Changes </a>
-->
<input class="comm_btn_design green_btn_back" type="submit" name="submit" value="Save Changes"/>
</div>
</div>
</div>
</form>
</div>
<script>
$("#update-tracking").on("submit",function(e){
var checked;
if(document.getElementById('test1').checked) {
checked = 1;
} else {
checked = 0;
}
$.ajax({
type: "POST",
url: "ajax-update-tracking.php",
data: {
checkVal: checked
},
dataType: "JSON",
success: function(response) {
if(response.type == 'success') {
alert(response.message);
// location.reload();
} else {
alert('Error!');
}
}
});
return false;
});
</script>
<div role="tabpanel" class="billing_div tab-pane" id="tab4">
<h2 class="pofile_head mar_0"> Billing Settings </h2>
<div class="btm_line"></div>
<div class="row">
<div class="col-lg-12">
<div class="billing_contain">
<p> Plans </p>
<div class="gray_bg dark_back ">
<div class="flex billing_item ">
<span class="wht_color">Plan </span>
<span class="wht_color"> $ 0 </span>
<span class="wht_color" > Current Plan </span>
</div>
</div>
<div class="flex gray_bg">
<span> Full </span>
<span class="theme_color"> $ 5 </span>
<?php
$plan = $db->select("select * from billing where user_id = $user_id");
//print_r($plan);
if(!empty($plan))
echo "paid";
else
echo "<a class='comm_btn_design green_btn_back ' href='product.php'> Upgrade </a>";
?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include("modal.php"); ?>
<?php include("profile_modal.php"); ?>
<?php include("signup_modal.php"); ?>
<?php include("delete_account_model.php"); ?>
<?php include("footer.php") ; ?>