File: /home/barbeatleanalyti/public_html/m.beatleanalytics.com/application/views/customer/profile.php
<?php
include ('include/header.php');
include ('include/search.php');
//echo "<pre>";
//print_r($user_info);
//echo "</pre>";
?>
<!------------profile------>
<div class="profile">
<div class="container">
<div class="row">
<div class=""><!----col-lg-3 col-sm-6----->
<form name="frmSettings" id="frmSettings" method="post" action="" enctype="multipart/form-data" >
<input type="hidden" name="type_" id="type_" value="profilesubmit" />
<div class="card hovercard">
<div class="cardheader"><img src="<?php echo base_url();?>assets/customer/img/background-profile.jpg" /></div>
<div class="avatar">
<!-- <img alt="" src="http://lorempixel.com/100/100/people/9/">---->
<img class="profile-pic upload-button" src="<?php echo base_url();?>assets/customer/img/perry.png" />
<input class="file-upload" name="profilepic" id="profilepic" type="file" accept="image/*" style="display:none;" />
<input type="hidden" name="hdn_profilepic" id="hdn_profilepic" value="" />
<div class="info">
<div class="title">
<?php if($user_info[0]->db_username == "") { ?>
<a target="_blank" href="#"><?php echo $user_info[0]->db_phone;?></a>
<?php } else {?>
<a target="_blank" href="#"><?php echo $user_info[0]->db_username;?></a>
<?php }?>
</div>
<?php
if (!empty($error_masg))
{
?>
<div class="col-sm-12" style="color:#900; font-size:15px;"><?php echo $error_masg; ?></div>
<?php
}else if (!empty($success_masg))
{
?>
<div class="col-sm-12" style="color:#063; font-size:15px;"><?php echo $success_masg; ?></div>
<?php
}
?>
<div class="full_row main_container">
<!-- <i class="fa fa-id-badge" aria-hidden="true"></i> -->
<div class="full_row">
<!--<div class=" col-xs-12 f-from">
<div class="col-xs-1"></div>
<div class="col-xs-4"> Profile id: </div>
<div class="col-xs-6 f-pro">
<input name="username" id="username" value="HimanshuA" type="hidden"># HimanshuA</div>
<div class="col-xs-1"></div>
</div> -->
<div class=" col-xs-12 f-from">
<div class="col-xs-1"></div>
<div class="col-xs-4 "> <!--<i class="fa fa-user"></i> ---> Full Name :</div>
<div class="col-xs-6 ">
<input name="name" id="name" maxlength="50" class="form-control input-xs no-padding" type="text" value="<?php echo $user_info[0]->db_username;?>">
</div>
<div class="col-xs-1"></div>
</div>
<div class=" col-xs-12 f-from">
<div class="col-xs-1"></div>
<div class="col-xs-4"><!--<i class="fa fa-envelope-open" aria-hidden="true"></i> ---> Email id: </div>
<div class="col-xs-6 f-pro">
<input name="email" id="email" class="form-control input-xs" type="text" value="<?php echo $user_info[0]->db_email;?>">
</div>
<div class="col-xs-1"></div>
</div>
<!--- <i class="fa fa-mobile" aria-hidden="true"></i> --->
<!--<div class=" col-xs-12 f-from">
<div class="col-xs-1"></div>
<div class="col-xs-4">Phone no: </div>
<div class="col-xs-6 f-pro">
<input disabled="disabled" class="form-control input-xs" type="text" maxlength="10" name="contact_number" id="contact_number" value="<?php echo $user_info[0]->db_phone;?>">
</div>
<div class="col-xs-1"></div>
</div> -->
<div class=" col-xs-12 f-from">
<div class="col-xs-1"></div>
<div class="col-xs-4"><!---<i class="fa fa-address-card" aria-hidden="true"></i> ---> Address :</div>
<div class="col-xs-6 f-pro">
<input class="form-control input-xs" name="address" id="address" type="text" value="<?php echo $user_info[0]->db_address;?>">
</div>
<div class="col-xs-1"></div>
</div>
<div class=" col-xs-12 f-from">
<div class="col-xs-1"></div>
<div class="col-xs-4"><!-- <i class="fa fa-file-archive-o"></i> --> PIN Code :</div>
<div class="col-xs-6 f-pro">
<input class="form-control input-xs" id="pincode" maxlength="6" name="pincode" type="text" value="<?php echo $user_info[0]->db_pincode;?>">
</div>
<div class="col-xs-1"></div>
</div>
<div class=" col-xs-12 f-from">
<div class="col-xs-1"></div>
<div class="col-xs-4"> <!----<i class="fa fa-flag"></i> -->State :</div>
<div class="col-xs-6 f-pro">
<?php
$rsState = $this->Customer_model->fetchStateData();
//print_r($rsState);
?>
<select onchange="javascript: fetchCityDataAjax(this.value)" class="form-control" name="state" id="state">
<?php
$s_cnt = 0;
$stateid = $rsState[0]->id;
foreach($rsState as $sKey => $sVal) {
$s_select = '';
if($user_info[0]->db_state == $sVal->id){
$s_select = 'selected="selected" ';
}
if($user_info[0]->db_state != 0 && !empty($user_info[0]->db_state)){
$stateid = $user_info[0]->db_state;
}
?>
<option <?php echo $s_select; ?> value="<?php echo $sVal->id; ?>"><?php echo $sVal->name; ?></option>
<?php } ?>
</select>
</div>
<div class="col-xs-1"></div>
</div>
<div class=" col-xs-12 f-from">
<div class="col-xs-1"></div>
<div class="col-xs-4"> <!----- <i class="fa fa-building"></i> ----> City :</div>
<div class="col-xs-6 f-pro" id="city-data">
<?php
$rsState = $this->Customer_model->fetchCityData($stateid);
//print_r($rsState);
?>
<select class="form-control" name="city" id="city">
<?php
$s_cnt = 0;
$stateid = 0;
foreach($rsState as $sKey => $sVal) {
$s_select = '';
if($user_info[0]->db_city == $sVal->id){
$s_select = 'selected="selected" ';
}
if($user_info[0]->db_state != 0 && !empty($user_info[0]->db_state)){
$stateid = $user_info[0]->db_state;
}
?>
<option <?php echo $s_select; ?> value="<?php echo $sVal->id; ?>"><?php echo $sVal->name; ?></option>
<?php } ?>
</select>
</div>
<div class="col-xs-1"></div>
</div>
</div>
<div class="save-btn">
<button type="button" onclick="javascript: return validateFrom();" class="btn btn-info">Save</button>
</div>
</div>
<script>
function fetchCityDataAjax(sid){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("city").innerHTML = this.responseText;
}
};
xhttp.open("GET", "<?php echo base_url();?>index.php/customer/fetchCityDataAjax/"+sid, true);
xhttp.send();
}
function validateFrom(){
var name = document.getElementById('name');
// var contact_number = document.getElementById('contact_number');
var email = document.getElementById('email');
//var user_name_hdn = document.getElementById('user_name_hdn');
//var username = document.getElementById('username');
var address = document.getElementById('address');
var pincode = document.getElementById('pincode');
var error = 0;
if(name.value.trim() == ""){
name.style.border = "1px solid red";
error = 1;
}else{
name.style.border = "1px solid #ccc";
}
/*
if(contact_number.value.trim() == ""){
contact_number.style.border = "1px solid red";
error = 1;
}else{
contact_number.border = "1px solid #ccc";
}
if(contact_number.value.length != 10){
contact_number.style.border = "1px solid red";
error = 1;
}else{
contact_number.style.border = "1px solid #ccc";
} */
if(ValidateEmail(email) == false){
email.style.border = "1px solid red";
error = 1;
}else{
email.style.border = "1px solid #ccc";
}
if(address.value.trim() == ""){
address.style.border = "1px solid red";
error = 1;
}else{
address.style.border = "1px solid #ccc";
}
if(pincode.value.trim() == ""){
pincode.style.border = "1px solid red";
error = 1;
}else{
if(pincode.value.trim().length != 6){
pincode.style.border = "1px solid red";
error = 1;
}else
pincode.style.border = "1px solid #ccc";
}
if(error == 1)
return false;
document.getElementById('frmSettings').submit();
}
function isNumber(evt) {
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
}
return true;
}
function ValidateEmail(mail)
{
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail.value.trim()))
{
return true;
}
//alert("You have entered an invalid email address!")
return false;
}
</script>
<br><br><br>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!----------//profile--------->
<script>
$(window).load(function(){
loadingFade();
});
</script>
<!---profile-img-click-to-chang--->
<script>
$(document).ready(function() {
var readURL = function(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('.profile-pic').attr('src', e.target.result);
//$('#hdn_profilepic').val(e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$(".file-upload").on('change', function(){
readURL(this);
});
$(".upload-button").on('click', function() {
$(".file-upload").click();
});
});
</script>
<?php
include ('include/footer.php');
?>