647 lines
22 KiB
JavaScript
Executable File
647 lines
22 KiB
JavaScript
Executable File
'use strict';
|
|
/*** controller***/
|
|
app.controller('report_certificateCtrl', ["$scope", "$filter","$rootScope","$modal", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', '$window',"dateListDescService",
|
|
function ($scope, $filter,$rootScope,$modal, apiPoint, $http, SweetAlert, $state, md5, ipCookie, $window, dateListDescService) {
|
|
/*
|
|
* auto call tracking
|
|
*/
|
|
$scope.userType=JSON.parse(sessionStorage.getItem('localObj')).localType;
|
|
$scope.isTblShow = false;
|
|
$scope.isLoader = false;
|
|
$scope.isLoaderShow = false;
|
|
$scope.isLoaderShow1 =false;
|
|
$scope.isLoaderTxt = "Loading...";
|
|
$scope.isLoaderTxt1 ="Selected Date Range is wrong";
|
|
$scope.generateButtonTxt = "GENERATE";
|
|
$scope.generateButtonStatus = false;
|
|
$scope.currentPage = 1;
|
|
|
|
$scope.myModel = {
|
|
|
|
"date": new Date(),
|
|
"activity": "",
|
|
"assignedTo": "",
|
|
"status": "",
|
|
"referedBy": '',
|
|
"comments":'',
|
|
"enquiryStatus":'',
|
|
|
|
"important":false,
|
|
"branch":"",
|
|
|
|
};
|
|
|
|
//get current date
|
|
$scope.hideDateSearch=true;
|
|
$scope.modifyMinDate = moment();
|
|
//$scope.minDate = $filter('date')($scope.modifyMinDate, 'MM-dd-yyyy');
|
|
$scope.currentDate=$filter('date')(new Date(), 'dd-MM-yyyy');
|
|
// get 30 plus date for follwup details
|
|
$scope.modifyDate = moment();
|
|
$scope.modifyDate.add(30, 'days');
|
|
$scope.futureDate = $filter('date')($scope.modifyDate, 'dd-MM-yyyy');
|
|
$scope.myModel.date=$scope.currentDate;
|
|
// console.log($scope.currentDate);
|
|
/**
|
|
* End of the call tracking
|
|
*/
|
|
// DataTables configurable options
|
|
|
|
|
|
$scope.univModel = {
|
|
"branch": "",
|
|
"university": "",
|
|
"batch": "",
|
|
"status":"",
|
|
"from_date": "",
|
|
"to_date": "",
|
|
|
|
};
|
|
|
|
$scope.filters = function () {
|
|
var filterlist = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'report_certificate_filter/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
branch : JSON.parse(sessionStorage.getItem('localObj')).localBranchID
|
|
|
|
}
|
|
|
|
};
|
|
$http(filterlist).then(function (response) {
|
|
if (response.data) {
|
|
$scope.batch=[];
|
|
$scope.batchlist = response.data.batch;
|
|
$scope.university = response.data.university;
|
|
$scope.certificatestatus = response.data.certificatestatus;
|
|
//Desc order Batchlist
|
|
angular.forEach($scope.batchlist,function (values,key) {
|
|
var parts = values.BatchDate.split("-");
|
|
$scope.batch.push({
|
|
"batchcode":values.batchcode,
|
|
"batch":values.batch + '('+ values.batchcode + ')',
|
|
"BatchDate":values.BatchDate,
|
|
"givenDateObject":new Date(parts[2], parts[1] - 1, parts[0])
|
|
})
|
|
});
|
|
// call service for make a list in desc order based on date
|
|
$scope.batch=dateListDescService.getOrderByList($scope.batch);
|
|
//console.log($scope.branch);
|
|
} else {
|
|
}
|
|
});
|
|
}
|
|
/* watch university model for bind batch objects*/
|
|
|
|
$scope.$watchCollection('univModel.university', function (newValue,oldValue) {
|
|
if(newValue==undefined || newValue==''){
|
|
$scope.filterBatchDetails="";
|
|
$scope.disableSubmit=true;
|
|
}
|
|
else{
|
|
if(angular.isString(newValue)){
|
|
$scope.filterBatchDetails=angular.fromJson(newValue);
|
|
$scope.disableSubmit=false;
|
|
}
|
|
}
|
|
|
|
});
|
|
// disable submit
|
|
$scope.$watchCollection('univModel.status', function (newValue,oldValue) {
|
|
if(newValue==undefined || newValue=='' || newValue==null){
|
|
$scope.disableSubmit=true;
|
|
}
|
|
else{
|
|
$scope.disableSubmit=false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$scope.onSubmit = function (form) {
|
|
$scope.isLoaderShow1 =true;
|
|
if($scope.univModel.university !== null && $scope.univModel.university !== '' ){
|
|
$scope.filterUniv = angular.fromJson($scope.univModel.university);
|
|
}else {
|
|
$scope.filterUniv = '';
|
|
}
|
|
var firstError = null;
|
|
if (form.$invalid) {
|
|
var field = null, firstError = null;
|
|
$scope.show = true;
|
|
for (field in form) {
|
|
console.log('field',field);
|
|
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();
|
|
}else{
|
|
|
|
|
|
//alert($scope.batch.name);
|
|
$scope.cert_data = '';
|
|
$scope.message = '';
|
|
var response_data = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'report_certificate/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
branch: JSON.parse(sessionStorage.getItem('localObj')).localBranchID,
|
|
university: $scope.filterUniv.universityID,
|
|
batch: $scope.univModel.batch,
|
|
status:$scope.univModel.status,
|
|
from : $scope.univModel.from_date,
|
|
to : $scope.univModel.to_date
|
|
}
|
|
|
|
};
|
|
|
|
if($scope.univModel.from_date > $scope.univModel.to_date){
|
|
$scope.isLoaderShow =true;
|
|
}else{
|
|
$scope.isLoaderShow =false;
|
|
}
|
|
|
|
$http(response_data).then(function (response) {
|
|
if (response.data.certList == true) {
|
|
$scope.isLoaderShow1 =false;
|
|
$scope.cert_data = response.data.cert_data;
|
|
for(var i=0;i<$scope.cert_data.length;i++)
|
|
$scope.cert_data[i].SL_NO = i+1;
|
|
|
|
} else {
|
|
$scope.isLoaderShow1 =false;
|
|
$scope.message = response.data.message;
|
|
}
|
|
|
|
});
|
|
}
|
|
}
|
|
var mystyle = {
|
|
sheetid: 'CERTIFICATE STATUS REPORT',
|
|
headers: true,
|
|
caption: {
|
|
title:'CERTIFICATE STATUS REPORT',
|
|
width: '300px',
|
|
style:'font-size:50px;'
|
|
},
|
|
// style:'background:#00FF00',
|
|
column: {
|
|
style:'font-size:10px'
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.exportData = function () {
|
|
|
|
alasql('SELECT CAST(SL_NO AS NUMBER) as SLNO,initialPaid as CertificateFeePaidDate,Enrollment_id as EnrollmentID,Student_name as StudentName,Father_name as FatherName,Course_name as Course,University as University,CAST(balance AS NUMBER) as Balance,certname as CertificateName,STATUS as CertificateStatus,acmts as Comments, adate as Date,Batch_Name as Batch,Courier_Details as CertificateCourierDetails INTO XLS("Certificate_status.xls",?) FROM ?',[mystyle,$scope.cert_data]);
|
|
};
|
|
$scope.$watch(function () {
|
|
$scope.filteredItems = $scope.$eval(" cert_data | filter: search ");
|
|
});
|
|
/**
|
|
* Auto Call Tracking Sriram
|
|
*/
|
|
$rootScope.selectedStudentcertificateMN = [];
|
|
$scope.selectedStudentsID = [];
|
|
$scope.isCheckAll = function(e){
|
|
var val = (e.target.checked ? true : false);
|
|
if(val)
|
|
{
|
|
// $scope.disable = false;
|
|
var len = $scope.filteredItems.length;
|
|
var i = 0;
|
|
for(i=0;i<len;i++)
|
|
{
|
|
if($scope.selectedStudentsID.indexOf($scope.filteredItems[i]) === -1)
|
|
{
|
|
|
|
$scope.selectedStudentsID.push($scope.filteredItems[i]);
|
|
$rootScope.selectedStudentcertificateMN.push($scope.filteredItems[i].Phone_number);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// $scope.disable = true;
|
|
$scope.selectedStudentsID = [];
|
|
}
|
|
if($scope.selectedStudentsID !=''){
|
|
$scope.disable = false;
|
|
}else{
|
|
$scope.disable = true;
|
|
}
|
|
console.log($scope.selectedStudentsID);
|
|
}
|
|
$scope.isClick = function(e){
|
|
var ide = e.target;
|
|
var val = (ide.checked ? true : false);
|
|
var sid = e.target.id;
|
|
var smn = e.target.Phone_number;
|
|
// console.log("328");
|
|
// console.log($scope.balfee_data);
|
|
angular.forEach($scope.cert_data,function(value,key){
|
|
|
|
if(sid == value.Student_id)
|
|
{
|
|
sid = value;
|
|
smn = value.Phone_number;
|
|
}
|
|
});
|
|
console.log(sid);
|
|
var pos = $scope.selectedStudentsID.indexOf(sid);
|
|
//alert(val);
|
|
console.log($scope.selectedStudentsID.indexOf(sid));
|
|
if(val)
|
|
{
|
|
if( pos == -1)
|
|
{
|
|
|
|
//console.log("PUSH");
|
|
$scope.selectedStudentsID.push(sid);
|
|
$rootScope.selectedStudentcertificateMN.push(smn);
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
//console.log("POP");
|
|
$scope.selectedStudentsID.splice(pos,1);
|
|
$rootScope.selectedStudentcertificateMN.splice(pos,1);
|
|
}
|
|
//
|
|
if(val){
|
|
$scope.disable = false;
|
|
}else{
|
|
$scope.disable = true;
|
|
}
|
|
//console.log($scope.selectedStudentsID);
|
|
}
|
|
$scope.sendingsms = function(){
|
|
|
|
|
|
//$rootScope.student = $scope.selectedStudentsID;
|
|
if($scope.selectedStudentcertificateMN ==''){
|
|
swal('Select Check box','','warning');
|
|
return false;
|
|
}
|
|
else{
|
|
|
|
$state.go('app.broadCast.sendSMSPage');
|
|
|
|
|
|
}
|
|
}
|
|
$scope.calltracking = function(){
|
|
|
|
//$rootScope.student = $scope.selectedStudentsID;
|
|
if($scope.selectedStudentsID ==''){
|
|
swal('Select Check box','','warning');
|
|
return false;
|
|
}else{
|
|
$scope.controller = 'ng-controller="report_certificateCtrl"';
|
|
$scope.myModel.comments = 'Call Tracking for Document Report';
|
|
var lead = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getTrackingLeadDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
requestedBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID,
|
|
student:$scope.selectedStudentsID,
|
|
branchID:JSON.parse(sessionStorage.getItem('localObj')).localBranchID,
|
|
userType:JSON.parse(sessionStorage.getItem('localObj')).localType,
|
|
}
|
|
};
|
|
$http(lead).then(function (response) {
|
|
if (response.data.status==200) {
|
|
$rootScope.activity = response.data.activityDetails;
|
|
$rootScope.status = response.data.statusDetails;
|
|
$rootScope.staffDetails = response.data.staffDetails;
|
|
$rootScope.studentDetails = $scope.selectedStudentsID;
|
|
// $scope.modalopen($scope.activity);
|
|
$rootScope.modalInstance = $modal.open({
|
|
templateUrl: 'assets/views/autoCalltracking.html',
|
|
controller: 'report_certificateCtrl',
|
|
// size: size,
|
|
|
|
resolve: {
|
|
pdfitems: function () {
|
|
return $scope.activity;
|
|
|
|
}
|
|
}
|
|
});
|
|
|
|
$rootScope.modalInstance.result.then(function (selectedItem) {
|
|
$scope.selected = selectedItem;
|
|
}, function () {
|
|
$log.info('Modal dismissed at: ' + new Date());
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
}
|
|
}
|
|
|
|
$scope.trackForm = {
|
|
submit: function (form, myModel,loading,selectedStudents) {
|
|
//console.log(selectedStudents);
|
|
var comments = [];
|
|
for(var stuid=0;stuid<=selectedStudents.length-1;stuid++){
|
|
comments [stuid] ="Call Tracking For Report Certificate Status - DocumentName:"+selectedStudents[stuid].certname + " - Status:" +selectedStudents[stuid].status + " - Date:" +selectedStudents[stuid].adate;
|
|
}
|
|
if(isNaN(myModel.date)){
|
|
$scope.nextFollowupDate = myModel.date;
|
|
|
|
}
|
|
else{
|
|
$scope.getdate=new Date(myModel.date).toDateString();
|
|
|
|
$scope.nextFollowupDate = $filter('date')(new Date($scope.getdate), 'dd-MM-yyyy');
|
|
}
|
|
|
|
var firstError = null;
|
|
if (form.$invalid) {
|
|
console.log('field',field);
|
|
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("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
|
} else {
|
|
|
|
$scope.ldloading1 = {};
|
|
|
|
$scope.ldloading1[loading.replace('-', '_')] = true;
|
|
/* hide this fun after branch level changes
|
|
if($scope.userType !='R004'){
|
|
$scope.updateBranchID = JSON.parse(sessionStorage.getItem('localObj')).localBranchID;
|
|
$scope.updateAssignTo = myModel.assignedTo;
|
|
|
|
}
|
|
else{
|
|
$scope.updateBranchID = myModel.branch.BranchCode;
|
|
$scope.updateAssignTo = myModel.assignedTo;
|
|
|
|
}*/
|
|
|
|
var addLead = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'autoAddlead/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
student:selectedStudents,
|
|
date: $scope.nextFollowupDate,
|
|
activity: myModel.activity.activityID,
|
|
assignedTo: myModel.assignedTo,
|
|
status: myModel.status,
|
|
referedBy: myModel.referedBy,
|
|
comments:comments,
|
|
|
|
enquiryStatus:myModel.enquiryStatus,
|
|
createdBy: JSON.parse(sessionStorage.getItem('localObj')).localUserID,
|
|
branchId: JSON.parse(sessionStorage.getItem('localObj')).localBranchID
|
|
|
|
}
|
|
};
|
|
$http(addLead).then(function (response) {
|
|
if (response.data.status==200 && response.data.leadDetails.leadStatus == true) {
|
|
$rootScope.modalInstance.close();
|
|
swal(" ", response.data.leadDetails.message, "success");
|
|
$state.go($state.current, {}, { reload: true });
|
|
} else {
|
|
|
|
swal(" ", response.data.leadDetails.message, "error");
|
|
}
|
|
});
|
|
|
|
|
|
}
|
|
},
|
|
reset: function (form) {
|
|
|
|
$scope.myModel = angular.copy($scope.master);
|
|
form.$setPristine(true);
|
|
$scope.myModel = {
|
|
"studentName": "",
|
|
"mobileNumber": "",
|
|
"universityName": "",
|
|
"courseName": "",
|
|
"activity": "",
|
|
"assignedTo": "",
|
|
"status": "",
|
|
"referedBy": '',
|
|
"comments":''
|
|
};
|
|
}
|
|
};
|
|
|
|
|
|
/**
|
|
* Call Tracking End
|
|
*/
|
|
|
|
}]);
|
|
|
|
/*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.userType=JSON.parse(sessionStorage.getItem('localObj')).localType;
|
|
|
|
// $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.Phone_number,
|
|
requestedFrom: 3,
|
|
branchCode:JSON.parse(sessionStorage.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,filterby) {
|
|
if(type == '1' || type == '2'){ var result = values;}
|
|
if(type == '3' || type == '5' || type == '7' || type == '8'){
|
|
var result = [];
|
|
for (var i = 0; i < values.length; i++)
|
|
{
|
|
if (values[i].Sem === filterby)
|
|
{
|
|
result.push(values[i]);
|
|
}
|
|
}
|
|
}
|
|
if(type == '4'){
|
|
var result = [];
|
|
for (var i = 0; i < values.length; i++)
|
|
{
|
|
if (values[i].Sem_Year === filterby)
|
|
{
|
|
result.push(values[i]);
|
|
}
|
|
}
|
|
}
|
|
if(type == '6'){
|
|
var result = [];
|
|
for (var i = 0; i < values.length; i++)
|
|
{
|
|
if (values[i].CertificateName === filterby)
|
|
{
|
|
result.push(values[i]);
|
|
}
|
|
}
|
|
}
|
|
|
|
var modalInstance1 = $modal.open({
|
|
templateUrl: 'assets/views/student/studentPaymentModal.html',
|
|
controller: 'ModalInstanceCtrl1',
|
|
// size: size,
|
|
resolve: {
|
|
items1: function () {
|
|
var myvalues =
|
|
{
|
|
"values":result,
|
|
"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");
|
|
});
|
|
}
|
|
|
|
|
|
}]);
|
|
|
|
// 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');
|
|
};
|
|
|
|
|
|
}]);
|
|
|
|
|
|
|