定制 labapawel/filament-planer 二次开发

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

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

labapawel/filament-planer

最新稳定版本:v1.0.1

Composer 安装命令:

composer require labapawel/filament-planer

包简介

Filament form component for weekly planning.

README 文档

README

A Filament PHP form component that creates an interactive weekly timetable, allowing users to select specific hours for each day of the week.

image.png

Features

  • Weekly Timetable UI: Responsive grid layout with hours on the left and days on top.
  • Interactive Selection:
    • Drag & drop support for selecting multiple cells.
    • Click to toggle individual hours.
    • "Select All" / "Deselect All" icon buttons for each day.
  • Visual Feedback:
    • Real-time counters: Total selected hours (global) and daily totals.
    • customizable selection colors via CSS.
  • Configurable: Customizable hours range, time steps, meaningful days labels, and "full day" selection strategies.
  • Data Storage: Saves selection as a clean JSON object (e.g., {"1":["08:00","09:00"],"2":["10:00"]}).
  • Multilingual: Built-in support for Polish, English, and German.
  • Dark Mode: Fully compatible with Filament's dark mode.
  • Read-only Support: Respects Filament's disabled() state.

Installation

You can install the package via composer:

composer require labapawel/filament-planer

The service provider will automatically register itself. You can publish the configuration file with:

php artisan vendor:publish --tag="filament-planer-config"

Usage

Add the Planer component to your Filament form schema:

use Labapawel\FilamentPlaner\Forms\Components\Planer;

public static function form(Form $form): Form
{
    return $form
        ->schema([
            Planer::make('schedule')
                ->label('Weekly Plan')
                // Optional customizations:
                ->days([1, 2, 3, 4, 5]) // Define visible days (1=Mon to 7=Sun)
                ->hours(['08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00']) // Custom hour slots
                ->fullDayConfig([
                    'enabled' => true,      // Enable "Select All" buttons
                    'default_hours' => 8,   // Max hours to select when using 'first_n' strategy
                    'strategy' => 'first_n', // Strategies: 'all_available' or 'first_n'
                ])
                ->disabled(fn ($record) => $record?->is_locked),
        ]);
}

Styling & Customization

The component uses a dedicated CSS class .sel for selected cells, allowing for easy color customization outside of the standard Filament theme.

To customize the selection color, you can modify or override the CSS variables or classes in your project's stylesheet, or edit resources/css/filament-planer.css if you have published the assets.

Default values (filament-planer.css):

/* Light mode */
.filament-planer-table .sel {
    background-color: #93c5fd; /* blue-300 */
}

/* Dark mode */
:is(.dark .filament-planer-table) .sel {
    background-color: #3b82f6; /* blue-500 */
}

Configuration

The default settings can be globally modified in config/filament-planer.php:

return [
    'hours' => [
        'start' => '08:00',
        'end' => '16:00',
        'step' => 60, // Interval in minutes
    ],
    'days' => [1, 2, 3, 4, 5], // Default: Monday to Friday
    'full_day' => [
        'enabled' => true,
        'default_hours' => 8,
        'strategy' => 'all_available',
    ],
];

License

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

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固