diff --git a/public/js/menu-tree.js b/public/js/menu-tree.js index 976aaa07..81d0c9df 100644 --- a/public/js/menu-tree.js +++ b/public/js/menu-tree.js @@ -46,6 +46,24 @@ function hideChildren(parentId) { }); } +// 전체 접기/펼치기 +window.toggleAllChildren = function(collapse) { + const buttons = document.querySelectorAll('.toggle-btn'); + buttons.forEach(btn => { + const menuId = btn.getAttribute('data-menu-id'); + const chevron = btn.querySelector('.chevron-icon'); + if (!chevron) return; + + if (collapse) { + chevron.classList.add('rotate-[-90deg]'); + hideChildren(menuId); + } else { + chevron.classList.remove('rotate-[-90deg]'); + showChildren(menuId); + } + }); +}; + // 재귀적으로 직계 자식만 표시 function showChildren(parentId) { const children = getChildElements(parentId); diff --git a/resources/views/menus/index.blade.php b/resources/views/menus/index.blade.php index ff04d114..90d21438 100644 --- a/resources/views/menus/index.blade.php +++ b/resources/views/menus/index.blade.php @@ -159,6 +159,24 @@ function getCookieValue(name) { })(); + +