multiple role branch access
This commit is contained in:
parent
193a9d632a
commit
b46afdc48c
@ -133,7 +133,8 @@ class Employee_Controller extends REST_Controller {
|
|||||||
public function getMasterBranchDetails_post () {
|
public function getMasterBranchDetails_post () {
|
||||||
$reqRoleID = $this->post('reqRoleID');
|
$reqRoleID = $this->post('reqRoleID');
|
||||||
$reqUserID = $this->post('reqUserID');
|
$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)
|
if ($resMasterBranchDetails)
|
||||||
{
|
{
|
||||||
$resMasterBranchDetails['status'] = REST_Controller::HTTP_OK;
|
$resMasterBranchDetails['status'] = REST_Controller::HTTP_OK;
|
||||||
|
|||||||
@ -272,8 +272,9 @@ class Employee_model extends CI_Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get branch details based on login user
|
// 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) {
|
if ($reqRoleId == SUPER_ADMIN) {
|
||||||
// res for SuperAdmin
|
// res for SuperAdmin
|
||||||
$this->db->select('BranchCode, BranchName');
|
$this->db->select('BranchCode, BranchName');
|
||||||
@ -288,9 +289,10 @@ class Employee_model extends CI_Model
|
|||||||
$subQuery = "SELECT t1.BranchCode, t1.BranchName
|
$subQuery = "SELECT t1.BranchCode, t1.BranchName
|
||||||
FROM T_BranchMaster as t1
|
FROM T_BranchMaster as t1
|
||||||
LEFT JOIN T_Staff_BranchAccess as t2 ON t2.StaffID = '$staffId'
|
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 t1.IsActive = 1
|
||||||
AND t2.IsActive = 1";
|
AND t2.IsActive = 1
|
||||||
|
group by t1.BranchCode";
|
||||||
$mBranchDetails = $this->db->query($subQuery);
|
$mBranchDetails = $this->db->query($subQuery);
|
||||||
$results['MeasterBranchDetailStatus'] = true;
|
$results['MeasterBranchDetailStatus'] = true;
|
||||||
$results['branch_details'] = $mBranchDetails->result();
|
$results['branch_details'] = $mBranchDetails->result();
|
||||||
|
|||||||
@ -69,6 +69,8 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$
|
|||||||
if (localDetail != null) {
|
if (localDetail != null) {
|
||||||
$scope.currentDate = new Date();
|
$scope.currentDate = new Date();
|
||||||
$scope.localUserListCode = localDetail.localType;
|
$scope.localUserListCode = localDetail.localType;
|
||||||
|
$scope.localBranchID = localDetails.localBranchID;
|
||||||
|
|
||||||
|
|
||||||
// $scope.currentPage = 1;
|
// $scope.currentPage = 1;
|
||||||
$scope.getEmployeeList();
|
$scope.getEmployeeList();
|
||||||
@ -459,6 +461,7 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$
|
|||||||
data: {
|
data: {
|
||||||
reqRoleID: localDetails.localType,
|
reqRoleID: localDetails.localType,
|
||||||
reqUserID: localDetails.localUserID,
|
reqUserID: localDetails.localUserID,
|
||||||
|
branchId : localDetails.localBranchID,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$http(req).then(function (response) {
|
$http(req).then(function (response) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user