Admin subscriptions: hide batch expired action in attach order mode

This commit is contained in:
萝卜
2026-03-17 00:37:11 +08:00
parent f47cc71599
commit 7ce6a65aab
2 changed files with 37 additions and 0 deletions

View File

@@ -271,6 +271,7 @@
<a class="btn btn-sm" href="{!! $createOrderFromSubIndexUrl !!}">续费下单(先选订阅)</a> <a class="btn btn-sm" href="{!! $createOrderFromSubIndexUrl !!}">续费下单(先选订阅)</a>
@endif @endif
@if($attachOrderId <= 0)
<form method="post" action="/admin/site-subscriptions/batch-mark-expired" data-action="disable-on-submit" onsubmit="return confirm('确认将当前筛选集合内的订阅批量标记为已过期?该操作会更新 status 字段。');" class="actions gap-10"> <form method="post" action="/admin/site-subscriptions/batch-mark-expired" data-action="disable-on-submit" onsubmit="return confirm('确认将当前筛选集合内的订阅批量标记为已过期?该操作会更新 status 字段。');" class="actions gap-10">
@csrf @csrf
<input type="hidden" name="status" value="{{ $filters['status'] ?? '' }}"> <input type="hidden" name="status" value="{{ $filters['status'] ?? '' }}">
@@ -292,6 +293,7 @@
@endif @endif
</div> </div>
</form> </form>
@endif
</div> </div>
<div class="muted muted-xs mt-6"> <div class="muted muted-xs mt-6">
@if($attachOrderId > 0) @if($attachOrderId > 0)

View File

@@ -0,0 +1,35 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminSiteSubscriptionIndexBatchMarkExpiredShouldHideWhenAttachOrderModeTest 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_batch_mark_expired_form_should_not_render_when_attach_order_mode_enabled(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin/site-subscriptions?attach_order_id=123&expiry=expired');
$res->assertOk();
$html = (string) $res->getContent();
// 在“绑定订阅到订单”模式下,工具区应专注绑定操作,避免出现批量治理动作造成误操作。
$this->assertStringNotContainsString('action="/admin/site-subscriptions/batch-mark-expired"', $html);
$this->assertStringNotContainsString('批量标记已过期(当前集合)', $html);
}
}