diff --git a/Apollo/assets/js/controllers/courseCtrl.js b/Apollo/assets/js/controllers/courseCtrl.js index 7a73d074..5d0612b5 100755 --- a/Apollo/assets/js/controllers/courseCtrl.js +++ b/Apollo/assets/js/controllers/courseCtrl.js @@ -207,49 +207,66 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab } else{ - $scope.ldloading1 = {}; - $scope.ldloading1[loading.replace('-', '_')] = true; + /* check duplication objects values */ + if(semYearModel.program=='Y001'){ + $scope.myModelSemYear.programName=""; + $scope.myModelSemYear.FeesAmount=""; + var valueArr = $scope.addMoreItems.map(function(item){ return item.programName }); + var isDuplicate = valueArr.some(function(item, idx){ + return valueArr.indexOf(item) != idx; + }); + } + if(semYearModel.program=='Y001' && isDuplicate==true){ + + swal("Warning!", 'Sem/Year Duplication ', "warning"); + } + else{ + $scope.ldloading1 = {}; + + $scope.ldloading1[loading.replace('-', '_')] = true; - var addCourse = { - method: 'POST', - url: apiPoint.url + 'addCourseDetails/', - headers: { - 'Content-Type': 'application/json' - }, - data: { - courseCode: 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, - // subjects:myModel.subject, - branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID - } - }; - $http(addCourse).then(function (response) { - if (response.data.status==200 && response.data.courseStatus) { - $scope.ldloading1[loading.replace('-', '_')] = false; - swal(" ", "Course added successfully.", "success"); - $state.go($state.current, {}, {reload: true}); - } else { - $scope.addMoreItems.splice($scope.addMoreItems.length-1); - $scope.ldloading1[loading.replace('-', '_')] = false; - swal(" ", response.data.message, "error"); - } - }); + var addCourse = { + method: 'POST', + url: apiPoint.url + 'addCourseDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + courseCode: 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, + // subjects:myModel.subject, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID + } + }; + $http(addCourse).then(function (response) { + if (response.data.status==200 && response.data.courseStatus) { + $scope.ldloading1[loading.replace('-', '_')] = false; + swal(" ", "Course added successfully.", "success"); + $state.go($state.current, {}, {reload: true}); + } else { + $scope.addMoreItems.splice($scope.addMoreItems.length-1); + $scope.ldloading1[loading.replace('-', '_')] = false; + swal(" ", response.data.message, "error"); + } + }); + } + } @@ -296,57 +313,73 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab FeesAmount: semYear.FeesAmount }); } - $scope.ldloading = {}; + /* check duplication objects values */ + if(semYear.program=='Y001'){ + $scope.myModelSemYear1.programName=""; + $scope.myModelSemYear1.FeesAmount=""; + var valueArr = $rootScope.updateMoreItems.map(function(item){ return item.programName }); + var isDuplicate = valueArr.some(function(item, idx){ + return valueArr.indexOf(item) != idx; + }); + } + if(semYear.program=='Y001' && isDuplicate==true){ - $scope.ldloading[loading.replace('-', '_')] = true; + swal("Warning!", 'Sem/Year Duplication ', "warning"); + } + else{ + $scope.ldloading = {}; + + $scope.ldloading[loading.replace('-', '_')] = true; - var update = { - method: 'POST', - url: apiPoint.url + 'updateCourseDetails/', - headers: { - 'Content-Type': 'application/json' - }, - data: { - courseID: myModel.CourseID, - universityID: myModel.UniversityID, - courseCode: myModel.CourseCode, - courseName: myModel.CourseName, - provFess:myModel.PC, - transferAmount:myModel.TC, - degreeAmount:myModel.DC, - migrationAmount:myModel.MC, - otherAmount:myModel.OtherFees, - feesAmounts:myModel.feesStructures, - regularFeesAmounts:regular, - lateralFeesAmounts:lateral, - semFeesAmounts:$rootScope.updateMoreItems, - status: myModel.IsActive, - updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, - specilization1:myModel.Specilization1, - specilization2:myModel.Specilization2, - existCourseID:myModel.CourseID, - // subjects:subjects.list, - branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID + var update = { + method: 'POST', + url: apiPoint.url + 'updateCourseDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + courseID: myModel.CourseID, + universityID: myModel.UniversityID, + courseCode: myModel.CourseCode, + courseName: myModel.CourseName, + provFess:myModel.PC, + transferAmount:myModel.TC, + degreeAmount:myModel.DC, + migrationAmount:myModel.MC, + otherAmount:myModel.OtherFees, + feesAmounts:myModel.feesStructures, + regularFeesAmounts:regular, + lateralFeesAmounts:lateral, + semFeesAmounts:$rootScope.updateMoreItems, + status: myModel.IsActive, + updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + specilization1:myModel.Specilization1, + specilization2:myModel.Specilization2, + existCourseID:myModel.CourseID, + // subjects:subjects.list, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID - } - }; - $http(update).then(function (response) { - if (response.data.status==200 && response.data.courseStatus) { - $scope.ldloading[loading.replace('-', '_')] = false; - $rootScope.updateMoreItems=[]; - $rootScope.init(); - swal(" ", "Updated successfully.", "success"); + } + }; + $http(update).then(function (response) { + if (response.data.status==200 && response.data.courseStatus) { + $scope.ldloading[loading.replace('-', '_')] = false; + $rootScope.updateMoreItems=[]; + $rootScope.init(); + swal(" ", "Updated successfully.", "success"); - $scope.editId = -1; + $scope.editId = -1; - } else { - $scope.ldloading[loading.replace('-', '_')] = false; - // $rootScope.init(); - swal(" ", response.data.message, "error"); - } - }); + } else { + $scope.ldloading[loading.replace('-', '_')] = false; + // $rootScope.init(); + swal(" ", response.data.message, "error"); + } + }); + } + } }; /* diff --git a/Apollo/assets/views/courseDetails.html b/Apollo/assets/views/courseDetails.html index c8f4810a..5c8c38b1 100755 --- a/Apollo/assets/views/courseDetails.html +++ b/Apollo/assets/views/courseDetails.html @@ -309,7 +309,7 @@ + ng-model="myModelRegular.FeesAmount" ng-disabled="myModelLateral.FeesAmount!='' || myModelSemYear.programName!='' || myModelSemYear.FeesAmount!='' || addMoreItems.length!=0" ng-pattern="/^[0-9]*$/"/> Enter a valid amount @@ -322,7 +322,7 @@ + ng-model="myModelLateral.FeesAmount" ng-disabled="myModelRegular.FeesAmount!='' || myModelSemYear.programName!='' || myModelSemYear.FeesAmount!='' || addMoreItems.length!=0" ng-pattern="/^[0-9]*$/"/> Enter a valid amount diff --git a/Apollo/assets/views/editCourseDetails.html b/Apollo/assets/views/editCourseDetails.html index 675f8cab..da1139a2 100755 --- a/Apollo/assets/views/editCourseDetails.html +++ b/Apollo/assets/views/editCourseDetails.html @@ -290,8 +290,95 @@ +
+
+
+
+ -
+ + Enter a valid amount + +
+ + + +
+ + + + Enter a valid amount + +
+
+ + +
+
+ + + + Enter a valid amount + +
+
+ + + + Enter a valid amount + +
+
+ +
+
+ + + + Enter a valid amount + +
+
+ + + + +
+ + +
+ +
{{myModelSemYear1.FeesName}}