course details changes done

This commit is contained in:
gandhimathi 2018-01-25 17:47:31 +05:30
parent e4bd7485da
commit 9e8d4e0d1d

View File

@ -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");
}
});