F
Filamentcodeartisan

Calculate Totals in the footer for a table component

How can calculate the total balance of the customers and show it in the footer .Note this table component is not being used in filament admin panel but rather a laravel project with livewire Also how can I add the view and edit actions onto this table component
No description
C
codeartisan43d ago
No description
H
Hussain4real43d ago
Use Filament summarizer
C
codeartisan43d ago
let me share my code
H
Hussain4real43d ago
and for the View and Edit, you just need to include them in the actions column Okay
C
codeartisan43d ago
C
codeartisan43d ago
When I try to include the Actions I get an error
H
Hussain4real43d ago
your'e probably not importing the right action which column do you want total for? the code is not showing complete paste it instead of file upload use the tripple backtick to format
C
codeartisan43d ago
php
php
C
codeartisan43d ago
Is that better I want the view , delete ,show but I pass in my custom routes Also I want create Action and pass in my custom route name For the column I want to sum the balance
H
Hussain4real43d ago
use Filament\Tables\Columns\Summarizers\Sum;

TextColumn::make('balance')
->summarize([
Sum::make()
])
use Filament\Tables\Columns\Summarizers\Sum;

TextColumn::make('balance')
->summarize([
Sum::make()
])
for the actions, i can see your'e importing the wrong action use Filament\Tables\Actions\Action; then chain the ->url() to the action which will contain the custom route
C
codeartisan43d ago
Class "App\Livewire\Tables\Actions\ViewAction" not found I get this error
C
codeartisan43d ago
php
php
I dont know if am importing everything in the right way but thats what i have
H
Hussain4real43d ago
dont use ViewAction use normal Action since you will be using custom route something like this:
use Filament\Tables\Actions\Action;

Action::make('view')
->url(fn ($record) => route('customers.show', $record)),
use Filament\Tables\Actions\Action;

Action::make('view')
->url(fn ($record) => route('customers.show', $record)),
make sure you Implements HasActions trait and add: use InteractsWithActions;
C
codeartisan43d ago
Now the header actions are not appearing But the rest are appearing
C
codeartisan43d ago
No description
H
Hussain4real43d ago
did you add any headerAction?
C
codeartisan43d ago
Yeah I added create
->headerActions([
Action::make('create')
->label('Add Customer')
->color('primary')
->url(route('customers.create')),
])
->headerActions([
Action::make('create')
->label('Add Customer')
->color('primary')
->url(route('customers.create')),
])
H
Hussain4real43d ago
check if you imported the right action
C
codeartisan43d ago
am using use Filament\Tables\Actions\Action; probably i need to implement some trait
H
Hussain4real43d ago
this is from the docs:
use Filament\Actions\Action;

public function deleteAction(): Action
{
return Action::make('delete')
->requiresConfirmation()
->action(fn () => $this->post->delete());
}
use Filament\Actions\Action;

public function deleteAction(): Action
{
return Action::make('delete')
->requiresConfirmation()
->action(fn () => $this->post->delete());
}
then in ur view:
<div>
{{ $this->deleteAction }}
<x-filament-actions::modals />

{{ $this->table }}
</div>
<div>
{{ $this->deleteAction }}
<x-filament-actions::modals />

{{ $this->table }}
</div>
change yours to createAction(): Action
C
codeartisan43d ago
let me try that
H
Hussain4real43d ago
Okay
C
codeartisan43d ago
I see it but its color is not visible
public function createAction(): Action
{
return Action::make('create')
->label('Add Customer')
->color('primary')
->url(route('customers.create'));
}
public function createAction(): Action
{
return Action::make('create')
->label('Add Customer')
->color('primary')
->url(route('customers.create'));
}
it shows but its gray in color
H
Hussain4real43d ago
do you have a custom theme?
C
codeartisan43d ago
no its just a tailwindcss template probably i add css classes
H
Hussain4real43d ago
if you add css it won't work, it will be stripped out. you need to create custom theme
C
codeartisan43d ago
How do I do that then
C
codeartisan43d ago
But am not using a their panel am just using a normal liveware and tailwindcss template
H
Hussain4real43d ago
did you install Filament Table package?
C
codeartisan43d ago
Yeah I installed it
H
Hussain4real43d ago
then you need to create a custom theme also you need to tell Your AppServiceprovider the colors you will be using because currently Your Application is unaware of the primary color
C
codeartisan43d ago
the problem am not so sure on how to do that
H
Hussain4real43d ago
in your AppServiceProvider in the boot method put this:
use Filament\Support\Colors\Color;
use Filament\Support\Facades\FilamentColor;

