3987 lines
138 KiB
JavaScript
Executable File
3987 lines
138 KiB
JavaScript
Executable File
'use strict';
|
|
/**
|
|
* controllers for ng-table
|
|
* Simple table with sorting and filtering on AngularJS
|
|
*/
|
|
|
|
app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$http", "API_POINTS", "$sessionStorage" , "$state", '$rootScope', '$cookies', 'md5', 'ipCookie', '$timeout', '$window', "flowFactory", "$interval", 'SweetAlert', function ($scope, toaster, $filter, ngTableParams, $http, apiPoint, $sessionStorage, $state, $rootScope, $cookies, md5, ipCookie, $timeout, $window, flowFactory, $interval, SweetAlert) {
|
|
$scope.userType=JSON.parse(sessionStorage.getItem('localObj')).localType;
|
|
/**
|
|
* student details capture
|
|
* by : kdk
|
|
*/
|
|
|
|
// Inactive Branch Check
|
|
$scope.inActiveBranchStatus = false;
|
|
$scope.addStudentView = function () {
|
|
// check the local branch is active for add a new student for this branch
|
|
var checkBranchActiveForStuAdd = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getBranchActiveStatusforStuAdd/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: localDetails
|
|
}
|
|
};
|
|
$http(checkBranchActiveForStuAdd).then(function (response) {
|
|
if (response.data) {
|
|
var checkStatus = response.data.branch_active_status;
|
|
if (checkStatus == "0") {
|
|
$scope.inActiveBranchStatus = true;
|
|
swal(" ", "Cannot create a new Student for In-Active Branch", "warning");
|
|
} else {
|
|
$scope.inActiveBranchStatus = false;
|
|
}
|
|
} else {
|
|
}
|
|
});
|
|
}
|
|
|
|
// 2017-11-23T00:00:00+0530
|
|
// 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
|
|
}
|
|
|
|
// get local client details
|
|
var localDetail = JSON.parse(sessionStorage.getItem('localObj'));
|
|
var localDetails = ipCookie('cookiechk');
|
|
|
|
// load when html page load
|
|
$scope.init = function () {
|
|
|
|
// alert('dsc');
|
|
var logcheck = JSON.parse(sessionStorage.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.sessionStorage.clear();
|
|
$state.go('login.signin');
|
|
}
|
|
}
|
|
|
|
|
|
var allcourse = {
|
|
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getCourse/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: localDetails
|
|
}
|
|
|
|
};
|
|
|
|
$http(allcourse).then(function (response) {
|
|
if (response.data.details) {
|
|
$scope.allcourselist = response.data.details;
|
|
// console.log($scope.allcourselist)
|
|
} else {
|
|
$scope.employeeList = '';
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.localUserType = localDetails.localType;
|
|
$scope.todayDate = new Date();
|
|
var nowInMS = new Date().getTime(),
|
|
sixteenYearsInMS = 1000 * 60 * 60 * 24 * 365 * 16,
|
|
sixteenYearsBeforeNow = new Date(nowInMS - sixteenYearsInMS);
|
|
if (localDetail != null) {
|
|
if (localDetails.localType === 'R003' || localDetails.localType === 'R002' || localDetails.localType === 'R005') {
|
|
// $scope.currentDate = new Date(sixteenYearsBeforeNow);
|
|
$scope.currentDate = new Date();
|
|
$scope.getStudentList();
|
|
$scope.getUniversityList();
|
|
$scope.getUniversitySearchList();
|
|
$scope.getEmployeeList();
|
|
$scope.myModelCourseAdd.dateofjoining = $filter('date')($scope.currentDate, 'dd-MM-yyyy');
|
|
$scope.myModelCourse.dateofjoining = $filter('date')($scope.currentDate, 'dd-MM-yyyy');
|
|
} else {
|
|
ipCookie.remove('cookiechk');
|
|
$window.sessionStorage.clear();
|
|
$state.go('login.signin');
|
|
}
|
|
} else {
|
|
}
|
|
}
|
|
|
|
$scope.employeeList = '';
|
|
$scope.getEmployeeList = function() {
|
|
var getEmpListBranch = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getEmployeeDetailsBranch/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: localDetails
|
|
}
|
|
};
|
|
$http(getEmpListBranch).then(function (response) {
|
|
if (response.data.employeeList) {
|
|
$scope.employeeList = response.data.employees_details;
|
|
} else {
|
|
$scope.employeeList = '';
|
|
}
|
|
});
|
|
}
|
|
|
|
// get University List
|
|
$scope.universitySearchData = '';
|
|
$scope.getUniversitySearchList = function () {
|
|
var empListreq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getUniveCourseBratch/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: localDetails
|
|
}
|
|
};
|
|
$http(empListreq).then(function (response) {
|
|
if (response.data.univList) {
|
|
$scope.universitySearchData = response.data.university_details;
|
|
// alert()
|
|
} else {
|
|
}
|
|
});
|
|
};
|
|
|
|
$scope.searchData = {
|
|
"University": "",
|
|
"Course": "",
|
|
"Status": ""
|
|
}
|
|
$scope.myUnivSearch = "";
|
|
|
|
$scope.coursedropdownstatus = true;
|
|
|
|
$scope.batchlengh='0';
|
|
|
|
$scope.visiblecheck='0';
|
|
$scope.getUniveId = function (univ) {
|
|
|
|
//alert('1')
|
|
$scope.coursedropdownstatus = false;
|
|
|
|
$scope.visiblecheck='1';
|
|
|
|
if (univ === '') {
|
|
$scope.myUnivSearch = "";
|
|
$scope.searchData.University = '';
|
|
$scope.searchData.Course = '';
|
|
$scope.searchData.Batch = '';
|
|
$scope.courseData = name.Course;
|
|
$scope.batchData = name.Batch;
|
|
$scope.OpenWindowStatus = false;
|
|
$scope.getStudentList();
|
|
} else {
|
|
let name = JSON.parse(univ);
|
|
$scope.searchData.University = name.UniversityID;
|
|
$scope.searchData.Course = '';
|
|
$scope.searchData.Batch = '';
|
|
$scope.courseData = name.Course;
|
|
$scope.batchData = name.Batch;
|
|
$scope.OpenWindowStatus = false;
|
|
$scope.getStudentList();
|
|
}
|
|
|
|
|
|
|
|
|
|
// if($scope.courseData.length >0)
|
|
// {
|
|
// $scope.batchlengh='1';
|
|
// }
|
|
|
|
};
|
|
|
|
|
|
$scope.getValueChange = function () {
|
|
// $scope.searchData = {
|
|
// "University": "",
|
|
// "Course": "",
|
|
// "Status": ""
|
|
// }
|
|
$scope.getStudentList();
|
|
}
|
|
$scope.studentListLength = 0;
|
|
$scope.getStudentList = function () {
|
|
$scope.loader = true;
|
|
|
|
//alert('in')
|
|
|
|
//console.log($scope.courseData.length);
|
|
//console.log($scope.searchData);
|
|
var empListreq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getStudentList/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: localDetails,
|
|
search: $scope.searchData
|
|
}
|
|
};
|
|
$http(empListreq).then(function (response) {
|
|
if (response.data.studentList) {
|
|
$scope.loader = false;
|
|
$scope.studentData = true;
|
|
$scope.data = response.data.student_details;
|
|
$scope.studentListLength = $scope.data.length;
|
|
} else {
|
|
$scope.loader = false;
|
|
$scope.studentData = false;
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
//======================================= Student Entrollment =======================================================
|
|
$scope.myModel = {
|
|
'primaryPhone': '',
|
|
'firstname': '',
|
|
'lastname': '',
|
|
'fathername': '',
|
|
'mothername': '',
|
|
'emailId': '',
|
|
'secondaryPhone': '',
|
|
'dateofbirth': '',
|
|
'gender': '',
|
|
'aadharNumber': '',
|
|
'otherId': '',
|
|
'otherIdDetails': '',
|
|
'address1': '',
|
|
'address2': '',
|
|
'caste': '',
|
|
'category': '',
|
|
'religion': '',
|
|
'nationality': '',
|
|
'prequalification': '',
|
|
'occupation': '',
|
|
'designation': '',
|
|
'companyname': '',
|
|
'referredby': '',
|
|
'referredmobilenumber': '',
|
|
'switchsetting': true,
|
|
'DeactiveComments': '',
|
|
'Comments': '',
|
|
'admittedBy': ''
|
|
};
|
|
|
|
$scope.myModelCourse = {
|
|
'university': '',
|
|
'course': '',
|
|
'batch': '',
|
|
'dateofjoining': '',
|
|
'enrollmentid': '',
|
|
'specilization1': '',
|
|
'specilization2': ''
|
|
};
|
|
|
|
$scope.myModelCourseAdd = {
|
|
'university': '',
|
|
'course': '',
|
|
'batch': '',
|
|
'dateofjoining': '',
|
|
'enrollmentid': '',
|
|
'specilization1': '',
|
|
'specilization2': ''
|
|
};
|
|
|
|
//=======================================================================>
|
|
/*
|
|
* Existing Student Entroll Course Details
|
|
*
|
|
*/
|
|
|
|
$scope.existingStudentView = false;
|
|
$scope.existingStudentId = '';
|
|
// check mobile number existing
|
|
$scope.checkMobileExist = function () {
|
|
var checkReq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'chkStudentExistDetail/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: $scope.myModel.primaryPhone,
|
|
check: 'mobileNumber'
|
|
}
|
|
};
|
|
$http(checkReq).then(function (response) {
|
|
if (response.data.existMobile == true) {
|
|
if (response.data.details.type === 'R001') {
|
|
$scope.myModel.primaryPhone = '';
|
|
SweetAlert.swal({
|
|
title: "Warning!",
|
|
text: "Student exist with this same number." + "\n Do you want to enroll new course!",
|
|
type: "warning",
|
|
showCancelButton: true,
|
|
confirmButtonColor: "#007aff",
|
|
confirmButtonText: "Yes!"
|
|
}, function (res) {
|
|
if (res === true) {
|
|
$scope.existingStudentView = true;
|
|
$scope.existingStudentId = response.data.details.studentId;
|
|
}
|
|
});
|
|
|
|
} else if (response.data.details.type === 'R002' || response.data.details.type === 'R003') {
|
|
swal("Warning!", response.data.message, "warning");
|
|
$scope.myModel.primaryPhone = '';
|
|
} else {
|
|
swal("Warning!", response.data.message, "warning");
|
|
$scope.myModel.primaryPhone = '';
|
|
}
|
|
} else {
|
|
}
|
|
});
|
|
}
|
|
|
|
$scope.stuExistingDetailsShowLoading = false;
|
|
|
|
$scope.getExistStudentDetails = function () {
|
|
// alert($scope.existingStudentId);
|
|
$scope.stuExistingDetailsShowLoading = true;
|
|
var checkExisReq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getExistingStudentDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: $scope.existingStudentId,
|
|
reqDetails: localDetails
|
|
}
|
|
};
|
|
$http(checkExisReq).then(function (response) {
|
|
if (response.data.existingStudentDetailsStatus == true) {
|
|
$scope.existingStuPersonalDetails = response.data.personalDetails[0];
|
|
$scope.existingStuCourseDetails = response.data.courseDetails;
|
|
$scope.stuExistingDetailsShowLoading = false;
|
|
} else {
|
|
$scope.stuExistingDetailsShowLoading = false;
|
|
}
|
|
});
|
|
}
|
|
|
|
$scope.cancelExisStudentView = function () {
|
|
$scope.existingStudentView = false;
|
|
}
|
|
|
|
$scope.existStuCourseDetailsCheck = function (myModelCourseObjExitStu) {
|
|
$scope.myModelCourse.course = myModelCourseObjExitStu.selected.CourseID;
|
|
$scope.myModelCourse.specilization1 = myModelCourseObjExitStu.selected.Specilization1;
|
|
$scope.myModelCourse.specilization2 = myModelCourseObjExitStu.selected.Specilization2;
|
|
}
|
|
|
|
$scope.getDOJchangesOnExistingStudentView = function () {
|
|
// alert();
|
|
try {
|
|
var formate = "dd-MM-yyyy";
|
|
$scope.myModelCourse.dateofjoining = $filter('date')(new Date($scope.myModelCourse.dateofjoining), formate);
|
|
}
|
|
catch(e) {
|
|
}
|
|
}
|
|
|
|
|
|
// add student course for existing student
|
|
$scope.addCourseExistingStudent = {
|
|
submit: function (form, myModelCourse, p) {
|
|
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();
|
|
} else {
|
|
var formate = "dd-MM-yyyy";
|
|
// $scope.myModelCourse.dateofjoining = $filter('date')(new Date($scope.myModelCourse.dateofjoining), formate);
|
|
var req = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'insertStudentCourse/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
addStudent: p.StudentID,
|
|
coursedata: $scope.myModelCourse,
|
|
loginBranch: localDetails.localBranchID,
|
|
createdBy: localDetails.localUserID,
|
|
}
|
|
};
|
|
$http(req).then(function (response) {
|
|
if (response.data.addStuCourseStatus == true) {
|
|
swal(" ", "Student course added successfully. ", "success");
|
|
$state.go($state.current, {}, { reload: true });
|
|
} else {
|
|
swal(" ", response.data.message, "error");
|
|
$scope.myModelCourse.dateofjoining = '';
|
|
}
|
|
});
|
|
}
|
|
},
|
|
cancel: function () {
|
|
$scope.myModelCourse = {
|
|
'university': '',
|
|
'course': '',
|
|
'batch': '',
|
|
'dateofjoining': '',
|
|
'enrollmentid': '',
|
|
'specilization1': '',
|
|
'specilization2': ''
|
|
};
|
|
}
|
|
|
|
}
|
|
//=====================================================================>
|
|
|
|
|
|
|
|
$scope.myModelCourseObjExitStu = {};
|
|
$scope.myModelCourseObjStu = {};
|
|
$scope.courseLoading = false;
|
|
$scope.onSlecetUniv = function () {
|
|
$scope.courseData = [];
|
|
$scope.batchData = '';
|
|
$scope.myModelCourse.course = '';
|
|
$scope.myModelCourse.batch = '';
|
|
$scope.myModelCourse.specilization1 = '';
|
|
$scope.myModelCourse.specilization2 = '';
|
|
$scope.myModelCourseObjExitStu.selected = undefined;
|
|
$scope.myModelCourseObjStu.selected = undefined;
|
|
$scope.courseLoading = true;
|
|
var univListreq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getCourseBatchForUniv/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: $scope.myModelCourse.university,
|
|
reqDetails: localDetails
|
|
}
|
|
};
|
|
$http(univListreq).then(function (response) {
|
|
if (response.data.courseStatus) {
|
|
$scope.courseLoading = false;
|
|
$scope.courseData = response.data.course_details;
|
|
$scope.batchData = response.data.batch_details;
|
|
} else {
|
|
$scope.courseLoading = false;
|
|
}
|
|
});
|
|
}
|
|
|
|
$scope.myModelCourseObj = {};
|
|
$scope.onSlecetUnivAdd = function () {
|
|
$scope.courseDataAdd = [];
|
|
$scope.batchDataAdd = '';
|
|
$scope.myModelCourseAdd.course = '';
|
|
$scope.myModelCourseAdd.batch = '';
|
|
$scope.myModelCourseAdd.specilization1 = '';
|
|
$scope.myModelCourseAdd.specilization2 = '';
|
|
$scope.myModelCourseObj.selected = undefined;
|
|
$scope.courseLoading = true;
|
|
var univListreq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getCourseBatchForUniv/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: $scope.myModelCourseAdd.university,
|
|
reqDetails: localDetails
|
|
}
|
|
};
|
|
$http(univListreq).then(function (response) {
|
|
if (response.data.courseStatus) {
|
|
$scope.courseLoading = false;
|
|
$scope.courseDataAdd = response.data.course_details;
|
|
$scope.batchDataAdd = response.data.batch_details;
|
|
} else {
|
|
$scope.courseLoading = false;
|
|
$scope.courseDataAdd = [];
|
|
}
|
|
});
|
|
}
|
|
|
|
$scope.courseChange = function (myModelCourseObj) {
|
|
// let myCourseDetails = myModelCourseObj.CourseID;
|
|
$scope.myModelCourseAdd.course = myModelCourseObj.selected.CourseID;
|
|
$scope.myModelCourseAdd.specilization1 = myModelCourseObj.selected.Specilization1;
|
|
$scope.myModelCourseAdd.specilization2 = myModelCourseObj.selected.Specilization2;
|
|
}
|
|
|
|
|
|
|
|
// check emailId existing
|
|
$scope.checkEmailExist = function () {
|
|
var checkReq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'chkStudentExistDetail/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: $scope.myModel.emailId,
|
|
check: 'emailId'
|
|
}
|
|
};
|
|
$http(checkReq).then(function (response) {
|
|
if (response.data.existEmailId == true) {
|
|
swal("Warning!", response.data.message, "warning");
|
|
$scope.myModel.emailId = '';
|
|
} else {
|
|
}
|
|
});
|
|
}
|
|
|
|
//-------------------------------------------------------------->
|
|
// getting for image to show
|
|
//-------------------------------------------------------------->
|
|
|
|
$scope.stepsModel = [];
|
|
$scope.imageUpload = function (event) {
|
|
var files = event.target.files; //FileList object
|
|
|
|
for (var i = 0; i < files.length; i++) {
|
|
var file = files[i];
|
|
var reader = new FileReader();
|
|
reader.onload = $scope.imageIsLoaded;
|
|
reader.readAsDataURL(file);
|
|
}
|
|
}
|
|
|
|
$scope.imageIsLoaded = function (e) {
|
|
$scope.$apply(function () {
|
|
// $scope.stepsModel.push(e.target.result);
|
|
$scope.stepsModel[0] = e.target.result;
|
|
});
|
|
}
|
|
|
|
//an array of files selected
|
|
$scope.files = [];
|
|
|
|
//listen for the file selected event
|
|
$scope.$on("fileSelected", function (event, args) {
|
|
$scope.$apply(function () {
|
|
//add the file object to the scope's files collection
|
|
$scope.files[0] = args.file;
|
|
});
|
|
});
|
|
|
|
// reset image
|
|
$scope.resetImage = function () {
|
|
$scope.files.length = 0;
|
|
$scope.stepsModel.length = 0;
|
|
}
|
|
|
|
$scope.getChangeDate = function () {
|
|
// alert();
|
|
try {
|
|
var formate = "dd-MM-yyyy";
|
|
$scope.myModelCourseAdd.dateofjoining = $filter('date')(new Date($scope.myModelCourseAdd.dateofjoining), formate);
|
|
// alert($scope.myModel.dateofbirth);
|
|
// var myDate = new Date($scope.myModel.dateofbirth);
|
|
// alert(myDate);
|
|
// if(typeof myDate === 'function') {
|
|
// alert("true")
|
|
// } else {
|
|
// alert("error")
|
|
// }
|
|
}
|
|
catch(e) {
|
|
// alert('error');
|
|
// alert(err);
|
|
}
|
|
}
|
|
|
|
// add student
|
|
$scope.studentFORM = {
|
|
submit: function (form, myModel, myModelCourseAdd) {
|
|
|
|
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("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
|
} else {
|
|
$scope.disableButton = true;
|
|
var formate = "dd-MM-yyyy";
|
|
$scope.myModel.dateofbirth = $filter('date')(new Date($scope.myModel.dateofbirth), formate);
|
|
$scope.myModel.switchsetting = $scope.myModel.switchsetting === true ? 1 : 0;
|
|
// $scope.myModelCourseAdd.dateofjoining = $filter('date')(new Date($scope.myModelCourseAdd.dateofjoining), formate);
|
|
var idStuProof = $scope.files[0];
|
|
// alert(JSON.stringify($scope.myModel));
|
|
if (idStuProof !== undefined) {
|
|
var formData = new FormData();
|
|
var idProof = $scope.files[0];
|
|
// alert(idProof);
|
|
formData.append("data", JSON.stringify($scope.myModel));
|
|
formData.append("coursedata", JSON.stringify($scope.myModelCourseAdd));
|
|
formData.append("createdBy", localDetails.localUserID);
|
|
formData.append("loginBranch", localDetails.localBranchID);
|
|
formData.append('idStuProof', idStuProof);
|
|
|
|
$http.post(apiPoint.url + 'insertStudentImg/', formData, {
|
|
transformRequest: angular.identity,
|
|
headers: { 'Content-Type': undefined, 'Process-Data': false },
|
|
}).success(function (data) {
|
|
if (data.addStudentStatus === true) {
|
|
swal(" ", "Student added successfully.", "success");
|
|
$scope.disableButton = false;
|
|
$state.go($state.current, {}, { reload: true });
|
|
} else {
|
|
// $scope.ldloading1[loading.replace('-', '_')] = false;
|
|
swal(" ", data.message, "error");
|
|
// $scope.disableButton = false;
|
|
}
|
|
});
|
|
} else {
|
|
var req = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'insertStudent/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: $scope.myModel,
|
|
coursedata: $scope.myModelCourseAdd,
|
|
loginBranch: localDetails.localBranchID,
|
|
createdBy: localDetails.localUserID,
|
|
}
|
|
};
|
|
$http(req).then(function (response) {
|
|
if (response.data.addStudentStatus === true) {
|
|
swal(" ", "Student added successfully.", "success");
|
|
$scope.disableButton = false;
|
|
$state.go($state.current, {}, { reload: true });
|
|
} else {
|
|
// $scope.disableButton = false;
|
|
swal(" ", response.data.message, "error");
|
|
}
|
|
});
|
|
}
|
|
}
|
|
},
|
|
reset: function (form) {
|
|
form.$setPristine(true);
|
|
$scope.myModel = {
|
|
'primaryPhone': '',
|
|
'firstname': '',
|
|
'lastname': '',
|
|
'fathername': '',
|
|
'mothername': '',
|
|
'emailId': '',
|
|
'secondaryPhone': '',
|
|
'dateofbirth': '',
|
|
'gender': '',
|
|
'aadharNumber': '',
|
|
'otherId': '',
|
|
'otherIdDetails': '',
|
|
'address1': '',
|
|
'address2': '',
|
|
'caste': '',
|
|
'category': '',
|
|
'religion': '',
|
|
'nationality': '',
|
|
'prequalification': '',
|
|
'occupation': '',
|
|
'designation': '',
|
|
'companyname': '',
|
|
'referredby': '',
|
|
'referredmobilenumber': '',
|
|
'switchsetting': true,
|
|
'DeactiveComments': '',
|
|
'Comments': '',
|
|
'admittedBy': ''
|
|
};
|
|
$scope.myModelCourseAdd = {
|
|
'university': '',
|
|
'course': '',
|
|
'batch': '',
|
|
'dateofjoining': '',
|
|
'enrollmentid': '',
|
|
'specilization1': '',
|
|
'specilization2': ''
|
|
};
|
|
}, resetCourse: function (form) {
|
|
form.$setPristine(true);
|
|
$scope.myModelCourse = {
|
|
'university': '',
|
|
'course': '',
|
|
'batch': '',
|
|
'dateofjoining': '',
|
|
'enrollmentid': '',
|
|
'specilization1': '',
|
|
'specilization2': ''
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
//======================================================================>
|
|
|
|
|
|
$scope.CopyModel={
|
|
|
|
'AadharNumber':'',
|
|
'AdmittedBy':'',
|
|
'AlternateNumber':'',
|
|
'BranchCode': '',
|
|
'Caste':'',
|
|
'Category':'',
|
|
'Comments': '',
|
|
'Companyname':'',
|
|
'CourseCode': '',
|
|
'CourseID':'',
|
|
'CourseName': '',
|
|
'CreatedBy': '',
|
|
'CreatedOn':'',
|
|
'DOB': '',
|
|
'DeactiveComments':'',
|
|
'Designation':'',
|
|
'EmailID':'',
|
|
'Fathername':'',
|
|
'Firstname':'',
|
|
'Gender': '',
|
|
'IsActive':'',
|
|
'Lastname': '',
|
|
'MobileNumber':'',
|
|
'MotherName': '',
|
|
'Nationality':'',
|
|
'Occupation':'',
|
|
'OtherID':'',
|
|
'OtherIDDetails':'',
|
|
'PermanentAddress':'',
|
|
'PreQualification':'',
|
|
'PresentAddress':'',
|
|
'ProfilePicPath':'',
|
|
'Qualification':'',
|
|
'ReferersMobileNumber':'',
|
|
'ReferredBy':'',
|
|
'Religion':'',
|
|
'StudentID':'',
|
|
'Student_Course_id':'',
|
|
'UniversityID':'',
|
|
'UniversityName':'',
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.editId = -1;
|
|
$scope.editCourseId = -1;
|
|
$scope.OldPhone='';
|
|
$scope.setEditId = function (unique_id, id,k) {
|
|
|
|
// alert()
|
|
|
|
|
|
$scope.CopyModel.Fathername=k.Fathername;
|
|
$scope.CopyModel.AadharNumber=k.AadharNumber;
|
|
$scope.CopyModel.AdmittedBy=k.AdmittedBy;
|
|
$scope.CopyModel.AlternateNumber = k.AlternateNumber;
|
|
$scope.CopyModel.Caste = k.Caste;
|
|
$scope.CopyModel.Category = k.Category;
|
|
$scope.CopyModel.Comments=k.Comments;
|
|
$scope.CopyModel.Companyname=k.Companyname;
|
|
$scope.CopyModel.CourseCode= k.CourseCode;
|
|
$scope.CopyModel.CourseID=k.CourseID;
|
|
$scope.CopyModel.CourseName=k.CourseName;
|
|
$scope.CopyModel.DOB = k.DOB;
|
|
$scope.CopyModel.DeactiveComments = k.DeactiveComments;
|
|
$scope.CopyModel.EmailID=k.EmailID;
|
|
$scope.CopyModel.Firstname=k.Firstname;
|
|
$scope.CopyModel.Gender=k.Gender;
|
|
$scope.CopyModel.IsActive=k.IsActive;
|
|
$scope.CopyModel.Lastname=k.Lastname;
|
|
$scope.CopyModel.MobileNumber=k.MobileNumber;
|
|
$scope.CopyModel.MotherName=k.MotherName;
|
|
$scope.CopyModel.Nationality=k.Nationality;
|
|
$scope.CopyModel.Occupation=k.Occupation;
|
|
$scope.CopyModel.OtherID=k.OtherID;
|
|
$scope.CopyModel.OtherIDDetails=k.OtherIDDetails;
|
|
$scope.CopyModel.PermanentAddress=k.PermanentAddress;
|
|
$scope.CopyModel.PreQualification=k.PreQualification;
|
|
$scope.CopyModel.PresentAddress=k.PresentAddress;
|
|
$scope.CopyModel.ReferersMobileNumber=k.ReferersMobileNumber;
|
|
$scope.CopyModel.ReferredBy=k.ReferredBy;
|
|
$scope.CopyModel.Religion=k.Religion;
|
|
$scope.CopyModel.StudentID=k.StudentID;
|
|
|
|
|
|
$scope.editId = unique_id;
|
|
$scope.editCourseId = -1;
|
|
$scope.studentViewPage = -1;
|
|
$scope.OldPhone=mobile;
|
|
|
|
$scope.OldPhone=k.MobileNumber;
|
|
|
|
|
|
|
|
}
|
|
|
|
$scope.PreviousPhoneDetails ='';
|
|
$scope.Changecheck = false;
|
|
$scope.getPhoneNoHistoy = function(studentId)
|
|
{
|
|
|
|
// alert('fn')
|
|
var getphonehistory = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'GetPhoneHistory/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
|
|
StudentID:studentId,
|
|
loginBranch: localDetails.localBranchID,
|
|
createdBy: localDetails.localUserID,
|
|
}
|
|
};
|
|
|
|
|
|
$http(getphonehistory).then(function (response)
|
|
{
|
|
|
|
//console.log(response.data)
|
|
if(response.data.stuidStatus == true)
|
|
{
|
|
$scope.PreviousPhoneDetails= response.data.Mobiledetails;
|
|
$scope.Changecheck= true;
|
|
}
|
|
else
|
|
{
|
|
$scope.PreviousPhoneDetails= '';
|
|
$scope.Changecheck= false;
|
|
}
|
|
|
|
console.log($scope.PreviousPhoneDetails)
|
|
});
|
|
}
|
|
|
|
|
|
|
|
$scope.setEditCourseId = function (unique_id,id) {
|
|
|
|
$scope.list = false;
|
|
$scope.getStudentCourseList(id);
|
|
$scope.currentStudentId = id;
|
|
$scope.editCourseId = unique_id;
|
|
$scope.editId = -1;
|
|
$scope.courseEditLoading = true;
|
|
$scope.courselist = true;
|
|
}
|
|
|
|
|
|
$scope.cancel = function () {
|
|
|
|
$scope.getStudentList();
|
|
$scope.editId = -1;
|
|
$scope.editCourseId = -1;
|
|
$scope.editTrackingId=-1;
|
|
}
|
|
|
|
$scope.cancelCourseDetails = function () {
|
|
$scope.getStudentCourseList($scope.currentStudentId);
|
|
// $scope.editId = -1;
|
|
// $scope.editCourseId = -1;
|
|
}
|
|
|
|
$scope.setEditTrackingId = function (uniqe_id,courseid,universityid,MobileNumber) {
|
|
|
|
$scope.getStudentTrackingDetails1(courseid,universityid,MobileNumber);
|
|
$scope.currentStudentId = MobileNumber;
|
|
// $scope.getStudentCourseDetails(id);
|
|
$scope.editTrackingId = uniqe_id;
|
|
$scope.editId = -1;
|
|
$scope.editCourseId=-1;
|
|
$scope.trackingEditLoading = true;
|
|
$scope.trackingdetails = true;
|
|
|
|
}
|
|
$scope.TrackingDetails = function (s) {
|
|
|
|
$rootScope.trackingid1=s.TrackingID;
|
|
console.log($rootScope.trackingid1+'student');
|
|
$state.go('app.call.trackingFollowup');
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$scope.cancelnotification = function()
|
|
{
|
|
$scope.msgdetID = '-1';
|
|
}
|
|
|
|
$scope.MailDetails='';
|
|
$scope.MessageDetails = '';
|
|
$scope.StudentIDDet = '';
|
|
$scope.msgdetID = -1;
|
|
$scope.setmessageId = function (student)
|
|
{
|
|
|
|
//console.log(student);return false;
|
|
|
|
var studentID= student.StudentID;
|
|
var phonenumber = student.MobileNumber;
|
|
var email = student.EmailID;
|
|
|
|
|
|
var sentnotification = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'Getnotificcations/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
|
|
StudentID: studentID,
|
|
Phone: phonenumber,
|
|
Email:email,
|
|
loginBranch: localDetails.localBranchID,
|
|
createdBy: localDetails.localUserID,
|
|
}
|
|
};
|
|
$http(sentnotification).then(function (response) {
|
|
|
|
if(response.data.status == 200)
|
|
{
|
|
$scope.MailDetails=response.data.maildetails;
|
|
$scope.MessageDetails = response.data.msgdetails;
|
|
$scope.StudentIDDet = response.data.StudentID;
|
|
$scope.msgdetID = $scope.StudentIDDet[0].StudentID;
|
|
|
|
// console.log($scope.MailDetails);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
$scope.getStudentTrackingDetails1 = function (courseid,universityid,MobileNumber)
|
|
{
|
|
|
|
$scope.trackingEditLoading = true;
|
|
$scope.list = true;
|
|
$scope.courseEdit = false;
|
|
$scope.courseAdd = false;
|
|
var req = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getStudentTrackingDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
MobileNumber: MobileNumber,
|
|
courseid:courseid,
|
|
universityid:universityid,
|
|
loginBranch: localDetails.localBranchID,
|
|
createdBy: localDetails.localUserID,
|
|
userType:JSON.parse(sessionStorage.getItem('localObj')).localType,
|
|
}
|
|
|
|
};
|
|
$http(req).then(function (response) {
|
|
|
|
if (response.data.status==200) {
|
|
|
|
$scope.trackingDetails =response.data.trackingdata;
|
|
$scope.trackingEditLoading = false;
|
|
// $scope.
|
|
console.log($scope.trackingDetails);
|
|
} else {
|
|
|
|
$scope.trackingdetails = false;
|
|
$scope.trackingEditLoading='';
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.addStudentCourse = function () {
|
|
$scope.myModelCourse = {
|
|
'university': '',
|
|
'course': '',
|
|
'batch': '',
|
|
'dateofjoining': '',
|
|
'enrollmentid': '',
|
|
'specilization1': '',
|
|
'specilization2': ''
|
|
};
|
|
$scope.currentDate = new Date();
|
|
$scope.myModelCourse.dateofjoining = $filter('date')($scope.currentDate, 'dd-MM-yyyy');
|
|
$scope.list = false;
|
|
$scope.courseEdit = false;
|
|
$scope.courseAdd = true;
|
|
}
|
|
|
|
$scope.addStudentCourseDetailsChanges = function (objCourseDetails) {
|
|
$scope.myModelCourse.course = objCourseDetails.selected.CourseID;
|
|
$scope.myModelCourse.specilization1 = objCourseDetails.selected.Specilization1;
|
|
$scope.myModelCourse.specilization2 = objCourseDetails.selected.Specilization2;
|
|
}
|
|
|
|
$scope.stuAddNewCourseDateChange = function () {
|
|
// alert();
|
|
try {
|
|
var formate = "dd-MM-yyyy";
|
|
$scope.myModelCourse.dateofjoining = $filter('date')(new Date($scope.myModelCourse.dateofjoining), formate);
|
|
|
|
}
|
|
catch(e) {
|
|
}
|
|
}
|
|
|
|
|
|
// add student course
|
|
$scope.addCourseFORM = {
|
|
|
|
submit: function (form, myModelCourse, p) {
|
|
// alert();
|
|
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("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
|
} else {
|
|
// alert(JSON.stringify(p.StudentID));
|
|
var formate = "dd-MM-yyyy";
|
|
// $scope.myModel.switchsetting = $scope.myModel.switchsetting === true ? 1 : 0;
|
|
// $scope.myModel.dateofbirth = $filter('date')(new Date($scope.myModel.dateofbirth), formate);
|
|
// $scope.myModelCourse.dateofjoining = $filter('date')(new Date($scope.myModelCourse.dateofjoining), formate);
|
|
var req = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'insertStudentCourse/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
addStudent: p.StudentID,
|
|
coursedata: $scope.myModelCourse,
|
|
loginBranch: localDetails.localBranchID,
|
|
createdBy: localDetails.localUserID,
|
|
}
|
|
};
|
|
$http(req).then(function (response) {
|
|
if (response.data.addStuCourseStatus == true) {
|
|
swal(" ", "Student course added successfully.", "success");
|
|
$scope.getStudentCourseList($scope.currentStudentId);
|
|
} else {
|
|
swal(" ", response.data.message, "error");
|
|
$scope.getStudentCourseList($scope.currentStudentId);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
// get Student Course List
|
|
$scope.getStudentCourseList = function (studentId) {
|
|
|
|
console.log('in')
|
|
$scope.courseEditLoading = true;
|
|
$scope.list = true;
|
|
$scope.courseEdit = false;
|
|
$scope.courseAdd = false;
|
|
var req = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getStudentCourseList/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
studentID: studentId,
|
|
updatedBy: localDetails,
|
|
}
|
|
};
|
|
$http(req).then(function (response) {
|
|
if (response.data.stuCourseDetails) {
|
|
$scope.courseEditLoading = false;
|
|
$scope.studentCourseList = response.data.course_details;
|
|
// $scope.stucour = $scope.studentCourse[0];
|
|
} else {
|
|
$scope.courselist = false;
|
|
$scope.courseEditLoading='';
|
|
}
|
|
});
|
|
}
|
|
|
|
// get student particular course details : params : studentCourseID
|
|
$scope.getStudentCourseDetails = function (studentcourseID) {
|
|
$scope.courseEditLoading = true;
|
|
$scope.stucour = '';
|
|
$scope.list = false;
|
|
$scope.courseAdd = false;
|
|
$scope.courseEdit = true;
|
|
var req = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getStudentCourseDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
studentcourseId: studentcourseID
|
|
}
|
|
};
|
|
$http(req).then(function (response) {
|
|
if (response.data.stuCourseDetails) {
|
|
$scope.courseEditLoading = false;
|
|
$scope.studentCourse = response.data.course_details;
|
|
$scope.stucour = $scope.studentCourse[0];
|
|
} else {
|
|
}
|
|
});
|
|
}
|
|
|
|
// update sutdent course details
|
|
$scope.updateStudentCourseDetails = function (form, datas, hidedoj) {
|
|
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("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
|
} else {
|
|
// alert(datas.DOJ);
|
|
var formate = "dd-MM-yyyy";
|
|
var checkDOJ = $filter('date')(new Date(datas.DOJ), formate);
|
|
datas.IsActive = datas.IsActive === true ? 1 : 0;
|
|
datas.DOJ = datas.DOJ == hidedoj ? datas.DOJ : $filter('date')(new Date(datas.DOJ), formate);
|
|
// alert(datas.DOJ);
|
|
var req = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'updateStudentCourseDetail/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: datas,
|
|
updatedBy: localDetails.localUserID,
|
|
}
|
|
};
|
|
$http(req).then(function (response) {
|
|
if (response.data.updateStuCourseStatus) {
|
|
swal(" ", "Updated successfully.", "success");
|
|
$scope.getStudentCourseList($scope.currentStudentId);
|
|
// $scope.editCourseId = false;
|
|
} else {
|
|
// $scope.ldloading1[loading.replace('-', '_')] = false;
|
|
swal(" ", response.data.message, "error");
|
|
$scope.getStudentCourseList($scope.currentStudentId);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
$scope.universityData = '';
|
|
$scope.getUniversityList = function () {
|
|
var empListreq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getStudentUniversity/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: localDetails
|
|
}
|
|
};
|
|
$http(empListreq).then(function (response) {
|
|
if (response.data.univList) {
|
|
$scope.universityData = response.data.university_details;
|
|
} else {
|
|
}
|
|
});
|
|
}
|
|
|
|
$scope.stuCourseEditDetailsObj = {};
|
|
$scope.onSlecetUnivEdit = function (univid, coursid) {
|
|
let UniversityId = univid;
|
|
$scope.onSlecetUnivEditCourse(UniversityId, coursid);
|
|
}
|
|
|
|
$scope.onChangeSlecetUnivEdit = function (univid) {
|
|
let UniversityId = univid;
|
|
$scope.onSlecetUnivEditCourse(UniversityId);
|
|
$scope.stucour.CourseID = '';
|
|
$scope.stucour.BatchCode = '';
|
|
$scope.stucour.Specilization1 = '';
|
|
$scope.stucour.Specilization2 = '';
|
|
}
|
|
|
|
$scope.courseLoading = false;
|
|
$scope.onSlecetUnivEditCourse = function (UniversityId, CourseId = null) {
|
|
$scope.courseDataEditScrn = [];
|
|
// Object.keys($scope.stuCourseEditDetailsObj).length = 0;
|
|
$scope.stuCourseEditDetailsObj.selected = undefined;
|
|
// alert(JSON.stringify($scope.stuCourseEditDetailsObj));
|
|
$scope.courseLoading = true;
|
|
var univListreq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getCourseBatchForUniv/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: UniversityId,
|
|
reqDetails: localDetails
|
|
}
|
|
};
|
|
$http(univListreq).then(function (response) {
|
|
if (response.data.courseStatus) {
|
|
$scope.courseLoading = false;
|
|
$scope.courseDataEditScrn = response.data.course_details;
|
|
if (CourseId !== null) {
|
|
let courseData = $scope.courseDataEditScrn;
|
|
let details = courseData.filter(x => x.CourseID === CourseId);
|
|
$scope.stuCourseEditDetailsObj.selected = details[0];
|
|
} else {
|
|
$scope.stuCourseEditDetailsObj.selected = undefined;
|
|
}
|
|
} else {
|
|
$scope.courseLoading = false;
|
|
}
|
|
});
|
|
}
|
|
|
|
$scope.editStudentCourseDetailsChanges = function (obj) {
|
|
let stuCourseEditDetailsObj = obj.selected;
|
|
$scope.stucour.CourseID = stuCourseEditDetailsObj.CourseID;
|
|
$scope.stucour.Specilization1 = stuCourseEditDetailsObj.Specilization1;
|
|
$scope.stucour.Specilization2 = stuCourseEditDetailsObj.Specilization2;
|
|
}
|
|
|
|
// $scope.getStudentCourseEditObj = function() {
|
|
// let studentCourseData = $scope.courseData;
|
|
// alert(JSON.stringify(studentCourseData));
|
|
// }
|
|
// update check mobile exist
|
|
$scope.updateCheckMobileExist = function (p) {
|
|
var checkReq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'chkUpdateStuExistDetail/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
exceptId: p.StudentID,
|
|
datas: p.MobileNumber,
|
|
check: 'mobileNumber'
|
|
}
|
|
};
|
|
$http(checkReq).then(function (response) {
|
|
if (response.data.existMobile == true) {
|
|
swal("Warning!", response.data.message, "warning");
|
|
p.MobileNumber = response.data.resetValue.MobileNumber;
|
|
} else {
|
|
}
|
|
});
|
|
}
|
|
|
|
// update check email id exist
|
|
$scope.updateCheckEmailExist = function (p) {
|
|
var checkReq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'chkUpdateStuExistDetail/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
exceptId: p.StudentID,
|
|
datas: p.EmailID,
|
|
check: 'emailId'
|
|
}
|
|
};
|
|
$http(checkReq).then(function (response) {
|
|
if (response.data.existEmailId == true) {
|
|
swal("Warning!", response.data.message, "warning");
|
|
p.EmailID = response.data.resetValue.EmailID;
|
|
} else {
|
|
}
|
|
});
|
|
}
|
|
|
|
// start : entrollment document upload =============================
|
|
$scope.studentDocumentsList = '';
|
|
// get Student Document Details
|
|
$scope.getStuEntrollDocDetails = function (stuId) {
|
|
// $scope.studentDocumentsList = '';
|
|
var getStudentDocDetails = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getListofStuDocDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
exceptId: stuId,
|
|
localData: localDetail
|
|
}
|
|
};
|
|
$http(getStudentDocDetails).then(function (response) {
|
|
if (response.data.docListStatus == true) {
|
|
$scope.docNotFound = false;
|
|
$scope.studentDocumentsList = response.data.student_doc_details;
|
|
} else {
|
|
$scope.docNotFound = true;
|
|
$scope.studentDocumentsList.call();
|
|
}
|
|
});
|
|
}
|
|
|
|
$scope.deleteDocDetails = function (id, stuID) {
|
|
SweetAlert.swal({
|
|
title: "Warning!",
|
|
text: "Want to Delete this file ?",
|
|
type: "warning",
|
|
showCancelButton: true,
|
|
confirmButtonColor: "#007aff",
|
|
confirmButtonText: "Yes!"
|
|
}, function (res) {
|
|
if (res === true) {
|
|
// alert(id);
|
|
// alert(stuId);
|
|
$scope.documentAddDetailsLoading = true;
|
|
var deleteDocEntry = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'deleteStuDocDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
exceptId: stuID,
|
|
docDetailsID: id,
|
|
localData: localDetail
|
|
}
|
|
};
|
|
$http(deleteDocEntry).then(function (response) {
|
|
if (response.data.deleteStatus == true) {
|
|
// swal("Success!", response.data.message, "success");
|
|
$scope.documentAddDetailsLoading = false;
|
|
$scope.studentDocumentsList = '';
|
|
$scope.getStuEntrollDocDetails(stuID);
|
|
} else {
|
|
swal(" ", res.data.message, "error");
|
|
$scope.documentAddDetailsLoading = false;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
$scope.myModelAddDocuments = {
|
|
"documentName": "",
|
|
"documentComments": ""
|
|
}
|
|
|
|
//an array of documents selected
|
|
$scope.filesDocuments = [];
|
|
//listen for the document selected event
|
|
$scope.$on("fileSelectedDocument", function (event, args) {
|
|
$scope.$apply(function () {
|
|
//add the file object to the scope's files collection
|
|
$scope.filesDocuments[0] = args.file;
|
|
});
|
|
});
|
|
|
|
$scope.documentAddDetailsLoading = false;
|
|
$scope.studentEntrollDocFORM = {
|
|
submit: function (form, myModelAddDocuments, stuID) {
|
|
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("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
|
} else {
|
|
if ($scope.filesDocuments[0] == undefined || $scope.filesDocuments[0] == null || $scope.filesDocuments.length === 0) {
|
|
swal("Warning!", "Choose the File.", "warning");
|
|
} else {
|
|
$scope.documentAddDetailsLoading = true;
|
|
var formData = new FormData();
|
|
var stuDocProof = $scope.filesDocuments[0];
|
|
var stuDocProofStatus = $scope.filesDocuments[0] !== undefined ? true : false;
|
|
|
|
formData.append("data", JSON.stringify(myModelAddDocuments));
|
|
formData.append("studentID", stuID);
|
|
formData.append("updatedBy", localDetails.localUserID);
|
|
formData.append('stuDocProof', stuDocProof);
|
|
formData.append('stuDocProof_Status', stuDocProofStatus);
|
|
|
|
$http.post(apiPoint.url + 'addStudentEntrollDocDetails/', formData, {
|
|
transformRequest: angular.identity,
|
|
headers: { 'Content-Type': undefined, 'Process-Data': false },
|
|
}).success(function (res) {
|
|
if (res.stuDocUpdateStatus == true) {
|
|
$scope.getStuEntrollDocDetails(stuID);
|
|
// swal(" ", "Updated successfully.", "success");
|
|
$scope.documentAddDetailsLoading = false;
|
|
$scope.filesDocuments[0] = undefined;
|
|
form.$setPristine(true);
|
|
angular.element("input[type='file']").val(null);
|
|
$scope.myModelAddDocuments = {
|
|
"documentName": "",
|
|
"documentComments": ""
|
|
}
|
|
// $scope.getStudentList();
|
|
// $scope.editId = -1;
|
|
// $scope.editSaveButtonDisable = false;
|
|
} else {
|
|
swal(" ", res.data.message, "error");
|
|
$scope.documentAddDetailsLoading = false;
|
|
// $scope.editSaveButtonDisable = false;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
},
|
|
reset: function (form) {
|
|
$scope.filesDocuments[0] = undefined;
|
|
form.$setPristine(true);
|
|
angular.element("input[type='file']").val(null);
|
|
}
|
|
}
|
|
|
|
// $scope.PendingDocNotFound = false;
|
|
// student pending document details
|
|
$scope.getStudentPendingEntrolDocDetails = function (stuId) {
|
|
// $scope.studentDocumentsList = '';
|
|
var getStudentPendingDocDetails = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getListofStuPendingDocDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
exceptId: stuId,
|
|
localData: localDetail
|
|
}
|
|
};
|
|
$http(getStudentPendingDocDetails).then(function (response) {
|
|
if (response.data.PendingDocListStatus == true) {
|
|
// $scope.PendingDocNotFound = false;
|
|
$scope.studentPendingDocumentsDetails = response.data.student_pending_doc_details;
|
|
} else {
|
|
// $scope.PendingDocNotFound = true;
|
|
}
|
|
});
|
|
}
|
|
|
|
$scope.myModelAddPendingDocDetails = {
|
|
"documentDetails": "",
|
|
"documentdate":"",
|
|
"course":"",
|
|
"checkTracking": false
|
|
}
|
|
$scope.documentTrackAddDetailsLoading = false;
|
|
|
|
$scope.studentEntrollPendingDocFORM = {
|
|
submit: function (form, myModelAddPendingDocDetails, stuID) {
|
|
|
|
|
|
// alert('in');
|
|
// return false;
|
|
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("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
|
} else {
|
|
$scope.documentTrackAddDetailsLoading = true;
|
|
$scope.docFollowupDate = new Date(myModelAddPendingDocDetails.documentDate).toDateString();
|
|
|
|
var ModelDetails = {
|
|
"student": stuID,
|
|
"doc_Details": myModelAddPendingDocDetails.documentDetails,
|
|
"checkTracking": myModelAddPendingDocDetails.checkTracking,
|
|
"CourseID":myModelAddPendingDocDetails.course,
|
|
"documentdate": $filter('date')(new Date($scope.docFollowupDate),'dd-MM-yyyy')
|
|
};
|
|
var updateStudentPendingDocDetails = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'addStudentEnrollPendingDocDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
updateDetails: ModelDetails,
|
|
localData: localDetail
|
|
}
|
|
};
|
|
$http(updateStudentPendingDocDetails).then(function (response) {
|
|
if (response.data.AddStuPendingDocStatus == true) {
|
|
$scope.getStudentPendingEntrolDocDetails(stuID);
|
|
$scope.documentTrackAddDetailsLoading = false;
|
|
$scope.myModelAddPendingDocDetails = {
|
|
"documentDetails": "",
|
|
"course":"",
|
|
"checkTracking": false
|
|
}
|
|
form.$setPristine(true);
|
|
} else {
|
|
swal(" ", res.data.message, "error");
|
|
$scope.documentTrackAddDetailsLoading = false;
|
|
}
|
|
});
|
|
}
|
|
},
|
|
reset: function (form) {
|
|
|
|
// alert('reset')
|
|
// return false;
|
|
$scope.myModelAddPendingDocDetails = {
|
|
"documentDetails": "",
|
|
"course":"",
|
|
"checkTracking": false
|
|
}
|
|
}
|
|
}
|
|
|
|
$scope.deletePendingDocDetails = function (details, StuID, Url) {
|
|
// alert(JSON.stringify(details));
|
|
SweetAlert.swal({
|
|
title: "Warning!",
|
|
text: "Want to Delete this Entry ?",
|
|
type: "warning",
|
|
showCancelButton: true,
|
|
confirmButtonColor: "#007aff",
|
|
confirmButtonText: "Yes!"
|
|
}, function (res) {
|
|
if (res === true) {
|
|
$scope.documentTrackAddDetailsLoading = true;
|
|
var deleteDocEntry = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'deleteDocPendingDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
exceptId: details.ID,
|
|
localData: localDetail
|
|
}
|
|
};
|
|
$http(deleteDocEntry).then(function (response) {
|
|
if (response.data.deleteStatus == true) {
|
|
// swal("Success!", response.data.message, "success");
|
|
$scope.documentTrackAddDetailsLoading = false;
|
|
// $scope.studentDocumentsList = '';
|
|
$scope.getStudentPendingEntrolDocDetails(StuID);
|
|
} else {
|
|
swal(" ", res.data.message, "error");
|
|
$scope.documentTrackAddDetailsLoading = false;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
// end : entrollment document upload ====================================
|
|
$scope.stepsModelEdit = [];
|
|
$scope.imageUploadEdit = function (event) {
|
|
var files = event.target.files; //FileList object
|
|
|
|
for (var i = 0; i < files.length; i++) {
|
|
var file = files[i];
|
|
var reader = new FileReader();
|
|
reader.onload = $scope.imageIsLoadedEdit;
|
|
reader.readAsDataURL(file);
|
|
}
|
|
}
|
|
|
|
$scope.imageIsLoadedEdit = function (e) {
|
|
$scope.$apply(function () {
|
|
// $scope.stepsModel.push(e.target.result);
|
|
$scope.stepsModelEdit[0] = e.target.result;
|
|
});
|
|
}
|
|
|
|
//an array of files selected
|
|
$scope.filesEdit = [];
|
|
//listen for the file selected event
|
|
$scope.$on("fileSelectedEdit", function (event, args) {
|
|
$scope.$apply(function () {
|
|
//add the file object to the scope's files collection
|
|
$scope.filesEdit[0] = args.file;
|
|
});
|
|
});
|
|
|
|
// reset image for Edit
|
|
$scope.resetImageEdit = function () {
|
|
$scope.filesEdit.length = 0;
|
|
$scope.stepsModelEdit.length = 0;
|
|
}
|
|
|
|
$scope.editSaveButtonDisable = false;
|
|
// update student details
|
|
$scope.updateStuDetails = function (form, p, hidedob) {
|
|
|
|
|
|
// console.log($scope.OldPhone);return false;
|
|
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("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
|
} else {
|
|
// alert(p.DOB);
|
|
$scope.editSaveButtonDisable = true;
|
|
var idProof = $scope.filesEdit[0];
|
|
var formate = "dd-MM-yyyy";
|
|
var checkDOB = $filter('date')(new Date(p.DOB), formate);
|
|
p.IsActive = p.IsActive === true ? 1 : 0;
|
|
p.DOB = p.DOB == hidedob ? p.DOB : $filter('date')(new Date(p.DOB), formate);
|
|
|
|
if (idProof == undefined) {
|
|
// alert(idProof);
|
|
var req = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'updateStudentExistDetail/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: p,
|
|
updatedBy: localDetails.localUserID,
|
|
OldPhone: $scope.OldPhone,
|
|
OldDetails:$scope.CopyModel
|
|
}
|
|
};
|
|
$http(req).then(function (response) {
|
|
if (response.data.updateStuStatus === true) {
|
|
swal(" ", "Updated successfully.", "success");
|
|
$scope.getStudentList();
|
|
$scope.editId = -1;
|
|
$scope.editSaveButtonDisable = false;
|
|
} else {
|
|
// $scope.ldloading1[loading.replace('-', '_')] = false;
|
|
swal(" ", response.data.message, "error");
|
|
$scope.editSaveButtonDisable = false;
|
|
}
|
|
});
|
|
} else {
|
|
// alert();
|
|
var formData = new FormData();
|
|
var idStuUpProof = $scope.filesEdit[0];
|
|
// alert(idProof);
|
|
formData.append("data", JSON.stringify(p));
|
|
formData.append("updatedBy", localDetails.localUserID);
|
|
formData.append('idStuUpProof', idStuUpProof);
|
|
$http.post(apiPoint.url + 'updateStudentImgDetails/', formData, {
|
|
transformRequest: angular.identity,
|
|
headers: { 'Content-Type': undefined, 'Process-Data': false },
|
|
}).success(function (res) {
|
|
// alert(JSON.stringify(res));
|
|
if (res.updateStuStatus == true) {
|
|
swal(" ", "Updated successfully.", "success");
|
|
$scope.getStudentList();
|
|
$scope.editId = -1;
|
|
$scope.editSaveButtonDisable = false;
|
|
} else {
|
|
// $scope.ldloading1[loading.replace('-', '_')] = false;
|
|
swal(" ", response.data.message, "error");
|
|
$scope.editSaveButtonDisable = false;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}]);
|
|
|
|
|
|
|
|
|
|
// Student datails for super admin : Start
|
|
app.controller('studentSuperAdminCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$http", "API_POINTS", "$state", '$rootScope', '$cookies', 'md5', 'ipCookie', '$timeout', '$window', "flowFactory", "SweetAlert", function ($scope, toaster, $filter, ngTableParams, $http, apiPoint, $state, $rootScope, $cookies, md5, ipCookie, $timeout, $window, flowFactory, SweetAlert) {
|
|
/**
|
|
* student details capture
|
|
* by : kdk
|
|
*/
|
|
|
|
|
|
// get local client details
|
|
var localDetail = JSON.parse(sessionStorage.getItem('localObj'));
|
|
var localDetails = ipCookie('cookiechk');
|
|
$scope.localBranchDetails = "";
|
|
$scope.loader = false;
|
|
$scope.allcourselist ='';
|
|
$scope.che='abc';
|
|
|
|
$scope.viewStudentDetailsPage = false;
|
|
// load when html page load
|
|
$scope.init = function () {
|
|
$scope.che='123';
|
|
|
|
//console.log($scope.che);
|
|
|
|
$scope.localUserType = localDetails.localType;
|
|
if (localDetail != null) {
|
|
if (localDetails.localType === 'R004') {
|
|
getDetails();
|
|
} else {
|
|
ipCookie.remove('cookiechk');
|
|
$window.sessionStorage.clear();
|
|
$state.go('login.signin');
|
|
}
|
|
} else {
|
|
}
|
|
|
|
|
|
var allcourse = {
|
|
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getCourse/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: localDetails
|
|
}
|
|
|
|
};
|
|
|
|
$http(allcourse).then(function (response) {
|
|
if (response.data.details) {
|
|
$scope.allcourselist = response.data.details;
|
|
// console.log($scope.allcourselist)
|
|
} else {
|
|
$scope.employeeList = '';
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
$scope.employeeList = '';
|
|
$scope.getEmployeeList = function() {
|
|
var getEmpListBranch = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getEmployeeDetailsBranch/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: localDetails
|
|
}
|
|
};
|
|
$http(getEmpListBranch).then(function (response) {
|
|
if (response.data.employeeList) {
|
|
$scope.employeeList = response.data.employees_details;
|
|
} else {
|
|
$scope.employeeList = '';
|
|
}
|
|
});
|
|
}
|
|
|
|
// $scope.getBranchList = function () {
|
|
// $scope.loader = true;
|
|
// var empListreq = {
|
|
// method: 'POST',
|
|
// url: apiPoint.url + 'getBranchListDetails/',
|
|
// headers: {
|
|
// 'Content-Type': 'application/json'
|
|
// },
|
|
// data: {
|
|
// data: localDetails
|
|
// }
|
|
// };
|
|
// $http(empListreq).then(function (response) {
|
|
// if (response.data.branDetailstatus) {
|
|
// $scope.loader = false;
|
|
// $scope.branchList_data = response.data.branch_details;
|
|
// } else {
|
|
// }
|
|
// });
|
|
// }
|
|
|
|
// $scope.changeBranch = function () {
|
|
// $scope.viewStudentDetailsPage = false;
|
|
// localDetails.localBranchID = $scope.localBranchDetails;
|
|
// localDetail.localBranchID = $scope.localBranchDetails;
|
|
// getDetails()
|
|
// }
|
|
|
|
function getDetails() {
|
|
$scope.todayDate = new Date();
|
|
var nowInMS = new Date().getTime(),
|
|
sixteenYearsInMS = 1000 * 60 * 60 * 24 * 365 * 16,
|
|
sixteenYearsBeforeNow = new Date(nowInMS - sixteenYearsInMS);
|
|
$scope.currentDate = new Date();
|
|
$scope.getStudentList();
|
|
$scope.getUniversityList();
|
|
$scope.getUniversitySearchList();
|
|
$scope.getEmployeeList();
|
|
// $scope.myModel.dateofbirth = $filter('date')($scope.currentDate, 'dd-MM-yyyy');
|
|
$scope.myModelCourseAdd.dateofjoining = $filter('date')($scope.currentDate, 'dd-MM-yyyy');
|
|
$scope.myModelCourse.dateofjoining = $filter('date')($scope.currentDate, 'dd-MM-yyyy');
|
|
// $scope.viewStudentDetailsPage = true;
|
|
}
|
|
|
|
$scope.myModel = {
|
|
'primaryPhone': '',
|
|
'firstname': '',
|
|
'lastname': '',
|
|
'fathername': '',
|
|
'mothername': '',
|
|
'emailId': '',
|
|
'secondaryPhone': '',
|
|
'dateofbirth': '',
|
|
'gender': '',
|
|
'aadharNumber': '',
|
|
'otherId': '',
|
|
'otherIdDetails': '',
|
|
'address1': '',
|
|
'address2': '',
|
|
'caste': '',
|
|
'category': '',
|
|
'religion': '',
|
|
'nationality': '',
|
|
'prequalification': '',
|
|
'occupation': '',
|
|
'designation': '',
|
|
'companyname': '',
|
|
'referredby': '',
|
|
'referredmobilenumber': '',
|
|
'switchsetting': true,
|
|
'DeactiveComments': '',
|
|
'Comments': '',
|
|
'admittedBy': ''
|
|
};
|
|
|
|
$scope.myModelCourse = {
|
|
'university': '',
|
|
'course': '',
|
|
'batch': '',
|
|
'dateofjoining': '',
|
|
'enrollmentid': '',
|
|
'specilization1': '',
|
|
'specilization2': ''
|
|
};
|
|
|
|
$scope.myModelCourseAdd = {
|
|
'university': '',
|
|
'course': '',
|
|
'batch': '',
|
|
'dateofjoining': '',
|
|
'enrollmentid': '',
|
|
'specilization1': '',
|
|
'specilization2': ''
|
|
};
|
|
|
|
$scope.inActiveBranchStatus = false;
|
|
$scope.addStudentView = function () {
|
|
// check the local branch is active for add a new student for this branch
|
|
// alert();
|
|
var checkBranchActiveForStuAdd = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getBranchActiveStatusforStuAdd/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: localDetails
|
|
}
|
|
};
|
|
$http(checkBranchActiveForStuAdd).then(function (response) {
|
|
if (response.data) {
|
|
var checkStatus = response.data.branch_active_status;
|
|
if (checkStatus == "0") {
|
|
$scope.inActiveBranchStatus = true;
|
|
swal(" ", "Cannot create a new Student for In-Active Branch", "warning");
|
|
} else {
|
|
// $scope.inActiveBranchStatus = false;
|
|
}
|
|
} else {
|
|
}
|
|
});
|
|
|
|
|
|
// $scope.myModelCourseAdd = {
|
|
// 'university': '',
|
|
// 'course': '',
|
|
// 'batch': '',
|
|
// 'dateofjoining': '',
|
|
// 'enrollmentid': ''
|
|
// };
|
|
// $scope.courseDataAdd = '';
|
|
// $scope.batchDataAdd = '';
|
|
}
|
|
|
|
|
|
|
|
// 2017-11-23T00:00:00+0530
|
|
// 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
|
|
}
|
|
|
|
// get University List
|
|
$scope.universitySearchData = '';
|
|
$scope.getUniversitySearchList = function () {
|
|
var empListreq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getUniveCourseBratch/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: localDetails
|
|
}
|
|
};
|
|
$http(empListreq).then(function (response) {
|
|
if (response.data.univList) {
|
|
$scope.universitySearchData = response.data.university_details;
|
|
// alert()
|
|
} else {
|
|
}
|
|
});
|
|
};
|
|
|
|
$scope.searchData = {
|
|
"University": "",
|
|
"Course": "",
|
|
"Status": ""
|
|
}
|
|
$scope.myUnivSearch = "";
|
|
$scope.coursedropdownstatus = true;
|
|
|
|
$scope.visiblecheck='0';
|
|
$scope.getUniveId = function (univ) {
|
|
|
|
|
|
//alert('2');
|
|
$scope.coursedropdownstatus = false;
|
|
let name = JSON.parse(univ);
|
|
$scope.searchData.University = name.UniversityID;
|
|
$scope.searchData.Course = '';
|
|
$scope.searchData.Batch = '';
|
|
$scope.courseData = name.Course;
|
|
$scope.batchData = name.Batch;
|
|
$scope.OpenWindowStatus = false;
|
|
|
|
$scope.visiblecheck='1';
|
|
|
|
$scope.getStudentList();
|
|
};
|
|
|
|
|
|
|
|
$scope.getValue = function(se)
|
|
{
|
|
console.log(se)
|
|
}
|
|
|
|
|
|
$scope.getValueChange = function () {
|
|
|
|
|
|
// alert();
|
|
// $scope.searchData = {
|
|
// "University": "",
|
|
// "Course": "",
|
|
// "Status": ""
|
|
// }
|
|
$scope.getStudentList();
|
|
}
|
|
$scope.Searchloader = false;
|
|
$scope.studentListLength = 0;
|
|
$scope.getStudentList = function () {
|
|
|
|
|
|
//alert('in 2')
|
|
|
|
//console.log(localDetails);
|
|
|
|
$scope.Searchloader = true;
|
|
var empListreq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getStudentList/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: localDetails,
|
|
search: $scope.searchData
|
|
}
|
|
};
|
|
$http(empListreq).then(function (response) {
|
|
if (response.data.studentList) {
|
|
$scope.Searchloader = false;
|
|
$scope.studentData = true;
|
|
$scope.data = response.data.student_details;
|
|
$scope.studentListLength = $scope.data.length;
|
|
} else {
|
|
$scope.Searchloader = false;
|
|
$scope.studentData = false;
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
$scope.CopyModel={
|
|
|
|
'AadharNumber':'',
|
|
'AdmittedBy':'',
|
|
'AlternateNumber':'',
|
|
'BranchCode': '',
|
|
'Caste':'',
|
|
'Category':'',
|
|
'Comments': '',
|
|
'Companyname':'',
|
|
'CourseCode': '',
|
|
'CourseID':'',
|
|
'CourseName': '',
|
|
'CreatedBy': '',
|
|
'CreatedOn':'',
|
|
'DOB': '',
|
|
'DeactiveComments':'',
|
|
'Designation':'',
|
|
'EmailID':'',
|
|
'Fathername':'',
|
|
'Firstname':'',
|
|
'Gender': '',
|
|
'IsActive':'',
|
|
'Lastname': '',
|
|
'MobileNumber':'',
|
|
'MotherName': '',
|
|
'Nationality':'',
|
|
'Occupation':'',
|
|
'OtherID':'',
|
|
'OtherIDDetails':'',
|
|
'PermanentAddress':'',
|
|
'PreQualification':'',
|
|
'PresentAddress':'',
|
|
'ProfilePicPath':'',
|
|
'Qualification':'',
|
|
'ReferersMobileNumber':'',
|
|
'ReferredBy':'',
|
|
'Religion':'',
|
|
'StudentID':'',
|
|
'Student_Course_id':'',
|
|
'UniversityID':'',
|
|
'UniversityName':'',
|
|
|
|
};
|
|
|
|
|
|
$scope.editId = -1;
|
|
$scope.editCourseId = -1;
|
|
$scope.editTrackingId=-1;
|
|
$scope.msgdetID = -1;
|
|
$scope.OldPhone='';
|
|
$scope.setEditId = function (uniqe_id ,id,k) {
|
|
|
|
//alert()
|
|
//console.log(k);
|
|
$scope.CopyModel.Fathername=k.Fathername;
|
|
$scope.CopyModel.AadharNumber=k.AadharNumber;
|
|
$scope.CopyModel.AdmittedBy=k.AdmittedBy;
|
|
$scope.CopyModel.AlternateNumber = k.AlternateNumber;
|
|
$scope.CopyModel.Caste = k.Caste;
|
|
$scope.CopyModel.Category = k.Category;
|
|
$scope.CopyModel.Comments=k.Comments;
|
|
$scope.CopyModel.Companyname=k.Companyname;
|
|
$scope.CopyModel.CourseCode= k.CourseCode;
|
|
$scope.CopyModel.CourseID=k.CourseID;
|
|
$scope.CopyModel.CourseName=k.CourseName;
|
|
$scope.CopyModel.DOB = k.DOB;
|
|
$scope.CopyModel.DeactiveComments = k.DeactiveComments;
|
|
$scope.CopyModel.EmailID=k.EmailID;
|
|
$scope.CopyModel.Firstname=k.Firstname;
|
|
$scope.CopyModel.Gender=k.Gender;
|
|
$scope.CopyModel.IsActive=k.IsActive;
|
|
$scope.CopyModel.Lastname=k.Lastname;
|
|
$scope.CopyModel.MobileNumber=k.MobileNumber;
|
|
$scope.CopyModel.MotherName=k.MotherName;
|
|
$scope.CopyModel.Nationality=k.Nationality;
|
|
$scope.CopyModel.Occupation=k.Occupation;
|
|
$scope.CopyModel.OtherID=k.OtherID;
|
|
$scope.CopyModel.OtherIDDetails=k.OtherIDDetails;
|
|
$scope.CopyModel.PermanentAddress=k.PermanentAddress;
|
|
$scope.CopyModel.PreQualification=k.PreQualification;
|
|
$scope.CopyModel.PresentAddress=k.PresentAddress;
|
|
$scope.CopyModel.ReferersMobileNumber=k.ReferersMobileNumber;
|
|
$scope.CopyModel.ReferredBy=k.ReferredBy;
|
|
$scope.CopyModel.Religion=k.Religion;
|
|
$scope.CopyModel.StudentID=k.StudentID;
|
|
|
|
|
|
//console.log($scope.CopyModel)
|
|
|
|
// console.log(id)
|
|
$scope.editId = uniqe_id;
|
|
$scope.editCourseId = -1;
|
|
$scope.editTrackingId=-1;
|
|
$scope.msgdetID = -1;
|
|
|
|
$scope.OldPhone=k.MobileNumber;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.PreviousPhoneDetails ='';
|
|
$scope.Changecheck = false;
|
|
$scope.getPhoneNoHistoy = function(studentId)
|
|
{
|
|
|
|
// alert('fn')
|
|
var getphonehistory = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'GetPhoneHistory/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
|
|
StudentID:studentId,
|
|
loginBranch: localDetails.localBranchID,
|
|
createdBy: localDetails.localUserID,
|
|
}
|
|
};
|
|
|
|
|
|
$http(getphonehistory).then(function (response)
|
|
{
|
|
|
|
//console.log(response.data)
|
|
if(response.data.stuidStatus == true)
|
|
{
|
|
$scope.PreviousPhoneDetails= response.data.Mobiledetails;
|
|
$scope.Changecheck= true;
|
|
|
|
console.log($scope.PreviousPhoneDetails)
|
|
}
|
|
else
|
|
{
|
|
$scope.PreviousPhoneDetails= '';
|
|
$scope.Changecheck= false;
|
|
}
|
|
|
|
console.log($scope.PreviousPhoneDetails)
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
$scope.setEditCourseId = function (uniqe_id ,id) {
|
|
|
|
//alert('1');
|
|
$scope.list = false;
|
|
$scope.getStudentCourseList(id);
|
|
$scope.currentStudentId = id;
|
|
// $scope.getStudentCourseDetails(id);
|
|
$scope.editCourseId = uniqe_id;
|
|
$scope.editId = -1;
|
|
$scope.editTrackingId=-1;
|
|
$scope.courseEditLoading = true;
|
|
$scope.courselist = true;
|
|
}
|
|
$scope.setEditTrackingId = function (uniqe_id,courseid,universityid,MobileNumber) {
|
|
|
|
|
|
$scope.list = false;
|
|
$scope.getStudentTrackingDetails(courseid,universityid,MobileNumber);
|
|
$scope.currentStudentId = MobileNumber;
|
|
// $scope.getStudentCourseDetails(id);
|
|
$scope.editTrackingId = uniqe_id;
|
|
$scope.editId = -1;
|
|
$scope.editCourseId=-1;
|
|
$scope.trackingEditLoading = true;
|
|
$scope.trackingdetails = true;
|
|
|
|
}
|
|
$scope.TrackingDetails = function (s) {
|
|
|
|
$rootScope.trackingid=s.TrackingID;
|
|
$state.go('app.call.trackingFollowup');
|
|
|
|
|
|
}
|
|
|
|
|
|
$scope.cancelnotification = function()
|
|
{
|
|
$scope.msgdetID = '-1';
|
|
}
|
|
|
|
$scope.MailDetails='';
|
|
$scope.MessageDetails = '';
|
|
$scope.StudentIDDet = '';
|
|
$scope.msgdetID = -1;
|
|
$scope.setmessageId = function (student)
|
|
{
|
|
|
|
//console.log(student);return false;
|
|
|
|
var studentID= student.StudentID;
|
|
var phonenumber = student.MobileNumber;
|
|
var email = student.EmailID;
|
|
|
|
|
|
var sentnotification = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'Getnotificcations/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
|
|
StudentID: studentID,
|
|
Phone: phonenumber,
|
|
Email:email,
|
|
loginBranch: localDetails.localBranchID,
|
|
createdBy: localDetails.localUserID,
|
|
}
|
|
};
|
|
$http(sentnotification).then(function (response) {
|
|
|
|
if(response.data.status == 200)
|
|
{
|
|
$scope.MailDetails=response.data.maildetails;
|
|
$scope.MessageDetails = response.data.msgdetails;
|
|
$scope.StudentIDDet = response.data.StudentID;
|
|
$scope.msgdetID = $scope.StudentIDDet[0].StudentID;
|
|
|
|
//console.log($scope.msgdetID);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.cancel = function () {
|
|
$scope.getStudentList();
|
|
$scope.editId = -1;
|
|
$scope.editCourseId = -1;
|
|
$scope.editTrackingId=-1;
|
|
}
|
|
|
|
|
|
$scope.cancelCourseDetails = function () {
|
|
$scope.getStudentCourseList($scope.currentStudentId);
|
|
// $scope.editId = -1;
|
|
// $scope.editCourseId = -1;
|
|
}
|
|
|
|
$scope.addStudentCourse = function () {
|
|
$scope.myModelCourse = {
|
|
'university': '',
|
|
'course': '',
|
|
'batch': '',
|
|
'dateofjoining': '',
|
|
'enrollmentid': '',
|
|
'specilization1': '',
|
|
'specilization2': ''
|
|
};
|
|
$scope.currentDate = new Date();
|
|
$scope.myModelCourse.dateofjoining = $filter('date')($scope.currentDate, 'dd-MM-yyyy');
|
|
|
|
$scope.list = false;
|
|
$scope.courseEdit = false;
|
|
$scope.courseAdd = true;
|
|
}
|
|
|
|
$scope.addStudentCourseDetailsChanges = function (objCourseDetails) {
|
|
$scope.myModelCourse.course = objCourseDetails.selected.CourseID;
|
|
$scope.myModelCourse.specilization1 = objCourseDetails.selected.Specilization1;
|
|
$scope.myModelCourse.specilization2 = objCourseDetails.selected.Specilization2;
|
|
}
|
|
|
|
$scope.stuAddNewCourseDateChange = function () {
|
|
// alert();
|
|
try {
|
|
var formate = "dd-MM-yyyy";
|
|
$scope.myModelCourse.dateofjoining = $filter('date')(new Date($scope.myModelCourse.dateofjoining), formate);
|
|
|
|
}
|
|
catch(e) {
|
|
}
|
|
}
|
|
|
|
// add student course
|
|
$scope.addCourseFORM = {
|
|
|
|
submit: function (form, myModelCourse, p) {
|
|
// alert();
|
|
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("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
|
} else {
|
|
// alert(JSON.stringify(p.StudentID));
|
|
var formate = "dd-MM-yyyy";
|
|
// $scope.myModel.switchsetting = $scope.myModel.switchsetting === true ? 1 : 0;
|
|
// $scope.myModel.dateofbirth = $filter('date')(new Date($scope.myModel.dateofbirth), formate);
|
|
// $scope.myModelCourse.dateofjoining = $filter('date')(new Date($scope.myModelCourse.dateofjoining), formate);
|
|
var req = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'insertStudentCourse/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
addStudent: p.StudentID,
|
|
coursedata: $scope.myModelCourse,
|
|
loginBranch: localDetails.localBranchID,
|
|
createdBy: localDetails.localUserID,
|
|
}
|
|
};
|
|
$http(req).then(function (response) {
|
|
if (response.data.addStuCourseStatus == true) {
|
|
swal(" ", "Student course added successfully. ", "success");
|
|
$scope.getStudentCourseList($scope.currentStudentId);
|
|
} else {
|
|
swal(" ", response.data.message, "error");
|
|
$scope.getStudentCourseList($scope.currentStudentId);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
// get Student Course List
|
|
$scope.getStudentCourseList = function (studentId) {
|
|
$scope.courseEditLoading = true;
|
|
$scope.list = true;
|
|
$scope.courseEdit = false;
|
|
$scope.courseAdd = false;
|
|
var req = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getStudentCourseList/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
studentID: studentId,
|
|
updatedBy: localDetails,
|
|
|
|
}
|
|
};
|
|
$http(req).then(function (response) {
|
|
if (response.data.stuCourseDetails) {
|
|
$scope.courseEditLoading = false;
|
|
$scope.studentCourseList = response.data.course_details;
|
|
// $scope.stucour = $scope.studentCourse[0];
|
|
|
|
console.log($scope.studentCourseList);
|
|
} else {
|
|
$scope.courselist = false;
|
|
$scope.courseEditLoading='';
|
|
}
|
|
});
|
|
}
|
|
|
|
// get student particular course details : params : studentCourseID
|
|
$scope.getStudentCourseDetails = function (studentcourseID) {
|
|
$scope.courseEditLoading = true;
|
|
$scope.stucour = '';
|
|
$scope.list = false;
|
|
$scope.courseAdd = false;
|
|
$scope.courseEdit = true;
|
|
var req = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getStudentCourseDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
studentcourseId: studentcourseID
|
|
}
|
|
};
|
|
$http(req).then(function (response) {
|
|
if (response.data.stuCourseDetails) {
|
|
$scope.courseEditLoading = false;
|
|
$scope.studentCourse = response.data.course_details;
|
|
$scope.stucour = $scope.studentCourse[0];
|
|
} else {
|
|
}
|
|
});
|
|
}
|
|
$scope.getStudentTrackingDetails = function (courseid,universityid,MobileNumber)
|
|
{
|
|
|
|
$scope.trackingEditLoading = true;
|
|
$scope.list = true;
|
|
$scope.courseEdit = false;
|
|
$scope.courseAdd = false;
|
|
var req = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getStudentTrackingDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
MobileNumber: MobileNumber,
|
|
courseid:courseid,
|
|
universityid:universityid,
|
|
loginBranch: localDetails.localBranchID,
|
|
}
|
|
|
|
};
|
|
$http(req).then(function (response) {
|
|
|
|
if (response.data.status==200) {
|
|
|
|
$scope.trackingDetails =response.data.trackingdata;
|
|
$scope.trackingEditLoading = false;
|
|
// $scope.
|
|
//console.log($scope.trackingDetails);
|
|
} else {
|
|
|
|
$scope.trackingdetails = false;
|
|
$scope.trackingEditLoading='';
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
$scope.stuCourseEditDetailsObj = {};
|
|
$scope.onSlecetUnivEdit = function (univid, coursid) {
|
|
let UniversityId = univid;
|
|
$scope.onSlecetUnivEditCourse(UniversityId, coursid);
|
|
}
|
|
|
|
$scope.onChangeSlecetUnivEdit = function (univid) {
|
|
let UniversityId = univid;
|
|
$scope.onSlecetUnivEditCourse(UniversityId);
|
|
$scope.stucour.CourseID = '';
|
|
$scope.stucour.BatchCode = '';
|
|
$scope.stucour.Specilization1 = '';
|
|
$scope.stucour.Specilization2 = '';
|
|
}
|
|
|
|
$scope.courseLoading = false;
|
|
$scope.onSlecetUnivEditCourse = function (UniversityId, CourseId = null) {
|
|
$scope.courseDataEditScrn = [];
|
|
// Object.keys($scope.stuCourseEditDetailsObj).length = 0;
|
|
$scope.stuCourseEditDetailsObj.selected = undefined;
|
|
// alert(JSON.stringify($scope.stuCourseEditDetailsObj));
|
|
$scope.courseLoading = true;
|
|
var univListreq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getCourseBatchForUniv/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: UniversityId,
|
|
reqDetails: localDetails
|
|
}
|
|
};
|
|
$http(univListreq).then(function (response) {
|
|
if (response.data.courseStatus) {
|
|
$scope.courseLoading = false;
|
|
$scope.courseDataEditScrn = response.data.course_details;
|
|
if (CourseId !== null) {
|
|
let courseData = $scope.courseDataEditScrn;
|
|
let details = courseData.filter(x => x.CourseID === CourseId);
|
|
$scope.stuCourseEditDetailsObj.selected = details[0];
|
|
} else {
|
|
$scope.stuCourseEditDetailsObj.selected = undefined;
|
|
}
|
|
} else {
|
|
$scope.courseLoading = false;
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
$scope.editStudentCourseDetailsChanges = function (obj) {
|
|
let stuCourseEditDetailsObj = obj.selected;
|
|
$scope.stucour.CourseID = stuCourseEditDetailsObj.CourseID;
|
|
$scope.stucour.Specilization1 = stuCourseEditDetailsObj.Specilization1;
|
|
$scope.stucour.Specilization2 = stuCourseEditDetailsObj.Specilization2;
|
|
}
|
|
|
|
|
|
// update sutdent course details
|
|
$scope.updateStudentCourseDetails = function (form, datas, hidedoj) {
|
|
|
|
//alert('in');return false;
|
|
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("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
|
} else {
|
|
// alert(datas.DOJ);
|
|
var formate = "dd-MM-yyyy";
|
|
var checkDOJ = $filter('date')(new Date(datas.DOJ), formate);
|
|
datas.IsActive = datas.IsActive === true ? 1 : 0;
|
|
datas.DOJ = datas.DOJ == hidedoj ? datas.DOJ : $filter('date')(new Date(datas.DOJ), formate);
|
|
// alert(datas.DOJ);
|
|
var req = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'updateStudentCourseDetail/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: datas,
|
|
updatedBy: localDetails.localUserID,
|
|
}
|
|
};
|
|
$http(req).then(function (response) {
|
|
if (response.data.updateStuCourseStatus) {
|
|
swal("", "Updated successfully.", "success");
|
|
$scope.getStudentCourseList($scope.currentStudentId);
|
|
// $scope.editCourseId = false;
|
|
} else {
|
|
// $scope.ldloading1[loading.replace('-', '_')] = false;
|
|
swal(" ", response.data.message, "error");
|
|
$scope.getStudentCourseList($scope.currentStudentId);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
$scope.universityData = '';
|
|
$scope.getUniversityList = function () {
|
|
var empListreq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getStudentUniversity/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: localDetails
|
|
}
|
|
};
|
|
$http(empListreq).then(function (response) {
|
|
if (response.data.univList) {
|
|
$scope.universityData = response.data.university_details;
|
|
} else {
|
|
}
|
|
});
|
|
}
|
|
|
|
$scope.courseLoading = false;
|
|
$scope.myModelCourseObjExitStu = {};
|
|
$scope.myModelCourseObjStu = {};
|
|
$scope.onSlecetUniv = function () {
|
|
$scope.courseData = [];
|
|
$scope.batchData = '';
|
|
$scope.myModelCourse.course = '';
|
|
$scope.myModelCourse.batch = '';
|
|
$scope.myModelCourse.specilization1 = '';
|
|
$scope.myModelCourse.specilization2 = '';
|
|
$scope.courseLoading = true;
|
|
$scope.myModelCourseObjExitStu.selected = undefined;
|
|
$scope.myModelCourseObjStu.selected = undefined;
|
|
var univListreq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getCourseBatchForUniv/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: $scope.myModelCourse.university,
|
|
reqDetails: localDetails
|
|
}
|
|
};
|
|
$http(univListreq).then(function (response) {
|
|
if (response.data.courseStatus) {
|
|
$scope.courseLoading = false;
|
|
$scope.courseData = response.data.course_details;
|
|
$scope.batchData = response.data.batch_details;
|
|
} else {
|
|
$scope.courseLoading = false;
|
|
}
|
|
});
|
|
}
|
|
|
|
$scope.myModelCourseObj={};
|
|
$scope.onSlecetUnivAdd = function () {
|
|
$scope.courseDataAdd = [];
|
|
$scope.batchDataAdd = '';
|
|
$scope.myModelCourseAdd.course = '';
|
|
$scope.myModelCourseAdd.batch = '';
|
|
$scope.myModelCourseAdd.specilization1 = '';
|
|
$scope.myModelCourseAdd.specilization2 = '';
|
|
$scope.myModelCourseObj.selected = undefined;
|
|
|
|
$scope.courseLoading = true;
|
|
var univListreq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getCourseBatchForUniv/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: $scope.myModelCourseAdd.university,
|
|
reqDetails: localDetails
|
|
}
|
|
};
|
|
$http(univListreq).then(function (response) {
|
|
if (response.data.courseStatus) {
|
|
$scope.courseLoading = false;
|
|
$scope.courseDataAdd = response.data.course_details;
|
|
$scope.batchDataAdd = response.data.batch_details;
|
|
} else {
|
|
$scope.courseLoading = false;
|
|
}
|
|
});
|
|
}
|
|
|
|
$scope.existingStudentView = false;
|
|
$scope.existingStudentId = '';
|
|
// check mobile number existing
|
|
$scope.checkMobileExist = function () {
|
|
var checkReq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'chkStudentExistDetail/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: $scope.myModel.primaryPhone,
|
|
check: 'mobileNumber'
|
|
}
|
|
};
|
|
$http(checkReq).then(function (response) {
|
|
// if (response.data.existMobile == true) {
|
|
// swal("Warning!", response.data.message, "warning");
|
|
// $scope.myModel.primaryPhone = '';
|
|
|
|
// } else {
|
|
// }
|
|
if (response.data.existMobile == true) {
|
|
if (response.data.details.type === 'R001') {
|
|
// swal("Warning!", response.data.message, "warning");
|
|
$scope.myModel.primaryPhone = '';
|
|
// student registration find student previously exist
|
|
// $scope.existingStudentView = true;
|
|
// $scope.existingStudentId = response.data.details.studentId;
|
|
SweetAlert.swal({
|
|
title: "Warning!",
|
|
text: "Student exist with this same Number." + "\n Do you want to Enroll New Course!",
|
|
type: "warning",
|
|
showCancelButton: true,
|
|
confirmButtonColor: "#007aff",
|
|
confirmButtonText: "Yes!"
|
|
}, function (res) {
|
|
if (res === true) {
|
|
$scope.existingStudentView = true;
|
|
$scope.existingStudentId = response.data.details.studentId;
|
|
}
|
|
});
|
|
|
|
} else if (response.data.details.type === 'R002' || response.data.details.type === 'R003') {
|
|
swal("Warning!", response.data.message, "warning");
|
|
$scope.myModel.primaryPhone = '';
|
|
} else {
|
|
swal("Warning!", response.data.message, "warning");
|
|
$scope.myModel.primaryPhone = '';
|
|
}
|
|
} else {
|
|
}
|
|
});
|
|
}
|
|
|
|
$scope.stuExistingDetailsShowLoading = false;
|
|
|
|
$scope.getExistStudentDetails = function () {
|
|
// alert($scope.existingStudentId);
|
|
$scope.stuExistingDetailsShowLoading = true;
|
|
var checkExisReq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getExistingStudentDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: $scope.existingStudentId,
|
|
reqDetails: localDetails
|
|
}
|
|
};
|
|
$http(checkExisReq).then(function (response) {
|
|
if (response.data.existingStudentDetailsStatus == true) {
|
|
$scope.existingStuPersonalDetails = response.data.personalDetails[0];
|
|
$scope.existingStuCourseDetails = response.data.courseDetails;
|
|
$scope.stuExistingDetailsShowLoading = false;
|
|
} else {
|
|
$scope.stuExistingDetailsShowLoading = false;
|
|
}
|
|
});
|
|
}
|
|
|
|
$scope.cancelExisStudentView = function () {
|
|
$scope.existingStudentView = false;
|
|
}
|
|
|
|
$scope.existStuCourseDetailsCheck = function (myModelCourseObjExitStu) {
|
|
$scope.myModelCourse.course = myModelCourseObjExitStu.selected.CourseID;
|
|
$scope.myModelCourse.specilization1 = myModelCourseObjExitStu.selected.Specilization1;
|
|
$scope.myModelCourse.specilization2 = myModelCourseObjExitStu.selected.Specilization2;
|
|
}
|
|
|
|
$scope.getDOJchangesOnExistingStudentView = function () {
|
|
// alert();
|
|
try {
|
|
var formate = "dd-MM-yyyy";
|
|
$scope.myModelCourse.dateofjoining = $filter('date')(new Date($scope.myModelCourse.dateofjoining), formate);
|
|
}
|
|
catch(e) {
|
|
}
|
|
}
|
|
|
|
// add student course for existing student
|
|
$scope.addCourseExistingStudent = {
|
|
|
|
submit: function (form, myModelCourse, p) {
|
|
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("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
|
} else {
|
|
// alert(JSON.stringify(p.StudentID));
|
|
// alert(JSON.stringify(myModelCourse));
|
|
var formate = "dd-MM-yyyy";
|
|
// $scope.myModelCourse.dateofjoining = $filter('date')(new Date($scope.myModelCourse.dateofjoining), formate);
|
|
var req = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'insertStudentCourse/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
addStudent: p.StudentID,
|
|
coursedata: $scope.myModelCourse,
|
|
loginBranch: localDetails.localBranchID,
|
|
createdBy: localDetails.localUserID,
|
|
}
|
|
};
|
|
$http(req).then(function (response) {
|
|
if (response.data.addStuCourseStatus == true) {
|
|
swal(" ", "Student course added successfully. ", "success");
|
|
$scope.disableButton = false;
|
|
$scope.viewStudentDetailsPage = false;
|
|
$scope.myActivateDiv();
|
|
// $state.go($state.current, {}, { reload: true });
|
|
// $scope.getStudentCourseList($scope.currentStudentId);
|
|
} else {
|
|
swal(" ", response.data.message, "error");
|
|
// $scope.getStudentCourseList($scope.currentStudentId);
|
|
$scope.myModelCourse.dateofjoining = '';
|
|
}
|
|
});
|
|
}
|
|
},
|
|
cancel: function () {
|
|
$scope.myModelCourse = {
|
|
'university': '',
|
|
'course': '',
|
|
'batch': '',
|
|
'dateofjoining': '',
|
|
'enrollmentid': '',
|
|
'specilization1': '',
|
|
'specilization2': ''
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
$scope.courseChange = function (myModelCourseObj) {
|
|
// let myCourseDetails = myModelCourseObj.CourseID;
|
|
$scope.myModelCourseAdd.course = myModelCourseObj.selected.CourseID;
|
|
$scope.myModelCourseAdd.specilization1 = myModelCourseObj.selected.Specilization1;
|
|
$scope.myModelCourseAdd.specilization2 = myModelCourseObj.selected.Specilization2;
|
|
}
|
|
|
|
|
|
|
|
// check emailId existing
|
|
$scope.checkEmailExist = function () {
|
|
var checkReq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'chkStudentExistDetail/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: $scope.myModel.emailId,
|
|
check: 'emailId'
|
|
}
|
|
};
|
|
$http(checkReq).then(function (response) {
|
|
if (response.data.existEmailId == true) {
|
|
swal("Warning!", response.data.message, "warning");
|
|
$scope.myModel.emailId = '';
|
|
} else {
|
|
}
|
|
});
|
|
}
|
|
|
|
//-------------------------------------------------------------->
|
|
// getting for image to show
|
|
//-------------------------------------------------------------->
|
|
|
|
$scope.stepsModel = [];
|
|
$scope.imageUpload = function (event) {
|
|
var files = event.target.files; //FileList object
|
|
|
|
for (var i = 0; i < files.length; i++) {
|
|
var file = files[i];
|
|
var reader = new FileReader();
|
|
reader.onload = $scope.imageIsLoaded;
|
|
reader.readAsDataURL(file);
|
|
}
|
|
}
|
|
|
|
$scope.imageIsLoaded = function (e) {
|
|
$scope.$apply(function () {
|
|
// $scope.stepsModel.push(e.target.result);
|
|
$scope.stepsModel[0] = e.target.result;
|
|
});
|
|
}
|
|
|
|
//an array of files selected
|
|
$scope.files = [];
|
|
|
|
//listen for the file selected event
|
|
$scope.$on("fileSelected", function (event, args) {
|
|
$scope.$apply(function () {
|
|
//add the file object to the scope's files collection
|
|
$scope.files[0] = args.file;
|
|
});
|
|
});
|
|
|
|
// reset image
|
|
$scope.resetImage = function () {
|
|
$scope.files.length = 0;
|
|
$scope.stepsModel.length = 0;
|
|
}
|
|
|
|
// $scope.getChangeDate = function () {
|
|
// var formate = "dd-MM-yyyy";
|
|
// $scope.myModel.dateofbirth = $filter('date')(new Date($scope.myModel.dateofbirth), formate);
|
|
|
|
// }
|
|
|
|
$scope.tabactive1 = false;
|
|
$scope.tabactive2 = false;
|
|
$scope.tabActive = function (val) {
|
|
if (val === 'tabactive1') {
|
|
$scope.tabactive1 = true;
|
|
$scope.tabactive2 = false;
|
|
} else if (val === 'tabactive2') {
|
|
$scope.tabactive2 = true;
|
|
$scope.tabactive1 = false;
|
|
}
|
|
}
|
|
|
|
$scope.myActivateDiv = function () {
|
|
$scope.viewStudentDetailsPage = false;
|
|
$scope.myModel = {
|
|
'primaryPhone': '',
|
|
'firstname': '',
|
|
'lastname': '',
|
|
'fathername': '',
|
|
'mothername': '',
|
|
'emailId': '',
|
|
'secondaryPhone': '',
|
|
'dateofbirth': '',
|
|
'gender': '',
|
|
'aadharNumber': '',
|
|
'otherId': '',
|
|
'otherIdDetails': '',
|
|
'address1': '',
|
|
'address2': '',
|
|
'caste': '',
|
|
'category': '',
|
|
'religion': '',
|
|
'nationality': '',
|
|
'prequalification': '',
|
|
'occupation': '',
|
|
'designation': '',
|
|
'companyname': '',
|
|
'referredby': '',
|
|
'referredmobilenumber': '',
|
|
'switchsetting': true,
|
|
'DeactiveComments': '',
|
|
'Comments': '',
|
|
'admittedBy': ''
|
|
};
|
|
$scope.myModelCourseAdd = {
|
|
'university': '',
|
|
'course': '',
|
|
'batch': '',
|
|
'dateofjoining': '',
|
|
'enrollmentid': '',
|
|
'specilization1': '',
|
|
'specilization2': ''
|
|
};
|
|
$timeout(function () {
|
|
getDetails();
|
|
}, 1000);
|
|
}
|
|
|
|
$scope.getChangeDate = function () {
|
|
// alert();
|
|
try {
|
|
var formate = "dd-MM-yyyy";
|
|
$scope.myModelCourseAdd.dateofjoining = $filter('date')(new Date($scope.myModelCourseAdd.dateofjoining), formate);
|
|
// alert($scope.myModel.dateofbirth);
|
|
// var myDate = new Date($scope.myModel.dateofbirth);
|
|
// alert(myDate);
|
|
// if(typeof myDate === 'function') {
|
|
// alert("true")
|
|
// } else {
|
|
// alert("error")
|
|
// }
|
|
}
|
|
catch(e) {
|
|
// alert('error');
|
|
// alert(err);
|
|
|
|
}
|
|
}
|
|
// add student
|
|
$scope.studentFORM = {
|
|
submit: function (form, myModel, myModelCourseAdd) {
|
|
// alert(JSON.stringify(myModelCourseAdd));
|
|
|
|
//alert('ion');die();
|
|
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("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
|
} else {
|
|
$scope.disableButton = true;
|
|
var formate = "dd-MM-yyyy";
|
|
$scope.myModel.dateofbirth = $filter('date')(new Date($scope.myModel.dateofbirth), formate);
|
|
myModel.switchsetting = myModel.switchsetting === true ? 1 : 0;
|
|
// myModelCourseAdd.dateofjoining = $filter('date')(new Date(myModelCourseAdd.dateofjoining), formate);
|
|
var idStuProof = $scope.files[0];
|
|
|
|
if (idStuProof !== undefined) {
|
|
var formData = new FormData();
|
|
var idProof = $scope.files[0];
|
|
// alert(idProof);
|
|
formData.append("data", JSON.stringify(myModel));
|
|
formData.append("coursedata", JSON.stringify(myModelCourseAdd));
|
|
formData.append("createdBy", localDetails.localUserID);
|
|
formData.append("loginBranch", localDetails.localBranchID);
|
|
formData.append('idStuProof', idStuProof);
|
|
|
|
$http.post(apiPoint.url + 'insertStudentImg/', formData, {
|
|
transformRequest: angular.identity,
|
|
headers: { 'Content-Type': undefined, 'Process-Data': false },
|
|
}).success(function (data) {
|
|
if (data.addStudentStatus == true) {
|
|
swal(" ", "Student added successfully.", "success");
|
|
$scope.disableButton = false;
|
|
$scope.viewStudentDetailsPage = false;
|
|
$state.go($state.current, {}, { reload: true });
|
|
$scope.myActivateDiv();
|
|
// $scope.tabactive2 = false;
|
|
// $scope.viewStudentDetailsPage = false;
|
|
// $scope.tabActive('tabactive1');
|
|
} else {
|
|
// $scope.ldloading1[loading.replace('-', '_')] = false;
|
|
swal(" ", data.message, "error");
|
|
$scope.disableButton = false;
|
|
}
|
|
});
|
|
} else {
|
|
var req = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'insertStudent/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: myModel,
|
|
coursedata: myModelCourseAdd,
|
|
loginBranch: localDetails.localBranchID,
|
|
createdBy: localDetails.localUserID,
|
|
}
|
|
};
|
|
$http(req).then(function (response) {
|
|
if (response.data.addStudentStatus === true) {
|
|
swal("", "Student added successfully.", "success");
|
|
$scope.disableButton = false;
|
|
$scope.viewStudentDetailsPage = false;
|
|
$state.go($state.current, {}, { reload: true });
|
|
$scope.myActivateDiv();
|
|
// $scope.tabactive1 = true;
|
|
// $scope.tabactive2 = false;
|
|
|
|
// $scope.tabActive('tabactive1');
|
|
} else {
|
|
$scope.disableButton = false;
|
|
swal(" ", response.data.message, "error");
|
|
}
|
|
});
|
|
}
|
|
}
|
|
},
|
|
reset: function (form) {
|
|
// $scope.myModel = angular.copy($scope.master);
|
|
form.$setPristine(true);
|
|
$scope.myModel = {
|
|
'primaryPhone': '',
|
|
'firstname': '',
|
|
'lastname': '',
|
|
'fathername': '',
|
|
'mothername': '',
|
|
'emailId': '',
|
|
'secondaryPhone': '',
|
|
'dateofbirth': '',
|
|
'gender': '',
|
|
'aadharNumber': '',
|
|
'otherId': '',
|
|
'otherIdDetails': '',
|
|
'address1': '',
|
|
'address2': '',
|
|
'caste': '',
|
|
'category': '',
|
|
'religion': '',
|
|
'nationality': '',
|
|
'prequalification': '',
|
|
'occupation': '',
|
|
'designation': '',
|
|
'companyname': '',
|
|
'referredby': '',
|
|
'referredmobilenumber': '',
|
|
'switchsetting': true,
|
|
'DeactiveComments': '',
|
|
'Comments': '',
|
|
'admittedBy':''
|
|
};
|
|
$scope.myModelCourseAdd = {
|
|
'university': '',
|
|
'course': '',
|
|
'batch': '',
|
|
'dateofjoining': '',
|
|
'enrollmentid': '',
|
|
'specilization1': '',
|
|
'specilization2': ''
|
|
};
|
|
}, resetCourse: function (form) {
|
|
form.$setPristine(true);
|
|
$scope.myModelCourse = {
|
|
'university': '',
|
|
'course': '',
|
|
'batch': '',
|
|
'dateofjoining': '',
|
|
'enrollmentid': '',
|
|
'specilization1': '',
|
|
'specilization2': ''
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
// update check mobile exist
|
|
$scope.updateCheckMobileExist = function (p) {
|
|
var checkReq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'chkUpdateStuExistDetail/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
exceptId: p.StudentID,
|
|
datas: p.MobileNumber,
|
|
check: 'mobileNumber'
|
|
}
|
|
};
|
|
$http(checkReq).then(function (response) {
|
|
if (response.data.existMobile == true) {
|
|
// swal("Warning!", response.data.message, "warning");
|
|
p.MobileNumber = response.data.resetValue.MobileNumber;
|
|
} else {
|
|
}
|
|
});
|
|
}
|
|
|
|
// update check email id exist
|
|
$scope.updateCheckEmailExist = function (p) {
|
|
var checkReq = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'chkUpdateStuExistDetail/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
exceptId: p.StudentID,
|
|
datas: p.EmailID,
|
|
check: 'emailId'
|
|
}
|
|
};
|
|
$http(checkReq).then(function (response) {
|
|
if (response.data.existEmailId == true) {
|
|
swal("Warning!", response.data.message, "warning");
|
|
p.EmailID = response.data.resetValue.EmailID;
|
|
} else {
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
// start : entrollment document upload =============================
|
|
|
|
$scope.studentDocumentsList = '';
|
|
// get Student Document Details
|
|
$scope.getStuEntrollDocDetails = function (stuId) {
|
|
// $scope.studentDocumentsList = '';
|
|
var getStudentDocDetails = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getListofStuDocDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
exceptId: stuId,
|
|
localData: localDetail
|
|
}
|
|
};
|
|
$http(getStudentDocDetails).then(function (response) {
|
|
if (response.data.docListStatus == true) {
|
|
$scope.docNotFound = false;
|
|
$scope.studentDocumentsList = response.data.student_doc_details;
|
|
} else {
|
|
$scope.docNotFound = true;
|
|
// $scope.studentDocumentsList.call();
|
|
}
|
|
});
|
|
}
|
|
|
|
$scope.deleteDocDetails = function (id, stuID) {
|
|
SweetAlert.swal({
|
|
title: "Warning!",
|
|
text: "Want to Delete this file ?",
|
|
type: "warning",
|
|
showCancelButton: true,
|
|
confirmButtonColor: "#007aff",
|
|
confirmButtonText: "Yes!"
|
|
}, function (res) {
|
|
if (res === true) {
|
|
// alert(id);
|
|
// alert(stuId);
|
|
$scope.documentAddDetailsLoading = true;
|
|
var deleteDocEntry = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'deleteStuDocDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
exceptId: stuID,
|
|
docDetailsID: id,
|
|
localData: localDetail
|
|
}
|
|
};
|
|
$http(deleteDocEntry).then(function (response) {
|
|
if (response.data.deleteStatus == true) {
|
|
// swal("Success!", response.data.message, "success");
|
|
$scope.documentAddDetailsLoading = false;
|
|
$scope.studentDocumentsList = '';
|
|
$scope.getStuEntrollDocDetails(stuID);
|
|
} else {
|
|
swal(" ", res.data.message, "error");
|
|
$scope.documentAddDetailsLoading = false;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
$scope.myModelAddDocuments = {
|
|
"documentName": "",
|
|
"documentComments": ""
|
|
}
|
|
|
|
//an array of documents selected
|
|
$scope.filesDocuments = [];
|
|
//listen for the document selected event
|
|
$scope.$on("fileSelectedDocument", function (event, args) {
|
|
$scope.$apply(function () {
|
|
//add the file object to the scope's files collection
|
|
$scope.filesDocuments[0] = args.file;
|
|
});
|
|
});
|
|
|
|
$scope.documentAddDetailsLoading = false;
|
|
$scope.studentEntrollDocFORM = {
|
|
submit: function (form, myModelAddDocuments, stuID) {
|
|
|
|
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("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
|
} else {
|
|
|
|
if ($scope.filesDocuments[0] == undefined || $scope.filesDocuments[0] == null || $scope.filesDocuments.length === 0) {
|
|
swal("Warning!", "Choose the File.", "warning");
|
|
} else {
|
|
$scope.documentAddDetailsLoading = true;
|
|
var formData = new FormData();
|
|
var stuDocProof = $scope.filesDocuments[0];
|
|
var stuDocProofStatus = $scope.filesDocuments[0] !== undefined ? true : false;
|
|
|
|
formData.append("data", JSON.stringify(myModelAddDocuments));
|
|
formData.append("studentID", stuID);
|
|
formData.append("updatedBy", localDetails.localUserID);
|
|
formData.append('stuDocProof', stuDocProof);
|
|
formData.append('stuDocProof_Status', stuDocProofStatus);
|
|
|
|
$http.post(apiPoint.url + 'addStudentEntrollDocDetails/', formData, {
|
|
transformRequest: angular.identity,
|
|
headers: { 'Content-Type': undefined, 'Process-Data': false },
|
|
}).success(function (res) {
|
|
if (res.stuDocUpdateStatus == true) {
|
|
$scope.getStuEntrollDocDetails(stuID);
|
|
// swal(" ", "Updated successfully.", "success");
|
|
$scope.documentAddDetailsLoading = false;
|
|
$scope.filesDocuments[0] = undefined;
|
|
form.$setPristine(true);
|
|
angular.element("input[type='file']").val(null);
|
|
$scope.myModelAddDocuments = {
|
|
"documentName": "",
|
|
"documentComments": ""
|
|
}
|
|
// $scope.getStudentList();
|
|
// $scope.editId = -1;
|
|
// $scope.editSaveButtonDisable = false;
|
|
} else {
|
|
swal(" ", res.data.message, "error");
|
|
$scope.documentAddDetailsLoading = false;
|
|
// $scope.editSaveButtonDisable = false;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
},
|
|
reset: function (form) {
|
|
$scope.filesDocuments[0] = undefined;
|
|
form.$setPristine(true);
|
|
angular.element("input[type='file']").val(null);
|
|
}
|
|
}
|
|
|
|
|
|
// $scope.PendingDocNotFound = false;
|
|
// student pending document details
|
|
$scope.getStudentPendingEntrolDocDetails = function(stuId) {
|
|
// $scope.studentDocumentsList = '';
|
|
|
|
var getStudentPendingDocDetails = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getListofStuPendingDocDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
exceptId: stuId,
|
|
localData: localDetail
|
|
}
|
|
};
|
|
$http(getStudentPendingDocDetails).then(function (response) {
|
|
if (response.data.PendingDocListStatus == true) {
|
|
// $scope.PendingDocNotFound = false;
|
|
$scope.studentPendingDocumentsDetails = response.data.student_pending_doc_details;
|
|
|
|
console.log($scope.studentPendingDocumentsDetails);
|
|
|
|
} else {
|
|
// $scope.PendingDocNotFound = true;
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
$scope.myModelAddPendingDocDetails = {
|
|
"documentDetails": "",
|
|
"course":"",
|
|
"checkTracking": false
|
|
}
|
|
|
|
$scope.documentTrackAddDetailsLoading = false;
|
|
|
|
$scope.studentEntrollPendingDocFORM = {
|
|
submit: function (form, myModelAddPendingDocDetails, stuID) {
|
|
|
|
// console.log(myModelAddPendingDocDetails);
|
|
// console.log(form);
|
|
// console.log(stuID);
|
|
// // alert('in');
|
|
// return false;
|
|
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("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
|
} else {
|
|
$scope.documentTrackAddDetailsLoading = true;
|
|
$scope.docFollowupDate = new Date(myModelAddPendingDocDetails.documentDate).toDateString();
|
|
//alert($filter('date')(new Date($scope.docFollowupDate),'dd-MM-yyyy'));
|
|
// exist();
|
|
var ModelDetails = {
|
|
"student" : stuID,
|
|
"doc_Details": myModelAddPendingDocDetails.documentDetails,
|
|
"checkTracking": myModelAddPendingDocDetails.checkTracking,
|
|
"CourseID":myModelAddPendingDocDetails.course,
|
|
"documentdate" :$filter('date')(new Date($scope.docFollowupDate),'dd-MM-yyyy')
|
|
};
|
|
var updateStudentPendingDocDetails = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'addStudentEnrollPendingDocDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
updateDetails: ModelDetails,
|
|
localData: localDetail
|
|
}
|
|
};
|
|
$http(updateStudentPendingDocDetails).then(function (response) {
|
|
if (response.data.AddStuPendingDocStatus == true) {
|
|
$scope.getStudentPendingEntrolDocDetails(stuID);
|
|
$scope.documentTrackAddDetailsLoading = false;
|
|
$scope.myModelAddPendingDocDetails = {
|
|
"documentDetails": "",
|
|
"checkTracking": false
|
|
}
|
|
form.$setPristine(true);
|
|
} else {
|
|
swal(" ", res.data.message, "error");
|
|
$scope.documentTrackAddDetailsLoading = false;
|
|
}
|
|
});
|
|
}
|
|
},
|
|
reset: function (form) {
|
|
$scope.myModelAddPendingDocDetails = {
|
|
"documentDetails": "",
|
|
"course":"",
|
|
"checkTracking": false
|
|
}
|
|
}
|
|
}
|
|
|
|
$scope.deletePendingDocDetails = function(details, StuID, Url) {
|
|
// alert(JSON.stringify(details));
|
|
|
|
SweetAlert.swal({
|
|
title: "Warning!",
|
|
text: "Want to Delete this Entry ?",
|
|
type: "warning",
|
|
showCancelButton: true,
|
|
confirmButtonColor: "#007aff",
|
|
confirmButtonText: "Yes!"
|
|
}, function (res) {
|
|
if (res === true) {
|
|
$scope.documentTrackAddDetailsLoading = true;
|
|
var deleteDocEntry = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'deleteDocPendingDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
exceptId: details.ID,
|
|
localData: localDetail
|
|
}
|
|
};
|
|
$http(deleteDocEntry).then(function (response) {
|
|
if (response.data.deleteStatus == true) {
|
|
// swal("Success!", response.data.message, "success");
|
|
$scope.documentTrackAddDetailsLoading = false;
|
|
// $scope.studentDocumentsList = '';
|
|
$scope.getStudentPendingEntrolDocDetails(StuID);
|
|
} else {
|
|
swal(" ", res.data.message, "error");
|
|
$scope.documentTrackAddDetailsLoading = false;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
// end : entrollment document upload ====================================
|
|
|
|
|
|
|
|
$scope.stepsModelEdit = [];
|
|
$scope.imageUploadEdit = function (event) {
|
|
var files = event.target.files; //FileList object
|
|
|
|
for (var i = 0; i < files.length; i++) {
|
|
var file = files[i];
|
|
var reader = new FileReader();
|
|
reader.onload = $scope.imageIsLoadedEdit;
|
|
reader.readAsDataURL(file);
|
|
}
|
|
}
|
|
|
|
$scope.imageIsLoadedEdit = function (e) {
|
|
$scope.$apply(function () {
|
|
// $scope.stepsModel.push(e.target.result);
|
|
$scope.stepsModelEdit[0] = e.target.result;
|
|
});
|
|
}
|
|
|
|
//an array of files selected
|
|
$scope.filesEdit = [];
|
|
//listen for the file selected event
|
|
$scope.$on("fileSelectedEdit", function (event, args) {
|
|
$scope.$apply(function () {
|
|
//add the file object to the scope's files collection
|
|
$scope.filesEdit[0] = args.file;
|
|
});
|
|
});
|
|
|
|
|
|
// reset image for Edit
|
|
$scope.resetImageEdit = function () {
|
|
$scope.filesEdit.length = 0;
|
|
$scope.stepsModelEdit.length = 0;
|
|
}
|
|
|
|
$scope.editSaveButtonDisable = false;
|
|
// update student details
|
|
$scope.updateStuDetails = function (form, p, hidedob) {
|
|
var firstError = null;
|
|
|
|
|
|
// console.log($scope.OldPhone);
|
|
|
|
|
|
// console.log($scope.CopyModel);return false;
|
|
|
|
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("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
|
} else {
|
|
// alert(p.DOB);
|
|
var idProof = $scope.filesEdit[0];
|
|
$scope.editSaveButtonDisable = true;
|
|
var formate = "dd-MM-yyyy";
|
|
var checkDOB = $filter('date')(new Date(p.DOB), formate);
|
|
p.IsActive = p.IsActive === true ? 1 : 0;
|
|
p.LoginAccess = p.LoginAccess === true ? 1 : 0;
|
|
p.DOB = p.DOB == hidedob ? p.DOB : $filter('date')(new Date(p.DOB), formate);
|
|
|
|
if (idProof == undefined) {
|
|
// alert(idProof);
|
|
var req = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'updateStudentExistDetail/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
data: p,
|
|
updatedBy: localDetails.localUserID,
|
|
OldPhone: $scope.OldPhone,
|
|
OldDetails:$scope.CopyModel
|
|
}
|
|
};
|
|
$http(req).then(function (response) {
|
|
if (response.data.updateStuStatus === true) {
|
|
swal("", "Updated successfully.", "success");
|
|
$scope.getStudentList();
|
|
$scope.editId = -1;
|
|
$scope.editSaveButtonDisable = false;
|
|
} else {
|
|
// $scope.ldloading1[loading.replace('-', '_')] = false;
|
|
// alert(response.data.message);
|
|
swal("", response.data.message, "error");
|
|
$scope.editSaveButtonDisable = false;
|
|
}
|
|
});
|
|
} else {
|
|
var formData = new FormData();
|
|
var idStuUpProof = $scope.filesEdit[0];
|
|
// alert(idProof);
|
|
formData.append("data", JSON.stringify(p));
|
|
formData.append("updatedBy", localDetails.localUserID);
|
|
formData.append('idStuUpProof', idStuUpProof);
|
|
|
|
$http.post(apiPoint.url + 'updateStudentImgDetails/', formData, {
|
|
transformRequest: angular.identity,
|
|
headers: { 'Content-Type': undefined, 'Process-Data': false },
|
|
}).success(function (response) {
|
|
if (response.updateStuStatus == true) {
|
|
swal("", "Updated successfully.", "success");
|
|
$scope.getStudentList();
|
|
$scope.editId = -1;
|
|
$scope.editSaveButtonDisable = false;
|
|
} else {
|
|
// $scope.ldloading1[loading.replace('-', '_')] = false;
|
|
// swal("", data.message, "error");
|
|
swal("", response.data.message, "error");
|
|
$scope.editSaveButtonDisable = false;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}]);
|
|
|
|
// file upload directive
|
|
app.directive('fileUpload', function () {
|
|
return {
|
|
scope: true, //create a new scope
|
|
link: function (scope, el, attrs) {
|
|
el.bind('change', function (event) {
|
|
var files = event.target.files;
|
|
//iterate files since 'multiple' may be specified on the element
|
|
for (var i = 0; i < files.length; i++) {
|
|
//emit event upward
|
|
scope.$emit("fileSelected", { file: files[i] });
|
|
}
|
|
});
|
|
}
|
|
};
|
|
});
|
|
|
|
|
|
// file upload directive
|
|
app.directive('fileUploadEdit', function () {
|
|
return {
|
|
scope: true, //create a new scope
|
|
link: function (scope, el, attrs) {
|
|
el.bind('change', function (event) {
|
|
var files = event.target.files;
|
|
//iterate files since 'multiple' may be specified on the element
|
|
for (var i = 0; i < files.length; i++) {
|
|
//emit event upward
|
|
scope.$emit("fileSelectedEdit", { file: files[i] });
|
|
}
|
|
});
|
|
}
|
|
};
|
|
});
|
|
|
|
// file upload directive - file-upload-document
|
|
app.directive('fileUploadDocument', function () {
|
|
return {
|
|
scope: true, //create a new scope
|
|
link: function (scope, el, attrs) {
|
|
el.bind('change', function (event) {
|
|
var files = event.target.files;
|
|
//iterate files since 'multiple' may be specified on the element
|
|
for (var i = 0; i < files.length; i++) {
|
|
//emit event upward
|
|
scope.$emit("fileSelectedDocument", { file: files[i] });
|
|
}
|
|
});
|
|
}
|
|
};
|
|
});
|
|
|
|
app.filter('unique', function () {
|
|
return function (collection, primaryKey, secondaryKey) { //optional secondary key
|
|
var output = [],
|
|
keys = [];
|
|
|
|
angular.forEach(collection, function (item) {
|
|
var key;
|
|
secondaryKey === undefined ? key = item[primaryKey] : key = item[primaryKey][secondaryKey];
|
|
|
|
if (keys.indexOf(key) === -1) {
|
|
keys.push(key);
|
|
output.push(item);
|
|
}
|
|
});
|
|
|
|
return output;
|
|
};
|
|
});
|
|
/*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.StudentID,
|
|
requestedFrom: 1,
|
|
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) {
|
|
|
|
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");
|
|
});
|
|
}
|
|
|
|
|
|
}]);
|
|
|
|
// 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');
|
|
};
|
|
|
|
|
|
}]);
|
|
|
|
|
|
// Hook in a directive
|
|
app.directive('fileDownload', function($window){
|
|
|
|
// alert(path);
|
|
return {
|
|
restrict: 'E', // applied on 'element'
|
|
scope: {
|
|
fileurl: '@fileurl',
|
|
linktext: '@linktext'
|
|
},
|
|
controller: function($scope) {
|
|
$scope.path = $window.location.origin + $window.location.pathname + 'images/';
|
|
},
|
|
template: '<a href="{{ path }}{{ fileurl }}" download><button tooltip="Download" class="btn btn-xs btn-primary"><i class="ti-download"> </i></button></a>', // need this so that the inner HTML can be re-used
|
|
link: function(scope, elem, attrs) {
|
|
/* Ref: https://thinkster.io/egghead/isolate-scope-at
|
|
* This block is used when we have
|
|
* scope: {
|
|
fileurl: '=fileurl',
|
|
linktext: '=linktext'
|
|
}
|
|
scope.fileurl = attrs.fileurl;
|
|
scope.linktext = attrs.linktext;*/
|
|
}
|
|
}
|
|
})
|
|
|
|
app.directive('capitalizeFirst', function($parse) {
|
|
return {
|
|
require: 'ngModel',
|
|
link: function(scope, element, attrs, modelCtrl) {
|
|
var capitalize = function(inputValue) {
|
|
if (inputValue === undefined) { inputValue = ''; }
|
|
var capitalized = inputValue.charAt(0).toUpperCase() +
|
|
inputValue.substring(1);
|
|
if(capitalized !== inputValue) {
|
|
modelCtrl.$setViewValue(capitalized);
|
|
modelCtrl.$render();
|
|
}
|
|
return capitalized;
|
|
}
|
|
modelCtrl.$parsers.push(capitalize);
|
|
capitalize($parse(attrs.ngModel)(scope)); // capitalize initial value
|
|
}
|
|
};
|
|
}); |