fix(admin): render the ticket process form as a dedicated view
action=process used to append the process form into the tickets table as a bare <form><table> inside <tbody> — invalid HTML that browsers reflow, leaving the ticket list stacked below the submit button. Render the process form as its own view (early return, list and pagenavi skipped, with a lookup fallback beyond the current page slice) and keep the list view free of form injection.
This commit is contained in:
@@ -183,8 +183,32 @@ trait UsersMenusTickets {
|
||||
echo '<div class="mb10">"' . esc_html($s) . '" ' . esc_html__('的搜索结果', 'aksrt') . '</div>';
|
||||
}
|
||||
|
||||
$process_id = isset($_GET['id']) ? (string) wp_unslash($_GET['id']) : '';
|
||||
|
||||
if ($process_action === 'process') {
|
||||
echo '<a href="' . esc_url(remove_query_arg(['action', 'id'], $page_url)) . '">' . esc_html__('查看全部', 'aksrt') . '</a>';
|
||||
// 独立处理视图:只渲染目标工单的处理表单(参考主题同构)。
|
||||
// 列表与分页不得出现在“确认提交”下方——此前表单被当作 <tr>
|
||||
// 追加进列表表格,属于无效 HTML 嵌套,浏览器重排后工单列表
|
||||
// 全部堆到表单下方。
|
||||
$processing = null;
|
||||
foreach (array_merge($tickets, $rows) as $row) {
|
||||
if ($process_id === (string) $row['kind'] . '-' . (string) $row['id']) {
|
||||
$processing = $row;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
echo '<a class="button" href="' . esc_url(remove_query_arg(['action', 'id'], $page_url)) . '" style="margin:8px 0;">' . esc_html__('查看全部', 'aksrt') . '</a>';
|
||||
|
||||
if ($processing === null) {
|
||||
echo '<div class="table-box" style="max-width:860px;"><p>' . esc_html__('工单不存在或已被删除', 'aksrt') . '</p></div>';
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<div class="table-box" style="max-width:860px;">';
|
||||
$this->render_ticket_process_form($processing, $action_url);
|
||||
echo '</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<div class="table-box" style="overflow-y:auto;width:100%;">';
|
||||
@@ -217,13 +241,8 @@ trait UsersMenusTickets {
|
||||
echo '<tr><td colspan="6" align="center"><strong>' . esc_html__('暂无申请记录', 'aksrt') . '</strong></td></tr>';
|
||||
}
|
||||
|
||||
$process_id = isset($_GET['id']) ? (string) wp_unslash($_GET['id']) : '';
|
||||
|
||||
foreach ($tickets as $row) {
|
||||
$this->render_ticket_row($row, $page_url);
|
||||
if ($process_action === 'process' && $process_id === (string) $row['kind'] . '-' . (string) $row['id']) {
|
||||
$this->render_ticket_process_form($row, $action_url);
|
||||
}
|
||||
}
|
||||
|
||||
echo '</tbody></table></div>';
|
||||
|
||||
Reference in New Issue
Block a user