ui(site-subscriptions): add ends_at range quick links
This commit is contained in:
@@ -272,7 +272,27 @@
|
||||
<option value="expiring_7d" @selected(($filters['expiry'] ?? '') === 'expiring_7d')>7天内到期</option>
|
||||
<option value="expired" @selected(($filters['expiry'] ?? '') === 'expired')>已过期</option>
|
||||
</select>
|
||||
<div>
|
||||
<input type="date" name="ends_from" data-role="sub-ends-from" placeholder="到期时间从" value="{{ $filters['ends_from'] ?? '' }}" class="w-180">
|
||||
<div class="muted muted-xs mt-6">
|
||||
@php
|
||||
$endsToday = now()->format('Y-m-d');
|
||||
$ends7d = now()->addDays(7)->format('Y-m-d');
|
||||
$ends30d = now()->addDays(30)->format('Y-m-d');
|
||||
$endsQuickTodayUrl = $buildQuickFilterUrl(['ends_from' => $endsToday, 'ends_to' => $endsToday, 'page' => null]);
|
||||
$endsQuick7dUrl = $buildQuickFilterUrl(['ends_from' => $endsToday, 'ends_to' => $ends7d, 'page' => null]);
|
||||
$endsQuick30dUrl = $buildQuickFilterUrl(['ends_from' => $endsToday, 'ends_to' => $ends30d, 'page' => null]);
|
||||
$endsQuickClearUrl = $buildQuickFilterUrl(['ends_from' => null, 'ends_to' => null, 'page' => null]);
|
||||
@endphp
|
||||
<a class="link" href="{!! $endsQuickTodayUrl !!}">今天到期</a>
|
||||
<span class="muted">|</span>
|
||||
<a class="link" href="{!! $endsQuick7dUrl !!}">近7天到期</a>
|
||||
<span class="muted">|</span>
|
||||
<a class="link" href="{!! $endsQuick30dUrl !!}">近30天到期</a>
|
||||
<span class="muted">|</span>
|
||||
<a class="link" href="{!! $endsQuickClearUrl !!}">清空到期区间</a>
|
||||
</div>
|
||||
</div>
|
||||
<input type="date" name="ends_to" data-role="sub-ends-to" placeholder="到期时间到" value="{{ $filters['ends_to'] ?? '' }}" class="w-180">
|
||||
<select name="merchant_id">
|
||||
<option value="">全部站点</option>
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminSiteSubscriptionIndexEndsAtRangeQuickLinksShouldRenderTest 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_site_subscriptions_index_should_render_ends_at_range_quick_links(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$res = $this->get('/admin/site-subscriptions');
|
||||
$res->assertOk();
|
||||
|
||||
$html = (string) $res->getContent();
|
||||
|
||||
$this->assertStringContainsString('今天到期', $html);
|
||||
$this->assertStringContainsString('近7天到期', $html);
|
||||
$this->assertStringContainsString('近30天到期', $html);
|
||||
$this->assertStringContainsString('清空到期区间', $html);
|
||||
$this->assertStringContainsString('ends_from=', $html);
|
||||
$this->assertStringContainsString('ends_to=', $html);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user