methods['employee_get']['limit'] = 500; // 500 requests per hour per user/key $this->methods['employee_post']['limit'] = 100; // 100 requests per hour per user/key $this->methods['employee_delete']['limit'] = 50; // 50 requests per hour per user/key $this->methods['getRoleDetails_post']['limit'] = 100; $this->methods['getMasterBranchDetails_post']['limit'] = 100; $this->methods['addEmployee_post']['limit'] = 100; $this->methods['check_exist_post']['limit'] = 100; $this->methods['check_update_exist_post']['limit'] = 100; $this->methods['updateEmployee_post']['limit'] = 100; $this->methods['updateEmpBranchDetail_post']['limit'] = 100; // load the employee model $this->load->model('Employee_model', 'employee_model'); } // get login employee profile details public function employeeGetProf_post() { $empLoginID = $this->post('employeeLoginID'); $employeeDetails = $this->employee_model->get_emp_prof_detail( $empLoginID );// Check if the employee exist if ($employeeDetails) { $employeeDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($employeeDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No users were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } //This method used to get employee Details public function employee_post() { $empLoginID = $this->post('employeeLoginID'); $employeeDetails = $this->employee_model->get_emp_detail( $empLoginID );// Check if the employee exist if ($employeeDetails) { $employeeDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($employeeDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No users were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } // get all employee details public function getEmployeeList_post() { $reqData = $this->post('data'); $loginUserId = $reqData['localUserID']; $loginUserBranchId = $reqData['localBranchID']; $loginUserType = $reqData['localType']; $employeeListDetails = $this->employee_model->get_employee_list( $loginUserId, $loginUserBranchId, $loginUserType );// Check if the employee exist if ($employeeListDetails) { $employeeListDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($employeeListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No users were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } // get role details public function getRoleDetails_post() { $reqRoleID = $this->post('reqRoleID'); $resRoleDetails = $this->employee_model->get_req_role_detail( $reqRoleID );// Check if the employee exist if ($resRoleDetails) { $resRoleDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($resRoleDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No users were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } // get branch details public function getMasterBranchDetails_post () { $reqRoleID = $this->post('reqRoleID'); $reqUserID = $this->post('reqUserID'); $branchId= $this->post('branchId'); $resMasterBranchDetails = $this->employee_model->get_req_master_branch_detail( $reqRoleID, $reqUserID,$branchId);// Check if the employee exist if ($resMasterBranchDetails) { $resMasterBranchDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($resMasterBranchDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No users were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } // check exist values details public function check_exist_post() { $data = $this->post('data'); $checkData = $this->post('check'); $checkRes = $this->employee_model->check_exist( $data, $checkData );// Check if the employee exist if ($checkRes) { $checkRes['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($checkRes, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No users were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } // add employee without image public function addEmployee_post() { $data = $this->post('data'); $createdBy = $this->post('createdBy'); $imagename = ''; $size = ''; $imageSource = ''; $req['StaffID'] = $data['employeeId']; $req['Firstname'] = $data['firstname']; $req['Lastname'] = $data['lastname']; $req['Fathername'] = $data['fathername']; $req['EmailID'] = $data['emailId']; $req['MotherName'] = $data['mothername']; $req['MobileNumber'] = $data['primaryPhone']; $req['AlternateNumber'] = $data['secondaryPhone']; $req['Gender'] = $data['gender']; $req['DOB'] = $data['dateofbirth']; // $req['DOB'] = $data['dateofbirth']; $req['PresentAddress'] = $data['address2']; $req['PermanentAddress'] = $data['address1']; $req['AadharNumber'] = $data['aadharNumber']; $req['OtherID'] = $data['otherId']; $req['OtherIDDetails'] = $data['otherIdDetails']; $req['Qualification'] = $data['qualificaion']; $req['BranchCode'] = $data['homeBranch']; $req['IsActive'] = $data['switchsetting']; $req['FinanceModuleAccess'] = $data['finaceModuleAccess']; $req['CallModuleAccess'] = $data['callModuleAccess']; $req['DOJ'] = $data['dateofjoining']; $req['JobResponsibility'] = $data['jobResponsibility']; // $req['DOJ'] = $data['dateofjoining']; $req['ListCode'] = $data['role']; $req['CreatedBy'] = $createdBy; // print_r($req);exit(); $employeeAdd = $this->employee_model->add_employee( $req, $createdBy, $imagename, $imageSource, $size );// Check if the employee exist if ($employeeAdd) { $employeeAdd['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($employeeAdd, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No users were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } // add employee with image public function addEmployeeImage_post() { // print_r($this->post('idProof'));exit(); $imagename = $_FILES['idProof']['name']; $size = $_FILES['idProof']['size']; $imageSource = $_FILES['idProof']['tmp_name']; // echo $size;exit(); $data= $this->post('data'); $createdBy= $this->post('createdBy'); $temp = json_decode($data, true); $req['StaffID'] = $temp['employeeId']; $req['Firstname'] = $temp['firstname']; $req['Lastname'] = $temp['lastname']; $req['Fathername'] = $temp['fathername']; $req['EmailID'] = $temp['emailId']; $req['MotherName'] = $temp['mothername']; $req['MobileNumber'] = $temp['primaryPhone']; $req['AlternateNumber'] = $temp['secondaryPhone']; $req['Gender'] = $temp['gender']; $req['DOB'] = $temp['dateofbirth']; // $req['DOB'] = $data['dateofbirth']; $req['PresentAddress'] = $temp['address2']; $req['PermanentAddress'] = $temp['address1']; $req['AadharNumber'] = $temp['aadharNumber']; $req['OtherID'] = $temp['otherId']; $req['OtherIDDetails'] = $temp['otherIdDetails']; $req['Qualification'] = $temp['qualificaion']; $req['BranchCode'] = $temp['homeBranch']; $req['IsActive'] = $temp['switchsetting']; $req['FinanceModuleAccess'] = $temp['finaceModuleAccess']; $req['DOJ'] = $temp['dateofjoining']; $req['JobResponsibility'] = $temp['jobResponsibility']; // $req['DOJ'] = $data['dateofjoining']; $req['ListCode'] = $temp['role']; $req['CreatedBy'] = $createdBy; $employeeAdd = $this->employee_model->add_employee( $req, $createdBy, $imagename, $imageSource, $size );// Check if the employee exist if ($employeeAdd) { $employeeAdd['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($employeeAdd, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No users were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } public function check_update_exist_post() { $exceptId = $this->post('exceptId'); $datas = $this->post('datas'); $checkFor = $this->post('check'); $checkRes = $this->employee_model->check_update_exist( $exceptId, $datas, $checkFor );// Check if the employee exist if ($checkRes) { $checkRes['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($checkRes, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No users were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } // update employee with image public function updateEmployeeImage_post() { $imagename = $_FILES['idProof']['name']; $size = $_FILES['idProof']['size']; $imageSource = $_FILES['idProof']['tmp_name']; $temp= $this->post('data'); $createdBy= $this->post('createdBy'); $data = json_decode($temp, true); $updatedBy = $this->post('updatedBy'); $updateStaff = $data['StaffID']; $req['Firstname'] = $data['Firstname']; $req['Lastname'] = $data['Lastname']; $req['Fathername'] = $data['Fathername']; $req['EmailID'] = $data['EmailID']; $req['MotherName'] = $data['MotherName']; $req['MobileNumber'] = $data['MobileNumber']; $req['AlternateNumber'] = $data['AlternateNumber']; $req['Gender'] = $data['Gender']; // $req['DOB'] = date('d-m-Y', strtotime($data['DOB']) ); $req['DOB'] = $data['DOB']; $req['PresentAddress'] = $data['PresentAddress']; $req['PermanentAddress'] = $data['PermanentAddress']; $req['AadharNumber'] = $data['AadharNumber']; $req['OtherID'] = $data['OtherID']; $req['OtherIDDetails'] = $data['OtherIDDetails']; $req['Qualification'] = $data['Qualification']; // $req['JobResponsibility'] = $data['JobResponsibility']; $req['ProfilePicPath'] = $data['ProfilePicPath']; // $req['BranchCode'] = $data['BranchCode']; $req['IsActive'] = $data['IsActive']; // $req['DOJ'] = date('d-m-Y', strtotime($data['DOJ']) ); $req['DOJ'] = $data['DOJ']; // $req['ListCode'] = $data['ListCode']; $req['UpdatedBy'] = $updatedBy; $date = date('Y-m-d H:i:s'); $req['UpdatedOn'] = $date; // print_r($req);exit(); $employeeUpdate = $this->employee_model->update_employee( $req, $updateStaff, $imagename, $imageSource, $size );// Check if the employee exist if ($employeeUpdate) { $employeeUpdate['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($employeeUpdate, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No users were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } // update employee details without image public function updateEmployee_post () { $data = $this->post('data'); $updatedBy = $this->post('updatedBy'); $updateStaff = $data['StaffID']; $imagename = ''; $size = ''; $imageSource = ''; $req['Firstname'] = $data['Firstname']; $req['Lastname'] = $data['Lastname']; $req['Fathername'] = $data['Fathername']; $req['EmailID'] = $data['EmailID']; $req['MotherName'] = $data['MotherName']; $req['MobileNumber'] = $data['MobileNumber']; $req['AlternateNumber'] = $data['AlternateNumber']; $req['Gender'] = $data['Gender']; // $req['DOB'] = date('d-m-Y', strtotime($data['DOB']) ); $req['DOB'] = $data['DOB']; $req['PresentAddress'] = $data['PresentAddress']; $req['PermanentAddress'] = $data['PermanentAddress']; $req['AadharNumber'] = $data['AadharNumber']; $req['OtherID'] = $data['OtherID']; $req['OtherIDDetails'] = $data['OtherIDDetails']; $req['Qualification'] = $data['Qualification']; // $req['ProfilePicPath'] = $data['ProfilePicPath']; // $req['JobResponsibility'] = $data['JobResponsibility']; // $req['BranchCode'] = $data['BranchCode']; $req['IsActive'] = $data['IsActive']; // $req['DOJ'] = date('d-m-Y', strtotime($data['DOJ']) ); $req['DOJ'] = $data['DOJ']; // $req['ListCode'] = $data['ListCode']; $req['UpdatedBy'] = $updatedBy; $date = date('Y-m-d H:i:s'); $req['UpdatedOn'] = $date; // print_r($req);exit(); $employeeUpdate = $this->employee_model->update_employee( $req, $updateStaff, $imagename, $imageSource, $size );// Check if the employee exist if ($employeeUpdate) { $employeeUpdate['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($employeeUpdate, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No users were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } // get employee branch details public function getEmpBranchDetails_post() { $staffID = $this->post('staffID'); $employeeBranch = $this->employee_model->get_employee_branch( $staffID );// Check if the employee exist if ($employeeBranch) { $employeeBranch['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($employeeBranch, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No users were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } public function addEmpBranchDetail_post() { $req['StaffID'] = $this->post('empFor'); $req['BranchCode'] = $this->post('updateBranch'); $req['ListCode'] = $this->post('updateRole'); $req['JobResponsibility'] = $this->post('JobResponsibility'); $req['FinanceModuleAccess'] = $this->post('FinanceModuleAccess') == 1 ? '1' : '0'; $req['CallModuleAccess'] = $this->post('CallModuleAccess') == 1 ? '1' : '0'; $req['CreatedBy'] = $this->post('updateBy'); $date = date('Y-m-d H:i:s'); $req['IsActive'] = '1'; $req['UpdatedOn'] = $date; $addEmpBranch = $this->employee_model->add_employee_branch( $req );// Check if the employee exist if ($addEmpBranch) { $addEmpBranch['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($addEmpBranch, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No users were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } // update employee branch public function updateEmpBranchDetail_post() { // exit(); $req['StaffID'] = $this->post('empFor'); $req['BranchCode'] = $this->post('updateBranch'); $req['ListCode'] = $this->post('updateRole'); $req['JobResponsibility'] = $this->post('JobResponsibility'); $req['HomeBranch'] = $this->post('HomeBranch'); $req['FinanceModuleAccess'] = $this->post('FinanceModuleAccess') == 1 ? '1' : '0'; $req['CallModuleAccess'] = $this->post('CallModuleAccess') == 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'); $req['UpdatedOn'] = $date; // echo $req['CallModuleAccess'];die(); $updateFor = $this->post('ID'); $updateBranch = $this->employee_model->upate_employee_branch( $updateFor, $req );// Check if the employee exist if ($updateBranch) { $updateBranch['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($updateBranch, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No users were found', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } }