mokhosh / filament-kanban

Add kanban boards to your Filament pages
https://filamentphp.com/plugins/mokhosh-kanban
MIT License
228 stars 32 forks source link

[New Feature]: Is there any way to prevent a record from being draggable? #39

Open willcastillo opened 2 months ago

willcastillo commented 2 months ago

What happened?

I'd like to temporarily prevent a record from being moved to a new column. It'd be ok to be moved within its current status but not to change its current status. is that possible somehow?

How to reproduce the bug

Not a bug.

Package Version

2.8

PHP Version

8.2

Laravel Version

11.4

Which operating systems does with happen with?

No response

Which browsers does with happen with?

No response

Notes

No response

mokhosh commented 2 months ago

You can do this on the backend side for now, and simply not persist the change when you don't want it. Locking a record on the frontend side will probably come in v3.

willcastillo commented 2 months ago

Thanks @mokhosh.

In the meantime, I'm hacking my way in using something like this in the main div container of the kanban-record.blade.php view:

    @if ($record->isPendingApproval())
        onmousedown="event.preventDefault ? event.preventDefault() : event.returnValue = false"
    @endif

So I'm VERY glad to know it's coming. That's super hacky :(

Any guesstimate when v3 will be available?

willcastillo commented 2 months ago

By the way... I am indeed using your approach but for "invalid" moves... My use case for having a fixed "record" was to add a create button inside the status column. Something like: image

mokhosh commented 2 months ago

interesting 👌

no eta currently, as I'm super busy with a few projects.

kusman28 commented 1 month ago

Hi @willcastillo Have you tried disabling it at kanban-scripts.blade.php

I tried to comment these line of codes just to disable the drag.

What's your opinion about this? @mokhosh image

milenmk commented 3 weeks ago

By the way... I am indeed using your approach but for "invalid" moves... My use case for having a fixed "record" was to add a create button inside the status column.

To add this button I assume you are editing the kanban-record.blade.php. If that's the case, just add cursor-pointer class for the create button.