From f4f0d5d7b140695f33e738f7a3fe104c8402a52f Mon Sep 17 00:00:00 2001 From: 92451 <924518135@qq.com> Date: Wed, 11 Nov 2026 19:50:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=90=8C=E6=AD=A5=E8=B4=A6=E6=88=B7?= =?UTF-8?q?=E8=B5=84=E9=87=91=E6=B1=87=E6=80=BB=E5=B9=B6=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9D=A5=E6=BA=90=20(#1114)=20Co-authored-by?= =?UTF-8?q?:=2092451=20<924518135@qq.com>=20Co-committed-by:=2092451=20<92?= =?UTF-8?q?4518135@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Business/FinanceLedger.php | 21 +++ ...00_create_flow_summary_account_sources.php | 33 +++++ .../Services/FinanceLedgerAccountEditor.php | 20 +-- .../FinanceLedgerFlowSummaryEditor.php | 66 +++++++++ .../View/FinanceLedgerPageData.php | 39 +++++- .../pages/financial-ledger/ledger.blade.php | 42 ++++-- routes/admin.php | 4 + ...inanceLedgerFlowSummarySpreadsheetTest.php | 127 +++++++++++++++++- .../FinanceLedgerHeaderControlsTest.php | 10 +- .../Business/FinanceLedgerManualEditTest.php | 2 +- 10 files changed, 327 insertions(+), 37 deletions(-) create mode 100644 database/migrations/2026_11_11_200000_create_flow_summary_account_sources.php diff --git a/app/Http/Controllers/Business/FinanceLedger.php b/app/Http/Controllers/Business/FinanceLedger.php index 05236791..b0665aba 100644 --- a/app/Http/Controllers/Business/FinanceLedger.php +++ b/app/Http/Controllers/Business/FinanceLedger.php @@ -1506,6 +1506,27 @@ class FinanceLedger extends Controller ], 200, ['Cache-Control' => 'private, no-store']); } + public function updateFlowSummarySource( + Request $request, + FinanceLedgerFlowSummaryEditor $editor, + ): JsonResponse { + abort_unless(FinanceLedgerAccess::canEditAccountStatus(user()), 403, '只有财务台账管理员可以编辑账户资金汇总数据来源。'); + + $data = $request->validate([ + 'account_short' => ['required', 'string', 'max:100'], + 'value' => ['nullable', 'string', 'max:500'], + ]); + + return response()->json([ + 'ok' => true, + 'value' => $editor->updateSource( + trim((string) $data['account_short']), + $data['value'] ?? null, + ), + 'message' => '数据来源已保存。', + ], 200, ['Cache-Control' => 'private, no-store']); + } + public function updateTransactionAccount(Request $request, int $id, FinanceLedgerCalculator $calculator): JsonResponse { abort_unless(FinanceLedgerAccess::canEditTransactions(user()), 403, '当前账号没有修改动账账户关联权限。'); diff --git a/database/migrations/2026_11_11_200000_create_flow_summary_account_sources.php b/database/migrations/2026_11_11_200000_create_flow_summary_account_sources.php new file mode 100644 index 00000000..fc699e90 --- /dev/null +++ b/database/migrations/2026_11_11_200000_create_flow_summary_account_sources.php @@ -0,0 +1,33 @@ +connection()); + + if (! $schema->hasTable('fin_flow_summary_account_sources')) { + $schema->create('fin_flow_summary_account_sources', function (Blueprint $table): void { + $table->bigIncrements('id'); + $table->string('account_short', 100)->unique('fin_flow_summary_account_source_short_unique'); + $table->string('data_source', 500)->nullable(); + $table->string('updated_by', 100)->nullable(); + $table->timestamps(); + }); + } + } + + public function down(): void + { + Schema::connection($this->connection())->dropIfExists('fin_flow_summary_account_sources'); + } +}; diff --git a/modules/EcommerceFinance/Services/FinanceLedgerAccountEditor.php b/modules/EcommerceFinance/Services/FinanceLedgerAccountEditor.php index 40126fc6..8c446e5d 100644 --- a/modules/EcommerceFinance/Services/FinanceLedgerAccountEditor.php +++ b/modules/EcommerceFinance/Services/FinanceLedgerAccountEditor.php @@ -146,15 +146,17 @@ class FinanceLedgerAccountEditor { $now = now(); foreach ([ - 'fin_account_opening' => ['account_short' => [], 'updated_at' => $now], - 'fin_daily_flows' => ['account_short' => [], 'updated_at' => $now], - 'fin_transactions' => ['account_short' => [], 'updated_by' => (string) (user()?->name ?? ''), 'updated_at' => $now], - 'fin_account_map' => ['account_short' => [], 'updated_by' => (string) (user()?->name ?? ''), 'updated_at' => $now], - 'fin_account_statuses' => ['account_short' => [], 'updated_by' => (string) (user()?->name ?? ''), 'updated_at' => $now], - 'fin_account_type_overrides' => ['account_short' => [], 'updated_by' => (string) (user()?->name ?? ''), 'updated_at' => $now], - 'fin_account_todos' => ['account_short' => [], 'updated_by' => (string) (user()?->name ?? ''), 'updated_at' => $now], - 'fin_account_keep_todos' => ['account_short' => [], 'updated_by' => (string) (user()?->name ?? ''), 'updated_at' => $now], - 'fin_shops' => ['account_short' => [], 'updated_at' => $now], + 'fin_account_opening' => ['updated_at' => $now], + 'fin_daily_flows' => ['updated_at' => $now], + 'fin_transactions' => ['updated_by' => (string) (user()?->name ?? ''), 'updated_at' => $now], + 'fin_account_map' => ['updated_by' => (string) (user()?->name ?? ''), 'updated_at' => $now], + 'fin_account_statuses' => ['updated_by' => (string) (user()?->name ?? ''), 'updated_at' => $now], + 'fin_account_type_overrides' => ['updated_by' => (string) (user()?->name ?? ''), 'updated_at' => $now], + 'fin_account_todos' => ['updated_by' => (string) (user()?->name ?? ''), 'updated_at' => $now], + 'fin_account_keep_todos' => ['updated_by' => (string) (user()?->name ?? ''), 'updated_at' => $now], + 'fin_shops' => ['updated_at' => $now], + 'fin_flow_summary_custom_values' => ['updated_at' => $now], + 'fin_flow_summary_account_sources' => ['updated_by' => (string) (user()?->name ?? ''), 'updated_at' => $now], ] as $table => $extra) { if (! Schema::connection($this->connection->getName())->hasTable($table) || ! Schema::connection($this->connection->getName())->hasColumn($table, 'account_short')) { diff --git a/modules/EcommerceFinance/Services/FinanceLedgerFlowSummaryEditor.php b/modules/EcommerceFinance/Services/FinanceLedgerFlowSummaryEditor.php index 1cf8621d..d9149d60 100644 --- a/modules/EcommerceFinance/Services/FinanceLedgerFlowSummaryEditor.php +++ b/modules/EcommerceFinance/Services/FinanceLedgerFlowSummaryEditor.php @@ -61,6 +61,11 @@ class FinanceLedgerFlowSummaryEditor 'field_names' => '一次新增的列名不能重复。', ]); } + if (in_array('数据来源', $normalizedNames, true)) { + throw ValidationException::withMessages([ + 'field_names' => '“数据来源”是账户资金汇总固定列,不能重复新增。', + ]); + } return $this->connection->transaction(function () use ( $fieldNames, @@ -257,6 +262,67 @@ class FinanceLedgerFlowSummaryEditor }); } + /** + * @return array + */ + public function updateSource(string $accountShort, mixed $value): array + { + $accountShort = preg_replace('/\s+/u', ' ', trim($accountShort)) ?? trim($accountShort); + $text = trim((string) ($value ?? '')); + $text = preg_replace('/\s+/u', ' ', $text) ?? $text; + + return $this->connection->transaction(function () use ($accountShort, $text): array { + if ($accountShort === '' || FinanceLedgerIndependentAccounts::contains($accountShort)) { + throw ValidationException::withMessages([ + 'account_short' => '请选择账户资金汇总中的账户。', + ]); + } + if (! $this->connection->table('fin_accounts')->where('account_short', $accountShort)->exists()) { + throw ValidationException::withMessages([ + 'account_short' => '账户简称不存在,请刷新页面后重试。', + ]); + } + + $query = $this->connection->table('fin_flow_summary_account_sources') + ->where('account_short', $accountShort); + $existing = $query->lockForUpdate()->first(); + $before = $existing?->data_source; + $nextValue = $text !== '' ? mb_substr($text, 0, 500) : null; + if ($nextValue === null) { + if ($existing !== null) { + $query->delete(); + } + } elseif ($existing === null) { + $this->connection->table('fin_flow_summary_account_sources')->insert([ + 'account_short' => $accountShort, + 'data_source' => $nextValue, + 'updated_by' => (string) (user()?->name ?? ''), + 'created_at' => now(), + 'updated_at' => now(), + ]); + } else { + $query->update([ + 'data_source' => $nextValue, + 'updated_by' => (string) (user()?->name ?? ''), + 'updated_at' => now(), + ]); + } + $this->audit( + 'flow_summary_source_set', + $accountShort, + [ + 'before' => $before, + 'after' => $nextValue, + ], + ); + + return [ + 'account_short' => $accountShort, + 'data_source' => $nextValue, + ]; + }); + } + /** * @param array $changes */ diff --git a/modules/EcommerceFinance/View/FinanceLedgerPageData.php b/modules/EcommerceFinance/View/FinanceLedgerPageData.php index 669460bf..24ca5ddd 100644 --- a/modules/EcommerceFinance/View/FinanceLedgerPageData.php +++ b/modules/EcommerceFinance/View/FinanceLedgerPageData.php @@ -674,11 +674,16 @@ class FinanceLedgerPageData $accountRows = $accountQuery ->orderBy('a.company_name') ->orderBy('a.account_short') - ->get(['a.company_name', 'a.account_short', 'a.account_type']) - ->filter(static fn ($account): bool => trim((string) ($account->account_short ?? '')) !== '') - ->unique('account_short') - ->keyBy('account_short'); - $accountShorts = $accountRows->keys()->map(static fn (mixed $value): string => (string) $value)->all(); + ->orderBy('a.id') + ->get(['a.id', 'a.company_name', 'a.account_short', 'a.account_type']); + $accountShorts = $accountRows + ->pluck('account_short') + ->map(static fn (mixed $value): string => trim((string) $value)) + ->filter() + ->unique() + ->values() + ->all(); + $accountSources = $this->flowSummaryAccountSources($accountShorts); $flowQuery = FinanceLedgerIndependentAccounts::exclude($this->db()->table('fin_daily_flows')) ->whereIn('account_short', $accountShorts) @@ -695,8 +700,8 @@ class FinanceLedgerPageData ->groupBy('account_short'); $rows = []; - foreach ($accountRows as $accountShort => $account) { - $accountShort = (string) $accountShort; + foreach ($accountRows as $account) { + $accountShort = trim((string) ($account->account_short ?? '')); $accountFlows = $flowRows->get($accountShort, collect()); $inPeriod = $accountFlows->filter(static function ($row) use ($period): bool { $date = substr((string) $row->flow_date, 0, 10); @@ -720,9 +725,11 @@ class FinanceLedgerPageData ->count(); $hasBalance = $openingRow !== null || $closingRow !== null; $rows[] = [ + 'account_id' => (int) $account->id, 'company_name' => (string) ($account->company_name ?? ''), 'account_short' => $accountShort, 'bank_affiliation' => $this->bankAffiliation($accountShort), + 'data_source' => $accountSources[$accountShort] ?? null, 'opening_balance' => $latestBeforePeriod !== null ? round((float) $latestBeforePeriod->closing_balance, 2) : ($firstInPeriod === null ? null : round((float) $firstInPeriod->opening_balance, 2)), @@ -772,6 +779,23 @@ class FinanceLedgerPageData ]; } + /** + * @param list $accountShorts + * @return array + */ + private function flowSummaryAccountSources(array $accountShorts): array + { + if ($accountShorts === [] || ! $this->db()->getSchemaBuilder()->hasTable('fin_flow_summary_account_sources')) { + return []; + } + + return $this->db()->table('fin_flow_summary_account_sources') + ->whereIn('account_short', $accountShorts) + ->pluck('data_source', 'account_short') + ->map(static fn (mixed $value): ?string => $value !== null ? (string) $value : null) + ->all(); + } + /** * @return list */ @@ -1820,6 +1844,7 @@ class FinanceLedgerPageData 'account_short' => ['sort' => 'account_short', 'type' => 'text'], 'bank_affiliation' => ['sort' => 'bank_affiliation', 'type' => 'text'], 'company_name' => ['sort' => 'company_name', 'type' => 'text'], + 'data_source' => ['sort' => 'data_source', 'type' => 'text'], 'opening_balance' => ['sort' => 'opening_balance', 'type' => 'number'], 'inflow' => ['sort' => 'inflow', 'type' => 'number'], 'outflow' => ['sort' => 'outflow', 'type' => 'number'], diff --git a/resources/views/business/pages/financial-ledger/ledger.blade.php b/resources/views/business/pages/financial-ledger/ledger.blade.php index acdca8d3..15350f99 100644 --- a/resources/views/business/pages/financial-ledger/ledger.blade.php +++ b/resources/views/business/pages/financial-ledger/ledger.blade.php @@ -198,6 +198,7 @@ ['account_short', '账户简称', 'text'], ['bank_affiliation', '所属银行', 'text'], ['company_name', '公司', 'text'], + ['data_source', '数据来源', 'text'], ['opening_balance', '期初余额', 'number', ['headerClass' => 'num', 'align' => 'end']], ['inflow', '当期收入', 'number', ['headerClass' => 'num', 'align' => 'end']], ['outflow', '当期支出', 'number', ['headerClass' => 'num', 'align' => 'end']], @@ -1152,10 +1153,17 @@ @endforelse @else @forelse ($ledgerFlows as $row) - + {{ $row->account_short }} {{ $row->bank_affiliation ?: '—' }} {{ $row->company_name }} + + @if ($canEditAccounts && $row->account_short !== '') + + @else + {{ filled($row->data_source ?? null) ? $row->data_source : '—' }} + @endif + {{ $row->opening_balance === null ? '—' : $money($row->opening_balance) }} {{ $row->inflow > 0 ? $money($row->inflow) : '' }} {{ $row->outflow > 0 ? $money($row->outflow) : '' }} @@ -1165,7 +1173,7 @@ @foreach ($flowSummaryCustomFields as $customField) @php $customValue = $row->custom_values[$customField['field_key']] ?? ''; @endphp - @if ($canEditAccounts) + @if ($canEditAccounts && $row->account_short !== '') @else {{ $customValue }} @@ -1173,7 +1181,7 @@ @endforeach - @if ($canEditAccounts) + @if ($canEditAccounts && $row->account_short !== '') @else — @@ -1181,7 +1189,7 @@ @empty -
没有匹配的账户。
+
没有匹配的账户。
@endforelse @endif @@ -3759,7 +3767,8 @@ }); } - flowsPanel?.querySelectorAll('[data-ledger-flow-summary-custom-value]').forEach((input) => { + flowsPanel?.querySelectorAll('[data-ledger-flow-summary-custom-value], [data-ledger-flow-summary-source]').forEach((input) => { + const isDataSource = input.hasAttribute('data-ledger-flow-summary-source'); const saveValue = async () => { if (input.dataset.saving === '1') return; const previousValue = input.dataset.previousValue || ''; @@ -3779,25 +3788,30 @@ 'X-CSRF-TOKEN': ledgerCsrfToken, 'X-Requested-With': 'XMLHttpRequest', }, - body: JSON.stringify({ - field_id: Number(input.dataset.fieldId || 0), - account_short: input.dataset.accountShort || '', - value: nextValue, - }), + body: JSON.stringify(isDataSource + ? { + account_short: input.dataset.sourceAccountShort || '', + value: nextValue, + } + : { + field_id: Number(input.dataset.fieldId || 0), + account_short: input.dataset.accountShort || '', + value: nextValue, + }), }); const payload = await response.json().catch(() => ({})); if (!response.ok) { const firstError = Object.values(payload.errors || {})[0]?.[0]; - throw new Error(firstError || payload.message || '自定义列数据保存失败'); + throw new Error(firstError || payload.message || (isDataSource ? '数据来源保存失败' : '自定义列数据保存失败')); } - const savedValue = payload.value?.value || ''; + const savedValue = (isDataSource ? payload.value?.data_source : payload.value?.value) || ''; input.value = savedValue; input.dataset.previousValue = savedValue; - notify(payload.message || '自定义列数据已保存'); + notify(payload.message || (isDataSource ? '数据来源已保存' : '自定义列数据已保存')); } catch (error) { input.value = previousValue; input.classList.add('is-error'); - notify(error.message || '自定义列数据保存失败', true); + notify(error.message || (isDataSource ? '数据来源保存失败' : '自定义列数据保存失败'), true); } finally { input.disabled = false; input.classList.remove('is-saving'); diff --git a/routes/admin.php b/routes/admin.php index 02ddc185..cedca371 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -939,6 +939,10 @@ Route::post('workspace/financial-ledger/flows/summary/values', [\App\Http\Contro ->middleware('business.page:financial-operations,ledger') ->name('business.financial-ledger.flows.summary.values.update'); +Route::post('workspace/financial-ledger/flows/summary/source', [\App\Http\Controllers\Business\FinanceLedger::class, 'updateFlowSummarySource']) + ->middleware('business.page:financial-operations,ledger') + ->name('business.financial-ledger.flows.summary.source.update'); + Route::post('workspace/financial-ledger/accounts/status', [\App\Http\Controllers\Business\FinanceLedger::class, 'updateAccountStatus']) ->middleware('business.page:financial-operations,ledger') ->name('business.financial-ledger.accounts.status'); diff --git a/tests/Feature/Business/FinanceLedgerFlowSummarySpreadsheetTest.php b/tests/Feature/Business/FinanceLedgerFlowSummarySpreadsheetTest.php index 080cf354..289ca9ab 100644 --- a/tests/Feature/Business/FinanceLedgerFlowSummarySpreadsheetTest.php +++ b/tests/Feature/Business/FinanceLedgerFlowSummarySpreadsheetTest.php @@ -92,6 +92,115 @@ class FinanceLedgerFlowSummarySpreadsheetTest extends FeatureTestCase ], 'business_mirror'); } + public function test_summary_keeps_every_account_master_row_and_follows_account_edits(): void + { + $connection = DB::connection('business_mirror'); + $originalId = (int) $connection->table('fin_accounts') + ->where('account_short', $this->accountShort) + ->value('id'); + $duplicateId = (int) $connection->table('fin_accounts')->insertGetId([ + 'company_name' => '重名账户测试公司', + 'account_short' => $this->accountShort, + 'account_type' => '公户', + 'current_balance' => 20, + 'daily_available' => 20, + 'blocked_amount' => 0, + ]); + + $html = $this->loginAs()->get($this->pageUrl())->assertOk()->getContent(); + + $this->assertStringContainsString('data-flow-summary-account-id="' . $originalId . '"', $html); + $this->assertStringContainsString('data-flow-summary-account-id="' . $duplicateId . '"', $html); + $this->assertStringContainsString('汇总表格测试公司', $html); + $this->assertStringContainsString('重名账户测试公司', $html); + + $renamedShort = $this->accountShort . '-已同步'; + $this->loginAs()->postJson(route('business.financial-ledger.accounts.update', [ + 'company_id' => $this->company->id, + 'id' => $duplicateId, + ]), [ + 'company_name' => '账户编辑后公司', + 'account_short' => $renamedShort, + 'status' => 'normal', + ])->assertOk()->assertJsonPath('account.company_name', '账户编辑后公司'); + + $renamedHtml = $this->loginAs()->get($this->pageUrlForAccount($renamedShort)) + ->assertOk() + ->getContent(); + $this->assertStringContainsString('data-flow-summary-account-id="' . $duplicateId . '"', $renamedHtml); + $this->assertStringContainsString('账户编辑后公司', $renamedHtml); + $this->assertStringNotContainsString('重名账户测试公司', $renamedHtml); + } + + public function test_data_source_is_after_company_and_can_be_edited_inline(): void + { + $html = $this->loginAs()->get($this->pageUrl())->assertOk()->getContent(); + $flowsStart = strpos($html, 'id="ledger-panel-flows"'); + $transactionsStart = strpos($html, 'id="ledger-panel-transactions"'); + $flowsHtml = substr($html, (int) $flowsStart, (int) $transactionsStart - (int) $flowsStart); + $accountHeader = strpos($flowsHtml, 'data-ledger-header-field="account_short"'); + $companyHeader = strpos($flowsHtml, 'data-ledger-header-field="company_name"'); + $sourceHeader = strpos($flowsHtml, 'data-ledger-header-field="data_source"'); + $openingHeader = strpos($flowsHtml, 'data-ledger-header-field="opening_balance"'); + + $this->assertIsInt($accountHeader); + $this->assertIsInt($companyHeader); + $this->assertIsInt($sourceHeader); + $this->assertIsInt($openingHeader); + $this->assertTrue($accountHeader < $companyHeader); + $this->assertTrue($companyHeader < $sourceHeader); + $this->assertTrue($sourceHeader < $openingHeader); + $this->assertStringContainsString('data-ledger-flow-summary-source', $flowsHtml); + $this->assertStringContainsString('placeholder="填写数据来源"', $flowsHtml); + + $this->loginAs()->postJson($this->sourceUrl(), [ + 'account_short' => $this->accountShort, + 'value' => '银行流水', + ])->assertOk() + ->assertJsonPath('value.data_source', '银行流水'); + $this->assertDatabaseHas('fin_flow_summary_account_sources', [ + 'account_short' => $this->accountShort, + 'data_source' => '银行流水', + ], 'business_mirror'); + + $accountId = (int) DB::connection('business_mirror')->table('fin_accounts') + ->where('account_short', $this->accountShort) + ->value('id'); + $renamedShort = $this->accountShort . '-来源同步'; + $this->loginAs()->postJson(route('business.financial-ledger.accounts.update', [ + 'company_id' => $this->company->id, + 'id' => $accountId, + ]), [ + 'company_name' => '汇总表格测试公司', + 'account_short' => $renamedShort, + 'status' => 'normal', + ])->assertOk(); + + $this->assertDatabaseHas('fin_flow_summary_account_sources', [ + 'account_short' => $renamedShort, + 'data_source' => '银行流水', + ], 'business_mirror'); + $this->assertDatabaseHas('fin_account_opening', [ + 'account_short' => $renamedShort, + ], 'business_mirror'); + $this->assertDatabaseMissing('fin_account_opening', [ + 'account_short' => $this->accountShort, + ], 'business_mirror'); + $renamedHtml = $this->loginAs()->get($this->pageUrlForAccount($renamedShort)) + ->assertOk() + ->getContent(); + $this->assertStringContainsString('value="银行流水"', $renamedHtml); + } + + public function test_data_source_column_name_is_reserved_for_the_fixed_column(): void + { + $this->withExceptionHandling()->loginAs()->postJson($this->columnStoreUrl(), [ + 'field_names' => ['数据来源'], + 'position' => 'end', + ])->assertUnprocessable() + ->assertJsonPath('errors.field_names.0', '“数据来源”是账户资金汇总固定列,不能重复新增。'); + } + public function test_summary_spreadsheet_endpoints_reject_account_viewers(): void { $viewer = user_model_class()::create([ @@ -110,9 +219,18 @@ class FinanceLedgerFlowSummarySpreadsheetTest extends FeatureTestCase $this->withExceptionHandling()->loginAs($viewer)->postJson($this->columnStoreUrl(), [ 'field_names' => ['无权限列'], ])->assertForbidden(); + $this->withExceptionHandling()->loginAs($viewer)->postJson($this->sourceUrl(), [ + 'account_short' => $this->accountShort, + 'value' => '无权限来源', + ])->assertForbidden(); } private function pageUrl(): string + { + return $this->pageUrlForAccount($this->accountShort); + } + + private function pageUrlForAccount(string $accountShort): string { return route('business.pages.show', [ 'company_id' => $this->company->id, @@ -123,7 +241,7 @@ class FinanceLedgerFlowSummarySpreadsheetTest extends FeatureTestCase 'flows_view' => 'summary', 'flows_from' => '2026-11-01', 'flows_to' => '2026-11-30', - 'flows_account' => $this->accountShort, + 'flows_account' => $accountShort, ]); } @@ -148,4 +266,11 @@ class FinanceLedgerFlowSummarySpreadsheetTest extends FeatureTestCase 'company_id' => $this->company->id, ]); } + + private function sourceUrl(): string + { + return route('business.financial-ledger.flows.summary.source.update', [ + 'company_id' => $this->company->id, + ]); + } } diff --git a/tests/Feature/Business/FinanceLedgerHeaderControlsTest.php b/tests/Feature/Business/FinanceLedgerHeaderControlsTest.php index 1ff70b0e..5188da47 100644 --- a/tests/Feature/Business/FinanceLedgerHeaderControlsTest.php +++ b/tests/Feature/Business/FinanceLedgerHeaderControlsTest.php @@ -140,8 +140,8 @@ class FinanceLedgerHeaderControlsTest extends FeatureTestCase $response = $this->loginAs()->get($this->pageUrl()); $html = $response->assertOk()->getContent(); - $this->assertSame(66, preg_match_all('/]*data-ledger-header-details/', $html)); - $this->assertSame(66, preg_match_all('/]*data-ledger-header-label/', $html)); + $this->assertSame(67, preg_match_all('/]*data-ledger-header-details/', $html)); + $this->assertSame(67, preg_match_all('/]*data-ledger-header-label/', $html)); $this->assertSame(2, preg_match_all('/