2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
20 app.controller('profileSearchCtrl', function($scope, $http,ProfileService,modalService){
22 $scope.showInput = true;
23 $scope.totalPages1 = 5;
24 $scope.viewPerPage1 = 8;
25 $scope.currentPage1 = 1;
27 $scope.$watch('viewPerPage1', function(val) {
28 ProfileService.getProfilePagination($scope.currentPage1, val).then(function(data){
30 $scope.data = JSON.parse(j.data);
31 $scope.tableData =JSON.parse($scope.data.profileList);
32 $scope.totalPages1 =JSON.parse($scope.data.totalPage);
33 for(x in $scope.tableData){
34 if($scope.tableData[x].active_yn=='Y')
35 $scope.tableData[x].active_yn=true;
37 $scope.tableData[x].active_yn=false;
40 console.log("failed");
46 $scope.customHandler = function(num) {
47 $scope.currentPage1 = num;
48 ProfileService.getProfilePagination($scope.currentPage1,$scope.viewPerPage1).then(function(data){
50 $scope.data = JSON.parse(j.data);
51 $scope.tableData =JSON.parse($scope.data.profileList);
52 $scope.totalPages1 =JSON.parse($scope.data.totalPage);
53 for(x in $scope.tableData){
54 if($scope.tableData[x].active_yn=='Y')
55 $scope.tableData[x].active_yn=true;
57 $scope.tableData[x].active_yn=false;
60 console.log("failed");
66 $scope.editRow = function(profileId){
67 window.location = 'userProfile#/profile/' + profileId;
70 $scope.toggleProfileActive = function(rowData) {
71 modalService.popupConfirmWinWithCancel("Confirm","You are about to change user's active status. Do you want to continue?",
73 $http.get("profile/toggleProfileActive?profile_id="+rowData.id).success(function(){});
76 rowData.active=!rowData.active;