PageSourceSearch

https://www.xploresports.com/js/vendor/notificationPostController.js?v=1.7.2.29

js xploresports.com collected 2026-09-30 11:47:48 UTC 75,697 bytes, 1,617 lines download raw bytes

1(function () {
2    "use strict";
3    angular.module('notificationPost', [])
4        .controller('notificationPostController', ['$scope', '$rootScope', '$httpApi','$timeout','$otherService', 'API_BASE_URL', '$location', '$filter','SweetAlert','$window','$sce',
5            function ($scope, $rootScope, $httpApi,$timeout, $otherService, API_BASE_URL, $location, $filter,SweetAlert,$window,$sce) {
6
7                $scope.timeLinePosts = [];
8                $scope.postsImages = [];
9                $scope.showPostEdit = [];
10                $scope.showEdit = [];
11                $scope.newComment = [];
12                $scope.updatedComment = [];
13                $scope.updatedPost = [];
14                //console.clear();
15                $scope.vendorUrl = vendorUrl;
16                $scope.awsVendorUrl = awsVendorUrl;
17                //$scope.open =false;
18                if(!localStorage.getItem('user'))
19                {
20                    $rootScope.users=0;
21                    $location.path('/login');
22                }
23                if(localStorage.getItem('user'))
24                {
25                    $otherService.checksession($rootScope,$location).then(function (response) {
26                        if(response)
27                        {
28
29                        }
30                        else {
31                            localStorage.clear();
32                            $rootScope.link='#/';
33                            $location.path('/login');
34                        }
35                    });
36                    /* if(JSON.parse(localStorage.getItem('user')).user_type_id==2 && !localStorage.getItem('timelineMemberID')){
37                     $location.path('vendor/dashboard');
38                     }*/
39                    if(JSON.parse(localStorage.getItem('user')).user_type_id==1){
40                        $rootScope.users=1;
41                    }else{
42                        $rootScope.admin=1;
43                        $rootScope.users=3;
44                    }
45                }
46
47                $scope.showPost = function (postId) {
48                    console.log(postId);
49                    localStorage.removeItem('notificationPostId');
50                    localStorage.setItem('notificationPostId',postId);
51                    $location.path('/msportslines/member/'+ makeid());
52                };
53
54                $scope.group_id = {};
55                $scope.timelinePostsData = [];
56                 $scope.group_btn_active = false;
57                $scope.initPost = function () {
58                    var post_id = localStorage.getItem('notificationPostId');
59                   $scope.getDeletedPostData(post_id)
60                    console.log(post_id);
61                    var options = {
62                        "url": "/index.php/site/get-individual-post",
63                        "params": {"post_id": post_id, "member_id": $rootScope.loginUser.id}
64                    };
65                    $httpApi.get(options).then(function (response) {
66                        console.log(response);
67
68                        // 🔴 POST DELETED / NOT FOUND
69                        if (!response || response.length === 0) {
70                            console.log('Post Deleted');
71                            $scope.postDeletedMsg = true;
72                            $scope.timeLinePosts = [];
73                            return;
74                        }
75                       
76                         console.log($scope.timelinePostsData);
77                        $scope.group_id = response[0].gec_id;
78                        if(response[0].gec_id){
79                           $scope.group_btn_active = true; 
80                           $scope.getGroupDetails(response[0].gec_id)
81                        }
82
83                        $scope.timeLinePosts = [];
84                        if(response.length){
85                            var data = response[0];
86                            $scope.timelinePostsData = response;
87                            $scope.timeLinePosts.push(data);
88                            var images = [];
89                            if(data.user_type_id == 1){
90                                angular.forEach(data.photos, function (photo) {
91                                    images.push({
92                                        src: awsUrl + 'users/Post/Photo/' + photo['photo_url'],      // url
93                                        alt: '',          // alternative text
94                                        title: ''        // title
95                                        //caption: data.post_data[0].message  // modal caption
96                                    });
97                                });
98                            }else{
99                                angular.forEach(data.photos, function (photo) {
100                                    images.push({
101                                        src: awsVendorUrl + 'Post/Photo/' + photo['photo_url'],      // url
102                                        alt: '',          // alternative text
103                                        title: ''        // title
104                                        //caption: data.post_data[0].message  // modal caption
105                                    });
106                                });
107                            }
108                            
109                            $scope.postsImages[data.id] = images;
110                        }
111
112                        //$scope.getMore();
113                    });
114
115                };
116
117                 $scope.delete_btn_active = false;    
118                $scope.getDeletedPostData = function(post_id){
119                    var options = {
120                        "url": "/index.php/site/get-individual-deleted-post",
121                        "params": {"post_id": post_id, "member_id": $rootScope.loginUser.id}
122                    };
123                    $httpApi.get(options).then(function (response) {
124                          console.log('I am here', response);  
125                           //$scope.group_id = response[0].gec_id;
126                            if(response[0].gec_id){
127                                console.log('Success');
128                                 $scope.delete_btn_active = true; 
129                                  $scope.getGroupDetails(response[0].gec_id)
130                            }
131
132                    });
133                }
134
135
136
137                $scope.groupData = {};
138                $scope.getGroupDetails = function(userId){
139                    var options = {
140                        url:"/index.php/site/group-details-data",
141                        params: { id: userId }
142                    }
143                    $httpApi.get(options).then(function(response){
144                        $scope.groupData = response.user;
145                        console.log($scope.groupData);
146                    })
147                }
148
149                 $scope.readGroup=function (g) {
150                    console.log(g);
151                // return;
152                    localStorage.setItem('group','');
153                    localStorage.setItem('group',JSON.stringify(g));
154
155                    $scope.wayToEvent = JSON.parse(localStorage.getItem('group'));
156                    var event_title = $scope.wayToEvent.title;
157                    var url = window.location.href.substring(0, window.location.href.indexOf("#") + 1);
158                    if( screen.width <= 480 ) {
159                        var s = url + '/mevents/viewevent/' + event_title;
160                    }else{
161                        var s = url + '/events/viewevent/' + event_title;
162                    }
163
164                    var x = s.split(" ").join("-");
165                    $location.path(x);
166                    console.log($scope.wayToEvent);
167
168                };
169
170
171                $scope.initPo = function (id) {
172                    var post_id = id;
173                    console.log(post_id);
174                    var options = {
175                        "url": "/index.php/site/get-individual-post",
176                        "params": {"post_id": post_id, "member_id": $rootScope.loginUser.id}
177                    };
178                    $httpApi.get(options).then(function (response) {
179                        $scope.timeLinePosts = [];
180                        if(response.length){
181                            var data = response[0];
182
183                            $scope.timeLinePosts.push(data);
184                            var images = [];
185                            angular.forEach(data.photos, function (photo) {
186                                images.push({
187                                    src: awsUrl + 'users/Post/Photo/' + photo['photo_url'],      // url
188                                    alt: '',          // alternative text
189                                    title: ''        // title
190                                    //caption: data.post_data[0].message  // modal caption
191                                });
192                            });
193                            $scope.postsImages[data.id] = images;
194                        }
195
196                        //$scope.getMore();
197                    });
198
199                };
200
201                $scope.wayToPost = function(post_id){
202                    console.log(post_id)
203                    localStorage.setItem('notificationPostId',post_id);
204                    $location.path('/post-notification');
205                }
206
207                $scope.date = new Date()
208                $rootScope.spinner = {active : true};
209                $scope.loader = true;
210                $scope.initMember = function(){
211                    var post_id = JSON.parse(localStorage.getItem('notificationPostId'));
212                    $scope.member_data = post_id;
213                    //$scope.getSportNameList();
214
215                }
216
217
218                $scope.pageMore = 3;
219                $scope.loadMorePage =function(){
220                    $scope.pageMore +=3;
221                    $scope.initPosts();
222                }
223                $scope.loader = true;
224
225                $scope.initPosts = function () {
226                   // $scope.loader = false;
227                    //$scope.getLikesForPost();
228                    var post_id = JSON.parse(localStorage.getItem('notificationPostId'));
229                    console.log(post_id);
230                    $rootScope.title = 'Sports Achievements Of ' + post_id.member_name + ' ' + post_id.last_name;
231                    var options = {
232                        "url": "/index.php/site/get-all-achivement",
233                        "params": {"id": post_id.id, "member_id": $rootScope.loginUser.id,page:$scope.pageMore}
234                    };
235                    $httpApi.get(options).then(function (response) {
236                        //$scope.setFriendRequest()
237                        $scope.loader = false;
238                        $scope.timeLinePosts = [];
239                        console.log(response);
240                        $scope.timeLinePosts = response;
241                        //console.log(post_id.member_name);                            )    
242
243                        $scope.getFollowBioSportsss($scope.timeLinePosts);
244                        /*for(var i =0; i<$scope.timeLinePosts.length; i++ ) {
245                            $rootScope.spinner = {active : false};
246                            $scope.timeLinePosts[i].decesndingOrder = new Date($scope.timeLinePosts[i].year, $scope.timeLinePosts[i].month, 2)
247                        }*/
248
249                             var images = [];
250                            angular.forEach($scope.timeLinePosts, function (post) {
251                                if(post.photos.length){
252                                    var images = [];
253                                    if(post.user_type_id == 1){
254                                        angular.forEach(post.photos, function (photo) {
255                                            images.push({
256                                                src: awsUrl + 'users/Post/Photo/' + photo['photo_url'],      // url
257                                                alt: '',          // alternative text
258                                                title: ''        // title
259                                                //caption: data.post_data[0].message  // modal caption
260                                            });
261                                        });
262                                    }else{
263                                        angular.forEach(post.photos, function (photo) {
264                                            images.push({
265                                                src: awsVendorUrl + 'Post/Photo/' + photo['photo_url'],      // url
266                                                alt: '',          // alternative text
267                                                title: ''        // title
268                                                //caption: data.post_data[0].message  // modal caption
269                                            });
270                                        });
271                                    }
272
273                                    $scope.postsImages[post.id] = images;
274                                }
275
276                            });
277
278                        //$scope.getMore();
279                    });
280
281                };
282
283                $scope.page = 5;
284                $scope.loadMorePageData = function(){
285                    $scope.searchButtonText = true;
286                    $scope.page +=5;
287                    $scope.initDashboardPosts();
288                    $timeout(function(){
289                        $scope.searchButtonText = false;
290                        $scope.searchButtonText = "Searching";
291                    }, 2000);
292
293                };
294
295                if(window.location.href.indexOf("msportslines") > -1 || window.location.href.indexOf("company") > -1){
296                    $scope.timeLinePosts=[];
297                    $scope.currentView = "timeline";
298                    console.log($scope.currentView);
299                    //var user_id = $route.current.params.id;
300                    var user_id = JSON.parse(localStorage.getItem('notificationPostId'));
301                    console.log(user_id);
302                    var options = {
303                        url:"/index.php/site/get-dashboard-of-buddies",
304                        params: { id: user_id }
305                    }
306                    $httpApi.get(options).then(function(response){
307                        $rootScope.userDetail = response.user[0];
308                        console.log($rootScope.userDetail);
309                        $scope.checkBuddyStatus()
310                    })
311                }
312
313                $scope.initDashboardPosts = function () {
314                    var post_id = localStorage.getItem('notificationPostId');
315                    console.log(post_id);
316                    //$rootScope.title = 'Sports Timeline Of ' + $rootScope.userDetail.member_name + ' ' + $rootScope.userDetail.last_name;
317                    var options = {
318                        "url": "/index.php/site/get-dashboard",
319                        "params": {page:$scope.page,"id": post_id, "member_id": $rootScope.loginUser.id}
320                    };
321                    $httpApi.get(options).then(function (response) {
322                        console.log(response);
323                        //$scope.setFriendRequest()
324                        if($scope.currentView == 'msportslines'){
325                            $scope.buddyStatus = response.buddyStatus;
326                            console.log(response.buddyStatus);
327                        }
328                        $scope.loader = false;
329                        $scope.timeLinePosts = [];
330                        console.log(response);
331                        $scope.timeLinePosts = response;
332                       // $scope.getFollowBioSportsss($scope.timeLinePosts);
333                       // for(var i =0; i<$scope.timeLinePosts.length; i++ ) {
334                         //   $rootScope.spinner = {active : false};
335                           // $scope.timeLinePosts[i].decesndingOrder = new Date($scope.timeLinePosts[i].year, $scope.timeLinePosts[i].month, 2)
336                        //}
337
338                        var images = [];
339                        angular.forEach($scope.timeLinePosts, function (post) {
340                            if(post.photos.length){
341                                var images = [];
342                                if(post.user_type_id == 1){
343                                    angular.forEach(post.photos, function (photo) {
344                                        images.push({
345                                            src: awsUrl + 'users/Post/Photo/' + photo['photo_url'],      // url
346                                            alt: '',          // alternative text
347                                            title: ''        // title
348                                            //caption: data.post_data[0].message  // modal caption
349                                        });
350                                    });
351                                }else{
352                                    angular.forEach(post.photos, function (photo) {
353                                        images.push({
354                                            src: awsVendorUrl + 'Post/Photo/' + photo['photo_url'],      // url
355                                            alt: '',          // alternative text
356                                            title: ''        // title
357                                            //caption: data.post_data[0].message  // modal caption
358                                        });
359                                    });
360                                }
361
362                                $scope.postsImages[post.id] = images;
363                            }
364
365                        });
366
367                        //$scope.getMore();
368                    });
369
370                };
371
372
373
374                $scope.mouseEnter = function () {
375                    this.clickedh = true;
376                  //  console.log(this.clickedh);
377                };
378
379                $scope.mouseLeave = function () {
380                    this.clickedh = false;
381                  //  console.log(this.clickedh);
382                };
383
384                $scope.convertUTCDateToLocalDate = function (utcDate) {
385
386                    var localTime  = moment.utc(utcDate).toDate();
387                    localTime = moment(localTime).format('MMM D, YYYY hh:mm A');
388                    return localTime;
389                };
390
391                $scope.seeMore = function () {
392                    this.showMore = true;
393                    //console.log(this.showMore);
394
395                };
396
397                $scope.hideMore = function () {
398                    this.showMore = false;
399                    // console.log(this.showMore);
400                };
401
402                $scope.deletePost = function (postId) {
403                   // $log.warn('Warning: attempting to delete post id:',postId);
404
405                    SweetAlert.swal({
406                            title: "Are you sure you want to delete this post?", //Bold text
407                            showCancelButton: true, // displays cancel btton
408                            confirmButtonColor: "#555",
409                            confirmButtonText: "Yes",
410                            closeOnConfirm: true, //do not close popup after click on confirm, usefull when you want to display a subsequent popup
411                            closeOnCancel: true
412                        },
413                        function(isConfirm){ //Function that triggers on user action.
414                            if(isConfirm){
415                               // $log.debug('deleting post id:',postId);
416                                //console.log("delete post: "+postId);
417                                //console.log("before postimage array: ");
418                                var options = {
419                                    "url": '/index.php/site/delete-post',
420                                    "params": { mainPost:postId, member_id:$rootScope.loginUser.id}
421                                }
422                                $httpApi.get(options).then(function (response) {
423                                    $log.debug('Post delete response from server',response);
424                                    var index = $scope.timeLinePosts.findIndex(x => x.id == postId);
425                                    if (index > -1) {
426                                        //$log.info('Post removed from the list');
427                                        $scope.timeLinePosts.splice(index, 1);
428                                        /*$scope.allcomments['f'+postId]=[];
429                                        $scope.inti_comment['f'+postId]=[];
430                                        $scope.showComment['f'+postId]=[];
431                                        $scope.shwcmnt['f'+postId]=1;*/
432                                        if($scope.postsImages[postId]){
433                                            $scope.postsImages.splice(postId, 1);
434                                        }
435
436                                        //console.log("after postimage array: ");
437                                        //console.log($scope.postsImages);
438                                        //$scope.getMore();
439
440                                    }
441                                    //$scope.updateCache();
442                                }, function (error) {
443                                   // $log.error(error);
444                                    setTimeout(function () {
445                                        // $scope.updateCache();
446                                    },50);
447
448                                });
449                            }else{
450
451                            }
452                        });
453
454                };
455
456                $scope.updatePost = function(postId,message,key){
457                    $scope.showPostEdit[postId]=!$scope.showPostEdit[postId];
458                    $scope.timeLinePosts[key].message = message;
459                    var options = {
460                        "url": '/index.php/site/update-post',
461                        "data": { postId:postId, message:message, member_id:$rootScope.loginUser.id}
462                    };
463                    $httpApi.post(options).then(function(response){
464                        /*var options = {
465                            "url": "/index.php/site/get-member-detail",
466                            "params":{"id":$rootScope.loginUser.id,current_view:$scope.currentView, member_id:$rootScope.loginUser.id}
467                        }
468                        $httpApi.get(options).then(function(updateCache){
469                            //console.log(updateCache);
470                        });*/
471
472                    });
473                };
474
475                $scope.cancelPostUpdate = function(postId,message){
476                    $scope.showPostEdit[postId]=!$scope.showPostEdit[postId];
477                    $scope.updatedPost[postId] = message;
478                };
479
480                $scope.cancelCommentUpdate = function(postId,message){
481                    $scope.showEdit[postId]=!$scope.showEdit[postId];
482                    $scope.updatedComment[postId] = message;
483                };
484
485                $scope.reactOnPost = function (postId) {
486                    //$scope.initPosts();
487                    //$log.debug('sending reaction for post id:',postId);
488                    var options = {
489                        "url": "/index.php/site/update-like-on-post",
490                        data: { post_id:postId,member_id:$rootScope.loginUser.id}
491                    };
492                    $httpApi.post(options).then(function (response) {
493                     //   $scope.initDashboardPosts();
494                        var index = $scope.timeLinePosts.findIndex(function(x){
495                            return x.id == postId
496                        });
497                        if(index > -1){
498                            $scope.timeLinePosts[index].hasUserLiked =!$scope.timeLinePosts[index].hasUserLiked;
499                        }
500                    }, function (error) {
501
502                    });
503                };
504
505                $scope.showPreviousComments = function (key) {
506                    if($scope.timeLinePosts[key].comments_pages > $scope.timeLinePosts[key].comments_page){
507                        $scope.timeLinePosts[key].comments_page+=1;
508                    }
509
510                };
511
512                $scope.showLatestComments = function (key) {
513                    $scope.timeLinePosts[key].comments_page=1;
514                };
515                function makeid()
516                {
517                    var text = "";
518                    var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
519
520                    for( var i=0; i < 5; i++ )
521                        text += possible.charAt(Math.floor(Math.random() * possible.length));
522
523                    return text;
524                }
525
526                $scope.memberTimeline = function(id,memberName, user_type_id){
527
528                    //$scope.timeLinePosts=[];
529                    if(user_type_id == 1){
530                        localStorage.setItem('timelineMemberID','');
531                        localStorage.setItem('timelineMemberID',JSON.stringify(id));
532                        $location.path('/sportsline/member/'+ makeid());
533                    } else if (user_type_id == 2) {
534                        var options = {
535                            url: "/index.php/site/get-partner-details",
536                            data: { 'id': id }
537                        };
538                        $httpApi.post(options).then(function (response) {
539                           // console.log(response);
540                            localStorage.setItem('companyTimeline','');
541                            //console.log(id);
542                            localStorage.setItem('companyTimeline',JSON.stringify(response.data[0]));
543                            $location.path('/company/'+ makeid());
544                        });
545                    }
546
547                };
548
549                $scope.insertEmojisinEditPost = function (text,postid) {
550                    this.editPostEmoji = !this.editPostEmoji;
551                    //$scope.sharePostData.message  += "<i class='emoticon emoticon-" 
551+ title + "' title=':" + title + "'></i>&nbsp;";
552                    //$scope.sharePostData.message  += ":"+title+":";
553                    var insertText = ":"+text+":";
554                    var result = document.getElementById("MemberPostsTbl_PostEdit"+postid);
555                    var element = angular.element(result);
556                    var input = element[0];
557                   // console.log(input);
558                    if (input == undefined) { return; }
559                    var scrollPos = input.scrollTop;
560                    var pos = 0;
561                    var browser = ((input.selectionStart || input.selectionStart == "0") ?
562                        "ff" : (document.selection ? "ie" : false ) );
563                    if (browser == "ie") {
564                        input.focus();
565                        var range = document.selection.createRange();
566                        range.moveStart ("character", -input.value.length);
567                        pos = range.text.length;
568                    }
569                    else if (browser == "ff") { pos = input.selectionStart };
570
571                    var front = (input.value).substring(0, pos);
572                    var back = (input.value).substring(pos, input.value.length);
573                    input.value = front+insertText+back;
574                    pos = pos + insertText.length;
575                    if (browser == "ie") {
576                        input.focus();
577                        var range = document.selection.createRange();
578                        range.moveStart ("character", -input.value.length);
579                        range.moveStart ("character", pos);
580                        range.moveEnd ("character", 0);
581                        range.select();
582                    }
583                    else if (browser == "ff") {
584                        input.selectionStart = pos;
585                        input.selectionEnd = pos;
586                        input.focus();
587                    }
588                    input.scrollTop = scrollPos;
589                    $scope.updatedPost[postid] = input.value;
590
591                };
592
593                $scope.insertEmojisInComment = function (text,postid) {
594                    this.editPostEmoji = !this.editPostEmoji;
595                    //$scope.sharePostData.message  += "<i class='emoticon emoticon-" + title + "' title=':" + title + "'></i>&nbsp;";
596                    //$scope.sharePostData.message  += ":"+title+":";
597                    var insertText = ":"+text+":";
598                    var result = document.getElementById("MemberPostsResponceTbl_comments_"+postid);
599                    var element = angular.element(result);
600                    var input = element[0];
601                   // console.log(input);
602                    if (input == undefined) { return; }
603                    var scrollPos = input.scrollTop;
604                    var pos = 0;
605                    var browser = ((input.selectionStart || input.selectionStart == "0") ?
606                        "ff" : (document.selection ? "ie" : false ) );
607                    if (browser == "ie") {
608                        input.focus();
609                        var range = document.selection.createRange();
610                        range.moveStart ("character", -input.value.length);
611                        pos = range.text.length;
612                    }
613                    else if (browser == "ff") { pos = input.selectionStart };
614
615                    var front = (input.value).substring(0, pos);
616                    var back = (input.value).substring(pos, input.value.length);
617                    input.value = front+insertText+back;
618                    pos = pos + insertText.length;
619                    if (browser == "ie") {
620                        input.focus();
621                        var range = document.selection.createRange();
622                        range.moveStart ("character", -input.value.length);
623                        range.moveStart ("character", pos);
624                        range.moveEnd ("character", 0);
625                        range.select();
626                    }
627                    else if (browser == "ff") {
628                        input.selectionStart = pos;
629                        input.selectionEnd = pos;
630                        input.focus();
631                    }
632                    input.scrollTop = scrollPos;
633                    $scope.newComment[postid] = input.value;
634
635                };
636
637                $scope.insertEmojisInEditComment = function (text,postid) {
638                    this.editPostEmoji = !this.editPostEmoji;
639                    //$scope.sharePostData.message  += "<i class='emoticon emoticon-" 
639+ title + "' title=':" + title + "'></i>&nbsp;";
640                    //$scope.sharePostData.message  += ":"+title+":";
641                    var insertText = ":"+text+":";
642                    var result = document.getElementById("MemberPostsResponceTbl_old_comments"+postid);
643                    var element = angular.element(result);
644                    var input = element[0];
645                    //console.log(input);
646                    if (input == undefined) { return; }
647                    var scrollPos = input.scrollTop;
648                    var pos = 0;
649                    var browser = ((input.selectionStart || input.selectionStart == "0") ?
650                        "ff" : (document.selection ? "ie" : false ) );
651                    if (browser == "ie") {
652                        input.focus();
653                        var range = document.selection.createRange();
654                        range.moveStart ("character", -input.value.length);
655                        pos = range.text.length;
656                    }
657                    else if (browser == "ff") { pos = input.selectionStart };
658
659                    var front = (input.value).substring(0, pos);
660                    var back = (input.value).substring(pos, input.value.length);
661                    input.value = front+insertText+back;
662                    pos = pos + insertText.length;
663                    if (browser == "ie") {
664                        input.focus();
665                        var range = document.selection.createRange();
666                        range.moveStart ("character", -input.value.length);
667                        range.moveStart ("character", pos);
668                        range.moveEnd ("character", 0);
669                        range.select();
670                    }
671                    else if (browser == "ff") {
672                        input.selectionStart = pos;
673                        input.selectionEnd = pos;
674                        input.focus();
675                    }
676                    input.scrollTop = scrollPos;
677                    $scope.updatedComment[postid] = input.value;
678
679                };
680
681
682                $scope.updateComment = function (postId,commentId,commentText,postKey,ComKey) {
683
684                    $scope.showEdit[commentId] = false;
685                    //$scope.updatedComment[postId] = commentText;
686                    //$scope.timeLinePosts[postKey].comments[ComKey].comments = commentText;
687                    var index = $scope.timeLinePosts[postKey].comments.findIndex(x => x.mprid == commentId);
688                    if (index > -1) {
689                        $scope.timeLinePosts[postKey].comments[index].comments = commentText;
690                        //$scope.updatedComment[response]=commentText;
691                    }
692                    var options = {
693                        "url": '/index.php/site/comment-reaction-on-post',
694                        "data": { id:commentId,old_comments:commentText,member_post_id:postId,member_id:$rootScope.loginUser.id}
695                    };
696                    $httpApi.post(options).then(function (response) {
697
698                    }, function (error) {
699
700                    });
701                };
702
703                $scope.addComment = function (postId,commentText,key) {
704                    var date = new Date();
705                    var utcdate = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(),  date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
706
707                    var x = Math.floor((Math.random() * 10) + 1);
708                    var mprid="N"+x;
709                   // console.log(mprid);
710                    var userPic ='';
711                    if($rootScope.loginUser.profile_pic_url){
712                        userPic = $rootScope.loginUser.profile_pic_url;
713                    }else{
714                        if($rootScope.loginUser.gender == 0){
715                            userPic = 'Male.jpg';
716                        }else{
717                            userPic = 'Female.jpg';
718                        }
719                    }
720                    var newComment ={
721                        buddy_id:$rootScope.loginUser.id,
722                        comments:commentText,
723
724                        date:moment(utcdate).format("YYYY-MM-D HH:mm:ss A"),
725                        gender:$rootScope.loginUser.gender,
726                        id:"--",
727                        last_name:$rootScope.loginUser.last_name,
728                        member_name:$rootScope.loginUser.member_name,
729                        mprid:mprid,
730                        user_type_id: "1",
731                        profile_pic_url:userPic
732                    };
733                    $scope.timeLinePosts[key].comments.push(newComment);
734                    $scope.newComment[postId] = '';
735                    var options = {
736                        "url": '/index.php/site/comment-reaction-on-post',
737                        "data": {comments:commentText,member_post_id:postId,member_id:$rootScope.loginUser.id}
738                    };
739                    $httpApi.post(options).then(function (response) {
740
741                       // console.log(response);
742                        var index = $scope.timeLinePosts[key].comments.findIndex(x => x.mprid == mprid);
743                        if (index > -1) {
744                            $scope.timeLinePosts[key].comments[index].mprid = response;
745                            $scope.updatedComment[response]=commentText;
746                        }
747                        //$scope.newComment[postId] = '';
748                    }, function (error) {
749
750                    });
751                };
752
753                $scope.deleteComment = function (postId,commentId) {
754                    var options = {
755                        "url": '/index.php/site/delete-comment',
756                        "params": {post_id:commentId,mainPost:postId}
757                    };
758                    $httpApi.get(options).then(function (response) {
759
760                    }, function (error) {
761
762
763                    });
764                };
765
766                $scope.$on('updatecomment', function (event,data) {
767                    $scope.getCommentsForPost(data.id);
768
769                });
770
771                $scope.getCommentsForPost = function (postId) {
772                    //$log.debug('fetching comments for post id:',postId);
773                    var index = $scope.timeLinePosts.findIndex(x => x.id == postId);
774                    if (index > -1) {
775                        //$log.debug('post exists for fetching comments');
776                        var options = {
777                            "url": '/index.php/site/get-comments-for-post',
778                            "params": {post_id:postId}
779                        }
780                        $httpApi.get(options).then(function (response) {
781
782                            $scope.timeLinePosts[index].comments= response.comments;
783
784                            var totalCommentPages = Math.ceil(response.comments.length/5);
785
786                            $scope.timeLinePosts[index].comments_pages= totalCommentPages;
787                            if(!$scope.timeLinePosts[index].comments_page && response.comments.length >5)
788                                $scope.timeLinePosts[index].comments_page=1;
789
790
791                        }, function (error) {
792                            //$log.error(error);
793                        });
794                    }
795                    else {
796                        //$log.debug('post does not exist in $scope.timeLinePosts');
797                    }
798                };
799
800                $scope.$on('deletepost', function (event,data) {
801
802                    var index = $scope.timeLinePosts.findIndex(x => x.id == data.id);
803                    if (index > -1) {
804                        $scope.timeLinePosts.splice(index, 1);
805
806                        $scope.$apply();
807                    }
808                });
809
810
811
812                $scope.getLikesForPost = function (postId) {
813
814                   // console.log(postId);
815                    //console.log('[' + Math.floor(Date.now() / 1000)+ ']' + "BEFORE PHP CALLL controller")
816
817                    var index = $scope.timeLinePosts.findIndex(function(x){
818                        return x.id == postId
819                    });
820                    if (index > -1) {
821
822                        var options = {
823                            "url": '/index.php/site/get-likes-for-post',
824                            "data": {post_id:postId,member_id:$rootScope.loginUser.id}
825                        }
826                      //  console.log('[' + Math.floor(Date.now() / 1000)+ ']' + "AFTER CALL  Inside controller")
827                        $httpApi.post(options).then(function (response) {
828                         //   console.log('[' + Math.floor(Date.now() / 1000)+ ']' + "TIMESTAMP after response from  php")
829
830                            $scope.timeLinePosts[index].likes = response.likes;
831                            $scope.timeLinePosts[index].hasUserLiked = response.hasUserLiked;
832                            $scope.timeLinePosts[index].membersWhoLiked = response.membersWhoLiked;
833                            $scope.timeLinePosts[index].membersWhoLikedCount = response.membersWhoLikedCount;
834
835                        }, function (error) {
836
837                        });
838                    }
839                    else {
840
841                    }
842                };
843
844                $scope.$on('likepost', function (event,data) {
845
846                    $scope.getLikesForPost(data.id);
847                   // console.log(data.id);
848
849                });
850
851                $scope.$on('group-post-update',function (event,data) {
852                    if(angular.isDefined(data.post_data)) {
853                        var index = $scope.timeLinePosts.findIndex(x=>x.id == data.post_data[0].id);
854                        if(index > -1){
855                            $scope.timeLinePosts[index] = data.post_data[0];
856                            //$scope.timeLinePosts[index].message = data.post_data[0].message;
857                            /*if(angular.isDefined(data.post_data[0].tags)
857){
858                                $scope.timeLinePosts[index].tags = data.post_data[0].tags;
859                            }*/
860                        }
861                    }
862                    $scope.$apply();
863                });
864
865                $scope.backAchivement = function(edit){
866                    localStorage.setItem("sports-bio-edit",edit);
867                    $window.history.back();
868                    //$location.path('/sports-bio/'+ $rootScope.loginUser.uniqueName);
869                };
870
871                $scope.closeMod =function(){
872                    $fancyModal.close();
873                }
874
875                $scope.editBioInProfile = function(edit){
876                    localStorage.setItem("sports-bio-edit",edit);
877                    $location.path('/bio');
878                };
879
880
881
882
883
884
885
886
887
888                $scope.isFollowing = {};
889                $scope.getFollowStatusBioSports = function(memberId){
890                  // console.log(memberId);
891                    if(angular.isDefined($rootScope.loginUser)){
892                        var option = {
893                            url : '/index.php/site/get-following-bio-sports',
894                            "params":{ member_id: memberId,login_user:$rootScope.loginUser.id }
895                        };
896                        $httpApi.get(option).then(function(response){
897                            $scope.isFollowing = response;
898                           // console.log($scope.isFollowing);
899                        });
900                    }
901
902                };
903
904
905
906                $scope.getAllMembers = function(){
907                    var options = {
908                        "url": '/index.php/site/get-all-members',
909                        "params":{ login_id: $rootScope.loginUser.id }
910                    };
911                    $httpApi.get(options).then(function(data){
912                        $scope.memberList = [];
913                        $scope.memberList = Object.values(data.data);
914                        angular.forEach($scope.myBuddyIds,function(id){
915                            var index = $scope.memberList.findIndex(x => x.id == id);
916                            if(index > -1){
917                                $scope.memberList.splice(index,1);
918                            }
919                        });
920                        var index1 = $scope.memberList.findIndex(x => x.id == $rootScope.loginUser.id);
921                        if(index1 > -1){
922                            $scope.memberList.splice(index1,1);
923                        }
924                    });
925                }
926               /* $scope.clickFunction = function(){
927                    $scope.initPosts();
928                }*/
929                $scope.followBioSports = function(post_id,like_id,memberId){
930                    //$scope.initPosts();
931                  //  console.log($scope.timeLinePosts);
932                   // console.log($scope.timeLinePosts[post_id].membersWhoLiked[like_id].buddy_action);
933                    $scope.timeLinePosts[post_id].membersWhoLiked[like_id].buddy_action=7;
934
935                    if(angular.isDefined($rootScope.loginUser)){
936                        if(angular.isDefined($rootScope.loginUser.id)){
937                            var option = {
938                                url : '/index.php/site/set-follow-bio-sports',
939                                "params":{ member_id: memberId,login_user:$rootScope.loginUser.id }
940                            };
941                            $httpApi.get(option).then(function(response){
942                                $scope.timeLinePosts[post_id].membersWhoLiked[like_id].buddy_action=3;
943                                $scope.getFollowBioSports(memberId)
944                                if(response.following){
945                                    $scope.member.isFollowing=true;
946                                }else{
947                                    $scope.member.isFollowing=false;
948                                }
949
950                            });
951                        }else{
952                            $location.path('/login');
953                        }
954
955                    }else{
956                        $location.path('/login');
957                    }
958
959
960                };
961
962                $scope.unFollowBioSports = function(post_id,like_id,memberId){
963                  //  console.log($scope.timeLinePosts[post_id].membersWhoLiked[like_id].buddy_action);
964                    $scope.timeLinePosts[post_id].membersWhoLiked[like_id].buddy_action=7;
965                    if(angular.isDefined($rootScope.loginUser)){
966                        var option = {
967                            url : '/index.php/site/set-un-follow-bio-sports',
968                            "params":{ member_id: memberId,login_user:$rootScope.loginUser.id }
969                        };
970                        $httpApi.get(option).then(function(response){
971                            $scope.timeLinePosts[post_id].membersWhoLiked[like_id].buddy_action=4;
972                            if(response.following){
973                                $scope.member.isFollowing=false;
974                            }else{
975                                $scope.member.isFollowing=true;
976                            }
977
978                        });
979                    }else{
980                        $location.path('/login');
981                    }
982
983
984                };
985                $scope.setUnFriendRequest = function(post_id,like_id,buddy_id){
986                   // console.log($scope.timeLinePosts[post_id].membersWhoLiked[like_id].buddy_action);
987                    $scope.timeLinePosts[post_id].membersWhoLiked[like_id].buddy_action=7;
988                    var options = {
989                        url:"/index.php/site/set-un-friend-request",
990                        data: {'member_id':$rootScope.loginUser.id,'buddy_id':buddy_id}
991                    };
992                    $httpApi.post(options).then(function(response){
993                        if(response.status == "success"){
994                            $scope.timeLinePosts[post_id].membersWhoLiked[like_id].buddy_action=5;
995                            $scope.getAllMembers();
996                            $scope.buddyStatus=-1;
997
998                        }
999                    })
1000                }
1001
1002
1003
1004                $scope.setFriendRequest = function(post_id,like_id,buddy_id){
1005                    //console.log('Inside in friend request');
1006                    var my_post=$scope.timeLinePosts;
1007                  //  console.log(my_post);
1008                    //console.log($scope.timeLinePosts[post_id].membersWhoLiked[like_id].buddy_action);
1009                    //console.log($scope.timeLinePosts[post_id].membersWhoLiked[like_id].buddy_action);
1010                    $scope.timeLinePosts[post_id].membersWhoLiked[like_id].buddy_action=7;
1011                    //console.log('hii');
1012                    //$scope.sportsIntrest =false;
1013                    //$scope.initPosts();
1014                    //return;
1015
1016                    var options = {
1017                        url: "/index.php/site/get-friend-request",
1018                        data: {'member_id':$rootScope.loginUser.id,'buddy_id':buddy_id }
1019                    };
1020                    $httpApi.post(options).then(function(response){
1021                      //  console.log(response);
1022                        if(response.status == "success"){
1023                            // $rootScope.success_msg = "Your request has been sent successfully.";
1024                            $scope.sportsIntrest =true;
1025                            //$scope.getMemberBuddies();
1026                            $scope.getAllMembers();
1027                           // $scope.buddyStatuss=0;
1028                            $scope.timeLinePosts[post_id].membersWhoLiked[like_id].buddy_action=2;
1029
1030                        }
1031                    });
1032                }
1033
1034                $scope.getDetail =function(buddy){
1035                    if( screen.width <= 480 ) {
1036                    //    console.log(buddy);
1037                        localStorage.setItem('msg_list','');
1038                        localStorage.setItem('msg_list',JSON.stringify(buddy));
1039                        $scope.msg_info=JSON.parse(localStorage.getItem('msg_list'));
1040                     //   console.log( $scope.msg_info);
1041                        $location.path('/mobile-message/mobile-individual');
1042                    }else{
1043                        $location.path('/message');
1044                    }
1045
1046                }
1047
1048                $scope.YouTubeGetID = function(url){
1049                    //console.log(url);
1050                    url = url.split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);
1051                    return (url[2] !== undefined) ? url[2].split(/[^0-9a-z_\-]/i)[0] : url[0];
1052                }
1053
1054                $scope.sportslevel={};
1055                $scope.getSportList_ = function () {
1056
1057                    var options = {
1058                        "url": "/index.php/site/get-sport-list"
1059                    };
1060                    $httpApi.get(options).then(
1061                        function(result){
1062                            $scope.sportActive = result.sportList;
1063                            var options = {
1064                                url: "/index.php/site/get-sport-level"
1065                            };
1066                            $httpApi.get(options).then(function (response) {
1067                                $scope.sportslevel=response.sportList;
1068                                $scope.getSportInterest();
1069                                
1070                            },function(error){
1071                                //console.log("Error occur in fetching sport level");
1072                            });
1073                        },function(error){
1074                            //  console.log("Error occur in fetching sport activity");
1075                        }
1076                    );
1077                };
1078
1079
1080                $scope.getSportNameList_ = function() {
1081                    var options = {
1082                        "url": "/index.php/site/get-sport-list"
1083                    };
1084                    $httpApi.get(options).then(function(data){
1085                        angular.forEach(data.sportList,function(sport){
1086                            var s = {
1087                                "id": sport.id,
1088                                "label": sport.name
1089                            };
1090                            $scope.sportsdata.push(s);
1091                        });
1092                        angular.forEach($scope.member_data, function(member) {
1093                            var sports_ids = member.my_sports.split(",");
1094                            var sportIdSet = new Set(); // Use a Set to store unique sport.id values
1095                            console.log(sports_ids);
1096                        
1097                            var sportName = [];
1098                            angular.forEach(sports_ids, function(id) {
1099                                var indexSportName = $scope.sportsdata.findIndex(function(sport) {
1100                                    return sport.id == id;
1101                                });
1102                                if (indexSportName > -1 && !sportIdSet.has(id)) {
1103                                    // Check if the id is not in the Set to avoid duplicates
1104                                    sportIdSet.add(id); // Add the id to the Set to mark it as seen
1105                                    sportName.push($scope.sportsdata[indexSportName].label);
1106                                }
1107                            });
1108                            member.sportsName = sportName.join(", ");
1109                        });
1110                        
1111                      
1112                    });
1113                };
1114
1115
1116
1117
1118
1119                $scope.sprotsdisps=function (sports) {
1120                    var sportslv=[];
1121                    sportslv = sports.split(',');
1122                    var names=[];
1123                    for(var i=0;i<$scope.sportActive.length;i++)
1124                    {
1125                        for(var j=0;j<sportslv.length;j++) {
1126                            if ($scope.sportActive[i].id == sportslv[j]) {
1127                                names.push($scope.sportActive[i].name);
1128                            }
1129                        }
1130                    }
1131                    return names.join(' ');
1132
1133                };
1134
1135                $scope.sprotsdisp = function (sports) {
1136                    var sportslv = sports.split(',');
1137                    var uniqueIds = new Set();
1138                    var names = [];
1139                
1140                    for (var i = 0; i < $scope.sportActive.length; i++) {
1141                        for (var j = 0; j < sportslv.length; j++) {
1142                            if ($scope.sportActive[i].id == sportslv[j] && !uniqueIds.has(sportslv[j])) {
1143                                names.push($scope.sportActive[i].name);
1144                                uniqueIds.add(sportslv[j]);
1145                            }
1146                        }
1147                    }
1148                
1149                    return names.join(' ');
1150                };
1151                
1152
1153
1154
1155                $scope.processing = false;
1156                $scope.followBioSportsss = function(id){
1157                    console.log(id);
1158                    $scope.processing = true;
1159                    if(angular.isDefined($rootScope.loginUser)){
1160                        if(angular.isDefined($rootScope.loginUser.id)){
1161                            var option = {
1162                                url : '/index.php/site/set-follow-bio-sports',
1163                                "params":{ member_id: id,login_user:$rootScope.loginUser.id }
1164                            };
1165                            $httpApi.get(option).then(function(response){
1166
1167                                if(response.following){
1168                                    $scope.processing = false;
1169                                    $scope.timeLinePosts.isFollowing=true;
1170                                }else{
1171                                    $scope.timeLinePosts.isFollowing=false;
1172                                }
1173
1174                            });
1175                        }else{
1176                            $location.path('/login');
1177                        }
1178
1179                    }else{
1180                        $location.path('/login');
1181                    }
1182
1183
1184                };
1185
1186
1187                $scope.unFollowBioSportsss = function(id){
1188                    if(angular.isDefined($rootScope.loginUser)){
1189                        var option = {
1190                            url : '/index.php/site/set-un-follow-bio-sports',
1191                            "params":{ member_id: id,login_user:$rootScope.loginUser.id }
1192                        };
1193                        $httpApi.get(option).then(function(response){
1194                            $scope.getFollowBioSportsss(id);
1195                            if(response.following){
1196                                $scope.timeLinePosts.isFollowing=false;
1197                            }else{
1198                                $scope.timeLinePosts.isFollowing=true;
1199                            }
1200
1201                        });
1202                    }else{
1203                        $location.path('/login');
1204                    }
1205
1206
1207                };
1208                //$scope.timeLinePosts.isFollowing=false;
1209
1210                $scope.getFollowBioSportsss = function(){
1211                    console.log($scope.timeLinePosts);
1212                    if(angular.isDefined($rootScope.loginUser)){
1213                        var option = {
1214                            url : '/index.php/site/get-following-bio-sports',
1215                            "params":{ member_id: $scope.timeLinePosts[0].member_id,login_user:$rootScope.loginUser.id }
1216                        };
1217                        $httpApi.get(option).then(function(response){
1218                            console.log(response);
1219                            if(response.following == 1){
1220                                $scope.timeLinePosts.isFollowing=true;
1221                            }else{
1222                                $scope.timeLinePosts.isFollowing=false;
1223                            }
1224
1225                        });
1226                    }
1227
1228                };
1229
1230
1231                $scope.goToMsg = function(buddy){
1232                    //  console.log(buddy);
1233                    localStorage.setItem('msg_list','');
1234                    localStorage.setItem('msg_list',JSON.stringify(buddy));
1235                    $scope.msg_info=JSON.parse(localStorage.getItem('msg_list'));
1236                    // console.log( $scope.msg_info);
1237                    $location.path('/mobile-message/mobile-individual');
1238                }
1239
1240                $scope.trustSrcurl = function(data)
1241                {
1242                    return $sce.trustAsResourceUrl(data);
1243                }
1244
1245                $scope.memberPostsImages =[];
1246                $scope.MemberVideoDetail =[];
1247                $scope.getMemberPhotos = function(){
1248                    //  $log.debug('fetching timeline photos');
1249                    var userId=$rootScope.userDetail.id;
1250                    if(localStorage.getItem('UserPhotoId'))
1251                    {
1252                        userId  = parseInt(JSON.parse(localStorage.getItem('UserPhotoId')));
1253                    }
1254
1255                    var options = {
1256                        url: "/index.php/site/member-timeline-photo",
1257                        data: {"id": userId, "login_id": $rootScope.loginUser.id }
1258                    };
1259
1260                    $httpApi.post(options).then(function(response){
1261                        console.log(response);
1262                        // console.log(response.MemberVideoDetail);
1263                        $scope.MemberVideoDetail =  response.MemberVideoDetail;
1264                        $scope.image_url = response.MemberPhotoDetail;
1265
1266                        angular.forEach(response.MemberPhotoDetail, function (albums,key) {
1267                            var images = [];
1268                            angular.forEach(albums,function(photo){
1269                                images.push({
1270                                    id:key,
1271                                    src: awsUrl + 'users/Post/Photo/' + photo['photo_url'],      // url
1272                                    srcc: awsUrl + 'users/Post/Videos/' + photo['video_url'],      // url
1273                                    vid: photo['video_url'],
1274                                    pid: photo['photo_url'],
1275                                    alt: '',          // alternative text
1276                                    title: ''        // title
1277                                    //caption: photo.message  // modal caption
1278                                });
1279                            });
1280                            if(images.length > 0)
1281                                $scope.memberPostsImages.push(images);
1282                            console.log( $scope.memberPostsImages);
1283                        });
1284                    })
1285                };
1286                $rootScope.userDetail.buddyStatus = false;
1287                $scope.buddyStatuss={};
1288                $scope.checkBuddyStatus = function () {
1289                    console.log($rootScope.userDetail);
1290                    $scope.checkBuddyS();
1291                    $scope.checkBuddyF();
1292                    $scope.checkBuddyStatusData();
1293                    $scope.getFollowBioSportsData();
1294                    $scope.getSportInterest();
1295                    var user_id = $rootScope.userDetail.id;
1296                    if(angular.isDefined($rootScope.loginUser)){
1297                        var option = {
1298                            url : '/index.php/site/get-buddy-status',
1299                            "params":{ member_id: user_id,login_user:$rootScope.loginUser.id }
1300                        };
1301                        $httpApi.get(option).then(function(response){
1302                            $scope.buddyStatus = response.buddyStatus;
1303                            console.log($scope.buddyStatus);
1304                            if(response.buddyStatus == 0){
1305                                console.log($rootScope.userDetail.buddyStatus);
1306                                $rootScope.userDetail.buddyStatus=false;
1307                            }else{
1308                                $rootScope.userDetail.buddyStatus=true;
1309                            }
1310
1311                        });
1312                    }
1313                };
1314
1315                $scope.checkBuddyStatusData = function () {
1316                    var user_id = $rootScope.userDetail.id;
1317                    if(angular.isDefined($rootScope.loginUser)){
1318                        var option = {
1319                            url : '/index.php/site/get-buddy-status-data',
1320                            "params":{ member_id: user_id,login_user:$rootScope.loginUser.id }
1321                        };
1322                        $httpApi.get(option).then(function(response){
1323                            $scope.buddyStatuss = response.buddyStatus;
1324                            console.log($scope.buddyStatus);
1325                        });
1326                    }
1327                };
1328
1329
1330                $scope.buddyStatusData = {};
1331                $scope.checkBuddyS = function () {
1332                    if(angular.isDefined($rootScope.loginUser)){
1333                        var option = {
1334                            url : '/index.php/site/get-buddy-status-step-t',
1335                            "params":{ member_id: user_id,login_user:$rootScope.loginUser.id }
1336                        };
1337                        $httpApi.get(option).then(function(response){
1338                            $scope.buddyStatusData = response.buddyStpeThree;
1339                               console.log($scope.buddyStatusData);
1340
1341
1342                        });
1343                    }
1344                };
1345
1346                $scope.buddyFollowStatusData ={};
1347                $scope.checkBuddyF = function () {
1348                    if(angular.isDefined($rootScope.loginUser)){
1349                        var option = {
1350                            url : '/index.php/site/get-buddy-status-step-f',
1351                            "params":{ member_id: user_id,login_user:$rootScope.loginUser.id }
1352                        };
1353                        $httpApi.get(option).then(function(response){
1354                            $scope.buddyFollowStatusData = response.buddyStpeFour;
1355                              console.log($scope.buddyFollowStatusData);
1356
1357
1358                        });
1359                    }
1360                };
1361
1362                $scope.getFollowBioSportsData = function(){
1363                    if(angular.isDefined($rootScope.loginUser)){
1364                        var option = {
1365                            url : '/index.php/site/get-following-bio-sports',
1366                            "params":{ member_id: user_id,login_user:$rootScope.loginUser.id }
1367                        };
1368                        $httpApi.get(option).then(function(response){
1369                            if(response.following == 1){
1370                                $rootScope.userDetail.isFollowing=true;
1371                            }else{
1372                                $rootScope.userDetail.isFollowing=false;
1373                            }
1374
1375                        });
1376                    }
1377
1378                };
1379
1380                $scope.unFollowBioSuggestion = function(user_id){
1381                    if(angular.isDefined($rootScope.loginUser)){
1382                        var option = {
1383                            url : '/index.php/site/set-un-follow-bio-sports',
1384                            "params":{ member_id: user_id,login_user:$rootScope.loginUser.id }
1385                        };
1386                        $httpApi.get(option).then(function(response){
1387                            if(response.following){
1388                                $rootScope.userDetail.isFollowing=false;
1389                            }else{
1390                                $rootScope.userDetail.isFollowing=true;
1391                            }
1392
1393                        });
1394                    }else{
1395                        $location.path('/login');
1396                    }
1397
1398
1399                };
1400
1401                $scope.processing = false;
1402                $scope.followBioSuggestion = function(user_id){
1403                    $scope.processing = true;
1404                    if(angular.isDefined($rootScope.loginUser)){
1405                        if(angular.isDefined($rootScope.loginUser.id)){
1406                            var option = {
1407                                url : '/index.php/site/set-follow-bio-sports',
1408                                "params":{ member_id: user_id,login_user:$rootScope.loginUser.id }
1409                            };
1410                            $httpApi.get(option).then(function(response){
1411                                if(response.following){
1412                                    $scope.processing = false;
1413                                    $rootScope.userDetail.isFollowing=true;
1414                                }else{
1415                                    $rootScope.userDetail.isFollowing=false;
1416                                }
1417
1418                            });
1419                        }else{
1420                            $location.path('/login');
1421                        }
1422
1423                    }else{
1424                        $location.path('/login');
1425                    }
1426
1427
1428                };
1429
1430                $scope.addProcessing = false;
1431                $scope.setFriendRequests = function(buddy_id){
1432                    $scope.addProcessing = true;
1433                    //$scope.sportsIntrest =false;
1434                    var options = {
1435                        url: "/index.php/site/get-friend-request",
1436                        data: {'member_id':$rootScope.loginUser.id,'buddy_id':buddy_id }
1437                    };
1438                    $httpApi.post(options).then(function(response){
1439                        if(response.status == "success"){
1440                            $scope.addProcessing = false;
1441                            // $rootScope.success_msg = "Your request has been sent successfully.";
1442                            $scope.sportsIntrest =true;
1443                            //$scope.getMemberBuddies();
1444                            $scope.getAllMembers();
1445                            $scope.buddyStatuss=0;
1446
1447                        }
1448                    });
1449                }
1450
1451                $scope.setUnFriendRequestss = function(buddy_id){
1452
1453                    if(buddy_id != -1){
1454                        SweetAlert.swal({
1455                                title: "Are you sure you want to unbuddy?", //Bold text
1456
1457                                showCancelButton: true, // displays cancel btton
1458                                confirmButtonColor: "#555",
1459                                confirmButtonText: "Yes",
1460                                closeOnConfirm: true, //do not close popup after click on confirm, usefull when you want to display a subsequent popup
1461                                closeOnCancel: true
1462                            },
1463                            function(isConfirm){ //Function that triggers on user action.
1464                                if(isConfirm){
1465                                    //   $log.debug('unbuddy request:',buddy_id);
1466                                    var options = {
1467                                        url:"/index.php/site/set-un-friend-request",
1468                                        data: {'member_id':$rootScope.loginUser.id,'buddy_id':buddy_id}
1469                                    };
1470                                    $httpApi.post(options).then(function(response){
1471                                        if(response.status == "success"){
1472                                            // $rootScope.success_msg = "You have removed buddy from your sports circle.";
1473                                            //$scope.getMemberBuddies();
1474                                            $scope.getAllMembers();
1475                                            $scope.buddyStatuss=-1;
1476
1477                                        }
1478                                    })
1479
1480
1481                                }else{
1482
1483                                }
1484                            });
1485                    }else{
1486                        SweetAlert.swal({
1487                                title: "Are you sure you want to Unfollow?", //Bold text
1488                                showCancelButton: true, // displays cancel btton
1489                                confirmButtonColor: "#555",
1490                                confirmButtonText: "Yes",
1491                                closeOnConfirm: true, //do not close popup after click on confirm, usefull when you want to display a subsequent popup
1492                                closeOnCancel: true
1493                            },
1494                            function(isConfirm){ //Function that triggers on user action.
1495                                if(isConfirm){
1496                                    // $log.debug('unfollow request:',buddy_id);
1497
1498                                    var options = {
1499                                        url:"/index.php/site/set-un-friend-request",
1500                                        data: {'member_id':$rootScope.loginUser.id,'buddy_id':buddy_id}
1501                                    };
1502
1503                                    $httpApi.post(options).then(function(response){
1504                                        if(response.status == "success"){
1505                                            $rootScope.success_msg = "You have Unfollowed Xplore Sports.";
1506                                            $fancyModal.open({
1507                                                templateUrl: './views/modal/successfully_register.html',
1508                                                themeClass: 'fancymodal-theme-classic'
1509                                            });
1510                                            //$scope.getMemberBuddies();
1511                                            $scope.getAllMembers();
1512                                            $scope.buddyStatuss=-1;
1513
1514                                        }
1515                                    })
1516
1517
1518                                }else{
1519
1520                                }
1521                            });
1522                    }
1523
1524
1525
1526
1527                };
1528
1529                $scope.getSportInterest = function(){
1530                    var options = {
1531                        url:"/index.php/site/get-member-sport-interest",
1532                        data: {"member_id":user_id }
1533                    };
1534
1535                    $httpApi.post(options).then(function(response){
1536                        $scope.sportsIntrest =true;
1537                        $scope.member_sport_intrest_tbl =[];
1538                        $scope.member_sport_interest_name="";
1539                        var counter = 0;
1540                        if(response.data.length){
1541                            if(response.data[0].member_id == parseInt($rootScope.userDetail.id)){
1542                                angular.forEach(response,function(res,key){
1543                                    angular.forEach(res,function(sportInterest){
1544                                        // debugger;
1545                                        console.log(sportInterest);
1546                                        var index =  $scope.sportActive.findIndex(x => x.id == sportInterest.sport_id);
1547                                        var keySportLevel =  $scope.sportslevel.findIndex(x => x.id == sportInterest.level);
1548
1549                                        $scope.member_sport_intrest_tbl.push( {"favorite_player":sportInterest.favorite_player, "sport_activity":sportInterest.sport_id,"sport_interest":sportInterest.level,"sport_name":$scope.sportActive[index].name,"sport_level":$scope.sportslevel[keySportLevel].name});
1550
1551                                        if(counter <=2 ){
1552                                            $scope.member_sport_interest_name += $scope.sportActive[index].name + " ";
1553                                            /*$scope.member_sport_interest_name += $scope.sportActive[index].name + ", ";*/
1554
1555                                            counter++;
1556                                        }
1557                                    });
1558
1559                                    if(Object.keys(res).length > 3){
1560                                        $scope.member_sport_interest_name = $scope.member_sport_interest_name.slice(0,-2) + " ...";
1561                                    }else{
1562                                        $scope.member_sport_interest_name = $scope.member_sport_interest_name.slice(0,-2);
1563                                    }
1564                                });
1565                            }else{
1566                                angular.forEach(response,function(res,key){
1567                                    angular.forEach(res,function(sportInterest){
1568                                        // console.log(sportInterest);
1569                                        var index =  $scope.sportActive.findIndex(x => x.id == sportInterest.sport_id);
1570                                        var keySportLevel =  $scope.sportslevel.findIndex(x => x.id == sportInterest.level);
1571                                        $scope.member_sport_intrest_tbl.push( {
1572                                            "sport_activity":sportInterest.sport_id,
1573                                            "sport_interest":sportInterest.level,
1574                                            "sport_name":$scope.sportActive[index].name,
1575                                            "sport_level":$scope.sportslevel[keySportLevel].name});
1576                                    });
1577
1578                                });
1579                            }
1580                        }
1581
1582                    })
1583                }
1584
1585
1586                 $scope.goToCompany = function(gectbl) {
1587
1588                    if (gectbl.selectedService == 7) {
1589
1590                        // Clubs
1591                        $location.path('/clubs/' + gectbl.uniqueName);
1592
1593                    } else if (gectbl.selectedService == 2) {
1594
1595                        // Gyms
1596                        $location.path('/gyms/' + gectbl.uniqueName);
1597
1598                    } else if (gectbl.selectedService == 3) {
1599
1600                        // Stores
1601                        $location.path('/stores/' + gectbl.uniqueName);
1602
1603                    } else if (gectbl.selectedService == 1) {
1604
1605                        // Academies
1606                        $location.path('/academies/' + gectbl.uniqueName);
1607
1608                    }
1609                };
1610
1611
1612
1613
1614
1615
1616            }]);
1617})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.