feat(client): add journals relation and improve transaction ledger handling

- Add journals relation to Client model via Branch
- Update branch selection in JournalsRelationManager to use code instead of name
- Improve tax, withholding, and cash account ledger queries by adding client_id filter and amount checks
- Add missing import for GenerateVoucher command in ExpensesRelationManager
- Label 'Normal Balance' column in AccountsRelationManager
This commit is contained in:
Jp
2026-02-09 22:16:10 +08:00
parent 207f4c1609
commit 1548e178bc
5 changed files with 34 additions and 16 deletions

View File

@@ -37,7 +37,7 @@ class AccountsRelationManager extends RelationManager
->columns([
Tables\Columns\TextColumn::make('account')->description(fn (Account $record): string => $record->description ?? ''),
Tables\Columns\TextColumn::make('accountType.type'),
Tables\Columns\TextColumn::make('accountType.normal_balance'),
Tables\Columns\TextColumn::make('accountType.normal_balance')->label('Normal Balance'),
])
->filters([
//

View File

@@ -3,6 +3,7 @@
namespace App\Filament\Resources\ClientResource\RelationManagers;
use App\Actions\Transactions\CreateTransactionAction;
use App\Commands\Expenses\GenerateVoucher;
use App\DataObjects\CreateTransactionDTO;
use App\Models\Account;
use App\Models\Branch;

View File

@@ -35,7 +35,7 @@ class JournalsRelationManager extends RelationManager
->schema([
Select::make('branch_id')
->label('Branch')
->options(fn () => Branch::where('client_id', $this->getOwnerRecord()->id)->pluck('name', 'id'))
->options(fn () => Branch::where('client_id', $this->getOwnerRecord()->id)->pluck('code', 'id'))
->required()
->default(fn () => Branch::where('client_id', $this->getOwnerRecord()->id)->first()?->id),