14-07-2023 changes : venkateshwaran

This commit is contained in:
venkateswaran ubuntu 2023-07-14 23:08:00 +05:30
parent 34c6a2842d
commit af73de3740
15 changed files with 374 additions and 97 deletions

View File

@ -42,8 +42,8 @@ public function index()
public function business_list()
{
$business_list = $this->Business_model->get_business_details();
$this->layout->set('tableData', $business_list);
$business_list = $this->Business_model->get_business_details();
$this->layout->set('tableData', $business_list);
$this->layout->buffer('main_content', 'Business/business_list');
$this->layout->render('default_layout');
@ -52,9 +52,8 @@ public function business_list()
public function add_business()
{
$this->layout->set('stateData', $this->MY_Model->select('state'));
$this->layout->set('stateData', $this->MY_Model->select('state'));
$this->layout->set('ModuleData', $this->MY_Model->select('modules'));
$this->layout->buffer('main_content', 'Business/add_business');
$this->layout->render('default_layout');
@ -89,7 +88,17 @@ public function create_business()
unset($data['add_admin']);
}
$mtable = "permit_modules";
$mdata['module_id'] = $this->input->post('module_id');
$mdata['uid'] = $this->input->post('uid');
$mdata['is_active'] = 1;
$add_module = $this->MY_Model->insert($mdata,$mtable);
unset($data['module_id']);
$create_business = $this->MY_Model->insert($data,$table);
// audit history
if($create_business)
{
@ -154,7 +163,17 @@ public function edit_business()
$this->audit->set('table','business');
//fetch old_data before new_data update
$this->audit->fetch('old_data');
//insert new data
//insert new data
$mtable = "permit_modules";
$mdata['module_id'] = $this->input->post('module_id');
$mdata['uid'] = $this->input->post('uid');
$mdata['is_active'] = 1;
$businessData = $this->MY_Model->edit_option($action, $id, $table);
unset($data['module_id']);
$businessData = $this->MY_Model->edit_option($action, $id, $table);
if($businessData)
{
@ -169,11 +188,56 @@ public function edit_business()
}
public function delete_business($id)
{
{
$Data = $this->Business_model->delete_by_md5_id($id,user()->business_id,'asset');
redirect('Business/business_list');
}
//===================== MODULES =================================================
public function add_module()
{
$this->layout->buffer('main_content', 'Business/add_module_form');
$this->layout->render('default_layout');
}
public function create_add_module()
{
$table = 'modules';
$data = $this->input->post();
$data['is_active'] = 1;
$add_module = $this->MY_Model->insert($data, $table);
redirect('Business/module_list');
}
public function module_list()
{
$table = 'modules';
$module_list = $this->MY_Model->select($table);
$this->layout->set('module_list', $module_list);
$this->layout->buffer('main_content', 'Business/module_list');
$this->layout->render('default_layout');
}
public function edit_module($id)
{
$table = 'modules';
$module_data = $this->MY_Model->get_by_md5_id($id, $table);
$this->layout->set('module_data', $module_data);
$this->layout->buffer('main_content', 'Business/edit_modules');
$this->layout->render('default_layout');
}
public function edit_module_data()
{
$table = 'modules';
$id = $this->input->post('id');
$action = $this->input->post();
$action['is_active'] = 1;
$add_module = $this->MY_Model->edit_option($action, $id, $table);
redirect('Business/module_list');
}
}

View File

@ -13,11 +13,7 @@ public function get_business_details()
return $query;
}
public function get_business_by_md5_id($id)
public function get_business_by_md5_id($id)
{
$this->db->select('B.* , state.name as state_name ');
$this->db->from('business B');
@ -29,10 +25,7 @@ public function get_business_by_md5_id($id)
return $query;
}
public function delete_by_md5_id($id,$business_id,$table)
public function delete_by_md5_id($id,$business_id,$table)
{
$this->db->where('md5(id)', $id);
$this->db->where('business_id', $business_id);

View File

@ -35,21 +35,33 @@
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name">Business Name<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<div class="col-md-3 col-sm-3 ">
<input type="text" id="business_name" name="business_name" required="required" class="form-control ">
</div>
<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-3 col-sm-3 ">
<input type="email" id="email" name="email" required="required" class="form-control ">
</div>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Phone<a style="color:red;">*</a> </label>
<div class="col-md-3 col-sm-3 ">
<input id="phone" type="text" pattern="[6-9]{1}[0-9]{9}"
title="Phone number with 6-9 and remaing 9 digit with 0-9" name="phone" required="required" class="form-control" >
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Phone<a style="color:red;">*</a> </label>
<label class="control-label col-md-1 col-sm-1 " for="last-name">Select Modules<a style="color:red;">*</a></label>
<div class="col-md-5 col-sm-5 ">
<input id="phone" type="text" pattern="[6-9]{1}[0-9]{9}"
title="Phone number with 6-9 and remaing 9 digit with 0-9" name="phone" required="required" class="form-control" >
<select id="modules" name="module_id" required="required" class="form-control" >
<option value=""> Select Module </option>
<?php foreach ($ModuleData as $key => $value) { ?>
<option value="<?php echo $value->id; ?>"><?php echo $value->modules; ?></option>
<?php } ?>
</select>
</div>
<label class="control-label col-md-1 col-sm-1 " for="last-name">Select Logo </label>
@ -59,7 +71,6 @@
</div>
<div class="x_title"> </div> <br />
@ -104,16 +115,6 @@
</div>
<div class="ln_solid"></div>
<div class="item form-group">

View File

@ -0,0 +1,51 @@
<!-- Body page content -->
<div class="">
<div class="page-title">
<div class="title_left">
<h3>Add Module</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">
<div class="clearfix"></div>
</div>
<div class="x_content">
<br />
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url();?>Business/create_add_module" 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">Create Module<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="modules" name="modules" class="form-control"required>
</div>
</div>
<div class="col-md-5 col-sm-5 offset-md-1">
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
<button type="submit" class="btn btn-success">Submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- /Body page content -->

View File

@ -0,0 +1,53 @@
<!-- Body page content -->
<div class="">
<div class="page-title">
<div class="title_left">
<h3>Edit Module</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">
<div class="clearfix"></div>
</div>
<div class="x_content">
<br />
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url();?>Business/edit_module_data" 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 $module_data->id;?>">
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name">Module Name<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="modules" name="modules" class="form-control"required value="<?php echo $module_data->modules ?>">
</div>
</div>
<div class="col-md-5 col-sm-5 offset-md-1">
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
<button type="submit" class="btn btn-success">Update</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- /Body page content -->

View File

@ -0,0 +1,68 @@
<head>
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css'>
</head>
<div class="col-md-12 col-sm-12 ">
<div class="x_panel">
<div class="x_title">
<h1>Module List</h1>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="row">
<div class="col-sm-12">
<div class="card-box table-responsive">
<table id="datatable" class="table table-striped table-bordered dataTable no-footer" width="100%">
<thead>
<tr class="headings">
<th class="column-title">Modules </th>
<th class="column-title" >Action </th>
</tr>
</thead>
<tbody>
<?php foreach ($module_list as $key => $value) { ?>
<tr class="even pointer">
<td class=" "> <?php echo $value->modules; ?> </td>
<td style=" text-align: center; font-size: 16px;">
<a href="<?php echo base_url()?>Business/edit_module/<?php echo md5($value->id);?>" ><i class="fa fa-pencil"></i></a> &nbsp;
<a href="<?php echo base_url()?>Business/delete_business/<?php echo md5($value->id);?>"><i class="fa fa-trash"></i></a>&nbsp;
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<br/>
<div style="display:none" id="sub-value">
</div>
<div class="modal fade bs-example-modal-lg" id="ItemModal" tabindex="-1" role="dialog" aria-hidden="true"></div>
<script>
$(document).on('click','.bi-card-list',function(){
var id = $(this).attr("id")
$.ajax({
type: "get",
url: "<?php echo base_url()?>User/view_business_history/"+id,
success: function(response) {
response = JSON.parse(response);
console.log(response);
$('.bs-example-modal-lg').html(response);
$('.bs-example-modal-lg').modal("show");
},
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
});
});
</script>

View File

@ -59,6 +59,8 @@ public function empList()
public function addEmployee($businessId = 0)
{
$manager = $this->Emp_model->get_employee(user()->business_id);
$ModuleData = $this->Emp_model->get_modules(user()->business_id);
$this->layout->set('ModuleData', $ModuleData);
$this->layout->set('manager', $manager);
$this->layout->set('departmentData', $this->MY_Model->select_by_department_data('department_master',user()->business_id));
$this->layout->buffer('main_content', 'Employee/add_emp');

View File

@ -98,5 +98,18 @@ public function get_leave_type($business_id)
}
public function get_modules($business_id)
{
$this->db->select('permit_modules.*,modules.modules');
$this->db->from('permit_modules');
$this->db->join('modules', 'permit_modules.module_id = modules.id and modules.is_active = 1', 'left');
$this->db->where('uid', $business_id);
$this->db->where('permit_modules.is_active', 1);
$query = $this->db->get();
return $query->result();
}
}

View File

@ -97,12 +97,16 @@
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="email"> Gender</label>
<div class="col-md-5 col-sm-5 " style="padding:10px;">
<input type="radio" name="gender" value="male" />Male
<input type="radio" name="gender" value="female" />Female
</div>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Manager</label>
<div class="col-md-5 col-sm-5 ">
<select id="manager" name="manager" class="form-control">
<option value="">--Select--</option>
<?php foreach ($ModuleData as $key => $value) { ?>
<option value="<?php echo $value->id;?>"><?php echo $value->modules;?></option>
<?php } ?>
</select>
</div>
<label class="control-label col-md-1 col-sm-1 " for="first-name">Marital Status<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
@ -113,7 +117,7 @@
<option value="others">Others</option>
</select>
</div>
</div>
</div>
<div class="item form-group">
@ -219,21 +223,29 @@
<div class="col-md-5 col-sm-5 ">
<input type="text" id="employee_id" name="emp_id" value="<?php if(isset($editData)) { echo $editData->name; } ?>" class="form-control ">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="email"> Salary</label>
<div class="col-md-5 col-sm-5 ">
<input id="salary" name="salary" value="<?php if(isset($editData)) { echo $editData->mobile; } ?>" class="form-control" type="text">
</div>
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Comment</label>
</div>
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Comment</label>
<div class="col-md-5 col-sm-5 ">
<input id="comment" name="comment" value="<?php if(isset($editData)) { echo $editData->mobile; } ?>" class="form-control" type="text">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Gender</label>
<div class="col-md-5 col-sm-5 " style="padding:10px;">
<input type="radio" name="gender" value="male" />Male
<input type="radio" name="gender" value="female" />Female
</div>
</div>
<div class="item form-group">

View File

@ -53,7 +53,7 @@
<label class="control-label col-md-1 col-sm-1 " for="email"> Email<a style="color:red;">*</a> </label>
<div class="col-md-5 col-sm-5 ">
<input id="email" name="email" value="<?php if(isset($editData)) { echo $editData->email; } ?>" required="required" class="form-control" type="email" >
<input id="email" name="email" value="<?php if(isset($editData)) { echo $editData->email; } ?>" required="required" class="form-control" type="email" pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}" oninvalid="setCustomValidity('Enter a Valid E-mail Address.')" oninput="setCustomValidity('')">
</div>
</div>

View File

@ -5,7 +5,7 @@
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="myModalLabel2">Are you sure you want to delete</h6>
<h6 class="modal-title" id="myModalLabel2">Are you sure to Approve this Action</h6>
<button type="button" id="close-form" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span>
</button>
</div>

View File

@ -72,7 +72,7 @@
<?php if(check_auth() && is_admin() || is_superadmin() || is_user() ) { ?>
<li><a><i class="fa fa-user"></i> Users <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li><a href="<?php echo base_url();?>User/userList">Users List</a></li>
<li><a href="<?php echo base_url();?>Business/userList">Users List</a></li>
<?php if(user()->action_permit != 'view' ) { ?>
<li><a href="<?php echo base_url();?>User/addUser">Add Users</a></li>
<?php } ?>
@ -80,7 +80,35 @@
</li>
<?php } ?>
<?php if(check_auth() && is_admin() || is_superadmin() || is_user() ) { ?>
<?php if(check_auth() && is_superadmin() ) { ?>
<li><a><i class="fa fa-user"></i> Module <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li><a href="<?php echo base_url();?>Business/module_list">Module List</a></li>
<li><a href="<?php echo base_url();?>Business/add_module">Add Module</a></li>
</ul>
</li>
<?php } ?>
<?php if(check_auth() && is_admin() || is_user() ) { ?>
<li><a><i class="fa fa-clipboard"></i> Reports <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li><a href="<?php echo base_url();?>Asset/depreciation_report">Depreciation Reports</a></li>
<li><a href="<?php echo base_url();?>Asset/amc_report">AMC Reports</a></li>
<li><a href="<?php echo base_url();?>Asset/insurance_report">Insurance Reports</a></li>
</ul>
</li>
<?php } ?>
<?php if(check_auth() && is_admin() || is_user() ) { ?>
<br><br>
<h3>Employee</h3>
<br>
<li><a href="<?php echo base_url();?>Employee/empList"><i class="fa fa-group"></i> Employee</a></li>
<?php } ?>
@ -100,20 +128,7 @@
<li><a href="<?php echo base_url();?>Delegation/Delegation_list"><i class="fa fa-tasks" aria-hidden="true"></i> Delegation</a></li>
<?php } ?>
<?php if(check_auth() && is_admin() || is_user() ) { ?>
<li><a><i class="fa fa-clipboard"></i> Reports <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li><a href="<?php echo base_url();?>Asset/depreciation_report">Depreciation Reports</a></li>
<li><a href="<?php echo base_url();?>Asset/amc_report">AMC Reports</a></li>
<li><a href="<?php echo base_url();?>Asset/insurance_report">Insurance Reports</a></li>
</ul>
</li>
<?php } ?>
<?php } ?>
</ul>
</div>

