course details changes done

This commit is contained in:
gandhimathi 2017-12-23 18:43:22 +05:30
parent 124e2d9e1e
commit dd27c3104c

View File

@ -17,11 +17,6 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
$scope.updateModel = {
"feesType": "",
"sessionName": "",
"STF_WR": "",
"others": "",
"waiver": "",
"total": "",
"date": "",
"billNo": "",
"billAmount": "",
@ -30,6 +25,14 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
"studComments":"",
"statusCode":""
};
/*
* set model
* */
$scope.setModel = {
"feesType": "",
};
/*
* get payment options
@ -144,81 +147,33 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
* */
$scope.editId=-1;
$scope.updateFees = function (p) {
$scope.viewId=-1
$scope.getStudentFeesStructure(p.ID,p.CourseID,p.StudentID);
$scope.editId=p.ID;
}
/*
* set fees for student
* */
$scope.viewId=-1;
$scope.setFees = function (p) {
$scope.editId=-1;
$scope.getStudentSetFees(p.ID,p.CourseID,p.StudentID);
$scope.viewId=p.ID;
}
/*
* update total fees amount after change value
* created by kms
* */
$scope.changeTotalFees = function (model,type) {
if(type=='0'){
if(model.feesType.PendingFees=='' || model.feesType.PendingFees==undefined){
$scope.courseAmt=0;
}
else{
$scope.courseAmt=model.feesType.PendingFees;
}
if(model.feesType.STFOrWR=='' || model.feesType.STFOrWR==undefined || model.feesType.STFOrWR=='0'){
$scope.updateModel.STF_WR="";
$scope.STFWRAmt=0;
}
else{
$scope.STFWRAmt=model.feesType.STFOrWR;
$scope.updateModel.STF_WR=model.feesType.STFOrWR;
}
if(model.feesType.Others=='' || model.feesType.Others==undefined || model.feesType.Others=='0'){
$scope.otherAmt=0;
$scope.updateModel.others="";
}
else{
$scope.otherAmt=model.feesType.Others;
$scope.updateModel.others=model.feesType.Others;
}
if(model.feesType.Waiver=='' || model.feesType.Waiver==undefined || model.feesType.Waiver=='0'){
$scope.waiverAmt=0;
$scope.updateModel.waiver="";
}
else{
$scope.updateModel.waiver=model.feesType.Waiver;
}
}
else{
if(model.feesType.PendingFees=='' || model.feesType.PendingFees==undefined){
$scope.courseAmt=0;
}
else{
$scope.courseAmt=model.feesType.PendingFees;
}
if(model.STF_WR=='' || model.STF_WR==undefined){
$scope.STFWRAmt=0;
}
else{
$scope.STFWRAmt=model.STF_WR;
}
if(model.others=='' || model.others==undefined){
$scope.otherAmt=0;
}
else{
$scope.otherAmt=model.others;
}
if(model.waiver=='' || model.waiver==undefined){
$scope.waiverAmt=0;
}
else{
$scope.waiverAmt=model.waiver;
}
}
$scope.changeTotalFees = function (model) {
$scope.updateModel.billAmount = model.BalanceAmount;
$scope.updateModel.total = (parseFloat($scope.courseAmt)+parseFloat($scope.STFWRAmt)+parseFloat($scope.otherAmt))-parseFloat($scope.waiverAmt);
$scope.updateModel.billAmount = (parseFloat($scope.courseAmt)+parseFloat($scope.STFWRAmt)+parseFloat($scope.otherAmt))-parseFloat($scope.waiverAmt);
}
@ -267,12 +222,8 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
data: {
studID: myModel.StudentID,
courseID:myModel.CourseID,
courseAmount:updateModel.feesType.PendingFees,
feesID: updateModel.feesType.ID,
STFWR:updateModel.STF_WR,
waiver: updateModel.waiver,
other: updateModel.others,
session: updateModel.sessionName,
courseAmount:updateModel.feesType.ActualFees,
feesID: updateModel.feesType.FeesID,
billNO: updateModel.billNo,
billDate: $scope.billDate,
billAmount:updateModel.billAmount,
@ -293,8 +244,6 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
if (response.data.status==200 && response.data.paidStatus) {
$scope.ldloading[loading.replace('-', '_')] = false;
swal("Success!", response.data.message, "success");
$scope.getStudentFeesStructure(myModel.ID,myModel.CourseID,myModel.StudentID);
$scope.updateModel = {
"feesType": "",
"sessionName": "",
@ -311,11 +260,82 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
"statusCode":""
};
$scope.getStudentFeesStructure(myModel.ID,myModel.CourseID,myModel.StudentID);
} else {
$scope.ldloading[loading.replace('-', '_')] = false;
swal("Failed!", response.data.message, "error");
$scope.getStudentFeesStructure(myModel.ID,myModel.CourseID,myModel.StudentID);
//$scope.getStudentFeesStructure(myModel.ID,myModel.CourseID,myModel.StudentID);
}
});
}
};
/*
* set fees for student
* */
$scope.submitFeesForStudent = function (myModel, form,updateModel, loading) {
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].$stop_name;
}
if (form[field].$pristine) {
form[field].$dirty = true;
}
}
}
angular.element('.ng-invalid[name=' + firstError + ']').focus();
} else {
$scope.ldloading5 = {};
$scope.ldloading5[loading.replace('-', '_')] = true;
var updateFees = {
method: 'POST',
url: apiPoint.url + 'setFeesForStudent/',
headers: {
'Content-Type': 'application/json'
},
data: {
studID: myModel.StudentID,
courseID:myModel.CourseID,
courseAmount:updateModel.ActualFees,
feesID: updateModel.ID,
STFWR:updateModel.STFOrWR,
waiver: updateModel.Waiver,
other: updateModel.Others,
session: updateModel.SessionName,
rollNo: updateModel.RollNo,
createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
}
};
$http(updateFees).then(function (response) {
if (response.data.status==200 && response.data.setStatus) {
$scope.ldloading5[loading.replace('-', '_')] = false;
swal("Success!", response.data.message, "success");
$scope.getStudentSetFees(myModel.ID,myModel.CourseID,myModel.StudentID);
$scope.setModel = {
"feesType": "",
};
} else {
$scope.ldloading5[loading.replace('-', '_')] = false;
swal("Failed!", response.data.message, "error");
$scope.getStudentSetFees(myModel.ID,myModel.CourseID,myModel.StudentID);
}
});
@ -327,6 +347,10 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
* */
$scope.studentFeesInfo="";
$scope.getStudentFeesStructure = function(ID,courseID,studeID){
$scope.updateModel = {
"feesType": "",
};
$scope.studentFeesInfo="";
$scope.existStudentFeesDetails="";
$scope.getFeesUpdateStatus="";
@ -349,21 +373,75 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
$scope.existStudentFeesDetails = response.data.getExistStudentFeesDetails;
$scope.getFeesUpdateStatus = response.data.getFeesUpdateStatus;
} else {
$scope.studentFeesInfo="";
$scope.existStudentFeesDetails="";
$scope.getFeesUpdateStatus="";
swal("Warning!", response.data.message, "warning");
$scope.editId=-1;
}
});
}
/*
* get student set fees details
* */
$scope.feesStructureInfo="";
$scope.getStudentSetFees = function (ID,courseID,studeID) {
$scope.feesStructureInfo="";
var setFees = {
method: 'POST',
url: apiPoint.url + 'getStudentFeesAssign/',
headers: {
'Content-Type': 'application/json'
},
data: {
ID:ID,
courseID: courseID,
studentID: studeID,
requestedtBy: JSON.parse(localStorage.getItem('localObj')).localUserID
}
};
$http(setFees).then(function (response) {
if (response.data.status==200 && response.data.feesStatus) {
$scope.feesStructureInfo=response.data.feesDetails;
$scope.setModel = {
"feesType": "",
};
} else {
$scope.feesStructureInfo="";
$scope.setModel = {
"feesType": "",
};
}
});
}
/*
* set course fees amount
* */
/* $scope.changeFeesValues = function (model) {
console.log(model);
}*/
$scope.cancel = function () {
$scope.editId=-1;
$scope.studentFeesInfo="";
$scope.existStudentFeesDetails="";
$scope.getFeesUpdateStatus="";
$scope.viewId=-1;
}