Platform orders index: add clear subscription lock link
This commit is contained in:
@@ -87,8 +87,17 @@
|
|||||||
$selfWithoutBack
|
$selfWithoutBack
|
||||||
);
|
);
|
||||||
@endphp
|
@endphp
|
||||||
|
@php
|
||||||
|
// 清除订阅锁定:保留其它筛选上下文(例如 lead_id/keyword/back),但移除 site_subscription_id + page。
|
||||||
|
$clearSubscriptionUrl = \App\Support\BackUrl::currentPathWithQuery([
|
||||||
|
'site_subscription_id' => null,
|
||||||
|
'page' => null,
|
||||||
|
], $safeBackForLinks);
|
||||||
|
@endphp
|
||||||
<a class="link" href="{!! $subShowUrl !!}">{{ $currentSubscription->subscription_no }}</a>
|
<a class="link" href="{!! $subShowUrl !!}">{{ $currentSubscription->subscription_no }}</a>
|
||||||
<span class="muted">(订阅ID:{{ $currentSubscription->id }})</span>
|
<span class="muted">(订阅ID:{{ $currentSubscription->id }})</span>
|
||||||
|
<span class="muted">|</span>
|
||||||
|
<a class="muted" href="{!! $clearSubscriptionUrl !!}">取消锁定订阅</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="muted muted-xs">提示:本页快捷筛选会保留该订阅ID;右上角“新建平台订单”会自动预填订阅ID。</div>
|
<div class="muted muted-xs">提示:本页快捷筛选会保留该订阅ID;右上角“新建平台订单”会自动预填订阅ID。</div>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use App\Models\Merchant;
|
||||||
|
use App\Models\Plan;
|
||||||
|
use App\Models\SiteSubscription;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class AdminPlatformOrderIndexClearSubscriptionFilterLinkTest 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_clear_subscription_filter_link_when_site_subscription_id_present(): void
|
||||||
|
{
|
||||||
|
$this->loginAsPlatformAdmin();
|
||||||
|
|
||||||
|
$merchant = Merchant::query()->firstOrFail();
|
||||||
|
$plan = Plan::query()->create([
|
||||||
|
'code' => 'po_clear_sub_filter_plan',
|
||||||
|
'name' => '平台订单清除订阅锁定测试套餐',
|
||||||
|
'billing_cycle' => 'monthly',
|
||||||
|
'price' => 10,
|
||||||
|
'list_price' => 10,
|
||||||
|
'status' => 'active',
|
||||||
|
'sort' => 10,
|
||||||
|
'published_at' => now(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$sub = SiteSubscription::query()->create([
|
||||||
|
'merchant_id' => $merchant->id,
|
||||||
|
'plan_id' => $plan->id,
|
||||||
|
'status' => 'activated',
|
||||||
|
'source' => 'manual',
|
||||||
|
'subscription_no' => 'SS_CLEAR_SUB_FILTER_0001',
|
||||||
|
'plan_name' => $plan->name,
|
||||||
|
'billing_cycle' => $plan->billing_cycle,
|
||||||
|
'period_months' => 1,
|
||||||
|
'amount' => 10,
|
||||||
|
'starts_at' => now()->subDay(),
|
||||||
|
'ends_at' => now()->addMonth(),
|
||||||
|
'activated_at' => now()->subDay(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$res = $this->get('/admin/platform-orders?site_subscription_id=' . $sub->id . '&keyword=abc');
|
||||||
|
$res->assertOk();
|
||||||
|
|
||||||
|
// 清除订阅锁定:应移除 site_subscription_id,但保留 keyword。
|
||||||
|
$res->assertSee('取消锁定订阅', false);
|
||||||
|
$res->assertSee('href="/admin/platform-orders?keyword=abc"', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user