course details changes done
This commit is contained in:
parent
7c7ef348ba
commit
65e4e9bf0c
155
Apollo/assets/js/controllers/studentStatusUpdateCtrl.js
Normal file
155
Apollo/assets/js/controllers/studentStatusUpdateCtrl.js
Normal file
@ -0,0 +1,155 @@
|
||||
'use strict';
|
||||
/**
|
||||
* controllers for ng-table
|
||||
* Simple table with sorting and filtering on AngularJS
|
||||
*/
|
||||
// var helloApp = angular.module("helloApp", []);
|
||||
app.controller("studentStatusUpdateCtrl", ["$scope", "toaster", "$filter", "API_POINTS", "$localStorage", "$http", "$state", function ($scope, toaster, $filter, apiPoint, $localStorage, $http, $state) {
|
||||
|
||||
$scope.companies = {
|
||||
"ActivityID": "",
|
||||
"ActivityName": "",
|
||||
"switchsetting": true,
|
||||
|
||||
};
|
||||
/*
|
||||
* cancel edit div
|
||||
* created by kms
|
||||
* */
|
||||
$scope.cancel = function () {
|
||||
$scope.init();
|
||||
$scope.editId = -1;
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* update the default Activity details
|
||||
* created by kms
|
||||
* */
|
||||
$scope.updateActivity = function (myModel,listStatus, form, loading) {
|
||||
|
||||
var firstError = null;
|
||||
if (form.$invalid) {
|
||||
var field = null, firstError = null;
|
||||
for (field in form) {
|
||||
if (field[0] != '$') {
|
||||
if (firstError === null && !form[field].$valid) {
|
||||
firstError = form[field].$stop_name;
|
||||
}
|
||||
|
||||
if (form[field].$pristine) {
|
||||
form[field].$dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
angular.element('.ng-invalid[name=' + firstError + ']').focus();
|
||||
} else {
|
||||
$scope.ldloading3 = {};
|
||||
|
||||
$scope.ldloading3[loading.replace('-', '_')] = true;
|
||||
|
||||
|
||||
var update = {
|
||||
method: 'POST',
|
||||
url: apiPoint.url + 'updateDefaultActivityDetails/',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: {
|
||||
activityID: myModel.ActivityID,
|
||||
activityName: myModel.ActivityName,
|
||||
activityStatus:listStatus.list,
|
||||
updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID
|
||||
}
|
||||
};
|
||||
$http(update).then(function (response) {
|
||||
if (response.data.status==200 && response.data.activityStatus) {
|
||||
|
||||
$scope.ldloading3[loading.replace('-', '_')] = false;
|
||||
swal("Success!", response.data.message, "success");
|
||||
$scope.init();
|
||||
$scope.editId = -1;
|
||||
|
||||
|
||||
} else {
|
||||
$scope.ldloading3[loading.replace('-', '_')] = false;
|
||||
swal("Failed!", response.data.message, "error");
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// sorting function for table params
|
||||
$scope.sort = function(keyname){
|
||||
$scope.sortKey = keyname; //set the sortKey to the param passed
|
||||
$scope.reverse = !$scope.reverse; //if true make it false and vice versa
|
||||
}
|
||||
|
||||
|
||||
$scope.editId = -1;
|
||||
$scope.setEditId = function (p) {
|
||||
$scope.editId = p.ActivityID;
|
||||
$scope.editStatusList = [];
|
||||
angular.forEach(p.statusDetails, function (values, keys) {
|
||||
|
||||
$scope.editStatusList.push(values.ListCode);
|
||||
})
|
||||
$scope.viewEditStatus = {
|
||||
list: $scope.editStatusList,
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
*get Activity details when page loading called from view file
|
||||
*
|
||||
* created by karthi
|
||||
* */
|
||||
$scope.statusList = [];
|
||||
$scope.loader = '';
|
||||
$scope.emptyData = '';
|
||||
$scope.init = function () {
|
||||
var getActivity = {
|
||||
method: 'POST',
|
||||
url: apiPoint.url + 'getDefaultActivityDetails/',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: {
|
||||
requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID
|
||||
}
|
||||
};
|
||||
$http(getActivity).then(function (response) {
|
||||
if (response.data.status == 200 && response.data.activityStatus) {
|
||||
$scope.statusList = [];
|
||||
$scope.emptyData = true;
|
||||
$scope.loader = true;
|
||||
$scope.activityInfo = response.data.details;
|
||||
$scope.masterActivityStatus=response.data.masterStatusList;
|
||||
angular.forEach($scope.masterActivityStatus, function (values, keys) {
|
||||
$scope.statusData = {
|
||||
name: values.ListName,
|
||||
id: values.ListCode
|
||||
};
|
||||
$scope.statusList.push($scope.statusData);
|
||||
})
|
||||
} else {
|
||||
$scope.statusList = [];
|
||||
$scope.emptyData = false;
|
||||
$scope.loader = false;
|
||||
$scope.activityInfo = "";
|
||||
$scope.masterActivityStatus=response.data.masterStatusList;
|
||||
angular.forEach($scope.masterActivityStatus, function (values, keys) {
|
||||
$scope.statusData = {
|
||||
name: values.ListName,
|
||||
id: values.ListCode
|
||||
};
|
||||
$scope.statusList.push($scope.statusData);
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
}]);
|
||||
Loading…
Reference in New Issue
Block a user