96 lines
3.9 KiB
PHP
96 lines
3.9 KiB
PHP
<?php
|
|
/**
|
|
* User center assets panel orchestrator (wallet + points).
|
|
*
|
|
* legacy user-tab-balance parity: dual cards + tabbed ledgers.
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
$context = is_array($args['context'] ?? null) ? $args['context'] : [];
|
|
extract($context, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
|
|
|
|
$dir = __DIR__;
|
|
$show_wallet = !empty($balance_enabled);
|
|
$show_credits = !empty($credits_enabled);
|
|
|
|
// Dual cards row (legacy row gutters-10).
|
|
if ($show_wallet || $show_credits) :
|
|
?>
|
|
<div class="uc-assets-row<?php echo ($show_wallet && $show_credits) ? ' uc-assets-row--dual' : ''; ?>">
|
|
<?php if ($show_wallet) : ?>
|
|
<div class="uc-assets-col">
|
|
<?php
|
|
// Ledger moved to tab section below.
|
|
$skip_wallet_ledger = true;
|
|
require $dir . '/credits-wallet.php';
|
|
?>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if ($show_credits) : ?>
|
|
<div class="uc-assets-col">
|
|
<?php require $dir . '/credits-balance.php'; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php
|
|
endif;
|
|
|
|
if ($show_wallet || $show_credits) {
|
|
require $dir . '/transfer-modal.php';
|
|
}
|
|
|
|
// Tabbed ledgers (legacy record tabs).
|
|
if ($show_wallet || $show_credits) :
|
|
$show_tasks = $show_credits && class_exists('\AKSRT\Credits\PointsFree') && \AKSRT\Credits\PointsFree::enabled();
|
|
$asset_request = is_array($asset_request ?? null) ? $asset_request : [];
|
|
$requested_asset = in_array(($asset_request['asset'] ?? ''), ['balance', 'points'], true) ? $asset_request['asset'] : '';
|
|
$active_record = $requested_asset !== ''
|
|
? $requested_asset
|
|
: ($show_wallet ? 'balance' : 'points');
|
|
?>
|
|
<div class="uc-asset-tabs">
|
|
<ul class="uc-asset-tabs__nav list-inline tab-nav-theme font-bold">
|
|
<?php if ($show_wallet) : ?>
|
|
<li class="<?php echo $active_record === 'balance' ? 'active' : ''; ?>">
|
|
<a href="#record_tab_balance" data-aksrt-asset-tab="balance"><?php esc_html_e('余额记录', 'aksrt'); ?></a>
|
|
</li>
|
|
<?php endif; ?>
|
|
<?php if ($show_credits) : ?>
|
|
<li class="<?php echo $active_record === 'points' ? 'active' : ''; ?>">
|
|
<a href="#record_tab_points" data-aksrt-asset-tab="points"><?php esc_html_e('积分记录', 'aksrt'); ?></a>
|
|
</li>
|
|
<?php endif; ?>
|
|
<?php if (!empty($show_tasks)) : ?>
|
|
<li class="<?php echo in_array($active_record, ['points_free', 'points_date'], true) ? 'active' : ''; ?>">
|
|
<a href="#record_tab_points_free" data-aksrt-asset-tab="points_free"><?php esc_html_e('积分任务', 'aksrt'); ?></a>
|
|
</li>
|
|
<?php endif; ?>
|
|
</ul>
|
|
<div class="uc-asset-tabs__content tab-content">
|
|
<?php if ($show_wallet) : ?>
|
|
<div class="tab-pane<?php echo $active_record === 'balance' ? ' is-active' : ''; ?>" id="record_tab_balance" data-aksrt-asset-pane="balance"<?php echo $active_record === 'balance' ? '' : ' hidden'; ?>>
|
|
<?php require $dir . '/credits-wallet-ledger.php'; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if ($show_credits) : ?>
|
|
<div class="tab-pane<?php echo $active_record === 'points' ? ' is-active' : ''; ?>" id="record_tab_points" data-aksrt-asset-pane="points"<?php echo $active_record === 'points' ? '' : ' hidden'; ?>>
|
|
<?php require $dir . '/credits-transactions.php'; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if (!empty($show_tasks)) : ?>
|
|
<div class="tab-pane<?php echo $active_record === 'points_free' ? ' is-active' : ''; ?>" id="record_tab_points_free" data-aksrt-asset-pane="points_free"<?php echo $active_record === 'points_free' ? '' : ' hidden'; ?>>
|
|
<?php $points_tasks_pane = 'tasks'; require $dir . '/credits-points-tasks.php'; ?>
|
|
</div>
|
|
<div class="tab-pane<?php echo $active_record === 'points_date' ? ' is-active' : ''; ?>" id="tab_points_date" data-aksrt-asset-pane="points_date"<?php echo $active_record === 'points_date' ? '' : ' hidden'; ?>>
|
|
<?php $points_tasks_pane = 'date'; require $dir . '/credits-points-tasks.php'; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
endif;
|
|
?>
|