供应商对账:厂家上传的对账数据改为每页 15 行 + 页码翻页
上传的对账数据表原来一页 100 行太长:改为每页 15 行的短表,底部显示总行数/页码(首尾页+当前页附近页码、上一页/下一页),翻页保留所选厂家。
This commit is contained in:
parent
2848c81a5e
commit
c9f3e5b323
@ -15,7 +15,8 @@ use Modules\EcommerceFinance\Services\SupplierStatementStore;
|
||||
*/
|
||||
class SupplierReconciliationPageData
|
||||
{
|
||||
private const PER_PAGE = 100;
|
||||
/** 厂家上传的对账数据表:每页行数(短表 + 翻页)。 */
|
||||
private const PER_PAGE = 15;
|
||||
|
||||
public function __construct(
|
||||
private readonly SupplierPayableOverrideStore $store,
|
||||
|
||||
@ -132,13 +132,35 @@
|
||||
</table>
|
||||
</div>
|
||||
@if ($statementTotal > $perPage)
|
||||
@php
|
||||
$pageCount = max((int) ceil($statementTotal / $perPage), 1);
|
||||
$pageStart = max(1, min($rowsPage - 4, $pageCount - 8));
|
||||
$pageEnd = min($pageCount, $pageStart + 8);
|
||||
$pageUrl = fn (int $number): string => route('business.pages.show', [
|
||||
'section' => $section['slug'], 'page' => $page['slug'],
|
||||
'supplier' => $selectedSupplier, 'rows_page' => $number,
|
||||
]);
|
||||
@endphp
|
||||
<div class="sr-pagination">
|
||||
<span>第 {{ $rowsPage }} 页 / 共 {{ max((int) ceil($statementTotal / $perPage), 1) }} 页</span>
|
||||
<span>共 {{ number_format($statementTotal) }} 行,每页 {{ $perPage }} 行 · 第 {{ $rowsPage }} / {{ $pageCount }} 页</span>
|
||||
@if ($rowsPage > 1)
|
||||
<a class="sr-button" href="{{ route('business.pages.show', ['section' => $section['slug'], 'page' => $page['slug'], 'supplier' => $selectedSupplier, 'rows_page' => $rowsPage - 1]) }}">上一页</a>
|
||||
<a class="sr-button is-small" href="{{ $pageUrl($rowsPage - 1) }}">上一页</a>
|
||||
@endif
|
||||
@if ($pageStart > 1)
|
||||
<a class="sr-button is-small" href="{{ $pageUrl(1) }}">1</a>
|
||||
@if ($pageStart > 2) <span>…</span> @endif
|
||||
@endif
|
||||
@for ($number = $pageStart; $number <= $pageEnd; $number++)
|
||||
<a class="sr-button is-small {{ $number === $rowsPage ? 'is-primary' : '' }}"
|
||||
@if ($number === $rowsPage) aria-current="page" @endif
|
||||
href="{{ $pageUrl($number) }}">{{ $number }}</a>
|
||||
@endfor
|
||||
@if ($pageEnd < $pageCount)
|
||||
@if ($pageEnd < $pageCount - 1) <span>…</span> @endif
|
||||
<a class="sr-button is-small" href="{{ $pageUrl($pageCount) }}">{{ $pageCount }}</a>
|
||||
@endif
|
||||
@if ($rowsPage * $perPage < $statementTotal)
|
||||
<a class="sr-button" href="{{ route('business.pages.show', ['section' => $section['slug'], 'page' => $page['slug'], 'supplier' => $selectedSupplier, 'rows_page' => $rowsPage + 1]) }}">下一页</a>
|
||||
<a class="sr-button is-small" href="{{ $pageUrl($rowsPage + 1) }}">下一页</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@ -134,6 +134,33 @@ class SupplierReconciliationTest extends FeatureTestCase
|
||||
->assertSeeText('ZSJ-1');
|
||||
}
|
||||
|
||||
public function test_statement_rows_are_paginated_fifteen_per_page(): void
|
||||
{
|
||||
$rows = [];
|
||||
for ($i = 1; $i <= 20; $i++) {
|
||||
$rows[] = $this->statementRow(sprintf('ST-%02d', $i), '10.00', '1', '10.00');
|
||||
}
|
||||
$this->seedStatement('晨丰', $rows);
|
||||
|
||||
$pageUrl = fn (int $page): string => route('business.pages.show', [
|
||||
'section' => 'supplier-reconciliation',
|
||||
'page' => 'supplier-data',
|
||||
'supplier' => '晨丰',
|
||||
'rows_page' => $page,
|
||||
]);
|
||||
|
||||
$this->loginAs()->get($pageUrl(1))
|
||||
->assertOk()
|
||||
->assertSeeText('每页 15 行')
|
||||
->assertSeeText('ST-01')
|
||||
->assertDontSeeText('ST-20');
|
||||
|
||||
$this->loginAs()->get($pageUrl(2))
|
||||
->assertOk()
|
||||
->assertSeeText('ST-20')
|
||||
->assertDontSeeText('ST-01');
|
||||
}
|
||||
|
||||
public function test_return_rows_can_be_confirmed_disputed_and_confirmed_all(): void
|
||||
{
|
||||
$store = app(SupplierPayableOverrideStore::class);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user