FilamentColor::register([
'danger' => Color::Red,
'gray' => Color::Gray,
'info' => Color::Blue,
'primary' => Color::Indigo,
'success' => Color::Green,
'warning' => Color::Amber,
]);
use Filament\Support\Colors\Color;
use Filament\Support\Facades\FilamentColor;

FilamentColor::register([
'danger' => Color::Red,
'gray' => Color::Gray,
'info' => Color::Blue,
'primary' => Color::Indigo,
'success' => Color::Green,
'warning' => Color::Amber,
]);
C
codeartisan43d ago
ok am trying it
<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Filament\Support\Colors\Color;
use Filament\Support\Facades\FilamentColor;

class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}

/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
FilamentColor::register([
'danger' => Color::Red,
'gray' => Color::Gray,
'info' => Color::Blue,
'primary' => Color::Indigo,
'success' => Color::Green,
'warning' => Color::Amber,
]);
}
}
<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Filament\Support\Colors\Color;
use Filament\Support\Facades\FilamentColor;

class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}

/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
FilamentColor::register([
'danger' => Color::Red,
'gray' => Color::Gray,
'info' => Color::Blue,
'primary' => Color::Indigo,
'success' => Color::Green,
'warning' => Color::Amber,
]);
}
}
thats what i have dont But seems no change I have re-started the application
H
Hussain4real43d ago
recompile your assets
C
codeartisan43d ago
npm run dev?
H
Hussain4real43d ago
yes
C
codeartisan43d ago
There was change *no change
H
Hussain4real43d ago
Hmm create a custom theme and style it from there
C
codeartisan43d ago
i have created now
H
Hussain4real43d ago
style the action button there
C
codeartisan43d ago
example please
H
Hussain4real43d ago
in your new theme.css style the button action there, you will need to look for the class name in your inspect console i think the name is .fi-btn style that class like this:
.fi-btn{
@apply bg-purple-600;
}
.fi-btn{
@apply bg-purple-600;
}
C
codeartisan43d ago
Sorry to take you back but it seems the create custom theme didnot work as expected
No description
H
Hussain4real43d ago
i guess because you don't have a panel just try styling the action like how you will style a button you could wrap a div around it then style that div and see
C
codeartisan43d ago
okay then
H
Hussain4real43d ago
we could get on a call if possible
C
codeartisan43d ago
Yeah its okay I set up google meets?
C
codeartisan43d ago
Meet
Real-time meetings by Google. Using your browser, share your video, desktop, and presentations with teammates and customers.
H
Hussain4real43d ago
not now in an hour, 45 minutes time
C
codeartisan43d ago
ok no worries Hey @Hussain4real are you available now
H
Hussain4real43d ago
no have a meeting in 15 minutes
C
codeartisan43d ago
okay please
H
Hussain4real43d ago
I mean i have a meeting to attend now will let you know once i'm through
C
codeartisan43d ago
okay then hey @Hussain4real
H
Hussain4real43d ago
Sorry mate, still in the meeting
C
codeartisan43d ago
ok no worries
H
Hussain4real43d ago
Will be through 15 minutes probably
C
codeartisan43d ago
ok no problem
H
Hussain4real43d ago
I'm ready if you are
C
codeartisan43d ago
am around
C
codeartisan43d ago
Meet
Real-time meetings by Google. Using your browser, share your video, desktop, and presentations with teammates and customers.
H
Hussain4real43d ago
i'm waiting to be let in i can't hear you
C
codeartisan43d ago
thank you so much
H
Hussain4real43d ago
my pleasure mate
C
codeartisan43d ago
When your free please let me know for some reason export has only cancel button
C
codeartisan43d ago
No description
C
codeartisan42d ago
@Hussain4real are you available sir
H
Hussain4real42d ago
Okay, will let you know
C
codeartisan42d ago
let me wait then helo
H
Hussain4real41d ago
Hi Had a busy day
C
codeartisan41d ago
a good morning we can do today hello @Hussain4real
H
Hussain4real41d ago
Hi If you're free
C
codeartisan41d ago
am available right now let me share google meet
C
codeartisan41d ago
Meet
Real-time meetings by Google. Using your browser, share your video, desktop, and presentations with teammates and customers.
C
codeartisan41d ago
Thank you so much it has worked
H
Hussain4real41d ago
my pleasure mate!
C
codeartisan40d ago
a good morning I just have one more issue which is to change the filter positions on the table
use Filament\Tables\Filters\Layout;

