454 lines
12 KiB
JavaScript
454 lines
12 KiB
JavaScript
'use strict';
|
|
/*** controller***/
|
|
app.controller('newreg_reportCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage" ,"$http", "$state","$modal","$log",
|
|
function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http,ipCookie ,$state,$modal,$log){
|
|
|
|
//function ($scope, apiPoint, $http, SweetAlert, $state,$modal, md5, ipCookie, $window, dateListDescService) {
|
|
|
|
// DataTables configurable options
|
|
|
|
|
|
$scope.filters = {
|
|
|
|
"from_date": "",
|
|
"to_date": "",
|
|
|
|
};
|
|
|
|
|
|
var localDetails = JSON.parse(localStorage.getItem('localObj'));
|
|
//var localDetails = ipCookie('cookiechk');
|
|
|
|
// console.log(localDetails);
|
|
$scope.isTblShow = false;
|
|
$scope.isLoader = false;
|
|
$scope.isLoaderShow = false;
|
|
$scope.isLoaderShow1 =false;
|
|
$scope.isLoaderShow2 =false;
|
|
$scope.isLoaderTxt = "Loading...";
|
|
$scope.isLoaderTxt1 ="Selected Date Range is wrong";
|
|
$scope.generateButtonTxt = "GENERATE";
|
|
$scope.generateButtonStatus = false;
|
|
|
|
|
|
// $scope.initHead = function() {
|
|
//console.log('rfd');
|
|
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;
|
|
}
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//$scope.opinctotal='';
|
|
$scope.newreglist='';
|
|
$scope.isLoaderShow ='';
|
|
$scope.load = '';
|
|
$scope.isShow= '';
|
|
$scope.fromd='';
|
|
$scope.tod='';
|
|
$scope.getDetails = function (form,myModel)
|
|
{
|
|
// alert('in')
|
|
$scope.isLoaderShow = false;
|
|
$scope.isLoaderShow1 =true;
|
|
|
|
// console.log(myModel);
|
|
var from = $scope.filters.from_date;
|
|
var to = $scope.filters.to_date;
|
|
if(myModel != undefined)
|
|
{
|
|
|
|
var university = myModel.myUnivSearch ;
|
|
// console.log(from)
|
|
}
|
|
|
|
else
|
|
{
|
|
var university = '';
|
|
}
|
|
|
|
|
|
|
|
|
|
var f = new Date(from),
|
|
month = '' + (f.getMonth() + 1),
|
|
day = '' + f.getDate(),
|
|
year = f.getFullYear();
|
|
|
|
if (month.length < 2) month = '0' + month;
|
|
if (day.length < 2) day = '0' + day;
|
|
|
|
var from_dt = [day, month ,year].join('-');
|
|
|
|
|
|
|
|
var t = new Date(to),
|
|
month = '' + (t.getMonth() + 1),
|
|
day = '' + t.getDate(),
|
|
year = t.getFullYear();
|
|
|
|
if (month.length < 2) month = '0' + month;
|
|
if (day.length < 2) day = '0' + day;
|
|
|
|
var to_dt = [day, month ,year].join('-');
|
|
|
|
|
|
$scope.fromd = from_dt;
|
|
$scope.tod = to_dt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var getstudentdetails = {
|
|
|
|
method: 'POST',
|
|
url: apiPoint.url + 'NewregDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
university: university,
|
|
from : $scope.filters.from_date,
|
|
to : $scope.filters.to_date,
|
|
branch: JSON.parse(localStorage.getItem('localObj')).localBranchID
|
|
|
|
}
|
|
}
|
|
|
|
|
|
if($scope.filters.from_date > $scope.filters.to_date){
|
|
$scope.isLoaderShow2 =true;
|
|
}else{
|
|
$scope.isLoaderShow2 =false;
|
|
}
|
|
|
|
$http(getstudentdetails).then(function (response) {
|
|
|
|
if(response.data.status == 200 && response.data.searchst==true)
|
|
{
|
|
|
|
console.log(response.data);
|
|
$scope.newreglist = response.data.details;
|
|
$scope.isShow=true;
|
|
$scope.isLoaderShow=false;
|
|
$scope.isLoaderShow1 =false;
|
|
for(var i=0;i<$scope.newreglist.length;i++)
|
|
$scope.newreglist[i].SL_NO = i+1;
|
|
|
|
}
|
|
|
|
else
|
|
{
|
|
$scope.isLoaderShow=true;
|
|
$scope.isLoaderShow1 =false;
|
|
$scope.isShow=false;
|
|
}
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.exportData = function ()
|
|
{
|
|
//alert()
|
|
|
|
$scope.sam = 'New-Registration List from '+$scope.fromd+' to '+$scope.tod;
|
|
|
|
|
|
var mystyle = {
|
|
sheetid:$scope.sam,
|
|
headers: true,
|
|
caption: {
|
|
title: $scope.sam,
|
|
width: '1000px',
|
|
style:'font-size:50px;bold:true'
|
|
},
|
|
// style:'background:#00FF00',
|
|
column: {
|
|
style:'font-size:12px'
|
|
},
|
|
|
|
};
|
|
// console.log(mystyle);
|
|
|
|
alasql('SELECT SL_NO,BillDate as InitialPaymentPaidDate,CONCAT(Firstname,Lastname) as StudentName,Fathername,CourseName as Course,Sem_Year as SEM_YEAR,MobileNumber as Phone_No,UniversityName as University,ReferredBy,ReferersMobileNumber,CONCAT(Fname,Lname) as AdmittedBY INTO XLS("New Registration report.xls",?) FROM ?',[mystyle,$scope.newreglist]);
|
|
|
|
//console.log($scope.fullincomedetail);
|
|
// alasql('SELECT DOJ as RegistrationDate,Firstname as Name,Fathername,UniversityName,BatchName,CourseName,MobileNumber INTO XLS("New Registration report.xls",?) FROM ?',[mystyle,$scope.newreglist]);
|
|
|
|
};
|
|
|
|
|
|
$scope.OpenWindowStatus = false;
|
|
$scope.editId = -1;
|
|
$scope.setEditId = function (P)
|
|
{
|
|
//alert(P);
|
|
$scope.editId = P;
|
|
|
|
}
|
|
|
|
$scope.close = function ()
|
|
{
|
|
|
|
$scope.editId = -1;
|
|
|
|
}
|
|
|
|
|
|
$scope.fdate ='';
|
|
$scope.tdate ='';
|
|
//$scope.Subtypes = '';
|
|
|
|
|
|
|
|
|
|
$scope.open = function (studentDetails) {
|
|
|
|
|
|
|
|
// get student view details
|
|
var getcourse = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getStudentBasicInfo/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
requestedBy: studentDetails.StudentID,
|
|
requestedFrom: 1,
|
|
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 () {
|
|
$log.info('Modal dismissed at: ' + new Date());
|
|
});
|
|
|
|
} else {
|
|
swal("Failed!", "This student is not registerd", "warning");
|
|
$scope.courseEditLoading = false;
|
|
$scope.studentDetails = "";
|
|
$scope.courseDetails = "";
|
|
|
|
}
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|
|
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('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.StudentID,
|
|
requestedFrom: 1,
|
|
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 () {
|
|
$log.info('Modal dismissed at: ' + new Date());
|
|
});
|
|
|
|
} 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 () {
|
|
$log.info('Modal dismissed at: ' + new Date());
|
|
});
|
|
};
|
|
|
|
$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");
|
|
});
|
|
}
|
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|