suseendhiran

This commit is contained in:
suseendhiran17 2023-01-05 15:30:48 +05:30
parent ae16527a95
commit e5c14bc282
38 changed files with 322 additions and 192 deletions

View File

@ -53,12 +53,28 @@ public function index()
public function authendicate() public function authendicate()
{ {
$user = $this->auth_model->validate_user(); $user = $this->auth_model->validate_user();
//print_r($user);die(); // print_r($user);die();
// echo hash_password('password');die(); // echo hash_password('password');die();
if (empty($user)) { if (empty($user)) {
redirect('login'); $this->session->set_flashdata('msg', "username not avaiable");
} redirect('login');
}
if (!empty($user) && $user->is_active == 0) {
$this->session->set_flashdata('msg', "deactivate user");
redirect('login');
}
// if (!empty($user)) {
// if ($user->is_active == 0) {
// $this->session->set_flashdata('msg', $user);
// redirect('login');
// }
// else{
// $this->session->set_flashdata('msg', $user);
// redirect('login');
// }
// }
// if (!empty($user) && $user->status == 0) { // if (!empty($user) && $user->status == 0) {
// // account pending // // account pending
// echo json_encode(array('st'=>2)); // echo json_encode(array('st'=>2));
@ -105,6 +121,8 @@ public function authendicate()
$this->session->set_userdata($data); $this->session->set_userdata($data);
redirect('dashboard'); redirect('dashboard');
} }
// pass the value 1 when the username or password is wrong
$this->session->set_flashdata('msg',"password doesn't match");
redirect('login'); redirect('login');
} }

View File

@ -130,6 +130,7 @@ function validate_user()
$this->db->from('users'); $this->db->from('users');
$this->db->where('email', $this->input->post('user_name')); $this->db->where('email', $this->input->post('user_name'));
$this->db->or_where('user_name', $this->input->post('user_name')); $this->db->or_where('user_name', $this->input->post('user_name'));
// $this->db->where('is_active', 1);
$this->db->limit(1); $this->db->limit(1);
$query = $this->db->get(); $query = $this->db->get();
if($query->num_rows() == 1){ if($query->num_rows() == 1){

View File

@ -39,25 +39,32 @@
</div> </div>
<div> <div>
<input type="password" class="form-control" value="password" name="password" placeholder="Password" required="" /> <input type="password" class="form-control" value="password" name="password" placeholder="Password" required="" />
<?php
if ( $this->session->flashdata('msg')) {
?>
<p id='message' style="color:red"><?php echo $this->session->flashdata('msg'); ?></p>
<?php
}
?>
</div> </div>
<div> <div>
<button type="submit" class="btn btn-primary">Log in</button> <button type="submit" class="btn btn-primary">Log in</button>
<a class="reset_pass" href="#">Lost your password?</a> <!-- <a class="reset_pass" href="#">Lost your password?</a> -->
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="separator"> <div class="separator">
<p class="change_link">New to site? <!-- <p class="change_link">New to site?
<a href="#signup" class="to_register"> Create Account </a> <a href="#signup" class="to_register"> Create Account </a>
</p> </p> -->
<div class="clearfix"></div> <div class="clearfix"></div>
<br /> <br />
<div> <div>
<h1>Venba Infotech!</h1> <!-- <h1>Venba Infotech!</h1> -->
<p>©2016 All Rights Reserved. Venba Infotech! is a Bootstrap 4 template. Privacy and Terms</p> <p>All Rights Reserved.Privacy and Terms</p>
</div> </div>
</div> </div>
</form> </form>

View File

@ -39,7 +39,8 @@
<link href="<?php echo base_url(); ?>/assets/default/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet"> <link href="<?php echo base_url(); ?>/assets/default/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">
<!-- bootstrap-datetimepicker --> <!-- bootstrap-datetimepicker -->
<link href="<?php echo base_url(); ?>/assets/default/bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css" rel="stylesheet"> <link href="<?php echo base_url(); ?>/assets/default/bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css" rel="stylesheet">
<!-- style.css -->
<link href="<?php echo base_url(); ?>/assets/default/customize/style.css" rel="stylesheet">
@ -93,13 +94,19 @@
</a> </a>
<div class="dropdown-menu dropdown-usermenu pull-right" aria-labelledby="navbarDropdown"> <div class="dropdown-menu dropdown-usermenu pull-right" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="<?php echo base_url()?>user/profile/"> Profile</a> <a class="dropdown-item" href="<?php echo base_url()?>user/profile/"> Profile</a>
<a class="dropdown-item" href="javascript:;"> <a class="dropdown-item" href="<?php echo base_url()?>user/changepassword/">Change Password</a>
<?php
if (is_admin()) {
?>
<a class="dropdown-item" href="<?php echo base_url()?>user/businessProfile/<?php echo md5(user()->business_id); ?>"> Business</a>
<?php
}
?>
<a class="dropdown-item" href="javascript:;">
<span class="badge bg-red pull-right">50%</span> <span class="badge bg-red pull-right">50%</span>
<span>Settings</span> <span>Settings</span>
</a> </a>
<a class="dropdown-item" href="<?php echo base_url()?>user/changepassword/">Change password</a> <!-- <a class="dropdown-item" href="javascript:;">Help</a> -->
<a class="dropdown-item" href="<?php echo base_url()?>user/businessProfile/"> business</a>
<a class="dropdown-item" href="javascript:;">Help</a>
<a class="dropdown-item" href="<?php echo base_url();?>auth/logout"><i class="fa fa-sign-out pull-right"></i> Log Out</a> <a class="dropdown-item" href="<?php echo base_url();?>auth/logout"><i class="fa fa-sign-out pull-right"></i> Log Out</a>
</div> </div>
</li> </li>

View File

@ -187,10 +187,10 @@ public function check_password()
} }
public function businessProfile() public function businessProfile($business_id)
{ {
// $user_list = $this->MY_Model->get_by_id( user()->id , 'users'); $business_list = $this->user_model->get_business_by_md5_id($business_id);
// $this->layout->set('userData', $user_list); $this->layout->set('businessData', $business_list);
$this->layout->buffer('main_content', 'User/business'); $this->layout->buffer('main_content', 'User/business');
$this->layout->render('default_layout'); $this->layout->render('default_layout');
} }

