### Install and Run Project with npm Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/README.md This snippet outlines the essential npm commands for setting up the project, installing dependencies, starting the development server, building for production, and previewing the build. It assumes Node.js and npm are already installed. ```bash # Check your current versions node -v # Should be ^v22 npm -v # Should be 10.9.2+ # Install NVM (if not already installed) curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash source ~/.bashrc # or source ~/.zshrc for Zsh users # Set the correct Node version nvm install v22.16.0 nvm use v22.16.0 # Clone the repository git clone git@github.com:Asmit Nepali/advanced-kanban-docs.git cd advanced-kanban-docs git checkout main git pull origin main # Install dependencies npm install # Start development server npm run docs:dev # 🌐 Visit http://localhost:5173/ # Build for production npm run docs:build # Preview production build npm run docs:preview ``` -------------------------------- ### Kanban Board with Basic Columns (PHP) Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md An example demonstrating the complete setup of a Kanban board with basic column definitions. It includes setting the model, status field, and the array of columns, illustrating a common starting point for Kanban implementation. ```php model(Task::class) ->statusField('status') ->columns([ KanbanColumn::make('todo') ->label('To Do') ->color('gray'), KanbanColumn::make('in_progress') ->label('In Progress') ->color('blue'), KanbanColumn::make('completed') ->label('Completed') ->color('green'), ]); } ``` -------------------------------- ### Project Scripts Overview Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/README.md This table lists the available npm scripts for managing the VitePress documentation project. It includes commands for starting a development server with hot reloading, building the static site for production, and previewing the production build locally. ```bash | Command | Description | |---------|-------------| | `npm run docs:dev` | Start development server with hot reload | | `npm run docs:build` | Build static site for production | | `npm run docs:preview` | Preview the production build locally | ``` -------------------------------- ### Create Filament Kanban Page Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs/filament/advanced-kanban/quick-start.md This command generates a new Filament page file that will be used to display the kanban board. Ensure you have the Filament package installed before running this command. ```bash php artisan make:filament-page TasksKanban ``` -------------------------------- ### Composer Authentication Example Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Provides an example of composer authentication credentials, illustrating how to format the password with an optional license key fingerprint for private repository access. ```text Username: john@example.com Password: 8c21df8f-6273-4932-b4ba-8bcc723ef500:example.com ``` -------------------------------- ### Add Composer Private Repository Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs/filament/advanced-kanban/installation.md Configure your project's composer.json to include the private repository for the Advanced Kanban package. This allows Composer to locate and download the package. ```json { "repositories": [ { "type": "composer", "url": "https://filament-advanced-kanban.composer.sh" } ] } ``` -------------------------------- ### Register Kanban Builder Plugin in Filament Panel Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs/filament/advanced-kanban/installation.md Register the KanbanBuilder plugin within your Filament panel configuration. This makes the kanban functionality available in your Filament application. ```php plugins([ KanbanBuilder::make() // Other plugins if any ]); } ``` -------------------------------- ### Install Advanced Kanban Package (Bash) Source: https://context7.com/filament-plugins/advanced-kanban-docs/llms.txt Command-line instruction to install the Advanced Kanban Composer package. Requires a username and password for authentication, which should include your domain. ```bash composer require asmit/advanced-kanban # Username: your-email@example.com # Password: 8c21df8f-6273-4932-b4ba-8bcc723ef500:your-domain.com ``` -------------------------------- ### Install Advanced Kanban Plugin Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs/filament/advanced-kanban/help.md Command to install the Advanced Kanban plugin using Composer. Ensure you have a valid license and correct package name. ```bash composer require asmit/advanced-kanban ``` -------------------------------- ### Create and Add New Markdown Page Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/README.md This snippet shows how to create a new Markdown file within the `docs` directory and add content to it. It also demonstrates how to link this new page in the VitePress sidebar configuration by editing `.vitepress/config.mjs`. ```bash # Navigate to the docs folder cd ./docs # Create a new markdown file touch example.md ``` ```markdown # Your Page Title Your content goes here. Use standard Markdown syntax. ## Features - Feature 1 - Feature 2 - Feature 3 ## Code Example ```javascript const example = "Hello World"; console.log(example); ``` ``` ```javascript export default { // ... other config themeConfig: { sidebar: [ { text: 'Getting Started', items: [ { text: '💰 Pricing & Licensing', link: '/pricing-licensing' }, { text: '📦 Installation', link: '/installation' }, { text: '📝 New Example', link: '/example' } // <- Your new page ] } ] } } ``` -------------------------------- ### Basic Kanban Column Setup (PHP) Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Defines the fundamental properties of a Kanban column, including a unique key, a user-friendly label, and an optional color for visual distinction. This sets up the basic structure for workflow stages. ```php use Asmit\AdvancedKanban\Columns\KanbanColumn; ->columns([ KanbanColumn::make('todo') ->label('To Do') ->color('gray'), KanbanColumn::make('in_progress') ->label('In Progress') ->color('blue'), KanbanColumn::make('completed') ->label('Completed') ->color('green'), ]) ``` -------------------------------- ### Organize Pages in VitePress Sidebar Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/README.md This snippet illustrates how to structure the `docs` directory for organized routing and how to group pages into sections within the sidebar navigation by configuring the `themeConfig.sidebar` in `.vitepress/config.mjs`. ```javascript sidebar: [ { text: 'Getting Started', items: [ { text: '💰 Pricing & Licensing', link: '/pricing-licensing' }, { text: '📦 Installation', link: '/installation' } ] }, { text: 'Examples', items: [ { text: '📄 Basic Usage', link: '/examples/basic' }, { text: '📝 Advanced Features', link: '/examples/advanced' }, { text: '🔧 Custom Configuration', link: '/examples/config' } ] }, { text: 'API Reference', items: [ { text: '📚 Methods', link: '/api/methods' }, { text: '🎯 Events', link: '/api/events' } ] } ] ``` -------------------------------- ### Advanced Kanban Board Configuration with Common Options (PHP) Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Configures a Kanban board with common options including model, status, title, description, searchable fields, pagination limit, column headers, and record actions. This snippet provides a comprehensive setup for a functional Kanban board. ```php public function kanban(Kanban $kanban): Kanban { return $kanban ->model(Task::class) ->statusField('status') ->titleField('title') // Field to display as card title ->descriptionField('description') // Field to display as card description ->searchableFields(['title', 'description']) // Fields to search ->recordsPerColumn(10) // Pagination limit ->columns([ // Your columns here ]) ->columnHeaderActions([ // Actions here ]) ->recordActions([ // Actions here ]); } ``` -------------------------------- ### Kanban Class Methods Reference Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md A comprehensive reference of the available methods on the Kanban class for configuring the Kanban board, including setting models, fields, columns, and query modifications. ```APIDOC ## Kanban Class Methods ### Description Provides a detailed overview of the configurable methods available on the Kanban class for customizing its behavior and appearance. ### Methods - **`model(string|Model $model)`**: Set the Eloquent model for the kanban board. - **`statusField(string $field)`**: Set the status field name that determines column placement. - **`titleField(string $field)`**: Set the title field name to display on cards. - **`descriptionField(string $field)`**: Set the description field name to display on cards. - **`columns(array|Closure $columns)`**: Set the kanban columns configuration. - **`searchableFields(bool|Closure $fields)`**: Set fields that can be searched. - **`enableLoadingIndicator(Closure|bool $condition = true)`**: Enable or disable loading indicator. - **`filterFormSchema(array|Closure $schema)`**: Set the filter form schema. - **`recordActions(array|Closure $actions)`**: Set actions available on individual records. - **`columnHeaderActions(array|Closure $actions)`**: Set actions available in column headers. - **`recordsPerColumn(int $count)`**: Set maximum number of records per column. - **`modifyQueryUsing(Closure $callback)`**: Modify the base query for fetching records. - **`modifyRecordQueryUsing(Closure $callback)`**: Modify query for specific column records. - **`applyFiltersUsing(Closure $callback)`**: Set custom filter application logic. - **`applySearchUsing(Closure $callback)`**: Set custom search application logic. - **`emptyStateMessage(string $title, string $description)`**: Set custom empty state message. ### Parameters (See descriptions above for parameter types and purposes.) ### Request Example (Example usage would involve calling these methods on a Kanban instance, e.g., `Kanban::make()->model('App\Models\MyModel');`) ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Basic Kanban Board Configuration in PHP Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs/filament/advanced-kanban/kanban/overview.md Defines the fundamental setup for a Kanban board, specifying the model, status field, and defining the initial set of columns with their labels. ```php public function kanban(Kanban $kanban): return $kanban ->model(YourModel::class) // The model to display ->statusField('status') // The status field name ->columns([ KanbanColumn::make('todo')->label('To Do'), KanbanColumn::make('in_progress')->label('In Progress'), KanbanColumn::make('completed')->label('Completed'), ]); ``` -------------------------------- ### Composer Authentication Credentials Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Demonstrates the composer authentication prompt for private repositories. It shows the expected username and password format, including the optional license key fingerprint. ```text Loading composer repositories with package information Authentication required (filament-advanced-kanban.composer.sh): Username: [your-email-address] Password: [your-license-key] ``` -------------------------------- ### Render Hooks Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Advanced Kanban provides render hooks to inject custom content into specific areas of the Kanban page, such as before the search bar or at the page footer. ```APIDOC ## Render Hooks ### Description Allows insertion of custom content into predefined locations within the Kanban page. ### Available Hooks - `KanbanRenderHook::KANBAN_SEARCH_BEFORE` - Add content before the search bar. - `KanbanRenderHook::KANBAN_PAGE_FOOTER` - Add content at the bottom of the page. ### Parameters None ### Request Example (Usage would typically be within a Filament Page or Component) ### Response N/A ``` -------------------------------- ### Basic Kanban Board Configuration (PHP) Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Sets up a basic Kanban board by specifying the model, the field used for status, and defining the initial columns for the board. This is the fundamental structure for any Kanban board. ```php public function kanban(Kanban $kanban): Kanban { return $kanban ->model(YourModel::class) // The model to display ->statusField('status') // The status field name ->columns([ KanbanColumn::make('todo')->label('To Do'), KanbanColumn::make('in_progress')->label('In Progress'), KanbanColumn::make('completed')->label('Completed'), ]); } ``` -------------------------------- ### Set Up Basic Search Fields for Kanban (PHP) Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Enables searching within the Kanban board by specifying which fields of the model should be indexed for search. This is configured using the searchableFields method. ```php public function kanban(Kanban $kanban): Kanban { return $kanban ->model(Task::class) ->statusField('status') ->searchableFields(['title', 'description', 'assignedTo.name']) ->columns([ // Your columns here ]); } ``` -------------------------------- ### Kanban Column Icon Support (PHP) Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Demonstrates how to add icons to Kanban columns for enhanced visual representation. It includes options for specifying the icon, its color, and its size, utilizing Heroicon components. ```php KanbanColumn::make('todo') ->label('To Do') ->icon(Heroicon::OutlinedRectangleStack) ->iconColor(Color::Red[500]) ->iconSize(IconSize::Medium); // Use any Heroicon name ``` -------------------------------- ### Adding Actions to Components Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Learn how to add custom actions to Kanban cards or other components. This involves defining actions on the Kanban class and evaluating them in the Blade view. ```APIDOC ## Adding Actions to Components ### Description Enables the addition of custom actions that can be rendered within Kanban card components or other parts of the UI. ### Method Define an action method on your Kanban page class (e.g., `addDocsAction`). Evaluate the action in your Blade view using `$this->evaluateAction()`. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```php // On the Kanban class use Filament\Actions\Action; use Filament\Forms\Components\TextInput; public function addDocsAction(): Action { return Action::make('docs') ->schema(function (array $arguments): array { return [ TextInput::make('title')->default($arguments['recordId']), ]; }); } // In the Blade view {{ $this->evaluateAction($this->addDocsAction(), ['recordId' => $record->getKey()]) }} ``` ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Enable Loading Indicator for Kanban Actions (PHP) Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Adds a visual loading indicator to the Kanban board, providing user feedback during data loading or transitions. This is a simple boolean toggle method. ```php ->enableLoadingIndicator() ``` -------------------------------- ### PHP: Basic Search Setup in Advanced Kanban Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs/filament/advanced-kanban/kanban/search.md Enables basic search functionality in Advanced Kanban by specifying fields to search. It supports searching through related models using dot notation. ```php public function kanban(Kanban $kanban): Kanban { return $kanban ->model(Task::class) ->statusField('status') ->searchableFields(['title', 'description', 'assignedTo.name']) // ← Add searchable fields here ->columns([ // Your columns here ]); } ``` -------------------------------- ### Configure Kanban Page with Model and Status Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs/filament/advanced-kanban/quick-start.md This PHP code snippet demonstrates how to configure a Filament page to use the Advanced Kanban package. It requires extending the `KanbanPage` class and defining the `kanban` method to specify the Eloquent model, the status field, and the desired kanban columns. The `searchableFields` and `recordsPerColumn` methods offer further customization. ```php model(Task::class) // ← Pass your model ->statusField('status') // ← Pass the status field ->columns([ KanbanColumn::make('todo') // ← Pass required column ->label('To Do'), KanbanColumn::make('in_progress') ->label('In Progress'), KanbanColumn::make('completed') ->label('Completed'), ]) ->searchableFields(['title', 'description']) ->recordsPerColumn(10); } } ``` -------------------------------- ### Using Hooks for Record Moves Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Utilize `beforeRecordMove` and `afterRecordMove` hooks to execute custom logic before and after a record is moved between columns. These hooks allow for validation, notifications, and logging. ```APIDOC ## Record Move Hooks ### Description Hooks that can be implemented to perform actions before or after a record is moved between Kanban columns. ### Method `beforeRecordMove(string $newStatus, Model $record): void` - Executed before the record is moved. `afterRecordMove(mixed $oldStatus, string $newStatus, Model $record): void` - Executed after the record has been successfully moved. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```php // Before Record Move Hook public function beforeRecordMove(string $newStatus, Model $record): void { // Perform actions before the record is moved if ($newStatus === 'completed') { // Validate that the task can be completed if (!$record->all_subtasks_completed) { throw new \Exception('Cannot complete task: all subtasks must be finished'); } } // Log the move attempt \Log::info("Attempting to move task {$record->id} to {$newStatus}"); } // After Record Move Hook public function afterRecordMove(mixed $oldStatus, string $newStatus, Model $record): void { // Perform actions after the record is moved if ($newStatus === 'completed') { // Send notification $record->assignee->notify(new TaskCompletedNotification($record)); // Update completion timestamp $record->update(['completed_at' => now()]); } // Log the successful move \Log::info("Task {$record->id} moved from {$oldStatus} to {$newStatus}"); } ``` ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Advanced MRR Kanban Configuration Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs/filament/advanced-kanban/relational-records/mrr-kanban-setup.md This PHP code shows an advanced configuration for an MRR Kanban board in Filament. It extends the basic setup by adding custom labels, colors, and icons to the Kanban columns, along with adjusting the records per column. ```php model(Task::class) ->statusField('status') ->titleField('title') ->descriptionField('description') ->columns([ KanbanColumn::make('todo') ->label('To Do') ->color('gray') ->icon('heroicon-o-clock'), KanbanColumn::make('in-progress') ->label('In Progress') ->color('blue') ->icon('heroicon-o-play'), KanbanColumn::make('review') ->label('Review') ->color('yellow') ->icon('heroicon-o-eye'), KanbanColumn::make('done') ->label('Done') ->color('green') ->icon('heroicon-o-check-circle'), ]) ->searchableFields(['title', 'description']) ->recordsPerColumn(15); } } ``` -------------------------------- ### Set Up Basic Kanban Filters with Schema (PHP) Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Defines a form schema for user-selectable filters and applies custom filtering logic to the Kanban board based on selected filter values. This uses filterFormSchema for the UI and applyFiltersUsing for the backend logic. ```php model(Task::class) ->statusField('status') ->searchableFields(['title', 'description']) ->filterFormSchema([ Select::make('priority') ->options([ 'low' => 'Low', 'medium' => 'Medium', 'high' => 'High', ]) ->placeholder('All Priorities'), Select::make('assigned_to') ->options(User::pluck('name', 'id')) ->placeholder('All Users'), ]) ->applyFiltersUsing(function(Builder $query, array $data) { if (!empty($data['priority'])) { $query->where('priority', $data['priority']); } if (!empty($data['assigned_to'])) { $query->where('assigned_to', $data['assigned_to']); } return $query; }) ->columns([ // Your columns here ]); } ``` -------------------------------- ### Setting Title and Description Fields for Kanban Cards (PHP) Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Defines the fields from your model that will be used to populate the title and description areas of individual Kanban cards. This helps in quickly identifying card content. ```php ->titleField('title') // default title field ->titleField('name') ->titleField('subject') ``` ```php ->descriptionField('description') // default description field ->descriptionField('content') ->descriptionField('notes') ``` -------------------------------- ### Kanban Column Configuration in PHP Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs/filament/advanced-kanban/kanban/overview.md Details the setup for a single Kanban column, including its identifier, label, color, icon, description, allowed transitions, card locking mechanism, and custom CSS classes for the header. ```php KanbanColumn::make('todo') ->label('To Do') ->color('gray') ->icon('heroicon-o-clock') ->description('Tasks that need to be started') ->allowedTransitions(['in_progress']) // Control allowed moves ->lockCardUsing(fn($record) => false) // Lock specific cards ->extraColumnHeadingClass('font-bold'); // Custom CSS classes ``` -------------------------------- ### Dynamic Transitions Based on Permissions (PHP) Source: https://context7.com/filament-plugins/advanced-kanban-docs/llms.txt PHP example for defining dynamic allowed transitions for a Kanban column based on user permissions. This allows for more granular control over workflow movement, such as skipping review steps. ```php KanbanColumn::make('todo') ->allowedTransitions(fn() => [ 'in_progress', auth()->user()->can('skip-review') ? 'completed' : null ]) ``` -------------------------------- ### Implement HasKanban Interface for MRR Kanban Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs/filament/advanced-kanban/relational-records/mrr-kanban-setup.md This PHP code demonstrates how to implement the `HasKanban` interface and use the `HasKanbanRelatedRecords` trait to create a Kanban board within a Filament MRR page. It includes essential configurations like setting the resource, relationship, model, and status field. ```php model(Task::class) // ← Pass your model ->statusField('status') // ← Pass the status field ->titleField('title') ->descriptionField('description') ->columns([ KanbanColumn::make('To Do'), // ← Pass required column KanbanColumn::make('In Progress'), ]) ->searchableFields(['title', 'description']) ->recordsPerColumn(10); } } ``` -------------------------------- ### Query Modifications Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Modify the underlying database queries for fetching Kanban records. This includes modifying the base query for all records and the query for records within a specific column. ```APIDOC ## Query Modifications ### Description Allows for customization of the database queries used to fetch Kanban records, both globally and on a per-column basis. ### Method `modifyQueryUsing(Closure $callback)` - Modifies the base query for fetching all records. `modifyRecordQueryUsing(Closure $callback)` - Modifies the query for fetching records within a specific column. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```php // Base Query Modification use Asmit\AdvancedKanban\Kanban; Kanban::make() ->modifyQueryUsing(function ($query) { return $query->where('is_active', true); }); // Record Query Modification use Asmit\AdvancedKanban\Columns\KanbanColumn; KanbanColumn::make() ->modifyRecordQueryUsing(function ($query) { return $query->where('status', 'to_do')->orderBy('created_at', 'asc'); }); ``` ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Implement Advanced Kanban Filters with DatePicker and Toggle Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs/filament/advanced-kanban/kanban/filters/overview.md This example demonstrates advanced filtering for an Advanced Kanban board, incorporating a DatePicker for due dates and a Toggle for urgent tasks. The `filterFormSchema` defines these input types, while `applyFiltersUsing` customizes the query to filter by due date and urgency. This provides more complex filtering options for managing tasks. ```php model(Task::class) ->statusField('status') ->filterFormSchema([ Select::make('priority') ->options([ 'low' => 'Low', 'medium' => 'Medium', 'high' => 'High', ]), DatePicker::make('due_date') ->label('Due Date'), Toggle::make('is_urgent') ->label('Urgent Tasks Only'), ]) ->applyFiltersUsing(function(Builder $query, array $data) { if (!empty($data['priority'])) { $query->where('priority', $data['priority']); } if (!empty($data['due_date'])) { $query->whereDate('due_date', $data['due_date']); } if (!empty($data['is_urgent'])) { $query->where('is_urgent', true); } return $query; }); } ``` -------------------------------- ### Custom Card Component Structure (Blade) Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs/filament/advanced-kanban/kanban/advanced-features/components.md Example Blade component for a custom Kanban card. It utilizes variables such as record, title, description, actions, and isLocked status. ```blade {{-- resources/views/components/kanban/tasks/card.blade.php --}}

