fixed mobile
This commit is contained in:
@@ -5,10 +5,10 @@
|
||||
</head>
|
||||
|
||||
<body class="min-h-screen bg-white text-zinc-950 antialiased dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<div class="wms-app-shell" data-wms-shell>
|
||||
<div class="wms-mobile-overlay" data-wms-mobile-close></div>
|
||||
<div class="wms-app-shell" data-wms-shell data-wms-mobile-shell>
|
||||
<button type="button" class="wms-mobile-overlay" data-wms-mobile-close aria-label="{{ __('Close navigation menu') }}"></button>
|
||||
|
||||
<aside class="wms-sidebar" data-wms-sidebar aria-label="{{ __('Main navigation') }}">
|
||||
<aside id="wms-main-sidebar" class="wms-sidebar" data-wms-sidebar aria-label="{{ __('Main navigation') }}">
|
||||
<div class="wms-sidebar-header">
|
||||
<a href="{{ auth()->user()?->isMpbaPlatformAdmin() && Route::has('platform.dashboard') ? route('platform.dashboard') : route('dashboard') }}" wire:navigate class="wms-brand" aria-label="{{ __('Warehouse Management System') }}">
|
||||
<span class="wms-brand-mark" data-wms-brand-toggle title="{{ __('Expand sidebar') }}"><span class="wms-brand-mark-inner">W</span></span>
|
||||
@@ -34,7 +34,6 @@
|
||||
<i class="fa-solid fa-screwdriver-wrench wms-sidebar-icon" aria-hidden="true"></i>
|
||||
<span data-wms-sidebar-label>{{ __('Platform') }}</span>
|
||||
</a>
|
||||
|
||||
@elseif(Route::has('dashboard'))
|
||||
<a href="{{ route('dashboard') }}" wire:navigate class="wms-sidebar-link @if(request()->routeIs('dashboard')) is-active @endif" title="{{ __('Dashboard') }}">
|
||||
<i class="fa-solid fa-gauge-high wms-sidebar-icon" aria-hidden="true"></i>
|
||||
@@ -231,6 +230,18 @@
|
||||
</aside>
|
||||
|
||||
<div class="wms-main-panel">
|
||||
<header class="wms-mobile-header" role="banner">
|
||||
<button type="button" class="wms-mobile-menu" data-wms-mobile-open aria-label="{{ __('Open navigation menu') }}" aria-controls="wms-main-sidebar" aria-expanded="false">
|
||||
<i class="fa-solid fa-bars" aria-hidden="true"></i>
|
||||
</button>
|
||||
|
||||
<a href="{{ auth()->user()?->isMpbaPlatformAdmin() && Route::has('platform.dashboard') ? route('platform.dashboard') : route('dashboard') }}" wire:navigate class="wms-mobile-title">
|
||||
{{ __('Warehouse Management System') }}
|
||||
</a>
|
||||
|
||||
<span class="wms-mobile-badge">MPBA</span>
|
||||
</header>
|
||||
|
||||
<main class="wms-content">
|
||||
{{ $slot }}
|
||||
</main>
|
||||
@@ -258,8 +269,32 @@
|
||||
});
|
||||
}
|
||||
|
||||
function closeMobileSidebar() { document.documentElement.dataset.wmsMobileSidebar = 'closed'; }
|
||||
function openMobileSidebar() { document.documentElement.dataset.wmsMobileSidebar = 'open'; }
|
||||
function setMobileToggleState(isOpen) {
|
||||
document.querySelectorAll('[data-wms-mobile-open]').forEach((button) => {
|
||||
button.setAttribute('aria-expanded', isOpen ? 'true' : 'false');
|
||||
});
|
||||
|
||||
document.body.classList.toggle('wms-mobile-nav-open', isOpen);
|
||||
}
|
||||
|
||||
function closeMobileSidebar() {
|
||||
document.documentElement.dataset.wmsMobileSidebar = 'closed';
|
||||
setMobileToggleState(false);
|
||||
}
|
||||
|
||||
function openMobileSidebar() {
|
||||
document.documentElement.dataset.wmsMobileSidebar = 'open';
|
||||
setMobileToggleState(true);
|
||||
}
|
||||
|
||||
function toggleMobileSidebar() {
|
||||
if (document.documentElement.dataset.wmsMobileSidebar === 'open') {
|
||||
closeMobileSidebar();
|
||||
return;
|
||||
}
|
||||
|
||||
openMobileSidebar();
|
||||
}
|
||||
|
||||
function bindSidebarControls() {
|
||||
applySidebarState();
|
||||
@@ -287,10 +322,15 @@
|
||||
applySidebarState();
|
||||
});
|
||||
});
|
||||
closeMobileSidebar();
|
||||
|
||||
document.querySelectorAll('[data-wms-mobile-open]').forEach((button) => {
|
||||
if (button.dataset.wmsBound === '1') return;
|
||||
button.dataset.wmsBound = '1';
|
||||
button.addEventListener('click', openMobileSidebar);
|
||||
button.addEventListener('click', function (event) {
|
||||
event.preventDefault();
|
||||
toggleMobileSidebar();
|
||||
});
|
||||
});
|
||||
document.querySelectorAll('[data-wms-mobile-close]').forEach((button) => {
|
||||
if (button.dataset.wmsBound === '1') return;
|
||||
|
||||
Reference in New Issue
Block a user