| # (int)($item['post_id'] ?? 0))); ?> | 0 ? wp_kses_post(ABPTB_WC >= 2 ? wc_price($total) : number_format_i18n((float)$total, 2)) : esc_html__('FREE', 'abp-transport-booking'); ?> | |||
| = 2 ? wc_price($totals['total']) : number_format_i18n((float)$totals['total'], 2)); ?> | ||||
' . esc_html__('No ticket configuration found.', 'abp-transport-booking') . '
' . esc_html__('No seat plan assigned.', 'abp-transport-booking') . '
'; return; } $filters = array('post_id' => $post_id, 'start_time' => $start_time, 'cache' => false); $sold_seat = ABPTB_Query::get_sold_seat($filters, true); 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 = ABPTB_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 ? ABPTB_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-transport-booking') . '