course controller added
This commit is contained in:
parent
59ee63bf6f
commit
f33a328d4e
@ -92,7 +92,7 @@ app.controller('universityCtrl', ["$scope", "toaster", "$filter", "ngTableParams
|
|||||||
$scope.editId = -1;
|
$scope.editId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.updateUniversityDetails = function (form, p,loading) {
|
$scope.updateUniversityDetails = function (form, p) {
|
||||||
var firstError = null;
|
var firstError = null;
|
||||||
if (form.$invalid) {
|
if (form.$invalid) {
|
||||||
var field = null, firstError = null;
|
var field = null, firstError = null;
|
||||||
@ -109,9 +109,6 @@ app.controller('universityCtrl', ["$scope", "toaster", "$filter", "ngTableParams
|
|||||||
angular.element('.ng-invalid[name=' + firstError + ']').focus();
|
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");
|
// swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
||||||
} else {
|
} else {
|
||||||
$rootScope.ldloading2 = {};
|
|
||||||
|
|
||||||
$rootScope.ldloading2[loading.replace('-', '_')] = true;
|
|
||||||
p.IsActive = p.IsActive === true ? 1 : 0;
|
p.IsActive = p.IsActive === true ? 1 : 0;
|
||||||
var req = {
|
var req = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -128,13 +125,10 @@ app.controller('universityCtrl', ["$scope", "toaster", "$filter", "ngTableParams
|
|||||||
if (response.data.updateUniversityStatus = true) {
|
if (response.data.updateUniversityStatus = true) {
|
||||||
swal("Success!", response.data.message, "success");
|
swal("Success!", response.data.message, "success");
|
||||||
$scope.getUniversityList();
|
$scope.getUniversityList();
|
||||||
$rootScope.ldloading2[loading.replace('-', '_')] = false;
|
|
||||||
$scope.editId = -1;
|
$scope.editId = -1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// $scope.ldloading1[loading.replace('-', '_')] = false;
|
// $scope.ldloading1[loading.replace('-', '_')] = false;
|
||||||
swal("Failed!", response.data.message, "error");
|
swal("Failed!", response.data.message, "error");
|
||||||
$rootScope.ldloading2[loading.replace('-', '_')] = false;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -142,7 +136,7 @@ app.controller('universityCtrl', ["$scope", "toaster", "$filter", "ngTableParams
|
|||||||
|
|
||||||
// add university
|
// add university
|
||||||
$scope.universityForm = {
|
$scope.universityForm = {
|
||||||
submit: function (form, myModel,loading) {
|
submit: function (form, myModel) {
|
||||||
var firstError = null;
|
var firstError = null;
|
||||||
if (form.$invalid) {
|
if (form.$invalid) {
|
||||||
var field = null, firstError = null;
|
var field = null, firstError = null;
|
||||||
@ -159,9 +153,6 @@ app.controller('universityCtrl', ["$scope", "toaster", "$filter", "ngTableParams
|
|||||||
angular.element('.ng-invalid[name=' + firstError + ']').focus();
|
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");
|
// swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
||||||
} else {
|
} else {
|
||||||
$rootScope.ldloading1 = {};
|
|
||||||
|
|
||||||
$rootScope.ldloading1[loading.replace('-', '_')] = true;
|
|
||||||
$scope.myModel.switchsetting = $scope.myModel.switchsetting === true ? 1 : 0;
|
$scope.myModel.switchsetting = $scope.myModel.switchsetting === true ? 1 : 0;
|
||||||
var req = {
|
var req = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -177,12 +168,10 @@ app.controller('universityCtrl', ["$scope", "toaster", "$filter", "ngTableParams
|
|||||||
$http(req).then(function (response) {
|
$http(req).then(function (response) {
|
||||||
if (response.data.addUniv == true) {
|
if (response.data.addUniv == true) {
|
||||||
swal("Success!", response.data.message, "success");
|
swal("Success!", response.data.message, "success");
|
||||||
$rootScope.ldloading1[loading.replace('-', '_')] = false;
|
|
||||||
$state.go($state.current, {}, { reload: true });
|
$state.go($state.current, {}, { reload: true });
|
||||||
} else {
|
} else {
|
||||||
// $scope.ldloading1[loading.replace('-', '_')] = false;
|
// $scope.ldloading1[loading.replace('-', '_')] = false;
|
||||||
swal("Failed!", response.data.message, "error");
|
swal("Failed!", response.data.message, "error");
|
||||||
$rootScope.ldloading1[loading.replace('-', '_')] = false;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user