@php $companies = auth()->user() ? auth()->user()->getAllowedCompanies() : collect(); $activeCompanyId = currentCompanyId(); $activeCompany = $companies->where('id', $activeCompanyId)->first(); $switchableCompanies = (auth()->user()->role === 'admin') ? $companies->where('mode', '!=', 'cash') : $companies; $role = auth()->user()?->role ?? 'viewer'; $isAdmin = ($role === 'admin'); $isCa = ($role === 'ca'); $isCashRole = ($role === 'cash'); $isCash = currentCompany()?->mode === 'cash'; $cashModeActive = $activeCompany && $activeCompany->mode === 'cash'; $companyColors = [1 => '#04a9f5', 2 => '#6610f2', 3 => '#fd7e14']; $activeColor = $companyColors[$activeCompanyId] ?? '#4361ee'; $currentRoute = request()->route()?->getName(); @endphp {{-- ═══ TOP BAR ═══ --}}
{{-- Left: Company switcher --}}
@if($switchableCompanies->count() > 1 || $isAdmin) @else {{ $activeCompany->name ?? 'N/A' }} @endif @if($cashModeActive && !$isCashRole) Cash @endif @if($isAdmin) @endif
{{-- Center: Navigation (desktop) --}} {{-- Right: Actions --}}
{{-- Mobile hamburger --}} {{-- Shortcuts --}} @php $shortcuts = [ ['name' => 'Sales Invoice', 'route' => 'sale.create', 'icon' => 'ph-receipt', 'key' => '1', 'cash' => true], ['name' => 'Sale Receipt', 'route' => 'sale-receipts.create', 'icon' => 'ph-money', 'key' => '2', 'cash' => false], ['name' => 'Purchase Bill', 'route' => 'purchase.create', 'icon' => 'ph-note', 'key' => '3', 'cash' => false], ['name' => 'Purchase Payment', 'route' => 'purchase-payments.create', 'icon' => 'ph-currency-dollar', 'key' => '4', 'cash' => false], ['name' => 'Customer', 'route' => 'customers.create', 'icon' => 'ph-user-plus', 'key' => '5', 'cash' => false], ['name' => 'Product', 'route' => 'products.create', 'icon' => 'ph-cube', 'key' => '6', 'cash' => false], ['name' => 'Shipping Labels', 'route' => 'shipping-labels.index', 'icon' => 'ph-package', 'key' => '7', 'cash' => true], ['name' => 'Proforma Invoice', 'route' => 'proforma-invoices.create', 'icon' => 'ph-file-dashed', 'key' => '8', 'cash' => false], ['name' => 'OTC Sales', 'route' => 'otc-sales.create', 'icon' => 'ph-shopping-cart', 'key' => 'F9', 'cash' => true, 'cashOnly' => true], ['name' => 'Save / Submit', 'route' => null, 'icon' => 'ph-floppy-disk', 'key' => 'S', 'cash' => true], ]; @endphp {{-- User --}}
{{-- ═══ MOBILE NAV (collapse) ═══ --}}
Home @if(!$isCashRole && !$isCa)
Masters
Customers Products Shipping Labels Stock Stickers @endif
Purchase
@if(($cashModeActive || $isCashRole) && !$isCa) Purchase Orders@endif @if(!$isCashRole) @if(!$isCa) Purchase Bill Purchase Return @endif Payments @endif
Sales
@if($cashModeActive && !$isCa) Sales Enquiry@endif @if(!$isCa) Proforma Invoice Product Outwards Sales Bill @endif @if($cashModeActive || $isCashRole || $isCa) OTC Sales @endif @if(!$isCashRole) Receipts @if(!$isCa) Sales Return @endif @endif @if(!$isCashRole) @if($cashModeActive && !$isCa)
Field
Trade Exhibitions @endif
Reports
Ledger Outstandings GST Sales GST Purchase GST Purchase Return Sales (Customer) Sales (Product) @if($cashModeActive) Field Report @endif Purchases (Product) Customer Products Price List Most Moving Items Less Stock Items Dormant Customers HSN Report Catalog @if($isAdmin || $isCa) Bank Statement @endif Tally Export @endif @if($isAdmin)
Settings
Companies Bank Accounts Users Activity Logs @endif
{{-- Cash Mode Modal --}} @if($isAdmin) @if($errors->has('password')) @endif @endif