protected function getTableFiltersLayout(): ?string
{
return Layout::AboveContent;
}
use Filament\Tables\Filters\Layout;

protected function getTableFiltersLayout(): ?string
{
return Layout::AboveContent;
}
does not seem to work with livewire
H
Hussain4real40d ago
you probably need to include the trait Morning
C
codeartisan40d ago
I cannot find the trait name
H
Hussain4real40d ago
import this
use Filament\Tables\Concerns\HasFilters;

add this trait
use HasFilters;
import this
use Filament\Tables\Concerns\HasFilters;

add this trait
use HasFilters;
C
codeartisan40d ago
->filters([..], FiltersLayout::AboveContent)
->filters([..], FiltersLayout::AboveContent)
->filters([..], FiltersLayout::AboveContent)
That works ok thank you so much for the help
H
Hussain4real40d ago
my pleasure
Want results from more Discord servers?
Add your server
More Posts
Filter using columnsHello, I'm having difficulty creating a filter in a query that I inserted in the columns. How can I Hiring a senior mobile app developer from India or PakistanI have some mobile projects. I want someone have over 3 years experience. And especially I hope reacGet current row record in custom action```php Tables\Actions\Action::make('make_additional_payment') ->label('Наплати дSelect multiple preloaded options are reordered after selecting the inputI have a select multiple that is formFilled with options already attached on a BelongsToMany relatioError on trying to edit or create a new role at SHIELD pluginIm getting ```count(): Argument #1 ($value) must be of type Countable|array, null given``` this errotesting repeater / fillForm / fill default itemHi - I'm just getting started writing tests for my app with Pest. My first and most high-traffic resUse fa-icon in table builderI'm working in a project who already have a database in production. The database have a table with aIs there a difference between these two `Auth::user()` vs `Filament::auth()->user()`?Is there anytime where using one or the other is beneficial?larazeus popover pop under table header/footerHello, having a problem, when i add a popover in a table, it's showing under the tablefooter/header.Laravel Breeze and filamentHi everyone, i use filament for the admin panel that is registered on /admin, then i have an api endSetting an input value from outside the repeater?I need to set some input's values from outside the repeater using afterStateUpdated but I can not geIs it possible to add custom variables for creating contracts in the Rich Editor?I need to create a contract template where variables such as names, addresses, and personal documentFilament\Support\Services\RelationshipJoiner::prepareQueryForNoConstraints():Hi guys .. i'm on ContratoResource file wich list contracts. Each contract can have one item createdHow to record the last login (online) time of a user?The user table has created_at and updated_at fields. I want to add a logged_at field. To track whenstruggle with select field =_=i create a Select then for its option i have a model which has this relation: > `public function fiwhat merhod to use in import action: castStateUsing or filstateUsingHi everyone, i have a table with id and name and i want to modify name, while importing, based on a Weird login error after livewire updateAfter `composer update` I can't login to filament. I see the login form but the password field is aReusable sectionsHi, I was wondering how you usually create reusable parts for example e.g. infolists or forms? For efiltersForm()Im using custom livewire page with widget with table. I have defined filter form and $this->filters JS error : "Livewire assets are out of date"Hi guys, I made a few changes on my Filament app and now login isn't working anymore and I think it'