View File

@ -64,5 +64,17 @@ public function business()
return $query; return $query;
} }
public function get_business_by_md5_id($business_id)
{
$this->db->select('B.* , state.name as state_name ');
$this->db->from('business B');
$this->db->join('state', 'state.id = B.state', 'left');
$this->db->where('B.is_active', 1);
$this->db->where('md5(uid)', $business_id);
$query = $this->db->get();
$query = $query->row();
return $query;
}
} }

View File

@ -1,18 +1,5 @@
<!-- Body page content --> <!-- Body page content -->
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<style>
.field-icon {
float: right;
margin-left: -25px;
margin-top: -25px;
margin-right: 10px;
position: relative;
z-index: 3;
}
</style>
<div class=""> <div class="">
@ -56,7 +43,7 @@
<input type="text" id="business_id" name="business_id" value="<?php echo $data->business_id ?>" class="form-control " hidden> <input type="text" id="business_id" name="business_id" value="<?php echo $data->business_id ?>" class="form-control " hidden>
<?php } <?php }
else if(is_superadmin()) { ?> else if(is_superadmin()) { ?>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Business </label> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Business<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<select id="business_id" name="business_id" required="required" class="form-control" > <select id="business_id" name="business_id" required="required" class="form-control" >
<option value="<?php if(isset($businessData)) { echo $businessData->uid; } ?>"> <option value="<?php if(isset($businessData)) { echo $businessData->uid; } ?>">
@ -78,7 +65,7 @@
<input type="text" id="role" name="role" value="user" class="form-control " hidden> <input type="text" id="role" name="role" value="user" class="form-control " hidden>
<?php } <?php }
else if(is_superadmin()) { ?> else if(is_superadmin()) { ?>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Role </label> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Role<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<select id="role" name="role" required="required" class="form-control" > <select id="role" name="role" required="required" class="form-control" >
<option value="">Select role</option> <option value="">Select role</option>
@ -96,12 +83,12 @@
<!-- --------------------------- --> <!-- --------------------------- -->
<div class="item form-group"> <div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name </label> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Name<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="name" name="name" value="" required="required" class="form-control "> <input type="text" id="name" name="name" value="" required="required" class="form-control ">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Email </label> <label class="control-label col-md-1 col-sm-1 " for="last-name"> Email<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="email" name="email" value="" required="required" class="form-control "> <input type="text" id="email" name="email" value="" required="required" class="form-control ">
</div> </div>
@ -110,15 +97,15 @@
<!-- --------------------------- --> <!-- --------------------------- -->
<div class="item form-group"> <div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Mobile </label> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Mobile<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="mobile" name="mobile" value="" required="required" class="form-control "> <input type="text" id="mobile" name="mobile" value="" required="required" class="form-control ">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="last-name">Permit </label> <label class="control-label col-md-1 col-sm-1 " for="last-name"> Permission<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<select id="action_permit" name="action_permit" required="required" class="form-control" > <select id="action_permit" name="action_permit" required="required" class="form-control" >
<option value="">Select permit</option> <option value="">Select Permission</option>
<option value="all">All</option> <option value="all">All</option>
<option value="view">View</option> <option value="view">View</option>
</select> </select>
@ -130,18 +117,18 @@
<div class="item form-group"> <div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Username </label> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Username<a style="color:red;">*</a> </label>
<div class="col-md-3 col-sm-3 "> <div class="col-md-3 col-sm-3 ">
<input type="text" id="user_name" name="user_name" value="" required="required" class="form-control "> <input type="text" id="user_name" name="user_name" value="" required="required" class="form-control ">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Password </label> <label class="control-label col-md-1 col-sm-1 " for="last-name"> Password<a style="color:red;">*</a> </label>
<div class="col-md-3 col-sm-3 "> <div class="col-md-3 col-sm-3 ">
<input type="password" id="password" name="password" value="" required="required" class="form-control " title="password must have alphabets &#013;password requires 6 characters minimum"> <input type="password" id="password" name="password" value="" required="required" class="form-control " title="password must have alphabets &#013;password requires 6 characters minimum">
<span toggle="#password" class="fa fa-fw fa-eye field-icon toggle-password"></span> <span toggle="#password" id="toggle-password" class="fa fa-fw fa-eye field-icon toggle-password"></span>
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Confirm Password </label> <label class="control-label col-md-1 col-sm-1 " for="last-name"> Confirm Password<a style="color:red;">*</a> </label>
<div class="col-md-3 col-sm-3 "> <div class="col-md-3 col-sm-3 ">
<input type="password" id="confirm_password" name="confirm_password" value="" required="required" class="form-control "> <input type="password" id="confirm_password" name="confirm_password" value="" required="required" class="form-control ">
<span id='message'></span> <span id='message'></span>
@ -151,49 +138,6 @@
</div> </div>
<script>
// match the password and confirm password equal or not
$('#password, #confirm_password').on('keyup', function () {
$(':input[type="submit"]').prop('disabled', true);
if ($('#password').val() == $('#confirm_password').val() && $('#confirm_password').val().length > 0 ) {
$('#message').html('Matching').css('color', 'green');
$('button[type="submit"]').attr("disabled", false);
}
else if($('#password').val().length == 0 || $('#confirm_password').val().length == 0){
$('#message').html('');
}
else
$('#message').html('Not Matching').css('color', 'red');
});
// password eye icon
$(".toggle-password").click(function() {
$(this).toggleClass("fa-eye fa-eye-slash");
var input = $($(this).attr("toggle"));
if (input.attr("type") == "password") {
input.attr("type", "text");
}
else {
input.attr("type", "password");
}
});
// sadmin create admin onchange function select permit as all default
$('#role').on('change', function() {
if(this.value == "admin")
{
$('#action_permit').html('<option value="all">All</option>');
$('#action_permit').attr("style", "pointer-events: none;");
}
else
{
$('#action_permit').attr("style", "pointer-events: default;");
$('#action_permit').html(`<option value="">Select permit</option>
<option value="all">All</option>
<option value="view">View</option>`);
}
});
</script>

View File

@ -27,10 +27,10 @@
<div class="col-md-12 col-sm-12 "> <div class="col-md-12 col-sm-12 ">
<div class="x_panel"> <div class="x_panel">
<div class="x_title"> <div class="x_title">
<h2>User Report <h2>Business Report
<!-- <small>Activity report</small> --> <!-- <small>Activity report</small> -->
</h2> </h2>
<ul class="nav navbar-right panel_toolbox"> <!-- <ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a> <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
@ -42,7 +42,7 @@
</li> </li>
<li><a class="close-link"><i class="fa fa-close"></i></a> <li><a class="close-link"><i class="fa fa-close"></i></a>
</li> </li>
</ul> </ul> -->
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<div class="x_content"> <div class="x_content">
@ -51,13 +51,13 @@
<div id="crop-avatar"> <div id="crop-avatar">
<!-- Current avatar --> <!-- Current avatar -->
<?php <?php
if ($userData->profile_image == NULL) { if ($businessData->logo == NULL) {
?> ?>
<img style="width: 100%; display: block;" src="<?php echo base_url(); ?>assets/uploads/profile_picture/profile.jpg ?>" alt="Avatar" title="Change the avatar"> <img style="width: 100%; display: block;" src="<?php echo base_url(); ?>assets/uploads/logo/company-logo.png ?>" alt="Avatar" title="Change the avatar">
<?php <?php
} else { } else {
?> ?>
<img style="width: 100%; display: block;" src="<?php echo base_url(); ?>assets/uploads/profile_picture/<?php echo $userData->profile_image ?> ?>" alt="Avatar" title="Change the avatar"> <img style="width: 100%; display: block;" src="<?php echo base_url(); ?>assets/uploads/logo/<?php echo $businessData->logo ?>" alt="Avatar" title="Change the avatar">
<?php <?php
} }
?> ?>
@ -65,18 +65,22 @@
</div> </div>
</div> </div>
<div class="col-md-9 col-sm-9 "> <div class="col-md-9 col-sm-9 ">
<h3><?php echo user()->name ?></h3> <h3><?php echo $businessData->business_name ?></h3>
<ul class="list-unstyled user_data"> <ul class="list-unstyled user_data">
<li><i class="fa fa-envelope user-profile-icon"></i> <?php echo user()->email ?> <li><i class="fa fa-map-marker user-profile-icon"></i> <?php echo $businessData->address,' , ',$businessData->city,' , ',$businessData->state_name,' , ',$businessData->pincode,' , ',$businessData->country ?>
</li> </li>
<li> <li>
<i class="fa fa-phone user-profile-icon"></i> <?php echo user()->mobile ?> <i class="fa fa-envelope user-profile-icon"></i> <?php echo $businessData->email ?>
</li>
<li>
<i class="fa fa-phone user-profile-icon"></i> <?php echo $businessData->phone ?>
</li> </li>
</ul> </ul>
<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> <a class="btn btn-success" href="<?php echo base_url()?>business/get_business/<?php echo md5($businessData->id);?>"><i class="fa fa-edit m-right-xs"></i>Edit Business</a>
<br /> <br />
</div> </div>

View File

@ -1,25 +1,12 @@
<!-- Body page content --> <!-- Body page content -->
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<style>
.field-icon {
float: right;
margin-left: -25px;
margin-top: -25px;
margin-right: 10px;
position: relative;
z-index: 3;
}
</style>
<div class=""> <div class="">
<div class="page-title"> <div class="page-title">
<div class="title_left"> <div class="title_left">
<h3>Add User</h3> <h3>Change Password</h3>
</div> </div>
@ -46,9 +33,9 @@
<!-- --------------------------- --> <!-- --------------------------- -->
<div class="item form-group"> <div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Old password </label> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Old Password </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="old_password" name="old_password" value="" required="required" class="form-control "> <input type="password" id="old_password" name="old_password" value="" required="required" class="form-control ">
<span id='message1'></span> <span id='message1'></span>
</div> </div>
@ -59,7 +46,7 @@
<label class="control-label col-md-1 col-sm-1 " for="last-name"> New Password </label> <label class="control-label col-md-1 col-sm-1 " for="last-name"> New Password </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="password" id="password" name="password" value="" required="required" class="form-control " title="password must have alphabets &#013;password requires 6 characters minimum"> <input type="password" id="password" name="password" value="" required="required" class="form-control " title="password must have alphabets &#013;password requires 6 characters minimum">
<span toggle="#password" class="fa fa-fw fa-eye field-icon toggle-password"></span> <span toggle="#password" id="toggle-password" class="fa fa-fw fa-eye field-icon toggle-password"></span>
</div> </div>
</div> </div>
@ -75,6 +62,7 @@
</div> </div>
<!-- --------------------------- --> <!-- --------------------------- -->
</form>
@ -87,7 +75,7 @@
</div> </div>
</div> </div>
</form>
</div> </div>
</div> </div>
</div> </div>

View File

@ -7,7 +7,7 @@
<div class="page-title"> <div class="page-title">
<div class="title_left"> <div class="title_left">
<h3>Edit User</h3> <h3>Edit Profile</h3>
</div> </div>
@ -59,14 +59,14 @@
</div> </div>
<!-- --------------------------- --> <!-- --------------------------- -->
<div class="item form-group"> <!-- <div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Profile </label> <label class="control-label col-md-1 col-sm-1 " for="first-name"> Profile </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input id="formFile" name="profile_image" class="typeFile" type="file" > <input id="formFile" name="profile_image" class="typeFile" type="file" >
</div> </div>
</div> </div> -->
<!-- --------------------------- --> <!-- --------------------------- -->

View File

@ -53,12 +53,22 @@
<input type="text" id="mobile" name="mobile" value="<?php echo $editData->mobile; ?>" required="required" class="form-control "> <input type="text" id="mobile" name="mobile" value="<?php echo $editData->mobile; ?>" required="required" class="form-control ">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="last-name">Permit </label> <label class="control-label col-md-1 col-sm-1 " for="last-name">Permission </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<select id="action_permit" name="action_permit" required="required" class="form-control" > <select id="action_permit" name="action_permit" required="required" class="form-control" >
<option value="<?php echo $editData->action_permit; ?>"><?php echo $editData->action_permit; ?></option> <option value="<?php echo $editData->action_permit; ?>"><?php echo $editData->action_permit; ?></option>
<option value="all">all</option> <?php
<option value="view">view</option> if ($editData->action_permit == "all") {
?>
<option value="view">view</option>
<?php
}
else{
?>
<option value="all">all</option>
<?php
}
?>
</select> </select>
</div> </div>
@ -71,9 +81,9 @@
<input type="text" id="user_name" name="user_name" value="<?php echo $editData->user_name; ?>" required="required" class="form-control "> <input type="text" id="user_name" name="user_name" value="<?php echo $editData->user_name; ?>" required="required" class="form-control ">
</div> </div>
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Password </label> <label class="control-label col-md-1 col-sm-1 " for="last-name" hidden> Password </label>
<div class="col-md-5 col-sm-5 "> <div class="col-md-5 col-sm-5 ">
<input type="text" id="password" name="password" value="<?php echo $editData->password; ?>" required="required" class="form-control "> <input type="hidden" id="password" name="password" value="<?php echo $editData->password; ?>" required="required" class="form-control ">
</div> </div>
</div> </div>

View File

@ -1,6 +1,4 @@
<!-- page content --> <!-- page content -->
<div class="" role="main"> <div class="" role="main">
<div class=""> <div class="">
@ -27,10 +25,10 @@
<div class="col-md-12 col-sm-12 "> <div class="col-md-12 col-sm-12 ">
<div class="x_panel"> <div class="x_panel">
<div class="x_title"> <div class="x_title">
<h2>User Report <h2>User Details
<!-- <small>Activity report</small> --> <!-- <small>Activity report</small> -->
</h2> </h2>
<ul class="nav navbar-right panel_toolbox"> <!-- <ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a> <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
</li> </li>
<li class="dropdown"> <li class="dropdown">
@ -42,10 +40,15 @@
</li> </li>
<li><a class="close-link"><i class="fa fa-close"></i></a> <li><a class="close-link"><i class="fa fa-close"></i></a>
</li> </li>
</ul> </ul> -->
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<div class="x_content"> <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="col-md-3 col-sm-3 profile_left">
<div class="profile_img"> <div class="profile_img">
<div id="crop-avatar"> <div id="crop-avatar">
@ -53,11 +56,25 @@
<?php <?php
if ($userData->profile_image == NULL) { if ($userData->profile_image == NULL) {
?> ?>
<img style="width: 100%; display: block;" src="<?php echo base_url(); ?>assets/uploads/profile_picture/profile.jpg ?>" alt="Avatar" title="Change the avatar"> <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" 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 <?php
} else { } else {
?> ?>
<img style="width: 100%; display: block;" src="<?php echo base_url(); ?>assets/uploads/profile_picture/<?php echo $userData->profile_image ?> ?>" alt="Avatar" title="Change the avatar"> <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" 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 <?php
} }
?> ?>
@ -75,15 +92,37 @@
<i class="fa fa-phone user-profile-icon"></i> <?php echo user()->mobile ?> <i class="fa fa-phone user-profile-icon"></i> <?php echo user()->mobile ?>
</li> </li>
</ul> </ul>
<?php
<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> if (is_superadmin()) {
<br /> ?>
<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>
</div>
</form>
</div> </div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- /page content --> <!-- /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> -->

View File

@ -1,22 +1,4 @@
<style>
.btn.active {
display: none;
}
.btn span:nth-of-type(1) {
display: none;
}
.btn span:last-child {
display: block;
}
.btn.active span:nth-of-type(1) {
display: block;
}
.btn.active span:last-child {
display: none;
}
</style>
<div class="col-md-12 col-sm-12 "> <div class="col-md-12 col-sm-12 ">
<div class="x_panel"> <div class="x_panel">
<div class="x_title"> <div class="x_title">
@ -54,12 +36,12 @@
<a href="<?php echo base_url()?>user/editUser/<?php echo md5($value->id);?>" ><i class="fa fa-pencil"></i></a> <a href="<?php echo base_url()?>user/editUser/<?php echo md5($value->id);?>" ><i class="fa fa-pencil"></i></a>
&nbsp; &nbsp;
<a href="<?php echo base_url()?>user/deleteUser/<?php echo md5($value->id);?>" > <a href="<?php echo base_url()?>user/deleteUser/<?php echo md5($value->id);?>" >
<i class="darkgreen fa fa-check-circle" style="font-size:20px;" title="inactive"></i></a> <i class="#008000 fa fa-check-circle" style="font-size:20px;" title="deactivate"></i></a>
&nbsp; &nbsp;
<?php } ?> <?php } ?>
<?php if ($value->is_active == 0) { ?> <?php if ($value->is_active == 0) { ?>
<a href="<?php echo base_url()?>user/activateUser/<?php echo md5($value->id);?>" > <a href="<?php echo base_url()?>user/activateUser/<?php echo md5($value->id);?>" >
<i class="green fa fa-check-circle" style="font-size:20px;" title="active"></i></a> <i class="green fa fa-check-circle" style="font-size:20px;" title="activate"></i></a>
&nbsp; &nbsp;
<?php } ?> <?php } ?>
</td> </td>

View File

@ -149,8 +149,21 @@ $( document ).ready(function() {
}); });
// ------------------------------------------------------
// ################################################################################################################################
// show error msg for wrong password => file name : user/change_password.php
$(document).on('click','#submit',function(){ $(document).on('click','#submit',function(){
var data = $("#change-pass").serialize(); var data = $("#change-pass").serialize();
$.ajax({ $.ajax({
@ -163,42 +176,24 @@ $(document).on('click','#submit',function(){
// location.href = "<?php echo base_url();?>auth"; // location.href = "<?php echo base_url();?>auth";
} }
else { else {
$('#message1').html('Worng password').css('color', 'red'); $('#message1').html('Worng password').css('color', 'red');
alert(response); $('#password').val('');
$('#confirm_password').val('');
$('#message').html('');
} }
}, },
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) } error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
}); });
}); });
// hide err msg when the input is empty => file name : user/change_password.php , label name : Old Password
// match the password and confirm password equal or not $('#old_password').on('keyup', function () {
$('#password, #confirm_password').on('keyup', function () { if($('#old_password').val().length == 0){
$(':input[type="submit"]').prop('disabled', true); $('#message1').html('');
if ($('#password').val() == $('#confirm_password').val() && $('#confirm_password').val().length > 0 ) {
$('#message').html('Matching').css('color', 'green');
$('button[type="submit"]').attr("disabled", false);
}
else if($('#password').val().length == 0 || $('#confirm_password').val().length == 0){
$('#message').html('');
}
else
$('#message').html('Not Matching').css('color', 'red');
});
// password eye icon
$(".toggle-password").click(function() {
$(this).toggleClass("fa-eye fa-eye-slash");
var input = $($(this).attr("toggle"));
if (input.attr("type") == "password") {
input.attr("type", "text");
} }
else { });
input.attr("type", "password");
}
});
// match the password and confirm password equal or not // match the password and confirm password equal or not => file name : user/change_password.php and user/add_user.php
$('#password, #confirm_password').on('keyup', function () { $('#password, #confirm_password').on('keyup', function () {
$(':input[type="submit"]').prop('disabled', true); $(':input[type="submit"]').prop('disabled', true);
if ($('#password').val() == $('#confirm_password').val() && $('#confirm_password').val().length > 0 ) { if ($('#password').val() == $('#confirm_password').val() && $('#confirm_password').val().length > 0 ) {
@ -210,10 +205,10 @@ $('#password, #confirm_password').on('keyup', function () {
} }
else else
$('#message').html('Not Matching').css('color', 'red'); $('#message').html('Not Matching').css('color', 'red');
}); });
// password eye icon // password eye icon => file name : user/add_user.php && user/change_password.php
$(".toggle-password").click(function() { $("#toggle-password").click(function() {
$(this).toggleClass("fa-eye fa-eye-slash"); $(this).toggleClass("fa-eye fa-eye-slash");
var input = $($(this).attr("toggle")); var input = $($(this).attr("toggle"));
if (input.attr("type") == "password") { if (input.attr("type") == "password") {
@ -222,10 +217,10 @@ $('#password, #confirm_password').on('keyup', function () {
else { else {
input.attr("type", "password"); input.attr("type", "password");
} }
}); });
// sadmin create admin onchange function select permit as all default // sadmin create admin onchange function select permit as all default => file name : user/add_user.php
$('#role').on('change', function() { $('#role').on('change', function() {
if(this.value == "admin") if(this.value == "admin")
{ {
$('#action_permit').html('<option value="all">All</option>'); $('#action_permit').html('<option value="all">All</option>');
@ -238,4 +233,26 @@ $('#password, #confirm_password').on('keyup', function () {
<option value="all">All</option> <option value="all">All</option>
<option value="view">View</option>`); <option value="view">View</option>`);
} }
}); });
// file open => file name : user/profile.php
// The handler is executed at most once per element per event type => one()
$(".profilepic").one('click',function() {
$("#file_profile").trigger("click");
});
// $(".profilepic").click(function(){
// console.log("aaaa");
// // $("#file_profile").trigger("click");
// });
// change login person profile pic => file name : user/profile.php
$(document).ready(function(){
$("#file_profile").change(function(){
$(".btn-success").click();
});
});

View File

@ -0,0 +1,101 @@
/* file name =>user/change_password.php and user/add_user.php */
.field-icon {
float: right;
margin-left: -25px;
margin-top: -25px;
margin-right: 10px;
position: relative;
z-index: 3;
}
/* file name =>user/profile.php */
.fa-plus {
float: right;
margin-left: -25px;
margin-top: -70px;
margin-right: 10px;
position: relative;
z-index: 3;
font-size: 30px;
}
/* profile pic */
body {
font-family: sans-serif;
}
.profilepic {
position: relative;
/* width: 125px;
height: 125px; */
/* border-radius: 50%; */
overflow: hidden;
background-color: #fffff7;
}
.profilepic:hover .profilepic__content {
opacity: 1;
}
.profilepic:hover .profilepic__image {
opacity: .5;
}
.profilepic__image {
object-fit: cover;
opacity: 1;
transition: opacity .2s ease-in-out;
}
.profilepic__content {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: black;
opacity: 0;
transition: opacity .2s ease-in-out;
}
.profilepic__icon {
color: white;
padding-bottom: 8px;
}
.fas {
font-size: 20px;
}
.profilepic__text {
text-transform: uppercase;
font-size: 12px;
width: 50%;
text-align: center;
}
/* file name =>user/user_list.php */
.btn.active {
display: none;
}
.btn span:nth-of-type(1) {
display: none;
}
.btn span:last-child {
display: block;
}
.btn.active span:nth-of-type(1) {
display: block;
}
.btn.active span:last-child {
display: none;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB