fix:재무 대시보드 최근 거래내역에 수정된 적요 반영
- BankTransactionOverride 데이터 병합 로직 추가 - 수정된 적요/내용이 있으면 오버라이드 적용 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Barobill\BankTransaction as BarobillBankTransaction;
|
||||
use App\Models\Barobill\BankTransactionOverride;
|
||||
use App\Models\Barobill\CardTransaction as BarobillCardTransaction;
|
||||
use App\Models\Finance\BankAccount;
|
||||
use App\Models\Finance\FundSchedule;
|
||||
@@ -50,6 +51,30 @@ public function index(): View
|
||||
->limit(10)
|
||||
->get();
|
||||
|
||||
// 오버라이드 데이터 병합 (수정된 적요/내용)
|
||||
if ($recentTransactions->isNotEmpty()) {
|
||||
$uniqueKeys = $recentTransactions->map(fn($t) => $t->unique_key)->toArray();
|
||||
$overrides = BankTransactionOverride::getByUniqueKeys($tenantId, $uniqueKeys);
|
||||
|
||||
$recentTransactions = $recentTransactions->map(function ($transaction) use ($overrides) {
|
||||
$override = $overrides->get($transaction->unique_key);
|
||||
if ($override) {
|
||||
// 수정된 적요가 있으면 적용
|
||||
if ($override->modified_summary) {
|
||||
$transaction->summary = $override->modified_summary;
|
||||
}
|
||||
// 수정된 내용이 있으면 적용
|
||||
if ($override->modified_cast) {
|
||||
$transaction->cast = $override->modified_cast;
|
||||
}
|
||||
$transaction->is_overridden = true;
|
||||
} else {
|
||||
$transaction->is_overridden = false;
|
||||
}
|
||||
return $transaction;
|
||||
});
|
||||
}
|
||||
|
||||
// 최근 카드 사용내역 (바로빌 - 최근 7일, 최대 10건)
|
||||
$recentCardTransactions = BarobillCardTransaction::where('tenant_id', $tenantId)
|
||||
->whereBetween('use_date', [$weekAgo, $today])
|
||||
|
||||
Reference in New Issue
Block a user