From 5295fc6ad304997f13e7055d1d0fd0ce9c7c42e9 Mon Sep 17 00:00:00 2001
From: renshen <1005457301@qq.com>
Date: Wed, 16 Sep 2026 11:20:28 +0800
Subject: [PATCH] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E5=BA=94=E4=BB=98=E6=AC=BE?=
=?UTF-8?q?=E9=A1=B9=E7=BB=88=E7=89=88=E7=8B=AC=E7=AB=8B=E5=85=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/Listeners/Menu/ShowInAdmin.php | 8 +---
resources/views/business/pages/show.blade.php | 12 +++--
.../Business/PayablesFinalEntriesTest.php | 46 +++++++++++++++++++
tests/Unit/View/PayablesGroupTest.php | 14 ++----
4 files changed, 60 insertions(+), 20 deletions(-)
create mode 100644 tests/Feature/Business/PayablesFinalEntriesTest.php
diff --git a/app/Listeners/Menu/ShowInAdmin.php b/app/Listeners/Menu/ShowInAdmin.php
index fce6be26..c2a56afa 100644
--- a/app/Listeners/Menu/ShowInAdmin.php
+++ b/app/Listeners/Menu/ShowInAdmin.php
@@ -52,13 +52,7 @@ class ShowInAdmin
public static function groupPayables(array $navigation): array
{
- $legacyKeys = ['supplier-payables-final', 'courier-payables-final'];
- $navigation = array_values(array_filter(
- $navigation,
- static fn (array $section): bool => ! in_array($section['slug'], $legacyKeys, true)
- ));
-
- $keys = ['supplier-payables', 'courier-payables', 'raw-board-payables',
+ $keys = ['supplier-payables-final', 'courier-payables-final', 'supplier-payables', 'courier-payables', 'raw-board-payables',
'lamination-factory-payables', 'paper-materials', 'edge-banding-materials'];
$children = array_values(array_filter($navigation, static fn (array $section): bool => in_array($section['slug'], $keys, true)));
if ($children === []) {
diff --git a/resources/views/business/pages/show.blade.php b/resources/views/business/pages/show.blade.php
index 1845a9e5..a0a6a752 100644
--- a/resources/views/business/pages/show.blade.php
+++ b/resources/views/business/pages/show.blade.php
@@ -5,6 +5,10 @@
&& ($page['slug'] ?? null) === 'marketing-account-balance';
$isStoreReceivingAccountsPage = ($section['slug'] ?? null) === 'fund-management'
&& ($page['slug'] ?? null) === 'store-receiving-accounts';
+ $isSupplierWorkspace = in_array($section['slug'] ?? null, ['supplier-payables', 'supplier-payables-final'], true);
+ $supplierWorkspaceSection = ($section['slug'] ?? null) === 'supplier-payables-final'
+ ? collect(\App\Utilities\SidebarPermissions::navigationFor(user()))->firstWhere('slug', 'supplier-payables')
+ : $section;
$marketingAccountTabTitles = [
'taobao-wechat' => '阿里巴巴账户',
'jd-wallet' => '京东',
@@ -546,7 +550,7 @@
'business-page--marketing-account-balance' => $isMarketingAccountBalancePage,
])
@if ($isMarketingAccountBillsPage) data-marketing-account-bills-workspace @endif
- @if ($section['slug'] === 'supplier-payables') data-supplier-workspace @endif
+ @if ($isSupplierWorkspace) data-supplier-workspace @endif
>
@if ($isMarketingAccountBillsPage)
@@ -571,8 +575,8 @@
{{ $upstreamError }}
@endif
- @if ($section['slug'] === 'supplier-payables')
- @include('business.pages.supplier-payables.navigation')
+ @if ($isSupplierWorkspace && $supplierWorkspaceSection)
+ @include('business.pages.supplier-payables.navigation', ['section' => $supplierWorkspaceSection])
@endif
@if ($tabs->isNotEmpty())
@@ -621,7 +625,7 @@
}
@endphp
- @if ($section['slug'] === 'courier-payables' && empty($page))
+ @if (in_array($section['slug'], ['courier-payables', 'courier-payables-final'], true) && empty($page))
@include('business.pages.courier-payables.final-workspace')
@elseif (!empty($content) && !empty($content['view']))
diff --git a/tests/Feature/Business/PayablesFinalEntriesTest.php b/tests/Feature/Business/PayablesFinalEntriesTest.php
new file mode 100644
index 00000000..689a2616
--- /dev/null
+++ b/tests/Feature/Business/PayablesFinalEntriesTest.php
@@ -0,0 +1,46 @@
+user->attachPermission(
+ Permission::where('name', 'read-admin-panel')->firstOrFail()
+ );
+ }
+
+ public function test_supplier_payables_final_entry_renders_the_existing_supplier_workspace(): void
+ {
+ $this->loginAs()
+ ->get(route('business.pages.show', ['section' => 'supplier-payables-final']))
+ ->assertOk()
+ ->assertSee('data-supplier-workspace', false)
+ ->assertSee('aria-label="供应商应付页面"', false)
+ ->assertSee(route('business.pages.show', [
+ 'section' => 'supplier-payables',
+ 'page' => 'supplier-payables-report',
+ ]), false)
+ ->assertDontSee('class="business-blank-page"', false);
+ }
+
+ public function test_courier_payables_final_entry_renders_the_existing_courier_workspace(): void
+ {
+ $this->loginAs()
+ ->get(route('business.pages.show', ['section' => 'courier-payables-final']))
+ ->assertOk()
+ ->assertSee('data-courier-final', false)
+ ->assertSee('aria-label="快递应付子功能"', false)
+ ->assertSee(route('business.pages.show', [
+ 'section' => 'courier-payables',
+ 'page' => 'courier-information',
+ ]), false)
+ ->assertDontSee('class="business-blank-page"', false);
+ }
+}
diff --git a/tests/Unit/View/PayablesGroupTest.php b/tests/Unit/View/PayablesGroupTest.php
index a1d2efc8..b28a1de2 100644
--- a/tests/Unit/View/PayablesGroupTest.php
+++ b/tests/Unit/View/PayablesGroupTest.php
@@ -16,14 +16,10 @@ class PayablesGroupTest extends TestCase
$slugs = array_column($grouped, 'slug');
$index = array_search('payable-items', $slugs, true);
$this->assertSame('store-receivables', $slugs[$index - 1]);
- $this->assertCount(6, $grouped[$index]['sections']);
- $this->assertSame(['供应商应付', '快递应付'], array_column(array_slice($grouped[$index]['sections'], 0, 2), 'title'));
+ $this->assertCount(8, $grouped[$index]['sections']);
$this->assertSame(
- [],
- array_intersect(
- ['supplier-payables-final', 'courier-payables-final'],
- array_column($grouped[$index]['sections'], 'slug')
- )
+ ['供应商应付(终版)', '快递应付(终版)', '供应商应付', '快递应付'],
+ array_column(array_slice($grouped[$index]['sections'], 0, 4), 'title')
);
$this->assertContains('inventory-management', $slugs);
foreach ($grouped[$index]['sections'] as $section) {
@@ -39,10 +35,10 @@ class PayablesGroupTest extends TestCase
$this->assertSame($allowed, $result[0]['sections']);
$this->assertSame([], ShowInAdmin::groupPayables([]));
- $legacy = [
+ $finalEntries = [
['slug' => 'supplier-payables-final', 'title' => '供应商应付(终版)', 'pages' => []],
['slug' => 'courier-payables-final', 'title' => '快递应付(终版)', 'pages' => []],
];
- $this->assertSame([], ShowInAdmin::groupPayables($legacy));
+ $this->assertSame($finalEntries, ShowInAdmin::groupPayables($finalEntries)[0]['sections']);
}
}
--
2.47.2