245 lines
6.3 KiB
JavaScript
245 lines
6.3 KiB
JavaScript
'use strict';
|
|
/*** controller***/
|
|
app.controller('datacorrectionCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state","$modal","$log",
|
|
function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state,$modal,$log){
|
|
|
|
//function ($scope, apiPoint, $http, SweetAlert, $state,$modal, md5, ipCookie, $window, dateListDescService) {
|
|
|
|
// DataTables configurable options
|
|
|
|
|
|
$scope.filters = {
|
|
|
|
"Date": "",
|
|
//"to_date": "",
|
|
|
|
};
|
|
|
|
|
|
|
|
// $scope.initHead = function() {
|
|
|
|
var logcheck = JSON.parse(localStorage.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.localStorage.clear();
|
|
$state.go('login.signin');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
$scope.init = function(){
|
|
|
|
console.log('gf');
|
|
}
|
|
|
|
|
|
|
|
// $scope.click = function (form,myModel)
|
|
// {
|
|
|
|
|
|
// alert()
|
|
// };
|
|
|
|
|
|
|
|
|
|
$scope.studentInfo="";
|
|
$scope.getStudentDetails = function (form,myModel) {
|
|
|
|
// console.log(form.$invalid)
|
|
// alert()
|
|
|
|
var mobileNumber = myModel.mobileNumber;
|
|
//console.log(mobileNumber);
|
|
var studentName = myModel.studentName;
|
|
//console.log(studentName);
|
|
var receipt = myModel.receipt;
|
|
//console.log(receipt);
|
|
|
|
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.isLoaderShow= false
|
|
var getStudent = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'getAllDayBookDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
studentName: myModel.studentName,
|
|
mobileNumber: myModel.mobileNumber,
|
|
receipt: myModel.receipt,
|
|
// 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;
|
|
console.log($scope.studentInfo);
|
|
|
|
} else {
|
|
$scope.studentInfo="";
|
|
|
|
$scope.isLoaderShow = true;
|
|
$scope.load = "No Records Found";
|
|
|
|
}
|
|
});
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// $scope.setDate = function(p)
|
|
// {
|
|
// alert()
|
|
// }
|
|
|
|
|
|
|
|
|
|
$scope.updatestatus = function (myModel, form, 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].$name;
|
|
}
|
|
if (form[field].$pristine) {
|
|
form[field].$dirty = true;
|
|
}
|
|
}
|
|
}
|
|
angular.element('.ng-invalid[name=' + firstError + ']').focus();
|
|
swal("Please Enter Reason!", "", "error");
|
|
} else {
|
|
|
|
var d = new Date(myModel.Date);
|
|
var mdate = d.getUTCDate() + 1;
|
|
var mmonth = d.getUTCMonth() + 1;
|
|
var myear = d.getUTCFullYear();
|
|
|
|
var CDate = mdate+"-"+mmonth+"-"+myear;
|
|
//console.log(CDate)
|
|
var IsActive = '';
|
|
|
|
if(myModel.IsActive == true)
|
|
{
|
|
IsActive =1;
|
|
}
|
|
|
|
else if(myModel.IsActive == false)
|
|
{
|
|
IsActive =0;
|
|
}
|
|
|
|
var updatedaybook = {
|
|
method: 'POST',
|
|
url: apiPoint.url + 'update_DayBookDetails/',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
data: {
|
|
studentName: myModel.studentName,
|
|
mobileNumber: myModel.mobileNumber,
|
|
receipt: myModel.receipt,
|
|
ID : myModel.ID,
|
|
FID : myModel.FID,
|
|
Date :myModel.Date,
|
|
Amount :myModel.Amount,
|
|
Reason : myModel.Reason,
|
|
IsActive : IsActive,
|
|
// 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(updatedaybook).then(function (response) {
|
|
swal('Change Saved Successfully', response.data.message, "success");
|
|
$scope.close();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.OpenWindowStatus = false;
|
|
$scope.editId = -1;
|
|
$scope.setEditId = function (P)
|
|
{ //alert(P);
|
|
$scope.editId = P;
|
|
}
|
|
|
|
$scope.close = function ()
|
|
{
|
|
$scope.editId = -1;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|