{{ $title }}

@if($description)

{{ $description }}

@endif
Created: {{ $record->created_at->diffForHumans() }} @if($record->due_date) Due: {{ $record->due_date->format('M d') }} @endif
@if($isLocked)
@endif
@if($actions)
{{ $actions }}
@endif
``` -------------------------------- ### Define Allowed Transitions Between Kanban Columns (PHP) Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Configures which columns a card can transition to from a specific column. This controls the workflow and prevents invalid state changes. It requires the KanbanColumn class and is applied within the kanban method. ```php use Asmit\AdvancedKanban\Columns\KanbanColumn; public function kanban(Kanban $kanban): Kanban { return $kanban ->model(Task::class) ->statusField('status') ->columns([ KanbanColumn::make('todo') ->label('To Do') ->allowedTransitions(['in_progress']), KanbanColumn::make('in_progress') ->label('In Progress') ->allowedTransitions(['todo', 'review']), KanbanColumn::make('review') ->label('Review') ->allowedTransitions(['in_progress', 'completed']), KanbanColumn::make('completed') ->label('Completed') ->allowedTransitions([]), ]); } ``` -------------------------------- ### Advanced Kanban Column Configuration (PHP) Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Provides advanced options for customizing Kanban columns, including icons, descriptions, controlling allowed transitions between columns, locking specific cards, and applying custom CSS classes to the column header. This allows for fine-grained control over the board's appearance and behavior. ```php KanbanColumn::make('todo') ->label('To Do') ->color('gray') ->icon('heroicon-o-clock') ->description('Tasks that need to be started') ->allowedTransitions(['in_progress']) // Control allowed moves ->lockCardUsing(fn($record) => false) // Lock specific cards ->extraColumnHeadingClass('font-bold'); // Custom CSS classes ``` -------------------------------- ### Group Record Actions with ActionGroup - PHP Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs/filament/advanced-kanban/kanban/columns/record-actions.md Shows how to organize multiple actions into a dropdown menu using `ActionGroup`. This improves UI by reducing clutter for records with many available actions. Includes examples of 'view', 'duplicate', and 'delete' actions within a group. ```php use Asmit\AdvancedKanban\RecordAction\Action; use Asmit\AdvancedKanban\RecordAction\DeleteAction; use Asmit\AdvancedKanban\Actions\ActionGroup; public function kanban(Kanban $kanban): Kanban { return $kanban ->model(Task::class) ->statusField('status') ->recordActions([ Action::make('edit') ->label('Edit') ->icon('heroicon-o-pencil') ->action(fn($record) => $this->editTask($record)), ActionGroup::make([ Action::make('view') ->label('View Details') ->icon('heroicon-o-eye') ->action(fn($record) => $this->viewTask($record)), Action::make('duplicate') ->label('Duplicate') ->icon('heroicon-o-document-duplicate') ->action(fn($record) => $this->duplicateTask($record)), DeleteAction::make('delete') ->label('Delete') ->icon('heroicon-o-trash') ->color('danger') ->action(fn($record) => $this->deleteTask($record)), ]) ->label('More Actions') ->icon('heroicon-o-ellipsis-vertical') ->dropdownPlacement('bottom-end'), ]) ->columns([ // Your columns here ]); } ``` -------------------------------- ### Create MRR Page with Filament CLI Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs/filament/advanced-kanban/relational-records/mrr-kanban-setup.md Generates a new Filament page specifically for managing related records, aliased as 'ManageRelatedRecords'. This command is the first step in setting up the MRR Kanban functionality. ```bash php artisan make:filament-page ManageUserTasks --resource=UserResource --type=ManageRelatedRecords ``` -------------------------------- ### Adding Actions to Kanban Column Headers in PHP Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Shows how to define actions that appear directly on the Kanban board's column headers using the `->columnHeaderActions()` method in PHP. This allows for context-specific actions like adding a new task to a particular column. It utilizes the FilamentActionsAction class. ```php model(Task::class) ->statusField('status') ->columns([ // Your columns here ]) ->columnHeaderActions([ Action::make('add_task') ->label('Add Task') ->icon('heroicon-o-plus') ->color('primary') ->action(function($arguments) { // $arguments contains the current column status $this->addTaskToColumn($arguments['status']); }), ]); } ``` -------------------------------- ### Implement HasKanban Interface for MRR Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md This PHP code demonstrates how to implement the `HasKanban` interface and use the `HasKanbanRelatedRecords` trait to create a Kanban board for related records. It configures the Kanban board by specifying the model, status field, title field, and initial columns. ```php model(Task::class) // ← Pass your model ->statusField('status') // ← Pass the status field ->titleField('title') ->descriptionField('description') ->columns([ KanbanColumn::make('To Do'), // ← Pass required column KanbanColumn::make('In Progress'), ]) ->searchableFields(['title', 'description']) ->recordsPerColumn(10); } } ``` -------------------------------- ### Customize Record Move Behavior Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Override the `handleRecordMove` method to customize how records are moved between columns in the Kanban board. This allows for custom logic such as updating the record's status and logging the action. ```APIDOC ## Override `handleRecordMove` ### Description Customizes the behavior when a record is moved between columns. This method is called after the record's status has been updated. ### Method `handleRecordMove(string $newStatus, Model $record): void` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```php update(['status' => $newStatus]); // Log the move activity() ->performedOn($record) ->log("Task moved to {$newStatus}"); } } ``` ### Response #### Success Response (200) N/A (This is a server-side method override) #### Response Example N/A ``` -------------------------------- ### Kanban Filtering with Tabs (PHP) Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md This PHP code shows how to use Filament tabs to filter Kanban records. It defines tabs that apply specific query modifications to filter the displayed tasks based on their status or priority. ```php use Asmit\AdvancedKanban\Concerns\HasKanbanRelatedRecords; use Asmit\AdvancedKanban\Contracts\HasKanban; use Filament\Schemas\Components\Tabs\Tab; use Illuminate\Database\Eloquent\Builder; class ManageProjectTask extends ManageRelatedRecords implements HasKanban { use HasKanbanRelatedRecords; public function getTabs(): array { return [ 'all' => Tab::make(), 'complete' => Tab::make() ->modifyQueryUsing(fn (Builder $query) => $query->where('status', 'complete')), 'pending' => Tab::make() ->modifyQueryUsing(fn (Builder $query) => $query->where('status', 'pending')), ]; } public function kanban(Kanban $kanban): Kanban { return $kanban ->model(Task::class) ->statusField('status') // ... other Kanban config ; } } ``` ```php use Asmit\AdvancedKanban\Pages\KanbanPage; use Filament\Resources\Concerns\HasTabs; use Filament\Schemas\Components\Tabs\Tab; use Illuminate\Database\Eloquent\Builder; class TaskKanban extends KanbanPage { use HasTabs; public function getTabs(): array { return [ 'All' => Tab::make('All'), 'High Priority' => Tab::make('High Priority') ->modifyQueryUsing(fn (Builder $query) => $query->where('priority', 'high')), ]; } public function kanban(Kanban $kanban): Kanban { return $kanban ->model(Task::class) ->statusField('status') // ... other Kanban config ; } } ``` -------------------------------- ### Define Kanban Action in PHP Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs/filament/advanced-kanban/kanban/advanced-features/actions-to-component.md Defines a custom action for a Kanban component using Filament Actions. This example shows how to create an action named 'docs' and configure its schema with a text input that defaults to a record ID. ```php use Filament\Actions\Action; use Filament\Forms\Components\TextInput; public function addDocsAction(): Action { return Action::make('docs') ->schema(function (array $arguments): array { return [ TextInput::make('title')->default($arguments['recordId']), ]; }); } ``` -------------------------------- ### Custom Column Header Component Structure (Blade) Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs/filament/advanced-kanban/kanban/advanced-features/components.md Example Blade component for a custom Kanban column header. It showcases available variables like column, status, label, color, and icon. ```blade {{-- resources/views/components/kanban/tasks/column-header.blade.php --}}
@if($icon) @endif

