2025-07-21 09:02:13 +02:00
|
|
|
import './admin.scss'
|
|
|
|
|
import * as Turbo from "@hotwired/turbo"
|
2025-07-21 09:47:40 +02:00
|
|
|
import {AutoSubmit} from './class/AutoSubmit'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function script() {
|
|
|
|
|
customElements.define('auto-submit',AutoSubmit,{extends:'form'})
|
2025-07-21 13:25:15 +02:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function full() {
|
|
|
|
|
const sidebar = document.getElementById('sidebar');
|
|
|
|
|
const sidebarToggle = document.getElementById('sidebar-toggle');
|
|
|
|
|
|
|
|
|
|
sidebarToggle.addEventListener('click', function () {
|
|
|
|
|
sidebar.classList.toggle('-translate-x-full');
|
|
|
|
|
});
|
|
|
|
|
const submenuToggles = document.querySelectorAll('[data-submenu-toggle]');
|
|
|
|
|
|
|
|
|
|
submenuToggles.forEach(button => {
|
|
|
|
|
button.addEventListener('click', function () {
|
|
|
|
|
const targetId = this.dataset.submenuToggle;
|
|
|
|
|
const submenu = document.getElementById(`submenu-${targetId}`);
|
|
|
|
|
const arrowIcon = this.querySelector('.arrow-icon');
|
|
|
|
|
|
|
|
|
|
if (submenu && arrowIcon) {
|
|
|
|
|
// Toggle the 'active' class on the submenu
|
|
|
|
|
submenu.classList.toggle('active');
|
|
|
|
|
// Toggle the 'rotate' class on the arrow icon
|
|
|
|
|
arrowIcon.classList.toggle('rotate');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
2025-07-21 09:47:40 +02:00
|
|
|
}
|
|
|
|
|
|
2025-07-21 13:25:15 +02:00
|
|
|
document.addEventListener('DOMContentLoaded', ()=>{
|
|
|
|
|
script();
|
|
|
|
|
});
|
|
|
|
|
document.addEventListener("turbo:load", ()=> {
|
|
|
|
|
full()
|
|
|
|
|
});
|