Display squad numbers in defense section and sync statistics when editing event
This commit is contained in:
@@ -262,6 +262,26 @@ jQuery(document).ready(function($){
|
|||||||
// Trigger total stats calculator
|
// Trigger total stats calculator
|
||||||
$(".sp-data-table .sp-total input").trigger("updateTotal");
|
$(".sp-data-table .sp-total input").trigger("updateTotal");
|
||||||
|
|
||||||
|
// Sync inputs
|
||||||
|
$(".sp-sync-input").on("keyup", function() {
|
||||||
|
name = $(this).attr("name");
|
||||||
|
$el = $("input[name='"+name+"']");
|
||||||
|
if ( $el.length > 1 ) {
|
||||||
|
val = $(this).val();
|
||||||
|
$el.val(val);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Sync selects
|
||||||
|
$(".sp-sync-select").on("change", function() {
|
||||||
|
name = $(this).attr("name");
|
||||||
|
$el = $("select[name='"+name+"']")
|
||||||
|
if ( $el.length > 1 ) {
|
||||||
|
val = $(this).val();
|
||||||
|
$el.val(val);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Select all checkboxes
|
// Select all checkboxes
|
||||||
$(".sp-select-all-range").on("change", ".sp-select-all", function() {
|
$(".sp-select-all-range").on("change", ".sp-select-all", function() {
|
||||||
$range = $(this).closest(".sp-select-all-range");
|
$range = $(this).closest(".sp-select-all-range");
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* @author ThemeBoy
|
* @author ThemeBoy
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package SportsPress/Admin/Meta_Boxes
|
* @package SportsPress/Admin/Meta_Boxes
|
||||||
* @version 2.0
|
* @version 2.0.6
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
@@ -238,7 +238,7 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
<?php if ( $sortable ) { ?>
|
<?php if ( $sortable ) { ?>
|
||||||
<th class="icon"> </th>
|
<th class="icon"> </th>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if ( $numbers && 1 !== $section ) { ?>
|
<?php if ( apply_filters( 'sportspress_event_performance_show_numbers', $numbers, $section ) ) { ?>
|
||||||
<th>#</th>
|
<th>#</th>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<th><?php _e( 'Player', 'sportspress' ); ?></th>
|
<th><?php _e( 'Player', 'sportspress' ); ?></th>
|
||||||
@@ -259,7 +259,7 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</th>
|
</th>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php if ( $status && 1 !== $section ) { ?>
|
<?php if ( apply_filters( 'sportspress_event_performance_show_status', $status, $section ) ) { ?>
|
||||||
<th>
|
<th>
|
||||||
<?php _e( 'Status', 'sportspress' ); ?>
|
<?php _e( 'Status', 'sportspress' ); ?>
|
||||||
</th>
|
</th>
|
||||||
@@ -281,7 +281,7 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
<?php if ( $sortable ) { ?>
|
<?php if ( $sortable ) { ?>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if ( $numbers && 1 !== $section ) { ?>
|
<?php if ( apply_filters( 'sportspress_event_performance_show_numbers', $numbers, $section ) ) { ?>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<td><strong><?php _e( 'Total', 'sportspress' ); ?></strong></td>
|
<td><strong><?php _e( 'Total', 'sportspress' ); ?></strong></td>
|
||||||
@@ -297,7 +297,7 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
?>
|
?>
|
||||||
<td><input type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" placeholder="<?php echo trim( $placeholder ); ?>" value="<?php echo esc_attr( $value ); ?>" data-sp-format="<?php echo $format; ?>" /></td>
|
<td><input type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" placeholder="<?php echo trim( $placeholder ); ?>" value="<?php echo esc_attr( $value ); ?>" data-sp-format="<?php echo $format; ?>" /></td>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php if ( $status && 1 !== $section ) { ?>
|
<?php if ( apply_filters( 'sportspress_event_performance_show_status', $status, $section ) ) { ?>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -318,9 +318,9 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
<?php if ( $sortable ) { ?>
|
<?php if ( $sortable ) { ?>
|
||||||
<td class="icon"><span class="dashicons dashicons-menu post-state-format"></span></td>
|
<td class="icon"><span class="dashicons dashicons-menu post-state-format"></span></td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if ( $numbers && 1 !== $section ) { ?>
|
<?php if ( apply_filters( 'sportspress_event_performance_show_numbers', $numbers, $section ) ) { ?>
|
||||||
<td>
|
<td>
|
||||||
<input class="small-text sp-player-number-input" type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][number]" value="<?php echo esc_attr( $value ); ?>" />
|
<input class="small-text sp-player-number-input sp-sync-input" type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][number]" value="<?php echo esc_attr( $value ); ?>" />
|
||||||
</td>
|
</td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<td>
|
<td>
|
||||||
@@ -356,10 +356,10 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
$placeholder = sp_get_format_placeholder( sp_array_value( $formats, $column, 'number' ) );
|
$placeholder = sp_get_format_placeholder( sp_array_value( $formats, $column, 'number' ) );
|
||||||
?>
|
?>
|
||||||
<td>
|
<td>
|
||||||
<input class="sp-player-<?php echo $column; ?>-input" type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo esc_attr( $value ); ?>" placeholder="<?php echo $placeholder; ?>" />
|
<input class="sp-player-<?php echo $column; ?>-input sp-sync-input" type="text" name="sp_players[<?php echo $team_id; ?>][<?php echo $player_id; ?>][<?php echo $column; ?>]" value="<?php echo esc_attr( $value ); ?>" placeholder="<?php echo $placeholder; ?>" />
|
||||||
</td>
|
</td>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php if ( $status && 1 !== $section ) { ?>
|
<?php if ( apply_filters( 'sportspress_event_performance_show_status', $status, $section ) ) { ?>
|
||||||
<td class="sp-status-selector">
|
<td class="sp-status-selector">
|
||||||
<?php echo self::status_select( $team_id, $player_id, sp_array_value( $player_performance, 'status', null ) ); ?>
|
<?php echo self::status_select( $team_id, $player_id, sp_array_value( $player_performance, 'status', null ) ); ?>
|
||||||
<?php echo self::sub_select( $team_id, $player_id, sp_array_value( $player_performance, 'sub', null ), $data ); ?>
|
<?php echo self::sub_select( $team_id, $player_id, sp_array_value( $player_performance, 'sub', null ), $data ); ?>
|
||||||
@@ -382,7 +382,7 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
'sub' => __( 'Substitute', 'sportspress' ),
|
'sub' => __( 'Substitute', 'sportspress' ),
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$output = '<select name="sp_players[' . $team_id . '][' . $player_id . '][status]">';
|
$output = '<select class="sp-sync-select" name="sp_players[' . $team_id . '][' . $player_id . '][status]">';
|
||||||
|
|
||||||
foreach( $options as $key => $name ):
|
foreach( $options as $key => $name ):
|
||||||
$output .= '<option value="' . $key . '"' . ( $key == $value ? ' selected' : '' ) . '>' . $name . '</option>';
|
$output .= '<option value="' . $key . '"' . ( $key == $value ? ' selected' : '' ) . '>' . $name . '</option>';
|
||||||
@@ -402,7 +402,7 @@ class SP_Meta_Box_Event_Performance {
|
|||||||
if ( ! $team_id || ! $player_id )
|
if ( ! $team_id || ! $player_id )
|
||||||
return '—';
|
return '—';
|
||||||
|
|
||||||
$output = '<select name="sp_players[' . $team_id . '][' . $player_id . '][sub]" style="display: none;">';
|
$output = '<select class="sp-sync-select" name="sp_players[' . $team_id . '][' . $player_id . '][sub]" style="display: none;">';
|
||||||
|
|
||||||
$output .= '<option value="0">' . __( 'None', 'sportspress' ) . '</option>';
|
$output .= '<option value="0">' . __( 'None', 'sportspress' ) . '</option>';
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @author ThemeBoy
|
* @author ThemeBoy
|
||||||
* @package SportsPress/Templates
|
* @package SportsPress/Templates
|
||||||
* @version 2.0
|
* @version 2.0.6
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
@@ -30,7 +30,7 @@ if ( ! isset( $subs ) ) $subs = array();
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<?php if ( $show_players ): ?>
|
<?php if ( $show_players ): ?>
|
||||||
<?php if ( $show_numbers && 1 !== $section ) { ?>
|
<?php if ( apply_filters( 'sportspress_event_performance_show_numbers', $show_numbers, $section ) ) { ?>
|
||||||
<th class="data-number">#</th>
|
<th class="data-number">#</th>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<th class="data-name">
|
<th class="data-name">
|
||||||
@@ -77,7 +77,7 @@ if ( ! isset( $subs ) ) $subs = array();
|
|||||||
|
|
||||||
echo '<tr class="' . sp_array_value( $row, 'status', 'lineup' ) . ' ' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
echo '<tr class="' . sp_array_value( $row, 'status', 'lineup' ) . ' ' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
||||||
|
|
||||||
if ( $show_numbers && 1 !== $section ) {
|
if ( apply_filters( 'sportspress_event_performance_show_numbers', $show_numbers, $section ) ) {
|
||||||
$number = sp_array_value( $row, 'number', ' ' );
|
$number = sp_array_value( $row, 'number', ' ' );
|
||||||
|
|
||||||
// Player number
|
// Player number
|
||||||
@@ -171,7 +171,7 @@ if ( ! isset( $subs ) ) $subs = array();
|
|||||||
<tr class="sp-total-row <?php echo ( $i % 2 == 0 ? 'odd' : 'even' ); ?>">
|
<tr class="sp-total-row <?php echo ( $i % 2 == 0 ? 'odd' : 'even' ); ?>">
|
||||||
<?php
|
<?php
|
||||||
if ( $show_players ):
|
if ( $show_players ):
|
||||||
if ( $show_numbers && 1 !== $section ) {
|
if ( apply_filters( 'sportspress_event_performance_show_numbers', $show_numbers, $section ) ) {
|
||||||
echo '<td class="data-number"> </td>';
|
echo '<td class="data-number"> </td>';
|
||||||
}
|
}
|
||||||
echo '<td class="data-name">' . __( 'Total', 'sportspress' ) . '</td>';
|
echo '<td class="data-name">' . __( 'Total', 'sportspress' ) . '</td>';
|
||||||
|
|||||||
Reference in New Issue
Block a user