327 lines
17 KiB
PHP
327 lines
17 KiB
PHP
<!DOCTYPE html>
|
||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="dark">
|
||
<head>
|
||
@include('partials.head')
|
||
</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>
|
||
|
||
<aside class="wms-sidebar" data-wms-sidebar aria-label="{{ __('Main navigation') }}">
|
||
<div class="wms-sidebar-header">
|
||
<a href="{{ auth()->user()?->isMpbaPlatformAdmin() ? route('platform.dashboard') : route('dashboard') }}" wire:navigate class="wms-brand" aria-label="{{ __('Warehouse Management System') }}">
|
||
<span class="wms-brand-mark">
|
||
<span class="wms-brand-mark-inner">W</span>
|
||
</span>
|
||
|
||
<span class="wms-brand-copy" data-wms-sidebar-label>
|
||
<span class="wms-brand-title">{{ __('Warehouse Management System') }}</span>
|
||
<span class="wms-brand-subtitle">MPBA</span>
|
||
</span>
|
||
</a>
|
||
|
||
<button
|
||
type="button"
|
||
class="wms-sidebar-toggle"
|
||
data-wms-sidebar-toggle
|
||
aria-label="{{ __('Collapse sidebar') }}"
|
||
aria-expanded="true"
|
||
>
|
||
<span class="wms-toggle-expanded">‹</span>
|
||
<span class="wms-toggle-collapsed">›</span>
|
||
</button>
|
||
|
||
<button
|
||
type="button"
|
||
class="wms-mobile-close"
|
||
data-wms-mobile-close
|
||
aria-label="{{ __('Close navigation') }}"
|
||
>
|
||
×
|
||
</button>
|
||
</div>
|
||
|
||
<nav class="wms-sidebar-nav" aria-label="{{ __('Operations') }}">
|
||
<div class="wms-sidebar-group">
|
||
<div class="wms-sidebar-heading" data-wms-sidebar-label>{{ __('Operations') }}</div>
|
||
|
||
@if(auth()->user()?->isMpbaPlatformAdmin())
|
||
<a href="{{ route('platform.dashboard') }}" wire:navigate class="wms-sidebar-link @if(request()->routeIs('platform.dashboard')) is-active @endif" title="{{ __('Platform') }}">
|
||
<i class="fa-solid fa-screwdriver-wrench wms-sidebar-icon" aria-hidden="true"></i>
|
||
<span data-wms-sidebar-label>{{ __('Platform') }}</span>
|
||
</a>
|
||
@else
|
||
<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>
|
||
<span data-wms-sidebar-label>{{ __('Dashboard') }}</span>
|
||
</a>
|
||
@endif
|
||
|
||
|
||
</div>
|
||
|
||
@if(auth()->user()?->isMpbaPlatformAdmin())
|
||
<div class="wms-sidebar-group">
|
||
<div class="wms-sidebar-heading" data-wms-sidebar-label>{{ __('Administration') }}</div>
|
||
|
||
<a href="{{ route('warehouses.index') }}" wire:navigate class="wms-sidebar-link @if(request()->routeIs('warehouses.*')) is-active @endif" title="{{ __('Warehouses') }}">
|
||
<i class="fa-solid fa-warehouse wms-sidebar-icon" aria-hidden="true"></i>
|
||
<span data-wms-sidebar-label>{{ __('Warehouses') }}</span>
|
||
</a>
|
||
<a href="{{ route('warehouse-rules.index') }}" wire:navigate class="wms-sidebar-link @if(request()->routeIs('warehouse-rules.*')) is-active @endif" title="{{ __('Validation Rules') }}">
|
||
<i class="fa-solid fa-shield-halved wms-sidebar-icon" aria-hidden="true"></i>
|
||
<span data-wms-sidebar-label>{{ __('Validation Rules') }}</span>
|
||
</a>
|
||
<a href="{{ route('platform.companies.index') }}" wire:navigate class="wms-sidebar-link @if(request()->routeIs('platform.companies.*')) is-active @endif" title="{{ __('Companies') }}">
|
||
<i class="fa-solid fa-building wms-sidebar-icon" aria-hidden="true"></i>
|
||
<span data-wms-sidebar-label>{{ __('Companies') }}</span>
|
||
</a>
|
||
|
||
<a href="{{ route('platform.licenses.index') }}" wire:navigate class="wms-sidebar-link @if(request()->routeIs('platform.licenses.*')) is-active @endif" title="{{ __('Licences') }}">
|
||
<i class="fa-solid fa-key wms-sidebar-icon" aria-hidden="true"></i>
|
||
<span data-wms-sidebar-label>{{ __('Licences') }}</span>
|
||
</a>
|
||
|
||
<a href="{{ route('platform.payments.index') }}" wire:navigate class="wms-sidebar-link @if(request()->routeIs('platform.payments.*')) is-active @endif" title="{{ __('Payments') }}">
|
||
<i class="fa-solid fa-credit-card wms-sidebar-icon" aria-hidden="true"></i>
|
||
<span data-wms-sidebar-label>{{ __('Payments') }}</span>
|
||
</a>
|
||
</div>
|
||
@else
|
||
<div class="wms-sidebar-group">
|
||
<div class="wms-sidebar-heading" data-wms-sidebar-label>{{ __('Administration') }}</div>
|
||
|
||
<a href="{{ route('warehouses.index') }}" wire:navigate class="wms-sidebar-link @if(request()->routeIs('warehouses.*')) is-active @endif" title="{{ __('Warehouses') }}">
|
||
<i class="fa-solid fa-warehouse wms-sidebar-icon" aria-hidden="true"></i>
|
||
<span data-wms-sidebar-label>{{ __('Warehouses') }}</span>
|
||
</a>
|
||
</div>
|
||
@endif
|
||
</nav>
|
||
|
||
<div class="wms-sidebar-footer">
|
||
<flux:dropdown position="top" align="start">
|
||
<button type="button" class="wms-user-card wms-user-card-button" data-wms-sidebar-label>
|
||
<div class="wms-user-avatar">{{ auth()->user()?->initials() ?? 'U' }}</div>
|
||
<div class="wms-user-copy">
|
||
<div class="wms-user-name">{{ auth()->user()?->name ?? __('User') }}</div>
|
||
<div class="wms-user-email">{{ auth()->user()?->email ?? '' }}</div>
|
||
</div>
|
||
<i class="fa-solid fa-chevron-up wms-user-chevron" aria-hidden="true"></i>
|
||
</button>
|
||
|
||
<flux:menu>
|
||
<flux:menu.radio.group>
|
||
<div class="p-0 text-sm font-normal">
|
||
<div class="flex items-center gap-2 px-1 py-1.5 text-start text-sm">
|
||
<flux:avatar
|
||
:name="auth()->user()?->name ?? 'User'"
|
||
:initials="auth()->user()?->initials() ?? 'U'"
|
||
/>
|
||
|
||
<div class="grid flex-1 text-start text-sm leading-tight">
|
||
<flux:heading class="truncate">{{ auth()->user()?->name ?? __('User') }}</flux:heading>
|
||
<flux:text class="truncate">{{ auth()->user()?->email ?? '' }}</flux:text>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</flux:menu.radio.group>
|
||
|
||
<flux:menu.separator />
|
||
|
||
<flux:menu.radio.group>
|
||
<flux:menu.item :href="route('profile.edit')" icon="cog" wire:navigate>
|
||
{{ __('Settings') }}
|
||
</flux:menu.item>
|
||
</flux:menu.radio.group>
|
||
|
||
<flux:menu.separator />
|
||
|
||
<form method="POST" action="{{ route('logout') }}" class="w-full">
|
||
@csrf
|
||
<flux:menu.item
|
||
as="button"
|
||
type="submit"
|
||
icon="arrow-right-start-on-rectangle"
|
||
class="w-full cursor-pointer"
|
||
data-test="logout-button"
|
||
>
|
||
{{ __('Log out') }}
|
||
</flux:menu.item>
|
||
</form>
|
||
</flux:menu>
|
||
</flux:dropdown>
|
||
|
||
<flux:dropdown position="top" align="start">
|
||
<button type="button" class="wms-user-rail-button" title="{{ __('Account') }}">
|
||
{{ auth()->user()?->initials() ?? 'U' }}
|
||
</button>
|
||
|
||
<flux:menu>
|
||
<flux:menu.item :href="route('profile.edit')" icon="cog" wire:navigate>{{ __('Settings') }}</flux:menu.item>
|
||
<flux:menu.separator />
|
||
<form method="POST" action="{{ route('logout') }}" class="w-full">
|
||
@csrf
|
||
<flux:menu.item as="button" type="submit" icon="arrow-right-start-on-rectangle" class="w-full cursor-pointer">
|
||
{{ __('Log out') }}
|
||
</flux:menu.item>
|
||
</form>
|
||
</flux:menu>
|
||
</flux:dropdown>
|
||
</div>
|
||
</aside>
|
||
|
||
<div class="wms-main-column">
|
||
<header class="wms-mobile-header">
|
||
<button type="button" class="wms-mobile-menu" data-wms-mobile-open aria-label="{{ __('Open navigation') }}">
|
||
<i class="fa-solid fa-bars" aria-hidden="true"></i>
|
||
</button>
|
||
|
||
<a href="{{ auth()->user()?->isMpbaPlatformAdmin() ? route('platform.dashboard') : route('dashboard') }}" wire:navigate class="wms-mobile-title">
|
||
{{ __('Warehouse Management System') }}
|
||
</a>
|
||
|
||
<flux:dropdown position="top" align="end">
|
||
<flux:profile
|
||
:initials="auth()->user()?->initials() ?? 'U'"
|
||
icon-trailing="chevron-down"
|
||
/>
|
||
|
||
<flux:menu>
|
||
<flux:menu.radio.group>
|
||
<div class="p-0 text-sm font-normal">
|
||
<div class="flex items-center gap-2 px-1 py-1.5 text-start text-sm">
|
||
<flux:avatar
|
||
:name="auth()->user()?->name ?? 'User'"
|
||
:initials="auth()->user()?->initials() ?? 'U'"
|
||
/>
|
||
|
||
<div class="grid flex-1 text-start text-sm leading-tight">
|
||
<flux:heading class="truncate">{{ auth()->user()?->name ?? __('User') }}</flux:heading>
|
||
<flux:text class="truncate">{{ auth()->user()?->email ?? '' }}</flux:text>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</flux:menu.radio.group>
|
||
|
||
<flux:menu.separator />
|
||
|
||
<flux:menu.radio.group>
|
||
<flux:menu.item :href="route('profile.edit')" icon="cog" wire:navigate>
|
||
{{ __('Settings') }}
|
||
</flux:menu.item>
|
||
</flux:menu.radio.group>
|
||
|
||
<flux:menu.separator />
|
||
|
||
<form method="POST" action="{{ route('logout') }}" class="w-full">
|
||
@csrf
|
||
<flux:menu.item
|
||
as="button"
|
||
type="submit"
|
||
icon="arrow-right-start-on-rectangle"
|
||
class="w-full cursor-pointer"
|
||
data-test="logout-button"
|
||
>
|
||
{{ __('Log out') }}
|
||
</flux:menu.item>
|
||
</form>
|
||
</flux:menu>
|
||
</flux:dropdown>
|
||
</header>
|
||
|
||
<main class="wms-content">
|
||
{{ $slot }}
|
||
</main>
|
||
</div>
|
||
</div>
|
||
|
||
@persist('toast')
|
||
<flux:toast.group>
|
||
<flux:toast />
|
||
</flux:toast.group>
|
||
@endpersist
|
||
|
||
@fluxScripts
|
||
|
||
<script>
|
||
(function () {
|
||
const STORAGE_KEY = 'wms-sidebar-state';
|
||
|
||
function applySidebarState() {
|
||
const root = document.documentElement;
|
||
const saved = localStorage.getItem(STORAGE_KEY) || 'expanded';
|
||
|
||
root.dataset.wmsSidebar = saved === 'collapsed' ? 'collapsed' : 'expanded';
|
||
|
||
document.querySelectorAll('[data-wms-sidebar-toggle]').forEach((button) => {
|
||
const expanded = root.dataset.wmsSidebar !== 'collapsed';
|
||
button.setAttribute('aria-expanded', expanded ? 'true' : 'false');
|
||
button.setAttribute('aria-label', expanded ? '{{ __('Collapse sidebar') }}' : '{{ __('Expand sidebar') }}');
|
||
});
|
||
}
|
||
|
||
function closeMobileSidebar() {
|
||
document.documentElement.dataset.wmsMobileSidebar = 'closed';
|
||
}
|
||
|
||
function openMobileSidebar() {
|
||
document.documentElement.dataset.wmsMobileSidebar = 'open';
|
||
}
|
||
|
||
function bindSidebarControls() {
|
||
applySidebarState();
|
||
|
||
document.querySelectorAll('[data-wms-sidebar-toggle]').forEach((button) => {
|
||
if (button.dataset.wmsBound === '1') {
|
||
return;
|
||
}
|
||
|
||
button.dataset.wmsBound = '1';
|
||
|
||
button.addEventListener('click', function () {
|
||
const root = document.documentElement;
|
||
const next = root.dataset.wmsSidebar === 'collapsed' ? 'expanded' : 'collapsed';
|
||
|
||
root.dataset.wmsSidebar = next;
|
||
localStorage.setItem(STORAGE_KEY, next);
|
||
applySidebarState();
|
||
});
|
||
});
|
||
|
||
document.querySelectorAll('[data-wms-mobile-open]').forEach((button) => {
|
||
if (button.dataset.wmsBound === '1') {
|
||
return;
|
||
}
|
||
|
||
button.dataset.wmsBound = '1';
|
||
button.addEventListener('click', openMobileSidebar);
|
||
});
|
||
|
||
document.querySelectorAll('[data-wms-mobile-close]').forEach((button) => {
|
||
if (button.dataset.wmsBound === '1') {
|
||
return;
|
||
}
|
||
|
||
button.dataset.wmsBound = '1';
|
||
button.addEventListener('click', closeMobileSidebar);
|
||
});
|
||
|
||
document.querySelectorAll('.wms-sidebar-link[wire\\:navigate]').forEach((link) => {
|
||
if (link.dataset.wmsMobileBound === '1') {
|
||
return;
|
||
}
|
||
|
||
link.dataset.wmsMobileBound = '1';
|
||
link.addEventListener('click', closeMobileSidebar);
|
||
});
|
||
}
|
||
|
||
document.addEventListener('DOMContentLoaded', bindSidebarControls);
|
||
document.addEventListener('livewire:navigated', bindSidebarControls);
|
||
})();
|
||
</script>
|
||
</body>
|
||
</html>
|