course details changes done

This commit is contained in:
gandhimathi 2018-01-25 10:26:34 +05:30
parent 08cc45d97b
commit 379043449f

View File

@ -6,7 +6,7 @@
app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state) {
localStorage.setItem('searchName','');
localStorage.setItem('searchMobile','');
$scope.userType=JSON.parse(localStorage.getItem('localObj')).localType;
$scope.myModel = {
"studentName": "",
"mobileNumber": "",
@ -21,7 +21,8 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
"enquiryStatus":'',
"alterMobileNumber":'',
"address":'',
"important":false
"important":false,
"branch":""
};
//get current date
@ -212,6 +213,7 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
localStorage.setItem('searchObj', JSON.stringify($scope.searchData));
localStorage.setItem('trackID', p.TrackingID);
localStorage.setItem('count', 0);
$rootScope.followupDetails=p;
/* $rootScope.myModel1.status=$rootScope.followupDetails.StatusCode;
$rootScope.currentDate1=new Date().getFullYear() + '-' + ('0' + (new Date().getMonth() + 1)).slice(-2) + '-' + ('0' + new Date().getDate()).slice(-2);
@ -229,6 +231,7 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
* */
$scope.trackForm = {
submit: function (form, myModel,loading) {
if(isNaN(myModel.date)){
$scope.nextFollowupDate = myModel.date;
@ -260,7 +263,16 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
$scope.ldloading1 = {};
$scope.ldloading1[loading.replace('-', '_')] = true;
if($scope.userType !='R004'){
$scope.updateBranchID = JSON.parse(localStorage.getItem('localObj')).localBranchID;
$scope.updateAssignTo = myModel.assignedTo;
}
else{
$scope.updateBranchID = myModel.branch.BranchCode;
$scope.updateAssignTo = myModel.assignedTo;
}
var addLead = {
method: 'POST',
@ -275,7 +287,8 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
courseName: myModel.courseName,
date: $scope.nextFollowupDate,
activity: myModel.activity.activityID,
assignedTo: myModel.assignedTo,
assignedTo: $scope.updateAssignTo,
status: myModel.status,
referedBy: myModel.referedBy,
comments:myModel.comments,
@ -283,7 +296,7 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter",
address:myModel.address,
enquiryStatus:myModel.enquiryStatus,
createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID
branchId: $scope.updateBranchID
@ -1057,12 +1070,16 @@ app.controller('callTrackingPendingCtrl', ["$scope","$rootScope","toaster", "$fi
}]);
app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state) {
$scope.userType=JSON.parse(localStorage.getItem('localObj')).localType;
$scope.afterRefresh = function () {
$rootScope.myModel1 = {
"status":'',
"date": '',
"comments": "",
"branch":""
};
$rootScope.loadFollowupDetails(localStorage.getItem('trackID'));
};
@ -1402,7 +1419,6 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter",
* created by kms
* */
$rootScope.updateFollowup = function (followupDetails,myModel1, loading) {
if(isNaN(myModel1.date)){
$scope.nextFollowupDate = myModel1.date;
@ -1420,6 +1436,18 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter",
swal("Warning!", 'Please enter comments', "warning");
} else {
if($scope.userType !='R004'){
$scope.updateBranchID = JSON.parse(localStorage.getItem('localObj')).localBranchID;
}
else{
$scope.updateBranchID = myModel1.branch;
}
$rootScope.ldloading2 = {};
$rootScope.ldloading2[loading.replace('-', '_')] = true;
@ -1438,7 +1466,7 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter",
assignedTo: myModel1.assignStaff,
comments: myModel1.comments,
updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID,
branchId: $scope.updateBranchID,
}
};
$http(update).then(function (response) {
@ -1484,8 +1512,19 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter",
$rootScope.futureDate1 = $filter('date')($scope.modifyDate1, 'dd-MM-yyyy');
// $rootScope.myModel1.status=$rootScope.followupDetails.StatusCode;
$rootScope.trackingStatus=response.data.statusDetails;
$rootScope.myModel1.branch=$rootScope.followupDetails.CreatedBranch;
$rootScope.myModel1.assignStaff=$rootScope.followupDetails.AssignedTo;
$rootScope.staffArray='';
$rootScope.staffDetails=response.data.staffDetails;
angular.forEach($rootScope.staffDetails, function(item) {
if(item.BranchCode==$rootScope.myModel1.branch){
$rootScope.staffArray = item.staffDetails;
}
});
} else {
swal("Failed!", response.data.message, "error");
@ -1495,6 +1534,22 @@ app.controller('callTrackingCtrl2', ["$scope","$rootScope","toaster", "$filter",
}
/*
* get staff details while change branch
* */
$rootScope.changeBranch = function (branchCode) {
$rootScope.staffArray="";
$rootScope.myModel1.assignStaff="";
angular.forEach($rootScope.staffDetails, function(item) {
if(item.BranchCode==branchCode){
$rootScope.staffArray = item.staffDetails;
$rootScope.myModel1.assignStaff=item.staffDetails[0].loginId;
}
});
}
/*
* cancel the page
* created by kms