From f8dfe3a6e41e8909f27c8175f173a4d82908c1b3 Mon Sep 17 00:00:00 2001 From: Mo Khosh Date: Wed, 28 Feb 2024 20:26:14 +0330 Subject: [PATCH] use data-status-id instead of id to avoid id conflict with records when enum is int backed --- resources/views/kanban-scripts.blade.php | 6 +++--- resources/views/kanban-status.blade.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/views/kanban-scripts.blade.php b/resources/views/kanban-scripts.blade.php index 0d2c946..85a1786 100644 --- a/resources/views/kanban-scripts.blade.php +++ b/resources/views/kanban-scripts.blade.php @@ -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) @@ -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}) @@ -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, diff --git a/resources/views/kanban-status.blade.php b/resources/views/kanban-status.blade.php index 94a49b2..2078e9c 100644 --- a/resources/views/kanban-status.blade.php +++ b/resources/views/kanban-status.blade.php @@ -4,7 +4,7 @@ @include(static::$headerView)
@foreach($status['records'] as $record)