diff --git a/assets/js/admin/sportspress-admin.js b/assets/js/admin/sportspress-admin.js
index ca7c70b1..702799c2 100644
--- a/assets/js/admin/sportspress-admin.js
+++ b/assets/js/admin/sportspress-admin.js
@@ -636,23 +636,49 @@ jQuery(document).ready(function($){
$target = $(".sp-instance").eq(index).find(".sp-ajax-checklist ul");
if ( response.success ) {
$target.html("");
- if(response.data.players.length) {
- $target.eq(0).append("
");
- $(response.data.players).each(function( key, value ) {
- $target.eq(0).append("");
- });
- $target.eq(0).append("" + localized_strings.show_all + "");
+ i = 0;
+ if(-1 == response.data.sections) {
+ if(response.data.players.length) {
+ $target.eq(0).append("");
+ $(response.data.players).each(function( key, value ) {
+ $target.eq(0).append("");
+ });
+ $target.eq(0).append("" + localized_strings.show_all + "");
+ } else {
+ $target.eq(0).html("" + localized_strings.no_results_found + " " + localized_strings.show_all + "");
+ }
} else {
- $target.eq(0).html("" + localized_strings.no_results_found + " " + localized_strings.show_all + "");
+ if ( 1 == response.data.sections ) {
+ defense = i;
+ offense = i+1;
+ } else {
+ offense = i;
+ defense = i+1;
+ }
+ if(response.data.players.length) {
+ $target.eq(offense).append("");
+ $target.eq(defense).append("");
+ $(response.data.players).each(function( key, value ) {
+ $target.eq(offense).append("");
+ $target.eq(defense).append("");
+ });
+ $target.eq(offense).append("" + localized_strings.show_all + "");
+ $target.eq(defense).append("" + localized_strings.show_all + "");
+ } else {
+ $target.eq(offense).html("" + localized_strings.no_results_found + " " + localized_strings.show_all + "");
+ $target.eq(defense).html("" + localized_strings.no_results_found + " " + localized_strings.show_all + "");
+ }
+ i++;
}
+ i++;
if(response.data.staff.length) {
- $target.eq(1).append("");
+ $target.eq(i).append("");
$(response.data.staff).each(function( key, value ) {
- $target.eq(1).append("");
+ $target.eq(i).append("");
});
- $target.eq(1).append("" + localized_strings.show_all + "");
+ $target.eq(i).append("" + localized_strings.show_all + "");
} else {
- $target.eq(1).html("" + localized_strings.no_results_found + " " + localized_strings.show_all + "");
+ $target.eq(i).html("" + localized_strings.no_results_found + " " + localized_strings.show_all + "");
}
} else {
$target.html("" + localized_strings.no_results_found + "");
@@ -679,20 +705,43 @@ jQuery(document).ready(function($){
$target = $(".sp-instance").eq(index).find(".sp-ajax-checklist ul");
$target.find(".sp-ajax-show-all-container").hide();
if ( response.success ) {
- if(response.data.players.length) {
- $(response.data.players).each(function( key, value ) {
- if($target.find("input[value=" + value.ID + "]").length) return true;
- $target.eq(0).append("");
- });
+ i = 0;
+ console.log(response.data.sections);
+ if ( -1 == response.data.sections ) {
+ if(response.data.players.length) {
+ $(response.data.players).each(function( key, value ) {
+ //if($target.eq(i).find("input[value=" + value.ID + "]").length) return true;
+ $target.eq(i).append("");
+ });
+ } else {
+ $target.eq(i).html("" + localized_strings.no_results_found + "");
+ }
} else {
- $target.eq(0).html("" + localized_strings.no_results_found + "");
+ if(response.data.players.length) {
+ if ( 1 == response.data.sections ) {
+ defense = i;
+ offense = i+1;
+ } else {
+ offense = i;
+ defense = i+1;
+ }
+ $(response.data.players).each(function( key, value ) {
+ $target.eq(offense).append("");
+ $target.eq(defense).append("");
+ });
+ } else {
+ $target.eq(offense).html("" + localized_strings.no_results_found + "");
+ $target.eq(defense).html("" + localized_strings.no_results_found + "");
+ }
+ i++;
}
+ i++;
if(response.data.staff.length) {
$(response.data.staff).each(function( key, value ) {
- $target.eq(1).append("");
+ $target.eq(i).append("");
});
} else {
- $target.eq(1).html("" + localized_strings.no_results_found + "");
+ $target.eq(i).html("" + localized_strings.no_results_found + "");
}
} else {
$target.html("" + localized_strings.no_results_found + "");
diff --git a/modules/sportspress-lazy-loading.php b/modules/sportspress-lazy-loading.php
index 2ad77be3..373d5a84 100644
--- a/modules/sportspress-lazy-loading.php
+++ b/modules/sportspress-lazy-loading.php
@@ -90,6 +90,8 @@ class SportsPress_Lazy_Loading {
$data['players'] = $players;
$data['staff'] = $staff;
+ $data['sections'] = get_option( 'sportspress_event_performance_sections', -1 );
+
wp_send_json_success( $data );
}