F
Filament13mo ago
Mikeyer

Summarize table without summarizing groups

Hello everyone, I would like summaries at the bottom of my table, but not inline with each group. Is it possible to switch of the summaries for the group rows and show just one summary at the bottom of the table?
return $table
->recordTitleAttribute(fn (JournalEntry $journalEntry): string => $journalEntry->commonDescription?->description ?: $journalEntry->description)
->modifyQueryUsing(fn (Builder $query) => $query->with('commonDescription', 'taxAccount'))
->defaultGroup('taxAccount.name')
->groups([
Group::make('taxAccount.name')
->getTitleFromRecordUsing(fn (JournalEntry $record): string => "[{$record->taxAccount->code}] {$record->taxAccount->name}"),
])
->columns([
Tables\Columns\TextColumn::make('description')
->state(fn (JournalEntry $journalEntry): string => $journalEntry->commonDescription?->description ?: $journalEntry->description),
Tables\Columns\TextColumn::make('debit')
->money('GBP')
->summarize(Sum::make()->money('GBP')),
Tables\Columns\TextColumn::make('credit')
->money('GBP')
->summarize(Sum::make()->money('GBP')),
])
->filters([
//
])
->headerActions([
Tables\Actions\CreateAction::make(),
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
return $table
->recordTitleAttribute(fn (JournalEntry $journalEntry): string => $journalEntry->commonDescription?->description ?: $journalEntry->description)
->modifyQueryUsing(fn (Builder $query) => $query->with('commonDescription', 'taxAccount'))
->defaultGroup('taxAccount.name')
->groups([
Group::make('taxAccount.name')
->getTitleFromRecordUsing(fn (JournalEntry $record): string => "[{$record->taxAccount->code}] {$record->taxAccount->name}"),
])
->columns([
Tables\Columns\TextColumn::make('description')
->state(fn (JournalEntry $journalEntry): string => $journalEntry->commonDescription?->description ?: $journalEntry->description),
Tables\Columns\TextColumn::make('debit')
->money('GBP')
->summarize(Sum::make()->money('GBP')),
Tables\Columns\TextColumn::make('credit')
->money('GBP')
->summarize(Sum::make()->money('GBP')),
])
->filters([
//
])
->headerActions([
Tables\Actions\CreateAction::make(),
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server