Anish
Anish
FFilament
Created by Anish on 3/29/2025 in #❓┊help
Export - failed rows
Ok. Will try that.
7 replies
FFilament
Created by Anish on 3/29/2025 in #❓┊help
Export - failed rows
Here it is :
public static function getCompletedNotificationBody(Export $export): string
{
$body = 'Your application export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';

if ($failedRowsCount = $export->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
}

return $body;
}
public static function getCompletedNotificationBody(Export $export): string
{
$body = 'Your application export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';

if ($failedRowsCount = $export->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
}

return $body;
}
7 replies
FFilament
Created by Jap on 5/20/2024 in #❓┊help
Modify Export Action download URL link
Of course, what I am doing is not part of the set up. Basically my problem starts because I HAVE TO INSTALL laravel (and as a result filament) in a sub-directory. All the laravel routes, as well as the filament routes, I can modify by adding prefix (the name of the sub-directory). For filament panels, (I have 3 panels, I can do like
->path( 'prefix/admin' )
->path( 'prefix/admin' )
for admin panel, similarly for others) and for laravel routes in web.php (
->prefix( 'prefix')
->prefix( 'prefix')
by grouping). The only thing which does not work is the exports (I don't have to use imports, so can't comment on that). Therefore, I have to resort to some way for adding the prefix for downloading). If I add these routes, it works (both export as well download). If I don't add, export happens but download fails. It is just that the web server is looking at a path which does not exist without the (sub-directory) prefix. At this moment my concern is that I need to attach some middleware so that unauthorized access is prevented. If I can find which middleware has this alias 'filament.actions', then I can directly attach it to the route, without going through the filament alias to have it working.
26 replies
FFilament
Created by Jap on 5/20/2024 in #❓┊help
Modify Export Action download URL link
This is the situation: I have added the routes in routes directory, in a file called web_filament.php. Then export and download works. The only downside at this moment is that the middlewares are commented out. If I don't comment out the middlewares, it doesn't work. Complains about middleware not being found. But I have not edited any vendor file, what I am trying is to overwrite the download route by adding them in a file that I have control. If I don't add the file, the export works. I can manually see the directory that the file has been created. There is database table, which also has the entry of the export. But the download is missing the subdirectory prefix, and hence the download fails. I guess exports are not tied to any panel. In the panel you can add the prefix. If it is possible to add a prefix, then the hack is not required.
26 replies
FFilament
Created by Jap on 5/20/2024 in #❓┊help
Modify Export Action download URL link
Don't know about different auth guard. It seems to work - Exporting as well as downloading. It is inside the admin panel, so I want to protect it from unauthorised access.
26 replies
FFilament
Created by Jap on 5/20/2024 in #❓┊help
Modify Export Action download URL link
OK, some progress: Created a new routes file: web_filament.php and included it from web.php by
require __DIR__.'/web_filament.php';
require __DIR__.'/web_filament.php';
web_filament.php
Route::get('/filament/exports/{export}/download', DownloadExport::class)
->name('filament.exports.download')
//->middleware('filament.actions')
;


Route::get('/filament/imports/{import}/failed-rows/download', DownloadImportFailureCsv::class)
->name('filament.imports.failed-rows.download')
//->middleware('filament.actions')
;
Route::get('/filament/exports/{export}/download', DownloadExport::class)
->name('filament.exports.download')
//->middleware('filament.actions')
;


Route::get('/filament/imports/{import}/failed-rows/download', DownloadImportFailureCsv::class)
->name('filament.imports.failed-rows.download')
//->middleware('filament.actions')
;
This seems to get the export download urls to the correct path with the prefix of the sub-directory. Can anyone point to me where these middlewares exist in the code base? When I try to include them, it gives me an error.
26 replies
FFilament
Created by Jap on 5/20/2024 in #❓┊help
Modify Export Action download URL link
Has anyone found a solution yet?
26 replies
FFilament
Created by devpoolxx on 4/19/2024 in #❓┊help
How to close action confirmation modal after form validate fails?
Glad it worked
9 replies
FFilament
Created by devpoolxx on 4/19/2024 in #❓┊help
How to close action confirmation modal after form validate fails?
I found a way to close the modal window - after the confirmation button is clicked. Here is my action
public function myAction(): Action
{
return Action::make('my-action')
->label($this->actionButtonLabel)
->size(ActionSize::Large)
->icon($this->actionIcon)

->extraAttributes([
'title' => $this->actionButtonLabel,
])
->requiresConfirmation()
->modalIcon($this->actionIcon)
->modalHeading($this->actionButtonLabel)
->modalDescription($this->confirmationText)
->modalSubmitActionLabel($this->confirmationSubmitButton)
->action(function () {
$this->closeActionModal();
$this->action();
});
}
public function myAction(): Action
{
return Action::make('my-action')
->label($this->actionButtonLabel)
->size(ActionSize::Large)
->icon($this->actionIcon)

->extraAttributes([
'title' => $this->actionButtonLabel,
])
->requiresConfirmation()
->modalIcon($this->actionIcon)
->modalHeading($this->actionButtonLabel)
->modalDescription($this->confirmationText)
->modalSubmitActionLabel($this->confirmationSubmitButton)
->action(function () {
$this->closeActionModal();
$this->action();
});
}
This seems to work for me, if it passes validation, goes through the action. If it fails validation, the modal window is closed and shows validation window. Probably, naming could have been better! I guess that I should call it confirmedAction or something similar. I can put it in a trait and use it any place.
9 replies
FFilament
Created by Hemith on 10/25/2023 in #❓┊help
Opening a confirmation modal after validation.
Any updates on this?
7 replies
FFilament
Created by devpoolxx on 4/19/2024 in #❓┊help
How to close action confirmation modal after form validate fails?
Did you find a solution to this?
9 replies
FFilament
Created by Mis Tsu on 10/15/2023 in #❓┊help
Table in tab
OK! Got it
<div x-data="{ activeTab: 'tab1' }">

