feat(admin): 仪表盘最近平台订单链接携带 back 回跳
This commit is contained in:
@@ -8,6 +8,9 @@
|
||||
$incomingBack = (string) request()->query('back', '');
|
||||
$safeBackForLinks = \App\Support\BackUrl::sanitizeForLinks($incomingBack);
|
||||
|
||||
// 用于构建“从仪表盘跳到其它治理页后可返回仪表盘”的 back
|
||||
$selfWithoutBack = \App\Support\BackUrl::selfWithoutBack();
|
||||
|
||||
$billingEntryLinks = [
|
||||
'platform_orders' => \App\Support\BackUrl::withBack('/admin/platform-orders', $safeBackForLinks),
|
||||
'site_subscriptions' => \App\Support\BackUrl::withBack('/admin/site-subscriptions', $safeBackForLinks),
|
||||
@@ -130,10 +133,10 @@
|
||||
<tbody>
|
||||
@forelse(($recentPlatformOrders ?? []) as $po)
|
||||
@php
|
||||
$poShowUrl = '/admin/platform-orders/' . $po->id;
|
||||
$poShowUrl = \App\Support\BackUrl::withBack('/admin/platform-orders/' . $po->id, $selfWithoutBack);
|
||||
@endphp
|
||||
<tr>
|
||||
<td><a class="link" href="{{ $poShowUrl }}">{{ $po->order_no }}</a></td>
|
||||
<td><a class="link" href="{!! $poShowUrl !!}">{{ $po->order_no }}</a></td>
|
||||
<td>{{ $po->orderTypeLabel() }}</td>
|
||||
<td>¥{{ number_format((float) $po->payable_amount, 2) }}</td>
|
||||
<td>{{ $po->payment_status }}</td>
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminDashboardRecentPlatformOrderLinksShouldCarryBackTest 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_dashboard_recent_platform_order_links_should_carry_back(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$res = $this->get('/admin');
|
||||
$res->assertOk();
|
||||
|
||||
// 从仪表盘点进订单详情后,应能通过 back 回到 /admin
|
||||
$res->assertSee('href="/admin/platform-orders/1?back=%2Fadmin"', false);
|
||||
$res->assertDontSee('&back=', false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user