定制 arielmejiadev/filament-printable 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

arielmejiadev/filament-printable

最新稳定版本:3.0.0

Composer 安装命令:

composer require arielmejiadev/filament-printable

包简介

Package to get your Filament Resources Printable

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package adds a quick and simple way to print and print-as-pdf your Filament resource tables or forms, pretty handy to add basic reports (a lot of times it would be enough), it works with a any kind of sort, search, filter or paginated or all data.

Installation

You can install the package via composer:

composer require arielmejiadev/filament-printable

Stubs

You can publish (not necessary) and run the stubs:

php artisan filament-printable:install

Or

php artisan vendor:publish --tag="filament-printable-stubs"

Usage

// Add print button in a filament list header

class ListUsers extends ListRecords
{
    protected function getHeaderActions(): array
    {
        return [
            // ...
            PrintAction::make(),
        ];
    }
}


// Add print button in Filament CreateRecord or EditRecord class

class EditUser extends EditRecord
{
    protected function getHeaderActions(): array
    {
        return [
            // ...
            \ArielMejiaDev\FilamentPrintable\Actions\PrintAction::make(),
        ];
    }
} 


// Add print button as a bulk action

->bulkActions([
    Tables\Actions\BulkActionGroup::make([
        Tables\Actions\DeleteBulkAction::make(),
        \ArielMejiaDev\FilamentPrintable\Actions\PrintBulkAction::make(),
    ]),
]);

Print Filament Tables

By default, filament-printable set print styles to make tables look good no matter if table has been:

  • Sorted
  • Show Search Results
  • Show Filter Results
  • Show Paginated Results
  • Show all results

The styles are easily to customize in public/css/filament-printable/filament-printable-styles.css

Print Filament Forms

By default, Filament adds some flexible grids to form elements, if you want to set explicitly specific distribution for elements to print documents.

You can use Filament Grid and Section elements to distribute elements inside a form:

    public static function form(Form $form): Form
    {
        return $form
            ->schema([

                Forms\Components\Grid::make()->schema([
                    Forms\Components\TextInput::make('name'),
                    Forms\Components\TextInput::make('email'),
                ])->columns([
                        'xs' => 1,
                        'sm' => 2,
                    ]),

                Forms\Components\Section::make([
                    Forms\Components\TextInput::make('name'),
                    Forms\Components\TextInput::make('email'),
                    Forms\Components\TextInput::make('second_email'),
                ])->columns([
                        'xs' => 1,
                        'sm' => 3,
                    ]),
            ]);
    }

Important

For Letter and Legal paper sizes the Filament columns sm size distribution would be the one used.

Customization

Filament Printable includes a css file that you can publish:

php artisan vendor:publish --tag="filament-printable-styles"

Some css styles to print your resources that most of the time looks awesome, but you can customize your print css to match your requirements, in resources/css/filament-printable.css

Here an example to remove some section styles to print:

.fi-section {
    background-color: transparent !important;
    box-shadow: none !important;
}

To show the changes in your css file you can run:

composer update ArielMejiaDev/filament-printable

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 5.06k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 17
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 17
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-07