suseendhiran

This commit is contained in:
suseendhiran17 2023-01-03 11:55:58 +05:30
parent e49dbb3f99
commit ce5ee8c806
8 changed files with 371 additions and 19 deletions

View File

@ -42,7 +42,7 @@
</div>
<div>
<button type="submit" class="btn btn-primary">Log in</button>
<a class="reset_pass" href="<?php echo base_url()?>user/changepassword">Lost your password?</a>
<a class="reset_pass" href="#">Lost your password?</a>
</div>
<div class="clearfix"></div>

View File

@ -87,12 +87,14 @@
<?php if(check_auth() && is_admin() || is_user()){echo user()->name;}else{echo user()->name; }?>
</a>
<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:;">
<span class="badge bg-red pull-right">50%</span>
<span>Settings</span>
</a>
<a class="dropdown-item" href="javascript:;">Help</a>
<a class="dropdown-item" href="<?php echo base_url()?>user/changepassword/">Change password</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>
</div>
</li>

View File

@ -46,7 +46,7 @@ public function userList()
$user_list = $this->user_model->get_admin();
}
else if(is_admin()) {
$user_list = $this->user_model->get_user(user()->business_id , "user");
$user_list = $this->user_model->get_user(user()->business_id);
}
$this->layout->set('tableData', $user_list);
$this->layout->buffer('main_content', 'User/user_list');
@ -160,8 +160,70 @@ public function editprofiles()
public function changepassword()
{
echo "hai";
// $this->load->view('change_password');
// $password = md5(user()->password);
// $this->layout->set('pass', $password);
$this->layout->buffer('main_content', 'user/change_password');
$this->layout->render('default_layout');
}
public function check_password()
{
$old_password = $this->input->post('old_password');
if (password_verify($old_password, user()->password)) {
$data['password'] = hash_password($this->input->post('password'));
$table="users";
$userData = $this->MY_Model->edit_option($data, user()->id, $table);
$this->session->sess_destroy();
echo "success";
}
else{
echo "fail";
}
}
public function businessProfile()
{
// $user_list = $this->MY_Model->get_by_id( user()->id , 'users');
// $this->layout->set('userData', $user_list);
$this->layout->buffer('main_content', 'User/business');
$this->layout->render('default_layout');
}
// public function editprofile($id)
// {
// $usertData = $this->user_model->get_user_by_md5_id($id,user()->business_id);
// $this->layout->set('editData', $usertData);
// $this->layout->buffer('main_content', 'User/edit_profile');
// $this->layout->render('default_layout');
// }
// public function editprofiles()
// {
// $table="users";
// $action = $this->input->post();
// $id = $this->input->post('id');
// //file upload confic
// $user_image['upload_path'] = APPPATH. '../assets/uploads/profile_picture';
// $user_image['allowed_types'] = 'jpg|png';
// $user_image['max_size'] = 80000;
// //upload
// $this->load->library('upload', $user_image);
// $this->upload->initialize($user_image);
// if ( ! $this->upload->do_upload('profile_image'))
// {
// $error = array('error' => $this->upload->display_errors());
// unset($action['profile_image']);
// } else{
// $upload_user_image = $this->upload->data();
// $action['profile_image'] = $upload_user_image['file_name'];
// }
// $userData = $this->MY_Model->edit_option($action, $id, $table);
// redirect('user/profile');
// }
}

View File