View File

@ -47,8 +47,19 @@
</li>
<?php if(check_auth() && is_admin() || is_superadmin() || is_user() ) { ?>
<li><a href="<?php echo base_url();?>Employee/empList"><i class="fa fa-group"></i>Employee List</a></li>
<?php if(check_auth() && is_admin() || is_superadmin() || is_user() ) { ?>
<li><a><i class="fa fa-group"></i> Employees <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li><a href="<?php echo base_url();?>Employee/empList">Employee List</a></li>
<li><a href="<?php echo base_url();?>Employee/addEmployee">Add Employee</a></li>
</ul>
</li>
<?php } ?>
<?php if(check_auth() && is_user() || user()->role == null ) { ?>

View File

@ -222,7 +222,7 @@ public function createLeave()
}
else
{
if($noofdays > $leave_master_count[0]->days && $get_from_date > 0)
if($noofdays > $leave_master_count[0]->days)
{
$this->session->set_flashdata('error', '1');
redirect('Leave/applyLeave/'.'update');
@ -277,26 +277,6 @@ public function createLeave()
}
// public function get_from_to_date_count()
// { if($this->input->get('emp_id') == "")
// {
// $emp_id = user()->id;
// }
// else
// {
// $emp_id = $this->input->get('emp_id');
// }
// //$emp_id = $this->input->get('emp_id');
// $fromDate = $this->input->get('fromDate');
// $toDate = $this->input->get('toDate');
// $get_from_date = $this->Leave_model->get_from_date($emp_id, $fromDate, $toDate);
// print_r($get_from_date); die();
// }
public function edit_leave_function()
{
$id = $this->input->get('id');
@ -462,18 +442,32 @@ public function ApproveLeave()
$remaining_days = $this->Leave_model->remaining_days($emp_id, user()->business_id, $leave_year, $no_of_days->type);
//print_r($remaining_days); die();
$balance_days = $remaining_days[0]->remaining_days - $no_of_days->no_of_days;
$data['leave_bal'] = $balance_days;
$days['remaining_days'] = $balance_days;
$this->Leave_model->emp_leave_days_update($emp_id, $days, $leave_year, $business_id, $no_of_days->type);
if($remaining_days[0]->remaining_days <= 0){
$data['status'] = 'Approved';
$data['approved_by']= user()->name;
$data['approved_at'] = date('d-m-Y H:i:s');
$this->Leave_model->LeaveApprove($id, $data);
redirect('Leave/leaveList');
$data['status'] = 'Declined';
$data['declined_by']= user()->name;
$data['declined_at'] = date('d-m-Y H:i:s');
$data['DReason'] = 'No sufficient leave balance';
$this->Leave_model->LeaveDecline($id, $data);
redirect('Leave/leaveList');
}
else
{
$data['leave_bal'] = $balance_days;
$days['remaining_days'] = $balance_days;
$this->Leave_model->emp_leave_days_update($emp_id, $days, $leave_year, $business_id, $no_of_days->type);
$data['status'] = 'Approved';
$data['approved_by']= user()->name;
$data['approved_at'] = date('d-m-Y H:i:s');
$this->Leave_model->LeaveApprove($id, $data);
redirect('Leave/leaveList');
}
}
public function getManagerConfirmationPopup()

View File

@ -5,7 +5,7 @@
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title" id="myModalLabel2">Are you sure you want to delete</h6>
<h6 class="modal-title" id="myModalLabel2">Are you sure to Approve this Leave</h6>
<button type="button" id="close-form" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span>
</button>
</div>