1 appDS2.controller('profileSearchCtrlDS2', function($scope, $http,ProfileServiceDS2){
2 $scope.showInput = true;
3 $scope.totalPages1 = 5;
4 $scope.viewPerPage1 = 8;
5 $scope.currentPage1 = 1;
6 $scope.showLoader = false;
8 $scope.$watch('viewPerPage1', function(val) {
9 $scope.showLoader = true;
10 ProfileServiceDS2.getProfilePagination($scope.currentPage1, val).then(function(data){
12 $scope.data = JSON.parse(j.data);
13 $scope.tableData =JSON.parse($scope.data.profileList);
14 $scope.totalPages1 =JSON.parse($scope.data.totalPage);
15 for(x in $scope.tableData){
16 if($scope.tableData[x].active_yn=='Y')
17 $scope.tableData[x].active_yn=true;
19 $scope.tableData[x].active_yn=false;
21 $scope.showLoader = false;
23 console.log("failed");
29 $scope.customHandler = function(num) {
30 $scope.currentPage1 = num;
31 $scope.showLoader = true;
32 ProfileServiceDS2.getProfilePagination($scope.currentPage1,$scope.viewPerPage1).then(function(data){
34 $scope.data = JSON.parse(j.data);
35 $scope.tableData =JSON.parse($scope.data.profileList);
36 $scope.totalPages1 =JSON.parse($scope.data.totalPage);
37 for(x in $scope.tableData){
38 if($scope.tableData[x].active_yn=='Y')
39 $scope.tableData[x].active_yn=true;
41 $scope.tableData[x].active_yn=false;
43 $scope.showLoader = false;
45 console.log("failed");
51 $scope.editRow = function(profileId){
52 window.location = 'userProfile#/profile/' + profileId;
55 $scope.toggleProfileActive = function(rowData) {
56 modalService.popupConfirmWinWithCancel("Confirm","You are about to change user's active status. Do you want to continue?",
58 $http.get("profile/toggleProfileActive?profile_id="+rowData.id).success(function(){});
61 rowData.active=!rowData.active;