Skip to content

[Add-on][Done] KanbanOperation #48

@svenk2002

Description

@svenk2002

Introduction

I noticed there was no straightforward way to add a Kanban view to your data, so I developed a new Kanban feature that allows you to easily update the status of a task, among other things.

KanbanOvervieuw
KanBanToggle

How it works

  1. Functionality:

    • Adds a Kanban view to your CRUD panel
    • Allows dragging and dropping items between columns
    • Supports customizable columns and fields
    • Provides routes for fetching and updating Kanban items
    • Search on title inside the Kanban
  2. Implementation:
    To implement the Kanban operation in your CRUD controller, you need to use the KanbanOperation trait and configure it. Here's how you can do it:

use App\Http\Controllers\Admin\Operations\KanbanOperation;

class TaskCrudController extends CrudController
{

    use KanbanOperation;

  protected function setupKanbanOperation()

    {
        CRUD::set('kanban.columns', [
            'pending' => 'in afwachting',
            'approved' => 'actief',
            'completed' => 'voltooid',
        ]);
    }

    protected function getKanbanFieldsMap(): array
    {
        return [
            'id' => 'id',
            'title' => 'name',
        ];
    }
}

In this implementation:

  1. We use the KanbanOperation trait in the controller.

  2. We override the setupKanbanOperation() method to customize the Kanban columns. In this case, we're setting three columns: 'pending', 'approved', and 'completed', with their respective Dutch translations.

  3. We override the getKanbanFieldsMap() method to define which fields from your model should be used for the Kanban items. Here, we're mapping the 'id' and 'name' fields from your model to the expected Kanban item fields.

By default, the addon uses the 'status' field to determine which column an item belongs to. If your model uses a different field name for this purpose, you can set it like this:

    protected function getKanbanFieldsMap(): array
    {
       CRUD::set('kanban.column_field', 'your_status_field_name');
    }

After implementing this, you should see a new Kanban view option in your CRUD panel, allowing you to manage your entries in a Kanban board format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions