PageSourceSearch

https://www.xploresports.com/js/user/sports-talent.js

js xploresports.com collected 2026-09-30 11:47:15 UTC 28,110 bytes, 637 lines download raw bytes

1(function() {
2    "use strict";
3    angular.module('SportsTalent', ['ngSanitize', 'ui.select'])
4        .controller('SportsTalentController', ['$scope', '$log', '$timeout', 'API_BASE_URL','$location','$rootScope','$window','$compile','$q','$filter','$loading','$anchorScroll','$httpApi','$route',
5            function ($scope, $log, $timeout, API_BASE_URL,$location,$rootScope,$window,$compile,$q,$filter,$loading,$anchorScroll,$httpApi,$route) {
6
7                   /// console.log('SportsTalentController Initialized');
8
9                    $scope.sportBio = [];
10                    $scope.sportsdata = [];
11                    $rootScope.spinner = {active : true};
12                    $scope.type=[{"id":1,name:"Yes"},{"id":2,name:"No"}]
13                    $scope.gender=[{"id":0,name:"Male"},{"id":1,name:"Female"}]
14
15
16                $scope.setFilter = function (filter) {
17                    $scope.selectedFilter = filter;
18                };
19                $scope.filterDeals = {};
20                $scope.myFilter = {};
21                $scope.onCategoryChange = function(){
22                    var result = $scope.backupBio;
23                    var finalViewArray = [];
24
25                    if(angular.isDefined($scope.myFilter)){
26                        finalViewArray = [];
27                        angular.forEach(result, function (bio) {
28                            if(bio.my_sports == $scope.myFilter.my_sports.id){
29                                finalViewArray.push(bio);
30                            }
31                        });
32                        result = finalViewArray;
33                    }
34                    $scope.sportBio = result;
35                    //$scope.sportBio.push(result);
36                    //console.log($scope.member);
37                };
38
39
40
41                $scope.myFilter ={};
42                $scope.myFilter.city = '';
43                $scope.myFilter.sportsName = '';
44                $scope.myFilter.country ='';
45
46                $scope.bioCity=[];
47                $scope.bioCountry=[];
48                $scope.bioState=[];
49                $scope.sportBiooo =[];
50                $scope.talentCategory =[];
51
52                $scope.blockFilter = false;
53
54                $scope.page_no = 8;
55                $scope.page = 8;
56                //$scope.entryLimit = 10;
57                $scope.loadMoreTalent = function(){
58                    $scope.page +=8;
59                  //  console.log($scope.page);
60                    $scope.initSportsTalent();
61                }
62
63
64                $scope.searchButtonText = "Search";
65                $scope.searchButtonText = false;
66                $scope.loadMorePageData = function(){
67                    $scope.searchButtonText = "Searching";
68                    $scope.page_no +=8;
69                    $scope.initSportsTalents();
70                    $timeout(function(){
71                        $scope.searchButtonText = "Search";
72                    }, 2000);
73
74                };
75
76
77                $scope.initSportsTalent = function () {
78                    $scope.dta_display = false;
79                   // console.log('[' + Math.floor(Date.now() / 1000)+ ']' + "BEFORE PHP CALLL controller")
80                        var options = {
81                            "url": "/index.php/site/get-published-sports-bio",
82                            // "params":{page:$scope.page,sports_id:sports_id}
83
84                        };
85                    var seconds  = new Date().getTime() / 1000;
86                    //console.log('[' + Math.floor(Date.now() / 1000)+ ']' + "AFTER CALL  Inside controller")
87                        $httpApi.get(options).then(function(response){
88                            //    console.log(response)
89                            //console.log('[' + Math.floor(Date.now() / 1000)+ ']' + "TIMESTAMP after response from  php")
90                            //console.log("Response length" + response)
91                            //console.log('[' + Math.floor(Date.now() / 1000)+ ']' + "TIMESTAMP  0")
92
93                            angular.forEach(response,function (member) {
94                                $scope.blockI = true;
95
96                                $scope.sportBio.push(member);
97
98                                $scope.totalItems = $scope.sportBio.length;
99                                //$scope.noOfPages = Math.ceil($scope.totalItems / $scope.entryLimit);
100                                $scope.backupBio = $scope.sportBio;
101                                //console.log("TIMESTAMP  1")
102                                angular.forEach($scope.sportBio,function (bio) {
103                                    var indexCity = $scope.bioCity.findIndex(function (bioCity) {
104                                        return bioCity == bio.city;
105                                    });
106                                    if(indexCity == -1){
107                                        $scope.bioCity.push(bio.city);
108                                        var itemsSorted  = $filter('orderBy')($scope.bioCity, 'TypeId')
109                                    }
110
111                                });
112                                //console.log("TIMESTAMP  2")
113                                angular.forEach($scope.sportBio,function (bio) {
114                                    var indexCity = $scope.bioCountry.findIndex(function (bioCountry) {
115                                        return bioCountry == bio.country;
116                                    });
117                                    if(indexCity == -1){
118                                        $scope.bioCountry.push(bio.country);
119                                        var itemsSorted  = $filter('orderBy')($scope.bioCountry, 'TypeId')
120                                    }
121
122                                });
123                                //console.log("TIMESTAMP  3")
124                                angular.forEach($scope.sportBio,function (bio) {
125                                    var indexCity = $scope.bioState.findIndex(function (bioState) {
126                                        return bioState == bio.state;
127                                    });
128                                    if(indexCity == -1){
129                                        $scope.bioState.push(bio.state);
130                                    }
131
132                                });
133
134
135                            });
136                           // console.log('[' + Math.floor(Date.now() / 1000)+ ']' + "TIMESTAMP  before  getSportList")
137                            $scope.getSportList();
138                            //console.log('[' + Math.floor(Date.now() / 1000)+ ']' + "TIMESTAMP  before  getTalentTypeInfo")
139                            $scope.getTalentTypeInfo();
140                            //$scope.initSportsTalents();
141                            //console.log('[' + Math.floor(Date.now() / 1000)+ ']' + "TIMESTAMP  after   getTalentTypeInfo")
142                        });
143                    };
144
145
146
147                $scope.initFilter = function(){
148                    $timeout(function(){
149                        $scope.initSportsTalent();
150                        $scope.getBioSports();
151                    }, 5000);
152
153
154
155                }
156
157                $scope.sportBios =[];
158                $scope.loader = true;
159                $scope.initSportsTalents = function(){
160
161                    var options ={
162                        "url": "/index.php/site/get-publish-sport-talent",
163                        "params":{page:$scope.page_no}
164                    }
165                    $httpApi.get(options).then(function(response){
166                        $rootScope.spinner = {active : false};
167                       /* $timeout(function(){
168
169                        }, 2000);*/
170                        $scope.loader = false;
171
172                        $scope.dta_display = false;
173                        angular.forEach(response,function (member) {
174                            $scope.sportBios.push(member);
175                        });
176                    });
177                    $scope.getSportList();
178                   // $scope.initSportsTalent();
179                }
180
181                $scope.searchTalent =[];
182                $scope.initSportsTalentSearch = function(search_query){
183                    console.log(search_query);
184                    var options ={
185                        "url": "/index.php/site/get-publish-sport-talent-search",
186                        "params":{search_query:search_query}
187                    }
188                    $httpApi.get(options).then(function(response){
189                        angular.forEach(response,function (member) {
190                            $scope.searchTalent.push(member);
191                            console.log($scope.searchTalent);
192                        });
193                    });
194                    $scope.getSportList();
195                }
196
197
198
199
200
201
202
203
204
205                $scope.resetFilter = function(){
206                    delete $scope.selectedFilter;
207                    delete $scope.myFilter.city
208                    $scope.defaultFilter = 0;
209                  //  console.log($scope.defaultFilter);
210                }
211                $scope.getListTalentType =[];
212                $scope.talentTypes = [];
213                $scope.getTalentTypeInfo = function(){
214                    var option ={
215                        url:"/index.php/site/get-talent-type",
216                    };
217                    $httpApi.get(option).then(function(response){
218                        /*console.log(response);*/
219                        //$scope.getListTalentType = response.bioTalentTypes;
220                    angular.forEach(response.bioTalentTypes,function(type){
221                        var s = {
222                            "id":type.id,
223                            "label":type.type,
224                            "type_order": type.type_order,
225                        };
226                        $scope.getListTalentType.push(s);
227                      //  console.log($scope.getListTalentType)
228                    })
229
230                        angular.forEach($scope.sportBio,function (tp) {
231                            var indexSportId = $scope.getListTalentType.findIndex(function (tps) {
232                                return tps.id == tp.sport_info;
233                            });
234
235                            if(indexSportId > -1){
236                                var indexDealSport = $scope.talentTypes.findIndex(function (talentTypes) {
237
238                                    return talentTypes.id == tp.sport_info;
239                                });
240                                if(indexDealSport == -1){
241                                    $scope.talentTypes.push($scope.getListTalentType[indexSportId]);
242                                }
243
244                            }
245                        });
246
247                    });
248                }
249                $scope.bioSportsData =[];
250                $scope.getBioSports = function(){
251                    var options = {
252                        "url": "/index.php/site/get-sport-list-for-coach"
253                    };
254                    $httpApi.get(options).then(function(data){
255                        $scope.bioSportsData = data.sportBio;
256                        //console.log($scope.bioSportsData);
257                    });
258                }
259
260
261                $scope.dealsSport =[];
262
263                $scope.getSportList = function() {
264                    var options = {
265                        "url": "/index.php/site/get-sport-list"
266                    };
267                    $httpApi.get(options).then(function(data){
268                        angular.forEach(data.sportList,function(sport){
269                            var s = {
270                                "id": sport.id,
271                                "label": sport.name
272                            };
273                            $scope.sportsdata.push(s);
274                        });
275                        //var sports_ids = JSON.parse(localStorage.getItem('user')).my_sports.split(",");
276                        angular.forEach($scope.sportBio,function (member) {
277                            var sports_ids = member.my_sports.split(",");
278
279                            var sportName = [];
280                            angular.forEach(sports_ids,function (id) {
281                                var indexSportName = $scope.sportsdata.findIndex(function (sport) {
282                                    return sport.id == id;
283                                });
284                                if(indexSportName > -1){
285                                    sportName.push($scope.sportsdata[indexSportName].label);
286                                }
287                            });
288                            member.sportsName = sportName.join(", ");
289                        });
290                        angular.forEach($scope.sportBios,function (member) {
291                            var sports_ids = member.my_sports.split(",");
292
293                            var sportName = [];
294                            angular.forEach(sports_ids,function (id) {
295                                var indexSportName = $scope.sportsdata.findIndex(function (sport) {
296                                    return sport.id == id;
297                                });
298                                if(indexSportName > -1){
299                                    sportName.push($scope.sportsdata[indexSportName].label);
300                                }
301                            });
302                            member.sportsName = sportName.join(", ");
303                        });
304
305                        angular.forEach($scope.sportBiooo,function (member) {
306                            var sports_ids = member.my_sports.split(",");
307                            var sportName = [];
308                            angular.forEach(sports_ids,function (id) {
309                                var indexSportName = $scope.sportsdata.findIndex(function (sport) {
310                                    return sport.id == id;
311                                });
312                                if(indexSportName > -1){
313                                    sportName.push($scope.sportsdata[indexSportName].label);
314                                }
315                            });
316                            member.sportsName = sportName.join(', ');
317                        });
318                       // $scope.talentCategory =[];
319                        angular.forEach($scope.talentCategory,function (member) {
320                            var sports_ids = member.my_sports.split(",");
321                            var sportName = [];
322                            angular.forEach(sports_ids,function (id) {
323                                var indexSportName = $scope.sportsdata.findIndex(function (sport) {
324                                    return sport.id == id;
325                                });
326                                if(indexSportName > -1){
327                                    sportName.push($scope.sportsdata[indexSportName].label);
328                                }
329                            });
330                            member.sportsName = sportName.join(', ');
331                        });
332                        angular.forEach($scope.sportCategoryFilter,function (member) {
333                            var sports_ids = member.my_sports.split(",");
334                            var sportName = [];
335                            angular.forEach(sports_ids,function (id) {
336                                var indexSportName = $scope.sportsdata.findIndex(function (sport) {
337                                    return sport.id == id;
338                                });
339                                if(indexSportName > -1){
340                                    sportName.push($scope.sportsdata[indexSportName].label);
341                                }
342                            });
343                            member.sportsName = sportName.join(', ');
344                        });
345
346                        angular.forEach($scope.sportBio,function (deal) {
347                            var indexSportId = $scope.sportsdata.findIndex(function (sport) {
348                                return sport.id== deal.my_sports;
349                            });
350
351                            if(indexSportId > -1){
352                                var indexDealSport = $scope.dealsSport.findIndex(function (dealSport) {
353
354                                    return dealSport.id == deal.my_sports;
355                                });
356                                if(indexDealSport == -1){
357                                    $scope.dealsSport.push($scope.sportsdata[indexSportId]);
358                                }
359
360                            }
361                        });
362
363
364                    });
365                };
366                $scope.filterDeals = {};
367                $scope.myFilter = {};
368                $scope.onCategoryChange = function(){
369                    var result = $scope.backupBio;
370                    var finalViewArray = [];
371                    if(angular.isDefined($scope.myFilter)){
372                        finalViewArray = [];
373                        angular.forEach(result, function (bio) {
374                            if(bio.my_sports == $scope.myFilter.my_sports.id){
375                                finalViewArray.push(bio);
376                            }
377                        });
378                        result = finalViewArray;
379                    }
380                    if($scope.myFilter.city){
381                        angular.forEach(result, function (bio) {
382                            if(bio.city == $scope.myFilter.city){
383                                finalViewArray.push(bio);
384                            }
385                        });
386                        result = finalViewArray;
387                    }
388                    $scope.sportBio = result;
389                };
390
391                $scope.onCatChange = function(){
392                    var result = $scope.backupBio;
393                    var finalViewArray = [];
394                    if($scope.myFilter.country){
395                        angular.forEach(result, function (bio) {
396                            if(bio.country == $scope.myFilter.country){
397                                finalViewArray.push(bio);
398                            }
399                        });
400                        result = finalViewArray;
401                    }
402
403                    $scope.sportBio = result;
404                }
405
406                $scope.defaultFilter = 1;
407                $scope.blockI = true;
408                $scope.blockFilter = false;
409                $scope.resetBio = function(){
410                    $('#myFormCustom').trigger("reset");
411                    $scope.dta_display == false;
412                    $scope.initSportsTalents();
413                    $scope.defaultFilter = 1;
414                    $scope.blockI = true;
415                    $scope.blockFilter = false;
416                    //$scope.resetKeyBio();
417                    delete $scope.myFilter;
418                    delete $scope.myFilter.abled;
419                    delete $scope.selectedFilter.country;
420                    delete $scope.myFilter.city;
421                   // console.log($scope.defaultFilter);
422                }
423
424                $scope.clear = function() {
425                    $scope.myFilter.country = undefined;
426                    $scope.myFilter.city = undefined;
427                    $scope.defaultFilter = 1;
428                    $scope.myFilter.abled = undefined;
429                    $scope.myFilter.sport_info = undefined;
430                    $scope.myFilter.sportsName = undefined;
431                    $scope.myFilter.gender = undefined;
432                    $scope.searchSports ='';
433                    $scope.displayDropdown = false;
434
435
436                };
437                function makeid()
438                {
439                    var text = "";
440                    var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
441
442                    for( var i=0; i < 5; i++ )
443                        text += possible.charAt(Math.floor(Math.random() * possible.length));
444
445                    return text;
446                }
447
448                $scope.wayToSportsBio = function(id){
449                    $location.path('/sports-bio/'+ id);
450                }
451
452                $scope.memberTimeline = function(id, user_type_id){
453
454                    $scope.timeLinePosts=[];
455                    if(user_type_id == 1){
456                        localStorage.setItem('timelineMemberID','');
457                        localStorage.setItem('timelineMemberID',JSON.stringify(id));
458                        $location.path('/sportsline/member/'+ makeid());
459                    } else if (user_type_id == 2) {
460                        var options = {
461                            url: "/index.php/site/get-partner-details",
462                            data: { 'id': id }
463                        };
464                        $httpApi.post(options).then(function (response) {
465                            //console.log(response);
466                            localStorage.setItem('companyTimeline','');
467                            //console.log(id);
468                            localStorage.setItem('companyTimeline',JSON.stringify(response.data[0]));
469                            $location.path('/company/'+ makeid());
470                        });
471                    }
472
473                };
474
475                $scope.categoryList = [];
476                $scope.sportsCategoryList = function(){
477                    var options ={
478                        url:"/index.php/site/get-bio-sports"
479                    };
480                    $httpApi.get(options).then(function(response){
481                        $scope.categoryList = response.bioSports;
482
483                    });
484
485                }
486
487
488                $scope.sportslevel={};
489                $scope.sportActive =[];
490                $scope.getSportLists = function () {
491                    var options = {
492                        "url": "/index.php/site/get-sport-list"
493                    };
494                    $httpApi.get(options).then(
495                        function(result){
496                            $scope.sportActive = result.sportList;
497                            var options = {
498                                url: "/index.php/site/get-sport-level"
499                            };
500                            $httpApi.get(options).then(function (response) {
501                                $scope.sportslevel=response.sportList;
502                                //$scope.getSportInterest();
503                            },function(error){
504                                //console.log("Error occur in fetching sport level");
505                            });
506                        },function(error){
507                            console.log("Error occur in fetching sport activity");
508                        }
509                    );
510                };
511
512                $scope.sportActive =[];
513                $scope.sprotsdisp=function (sports) {
514                    var sportslv=[];
515                    sportslv = sports.split(',');
516                    var names=[];
517                    for(var i=0;i<$scope.sportActive.length;i++)
518                    {
519                        for(var j=0;j<sportslv.length;j++) {
520                            if ($scope.sportActive[i].id == sportslv[j]) {
521                                names.push($scope.sportActive[i].name);
522                            }
523                        }
524                    }
525                    return names.join(' ');
526
527                };
528
529                $scope.displayDropdown = false;
530                $scope.bioCityDetails =[];
531                $scope.bioActiveDetails =[];
532                $scope.getDataForCity = function(country){
533                   // $scope.myFilter.city = undefined;
534                    $scope.bioCityDetails =[];
535                    var country = country;
536                    var option ={
537                        "url": "/index.php/site/get-member-city",
538                        "data": {country : country}
539                    };
540                    $httpApi.post(option).then(function(response){
541                        /* console.log(response);*/
542                        $scope.matchResult = response.country;
543                       // console.log($scope.matchResult);
544                        $scope.displayDropdown = true;
545
546
547                        angular.forEach($scope.matchResult,function (bio) {
548                            var indexCity = $scope.bioCityDetails.findIndex(function (bioCityDetails) {
549                                return bioCityDetails == bio.city;
550                            });
551                            if(indexCity == -1){
552                                $scope.bioCityDetails.push(bio.city);
553
554                            }
555
556                        });
557                    });
558                }
559
560                $scope.filterType = 8;
561               // console.log($scope.filterType);
562                $scope.loadType = function(){
563                    $scope.filterType +=8;
564                    // console.log($scope.filterType);
565                    $scope.talentCategoryData();
566                }
567                $scope.loadSportsType = function(){
568                    $scope.filterType +=8;
569                   // console.log($scope.filterType);
570                    $scope.sportsCategoryData();
571                }
572
573
574                    $scope.sportBiooo = [];
575                     $scope.loaders = true;
576                    $scope.sportsCategoryData =function() {
577                        var red_path = localStorage.getItem('bioRedirect');
578                        $scope.id = red_path;
579                        var option = {
580                            "url": "/index.php/site/get-new-bio",
581                            params: {id: $scope.id,page: $scope.filterType}
582                        };
583                        $httpApi.get(option).then(function (response) {
584                            $rootScope.spinner = {active : false};
585                            $scope.loaders = false;
586                            $scope.sportBiooo = response.newfilter
587                          //  console.log($scope.sportBiooo)
588                            $scope.getSportList();
589                        })
590                    }
591
592                $scope.sportsAllCategoryData =function() {
593                    var red_path = localStorage.getItem('bioRedirect');
594                    $scope.id = red_path;
595                    var option = {
596                        "url": "/index.php/site/get-all-new-bio",
597                        params: {id: $scope.id}
598                    };
599                    $httpApi.get(option).then(function (response) {
600                        $rootScope.spinner = {active : false};
601                        $scope.loaders = false;
602                        $scope.sportCategoryFilter = response.newBioFilter;
603                        $scope.getSportList();
604                    })
605                }
606
607
608                $scope.loader = true;
609                if($location.$$path == '/sports-talent/talent-type') {
610                    $scope.talentCategory=[];
611
612                    $scope.talentCategoryData =function(){
613                        var talent_path = localStorage.getItem('bioRedirect');
614                        $scope.type_id = talent_path;
615                        var option ={
616                            "url":"/index.php/site/get-sports-talent-type",
617                            params: { id: $scope.type_id, page: $scope.filterType }
618                        };
619                        $httpApi.get(option).then(function(response){
620                            $rootScope.spinner = {active : false};
621                            $scope.loader = false;
622                            $scope.talentCategory = response.newfilter
623                            // console.log($scope.talentCategory)
624                            $scope.getSportList();
625                        })
626
627                    }
628
629                }
630
631
632
633
634            }])/*controller declaration end tags */
635
636})();
637

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.