Subscriptions: add expiry governance block on index
This commit is contained in:
@@ -86,6 +86,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="card mb-20">
|
||||||
|
<h3>到期治理</h3>
|
||||||
|
<div class="muted mb-10">按到期时间(ends_at)快速定位需要续费/处理的订阅集合(不改变订阅 status 字段)。</div>
|
||||||
|
|
||||||
|
@php
|
||||||
|
$expiredUrl = $buildQuickFilterUrl(['status' => null, 'expiry' => 'expired']);
|
||||||
|
$expiring7dUrl = $buildQuickFilterUrl(['status' => null, 'expiry' => 'expiring_7d']);
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<a class="btn btn-secondary btn-sm" href="{!! $expiredUrl !!}">已过期({{ $summaryStats['expired_subscriptions'] ?? 0 }})</a>
|
||||||
|
<a class="btn btn-secondary btn-sm" href="{!! $expiring7dUrl !!}">7天内到期({{ $summaryStats['expiring_7d_subscriptions'] ?? 0 }})</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="muted muted-xs mt-6">建议:先处理“7天内到期”续费触达,再处理“已过期”补单或关闭。</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="card mb-20">
|
<div class="card mb-20">
|
||||||
<h3>筛选条件</h3>
|
<h3>筛选条件</h3>
|
||||||
<form method="get" action="/admin/site-subscriptions" class="grid-4">
|
<form method="get" action="/admin/site-subscriptions" class="grid-4">
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class AdminSiteSubscriptionIndexExpiryGovernanceBlockTest extends TestCase
|
||||||
|
{
|
||||||
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
protected function loginAsPlatformAdmin(): void
|
||||||
|
{
|
||||||
|
$this->seed();
|
||||||
|
|
||||||
|
$this->post('/admin/login', [
|
||||||
|
'email' => 'platform.admin@demo.local',
|
||||||
|
'password' => 'Platform@123456',
|
||||||
|
])->assertRedirect('/admin');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_index_should_render_expiry_governance_block_with_quick_links(): void
|
||||||
|
{
|
||||||
|
$this->loginAsPlatformAdmin();
|
||||||
|
|
||||||
|
$res = $this->get('/admin/site-subscriptions');
|
||||||
|
$res->assertOk();
|
||||||
|
|
||||||
|
$res->assertSee('到期治理');
|
||||||
|
|
||||||
|
// 链接应使用 quick filter:仅 expiry,不附带 status
|
||||||
|
$res->assertSee('href="/admin/site-subscriptions?expiry=expired"', false);
|
||||||
|
$res->assertSee('href="/admin/site-subscriptions?expiry=expiring_7d"', false);
|
||||||
|
|
||||||
|
$res->assertSee('已过期');
|
||||||
|
$res->assertSee('7天内到期');
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user