<x-filament::tabs x-data="{ activeTab: 'tab1' }">


<x-filament::tabs.item
alpine-active="activeTab === 'tab1'"
x-on:click="activeTab = 'tab1'"
>
Tab 1 Title
</x-filament::tabs.item>


<x-filament::tabs.item
alpine-active="activeTab === 'tab2'"
x-on:click="activeTab = 'tab2'"
>
Tab 2
</x-filament::tabs.item>


</x-filament::tabs>

<div>
<div x-show="activeTab === 'tab1'>Tab 1 Content</div>
<div x-show="activeTab === 'tab2'>Tab 2 Content</div>
</div>
</div>
</div>
<div x-data="{ activeTab: 'tab1' }">

<x-filament::tabs x-data="{ activeTab: 'tab1' }">


<x-filament::tabs.item
alpine-active="activeTab === 'tab1'"
x-on:click="activeTab = 'tab1'"
>
Tab 1 Title
</x-filament::tabs.item>


<x-filament::tabs.item
alpine-active="activeTab === 'tab2'"
x-on:click="activeTab = 'tab2'"
>
Tab 2
</x-filament::tabs.item>


</x-filament::tabs>

<div>
<div x-show="activeTab === 'tab1'>Tab 1 Content</div>
<div x-show="activeTab === 'tab2'>Tab 2 Content</div>
</div>
</div>
</div>
9 replies
FFilament
Created by Mis Tsu on 10/15/2023 in #❓┊help
Table in tab
Could you please give an example of where to include the tab contents for Livewire components. I am just trying out :
<x-filament::tabs x-data="{ activeTab: 'tab1' }">


<x-filament::tabs.item
alpine-active="activeTab === 'tab1'"
x-on:click="activeTab = 'tab1'"
>
Tab 1 Title
</x-filament::tabs.item>


<x-filament::tabs.item
alpine-active="activeTab === 'tab2'"
x-on:click="activeTab = 'tab2'"
>
Tab 2
</x-filament::tabs.item>


</x-filament::tabs>
<x-filament::tabs x-data="{ activeTab: 'tab1' }">


<x-filament::tabs.item
alpine-active="activeTab === 'tab1'"
x-on:click="activeTab = 'tab1'"
>
Tab 1 Title
</x-filament::tabs.item>


<x-filament::tabs.item
alpine-active="activeTab === 'tab2'"
x-on:click="activeTab = 'tab2'"
>
Tab 2
</x-filament::tabs.item>


</x-filament::tabs>
Thanks in advance.
9 replies
FFilament
Created by Anish on 3/5/2024 in #❓┊help
DateConstraint : Nullable Issue
Solved it by using custom operator.
DateConstraint::make('application_submitted_at')
->pushOperators([
Operator::make('submiited')
->label(fn (bool $isInverse): string => $isInverse ? 'Is NULL' : 'Is Not NULL')
->summary(fn (bool $isInverse): string => 'Application submitted at ' . ($isInverse ? ' is NULL' : 'is Not NULL') )

->baseQuery(
fn (Builder $query, bool $isInverse) =>
$query->{$isInverse ? 'whereNull' : 'whereNotNull'}('application_submitted_at')
)

])
DateConstraint::make('application_submitted_at')
->pushOperators([
Operator::make('submiited')
->label(fn (bool $isInverse): string => $isInverse ? 'Is NULL' : 'Is Not NULL')
->summary(fn (bool $isInverse): string => 'Application submitted at ' . ($isInverse ? ' is NULL' : 'is Not NULL') )

->baseQuery(
fn (Builder $query, bool $isInverse) =>
$query->{$isInverse ? 'whereNull' : 'whereNotNull'}('application_submitted_at')
)

])
3 replies
FFilament
Created by Anish on 3/4/2024 in #❓┊help
DateConstraint
Thanks. But that's not using the DateConstraint. This is creating each filter separately. Then we can only use the "and" operations. I find the query builder is much more flexible. Of course, if I am unable to find a solution I will probably go back to a similar solution.
5 replies
FFilament
Created by Anish on 2/19/2024 in #❓┊help
Delete exported file
After checking the documentation, I found that there is a model
Filament\Actions\Exports\Models\Export;
Filament\Actions\Exports\Models\Export;
which holds the information about the export. One can define a hasMany relation on the User model to get the exports done by the User. What I now need if there is any event that is dispatched when one clears the notifications. Then I can write a listener which will delete the file and also the corresponding database entry. I think this may be a Laravel Event, so I need to dig up the details on clearing database notifications.
9 replies
FFilament
Created by Anish on 2/19/2024 in #❓┊help
Delete exported file
Exported to csv, downloaded it and cleared from the notification. Now I have no way to access the file from the interface and I don't need it anymore. I would like the file to be removed.
9 replies
FFilament
Created by Anish on 2/5/2024 in #❓┊help
CSS & JS
I tried it out. I uploaded the global css files to S3 and then loaded via AppServiceProvider, as mentioned in the documentation. But it is loading both css, local as well as from s3. I now need to find a solution to stop it from loading it from the local server. Any suggestions?
7 replies
FFilament
Created by lazywaterpark on 10/17/2023 in #❓┊help
How can I render a PDF using a Livewire component that implements HasInfolists?
I have tested it out, with proper css. It works quite well.
6 replies