2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
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 * ============LICENSE_END=========================================================
21 app.controller('samplePageController', function($scope, $http,ProfileService,modalService){
23 $scope.viewPerPage=20;
24 $scope.scrollViewPerPage=2;
27 $scope.searchCategory;
28 $scope.searchString="";
29 $scope.currentPageNum=1;
30 ProfileService.getProfilePagination(1,$scope.viewPerPage).then(function(data){
32 $scope.data = JSON.parse(j.data);
33 $scope.tableData =JSON.parse($scope.data.profileList);
34 $scope.totalPages =JSON.parse($scope.data.totalPage);
35 for(x in $scope.tableData){
36 if($scope.tableData[x].active_yn=='Y')
37 $scope.tableData[x].active_yn=true;
39 $scope.tableData[x].active_yn=false;
43 console.log("failed");
47 $scope.$watch('currentPageNum', function(val) {
49 ProfileService.getProfilePagination(val,$scope.viewPerPage).then(function(data){
51 $scope.data = JSON.parse(j.data);
52 $scope.tableData =JSON.parse($scope.data.profileList);
53 $scope.totalPages =JSON.parse($scope.data.totalPage);
54 for(x in $scope.tableData){
55 if($scope.tableData[x].active_yn=='Y')
56 $scope.tableData[x].active_yn=true;
58 $scope.tableData[x].active_yn=false;
62 console.log("failed");
67 $scope.editRow = function(profileId){
68 window.location = 'userProfile#/profile/' + profileId;
71 $scope.toggleProfileActive = function(rowData) {
72 modalService.popupConfirmWinWithCancel("Confirm","You are about to change user's active status. Do you want to continue?",
74 $http.get("profile/toggleProfileActive?profile_id="+rowData.id).success(function(){});
77 rowData.active=!rowData.active;