From 55d2038ebbb8950d01c255f4d31eb7207d8e38fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Sat, 14 Mar 2026 22:06:35 +0000 Subject: [PATCH] feat(plans): make summary cards clickable for governance navigation --- resources/views/admin/plans/index.blade.php | 23 +++++++++--- ...nPlanIndexSummaryCardsAreClickableTest.php | 36 +++++++++++++++++++ 2 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 tests/Feature/AdminPlanIndexSummaryCardsAreClickableTest.php diff --git a/resources/views/admin/plans/index.blade.php b/resources/views/admin/plans/index.blade.php index 348a802..ffd09b6 100644 --- a/resources/views/admin/plans/index.blade.php +++ b/resources/views/admin/plans/index.blade.php @@ -27,6 +27,13 @@ // - 拒绝 nested back=(避免 URL 膨胀/绕过) $incomingBack = (string) request()->query('back', ''); $safeBackForLinks = \App\Support\BackUrl::sanitizeForLinks($incomingBack); + + // 用于摘要卡等入口:保留当前 query 并覆盖字段,同时安全透传 back。 + $safeFullUrlWithQuery = function (array $overrides = []) use ($safeBackForLinks) { + return \App\Support\BackUrl::currentPathWithQuery($overrides, $safeBackForLinks); + }; + + $planIndexUrl = \App\Support\BackUrl::withBack('/admin/plans', $safeBackForLinks); @endphp

这里是总台视角的套餐目录页,用于沉淀平台可售卖的标准能力包。

@@ -123,19 +130,27 @@

套餐总数

-
{{ $summaryStats['total_plans'] ?? 0 }}
+

启用中套餐

-
{{ $summaryStats['active_plans'] ?? 0 }}
+

月付套餐

-
{{ $summaryStats['monthly_plans'] ?? 0 }}
+

年付套餐

-
{{ $summaryStats['yearly_plans'] ?? 0 }}
+

关联订阅总量

diff --git a/tests/Feature/AdminPlanIndexSummaryCardsAreClickableTest.php b/tests/Feature/AdminPlanIndexSummaryCardsAreClickableTest.php new file mode 100644 index 0000000..2f6cbc6 --- /dev/null +++ b/tests/Feature/AdminPlanIndexSummaryCardsAreClickableTest.php @@ -0,0 +1,36 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_summary_cards_should_link_to_filtered_sets(): void + { + $this->loginAsPlatformAdmin(); + + $this->get('/admin/plans') + ->assertOk() + ->assertSee('套餐总数') + ->assertSee('启用中套餐') + ->assertSee('月付套餐') + ->assertSee('年付套餐') + ->assertSee('status=active', false) + ->assertSee('billing_cycle=monthly', false) + ->assertSee('billing_cycle=yearly', false); + } +}