271 lines
7.4 KiB
JavaScript
271 lines
7.4 KiB
JavaScript
'use strict';
|
|
/*** controller***/
|
|
app.controller('entrycorrectionCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state","$modal","$log",
|
|
function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state,$modal,$log){
|
|
|
|
//function ($scope, apiPoint, $http, SweetAlert, $state,$modal, md5, ipCookie, $window, dateListDescService) {
|
|
|
|
// DataTables configurable options
|
|
|
|
|
|
$scope.filters = {
|
|
|
|
"Date": "",
|
|
//"to_date": "",
|
|
|
|
};
|
|
|
|
|
|
|
|
// $scope.initHead = function() {
|
|
|
|
var logcheck = JSON.parse(localStorage.getItem('localObj'));
|
|
|
|
const LOCALTYPE = logcheck.localType;
|
|
if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' || LOCALTYPE == 'R002' || LOCALTYPE == 'R005')) {
|
|
console.log("if");
|
|
}else {
|
|
if(logcheck != null && LOCALTYPE !='R001') {
|
|
console.log("else if");
|
|
$state.go('app.dashboard');
|
|
} else {
|
|
|
|
console.log("else else");
|
|
//ipCookie.remove('cookiechk');
|
|
window.localStorage.clear();
|
|
$state.go('login.signin');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$scope.universitySearchData = '';
|
|
|
|
$scope.init = function()
|
|
{
|
|
|
|
// alert()
|
|
var getuniv = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'AllgetUniversity/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
|
|
data: {
|
|
|
|
branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID,
|
|
}
|
|
|
|
};
|
|
|
|
$http(getuniv).then(function (response) {
|
|
|
|
if(response.status == 200)
|
|
{
|
|
$scope.universitySearchData=response.data.details;
|
|
|
|
//console.log($scope.universitySearchData);
|
|
}
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.studentInfo="";
|
|
$scope.getStudentDetails = function (form,myModel)
|
|
{
|
|
|
|
if(myModel !=undefined)
|
|
{
|
|
var mobileNumber = myModel.mobileNumber;
|
|
var studentName = myModel.studentName;
|
|
var receipt = myModel.receipt;
|
|
$scope.universityId = myModel.myUnivSearch;
|
|
// console.log($scope.universityId);
|
|
// return false;
|
|
|
|
$scope.isLoaderShow= false
|
|
|
|
var getdetail = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getAllstudentcoursedetail/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data :{
|
|
studentName: myModel.studentName,
|
|
mobileNumber: myModel.mobileNumber,
|
|
receipt: myModel.receipt,
|
|
University:$scope.universityId,
|
|
requestedtBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
|
|
branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID,
|
|
requestedDept: JSON.parse(localStorage.getItem('localObj')).localType,
|
|
}
|
|
|
|
};
|
|
|
|
$http(getdetail).then(function (response) {
|
|
|
|
//console.log(response)
|
|
if (response.data.status==200 && response.data.studentStatus) {
|
|
$scope.studentInfo=response.data.details;
|
|
console.log($scope.studentInfo);
|
|
|
|
} else {
|
|
$scope.studentInfo="";
|
|
|
|
$scope.isLoaderShow = true;
|
|
$scope.load = "No Records Found";
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
{
|
|
swal('Please Enter Any Field to Continue',"",'error');
|
|
return false;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.OpenWindowStatus = false;
|
|
$scope.editId = -1;
|
|
$scope.setEditId = function (P)
|
|
{ //alert(JSON.stringify(P));
|
|
|
|
var feedetails = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getAllfeedetail/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data :{
|
|
studentId: P.StudentID,
|
|
courseId:P.CourseID,
|
|
University:$scope.universityId,
|
|
requestedtBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
|
|
branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID,
|
|
requestedDept: JSON.parse(localStorage.getItem('localObj')).localType,
|
|
}
|
|
|
|
};
|
|
|
|
$http(feedetails).then(function (response) {
|
|
|
|
//console.log(response)
|
|
if (response.data.status==200 && response.data.feeStatus) {
|
|
$scope.feeInfo=response.data.details;
|
|
console.log($scope.feeInfo);
|
|
$scope.editId = P.ID;
|
|
|
|
} else {
|
|
$scope.feeInfo="";
|
|
$scope.loadfee = "No Records Found";
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
$scope.close = function ()
|
|
{
|
|
$scope.editId = -1;
|
|
}
|
|
|
|
|
|
|
|
$scope.updatestatus = function(myModel, 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].$name;
|
|
}
|
|
if (form[field].$pristine) {
|
|
form[field].$dirty = true;
|
|
}
|
|
}
|
|
}
|
|
angular.element('.ng-invalid[name=' + firstError + ']').focus();
|
|
swal("Please Enter Reason!", "", "error");
|
|
}
|
|
else
|
|
{
|
|
//alert('else')
|
|
// return false;
|
|
var IsActive = '';
|
|
|
|
if(myModel.IsActive == true)
|
|
{
|
|
IsActive =1;
|
|
}
|
|
|
|
else if(myModel.IsActive == false)
|
|
{
|
|
IsActive =0;
|
|
}
|
|
|
|
var studentid= myModel.StudentID;
|
|
var universityid = myModel.UniversityID;
|
|
var courseId = myModel.CourseID;
|
|
|
|
var updatecourse = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'updateCourseDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
|
|
studentid:studentid,
|
|
universityid:universityid,
|
|
courseId:courseId,
|
|
Reason:myModel.Reason,
|
|
IsActive:IsActive,
|
|
requestedtBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
|
|
branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID,
|
|
requestedDept: JSON.parse(localStorage.getItem('localObj')).localType,
|
|
}
|
|
};
|
|
|
|
$http(updatecourse).then(function (response) {
|
|
swal('Change Saved Successfully', response.data.message, "success");
|
|
$scope.close();
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|