status update branch level for superadmin : kdk
This commit is contained in:
parent
3926d87ebb
commit
9124786a74
@ -55,6 +55,7 @@ class Status_Controller extends REST_Controller {
|
|||||||
$details['ListGroup'] = "1";
|
$details['ListGroup'] = "1";
|
||||||
$details['CreatedBy'] = $this->post('createdBy');
|
$details['CreatedBy'] = $this->post('createdBy');
|
||||||
$details['IsActive'] = $this->post('status');
|
$details['IsActive'] = $this->post('status');
|
||||||
|
$details['BranchCode'] = $this->post('branch');
|
||||||
$details['CreatedOn'] = $now->format('Y-m-d H:i:s');
|
$details['CreatedOn'] = $now->format('Y-m-d H:i:s');
|
||||||
$statusDetails = $this->status_model->addstatus($details);// Check if the users data store contains users (in case the database result returns NULL)
|
$statusDetails = $this->status_model->addstatus($details);// Check if the users data store contains users (in case the database result returns NULL)
|
||||||
if ($statusDetails)
|
if ($statusDetails)
|
||||||
@ -81,7 +82,8 @@ class Status_Controller extends REST_Controller {
|
|||||||
public function getStatusDetails_post()
|
public function getStatusDetails_post()
|
||||||
{
|
{
|
||||||
$requestedBy = $this->post('requestedBy');
|
$requestedBy = $this->post('requestedBy');
|
||||||
$getStatus = $this->status_model->getStatus($requestedBy);
|
$requestedBranch = $this->post('requestBranch');
|
||||||
|
$getStatus = $this->status_model->getStatus($requestedBy, $requestedBranch);
|
||||||
|
|
||||||
if ($getStatus)
|
if ($getStatus)
|
||||||
{
|
{
|
||||||
@ -113,8 +115,9 @@ class Status_Controller extends REST_Controller {
|
|||||||
$details['ListName'] = $this->post('ListName');
|
$details['ListName'] = $this->post('ListName');
|
||||||
$details['IsActive'] = $this->post('status');
|
$details['IsActive'] = $this->post('status');
|
||||||
$details['UpdatedBy'] = $this->post('updatedBy');
|
$details['UpdatedBy'] = $this->post('updatedBy');
|
||||||
|
$branch = $this->post('requestBranch');
|
||||||
$details['UpdatedOn'] = $now->format("Y-m-d H:i:s");
|
$details['UpdatedOn'] = $now->format("Y-m-d H:i:s");
|
||||||
$statusDetails = $this->status_model->update($details,$ListCode);// Check if the users data store contains users (in case the database result returns NULL)
|
$statusDetails = $this->status_model->update($details,$ListCode, $branch);// Check if the users data store contains users (in case the database result returns NULL)
|
||||||
|
|
||||||
if ($statusDetails)
|
if ($statusDetails)
|
||||||
|
|
||||||
|
|||||||
@ -17,9 +17,11 @@ class Status_model extends CI_Model {
|
|||||||
|
|
||||||
public function addstatus($arrayDetails=null)
|
public function addstatus($arrayDetails=null)
|
||||||
{
|
{
|
||||||
$this->db->select('ListCode');
|
// print_r($arrayDetails);exit();
|
||||||
|
$this->db->select('ListCode');
|
||||||
$this->db->where('ListGroup', '1');
|
$this->db->where('ListGroup', '1');
|
||||||
$this->db->where('ListName', $arrayDetails['ListName']);
|
$this->db->where('ListName', $arrayDetails['ListName']);
|
||||||
|
$this->db->where('BranchCode', $arrayDetails['BranchCode']);
|
||||||
if($this->db->get(PICK_LIST_DETAILS)->first_row()){
|
if($this->db->get(PICK_LIST_DETAILS)->first_row()){
|
||||||
$result['Status'] = false;
|
$result['Status'] = false;
|
||||||
$result['message'] = "Status name is already exist!";
|
$result['message'] = "Status name is already exist!";
|
||||||
@ -52,10 +54,11 @@ class Status_model extends CI_Model {
|
|||||||
* created by Surendiran
|
* created by Surendiran
|
||||||
* */
|
* */
|
||||||
|
|
||||||
public function getStatus()
|
public function getStatus($reqBy, $reqBranch)
|
||||||
{
|
{
|
||||||
$this->db->select('ListCode,ListName,IsActive');
|
$this->db->select('ListCode,ListName,IsActive');
|
||||||
$this->db->where('ListGroup','1');
|
$this->db->where('ListGroup','1');
|
||||||
|
$this->db->where('BranchCode', $reqBranch);
|
||||||
$this->db->order_by('ListCode','DESC');
|
$this->db->order_by('ListCode','DESC');
|
||||||
$statusDetails = $this->db->get(PICK_LIST_DETAILS);
|
$statusDetails = $this->db->get(PICK_LIST_DETAILS);
|
||||||
if($statusDetails->result()){
|
if($statusDetails->result()){
|
||||||
@ -76,10 +79,11 @@ class Status_model extends CI_Model {
|
|||||||
* created by Surendiran
|
* created by Surendiran
|
||||||
* */
|
* */
|
||||||
|
|
||||||
public function update($arrayDetails=null,$ListCode=null)
|
public function update($arrayDetails=null,$ListCode=null, $branch)
|
||||||
{
|
{
|
||||||
$this->db->select('ListName');
|
$this->db->select('ListName');
|
||||||
$this->db->where('ListName', $arrayDetails['ListName']);
|
$this->db->where('ListName', $arrayDetails['ListName']);
|
||||||
|
$this->db->where('BranchCode', $branch);
|
||||||
$this->db->where_not_in('ListCode', $ListCode);
|
$this->db->where_not_in('ListCode', $ListCode);
|
||||||
if($this->db->get(PICK_LIST_DETAILS)->first_row()){
|
if($this->db->get(PICK_LIST_DETAILS)->first_row()){
|
||||||
$result['Status'] = false;
|
$result['Status'] = false;
|
||||||
|
|||||||
@ -75,7 +75,8 @@ app.controller("statusCtrl", ["$scope", "toaster", "$filter", "API_POINTS", "$lo
|
|||||||
data: {
|
data: {
|
||||||
statusName: myModel.StatusName,
|
statusName: myModel.StatusName,
|
||||||
status: myModel.switchsetting,
|
status: myModel.switchsetting,
|
||||||
createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID
|
createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
|
||||||
|
branch : localDetail.localBranchID
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -87,7 +88,7 @@ app.controller("statusCtrl", ["$scope", "toaster", "$filter", "API_POINTS", "$lo
|
|||||||
$state.go($state.current, {}, { reload: true });
|
$state.go($state.current, {}, { reload: true });
|
||||||
} else {
|
} else {
|
||||||
$scope.ldloading1[loading.replace('-', '_')] = false;
|
$scope.ldloading1[loading.replace('-', '_')] = false;
|
||||||
swal("", "Something went wrong, please try again.", "error");
|
swal("", response.data.message, "error");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -123,6 +124,7 @@ app.controller("statusCtrl", ["$scope", "toaster", "$filter", "API_POINTS", "$lo
|
|||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
|
requestBranch: localDetail.localBranchID,
|
||||||
requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID
|
requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -201,18 +203,20 @@ app.controller("statusCtrl", ["$scope", "toaster", "$filter", "API_POINTS", "$lo
|
|||||||
ListCode: myModel.ListCode,
|
ListCode: myModel.ListCode,
|
||||||
ListName: myModel.ListName,
|
ListName: myModel.ListName,
|
||||||
status: myModel.IsActive,
|
status: myModel.IsActive,
|
||||||
|
requestBranch: localDetail.localBranchID,
|
||||||
updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID
|
updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$http(update).then(function (response) {
|
$http(update).then(function (response) {
|
||||||
if (response.data.status == 200 && response.data.Status) {
|
if (response.data.Status) {
|
||||||
$scope.ldloading[loading.replace('-', '_')] = false;
|
$scope.ldloading[loading.replace('-', '_')] = false;
|
||||||
swal("", "Updated Successfully", "success");
|
swal("", "Updated Successfully", "success");
|
||||||
$scope.editId = -1;
|
$scope.editId = -1;
|
||||||
$scope.init();
|
$scope.init();
|
||||||
} else {
|
} else {
|
||||||
$scope.ldloading[loading.replace('-', '_')] = false;
|
$scope.ldloading[loading.replace('-', '_')] = false;
|
||||||
swal("", "Something went wrong, please try again", "error");
|
$scope.init();
|
||||||
|
swal("", response.data.message, "error");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user