{"size": 1997, "ext": "js", "max_stars_repo_path": "Admin-CSNet/public/angularjs/hostManagement.js", "max_stars_repo_name": "ShreyBhatt/CMPE281CSNet", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Admin-CSNet/public/angularjs/hostManagement.js", "max_issues_repo_name": "ShreyBhatt/CMPE281CSNet", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Admin-CSNet/public/angularjs/hostManagement.js", "max_forks_repo_name": "ShreyBhatt/CMPE281CSNet", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.2209302326, "max_line_length": 77, "alphanum_fraction": 0.4837255884}
/**
 * Created by vedant on 11/26/16.
 */
/**
 * Created by vedant on 11/26/16.
 */
var hostManagement = angular.module('hostManagementapp',[]);
hostManagement.controller('hostManagement', function($scope, $http, $window){

    $scope.getAllHosts = function(){
        console.log("The Host list gets called");
        $http({
            method:'get',
            url:'/getAllHosts'
        }).success(function(data){
            console.log("Getting all the hosts " + data);
            $scope.host=data;
        })

    };

    $scope.sortName = 'firstName';
    $scope.sortReverse = false;


    $scope.unapprovedHost = function(){
        $http({
            method: 'get',
            url: '/unapprovedHost'
        }).success(function(data){
            console.log(data);
            $scope.unapprovedhost = data;
        })
    };


    $scope.approveHost = function(hostId){
        console.log("user to be approved "+ hostId);
        $http({
            method: 'post',
            url: '/approveHost',
            data:{
                "_id":hostId
            }
        }).success(function(data){
            console.log(data);
            $window.location.assign('/admin_pendingHost');

           // $scope.approveHost = data;

        })
    };


    $scope.getHost = function(id){
        console.log("getHost gets called "+id);
        $http({
            method:'post',
            url:'/getHost',
            data:{
                "_id":id
            }
        }).success(function(data){
            console.log("Getting host " + data);
            $scope.a=data;
        })
    };


    $scope.getPendingHost = function(id){
        console.log("getPendingHost gets called "+id);
        $http({
            method:'post',
            url:'/getPendingHost',
            data:{
                "_id":id
            }
        }).success(function(data){
            console.log("Getting Pending host " + data);
            $scope.getPendingHost=data;
        })
    };

});

