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)
avatar @@ -325,10 +329,51 @@ $(document).ready(function() { \ No newline at end of file diff --git a/application/views/EmpIDCard.php b/application/views/EmpIDCard.php index 286920e..47c1ac2 100644 --- a/application/views/EmpIDCard.php +++ b/application/views/EmpIDCard.php @@ -33,7 +33,7 @@
- emp_mobile; ?> + emp_mobile; ?>
@@ -41,7 +41,7 @@
- emp_email; ?> + emp_email; ?>
@@ -49,7 +49,7 @@
- comp_web; ?> + comp_web; ?>
@@ -57,7 +57,7 @@
- branch_name; ?> + branch_address; ?>
@@ -77,6 +77,15 @@
- - - - - - - -
-
-

Add Company

-
- session->flashdata('status');?> -
-
-
-
- - -
(UploadSize: Below 1MB/ Type: PNG Only)
-
-
- avatar -
-
- - -
-
- - -
-
-
-
- - -
-
- - -
-
- -
-
- -
- -
- - - - - - - -
-
- - - - + + + + + + + Add Company + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +

Add Company

+ +
+ + session->flashdata('status');?> + +
+ +
+ +
+ +
+ + + + +
(UploadSize: Below 1MB/ Type: PNG Only)
+ +
+ +
+ + avatar + +
+ +
+ + + + + + +
+ +
+ + + + + + + +
+ +
+ +
+ +
+ +
+ + + + + + +
+ + + + + + + + + + + + + +
+ +
+ + + +
+ + + +
+ + + +
+
+ +
+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/application/views/changepass.php b/application/views/changepass.php index a58b5c8..e88f892 100644 --- a/application/views/changepass.php +++ b/application/views/changepass.php @@ -4,7 +4,9 @@ Change Password - + + + @@ -52,17 +63,20 @@
- - + + session->flashdata('error'); ?> + +
- - + +
- + +
@@ -75,6 +89,31 @@ - - + - - + @@ -43,10 +39,10 @@ - - - - + + + + @@ -54,8 +50,7 @@ if(isset($view)) { foreach ($view as $row) - { - + { ?> @@ -82,8 +77,7 @@ diff --git a/application/views/login.php b/application/views/login.php index a8d000e..e9b8600 100644 --- a/application/views/login.php +++ b/application/views/login.php @@ -28,11 +28,13 @@
- + + session->flashdata('user'); ?>
- + + session->flashdata('pass'); ?>
diff --git a/uploads/1683282445.png b/uploads/1683282445.png new file mode 100644 index 0000000..162fda5 Binary files /dev/null and b/uploads/1683282445.png differ diff --git a/uploads/1683282719.png b/uploads/1683282719.png new file mode 100644 index 0000000..d617894 Binary files /dev/null and b/uploads/1683282719.png differ diff --git a/uploads/1683282767.png b/uploads/1683282767.png new file mode 100644 index 0000000..9444b32 Binary files /dev/null and b/uploads/1683282767.png differ diff --git a/uploads/1683283052.png b/uploads/1683283052.png new file mode 100644 index 0000000..d617894 Binary files /dev/null and b/uploads/1683283052.png differ diff --git a/uploads/1683289319.png b/uploads/1683289319.png new file mode 100644 index 0000000..79f1b1d Binary files /dev/null and b/uploads/1683289319.png differ diff --git a/uploads/1683350088.png b/uploads/1683350088.png new file mode 100644 index 0000000..313288c Binary files /dev/null and b/uploads/1683350088.png differ diff --git a/uploads/1683350201.png b/uploads/1683350201.png new file mode 100644 index 0000000..d617894 Binary files /dev/null and b/uploads/1683350201.png differ diff --git a/uploads/1683350344.png b/uploads/1683350344.png new file mode 100644 index 0000000..d617894 Binary files /dev/null and b/uploads/1683350344.png differ diff --git a/uploads/1683608638.png b/uploads/1683608638.png new file mode 100644 index 0000000..7f620e0 Binary files /dev/null and b/uploads/1683608638.png differ diff --git a/uploads/1683616574.png b/uploads/1683616574.png new file mode 100644 index 0000000..7f620e0 Binary files /dev/null and b/uploads/1683616574.png differ
Company LogoCompany NameCompany WebsiteActionCompany LogoCompany NameCompany WebsiteAction
img