multiple role branch access

This commit is contained in:
venbatechnologies@gmail.com 2018-04-26 16:11:56 +05:30
parent 193a9d632a
commit b46afdc48c
3 changed files with 10 additions and 4 deletions

View File

@ -133,7 +133,8 @@ class Employee_Controller extends REST_Controller {
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
$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;

View File

@ -272,8 +272,9 @@ class Employee_model extends CI_Model
}
// get branch details based on login user
public function get_req_master_branch_detail($reqRoleId, $reqUserID)
public function get_req_master_branch_detail($reqRoleId, $reqUserID,$branchId)
{
$listcode="R003";
if ($reqRoleId == SUPER_ADMIN) {
// res for SuperAdmin
$this->db->select('BranchCode, BranchName');
@ -288,9 +289,10 @@ class Employee_model extends CI_Model
$subQuery = "SELECT t1.BranchCode, t1.BranchName
FROM T_BranchMaster as t1
LEFT JOIN T_Staff_BranchAccess as t2 ON t2.StaffID = '$staffId'
WHERE t2.BranchCode = t1.BranchCode
WHERE t1.BranchCode='$branchId' and t2.ListCode='$listcode'
AND t1.IsActive = 1
AND t2.IsActive = 1";
AND t2.IsActive = 1
group by t1.BranchCode";
$mBranchDetails = $this->db->query($subQuery);
$results['MeasterBranchDetailStatus'] = true;
$results['branch_details'] = $mBranchDetails->result();

View File

@ -69,6 +69,8 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$
if (localDetail != null) {
$scope.currentDate = new Date();
$scope.localUserListCode = localDetail.localType;
$scope.localBranchID = localDetails.localBranchID;
// $scope.currentPage = 1;
$scope.getEmployeeList();
@ -459,6 +461,7 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$
data: {
reqRoleID: localDetails.localType,
reqUserID: localDetails.localUserID,
branchId : localDetails.localBranchID,
}
};
$http(req).then(function (response) {