From af73de374022e7433507ba46bd31abf056cbd0bc Mon Sep 17 00:00:00 2001 From: venkateswaran ubuntu Date: Fri, 14 Jul 2023 23:08:00 +0530 Subject: [PATCH] 14-07-2023 changes : venkateshwaran --- .../modules/Business/controllers/Business.php | 78 +++++++++++++++++-- .../Business/models/Business_model.php | 11 +-- .../modules/Business/views/add_business.php | 33 ++++---- .../Business/views/add_module_form.php | 51 ++++++++++++ .../modules/Business/views/edit_modules.php | 53 +++++++++++++ .../modules/Business/views/module_list.php | 68 ++++++++++++++++ .../modules/Employee/controllers/Employee.php | 2 + .../Employee/models/Employee_model.php | 13 ++++ .../modules/Employee/views/add_emp.php | 40 ++++++---- .../modules/Employee/views/edit_emp.php | 2 +- .../Expence/views/confirmation_popup.php | 2 +- .../Layout/views/includes/default_menu.php | 47 +++++++---- .../Layout/views/includes/employee_menu.php | 15 +++- .../modules/Leave/controllers/Leave.php | 54 ++++++------- .../Leave/views/confirmation_popup.php | 2 +- 15 files changed, 374 insertions(+), 97 deletions(-) create mode 100644 application/modules/Business/views/add_module_form.php create mode 100644 application/modules/Business/views/edit_modules.php create mode 100644 application/modules/Business/views/module_list.php diff --git a/application/modules/Business/controllers/Business.php b/application/modules/Business/controllers/Business.php index c0b27aa..43ecd53 100644 --- a/application/modules/Business/controllers/Business.php +++ b/application/modules/Business/controllers/Business.php @@ -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'); + } + } diff --git a/application/modules/Business/models/Business_model.php b/application/modules/Business/models/Business_model.php index 81c27d7..266d135 100644 --- a/application/modules/Business/models/Business_model.php +++ b/application/modules/Business/models/Business_model.php @@ -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); diff --git a/application/modules/Business/views/add_business.php b/application/modules/Business/views/add_business.php index bd8a3a4..dbaa85b 100644 --- a/application/modules/Business/views/add_business.php +++ b/application/modules/Business/views/add_business.php @@ -35,21 +35,33 @@
-
+
-
+
+ + +
+ +
+
- + +
- +
@@ -59,7 +71,6 @@
-

@@ -104,16 +115,6 @@
- - - - - - - - - -
diff --git a/application/modules/Business/views/add_module_form.php b/application/modules/Business/views/add_module_form.php new file mode 100644 index 0000000..47647a9 --- /dev/null +++ b/application/modules/Business/views/add_module_form.php @@ -0,0 +1,51 @@ + + + +
+
+ +
+

Add Module

+
+ +
+
+
+
+
+
+
+
+
+
+
+ + + + +
+ +
+ +
+
+ + +
+ + +
+
+ + +
+
+
+ + +
+
+ + + + diff --git a/application/modules/Business/views/edit_modules.php b/application/modules/Business/views/edit_modules.php new file mode 100644 index 0000000..a77dcd9 --- /dev/null +++ b/application/modules/Business/views/edit_modules.php @@ -0,0 +1,53 @@ + + + +
+
+ +
+

Edit Module

+
+ +
+
+
+
+
+
+
+
+
+
+
+ + + + + + +
+ +
+ +
+
+ + +
+ + +
+
+ + +
+
+
+ + +
+
+ + + + diff --git a/application/modules/Business/views/module_list.php b/application/modules/Business/views/module_list.php new file mode 100644 index 0000000..8c0ba1d --- /dev/null +++ b/application/modules/Business/views/module_list.php @@ -0,0 +1,68 @@ + + + +
+
+
+

Module List

+ +
+
+
+
+
+
+ + + + + + + + + + + $value) { ?> + + + + + + + + +
+
+
+
+
+
+ +
+ + + + + + \ No newline at end of file diff --git a/application/modules/Employee/controllers/Employee.php b/application/modules/Employee/controllers/Employee.php index f9bdbf6..55bd4cf 100644 --- a/application/modules/Employee/controllers/Employee.php +++ b/application/modules/Employee/controllers/Employee.php @@ -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'); diff --git a/application/modules/Employee/models/Employee_model.php b/application/modules/Employee/models/Employee_model.php index f043c22..71f2751 100644 --- a/application/modules/Employee/models/Employee_model.php +++ b/application/modules/Employee/models/Employee_model.php @@ -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(); + + } } \ No newline at end of file diff --git a/application/modules/Employee/views/add_emp.php b/application/modules/Employee/views/add_emp.php index 5983a07..7ecdbba 100644 --- a/application/modules/Employee/views/add_emp.php +++ b/application/modules/Employee/views/add_emp.php @@ -97,12 +97,16 @@
- - -
- Male - Female -
+ + +
+ +
@@ -113,7 +117,7 @@
-
+
@@ -219,21 +223,29 @@
- -
- -
- +
- + +
+ +
+ +
- + + + +
+ Male + Female +
+
diff --git a/application/modules/Employee/views/edit_emp.php b/application/modules/Employee/views/edit_emp.php index a525bdc..754dd41 100644 --- a/application/modules/Employee/views/edit_emp.php +++ b/application/modules/Employee/views/edit_emp.php @@ -53,7 +53,7 @@
- +
diff --git a/application/modules/Expence/views/confirmation_popup.php b/application/modules/Expence/views/confirmation_popup.php index d6f94c0..1f0f362 100644 --- a/application/modules/Expence/views/confirmation_popup.php +++ b/application/modules/Expence/views/confirmation_popup.php @@ -5,7 +5,7 @@ diff --git a/application/modules/Layout/views/includes/employee_menu.php b/application/modules/Layout/views/includes/employee_menu.php index 3cc3097..909be64 100644 --- a/application/modules/Layout/views/includes/employee_menu.php +++ b/application/modules/Layout/views/includes/employee_menu.php @@ -47,8 +47,19 @@ - -
  • Employee List
  • + + +
  • Employees + +
  • + + role == null ) { ?> diff --git a/application/modules/Leave/controllers/Leave.php b/application/modules/Leave/controllers/Leave.php index 9dfe65e..7de3272 100644 --- a/application/modules/Leave/controllers/Leave.php +++ b/application/modules/Leave/controllers/Leave.php @@ -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() diff --git a/application/modules/Leave/views/confirmation_popup.php b/application/modules/Leave/views/confirmation_popup.php index d6f94c0..f3a4d10 100644 --- a/application/modules/Leave/views/confirmation_popup.php +++ b/application/modules/Leave/views/confirmation_popup.php @@ -5,7 +5,7 @@