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'); } //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'); $resMasterBranchDetails = $this->employee_model->get_req_master_branch_detail( $reqRoleID, $reqUserID );// 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 public function addEmployee_post() { $data = $this->post('data'); $createdBy = $this->post('createdBy'); $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['DOJ'] = $data['dateofjoining']; // $req['DOJ'] = $data['dateofjoining']; $req['ListCode'] = $data['role']; $req['CreatedBy'] = $createdBy; // print_r($req);exit(); $employeeAdd = $this->employee_model->add_employee( $req, $createdBy );// 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 details public function updateEmployee_post () { $data = $this->post('data'); $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['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 );// 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 } } // update employee branch public function updateEmpBranchDetail_post() { $empFor = $this->post('empFor'); $reqBanch['BranchCode'] = $this->post('updateBranch'); $req['ListCode'] = $this->post('updateRole'); $req['UpdatedBy'] = $this->post('updateBy'); $date = date('Y-m-d H:i:s'); $req['UpdatedOn'] = $date; $updateBranch = $this->employee_model->upate_employee_branch( $empFor, $reqBanch, $req, $req['UpdatedBy'], $req['UpdatedOn'] );// 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 } } }