Coder Social home page Coder Social logo

filament-export's People

Contributors

aland20 avatar alperenersoy avatar angelgnz avatar cswni avatar devomar-2 avatar inerba avatar josefbehr avatar mliell avatar mtsunu avatar ncavare avatar nicolasbaud avatar perryfaro avatar petertoye avatar ruswan avatar shopapps avatar techdaddies-kevin avatar vdeville avatar ziming avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

filament-export's Issues

RTL Language issue

When I try to export a table with Arabic content, the result is not on RTL
image

FilamentExportHeaderAction return all data, doesn't respect getTableQuery method

the problem is the same as #21 . I have read all the issues but have not found a solution

in get Table query method i use it like this

  public function getTableQuery(): Builder 
    {
        $record = Route::current()->record;
        return PlanKegiatanPengajuanPerjalananDinas::query()
            ->where('pengajuan_perjalanan_dinas_id', $record);
    }

return data table

image

but on export the result returns all data

image
image

am I missing somthing?

thanks in advance

Format Values for Export?

I have a few columns I'd like to format from 1 / 0 to Yes / No. What's the best way to achieve this with Filament-export?

[Feature request] Allow modification of SimpleExcelWriter before download

Hello,

This package is awesome, Thanks!

It would be good to have a way to modify SimpleExcelWriter before download, maybe defining a function with a closure beforeDownloading(function (SimpleExcelWriter $writer) {...}). That would allow the developer to further personalize the download (by applying custom formats, column witdths, etc.).

Aggregate Column Data Not Visible

Does It support Laravel-Excel View method?

