142 lines
6.7 KiB
PHP
142 lines
6.7 KiB
PHP
<!-- page content -->
|
|
<div class="" role="main">
|
|
<div class="">
|
|
<div class="page-title">
|
|
<div class="title_left">
|
|
<h3>User Profile</h3>
|
|
</div>
|
|
|
|
<div class="title_right">
|
|
<!-- <div class="col-md-5 col-sm-5 form-group pull-right top_search">
|
|
<div class="input-group">
|
|
<input type="text" class="form-control" placeholder="Search for...">
|
|
<span class="input-group-btn">
|
|
<button class="btn btn-secondary" type="button">Go!</button>
|
|
</span>
|
|
</div>
|
|
</div> -->
|
|
</div>
|
|
</div>
|
|
|
|
<div class="clearfix"></div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-12 col-sm-12 ">
|
|
<div class="x_panel">
|
|
<div class="x_title">
|
|
<h2>User Details</h2>
|
|
|
|
<div class="clearfix"></div>
|
|
</div>
|
|
<div class="x_content">
|
|
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post"
|
|
action="<?php echo base_url();?>User/editprofiles" enctype="multipart/form-data">
|
|
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>"
|
|
value="<?php echo $this->security->get_csrf_hash();?>">
|
|
<input type="hidden" name="id" value="<?php echo user()->id; ?>">
|
|
<button type="submit" class="btn btn-success" hidden>Update</button>
|
|
|
|
<div class="col-md-3 col-sm-3 profile_left">
|
|
<div class="profile_img">
|
|
<div id="crop-avatar">
|
|
<!-- Current avatar -->
|
|
<?php
|
|
if ($userData->profile_image == NULL) {
|
|
?>
|
|
<div class="profilepic">
|
|
<img style="width: 100%;height: 100%; display: block;"
|
|
src="<?php echo base_url(); ?>/assets/uploads/profile_picture/profile.jpg"
|
|
alt="Avatar" title="Change the avatar">
|
|
<input id="file_profile" name="profile_image" class="typeFile1" type="file" accept=".png, .jpg, .jpeg" hidden />
|
|
|
|
<div class="profilepic__content">
|
|
<span class="profilepic__icon"><i class="fa fa-camera"
|
|
style="font-size:25px;color:black"></i></span>
|
|
<span class="profilepic__text"><b>Edit Profile</b></span>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
} else {
|
|
?>
|
|
<div class="profilepic">
|
|
<img class="profilepic__image"
|
|
style="width: 100%; display: block;border-radius:50%"
|
|
src="<?php echo base_url();?>/assets/uploads/profile_picture/<?php echo $userData->profile_image ?>"
|
|
alt="Avatar" title="Change the avatar">
|
|
<input id="file_profile" name="profile_image" class="typeFile1" type="file"
|
|
accept=".png, .jpg, .jpeg" onchange="checkFileFormat()" hidden />
|
|
<div class="profilepic__content">
|
|
<span class="profilepic__icon"><i class="fa fa-camera"
|
|
style="font-size:25px;color:black"></i></span>
|
|
<span class="profilepic__text"><b>Edit Profile</b></span>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-9 col-sm-9 ">
|
|
<h3><?php echo user()->name ?></h3>
|
|
|
|
<ul class="list-unstyled user_data">
|
|
<li><i class="fa fa-envelope user-profile-icon"></i> <?php echo user()->email ?>
|
|
</li>
|
|
|
|
<li>
|
|
<i class="fa fa-phone user-profile-icon"></i> <?php echo user()->mobile ?>
|
|
</li>
|
|
</ul>
|
|
<?php
|
|
if (is_superadmin()) {
|
|
?>
|
|
<a class="btn btn-success"
|
|
href="<?php echo base_url()?>User/editprofile/<?php echo md5(user()->id);?>"><i
|
|
class="fa fa-edit m-right-xs"></i>Edit Profile</a>
|
|
<br />
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- /page content -->
|
|
|
|
|
|
<!-- <script>
|
|
// file open => file name : user/profile.php
|
|
$(".profilepic").click(function(){
|
|
$("#file_profile").trigger("click");
|
|
});
|
|
|
|
// change login person profile pic => file name : user/profile.php
|
|
$(document).ready(function(){
|
|
$("#file_profile").change(function(){
|
|
$(".btn-success").click();
|
|
});
|
|
});
|
|
</script> -->
|
|
<script>
|
|
function checkFileFormat() {
|
|
var input = document.getElementById('file_profile');
|
|
var fileName = input.value;
|
|
var allowedFormats = ['.png', '.jpg', '.jpeg'];
|
|
|
|
if (fileName) {
|
|
var fileExtension = fileName.slice((fileName.lastIndexOf(".") - 1 >>> 0) + 2);
|
|
|
|
if (allowedFormats.indexOf(fileExtension.toLowerCase()) === -1) {
|
|
alert('Please choose a valid image file (PNG, JPG, JPEG).');
|
|
input.value = ''; // Clear the file input to allow choosing a new file
|
|
}
|
|
}
|
|
}
|
|
</script>
|