{{ $label }}

@if($description)

{{ $description }}

@endif
{{ $slot }}
``` -------------------------------- ### Customize Locked Card Appearance (PHP) Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Allows customization of the icon and label displayed for locked cards. This enhances the visual indication that a card cannot be moved. It uses the lockedIcon and lockLabel methods after lockCardUsing. ```php KanbanColumn::make('completed') ->label('Completed') ->lockCardUsing(fn($record) => true) ->lockedIcon('heroicon-o-lock-closed') ->lockLabel('Completed - Cannot be moved'); ``` -------------------------------- ### Using Action Groups for Column Header Actions in PHP Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs.md Explains how to group multiple actions for Kanban column headers into a single dropdown menu using `ActionGroup` in PHP. This is useful for providing a set of related actions (e.g., add, bulk edit, export) on column headers. It requires AsmitAdvancedKanbanActionsActionGroup and FilamentActionsAction. ```php use Filament\Actions\Action; use Asmit\AdvancedKanban\Actions\ActionGroup; public function kanban(Kanban $kanban): Kanban { return $kanban ->model(Task::class) ->statusField('status') ->columns([ // Your columns here ]) ->columnHeaderActions([ ActionGroup::make([ Action::make('add_task') ->label('Add Task') ->icon('heroicon-o-plus') ->action(fn($arguments) => $this->addTask($arguments['status'])), Action::make('bulk_edit') ->label('Bulk Edit') ->icon('heroicon-o-pencil') ->action(fn($arguments) => $this->bulkEdit($arguments['status'])), Action::make('export_column') ->label('Export Column') ->icon('heroicon-o-arrow-down-tray') ->action(fn($arguments) => $this->exportColumn($arguments['status'])), ]) ->label('More Actions') ->icon('heroicon-o-ellipsis-vertical') ->color('gray'), ]); } ``` -------------------------------- ### Evaluate Kanban Action with Record ID Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs/filament/advanced-kanban/kanban/advanced-features/actions-to-component.md A general example demonstrating how to evaluate a Kanban action within a component, passing a specific record ID. This is useful for triggering actions tied to individual records in the Kanban view. ```php {{ $this->evaluateAction($this->yourAction(), ['recordId' => $record->getKey()]) }} ``` -------------------------------- ### Conditionally Hide Kanban Columns (PHP) Source: https://context7.com/filament-plugins/advanced-kanban-docs/llms.txt PHP example showing how to conditionally hide a Kanban column based on user permissions. The `hidden()` method accepts a closure that returns a boolean value. ```php KanbanColumn::make('archived') ->label('Archived') ->hidden(fn() => auth()->user()->cannot('view-archived')) ``` -------------------------------- ### Common Kanban Board Configuration Options in PHP Source: https://github.com/filament-plugins/advanced-kanban-docs/blob/main/docs/filament/advanced-kanban/kanban/overview.md Illustrates extensive configuration for a Kanban board, including model, status, title, description fields, searchable fields, pagination, column header actions, and record actions. ```php public function kanban(Kanban $kanban): return $kanban ->model(Task::class) ->statusField('status') ->titleField('title') // Field to display as card title ->descriptionField('description') // Field to display as card description ->searchableFields(['title', 'description']) // Fields to search ->recordsPerColumn(10) // Pagination limit ->columns([ // Your columns here ]) ->columnHeaderActions([ // Actions here ]) ->recordActions([ // Actions here ]); ```