625 lines
20 KiB
JavaScript
625 lines
20 KiB
JavaScript
'use strict';
|
|
/**
|
|
* controllers for ng-table
|
|
* Simple table with sorting and filtering on AngularJS
|
|
*/
|
|
|
|
app.controller('student_university_fee_compareCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$http", "API_POINTS", "$state", '$rootScope', '$cookies', 'md5', 'ipCookie', '$timeout', '$window', "flowFactory", "$interval", 'SweetAlert', '$modal', function ($scope, toaster, $filter, ngTableParams, $http, apiPoint, $state, $rootScope, $cookies, md5, ipCookie, $timeout, $window, flowFactory, $interval, SweetAlert, $modal) {
|
|
/**
|
|
* student university fee details compare
|
|
*/
|
|
// get local client details
|
|
var localDetail = JSON.parse(localStorage.getItem('localObj'));
|
|
var localDetails = ipCookie('cookiechk');
|
|
|
|
// load when html page load
|
|
$scope.init = function () {
|
|
|
|
if (localDetail != null) {
|
|
if (localDetail.localType === 'R004' || localDetail.localType === 'R003' || localDetail.localType === 'R002') {
|
|
// $scope.getUniversityList();
|
|
$scope.getUniversitySearchList();
|
|
$scope.getFileUploadUniversity();
|
|
} else {
|
|
localStorage.removeItem('localObj');
|
|
$state.go('login.signin');
|
|
}
|
|
} else {
|
|
$state.go('login.signin');
|
|
}
|
|
}
|
|
/*get university details for file upload
|
|
* */
|
|
// get University List
|
|
$scope.fileUploadUniversityData = '';
|
|
$scope.getFileUploadUniversity = function () {
|
|
var univreq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getUniversitySessionDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: localDetails
|
|
}
|
|
};
|
|
$http(univreq).then(function (response) {
|
|
if (response.data.status) {
|
|
$scope.fileUploadUniversityData = response.data.details;
|
|
} else {
|
|
$scope.fileUploadUniversityData="";
|
|
}
|
|
});
|
|
};
|
|
|
|
|
|
/* get json sem details for serach
|
|
* */
|
|
$scope.semDetails=["1","2","3","4","5","6","7","8"];
|
|
|
|
// get University List
|
|
$scope.universitySearchData = '';
|
|
$scope.getUniversitySearchList = function () {
|
|
var empListreq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getUnivCourseFromFileDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: localDetails
|
|
}
|
|
};
|
|
$http(empListreq).then(function (response) {
|
|
if (response.data.status) {
|
|
$scope.universitySearchData = response.data.details;
|
|
} else {
|
|
$scope.universitySearchData="";
|
|
}
|
|
});
|
|
};
|
|
|
|
|
|
$scope.searchData = {
|
|
"University": "",
|
|
"Course": "",
|
|
"Sem": ""
|
|
}
|
|
$scope.myUnivSearch = "";
|
|
$scope.sessionData="";
|
|
$scope.getUniveId = function (univ) {
|
|
if (univ === '') {
|
|
$scope.myUnivSearch = "";
|
|
$scope.searchData.University = '';
|
|
$scope.searchData.Course = '';
|
|
|
|
$scope.OpenWindowStatus = false;
|
|
} else {
|
|
let name = JSON.parse(univ);
|
|
$scope.searchData.University = name.univCode;
|
|
$scope.searchData.Course = '';
|
|
$scope.serachCourseData = name.univCourseDetails;
|
|
$scope.OpenWindowStatus = false;
|
|
}
|
|
|
|
};
|
|
/* mis match serach data*/
|
|
$scope.misMatchsSearchData = {
|
|
"University": "",
|
|
"Course": "",
|
|
"Sem": ""
|
|
}
|
|
$scope.misMatchCourseData=[];
|
|
$scope.getMisMatchUnivId = function (univ) {
|
|
if (univ === '') {
|
|
$scope.myUnivSearch = "";
|
|
$scope.misMatchsSearchData.University = '';
|
|
$scope.misMatchsSearchData.Course = '';
|
|
$scope.misMatchCourseData=[];
|
|
|
|
} else {
|
|
let uniName = JSON.parse(univ);
|
|
$scope.misMatchsSearchData.University = uniName.univCode;
|
|
$scope.misMatchsSearchData.Course = '';
|
|
$scope.misMatchCourseData=uniName.univCourseDetails;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
$scope.Searchloader = false;
|
|
$scope.studentData = false;
|
|
$scope.statusMessage="";
|
|
$scope.onSubmit = function(){
|
|
if($scope.searchData.University !== '' && $scope.searchData.Session !==''){
|
|
$scope.statusMessage="";
|
|
$scope.Searchloader = true;
|
|
var empListreq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getStudentUnivFeeCompareDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: localDetails,
|
|
search: $scope.searchData,
|
|
}
|
|
};
|
|
$http(empListreq).then(function (response) {
|
|
if (response.data.formTypeStatus) {
|
|
$scope.Searchloader = false;
|
|
$scope.studentData = true;
|
|
$scope.data = response.data.studentFeeCompareDetails;
|
|
$scope.studentListLength = $scope.data.length;
|
|
$scope.statusMessage="";
|
|
} else {
|
|
$scope.Searchloader = false;
|
|
$scope.studentData = false;
|
|
$scope.statusMessage = response.data.message;
|
|
$scope.data="";
|
|
}
|
|
});
|
|
}
|
|
}
|
|
//export excel
|
|
var mystyle = {
|
|
sheetid: 'Enrolment Details',
|
|
headers: true,
|
|
caption: {
|
|
title:'Student Form Enrolment Details',
|
|
width: '300px',
|
|
style:'font-size:50px;'
|
|
},
|
|
// style:'background:#00FF00',
|
|
column: {
|
|
style:'font-size:16px'
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.exportData = function () {
|
|
alasql('SELECT CAST(FormID as NUMBER) as FormID,EnrolmentNo as EnrolmentNo,FormType as FormType,concat(Firstname,Lastname) as StudentName,Fathername as FatherName,UniversityName as University,CourseName as Course,SemesterYear as SemYear INTO XLS("EnrolmentDetails.xls",?) FROM ?',[mystyle,$scope.data]);
|
|
};
|
|
//end of export excel
|
|
$scope.editId = -1;
|
|
$scope.setEditId=function(id){
|
|
$scope.editId = id;
|
|
}
|
|
|
|
/*upload model*/
|
|
$scope.uploadModel = {
|
|
university: "",
|
|
uploadFor: "",
|
|
}
|
|
/*
|
|
* upload options json
|
|
* */
|
|
$scope.uploadOptions=[{
|
|
id: 1,
|
|
name: 'Received Enrolment From University',
|
|
},
|
|
{
|
|
id: 2,
|
|
name: 'Received Fees From University'
|
|
},
|
|
];
|
|
/*
|
|
watch upload model for enable upload options
|
|
*/
|
|
$scope.showFile="0";
|
|
$scope.$watchCollection('uploadModel', function (newValue,oldValue) {
|
|
|
|
if(newValue.university!='' && newValue.university!=null){
|
|
$scope.showFile="1";
|
|
|
|
}
|
|
else{
|
|
$scope.showFile="0";
|
|
}
|
|
|
|
});
|
|
|
|
/* update received enrolment from university
|
|
* created by kms
|
|
* */
|
|
$scope.extractDetails="";
|
|
$scope.readXlsxDetails = function (workbook) {
|
|
/* DO SOMETHING WITH workbook HERE */
|
|
for (var sheetName in workbook.Sheets) {
|
|
var jsonData = XLSX.utils.sheet_to_json(workbook.Sheets[sheetName]);
|
|
if(jsonData.length!=0){
|
|
$scope.extractDetails=jsonData;
|
|
}
|
|
|
|
}
|
|
$scope.error = function (e) {
|
|
/* DO SOMETHING WHEN ERROR IS THROWN */
|
|
//console.log(e);
|
|
};
|
|
|
|
}
|
|
|
|
$scope.receiveEnrolmentDetails = function (details,uploadForDetails) {
|
|
if(details.length==0){
|
|
swal("Warning", "No data found for insert ", "warning");
|
|
}
|
|
else{
|
|
$scope.uniqueDetails = $filter('unique')(details,'Form Id');
|
|
var updateUniversityEnrolment = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'receiveEnrolmentFromUniv/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
localDetails: localDetail,
|
|
details: $scope.uniqueDetails,
|
|
universityID: angular.fromJson(uploadForDetails.university).UniversityID,
|
|
universityName: angular.fromJson(uploadForDetails.university).UniversityName,
|
|
|
|
}
|
|
};
|
|
|
|
$http(updateUniversityEnrolment).then(function (response) {
|
|
if (response.data.status == true) {
|
|
swal("", "Updated Successfully", "success");
|
|
$state.go($state.current, {}, {reload: true});
|
|
}
|
|
else if(response.data.status == false){
|
|
swal("", response.data.message, "error");
|
|
}
|
|
else {
|
|
swal("", "Failed", "error");
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|
|
// end
|
|
|
|
|
|
$scope.popupLoad = false;
|
|
$scope.popupLoadData = false;
|
|
$scope.formPaymentDetails="";
|
|
|
|
// Fee compare details get
|
|
|
|
$scope.getFeeCompareDetails = function(formId, enrolmentId){
|
|
$scope.popupLoadData = false;
|
|
$scope.formPaymentDetails="";
|
|
$scope.popupLoad = true;
|
|
var getFeeCompareDetailsList = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'formIDFeeCompareDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
localDetails: localDetail,
|
|
formId: formId,
|
|
enrolmentId: enrolmentId
|
|
}
|
|
};
|
|
|
|
$http(getFeeCompareDetailsList).then(function (response) {
|
|
if (response.data.status == true) {
|
|
$scope.popupLoad = false;
|
|
$scope.popupLoadData = true;
|
|
$scope.formPaymentDetails=response.data;
|
|
|
|
} else {
|
|
$scope.popupLoad = false;
|
|
$scope.popupLoadData = true;
|
|
$scope.formPaymentDetails=response.data;
|
|
}
|
|
});
|
|
}
|
|
|
|
$scope.unMatchedLoadingStatus = false;
|
|
// Get unmached details
|
|
$scope.getUnmatchedRecord = function(searchDetails){
|
|
$scope.unMatchedRecordDetails = '';
|
|
$scope.unMatchedNoRecordFound = false;
|
|
$scope.unMatchedLoadingStatus = true;
|
|
var getFeeCompareDetailsList = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getUnmatchedRecordDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
localDetails: localDetail,
|
|
getDetailsFor: searchDetails
|
|
}
|
|
};
|
|
$http(getFeeCompareDetailsList).then(function (response) {
|
|
if (response.data.unMatchedRecordStatus == true) {
|
|
$scope.unMatchedLoadingStatus = false;
|
|
$scope.unMatchedNoRecordFound = false;
|
|
$scope.unMatchedRecordDetails=response.data.unMatchedRecordDetails;
|
|
$scope.unMatchedRecordDetailsType= response.data.unMatchedRecordFor;
|
|
} else {
|
|
$scope.unMatchedLoadingStatus = false;
|
|
$scope.unMatchedNoRecordFound = true;
|
|
$scope.unMatchedRecordDetails=response.data.unMatchedRecordDetails;
|
|
}
|
|
});
|
|
}
|
|
//export excel
|
|
var mystyle1 = {
|
|
sheetid: 'Unmatched Records',
|
|
headers: true,
|
|
caption: {
|
|
title:'Unmatched Records',
|
|
width: '300px',
|
|
style:'font-size:50px;'
|
|
},
|
|
// style:'background:#00FF00',
|
|
column: {
|
|
style:'font-size:16px'
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.exportDataTab2 = function () {
|
|
alasql('SELECT CAST(FormID as NUMBER) as FormID,EnrolmentNo as EnrolmentNo,SemesterYear as SemesterYear,CAST(MobileNumber AS NUMBER) as MobileNumber,StudentName as StudentName,UniversityCode as UniversityCode,UniversityName as UniversityName,CourseCode as CourseCode,CourseName as CourseName,FatherName as FatherName,MotherName as MotherName,EmailID as EmailID INTO XLS("UnmatchedRecords.xls",?) FROM ?',[mystyle1,$scope.unMatchedRecordDetails]);
|
|
};
|
|
//End of export excel
|
|
$scope.manualEnModel={
|
|
"enrolmentNo": '',
|
|
"formID":"",
|
|
"sem":'',
|
|
};
|
|
/*
|
|
* add manual enrolment details
|
|
* */
|
|
$scope.enableEnrolment=false;
|
|
$scope.addManualEnrolemntDetails=function (values) {
|
|
if(values=='1'){
|
|
$scope.enableEnrolment=!$scope.enableEnrolment;
|
|
}
|
|
else{
|
|
$scope.enableEnrolment=!$scope.enableEnrolment;
|
|
}
|
|
|
|
}
|
|
/*
|
|
* check enrolment exist or not in student details
|
|
* */
|
|
$scope.semList=[];
|
|
$scope.studentInfo=[];
|
|
$scope.checkEnrolmentExistDetails=function (form,entryModel) {
|
|
$scope.semList=[];
|
|
$scope.studentInfo=[];
|
|
if(entryModel=='' || entryModel==null || entryModel==undefined){
|
|
swal("Warning","Please enter enrollment id", "error");
|
|
}
|
|
else{
|
|
var getExistEnrol = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getExistStudentEnrolmentDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
localDetails: localDetail,
|
|
enrolmentID: entryModel
|
|
}
|
|
};
|
|
$http(getExistEnrol).then(function (response) {
|
|
if (response.data.status == true) {
|
|
if(response.data.semDetails.length==0){
|
|
swal("Warning","In this enrollment have form id for all the semester", "warning");
|
|
}
|
|
else{
|
|
$scope.studentInfo=response.data.StudentInfo;
|
|
$scope.semList=response.data.semDetails;
|
|
}
|
|
|
|
} else {
|
|
$scope.semList=[];
|
|
$scope.studentInfo=[];
|
|
swal("Failed",response.data.message, "error");
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
}
|
|
/*
|
|
* cancel manual entry for enrolment details
|
|
* */
|
|
$scope.cancelManualEntry=function (form) {
|
|
$scope.semList=[];
|
|
$scope.enableEnrolment=!$scope.enableEnrolment;
|
|
$scope.manualEnModel.sem="";
|
|
$scope.manualEnModel.formID="";
|
|
}
|
|
/*
|
|
* submit manual entry form details
|
|
* */
|
|
$scope.manualEnrolmentSubmit = function (form) {
|
|
if($scope.manualEnModel.enrolmentNo=='' || $scope.manualEnModel.enrolmentNo==null || $scope.manualEnModel.enrolmentNo==undefined){
|
|
swal("Wraning","Please enter enrollment id", "warning");
|
|
|
|
}
|
|
else if($scope.manualEnModel.sem=='' || $scope.manualEnModel.sem==null){
|
|
swal("Wraning","Please select sem", "warning");
|
|
|
|
}
|
|
else if($scope.manualEnModel.formID=='' || $scope.manualEnModel.formID==null){
|
|
swal("Wraning","Please enter form id", "warning");
|
|
|
|
}
|
|
else{
|
|
var addEntry = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'addManualEnrolmentDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
localDetails: localDetail,
|
|
enrolmentID: $scope.manualEnModel.enrolmentNo,
|
|
formID: $scope.manualEnModel.formID,
|
|
sem: $scope.manualEnModel.sem,
|
|
studentInfo:$scope.studentInfo
|
|
}
|
|
};
|
|
$http(addEntry).then(function (response) {
|
|
if (response.data.status == true) {
|
|
$scope.studentInfo="";
|
|
$scope.semList=[];
|
|
$scope.manualEnModel.sem="";
|
|
$scope.manualEnModel.formID="";
|
|
swal("Success",response.data.message, "success");
|
|
} else {
|
|
swal("Failed",response.data.message, "error");
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
};
|
|
|
|
|
|
}]);
|
|
/*modal controller
|
|
* */
|
|
app.controller('studentModalDemoCtrl', ["$scope", "$rootScope", "$modal", "$log", "API_POINTS", "$http", function ($scope, $rootScope, $modal, $log,apiPoint,$http) {
|
|
//Tooltip for print button
|
|
$scope.dynamicTooltip = 'Student View';
|
|
|
|
|
|
|
|
// $scope.items = ['item1', 'item2', 'item3'];
|
|
|
|
$scope.open = function (studentDetails) {
|
|
// get student view details
|
|
var getcourse = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getStudentBasicInfo/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
requestedBy :studentDetails.MobileNumber,
|
|
requestedFrom: 4,
|
|
branchCode : JSON.parse(localStorage.getItem('localObj')).localBranchID
|
|
|
|
}
|
|
};
|
|
$http(getcourse).then(function (response) {
|
|
|
|
if (response.data.status == 200 && response.data.studentStatus== true) {
|
|
$scope.courseEditLoading = false;
|
|
// $scope.studentDetails = response.data.studentDetails;
|
|
$scope.studentDetails = response.data;
|
|
// $scope.courseDetails = response.data.courseDetails;
|
|
var modalInstance = $modal.open({
|
|
templateUrl: 'assets/views/student/studentDetailsModal.html',
|
|
controller: 'ModalInstanceCtrl',
|
|
// size: size,
|
|
resolve: {
|
|
items: function () {
|
|
return $scope.studentDetails;
|
|
}
|
|
}
|
|
});
|
|
|
|
modalInstance.result.then(function (selectedItem) {
|
|
$scope.selected = selectedItem;
|
|
}, function () {
|
|
modalInstance.close();
|
|
});
|
|
|
|
} else {
|
|
swal("Failed!", "This student is not registerd", "warning");
|
|
$scope.courseEditLoading = false;
|
|
$scope.studentDetails = "";
|
|
$scope.courseDetails = "";
|
|
|
|
}
|
|
});
|
|
};
|
|
$scope.open1 = function (values,type) {
|
|
|
|
var modalInstance1 = $modal.open({
|
|
templateUrl: 'assets/views/student/studentPaymentModal.html',
|
|
controller: 'ModalInstanceCtrl1',
|
|
// size: size,
|
|
resolve: {
|
|
items1: function () {
|
|
var myvalues =
|
|
{
|
|
"values":values,
|
|
"type":type
|
|
};
|
|
return myvalues;
|
|
}
|
|
|
|
}
|
|
});
|
|
|
|
modalInstance1.result.then(function (selectedItem) {
|
|
$scope.selected = selectedItem;
|
|
}, function () {
|
|
modalInstance1.close();
|
|
});
|
|
};
|
|
$scope.printStudentDetails = function (details) {
|
|
$rootScope.pdfItems = details;
|
|
|
|
var printInstance = $modal.open({
|
|
templateUrl: 'assets/views/student/studentPdf.html',
|
|
controller: 'studentModalDemoCtrl',
|
|
});
|
|
};
|
|
// generate pdf for student view
|
|
$scope.export = function(getName) {
|
|
kendo.drawing.drawDOM($("#exportthis")).then(function(group) {
|
|
kendo.drawing.pdf.saveAs(group, getName+".pdf");
|
|
});
|
|
}
|
|
|
|
}]);
|
|
// Please note that $modalInstance represents a modal window (instance) dependency.
|
|
// It is not the same as the $modal service used above.
|
|
|
|
app.controller('ModalInstanceCtrl', ["$scope", "$modalInstance", "items","WordsService", function ($scope, $modalInstance, items,WordsService) {
|
|
|
|
$scope.items = items;
|
|
$scope.selected = {
|
|
item: $scope.items[0]
|
|
};
|
|
|
|
$scope.ok = function () {
|
|
$modalInstance.close($scope.selected.item);
|
|
};
|
|
|
|
$scope.cancel = function () {
|
|
$modalInstance.dismiss('cancel');
|
|
};
|
|
}]);
|
|
app.controller('ModalInstanceCtrl1', ["$scope", "$modalInstance", "items1","WordsService", function ($scope, $modalInstance, items1,WordsService) {
|
|
|
|
$scope.items1 = items1.values;
|
|
$scope.selectedtype = items1.type;
|
|
|
|
$scope.ok = function () {
|
|
$modalInstance.close($scope.selected.item);
|
|
};
|
|
|
|
$scope.cancel = function () {
|
|
$modalInstance.dismiss('cancel');
|
|
};
|
|
|
|
}]);
|
|
|