Skip to content

Commit

Permalink
use data-status-id instead of id to avoid id conflict with records wh…
Browse files Browse the repository at this point in the history
…en enum is int backed
  • Loading branch information
mokhosh committed Feb 28, 2024
1 parent 40fd2f6 commit f8dfe3a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions resources/views/kanban-scripts.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function setData(dataTransfer, el) {
function onAdd(e) {
const recordId = e.item.id
const status = e.to.id
const status = e.to.dataset.statusId
const fromOrderedIds = [].slice.call(e.from.children).map(child => child.id)
const toOrderedIds = [].slice.call(e.to.children).map(child => child.id)
Expand All @@ -22,7 +22,7 @@ function onAdd(e) {
function onUpdate(e) {
const recordId = e.item.id
const status = e.from.id
const status = e.from.dataset.statusId
const orderedIds = [].slice.call(e.from.children).map(child => child.id)
Livewire.dispatch('sort-changed', {recordId, status, orderedIds})
Expand All @@ -31,7 +31,7 @@ function onUpdate(e) {
document.addEventListener('livewire:navigated', () => {
const statuses = @js($statuses->map(fn ($status) => $status['id']))
statuses.forEach(status => Sortable.create(document.getElementById(status), {
statuses.forEach(status => Sortable.create(document.querySelector(`[data-status-id='${status}']`), {
group: 'filament-kanban',
ghostClass: 'opacity-50',
animation: 150,
Expand Down
2 changes: 1 addition & 1 deletion resources/views/kanban-status.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@include(static::$headerView)

<div
id="{{ $status['id'] }}"
data-status-id="{{ $status['id'] }}"
class="flex flex-col flex-1 gap-2 p-3 bg-gray-200 dark:bg-gray-800 rounded-xl"
>
@foreach($status['records'] as $record)
Expand Down

0 comments on commit f8dfe3a

Please sign in to comment.