The standalone order card is folded into the 我的服务 (My Services) sidebar section: 我的订单 becomes a service-grid tile (all orders), with the 待支付/售后 quick shortcuts rendered beneath it as a compact row. Gated on the orders dashboard tab being registered so no dead tile appears when the payment stack is absent.
94 lines
3.0 KiB
PHP
94 lines
3.0 KiB
PHP
<?php
|
|
/**
|
|
* User center sidebar: services and account settings.
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
$level_url = isset($dashboard_tabs['level'])
|
|
? aksrt_get_user_center_tab_url('level')
|
|
: '';
|
|
$auth_url = isset($dashboard_tabs['auth']) ? aksrt_get_user_center_tab_url('auth') : '';
|
|
$orders_available = isset($dashboard_tabs['orders']);
|
|
$orders_url = $orders_available ? (string) ($orders_url ?? '') : '';
|
|
|
|
$services = array_values(array_filter([
|
|
[
|
|
'label' => __('我的等级', 'aksrt'),
|
|
'icon' => 'chart-line',
|
|
'tone' => 'level',
|
|
'url' => $level_url,
|
|
],
|
|
[
|
|
'label' => __('官方认证', 'aksrt'),
|
|
'icon' => 'id-badge',
|
|
'tone' => 'auth',
|
|
'url' => $auth_url,
|
|
'tab' => 'auth',
|
|
],
|
|
[
|
|
'label' => __('我的订单', 'aksrt'),
|
|
'icon' => 'receipt',
|
|
'tone' => 'orders',
|
|
'url' => $orders_url,
|
|
'tab' => 'orders',
|
|
],
|
|
], static fn(array $item): bool => (string) $item['url'] !== ''));
|
|
|
|
$settings = array_values(array_filter([
|
|
[
|
|
'label' => __('消息通知', 'aksrt'),
|
|
'icon' => 'bell',
|
|
'tone' => 'notice',
|
|
'url' => (string) ($messages_url ?? ''),
|
|
'count' => (int) ($notification_unread_count ?? 0),
|
|
],
|
|
[
|
|
'label' => __('个人资料', 'aksrt'),
|
|
'icon' => 'user-edit',
|
|
'tone' => 'profile',
|
|
'url' => isset($dashboard_tabs['profile']) ? aksrt_get_user_center_tab_url('profile') : '',
|
|
],
|
|
[
|
|
'label' => __('账户安全', 'aksrt'),
|
|
'icon' => 'shield-alt',
|
|
'tone' => 'security',
|
|
'url' => isset($dashboard_tabs['settings']) ? aksrt_get_user_center_tab_url('settings') : '',
|
|
],
|
|
], static fn(array $item): bool => (string) $item['url'] !== ''));
|
|
|
|
$render_grid = static function (array $items): void {
|
|
?>
|
|
<div class="uc-service-grid">
|
|
<?php foreach ($items as $item) : ?>
|
|
<a class="uc-service-grid__item uc-service-grid__item--<?php echo esc_attr((string) $item['tone']); ?><?php echo !empty($item['tab']) && ($active_tab ?? '') === $item['tab'] ? ' is-active' : ''; ?>" href="<?php echo esc_url((string) $item['url']); ?>"<?php if (!empty($item['tab'])) : ?> data-tab="<?php echo esc_attr((string) $item['tab']); ?>"<?php endif; ?>>
|
|
<span class="uc-service-grid__icon">
|
|
<i class="fas fa-<?php echo esc_attr((string) $item['icon']); ?>" aria-hidden="true"></i>
|
|
<?php if (!empty($item['count'])) : ?><small><?php echo esc_html((string) $item['count']); ?></small><?php endif; ?>
|
|
</span>
|
|
<span><?php echo esc_html((string) $item['label']); ?></span>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php
|
|
};
|
|
?>
|
|
<?php if ($services) : ?>
|
|
<div class="uc-sidebar__section">
|
|
<div class="uc-sidebar__heading"><span><?php esc_html_e('我的服务', 'aksrt'); ?></span></div>
|
|
<?php $render_grid($services); ?>
|
|
<?php if ($orders_url !== '') : ?>
|
|
<?php require __DIR__ . '/sidebar-orders.php'; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($settings) : ?>
|
|
<div class="uc-sidebar__section">
|
|
<div class="uc-sidebar__heading"><span><?php esc_html_e('功能设置', 'aksrt'); ?></span></div>
|
|
<?php $render_grid($settings); ?>
|
|
</div>
|
|
<?php endif; ?>
|