From 9ac354318c03be5f89276bf6b41121988017c1ae Mon Sep 17 00:00:00 2001 From: suseendhiran17 <58357088+suseendhiran17@users.noreply.github.com> Date: Wed, 10 May 2023 09:40:17 +0530 Subject: [PATCH] suseendhiran --- application/controllers/CompanyController.php | 25 +- .../controllers/EmployeeController.php | 64 +- application/controllers/LoginController.php | 35 +- application/models/EmployeeModel.php | 49 +- application/views/AddEmp.php | 97 ++- application/views/DisableEmployeeList.php | 17 +- application/views/EditEmp.php | 72 +- application/views/EmpIDCard.php | 38 +- application/views/EmpPreview.php | 6 +- application/views/EmployeeList.php | 14 +- application/views/Gsetting.php | 660 ++++++++++++------ application/views/changepass.php | 51 +- application/views/companylist.php | 24 +- application/views/editcompanylist.php | 51 +- application/views/login.php | 6 +- uploads/1683282445.png | Bin 0 -> 784311 bytes uploads/1683282719.png | Bin 0 -> 788469 bytes uploads/1683282767.png | Bin 0 -> 744561 bytes uploads/1683283052.png | Bin 0 -> 788469 bytes uploads/1683289319.png | Bin 0 -> 482691 bytes uploads/1683350088.png | Bin 0 -> 153593 bytes uploads/1683350201.png | Bin 0 -> 788469 bytes uploads/1683350344.png | Bin 0 -> 788469 bytes uploads/1683608638.png | Bin 0 -> 1273 bytes uploads/1683616574.png | Bin 0 -> 1273 bytes 25 files changed, 875 insertions(+), 334 deletions(-) create mode 100644 uploads/1683282445.png create mode 100644 uploads/1683282719.png create mode 100644 uploads/1683282767.png create mode 100644 uploads/1683283052.png create mode 100644 uploads/1683289319.png create mode 100644 uploads/1683350088.png create mode 100644 uploads/1683350201.png create mode 100644 uploads/1683350344.png create mode 100644 uploads/1683608638.png create mode 100644 uploads/1683616574.png diff --git a/application/controllers/CompanyController.php b/application/controllers/CompanyController.php index 527b7c8..b5c94cc 100644 --- a/application/controllers/CompanyController.php +++ b/application/controllers/CompanyController.php @@ -32,6 +32,7 @@ class CompanyController extends CI_Controller{ if($this->input->post('submit')){ + print_r($this->input->post());die(); $config = array( 'file_name'=>time(), @@ -116,6 +117,7 @@ class CompanyController extends CI_Controller{ $id=$this->input->get('id'); $result['data']=$this->CompanyModel->editcompany($id); $result['bdata']=$this->CompanyModel->get_branch($id); + // print_r($result);die(); // echo '
'; print_r($result); die();
$this->load->view('editcompanylist',$result);
@@ -165,17 +167,36 @@ class CompanyController extends CI_Controller{
$count = count($this->input->post('branch_name'));
+
+ // print_r($this->input->post('new_branch_name'));die();
for($i=0;$i<$count;$i++)
{
- $id = $this->input->post('branch_id');
+ // echo $this->input->post('branch_id')[$i];die();
+ $id = $this->input->post('branch_id')[$i];
$branch['branch_name']= $this->input->post('branch_name')[$i];
$branch['branch_address'] = $this->input->post('address')[$i];
+ $branch['maplink'] = $this->input->post('maplink')[$i];
// echo ''; echo $id; print_r($branch); die();
$this->CompanyModel->updatebranches($branch, $id);
+ }
+ if ($this->input->post('new_branch_name')) {
+ $count1 = count($this->input->post('new_branch_name'));
+
+ for($i=0;$i<$count1;$i++) {
+
+ $branch['comp_id'] = $this->input->post('comp_id');
+ $branch['branch_name']= $this->input->post('new_branch_name')[$i];
+ $branch['branch_address'] = $this->input->post('new_address')[$i];
+ $branch['maplink'] = $this->input->post('new_maplink')[$i];
+
+ // echo ''; print_r($branch); die();
- }
+ $result=$this->CompanyModel->branches($branch);
+
+ }
+ }
$this->session->set_flashdata('status', '"'. $company['comp_name'] .'" -Company Updated Sucessfully');
redirect('CompanyController/companylist');
diff --git a/application/controllers/EmployeeController.php b/application/controllers/EmployeeController.php
index e2697af..5c7c21c 100644
--- a/application/controllers/EmployeeController.php
+++ b/application/controllers/EmployeeController.php
@@ -132,6 +132,8 @@ public function addemp()
$id=$this->input->get('id');
+ $result['get_comp'] = $this->EmployeeModel->getcomp();
+ $result['get_branch'] = $this->EmployeeModel->getbranch();
$result['data']=$this->EmployeeModel->editrecords($id);
$this->load->view('EditEmp',$result);
}
@@ -204,30 +206,37 @@ public function addemp()
- public function viewemp($id)
+ public function viewemp($id = null)
{
- if($this->session->userdata('user_id'))
- {
-
- $result['view'] = $this->EmployeeModel->viewEmployee($id);
- $this->load->view('EmpPreview', $result);
-
- }
- else
- {
- redirect('LoginController');
- }
+ if($this->session->userdata('user_id'))
+ {
+
+ $result['view'] = $this->EmployeeModel->viewEmployee($id);
+ if ($result['view'] == '') {
+ echo 'User information not avaiable';
+ } else {
+ $this->load->view('EmpPreview', $result);
+ }
+ }
+ else {
+ echo 'User information not avaiable';
+ }
+
}
- public function EmpIDCard($id)
+ public function EmpIDCard($id = null)
{
-
$result['view'] = $this->EmployeeModel->viewEmployee($id);
- $this->load->view('EmpIDCard', $result);
+ if ($result['view'] == '') {
+ echo 'User information not avaiable';
+ } else {
+ $this->load->view('EmpIDCard', $result);
+ }
+
}
@@ -345,6 +354,31 @@ public function vcard(){
force_download($filename, $vcard);
}
+public function deleteEmp()
+{
+ $id = $this->input->get('id');
+ $this->db->set('is_active', '2');
+ $this->db->where('emp_id', $id);
+ $this->db->update('employees');
+ redirect( 'EmployeeController/DisableEmployeeList' );
+}
+
+public function check_emp_code()
+{
+ if($this->input->post('emp_code'))
+ {
+ $data = $this->EmployeeModel->check_code_exist($this->input->post('emp_code'));
+ if ($data)
+ {
+ echo true;
+ }
+ else
+ {
+ echo false;
+ }
+ }
+}
+
}
diff --git a/application/controllers/LoginController.php b/application/controllers/LoginController.php
index a929d6d..5ec5c42 100644
--- a/application/controllers/LoginController.php
+++ b/application/controllers/LoginController.php
@@ -67,20 +67,23 @@ class LoginController extends CI_Controller
// $email_verify = $this->LoginModel->validate_user($user);
if (empty($user)) {
- $this->session->set_flashdata('msg1', "Email not available");
+ $this->session->set_flashdata('username', $this->input->post('email'));
+ $this->session->set_flashdata('user', "Invalid email id");
$this->load->view('login');
}
else{
- if ($user && password_verify($password, $user->password))
+ if ($user && $password == $user->password)
{
$this->session->set_userdata('user_id', $user->email);
redirect('Dashboard');
}
else
{
- $this->session->set_flashdata('msg2',"Invalid Password");
+ $this->session->set_userdata('user_id', $user->email);
+ $this->session->set_flashdata('password', $this->input->post('password'));
+ $this->session->set_flashdata('pass',"Invalid Password");
$this->load->view('login');
}
}
@@ -120,20 +123,22 @@ public function updatepass()
$this->load->view('changepass');
}
-
- if ($new_password != $confirm_password)
+ else
{
- $this->session->set_flashdata('error', 'The new password and confirm password do not match.');
- $this->load->view('changepass');
+ if ($new_password != $confirm_password)
+ {
+ $this->session->set_flashdata('error', 'The new password and confirm password do not match.');
+ $this->load->view('changepass');
+ }
+
+ $hashed_password = password_hash($new_password, PASSWORD_DEFAULT);
+
+
+ $this->LoginModel->update_user_password($user_id, $hashed_password);
+
+ $this->session->set_flashdata('success', 'Your password has been changed.');
+ redirect('LoginController');
}
-
- $hashed_password = password_hash($new_password, PASSWORD_DEFAULT);
-
-
- $this->LoginModel->update_user_password($user_id, $hashed_password);
-
- $this->session->set_flashdata('success', 'Your password has been changed.');
- redirect('LoginController');
}
diff --git a/application/models/EmployeeModel.php b/application/models/EmployeeModel.php
index f9444cf..8511971 100644
--- a/application/models/EmployeeModel.php
+++ b/application/models/EmployeeModel.php
@@ -33,6 +33,7 @@ public function getbranch(){
}
public function EmployeeList(){
+ // echo $this->siteURL();die();
$query = $this->db->query('SELECT employees.* , company.comp_name,branches.branch_name
FROM employees LEFT JOIN company
@@ -68,6 +69,17 @@ return $query->result();
}
+ public function check_code_exist($id)
+ {
+ $this->db->select();
+ $this->db->from('employees');
+ $this->db->where('emp_code', $id);
+ $this->db->where('is_active', 1);
+ $query = $this->db->get();
+ $query = $query->result_array();
+ return $query;
+ }
+
public function updateemp($employee, $id){
@@ -94,11 +106,12 @@ return $query->result();
$this->db->from('employees A');
$this->db->join('company', 'company.comp_id = A.comp_id', 'left');
$this->db->join('branches', 'branches.branch_id = A.branch_id', 'left');
- $this->db->where('md5(A.emp_id)', $id);
+ $this->db->where('A.emp_code', $id);
$this->db->where('A.is_active', 1);
$query = $this->db->get();
$query = $query->row();
+ // echo $this->db->last_query(); die;
return $query;
@@ -109,6 +122,31 @@ return $query->result();
}
+ // public function view_employee($id)
+ // {
+
+
+
+ // $this->db->select('A.* , company.*, branches.* ');
+ // $this->db->from('employees A');
+ // $this->db->join('company', 'company.comp_id = A.comp_id', 'left');
+ // $this->db->join('branches', 'branches.branch_id = A.branch_id', 'left');
+ // $this->db->where('A.emp_code', $id);
+ // $this->db->where('A.is_active', 1);
+
+ // $query = $this->db->get();
+ // $query = $query->row();
+ // // echo $this->db->last_query(); die;
+ // return $query;
+
+
+ // // $this->db->where('md5(emp_id)', $id);
+ // // $query = $this->db->get('employees');
+ // // return $query->result_array();
+
+ // }
+
+
public function DisableEmployeeList(){
@@ -179,6 +217,15 @@ public function empcode_validation($empid){
}
+
+ public function delete_emp_by_md5_id($id,$business_id,$table)
+ {
+ $this->db->where('md5(id)', $id);
+ $this->db->where('business_id', $business_id);
+ $this->db->set('is_active',0);
+ $this->db->update($table);
+ return;
+ }
}
diff --git a/application/views/AddEmp.php b/application/views/AddEmp.php
index 724dd72..f1f2dd7 100644
--- a/application/views/AddEmp.php
+++ b/application/views/AddEmp.php
@@ -81,12 +81,16 @@ $('#empidErr').hide();
data:{ empid:empid},
success:function(response)
{
-
+alert(response)
if (response == true)
{
$('#empidErr').show();
- $('#empidErr').html('This Employee Code Alredy Exist');
- $("#empid").val('');
+ $('#empidErr').html('This Employee Code Alredy Exist.');
+ $("#submit").attr("disabled", true);
+ }
+ else
+ {
+ $("#submit").attr("disabled", false);
}
}
});
@@ -276,9 +280,9 @@ if (companyName == '') {
-
+
- (JPG, PNG Only | Max 1MB)
+ (JPG, JPEG , PNG Only | Max 1MB | 300 x 300)
@@ -325,10 +329,51 @@ $(document).ready(function() {