InvTrack / invtrack

GNU General Public License v3.0
1 stars 2 forks source link

Allow admins to reorder products #133

Closed michalstruck closed 7 months ago

michalstruck commented 8 months ago

Here comes the lovely UI part, we need to figure out how to nicely display this. My idea was to create a drag'n'drop creator similar to a kanban board, with the products being displayed at the top, outside the board. The downside of this is that we'd have limited space, and I'm not sure how to handle overflow - push it to next row, creating something like a grid? We could also flip the board 90deg, so that categories can be added at the bottom infinitely - to be discussed.

michalstruck commented 8 months ago

What is even more problematic here, is how to handle the product's index. Consider this:

felix-lipski commented 8 months ago

The index should refer to a place within the category, so there would be doubles, I don't see an issue with that. The categories themselves should have an ordering mechanism of it's own.

Nothing should happen to product indexes when the categories are reordered.

When the category of a product is changed, if the drag and drop UI allows for moving to a specific place within a category, just insert it at that index, move the other products, etc. if not, just insert it at the bottom of the category. Same goes for uncategorizing, just treat the null category as a category that is displayed at the bottom, and products can still have a specified order within it.

michalstruck commented 8 months ago

@felix-lipski alright then, ready to develop then

michalstruck commented 8 months ago

https://svelte.dev/repl/b225504c9fea44b189ed5bfb566df6e6?version=4.2.12 This may be taken as an inspiration/code example. Consider using a dnd library, but may not be necessary

EDIT: https://github.com/PuruVJ/neodrag this looks promising, with some nice QOL features available out of the box

michalstruck commented 7 months ago

closed by #137