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('samplePageController', function($scope, $http,ProfileService,modalService){
22 $scope.viewPerPage=20;
23 $scope.scrollViewPerPage=2;
26 $scope.searchCategory;
27 $scope.searchString="";
28 $scope.currentPageNum=1;
29 ProfileService.getProfilePagination(1,$scope.viewPerPage).then(function(data){
31 $scope.data = JSON.parse(j.data);
32 $scope.tableData =JSON.parse($scope.data.profileList);
33 $scope.totalPages =JSON.parse($scope.data.totalPage);
34 for(x in $scope.tableData){
35 if($scope.tableData[x].active_yn=='Y')
36 $scope.tableData[x].active_yn=true;
38 $scope.tableData[x].active_yn=false;
42 console.log("failed");
46 $scope.$watch('currentPageNum', function(val) {
48 ProfileService.getProfilePagination(val,$scope.viewPerPage).then(function(data){
50 $scope.data = JSON.parse(j.data);
51 $scope.tableData =JSON.parse($scope.data.profileList);
52 $scope.totalPages =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;
61 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;