summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/collaborate-list-controller.js
blob: 670e8fc16431be860abcda0747ed4868992660d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
appDS2.controller("collaborateListControllerDS2", function ($scope,$http, $modal,AdminService) { 
	  
	$scope.showInput = true;
	$scope.totalPages1 = 5;
	$scope.viewPerPage1 = 8;
	$scope.currentPage1 = 1;
	$scope.showLoader = false;
	$scope.firstPlay = true;
	// Start with empty list to silence error in console
	$scope.tableData = [];
	$scope.tableCollbItems = [];
	// $scope.totalPages1 = 20;
	$scope.$watch('viewPerPage1', function(val) {
		$scope.showLoader = true;
		AdminService.getCollaborateList($scope.currentPage1, val).then(function(data){
			var j = data;	
			$scope.data = JSON.parse(j.data);
			$scope.tableData = $scope.data;
			var totalItems = $scope.tableData.length;
			//console.log(totalItems);
			$scope.totalPages1  = Math.ceil(totalItems / $scope.viewPerPage1);
			$scope.showLoader = false;
			$scope.currentPage1=1;
			var endIndex = 1 * $scope.viewPerPage1;
			var startIndex = endIndex - $scope.viewPerPage1;
			$scope.tableCollbItems = $scope.tableData.slice(startIndex, endIndex);
		},function(error){
			console.log("failed");
			reloadPageOnce();
		});
	});
	    
	$scope.customHandler1 = function(num) {
		$scope.currentPage1=num;
		var endIndex = num * $scope.viewPerPage1;
		var startIndex = endIndex - $scope.viewPerPage1;
		$scope.tableCollbItems = $scope.tableData.slice(startIndex, endIndex);
	};
		
	$scope.openCollaboration = function(chatId){
		openInNewTab('openCollaboration?chat_id=' + chatId);
	}
	   
	$scope.toggleProfileActive = function(profileId) {
		modalService.popupConfirmWin("Confirm","You are about to change user's active status. Do you want to continue?",
				function(){
			$http.get("profile/toggleProfileActive?profile_id="+profileId).success(function(){});	
		})
	};	 

});

function openInNewTab(url) {
	var win = window.open(url, '_blank');
	win.focus();  
};

function downloadScreenCaptureExtenstion() {
	  
	var chromeURL = 'https://chrome.google.com/webstore/detail/icgmlogfeajbfdffajhoebcfbibfhaen';
	var firefoxURL = 'https://addons.mozilla.org/en-US/firefox/addon/screen-capturing-capability';
	var url;
	  
	if(isChrome)
		url = chromeURL;
	else if(isFirefox)
		url = 	firefoxURL;
	  
	var win = window.open(url);
	win.focus();
};