@ -6,7 +6,8 @@ public function get_user($business_id)
$this->db->select('*');
$this->db->from('users');
$this->db->where('business_id', $business_id);
$this->db->where('role', 'user');
$this->db->order_by('id','DESC');
// $this->db->where('role', 'user');
// $this->db->where('role', 'user');
// $this->db->where('is_active', 1);
$query = $this->db->get();
@ -19,6 +20,7 @@ public function get_admin()
$this->db->select('*');
$this->db->from('users');
$this->db->where('role !=', 'sadmin');
// $this->db->order_by('id','ASC');
$query = $this->db->get();
$query = $query->result();
return $query;
@ -39,7 +41,6 @@ public function delete_user_by_md5_id($id,$business_id)
{
$this->db->where('md5(id)', $id);
$this->db->where('business_id', $business_id);
$this->db->where('role', 'user');
$this->db->set('is_active',0);
$this->db->update('users');
return;
@ -49,7 +50,6 @@ public function activate_inactive_users($id,$business_id)
{
$this->db->where('md5(id)', $id);
$this->db->where('business_id', $business_id);
$this->db->where('role', 'user');
$this->db->set('is_active',1);
$this->db->update('users');
return;

View File

@ -42,6 +42,8 @@
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url();?>User/createUser" 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="text" id="created_by" name="created_by" value="<?php echo $data->created_by ?>" class="form-control " hidden>
<?php if (is_superadmin()) { ?>
<div class="item form-group">
@ -86,13 +88,6 @@
}
?>
<label class="control-label col-md-1 col-sm-1 " for="first-name" hidden> Created By </label>
<div class="col-md-2 col-sm-2 ">
<input type="text" id="created_by" name="created_by" value="<?php echo $data->created_by ?>" class="form-control " hidden>
</div>
</div>
<!-- <br /> <h6></h6> <div class="x_title"> </div> <br /> -->
@ -208,7 +203,7 @@
<div class="ln_solid"></div>
<div class="item form-group">
<div class="col-md-6 col-sm-6 offset-md-9">
<div class="col-md-3 col-sm-3 offset-md-9">
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
<button class="btn btn-primary" type="reset">Reset</button>
<button type="submit" class="btn btn-success">Submit</button>

View File

@ -0,0 +1,142 @@
<!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">
<!-- Bootstrap -->
<link href="../vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
<link href="../vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<!-- NProgress -->
<link href="../vendors/nprogress/nprogress.css" rel="stylesheet">
<!-- bootstrap-daterangepicker -->
<link href="../vendors/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">
<!-- Custom Theme Style -->
<link href="../build/css/custom.min.css" rel="stylesheet">
</head>
<body class="nav-md">
<div class="container body">
<div class="main_container">
<!-- page content -->
<div class="" role="main">
<div class="">
<div class="page-title">
<div class="title_left">
<h3> Business</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 Report
<!-- <small>Activity report</small> -->
</h2>
<ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Settings 1</a>
<a class="dropdown-item" href="#">Settings 2</a>
</div>
</li>
<li><a class="close-link"><i class="fa fa-close"></i></a>
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content">
<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) {
?>
<img style="width: 100%; display: block;" src="<?php echo base_url(); ?>assets/uploads/profile_picture/profile.jpg ?>" alt="Avatar" title="Change the avatar">
<?php
} 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">
<?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>
<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 />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /page content -->
</div>
</div>
<!-- jQuery -->
<script src="../vendors/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="../vendors/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<!-- FastClick -->
<script src="../vendors/fastclick/lib/fastclick.js"></script>
<!-- NProgress -->
<script src="../vendors/nprogress/nprogress.js"></script>
<!-- morris.js -->
<script src="../vendors/raphael/raphael.min.js"></script>
<script src="../vendors/morris.js/morris.min.js"></script>
<!-- bootstrap-progressbar -->
<script src="../vendors/bootstrap-progressbar/bootstrap-progressbar.min.js"></script>
<!-- bootstrap-daterangepicker -->
<script src="../vendors/moment/min/moment.min.js"></script>
<script src="../vendors/bootstrap-daterangepicker/daterangepicker.js"></script>
<!-- Custom Theme Scripts -->
<script src="../build/js/custom.min.js"></script>
</body>
</html>

View File

@ -1 +1,152 @@
<h1>working</h1>
<!-- 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="page-title">
<div class="title_left">
<h3>Add User</h3>
</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"> -->
<!-- <ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
</li>
</ul> -->
<!-- <h6>General Information</h6> -->
<!-- <div class="clearfix"></div> -->
<!-- </div> -->
<div class="x_content">
<br />
<form id="change-pass" data-parsley-validate class="form-horizontal form-label-left" method="post" action="" enctype="multipart/form-data">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
<!-- --------------------------- -->
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Old password </label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="old_password" name="old_password" value="" required="required" class="form-control ">
<span id='message1'></span>
</div>
</div>
<!-- --------------------------- -->
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="last-name"> New Password </label>
<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">
<span toggle="#password" class="fa fa-fw fa-eye field-icon toggle-password"></span>
</div>
</div>
<!-- --------------------------- -->
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="last-name"> Confirm Password </label>
<div class="col-md-5 col-sm-5 ">
<input type="password" id="confirm_password" name="confirm_password" value="" required="required" class="form-control ">
<span id='message'></span>
</div>
</div>
<!-- --------------------------- -->
<script>
$(document).on('click','#submit',function(){
var data = $("#change-pass").serialize();
$.ajax({
type: "post",
url: "<?php echo base_url();?>user/check_password",
data: data,
json: true,
success: function(response) {
if (response === "success") {
// location.href = "<?php echo base_url();?>auth";
}
else {
$('#message1').html('Worng password').css('color', 'red');
alert(response);
}
},
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
});
});
// 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");
}
});
</script>
<div class="ln_solid"></div>
<div class="item form-group">
<div class="col-md-3 col-sm-3 offset-md-9">
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
<button class="btn btn-primary" type="reset">Reset</button>
<button type="" id="submit" class="btn btn-success">Submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- /Body page content -->

View File

@ -72,7 +72,7 @@
<div class="ln_solid"></div>
<div class="item form-group">
<div class="col-md-6 col-sm-6 offset-md-10">
<div class="col-md-3 col-sm-3 offset-md-9">
<button class="btn btn-primary" onclick="history.back()">Cancel</button>
<button type="submit" class="btn btn-success">Update</button>
</div>