| # (int) ( $item['post_id'] ?? 0 ) ) ); ?> | 0 ) { echo function_exists( 'wc_price' ) ? wp_kses_post( wc_price( $total ) ) : esc_html( number_format_i18n( $total, 2 ) ); } else { esc_html_e( 'FREE', 'abp-event-ticket' ); } ?> | ||
' . esc_html__( 'No ticket configuration found.', 'abp-event-ticket' ) . '
' . esc_html__( 'No seat plan assigned.', 'abp-event-ticket' ) . '
'; return; } $filters = array( 'post_id' => $post_id, 'start_time' => $start_time, 'cache' => false ); $sold_seat = ABPET_Query::get_sold_seat( $filters ); foreach ( $sp_infos as $sp_item ) { $sp_id = (int) ( $sp_item['id'] ?? 0 ); if ( $sp_id <= 0 ) { continue; } $this->render_seat_plan( $sp_id, $sold_seat ); } } //=============================// private function render_seat_plan( $sp_id, $sold_seat ): void { $row = ABPET_Query::get_sp( $sp_id ); $sp_info = ! empty( $row ) ? current( $row ) : array(); if ( empty( $sp_info ) ) { return; } $others = json_decode( $sp_info['others'] ?? '', true ) ?: array(); $cell_width = $others['width'] ?? 40; $cell_height = $others['height'] ?? 40; $gap = $others['gap'] ?? 0; $radius = $others['radius'] ?? 0; $cols = intval( $others['column'] ?? 10 ); $bg_image = $others['bg_image'] ?? ''; $img_url = ! empty( $bg_image ) && $bg_image > 0 ? ABPET_Function::get_image_url( '', $bg_image ) : ''; $bg_color = $others['bg_color'] ?? '#fff'; $layout = json_decode( $sp_info['layout_data'] ?? '', true ) ?: array(); $sp_name = $sp_info['name'] ?? ''; // Multi-row/column cells must hide their "occupied" grid slots. $hidden_cells = array(); foreach ( $layout as $index => $cell ) { $c_span = intval( $cell['width_ratio'] ?? 1 ); $r_span = intval( $cell['height_ratio'] ?? 1 ); if ( $c_span > 1 || $r_span > 1 ) { for ( $r = 0; $r < $r_span; $r ++ ) { for ( $c = 0; $c < $c_span; $c ++ ) { if ( $r === 0 && $c === 0 ) { continue; } $target_idx = $index + ( $r * $cols ) + $c; $hidden_cells[ $target_idx ] = true; } } } } ?>' . esc_html__( 'No bookings for this journey yet.', 'abp-event-ticket' ) . '