diff --git a/Apollo/api/application/controllers/Course_Controller.php b/Apollo/api/application/controllers/Course_Controller.php index 62224905..cbd8470e 100755 --- a/Apollo/api/application/controllers/Course_Controller.php +++ b/Apollo/api/application/controllers/Course_Controller.php @@ -36,6 +36,9 @@ class Course_Controller extends REST_Controller { $details['CourseID'] = $this->post('courseID'); $details['CourseName'] = $this->post('courseName'); $details['UniversityID'] = $this->post('universityName'); + $details['Specilization1'] = $this->post('specilization1'); + $details['Specilization2'] = $this->post('specilization2'); + //$details['FeesType'] = $this->post('feesType'); $details['PC'] = $this->post('provFess'); $details['DC'] = $this->post('degreeAmount'); @@ -130,6 +133,8 @@ class Course_Controller extends REST_Controller { $now->setTimezone(new DateTimezone('Asia/Kolkata')); $details['CourseID'] = $this->post('courseCode'); $details['CourseName'] = $this->post('courseName'); + $details['Specilization1'] = $this->post('specilization1'); + $details['Specilization2'] = $this->post('specilization2'); $details['IsActive'] = $this->post('status'); $details['PC'] = $this->post('provFess'); $details['DC'] = $this->post('degreeAmount'); @@ -138,6 +143,7 @@ class Course_Controller extends REST_Controller { $details['OtherFees'] = $this->post('otherAmount'); $details['UpdatedBy'] = $this->post('updatedBy'); $details['UpdatedOn'] = $now->format('Y-m-d H:i:s'); + $existCourseID = $this->post('existCourseID'); $jsonRegularFeesData=$this->post('regularFeesAmounts'); $jsonLateralFeesData=$this->post('lateralFeesAmounts'); $jsonSemFeesData=$this->post('semFeesAmounts'); @@ -151,7 +157,7 @@ class Course_Controller extends REST_Controller { } - $updateDetails = $this->course_model->updateCourse($details,$jsonSemFeesData);// Check if the users data store contains users (in case the database result returns NULL) + $updateDetails = $this->course_model->updateCourse($details,$jsonSemFeesData,$existCourseID);// Check if the users data store contains users (in case the database result returns NULL) if ($updateDetails) { $updateDetails['status'] = REST_Controller::HTTP_OK; diff --git a/Apollo/api/application/models/Course_model.php b/Apollo/api/application/models/Course_model.php index 7159f17f..cffd819d 100755 --- a/Apollo/api/application/models/Course_model.php +++ b/Apollo/api/application/models/Course_model.php @@ -69,7 +69,7 @@ class Course_model extends CI_Model { public function getCourse() { - $this->db->select('CU.CourseID,CU.CourseName,CU.FeesType,CU.PC,CU.DC,CU.TC,CU.MC,CU.OtherFees,CU.IsActive,US.UniversityID,US.UniversityName'); + $this->db->select('CU.CourseID,CU.CourseName,CU.FeesType,CU.Specilization1,CU.Specilization2,CU.PC,CU.DC,CU.TC,CU.MC,CU.OtherFees,CU.IsActive,US.UniversityID,US.UniversityName'); $this->db->from(COURSE.' as CU'); $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = CU.UniversityID'); $this->db->order_by('CU.CreatedOn','DESC'); @@ -83,6 +83,8 @@ class Course_model extends CI_Model { $fetchData['CourseID']=$row->CourseID; $fetchData['CourseName']=$row->CourseName; $fetchData['FeesType']=$row->FeesType; + $fetchData['Specilization1']=$row->Specilization1; + $fetchData['Specilization2']=$row->Specilization2; $fetchData['PC']=$row->PC; $fetchData['DC']=$row->DC; $fetchData['TC']=$row->TC; diff --git a/Apollo/assets/js/controllers/courseCtrl.js b/Apollo/assets/js/controllers/courseCtrl.js index c77c5f1f..f795ca35 100755 --- a/Apollo/assets/js/controllers/courseCtrl.js +++ b/Apollo/assets/js/controllers/courseCtrl.js @@ -18,7 +18,10 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab "transferAmount":"", "degreeAmount":"", "migrationAmount":"", - "otherAmount":"" + "otherAmount":"", + "specilization1":"", + "specilization2":"", + }; $rootScope.myModel1 = { "ListName": "", @@ -125,7 +128,8 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab } angular.element('.ng-invalid[name=' + firstError + ']').focus(); // swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error"); - } else { + } + else { if(semYearModel.program=='Y001' && semYearModel.programName!="" || semYearModel.FeesAmount!=""){ $scope.addMoreItems.push({ @@ -137,45 +141,55 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab }); } - $scope.ldloading1 = {}; + if(regularModel.FeesAmount=='' && lateralModel.FeesAmount=='' && $scope.addMoreItems.length==0){ + swal("Failed!", 'Please Enter Single/Sem-Year Fees ', "error"); - $scope.ldloading1[loading.replace('-', '_')] = true; + } + else{ + $scope.ldloading1 = {}; + + $scope.ldloading1[loading.replace('-', '_')] = true; + + + var addCourse = { + method: 'POST', + url: apiPoint.url + 'addCourseDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + courseID: myModel.courseCode, + courseName: myModel.courseName, + universityName: myModel.universityName, + feesType:myModel.ListName.ListCode, + status: myModel.switchsetting, + provFess:myModel.provFess, + transferAmount:myModel.transferAmount, + degreeAmount:myModel.degreeAmount, + migrationAmount:myModel.migrationAmount, + otherAmount:myModel.otherAmount, + regularFeesAmounts:regularModel, + lateralFeesAmounts:lateralModel, + semFeesAmounts:$scope.addMoreItems, + createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + specilization1:myModel.specilization1, + specilization2:myModel.specilization2 + } + }; + $http(addCourse).then(function (response) { + if (response.data.status==200 && response.data.courseStatus) { + $scope.ldloading1[loading.replace('-', '_')] = false; + swal("Success!", response.data.message, "success"); + $state.go($state.current, {}, {reload: true}); + } else { + $scope.addMoreItems.splice($scope.addMoreItems.length-1); + $scope.ldloading1[loading.replace('-', '_')] = false; + swal("Failed!", response.data.message, "error"); + } + }); + } - var addCourse = { - method: 'POST', - url: apiPoint.url + 'addCourseDetails/', - headers: { - 'Content-Type': 'application/json' - }, - data: { - courseID: myModel.courseCode, - courseName: myModel.courseName, - universityName: myModel.universityName, - feesType:myModel.ListName.ListCode, - status: myModel.switchsetting, - provFess:myModel.provFess, - transferAmount:myModel.transferAmount, - degreeAmount:myModel.degreeAmount, - migrationAmount:myModel.migrationAmount, - otherAmount:myModel.otherAmount, - regularFeesAmounts:regularModel, - lateralFeesAmounts:lateralModel, - semFeesAmounts:$scope.addMoreItems, - createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID - } - }; - $http(addCourse).then(function (response) { - if (response.data.status==200 && response.data.courseStatus) { - $scope.ldloading1[loading.replace('-', '_')] = false; - swal("Success!", response.data.message, "success"); - $state.go($state.current, {}, {reload: true}); - } else { - $scope.addMoreItems.splice($scope.addMoreItems.length-1); - $scope.ldloading1[loading.replace('-', '_')] = false; - swal("Failed!", response.data.message, "error"); - } - }); } @@ -243,7 +257,10 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab lateralFeesAmounts:lateral, semFeesAmounts:$rootScope.updateMoreItems, status: myModel.IsActive, - updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID + updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + specilization1:myModel.Specilization1, + specilization2:myModel.Specilization2, + existCourseID:myModel.CourseID } }; $http(update).then(function (response) { @@ -258,7 +275,7 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab } else { $scope.ldloading[loading.replace('-', '_')] = false; - $rootScope.init(); + // $rootScope.init(); swal("Failed!", response.data.message, "error"); } }); diff --git a/Apollo/assets/views/courseDetails.html b/Apollo/assets/views/courseDetails.html index 85af9f54..31bd5007 100755 --- a/Apollo/assets/views/courseDetails.html +++ b/Apollo/assets/views/courseDetails.html @@ -158,7 +158,7 @@ + ng-model="myModel.courseCode" ng-pattern="/^[a-zA-Z0-9-]*$/" required/> Course id is required + + Invalid Specilization 1 + + + +
+ + + + + Invalid Specilization 2 + + +
+ @@ -245,7 +280,7 @@ @@ -304,7 +339,7 @@ - diff --git a/Apollo/assets/views/editCourseDetails.html b/Apollo/assets/views/editCourseDetails.html index bab131f6..f21e0d12 100755 --- a/Apollo/assets/views/editCourseDetails.html +++ b/Apollo/assets/views/editCourseDetails.html @@ -16,8 +16,8 @@ + tabindex="2" class="form-control" name="coursecode" + ng-model="p.CourseID" ng-pattern="/^[a-zA-Z0-9-]*$/" readonly required/> Course id is required +
Course name is required @@ -48,7 +49,7 @@ - + + Invalid Specilization 1 + + +
+
+ - + + + Invalid Specilization 2 + + +
-
+
-
Single +
+ Single
@@ -108,7 +141,7 @@ -
+
@@ -154,7 +187,7 @@ @@ -168,7 +201,7 @@