@@ -85,56 +85,7 @@ function menuItemsManager(config) {
85
85
},
86
86
87
87
initSortable () {
88
- if (typeof Sortable !== ' undefined' ) {
89
- const container = document .getElementById (' menu-items-container' );
90
- if (container) {
91
- Sortable .create (container, {
92
- group: ' menu-items' ,
93
- animation: 150 ,
94
- handle: ' .drag-handle' ,
95
- onStart : (evt ) => {
96
- // Store the original order and DOM state before drag
97
- this .originalOrder = Array .from (container .children ).map (el => this .extractItemId (el));
98
- this .originalElements = Array .from (container .children );
99
- },
100
- onEnd : (evt ) => {
101
- if (evt .oldIndex !== evt .newIndex ) {
102
- // Calculate the new order based on the drag operation
103
- const newOrder = [... this .originalOrder ];
104
- const movedItem = newOrder .splice (evt .oldIndex , 1 )[0 ];
105
- newOrder .splice (evt .newIndex , 0 , movedItem);
106
-
107
- // Immediately revert DOM to original state to preserve Livewire
108
- container .innerHTML = ' ' ;
109
- this .originalElements .forEach (el => container .appendChild (el));
110
-
111
- this .saveReorderFromOrder (newOrder);
112
- }
113
- }
114
- });
115
- }
116
- }
117
- },
118
-
119
- saveReorderFromOrder (newOrder ) {
120
- this .loading = true ;
121
-
122
- // Build items array from the calculated new order
123
- const items = newOrder .map ((itemId , index ) => {
124
- return {
125
- id: itemId,
126
- position: index,
127
- parent_id: null // Root level items for now
128
- };
129
- });
130
-
131
- // Call the Livewire method to save the new order
132
- this .$wire .reorderMenuItems (items);
133
- },
134
-
135
- extractItemId (element ) {
136
- const itemId = element .dataset .itemId ;
137
- return itemId ? parseInt (itemId) : null ;
88
+ // Drag and drop disabled - using up/down buttons instead
138
89
},
139
90
}
140
91
}
0 commit comments