diff --git a/Apollo/api/application/controllers/Employee_Controller.php b/Apollo/api/application/controllers/Employee_Controller.php index cc6b0ffb..8fab0765 100755 --- a/Apollo/api/application/controllers/Employee_Controller.php +++ b/Apollo/api/application/controllers/Employee_Controller.php @@ -476,6 +476,7 @@ class Employee_Controller extends REST_Controller { $req['HomeBranch'] = $this->post('HomeBranch'); $req['FinanceModuleAccess'] = $this->post('FinanceModuleAccess') == 1 ? '1' : '0'; + $req['IsActive'] = $this->post('IsActive') == 1 ? '1' : '0'; // echo $req['FinanceModuleAccess'];exit(); $req['UpdatedBy'] = $this->post('updateBy'); $date = date('Y-m-d H:i:s'); diff --git a/Apollo/api/application/models/Login_model.php b/Apollo/api/application/models/Login_model.php index 9a11cd5f..2de97c58 100755 --- a/Apollo/api/application/models/Login_model.php +++ b/Apollo/api/application/models/Login_model.php @@ -34,7 +34,7 @@ class Login_model extends CI_Model if ($mobile == $loginDetails->MobileNumber) { if ($password == $loginDetails->Password) { - if($loginDetails->ListCode !=STUDENT){ + if($loginDetails->ListCode == SUPER_ADMIN){ //print_r($loginDetails);exit(); $this->db->select('t1.MobileNumber, t1.ListCode, t1.ID, t2.BranchCode, t2.FinanceModuleAccess'); $this->db->from('' . LOGIN . ' as t1'); @@ -57,7 +57,26 @@ class Login_model extends CI_Model $result['loginStatus'] = false; $result['message'] = "Your login is de-activated."; } - + } else if ($loginDetails->ListCode == ADMIN || $loginDetails->ListCode == EMPLOYEE) { + //print_r($loginDetails);exit(); + $this->db->select('t1.MobileNumber, t3.ListCode, t1.ID, t3.BranchCode, t3.FinanceModuleAccess'); + $this->db->from('' . LOGIN . ' as t1'); + $this->db->join('' . STAFF . ' as t2', 't1.StaffID = t2.StaffID', 'LEFT'); + $this->db->join('' . STAFF_BRANCH . ' as t3', 't3.StaffID = t2.StaffID', 'LEFT'); + $this->db->where('t1.MobileNumber', $mobile); + $this->db->where('t2.IsActive', 1); + $this->db->where('t3.IsActive', 1); + $this->db->order_by('t3.CreatedOn', 'ASC'); + $this->db->group_by('t3.StaffID'); + $responseDetails = $this->db->get()->first_row(); + if($responseDetails){ + $result['loginStatus'] = true; + $result['details'] = $responseDetails; + } + else{ + $result['loginStatus'] = false; + $result['message'] = "Your login is de-activated."; + } } else if($loginDetails->ListCode == STUDENT){ $this->db->select('LO.MobileNumber, LO.ListCode, LO.ID,ST.BranchCode'); @@ -80,9 +99,6 @@ class Login_model extends CI_Model $result['loginStatus'] = false; $result['message'] = "Your login is de-activated or don't have login."; } - - - } else { $result['loginStatus'] = false; $result['message'] = "Please Enter Valid Password !!"; diff --git a/Apollo/assets/js/controllers/employeeCtrl.js b/Apollo/assets/js/controllers/employeeCtrl.js index 81ee37f9..c3eeafb7 100755 --- a/Apollo/assets/js/controllers/employeeCtrl.js +++ b/Apollo/assets/js/controllers/employeeCtrl.js @@ -234,7 +234,8 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ 'JobResponsibility': '', 'IsActive': '', 'FinanceModuleAccess': '', - 'HomeBranch': '' + 'HomeBranch': '', + 'IsActive': '' } $scope.getEmpEditBranchDetails = function(p) { @@ -249,6 +250,7 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ $scope.empEditBranchDetails.JobResponsibility = p.JobResponsibility; $scope.empEditBranchDetails.FinanceModuleAccess = p.FinanceModuleAccess == 1 ? true : false; $scope.empEditBranchDetails.HomeBranch = p.HomeBranch; + $scope.empEditBranchDetails.IsActive = p.IsActive == 1 ? true : false ; } $scope.getEmpEditBranchDetailsCancel = function() { @@ -264,7 +266,8 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ 'JobResponsibility': '', 'IsActive': '', 'FinanceModuleAccess': '', - 'HomeBranch': '' + 'HomeBranch': '', + 'IsActive': '' } } @@ -300,7 +303,8 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ 'updateBranch': $scope.empEditBranchDetails.BranchCode, 'updateBy': localDetails.localUserID, 'FinanceModuleAccess': $scope.empEditBranchDetails.FinanceModuleAccess == true ? 1 : 0, - 'HomeBranch': $scope.empEditBranchDetails.HomeBranch + 'HomeBranch': $scope.empEditBranchDetails.HomeBranch, + 'IsActive': $scope.empEditBranchDetails.IsActive == true ? 1 : 0 } // p.IsActive = p.IsActive === true ? 1 : 0; var req = { @@ -327,7 +331,8 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ 'JobResponsibility': '', 'IsActive': '', 'FinanceModuleAccess': '', - 'HomeBranch': '' + 'HomeBranch': '', + 'IsActive': '' }; } else { // $scope.ldloading1[loading.replace('-', '_')] = false; diff --git a/Apollo/assets/views/editEmployeeBranchDetails.html b/Apollo/assets/views/editEmployeeBranchDetails.html index b0031499..feb00509 100755 --- a/Apollo/assets/views/editEmployeeBranchDetails.html +++ b/Apollo/assets/views/editEmployeeBranchDetails.html @@ -20,6 +20,8 @@