course controller added

This commit is contained in:
gandhimathi 2017-11-23 20:15:22 +05:30
parent 59ee63bf6f
commit f33a328d4e

View File

@ -92,7 +92,7 @@ app.controller('universityCtrl', ["$scope", "toaster", "$filter", "ngTableParams
$scope.editId = -1;
}
$scope.updateUniversityDetails = function (form, p,loading) {
$scope.updateUniversityDetails = function (form, p) {
var firstError = null;
if (form.$invalid) {
var field = null, firstError = null;
@ -109,9 +109,6 @@ app.controller('universityCtrl', ["$scope", "toaster", "$filter", "ngTableParams
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 {
$rootScope.ldloading2 = {};
$rootScope.ldloading2[loading.replace('-', '_')] = true;
p.IsActive = p.IsActive === true ? 1 : 0;
var req = {
method: 'POST',
@ -128,13 +125,10 @@ app.controller('universityCtrl', ["$scope", "toaster", "$filter", "ngTableParams
if (response.data.updateUniversityStatus = true) {
swal("Success!", response.data.message, "success");
$scope.getUniversityList();
$rootScope.ldloading2[loading.replace('-', '_')] = false;
$scope.editId = -1;
} else {
// $scope.ldloading1[loading.replace('-', '_')] = false;
swal("Failed!", response.data.message, "error");
$rootScope.ldloading2[loading.replace('-', '_')] = false;
}
});
}
@ -142,7 +136,7 @@ app.controller('universityCtrl', ["$scope", "toaster", "$filter", "ngTableParams
// add university
$scope.universityForm = {
submit: function (form, myModel,loading) {
submit: function (form, myModel) {
var firstError = null;
if (form.$invalid) {
var field = null, firstError = null;
@ -159,9 +153,6 @@ app.controller('universityCtrl', ["$scope", "toaster", "$filter", "ngTableParams
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 {
$rootScope.ldloading1 = {};
$rootScope.ldloading1[loading.replace('-', '_')] = true;
$scope.myModel.switchsetting = $scope.myModel.switchsetting === true ? 1 : 0;
var req = {
method: 'POST',
@ -177,12 +168,10 @@ app.controller('universityCtrl', ["$scope", "toaster", "$filter", "ngTableParams
$http(req).then(function (response) {
if (response.data.addUniv == true) {
swal("Success!", response.data.message, "success");
$rootScope.ldloading1[loading.replace('-', '_')] = false;
$state.go($state.current, {}, { reload: true });
} else {
// $scope.ldloading1[loading.replace('-', '_')] = false;
swal("Failed!", response.data.message, "error");
$rootScope.ldloading1[loading.replace('-', '_')] = false;
}
});
}