From ef7985bb8cae55cdbaef378f41076962df971263 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Thu, 15 Feb 2018 09:36:48 +0530 Subject: [PATCH] course details changes done --- .../js/controllers/generateHallTicketCtrl.js | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 Apollo/assets/js/controllers/generateHallTicketCtrl.js diff --git a/Apollo/assets/js/controllers/generateHallTicketCtrl.js b/Apollo/assets/js/controllers/generateHallTicketCtrl.js new file mode 100644 index 00000000..40a40307 --- /dev/null +++ b/Apollo/assets/js/controllers/generateHallTicketCtrl.js @@ -0,0 +1,139 @@ +'use strict'; +/** + * controllers for ng-table + * Simple table with sorting and filtering on AngularJS + */ +app.controller('generateHallTicketCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state) { + $scope.myModel = { + "studentName": "", + "mobileNumber": "", + "universityName":"", + "courseName":"" + }; + + $rootScope.userType = JSON.parse(localStorage.getItem('localObj')).localType; + + + + // 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 + } + + /* + * init function + * created by kms + * */ + $scope.init = function () { + var getUniv = { + method: 'POST', + url: apiPoint.url + 'getUniversityCourseForFees/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + $http(getUniv).then(function (response) { + if (response.data.status==200 && response.data.universityStatus) { + $scope.university=response.data.univerSityDetails; + + + } else { + $scope.university=""; + + } + }); + } + + /* + * get student details + * created by kms + * */ + $scope.studentInfo=""; + $scope.getStudentDetails = function (form,myModel) { + if(myModel.universityName == null || myModel.universityName == '' || myModel.universityName == undefined){ + $scope.univId = ""; + } + else{ + $scope.univId = myModel.universityName.universityID; + } + 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 { + var getStudent = { + method: 'POST', + url: apiPoint.url + 'getStudentListFees/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + studentName: myModel.studentName, + mobileNumber: myModel.mobileNumber, + university: $scope.univId, + course:myModel.courseName, + requestedtBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID, + requestedDept: JSON.parse(localStorage.getItem('localObj')).localType, + } + }; + $http(getStudent).then(function (response) { + if (response.data.status==200 && response.data.studentStatus) { + $scope.studentInfo=response.data.details; + + } else { + $scope.studentInfo=""; + + } + }); + + } + } + + /* + * get course subjects details + * created by kms + * */ + $scope.getSubjectDetails = function (universityID,courseID) { + + var getsubject = { + method: 'POST', + url: apiPoint.url + 'getCourseSubjectDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + universityID : universityID, + courseID : courseID, + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + $http(getsubject).then(function (response) { + if (response.data.status==200 && response.data.universityStatus) { + $scope.university=response.data.univerSityDetails; + + + } else { + $scope.university=""; + + } + }); + } + +}]); \ No newline at end of file