branch In-active changes : kdk

This commit is contained in:
resicovenba 2018-02-06 15:56:41 +05:30
parent e5cf2a4e2e
commit b5f736de25
6 changed files with 106 additions and 5 deletions

View File

@ -127,6 +127,7 @@ $route['insertStudentCourse'] = 'Student_Controller/insertStudentCourse';
$route['insertStudentImg'] = 'Student_Controller/insertStudentImg';
$route['updateStudentImgDetails'] = 'Student_Controller/updateStudentImgDetails';
$route['getBranchListDetails'] = 'Student_Controller/getBranchListDetails';
$route['getBranchActiveStatusforStuAdd'] = 'Student_Controller/getBranchActiveStatusforStuAdd';
//batch
$route['addBatchDetails'] = 'Batch_Controller/addBatchDetails';

View File

@ -57,6 +57,28 @@ class Student_Controller extends REST_Controller {
}
}
// check the branch active for add a new student
public function getBranchActiveStatusforStuAdd_post() {
$reqData = $this->post('data');
$branchId = $reqData['localBranchID'];
// print_r($reqData);exit();
$checkBranchActiveStatis = $this->student_model->getBranchActiveStatusforStuAdd($branchId);// Get Branch list
if ($checkBranchActiveStatis)
{
$checkBranchActiveStatis['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($checkBranchActiveStatis, 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 getStudentList_post() {
$reqData = $this->post('data');
$searchReqData = $this->post('search');

View File

@ -128,7 +128,7 @@ class Employee_model extends CI_Model
$this->db->where('t2.StaffID', $EmpId);
$this->db->where('t2.IsActive', 1);
$this->db->join('' . BRANCH . ' as t3', 't2.BranchCode = t3.BranchCode', 'LEFT');
$this->db->where('t3.IsActive', 1);
// $this->db->where('t3.IsActive', 1);
// $this->db->join('T_StaffDetails as t2', 't1.StaffID = t2.StaffID', 'LEFT');
$branchDetails = $this->db->get();
$result['branchStatus'] = true;

View File

@ -17,7 +17,7 @@ class Student_model extends CI_Model
public function get_branch_list() {
$this->db->select('t1.BranchCode,t1.BranchName');
$this->db->from('' . BRANCH . ' as t1');
$this->db->where('t1.IsActive', 1);
// $this->db->where('t1.IsActive', 1);
$branchDetails = $this->db->get();
$checkArr = $branchDetails->result();
if (count($checkArr) > 0) {
@ -29,6 +29,24 @@ class Student_model extends CI_Model
return $result;
}
// check the branch active status for student add
public function getBranchActiveStatusforStuAdd($branchId){
$this->db->select('t1.IsActive');
$this->db->from('' . BRANCH . ' as t1');
$this->db->where('BranchCode', $branchId);
$statusDetails = $this->db->get()->first_row();
// echo $statusDetails->IsActive;exit();
$result['branch_active_status'] = $statusDetails->IsActive;
return $result;
// if (count($checkArr) > 0) {
// $result['branDetailstatus'] = true;
// $result['branch_details'] = $branchDetails->result();
// } else {
// $result['branDetailstatus'] = false;
// }
// return $result;
}
// get student list based on login user
public function get_student_list($loginUserId, $loginUserBranchId, $loginUserType, $getSearchData)
@ -446,7 +464,9 @@ if($StuStatus == '' ){
// add student
public function add_student($Arr, $courseArr, $imagename, $imageSource, $size)
{
{
if($this->getBranchActiveStatusforStuAdd($courseArr['BranchID']) === '1'){
if( $imageSource == '') { // add employee without image
$imageNameDb = 'default.jpeg';
$Arr['ProfilePicPath'] = "student/".$imageNameDb;
@ -533,6 +553,11 @@ if($StuStatus == '' ){
$result['message'] = "Something went wrong.please try again";
}
}
}
}else {
$result['addStudentStatus'] = false;
$result['message'] = "Cannot create a new Student for In-Active Branch";
}
return $result;
}

View File

@ -56,6 +56,31 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
};
$scope.addStudentView = function () {
// check the local branch is active for add a new student for this branch
var checkBranchActiveForStuAdd = {
method: 'POST',
url: apiPoint.url + 'getBranchActiveStatusforStuAdd/',
headers: {
'Content-Type': 'application/json'
},
data: {
data: localDetails
}
};
$http(checkBranchActiveForStuAdd).then(function (response) {
if (response.data) {
var checkStatus = response.data.branch_active_status;
if(checkStatus == "0"){
$scope.inActiveBranchStatus = true;
swal(" ", "Cannot create a new Student for In-Active Branch", "warning");
}else {
// $scope.inActiveBranchStatus = false;
}
} else {
}
});
// $scope.myModelCourseAdd = {
// 'university': '',
// 'course': '',
@ -971,7 +996,34 @@ app.controller('studentSuperAdminCtrl', ["$scope", "toaster", "$filter", "ngTabl
'enrollmentid': ''
};
$scope.inActiveBranchStatus = false;
$scope.addStudentView = function () {
// check the local branch is active for add a new student for this branch
// alert();
var checkBranchActiveForStuAdd = {
method: 'POST',
url: apiPoint.url + 'getBranchActiveStatusforStuAdd/',
headers: {
'Content-Type': 'application/json'
},
data: {
data: localDetails
}
};
$http(checkBranchActiveForStuAdd).then(function (response) {
if (response.data) {
var checkStatus = response.data.branch_active_status;
if(checkStatus == "0"){
$scope.inActiveBranchStatus = true;
swal(" ", "Cannot create a new Student for In-Active Branch", "warning");
}else {
// $scope.inActiveBranchStatus = false;
}
} else {
}
});
// $scope.myModelCourseAdd = {
// 'university': '',
// 'course': '',
@ -1552,6 +1604,7 @@ $scope.myUnivSearch = "";
} else {
// $scope.ldloading1[loading.replace('-', '_')] = false;
swal(" ", data.message, "error");
$scope.disableButton = false;
}
});
} else {
@ -1580,7 +1633,7 @@ $scope.myUnivSearch = "";
// $scope.tabActive('tabactive1');
} else {
// $scope.disableButton = false;
$scope.disableButton = false;
swal(" ", response.data.message, "error");
}
});

View File

@ -271,7 +271,7 @@
</style>
<tab active="tabactive2" ng-click="tabActive('tabactive1')" heading="Add Student" id="addstudent" ng-click="addStudentView()">
<tab active="tabactive2" ng-click="tabActive('tabactive1');addStudentView()" heading="Add Student" id="addstudent">
<!--<button ng-click="tabActive('0')" value="Tab1">Tab1</button>-->
<div>
<!--<button ng-click="myActivateDiv()">Click Me</button>-->