course master changes for duplication validations

This commit is contained in:
gandhimathi 2018-08-24 14:45:29 +05:30
parent bb2732917a
commit 1134bc5018
3 changed files with 207 additions and 87 deletions

View File

@ -207,49 +207,66 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab
}
else{
$scope.ldloading1 = {};
$scope.ldloading1[loading.replace('-', '_')] = true;
/* check duplication objects values */
if(semYearModel.program=='Y001'){
$scope.myModelSemYear.programName="";
$scope.myModelSemYear.FeesAmount="";
var valueArr = $scope.addMoreItems.map(function(item){ return item.programName });
var isDuplicate = valueArr.some(function(item, idx){
return valueArr.indexOf(item) != idx;
});
}
if(semYearModel.program=='Y001' && isDuplicate==true){
swal("Warning!", 'Sem/Year Duplication ', "warning");
}
else{
$scope.ldloading1 = {};
$scope.ldloading1[loading.replace('-', '_')] = true;
var addCourse = {
method: 'POST',
url: apiPoint.url + 'addCourseDetails/',
headers: {
'Content-Type': 'application/json'
},
data: {
courseCode: myModel.courseCode,
courseName: myModel.courseName,
universityName: myModel.universityName,
feesType:myModel.ListName.ListCode,
status: myModel.switchsetting,
provFess:myModel.provFess,
transferAmount:myModel.transferAmount,
degreeAmount:myModel.degreeAmount,
migrationAmount:myModel.migrationAmount,
otherAmount:myModel.otherAmount,
regularFeesAmounts:regularModel,
lateralFeesAmounts:lateralModel,
semFeesAmounts:$scope.addMoreItems,
createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
specilization1:myModel.specilization1,
specilization2:myModel.specilization2,
// subjects:myModel.subject,
branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID
}
};
$http(addCourse).then(function (response) {
if (response.data.status==200 && response.data.courseStatus) {
$scope.ldloading1[loading.replace('-', '_')] = false;
swal(" ", "Course added successfully.", "success");
$state.go($state.current, {}, {reload: true});
} else {
$scope.addMoreItems.splice($scope.addMoreItems.length-1);
$scope.ldloading1[loading.replace('-', '_')] = false;
swal(" ", response.data.message, "error");
}
});
var addCourse = {
method: 'POST',
url: apiPoint.url + 'addCourseDetails/',
headers: {
'Content-Type': 'application/json'
},
data: {
courseCode: myModel.courseCode,
courseName: myModel.courseName,
universityName: myModel.universityName,
feesType:myModel.ListName.ListCode,
status: myModel.switchsetting,
provFess:myModel.provFess,
transferAmount:myModel.transferAmount,
degreeAmount:myModel.degreeAmount,
migrationAmount:myModel.migrationAmount,
otherAmount:myModel.otherAmount,
regularFeesAmounts:regularModel,
lateralFeesAmounts:lateralModel,
semFeesAmounts:$scope.addMoreItems,
createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
specilization1:myModel.specilization1,
specilization2:myModel.specilization2,
// subjects:myModel.subject,
branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID
}
};
$http(addCourse).then(function (response) {
if (response.data.status==200 && response.data.courseStatus) {
$scope.ldloading1[loading.replace('-', '_')] = false;
swal(" ", "Course added successfully.", "success");
$state.go($state.current, {}, {reload: true});
} else {
$scope.addMoreItems.splice($scope.addMoreItems.length-1);
$scope.ldloading1[loading.replace('-', '_')] = false;
swal(" ", response.data.message, "error");
}
});
}
}
@ -296,57 +313,73 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab
FeesAmount: semYear.FeesAmount
});
}
$scope.ldloading = {};
/* check duplication objects values */
if(semYear.program=='Y001'){
$scope.myModelSemYear1.programName="";
$scope.myModelSemYear1.FeesAmount="";
var valueArr = $rootScope.updateMoreItems.map(function(item){ return item.programName });
var isDuplicate = valueArr.some(function(item, idx){
return valueArr.indexOf(item) != idx;
});
}
if(semYear.program=='Y001' && isDuplicate==true){
$scope.ldloading[loading.replace('-', '_')] = true;
swal("Warning!", 'Sem/Year Duplication ', "warning");
}
else{
$scope.ldloading = {};
$scope.ldloading[loading.replace('-', '_')] = true;
var update = {
method: 'POST',
url: apiPoint.url + 'updateCourseDetails/',
headers: {
'Content-Type': 'application/json'
},
data: {
courseID: myModel.CourseID,
universityID: myModel.UniversityID,
courseCode: myModel.CourseCode,
courseName: myModel.CourseName,
provFess:myModel.PC,
transferAmount:myModel.TC,
degreeAmount:myModel.DC,
migrationAmount:myModel.MC,
otherAmount:myModel.OtherFees,
feesAmounts:myModel.feesStructures,
regularFeesAmounts:regular,
lateralFeesAmounts:lateral,
semFeesAmounts:$rootScope.updateMoreItems,
status: myModel.IsActive,
updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
specilization1:myModel.Specilization1,
specilization2:myModel.Specilization2,
existCourseID:myModel.CourseID,
// subjects:subjects.list,
branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID
var update = {
method: 'POST',
url: apiPoint.url + 'updateCourseDetails/',
headers: {
'Content-Type': 'application/json'
},
data: {
courseID: myModel.CourseID,
universityID: myModel.UniversityID,
courseCode: myModel.CourseCode,
courseName: myModel.CourseName,
provFess:myModel.PC,
transferAmount:myModel.TC,
degreeAmount:myModel.DC,
migrationAmount:myModel.MC,
otherAmount:myModel.OtherFees,
feesAmounts:myModel.feesStructures,
regularFeesAmounts:regular,
lateralFeesAmounts:lateral,
semFeesAmounts:$rootScope.updateMoreItems,
status: myModel.IsActive,
updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
specilization1:myModel.Specilization1,
specilization2:myModel.Specilization2,
existCourseID:myModel.CourseID,
// subjects:subjects.list,
branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID
}
};
$http(update).then(function (response) {
if (response.data.status==200 && response.data.courseStatus) {
$scope.ldloading[loading.replace('-', '_')] = false;
$rootScope.updateMoreItems=[];
$rootScope.init();
swal(" ", "Updated successfully.", "success");
}
};
$http(update).then(function (response) {
if (response.data.status==200 && response.data.courseStatus) {
$scope.ldloading[loading.replace('-', '_')] = false;
$rootScope.updateMoreItems=[];
$rootScope.init();
swal(" ", "Updated successfully.", "success");
$scope.editId = -1;
$scope.editId = -1;
} else {
$scope.ldloading[loading.replace('-', '_')] = false;
// $rootScope.init();
swal(" ", response.data.message, "error");
}
});
} else {
$scope.ldloading[loading.replace('-', '_')] = false;
// $rootScope.init();
swal(" ", response.data.message, "error");
}
});
}
}
};
/*

View File

@ -309,7 +309,7 @@
<input type="text" placeholder="Enter Regular Fees Amt"
autofocus tabindex="7" class="form-control" name="regularFees" id="regularFees" ng-maxlength="8"
ng-model="myModelRegular.FeesAmount" ng-disabled="myModelLateral.FeesAmount!='' || myModelSemYear.programName!='' || myModelSemYear.FeesAmount!=''" ng-pattern="/^[0-9]*$/"/>
ng-model="myModelRegular.FeesAmount" ng-disabled="myModelLateral.FeesAmount!='' || myModelSemYear.programName!='' || myModelSemYear.FeesAmount!='' || addMoreItems.length!=0" ng-pattern="/^[0-9]*$/"/>
<span class="error text-small block"
ng-if="Form.regularFees.$error.maxlength || Form.regularFees.$error.pattern">Enter a valid amount</span>
@ -322,7 +322,7 @@
<input type="text" placeholder="Enter Lateral Fees Amt"
autofocus tabindex="8" class="form-control" name="lateralFees" id="lateralFees" ng-maxlength="8"
ng-model="myModelLateral.FeesAmount" ng-disabled="myModelRegular.FeesAmount!='' || myModelSemYear.programName!='' || myModelSemYear.FeesAmount!=''" ng-pattern="/^[0-9]*$/"/>
ng-model="myModelLateral.FeesAmount" ng-disabled="myModelRegular.FeesAmount!='' || myModelSemYear.programName!='' || myModelSemYear.FeesAmount!='' || addMoreItems.length!=0" ng-pattern="/^[0-9]*$/"/>
<span class="error text-small block"
ng-if="Form.lateralFees.$error.maxlength || Form.lateralFees.$error.pattern">Enter a valid amount</span>

View File

@ -290,8 +290,95 @@
</div>
</div>
<div class="col-md-6" ng-if="updateMoreItems.length==0">
<fieldset>
<div class="row">
<div class="col-md-6 form-group"
ng-class="{'has-error':Form.provFess.$dirty && Form.provFess.$invalid}">
<label>
Prov Cert Fees
</label>
<div class="col-md-6">
<input type="text" placeholder="Enter Prov Cert Fees"
autofocus tabindex="11" class="form-control" name="provFess" id="provFess" ng-maxlength="8"
ng-model="p.PC" ng-pattern="/^[0-9]*$/">
<span class="error text-small block"
ng-if="Form.provFess.$error.maxlength || Form.provFess.$error.pattern">Enter a valid amount</span>
</div>
<div class="col-md-6 form-group"
ng-class="{'has-error':Form.transferAmount.$dirty && Form.transferAmount.$invalid}">
<label>
Transfer Cert Fees
</label>
<input type="text" placeholder="Enter transfer Cert Fees"
autofocus tabindex="12" class="form-control" name="transferAmount" id="transferAmount" ng-maxlength="8"
ng-model="p.TC" ng-pattern="/^[0-9]*$/">
<span class="error text-small block"
ng-if="Form.transferAmount.$error.maxlength || Form.transferAmount.$error.pattern">Enter a valid amount</span>
</div>
</div>
<div class="row">
<div class="col-md-6 form-group"
ng-class="{'has-error':Form.degreeAmount.$dirty && Form.degreeAmount.$invalid}">
<label>
Degree Cert Fees
</label>
<input type="text" placeholder="Enter Degree Cert Fees"
autofocus tabindex="13" class="form-control" name="degreeAmount" id="degreeAmount" ng-maxlength="8"
ng-model="p.DC" ng-pattern="/^[0-9]*$/">
<span class="error text-small block"
ng-if="Form.degreeAmount.$error.maxlength || Form.degreeAmount.$error.pattern">Enter a valid amount</span>
</div>
<div class="col-md-6 form-group"
ng-class="{'has-error':Form.migrationAmount.$dirty && Form.migrationAmount.$invalid}">
<label>
Migration Cert Fees
</label>
<input type="text" placeholder="Enter Migration Cert Fees"
autofocus tabindex="14" class="form-control" name="migrationAmount" id="migrationAmount" ng-maxlength="8"
ng-model="p.MC" ng-pattern="/^[0-9]*$/">
<span class="error text-small block"
ng-if="Form.migrationAmount.$error.maxlength || Form.migrationAmount.$error.pattern">Enter a valid amount</span>
</div>
</div>
<div class="row">
<div class="col-md-6 form-group"
ng-class="{'has-error':Form.otherAmount.$dirty && Form.otherAmount.$invalid}">
<label>
Other Fees
</label>
<input type="text" placeholder="Enter Other Fees"
autofocus tabindex="15" class="form-control" name="otherAmount" id="otherAmount" ng-maxlength="8"
ng-model="p.OtherFees" ng-pattern="/^[0-9]*$/">
<span class="error text-small block"
ng-if="Form.otherAmount.$error.maxlength || Form.otherAmount.$error.pattern">Enter a valid amount</span>
</div>
</div>
</fieldset>
</div>
<div class="col-md-6" ng-if="updateMoreItems.length!=0">
<fieldset>
<legend >{{myModelSemYear1.FeesName}}</legend>