Site subscriptions show: add status governance form
This commit is contained in:
@@ -53,6 +53,18 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class="muted">状态</div>
|
<div class="muted">状态</div>
|
||||||
<div class="num-md">{{ ($statusLabels[$subscription->status] ?? $subscription->status) }} <span class="muted">({{ $subscription->status }})</span></div>
|
<div class="num-md">{{ ($statusLabels[$subscription->status] ?? $subscription->status) }} <span class="muted">({{ $subscription->status }})</span></div>
|
||||||
|
<div class="mt-6">
|
||||||
|
<form method="post" action="/admin/site-subscriptions/{{ $subscription->id }}/set-status" class="actions gap-10">
|
||||||
|
@csrf
|
||||||
|
<select name="status" onchange="this.form.submit()" class="w-140">
|
||||||
|
@foreach(($statusLabels ?? []) as $value => $label)
|
||||||
|
<option value="{{ $value }}" @selected($subscription->status === $value)>{{ $label }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<noscript><button type="submit" class="btn btn-secondary btn-sm">更新状态</button></noscript>
|
||||||
|
</form>
|
||||||
|
<div class="muted muted-xs mt-6">治理动作:可手工修正订阅状态(仅改状态字段,不自动改到期时间/订阅同步记录)。</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="muted">站点</div>
|
<div class="muted">站点</div>
|
||||||
|
|||||||
50
tests/Feature/AdminSiteSubscriptionShowSetStatusFormTest.php
Normal file
50
tests/Feature/AdminSiteSubscriptionShowSetStatusFormTest.php
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use App\Models\Merchant;
|
||||||
|
use App\Models\SiteSubscription;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class AdminSiteSubscriptionShowSetStatusFormTest 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_show_page_should_render_set_status_form(): void
|
||||||
|
{
|
||||||
|
$this->loginAsPlatformAdmin();
|
||||||
|
|
||||||
|
$merchant = Merchant::query()->firstOrFail();
|
||||||
|
|
||||||
|
$sub = SiteSubscription::query()->create([
|
||||||
|
'merchant_id' => $merchant->id,
|
||||||
|
'status' => 'pending',
|
||||||
|
'source' => 'manual',
|
||||||
|
'subscription_no' => 'SUB_SHOW_SET_STATUS_0001',
|
||||||
|
'plan_name' => '测试套餐',
|
||||||
|
'billing_cycle' => 'monthly',
|
||||||
|
'period_months' => 1,
|
||||||
|
'amount' => 10,
|
||||||
|
'starts_at' => now()->subDay(),
|
||||||
|
'ends_at' => now()->addDays(29),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$res = $this->get('/admin/site-subscriptions/' . $sub->id);
|
||||||
|
$res->assertOk();
|
||||||
|
|
||||||
|
$res->assertSee('action="/admin/site-subscriptions/' . $sub->id . '/set-status"', false);
|
||||||
|
$res->assertSee('name="status"', false);
|
||||||
|
$res->assertSee('option value="activated"', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user