Tables\Columns\TextColumn::make('invoice_items_sum_total')->sum('invoiceItems','total')->label('Bill Amount'),`

belongsToThrough

It is possible to use belongsToThrough relationship to export table?

Export does not work when using Pivot table.

Normally, the data comes, but when I want to print out, this data either comes incorrectly or not at all. Before using the pivot table, such a problem did not exist. This happened when I started using a pivot table

Export table with columns containing HTML

I am facing an issue while exporting a table containing a column with html in it. The exported column contains the HTML. I was able to fix it by publishing the views and change
{{ $row[$column->getName()] }} to {!! $row[$column->getName()] !!} and it works

But I am wondering if I will face new issues with that ? Of not, why not change those statements in the views of the package ? I can make a PR for that if you agree

Method Filament\Tables\Actions\Modal\Actions\Action::icon does not exist

Hey there,

I'm sure I'm missing something blindingly obvious here but I seem to be missing a number of filament methods or templates when trying to use filament-export and cannot for the life of me figure out where I've gone wrong!

I'm using:
"php": "^8.0",
"filament/filament": "^2.0",
"filament/forms": "^2.0",
"filament/tables": "^2.0",
"alperenersoy/filament-export": "^0.2.8",

And I've been through filament-export resources folder and commented out where I could find Action::make()->icon() in use but it just seems to find another component that is missing each time such as the x-filament-support::model template and more.

What am I missing here? I'm positive it's a me problem but hoping you may be able to shine a light on this...

Thanks

Tom

extraViewData blade variables in table_view.blade.php not defined

FilamentExportBulkAction::make(__('Export'))
                ->extraViewData(function ($action) {
                    return [
                        'recordCount' => $action->getRecords()->count()
                    ];
                }),

gives error:

Undefined variable $recordCount

when using this blade variable in table_view.blade.php as defined in readme.md

{{ $recordCount }}

but it works in pdf.blade.php

Export to excel failed if there's null value

If there's null value on our data, when exporting data to xls, the excel package (simple-excel / openspout) will throw an exception that is not properly handled. So the export will stuck on loading state.

The fix / workaround is by casting the state on the line below to string.

$item[$column->getName()] = $state;

$item[$column->getName()] = (string)$state; 

HasMany relationship - export a row for each related model?

I'm building out an order export system using the Filament Admin Panel. My listing table shows orders which have a HasMany relationship to order line items like so:

    /**
     * Get the items for the order.
     */
    public function items(): HasMany
    {
        return $this->hasMany(OrderItem::class, 'order_id', 'order_id');
    }

I need to be able to export a CSV or XLSX file of the orders along with their related line items, so if an order has 5 related line items, there would be 5 rows for this order in the exported file, with the order data (name, address, email, etc.) being static and only the line item data changing between the rows.

For example, a RIGHT JOIN like this would return what I need:

SELECT * FROM order_items RIGHT JOIN orders ON order_items.order_id = orders.order_id

However, I don't understand if it's possible to decouple/override the query that the exporter is using from the Filament resource, which is using the Order model.

Is it possible to do this?

I am getting sql error while trying to export all.

I am getting this issue while trying to export all data.

Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'offset 0' at line 1

Error when click export action

Hello everyone

I have this error htmlspecialchars(): Argument #1 ($string) must be of type string, array given you can see in here

and I've been try to debug it but I can't find any clue unless one clue that maybe because my json column on my modal?

maybe someone have another clue about this error? Thanks

Uncaught ReferenceError: printTable is not defined

I am not able to print on clicking print button and getting following error in console.

Uncaught ReferenceError: printTable is not defined

I am using only filament-forms and filament-table packages.

Please help me.

Language

Hi,

how can i change the language of the labels?

Thanks

docs: README.md on filamentphp.com

First of all, thank you for your plugin. It works really well and has been exactly what I needed several times.

Now to the issue: The docs on the page https://filamentphp.com/plugins/alperenersoy-export are unfortunately relatively old compared to the README.md from Github. I therefore spent some time thinking about how to include the hidden columns, until I realised that the source code for this was already available.

Additional fields?

This appears to only export columns that are visible in the table (ie hidden columns, or columns toggled off are not available).
Is there a way to export all fields? Or an array of fields, or all except?
Perhaps I just missed something in the docs.
Great plugin though!

Multiple `headerActions`

It will be good idea to have fully custom multiple header action, i dont know if its already there, but I tried its not working

use AlperenErsoy\FilamentExport\Actions\FilamentExportHeaderAction;

->headerActions([
      FilamentExportHeaderAction::make('Export')->defaultFormat('pdf')->label('Export PDF'),
      FilamentExportHeaderAction::make('Export')->defaultFormat('xlsx')->label('Export Excel'),
      FilamentExportHeaderAction::make('Export')->defaultFormat('csv')->label('Export CSV')
  ])

Set default additional columns

Hi,

Is there a way to set default additional columns please?

Basically I want to export every column on the model, but not sure how to go about it without adding them into the Modal each time I export.

Thanks,
Danny

SQL Server bind issue - chuck request?

Using SQL Server, when selecting 3000 records (All) we get:

SQLSTATE[IMSSP]: Tried to bind parameter number 2101. SQL Server supports a maximum of 2100 parameters. (SQL: select * from

There are two solutions I can see:

  1. Don't bind select all, store 'All Selected' type query which removes the tickbox selection part of the query.
  2. Chuck the DB query, so from the select call. Chuck them in batches of 1000, this would solve other issues too where they have searched and the results comeback and you select all results.

thoughts?

withColumns TextColumn Enum not supported

When I add an extra TextColumn via the withColums method with the method enum on it crashes the export and returns an error.

 ->withColumns([
                    TextColumn::make('gender')
                    ->label(__('fields.member.fields.gender.label'))
                    ->enum(GenderEnum::casesWithLabels())
                ])

GenderEnum function

public static function casesWithLabels(): array
    {
        $labels = [];
        foreach (self::cases() as $case) {
            $labels[$case->value] = __('genders.' . $case->value);
        }

        return $labels;
    }

Error message in console

Uncaught (in promise) SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
    value index.js:75
    promise callback*value/< index.js:70
    promise callback*value index.js:68
    sendMessage index.js:242
    value index.js:252
    later debounce.js:8
    setTimeout handler*debounce/< debounce.js:12
    value index.js:225
    debouncedHandler node_initializer.js:243
    value index.js:582
    debouncedHandler node_initializer.js:201
    attachListener node_initializer.js:259
    attachDomListener node_initializer.js:181
    initialize node_initializer.js:42
    initialize node_initializer.js:15
    value index.js:92
    value index.js:525
    walk walk.js:5
    walk walk.js:10
    walk walk.js:10
    walk walk.js:10
    value index.js:511
    value index.js:90
    Component index.js:51
    value index.js:88
    value index.js:87
    <anonymous> Ember
    gt app.js:1
    start app.js:1
    888 app.js:90
    i app.js:90
    <anonymous> app.js:90
    O app.js:90
    <anonymous> app.js:90
    <anonymous> app.js:90
index.js:75:57

exporting fields

exporting fields (xls/csv/pdf) of a relationship returns null..

Am I wrong or did I miss something in the documentation?

Thanks,

error in multiple field

Hello, i have a problem when i try to export a textColumn which have multiple values:

Forms\Components\Select::make('voltaje_prim_trafo')
...
->multiple()
->options([...

Tables\Columns\TextColumn::make('voltaje_prim_trafo')
..._

the error is next:

htmlspecialchars(): Argument #1 ($string) must be of type string, array given

https://flareapp.io/share/q5Y3erwP#F85

[Feature] Support languages

Hey!

First of all thank you for this great package <3
I was woundring if you would support more languages? e.g. Arabic.

And also.. I would be happy to work on those languages files! Thanks again.

`FilamentExportHeaderAction` doesn't respect `getTableQuery` method

for example I have changed getTableQuery in my list page

protected function getTableQuery(): Builder
    {
        if (auth()->user()->isAdmin) {
            return parent::getTableQuery();
        } elseif (auth()->user()->isDoctor) {
            return parent::getTableQuery()
                ->whereIn('page_id', auth()->user()->pages()->pluck('id'));
        } else {
            return parent::getTableQuery()
                ->when(
                    auth()->user()->branch_id,
                    fn ($q) => $q->where('branch_id', auth()->user()->branch_id)
                );
        }
    }

the FilamentExportHeaderAction exports all of table records

am I missing somthing?

thanks in advance

Can not install the package.

I am getting issue while installing this.

My php and filament version is

php: "^8.0.2",
filament/filament": "^2.0"

Your requirements could not be resolved to an installable set of packages.

Problem 1
- phpoffice/phpspreadsheet[1.18.0, ..., 1.22.0] require psr/simple-cache ^1.0 -> found psr/simple-cache[1.0.0, 1.0.1] but the package is fixed to 3.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- phpoffice/phpspreadsheet[1.23.0, ..., 1.24.1] require psr/simple-cache ^1.0 || ^2.0 -> found psr/simple-cache[1.0.0, 1.0.1, 2.0.0, 2.x-dev] but the package is fixed to 3.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- maatwebsite/excel[3.1.0, ..., 3.1.25] require php ^7.0 -> your php version (8.1.7) does not satisfy that requirement.
- maatwebsite/excel[3.1.26, ..., 3.1.35] require illuminate/support 5.8.*|^6.0|^7.0|^8.0 -> found illuminate/support[v5.8.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.
- alperenersoy/filament-export v0.1.6 requires maatwebsite/excel ^3.1 -> satisfiable by maatwebsite/excel[3.1.0, ..., 3.1.x-dev].
- maatwebsite/excel[3.1.36, ..., 3.1.x-dev] require phpoffice/phpspreadsheet ^1.18 -> satisfiable by phpoffice/phpspreadsheet[1.18.0, ..., 1.24.1].
- Root composer.json requires alperenersoy/filament-export ^0.1.6 -> satisfiable by alperenersoy/filament-export[v0.1.6].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require alperenersoy/filament-export:*" to figure out if any version is installable, or "composer require alperenersoy/filament-export:^2.1" if you know which you need.

Fail to export / print

Hi, I found issue when using TextColumn with rowIndex()

The index column is working normally in filament table view. It filled ordered number from $rowLoop. When I export the table using this plugin, and click Preview button, the modal was pop up, all record is normal, but index column show blanks, while export and print button, debugger showing this error:

Filament\Tables\Columns\TextColumn::Filament\Tables\Columns\{closure}(): Argument #1 ($rowLoop) must be of type stdClass, null given, called in /Users/umar/Projects/myproject/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php on line 36.

Please help. Thanks.

Releases?

Hi,

Thanks for the great package, am wondering if you can tag a 1.0 or 0.x release on github so we can use it.

Forever white screen

Hi,

I tried both bulk export and header export but what I get is a big white box in the middle of my screen forever.

my code is as follow

->headerActions([
FilamentExportHeaderAction::make('export'),
]);

and for bulk action it is similar except it is FilamentExportBulkAction

My table has 2500 records

getTableQuery returning nothing when aggregating data

First of all, this package is fantastic, thanks for making it!

I believe this is related to #21. I've got a table which is just aggregated data.

Query

public function getTableQuery(): Builder
    {
        return Participantprogramsession::query()
            ->join('participants', 'participantprogramsessions.participant_id', 'participants.id')
            ->where('participantprogramsessions.status', '=', 0)
            ->select(DB::raw('count(participants.tshirt_size) as count, participants.tshirt_size'))
            ->groupBy('participants.tshirt_size');
    }

Data

screenshot 2

Problem

When I try to export, it returns just the headings "Size" and "Count" but no data. Is there a way to fix this?

P.S. I was able to get it working perfectly using a more "normal" eloquent query.

Required ID Column?

Hello,

In the database structure this package requires ID exists. As an example, I have set the primaryKey within the list resource to be ClientID which is defined as part of the database I am getting data from. But when exporting, it fails because column ID doesn't exist.. Is it possible to change that?

[Admin] Column data truncated when ->limit() is used

In admin panels it can consume a lot of width if full URLs etc. are shown, so I have truncated them with ->limit(), and when exporting via header actions, the truncated values are being brought into the XLSX sheet. Is there a way to bypass this for the exports?

Example code:

<?php

namespace App\Filament\Resources;

use AlperenErsoy\FilamentExport\Actions\FilamentExportBulkAction;
use App\Filament\Resources\ExampleResource\Pages;
use App\Filament\Resources\ExampleResource\RelationManagers;
use App\Models\Example;
use Filament\Forms;
use Filament\Resources\Form;
use Filament\Resources\Resource;
use Filament\Resources\Table;
use Filament\Tables;

class ExampleResource extends Resource
{
    protected static ?string $model = Example::class;
    protected static ?string $navigationIcon = 'heroicon-o-collection';
    protected static ?string $navigationGroup = 'Example';

    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Forms\Components\TextInput::make('name')->required(),
                Forms\Components\Textarea::make('description'),
                Forms\Components\Select::make('owner_id')->relationship('owner', 'name')->label('Owner')->required(),
                Forms\Components\Select::make('category_id')->relationship('category', 'name')->label('Category')->required(),
            ]);
    }

    public static function table(Table $table): Table
    {
        return $table
            ->columns([
                Tables\Columns\TextColumn::make('id')->label('ID')->sortable(),
                Tables\Columns\TextColumn::make('name')->sortable()->limit(30),
                Tables\Columns\TextColumn::make('description')->sortable()->limit(30),
                Tables\Columns\TextColumn::make('category.name')->sortable(),
                Tables\Columns\TextColumn::make('owner.email')->sortable(),
                Tables\Columns\TextColumn::make('created_at')->dateTime()->sortable(),
                Tables\Columns\TextColumn::make('updated_at')->dateTime()->sortable(),
            ])
            ->filters([
                //
            ])
            ->actions([
                Tables\Actions\ViewAction::make(),
                Tables\Actions\EditAction::make(),
            ])
            ->bulkActions([
                Tables\Actions\DeleteBulkAction::make(),
                FilamentExportBulkAction::make('export'),
            ])
            ->headerActions([
                FilamentExportHeaderAction::make('export'),
            ])
            ->defaultSort('id', 'desc');
    }

    public static function getPages(): array
    {
        return [
            'index' => Pages\ListExample::route('/'),
            'create' => Pages\CreateExample::route('/create'),
            'view' => Pages\ViewExample::route('/{record}'),
            'edit' => Pages\EditExample::route('/{record}/edit'),
        ];
    }
}

PHP 8.2 support

Hello,

I detect a problem when try to install the package using composer with php 8.2.
I think you can upgrade spatie laravel excel to work, the bundle was updates to use newest version of spout
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.