diff --git a/Apollo/api/application/models/Employee_model.php b/Apollo/api/application/models/Employee_model.php index 3788ca62..74aadf5a 100755 --- a/Apollo/api/application/models/Employee_model.php +++ b/Apollo/api/application/models/Employee_model.php @@ -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);STAFF_BRANCH // $this->db->join('T_StaffDetails as t2', 't1.StaffID = t2.StaffID', 'LEFT'); $branchDetails = $this->db->get(); $result['branchStatus'] = true; @@ -164,11 +164,13 @@ class Employee_model extends CI_Model if ($loginUserBranchId == 'All') { // for getting all branch details $staffId = $this->selfGetEmpId($loginUserId); - $this->db->select('*'); - $this->db->order_by('CreatedOn', 'DESC'); - $this->db->from(STAFF); + $this->db->select('t1.*'); + $this->db->order_by('t1.CreatedOn', 'DESC'); + $this->db->from('' . STAFF . ' as t1'); + // $this->db->join('' . STAFF_BRANCH . ' as t3', 't3.StaffID = t1.StaffID', 'LEFT'); // not for SuperAdmin and Student Role code - $this->db->where_not_in('StaffID', $staffId); + $this->db->where_not_in('t1.StaffID', $staffId); + // $this->db->group_by('t3.StaffID'); // $this->db->where('BranchCode', $loginUserBranchId); $empDetails = $this->db->get(); $checkArr = $empDetails->result(); @@ -568,7 +570,7 @@ class Employee_model extends CI_Model $this->db->join('' . STAFF_BRANCH . ' as t2', 't2.BranchCode = t1.BranchCode', 'LEFT'); $this->db->where('t2.StaffID', $staffId); $this->db->where('t2.IsActive', 1); - $this->db->where('t1.IsActive', 1); + // $this->db->where('t1.IsActive', 1); $branchDetails = $this->db->get(); $branchArr = $branchDetails->result(); if( count($branchArr) > 0 ) { diff --git a/Apollo/api/application/models/StatusUpdation_model.php b/Apollo/api/application/models/StatusUpdation_model.php index 83490b73..2d42d143 100755 --- a/Apollo/api/application/models/StatusUpdation_model.php +++ b/Apollo/api/application/models/StatusUpdation_model.php @@ -361,9 +361,9 @@ class StatusUpdation_model extends CI_Model LEFT JOIN ".UNIVERSITY." as U ON SC.UniversityID = U.UniversityID LEFT JOIN ".COURSE." as C ON SC.CourseID = C.CourseID WHERE - SC.UniversityID LIKE '%$University%' - AND SC.CourseID LIKE '%$Course%' - AND SC.BatchCode LIKE '%$Batch%' + (SC.UniversityID = '$University' + OR (SC.CourseID = '$Course' AND SC.UniversityID = '$University') + OR (SC.BatchCode = '$Batch' AND SC.CourseID = '$Course' AND SC.UniversityID = '$University')) AND S.IsActive = '1' AND SC.IsActive = '1'"; @@ -371,17 +371,23 @@ class StatusUpdation_model extends CI_Model $results['searchResult'] = true; $results['search_result_details'] = $queryDetails->result(); } else { + // echo $University; + // echo $branch; $subQuery = "SELECT S.* , SC.CourseID , C.CourseName , U.UniversityName FROM ".STUDENTS." as S LEFT JOIN ".STUDENTCOURSE." as SC ON SC.StudentID = S.StudentID LEFT JOIN ".UNIVERSITY." as U ON SC.UniversityID = U.UniversityID LEFT JOIN ".COURSE." as C ON SC.CourseID = C.CourseID WHERE - SC.UniversityID LIKE '%$University%' - AND SC.CourseID LIKE '%$Course%' - AND SC.BatchCode LIKE '%$Batch%' + (SC.UniversityID = '$University' + OR (SC.CourseID = '$Course' AND SC.UniversityID = '$University') + OR (SC.BatchCode = '$Batch' AND SC.CourseID = '$Course' AND SC.UniversityID = '$University')) AND S.IsActive = '1' - AND S.BranchCode = '$branch' + AND SC.BranchID = '$branch' AND SC.IsActive = '1'"; + // AND S.BranchCode = '$branch' + // SC.UniversityID LIKE '%$University%' + // AND SC.CourseID LIKE '%$Course%' + // AND SC.BatchCode LIKE '%$Batch%' $queryDetails = $this->db->query($subQuery); $results['searchResult'] = true; diff --git a/Apollo/assets/js/controllers/studentCtrl.js b/Apollo/assets/js/controllers/studentCtrl.js index b54d5573..5fba3cec 100755 --- a/Apollo/assets/js/controllers/studentCtrl.js +++ b/Apollo/assets/js/controllers/studentCtrl.js @@ -4,7 +4,7 @@ * Simple table with sorting and filtering on AngularJS */ -app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$http", "API_POINTS", "$state", '$rootScope', '$cookies', 'md5', 'ipCookie', '$timeout', '$window', "flowFactory", "$interval", function ($scope, toaster, $filter, ngTableParams, $http, apiPoint, $state, $rootScope, $cookies, md5, ipCookie, $timeout, $window, flowFactory, $interval) { +app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$http", "API_POINTS", "$state", '$rootScope', '$cookies', 'md5', 'ipCookie', '$timeout', '$window', "flowFactory", "$interval", 'SweetAlert', function ($scope, toaster, $filter, ngTableParams, $http, apiPoint, $state, $rootScope, $cookies, md5, ipCookie, $timeout, $window, flowFactory, $interval, SweetAlert) { /** * student details capture * by : kdk @@ -55,6 +55,7 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams", 'enrollmentid': '' }; + $scope.inActiveBranchStatus = false; $scope.addStudentView = function () { // check the local branch is active for add a new student for this branch var checkBranchActiveForStuAdd = { @@ -74,7 +75,7 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams", $scope.inActiveBranchStatus = true; swal(" ", "Cannot create a new Student for In-Active Branch", "warning"); }else { - // $scope.inActiveBranchStatus = false; + $scope.inActiveBranchStatus = false; } } else { } @@ -518,10 +519,25 @@ $scope.studentListLength = 0; $http(checkReq).then(function (response) { if (response.data.existMobile == true) { if(response.data.details.type === 'R001'){ - swal("Warning!", response.data.message, "warning"); + // swal("Warning!", response.data.message, "warning"); $scope.myModel.primaryPhone = ''; + // student registration find student previously exist // $scope.existingStudentView = true; // $scope.existingStudentId = response.data.details.studentId; + SweetAlert.swal({ + title: "Warning!", + text: "Student, Exsit with this same Number." + "\n Want to need see the details!", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "Yes!" + }, function (res) { + if(res === true){ + $scope.existingStudentView = true; + $scope.existingStudentId = response.data.details.studentId; + } + }); + }else if (response.data.details.type === 'R002' || response.data.details.type === 'R003'){ swal("Warning!", response.data.message, "warning"); $scope.myModel.primaryPhone = ''; @@ -553,8 +569,11 @@ $scope.studentListLength = 0; }); } + $scope.stuExistingDetailsShowLoading = false; + $scope.getExistStudentDetails = function() { // alert($scope.existingStudentId); + $scope.stuExistingDetailsShowLoading = true; var checkExisReq = { method: 'POST', url: apiPoint.url + 'getExistingStudentDetails/', @@ -570,8 +589,9 @@ $scope.studentListLength = 0; if (response.data.existingStudentDetailsStatus == true) { $scope.existingStuPersonalDetails = response.data.personalDetails[0]; $scope.existingStuCourseDetails = response.data.courseDetails; + $scope.stuExistingDetailsShowLoading = false; } else { - + $scope.stuExistingDetailsShowLoading = false; } }); } @@ -925,8 +945,10 @@ $scope.studentListLength = 0; $scope.stepsModelEdit.length = 0; } + $scope.editSaveButtonDisable = false; // update student details $scope.updateStuDetails = function (form, p, hidedob) { + $scope.editSaveButtonDisable = true; var firstError = null; if (form.$invalid) { var field = null, firstError = null; @@ -969,12 +991,15 @@ $scope.studentListLength = 0; swal(" ", "Updated successfully.", "success"); $scope.getStudentList(); $scope.editId = -1; + $scope.editSaveButtonDisable = false; } else { // $scope.ldloading1[loading.replace('-', '_')] = false; swal(" ", response.data.message, "error"); + $scope.editSaveButtonDisable = false; } }); } else { + // alert(); var formData = new FormData(); var idStuUpProof = $scope.filesEdit[0]; // alert(idProof); @@ -985,14 +1010,17 @@ $scope.studentListLength = 0; $http.post(apiPoint.url + 'updateStudentImgDetails/', formData, { transformRequest: angular.identity, headers: { 'Content-Type': undefined, 'Process-Data': false }, - }).success(function (response) { - if (response.data.updateStuStatus === true) { + }).success(function(res) { + // alert(JSON.stringify(res)); + if (res.updateStuStatus == true) { swal(" ","Updated successfully." , "success"); $scope.getStudentList(); $scope.editId = -1; + $scope.editSaveButtonDisable = false; } else { // $scope.ldloading1[loading.replace('-', '_')] = false; swal(" ", response.data.message, "error"); + $scope.editSaveButtonDisable = false; } }); } @@ -1901,9 +1929,11 @@ $scope.myUnivSearch = ""; $scope.stepsModelEdit.length = 0; } + $scope.editSaveButtonDisable = false; // update student details $scope.updateStuDetails = function (form, p, hidedob) { var firstError = null; + $scope.editSaveButtonDisable = true; if (form.$invalid) { var field = null, firstError = null; for (field in form) { @@ -1945,10 +1975,12 @@ $scope.myUnivSearch = ""; swal("", "Updated successfully.", "success"); $scope.getStudentList(); $scope.editId = -1; + $scope.editSaveButtonDisable = false; } else { // $scope.ldloading1[loading.replace('-', '_')] = false; // alert(response.data.message); swal("", response.data.message, "error"); + $scope.editSaveButtonDisable = false; } }); } else { @@ -1963,14 +1995,16 @@ $scope.myUnivSearch = ""; transformRequest: angular.identity, headers: { 'Content-Type': undefined, 'Process-Data': false }, }).success(function (response) { - if (response.data.updateStuStatus === true) { + if (response.updateStuStatus == true) { swal("", "Updated successfully.", "success"); $scope.getStudentList(); $scope.editId = -1; + $scope.editSaveButtonDisable = false; } else { // $scope.ldloading1[loading.replace('-', '_')] = false; // swal("", data.message, "error"); swal("", response.data.message, "error"); + $scope.editSaveButtonDisable = false; } }); } diff --git a/Apollo/assets/views/student/editStudentDetails.html b/Apollo/assets/views/student/editStudentDetails.html index eb8d8dea..939b7a24 100755 --- a/Apollo/assets/views/student/editStudentDetails.html +++ b/Apollo/assets/views/student/editStudentDetails.html @@ -378,8 +378,8 @@
-
@@ -1112,10 +1118,12 @@ Active/De-Active
- + +
- + +
@@ -1138,6 +1146,7 @@ Course Details +
@@ -1173,6 +1182,7 @@
+
@@ -1183,8 +1193,7 @@ Cancel
-
-
+
Add New Cource @@ -1361,6 +1370,8 @@
+
+