Shang✨
Shang✨
FFilament
Created by Shang✨ on 12/26/2024 in #❓┊help
How to display notification message?
Hello everyone. I am building simcard management dashboard. I have datagrid table prebuilt using filament table, and it contains "Activate simcard" button on each row, so if I click it, modal opens. the modal is built with form. But what my problem is, after clicking Submit button on modal and after closing a modal, I want to show notification message, of course, I know notification works with livewire component, and @livewire('notifications') part should be added somewhere, but as you know, Filament doesn't provide any livewire component as default, so there is no app.blade.php file as default. Regarding this problem, I created a new app.blade.php file manually in to resource/views/components/layouts folder, and I added 'layout' => 'components.layouts.app' to config/filament.php, but notification not showing after submitting on modal. I don't want to create new livewire components for adding form on modal.
// This is SimcardResource class
...
public static function table(Table $table): Table
{
...
->actions([
Action::make('simcardActivate')
->label('Aktiver simkort')
->visible(fn (Simcard $record): bool => empty($record->Phone))
->form([
...
])
->action(function (array $data, Simcard $record): void {
$baserowApi = new BaserowApi();
$response = $baserowApi->updateRecord();

if ($response->successful()) {
Notification::make()
->title('Success!')
->body('Your action 1 was successful.')
->success()
->send();
}
})
])
}
// This is SimcardResource class
...
public static function table(Table $table): Table
{
...
->actions([
Action::make('simcardActivate')
->label('Aktiver simkort')
->visible(fn (Simcard $record): bool => empty($record->Phone))
->form([
...
])
->action(function (array $data, Simcard $record): void {
$baserowApi = new BaserowApi();
$response = $baserowApi->updateRecord();

if ($response->successful()) {
Notification::make()
->title('Success!')
->body('Your action 1 was successful.')
->success()
->send();
}
})
])
}
I am not sure how to display notification without creating livewire component on modal.
7 replies
FFilament
Created by Shang✨ on 12/26/2024 in #❓┊help
How to solve long string(numeric) issue in datagrid?
- What I am trying to do: I am trying to build simcard management dashboard. - What I did: so for this, I created table grid and displayed simcard data such as card number, phone number etc from external api. - My issue: For example, simcard number format is 9999999999999999999, but it's showing like 1.0E+20 I verified simcard number was loaded correctly from external api, but showing wrong on table grid, so I tried to use formatStateUsing function, but still showing wrong. I can't solve this problem. - Code:
return $table
->columns([
// simoverview record id
TextColumn::make('id')
->toggleable(isToggledHiddenByDefault: true),

// client id
TextColumn::make('portalClient')
->label('Client Id')
->toggleable(isToggledHiddenByDefault: true),

// package
TextColumn::make('PackageName')
->label('Pakke')
->alignLeft(),

// imei
TextColumn::make('IMEI')
->label('Simkort')
->copyable()
->copyMessage('Simkort copied')
->copyMessageDuration(1500)
->formatStateUsing(fn ($state) => (string) $state)
->weight('medium')
->alignLeft(),
]);
return $table
->columns([
// simoverview record id
TextColumn::make('id')
->toggleable(isToggledHiddenByDefault: true),

// client id
TextColumn::make('portalClient')
->label('Client Id')
->toggleable(isToggledHiddenByDefault: true),

// package
TextColumn::make('PackageName')
->label('Pakke')
->alignLeft(),

// imei
TextColumn::make('IMEI')
->label('Simkort')
->copyable()
->copyMessage('Simkort copied')
->copyMessageDuration(1500)
->formatStateUsing(fn ($state) => (string) $state)
->weight('medium')
->alignLeft(),
]);
100 replies
FFilament
Created by Shang✨ on 12/26/2024 in #❓┊help
I have a string length issue in datagrid.
No description
2 replies