course details changes done

This commit is contained in:
gandhimathi 2018-03-13 13:37:38 +05:30
parent e5c7aba490
commit 6c8471feae

View File

@ -1427,7 +1427,26 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter",
* update the follow up details * update the follow up details
* created by kms * created by kms
* */ * */
$rootScope.updateFollowup = function (followupDetails,myModel1, loading) { $rootScope.updateFollowup = function (form,followupDetails,myModel1, 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("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
}
else{
if(isNaN(myModel1.date)){ if(isNaN(myModel1.date)){
$scope.nextFollowupDate = myModel1.date; $scope.nextFollowupDate = myModel1.date;
@ -1479,6 +1498,9 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter",
comments: myModel1.comments, comments: myModel1.comments,
updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
branchId: $scope.updateBranchID, branchId: $scope.updateBranchID,
address: myModel1.Address,
alternateMobile: myModel1.AlternateMobile,
referredBy: myModel1.ReferredBy,
} }
}; };
$http(update).then(function (response) { $http(update).then(function (response) {
@ -1493,6 +1515,7 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter",
} }
}); });
} }
}
}; };
$rootScope.loadFollowupDetails = function (trackID) { $rootScope.loadFollowupDetails = function (trackID) {
@ -1515,9 +1538,14 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter",
if (response.data.status==200 && response.data.followupStatus) { if (response.data.status==200 && response.data.followupStatus) {
$rootScope.followupDetails=response.data.trackingDetails[0]; $rootScope.followupDetails=response.data.trackingDetails[0];
$rootScope.myModel1.status=$rootScope.followupDetails.StatusCode; $rootScope.myModel1.status=$rootScope.followupDetails.StatusCode;
if($rootScope.followupDetails.followupDetails[0].FollowupOn.length==10){
$rootScope.currentDate1 = new Date($rootScope.followupDetails.followupDetails[0].FollowupOn.substring(6,10)+'-'+$rootScope.followupDetails.followupDetails[0].FollowupOn.substring(3,5)+'-'+$rootScope.followupDetails.followupDetails[0].FollowupOn.substring(0,2));
}
else{
$rootScope.currentDate1=new Date().getFullYear() + '-' + ('0' + (new Date().getMonth() + 1)).slice(-2) + '-' + ('0' + new Date().getDate()).slice(-2); $rootScope.currentDate1=new Date().getFullYear() + '-' + ('0' + (new Date().getMonth() + 1)).slice(-2) + '-' + ('0' + new Date().getDate()).slice(-2);
}
$rootScope.myModel1.date=$rootScope.followupDetails.followupDetails[0].FollowupOn; $rootScope.myModel1.date=$rootScope.followupDetails.followupDetails[0].FollowupOn;
// get 30 plus date for follwup details // get 30 plus date for follwup details
$rootScope.modifyDate1 = moment(); $rootScope.modifyDate1 = moment();
@ -1527,6 +1555,9 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter",
$rootScope.trackingStatus=response.data.statusDetails; $rootScope.trackingStatus=response.data.statusDetails;
$rootScope.myModel1.branch=$rootScope.followupDetails.CreatedBranch; $rootScope.myModel1.branch=$rootScope.followupDetails.CreatedBranch;
$rootScope.myModel1.assignStaff=$rootScope.followupDetails.AssignedTo; $rootScope.myModel1.assignStaff=$rootScope.followupDetails.AssignedTo;
$rootScope.myModel1.AlternateMobile=$rootScope.followupDetails.AlternateMobile;
$rootScope.myModel1.Address=$rootScope.followupDetails.Address;
$rootScope.myModel1.ReferredBy=$rootScope.followupDetails.ReferredBy;
$rootScope.staffArray=''; $rootScope.staffArray='';
$rootScope.staffDetails=response.data.staffDetails; $rootScope.staffDetails=response.data.staffDetails;
if($scope.userType =='R004'){ if($scope.userType =='R004'){