diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php index b7e30b63..2e8bd530 100644 --- a/app/Http/Controllers/TransactionController.php +++ b/app/Http/Controllers/TransactionController.php @@ -145,7 +145,7 @@ class TransactionController extends Controller ->with(['account.bank:id,name,logo', 'labels:id,name,color']) ->orderBy('transaction_date', 'desc') ->orderBy('id', 'desc') - ->get(['id', 'account_id', 'category_id', 'description', 'description_iv', 'transaction_date', 'amount', 'currency_code', 'notes', 'notes_iv']); + ->get(['id', 'account_id', 'category_id', 'description', 'description_iv', 'transaction_date', 'amount', 'currency_code', 'notes', 'notes_iv', 'creditor_name', 'debtor_name']); return Inertia::render('transactions/categorize', [ 'categories' => $categories, diff --git a/resources/js/components/transactions/categorizer-card.tsx b/resources/js/components/transactions/categorizer-card.tsx index 57d058e2..5efaf131 100644 --- a/resources/js/components/transactions/categorizer-card.tsx +++ b/resources/js/components/transactions/categorizer-card.tsx @@ -7,6 +7,7 @@ import { cn } from '@/lib/utils'; import { type Category, getCategoryColorClasses } from '@/types/category'; import { type DecryptedTransaction } from '@/types/transaction'; import { formatDateLong } from '@/utils/date'; +import { __ } from '@/utils/i18n'; import { CheckCircle2 } from 'lucide-react'; interface CategorizerCardProps { @@ -92,6 +93,36 @@ export function CategorizerCard({ /> )} + + {(transaction.creditor_name || + transaction.debtor_name) && ( +
+ {transaction.creditor_name && ( +
+
+ {__('Creditor')} +
+
+ { + transaction.creditor_name + } +
+
+ )} + {transaction.debtor_name && ( +
+
+ {__('Debtor')} +
+
+ { + transaction.debtor_name + } +
+
+ )} +
+ )} diff --git a/tests/Feature/TransactionTest.php b/tests/Feature/TransactionTest.php index 7015ccc4..bab81284 100644 --- a/tests/Feature/TransactionTest.php +++ b/tests/Feature/TransactionTest.php @@ -720,6 +720,29 @@ test('categorize page only returns uncategorized transactions', function () { ); }); +test('categorize page exposes debtor and creditor names', function () { + $user = User::factory()->onboarded()->create(); + $account = Account::factory()->create(['user_id' => $user->id]); + + $transaction = Transaction::factory()->create([ + 'user_id' => $user->id, + 'account_id' => $account->id, + 'category_id' => null, + 'creditor_name' => 'Acme Corp', + 'debtor_name' => 'Jane Doe', + ]); + + $response = actingAs($user)->get(route('transactions.categorize')); + + $response->assertSuccessful(); + $response->assertInertia(fn ($page) => $page + ->component('transactions/categorize') + ->where('transactions.0.id', $transaction->id) + ->where('transactions.0.creditor_name', 'Acme Corp') + ->where('transactions.0.debtor_name', 'Jane Doe') + ); +}); + test('categorize page does not return transactions from deleted accounts', function () { $user = User::factory()->onboarded()->create();