@php
    $user_role = Auth::user()->role;
    $uid = Auth::user()->id;
@endphp

<nav class="navbar navbar-expand-lg">
    <div class="container-fluid">
        <a class="navbar-brand" href="{{ route('view_dashboard') }}">
            {{-- <img src="{{ asset('images/logogram-bonceng.png') }}" class="img-fluid" alt="" width="30" height="24"> --}}
            <img src="{{ asset('images/logogram-bonceng.png') }}" class="img-fluid" alt="" height="20" width="70">
        </a>
        <button class="navbar-toggler btn btn-outline-secondary btn-sm" type="button" data-bs-toggle="collapse" data-bs-target="#navbarScroll" aria-controls="navbarScroll" aria-expanded="false" aria-label="Toggle navigation" style="width: 30px; height: 30px;">
            <span class="ion-navicon-round fz-14"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarScroll">
            <ul class="navbar-nav navbar-nav-scroll">
                {{-- all roles --}}
                @if ($user_role === \App\Models\Users::ROLE_ADMIN || $user_role === \App\Models\Users::ROLE_VENDOR || $user_role === \App\Models\Users::ROLE_CLIENT_ADMIN || $user_role === \App\Models\Users::ROLE_SPECIAL_TRACKING)
                    <li class="nav-item {{ Request::segment(1) == 'dashboard' ? 'active' : '' }}">
                        <a class="nav-link d-flex align-items-center text-capitalize" aria-current="page" href="{{ route('view_dashboard') }}">
                            Dashboard
                        </a>
                    </li>
                @endif
                @if ($user_role === \App\Models\Users::ROLE_VENDOR)
                    {{-- <li class="nav-item {{ Request::path() == 'user/vendor/transactions' || Request::path() == 'user/vendor/transactions/newOrder' ? 'active' : '' }}">
                        <a class="nav-link d-flex align-items-center text-capitalize" aria-current="page" href="{{ url('user/vendor/transactions/newOrder') }}">
                            Transaction
                        </a>
                    </li> --}}
                    <li class="nav-item {{ Request::path() == 'user/vendor/transactions' || Request::path() == 'transactions/add/special' ? 'active' : '' }}">
                        <a class="nav-link d-flex align-items-center text-capitalize" aria-current="page" href="{{ url('user/vendor/transactions') }}">
                            Transaction
                        </a>
                    </li>
                @endif
                @if ($user_role === \App\Models\Users::ROLE_VENDOR)
                    <li class="nav-item {{ Request::segment(1) == 'zone' ? 'active' : '' }}">
                        <a class="nav-link d-flex align-items-center text-capitalize" aria-current="page" href="{{ route('view_zone') }}">
                            Zone
                        </a>
                    </li>
                @endif
                @if ($user_role === \App\Models\Users::ROLE_VENDOR)
                    <li class="nav-item {{ Request::segment(1) == 'checklist' ? 'active' : '' }}">
                        <a class="nav-link d-flex align-items-center text-capitalize" aria-current="page" href="{{ url('checklist') }}">
                            Konfigurasi
                        </a>
                    </li>
                @endif
                {{-- only admin --}}
                @if ($user_role === \App\Models\Users::ROLE_ADMIN)
                    <li class="nav-item {{ Request::segment(1) == 'transactions' ? 'active' : '' }}">
                        <a class="nav-link d-flex align-items-center text-capitalize" aria-current="page" href="{{ route('view_transactions') }}">
                            Job
                        </a>
                    </li>
                    <li class="nav-item {{ Request::segment(1) == 'clients' ? 'active' : '' }}">
                        <a class="nav-link d-flex align-items-center text-capitalize" aria-current="page" href="{{ route('view_clients') }}">
                            Company
                        </a>
                    </li>
                    <li class="nav-item {{ Request::segment(1) == 'zone' ? 'active' : '' }}">
                        <a class="nav-link d-flex align-items-center text-capitalize" aria-current="page" href="{{ route('view_zone') }}">
                            Zone
                        </a>
                    </li>
                    <li class="nav-item dropdown {{ Request::segment(1) == 'config' ? 'active' : '' }}">
                        <a class="nav-link dropdown-toggle" href="#" id="dropdownConfig" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                            Configuration
                        </a>
                        <ul class="dropdown-menu" style="right: 0; left: auto;" aria-labelledby="dropdownConfig">
                            {{-- <li>
                                <a class="dropdown-item {{ Request::segment(2) == 'rates' ? 'active' : '' }}" href="{{ route('view_config_rates') }}" title="">Harga</a>
                            </li>
                            <li>
                                <a class="dropdown-item {{ Request::segment(2) == 'pockets' ? 'active' : '' }}" href="{{ route('view_config_pockets') }}" title="">Uang Saku</a>
                            </li> --}}
                            {{-- <li>
                                <a class="dropdown-item {{ Request::segment(2) == 'static_insurances' ? 'active' : '' }}" href="{{ route('view_config_static_insurances') }}" title="">Asuransi</a>
                            </li> --}}
                            <li>
                                <a class="dropdown-item {{ Request::segment(2) == 'truck_types' ? 'active' : '' }}" href="{{ route('view_config_truck_types') }}" title="">Vehicle Type</a>
                            </li>
                            <li>
                                <a class="dropdown-item {{ Request::segment(2) == 'devices' ? 'active' : '' }}" href="{{ route('view_config_devices') }}" title="">Master Devices</a>
                            </li>
                            <li>
                                <a class="dropdown-item {{ Request::segment(2) == 'logs_gps' ? 'active' : '' }}" href="{{ route('view_config_logs_gps') }}" title="">Logs Gps</a>
                            </li>
                            {{-- <li>
                                <a class="dropdown-item {{ Request::segment(2) == 'a_items' ? 'active' : '' }}" href="{{ route('view_adm_a_items') }}" title="">additional item</a>
                            </li> --}}
                            {{-- <li>
                                <a class="dropdown-item {{ Request::segment(2) == 'menu_permissions' ? 'active' : '' }}"
                                    href="{{ route('view_adm_menu_permissions') }}" title="">Menu Permissions</a>
                            </li> --}}
                            {{-- <li>
                                <a class="dropdown-item {{ Request::segment(2) == 'logbook_types' ? 'active' : '' }}" href="{{ route('view_config_lgb_types') }}" title="">Tipe Logbook</a>
                            </li> --}}
                            {{-- <li>
                                <a class="dropdown-item {{ Request::segment(2) == 'logbook_keys' ? 'active' : '' }}" href="{{ route('view_config_lgb_keys') }}" title="">Master Logbook</a>
                            </li> --}}
                        </ul>
                    </li>
                @endif
                {{-- only admin and vendor --}}
                @if ($user_role === \App\Models\Users::ROLE_ADMIN || $user_role === \App\Models\Users::ROLE_VENDOR)
                    {{-- @if ($user_role === \App\Models\Users::ROLE_ADMIN) --}}
                    <li class="nav-item {{ Request::segment(1) == 'drivers' ? 'active' : '' }}">
                        <a class="nav-link d-flex align-items-center text-capitalize" aria-current="page" href="{{ route('view_drivers') }}">
                            Driver
                        </a>
                    </li>
                    <li class="nav-item {{ Request::segment(1) == 'vehicles' ? 'active' : '' }}">
                        <a class="nav-link d-flex align-items-center text-capitalize" aria-current="page" href="{{ route('view_vehicles') }}">
                            Vehicle
                        </a>
                    </li>
                @endif
                <li class="nav-item {{ Request::segment(1) == 'users' ? 'active' : '' }}">
                    <a class="nav-link d-flex align-items-center text-capitalize" aria-current="page" href="{{ route('view_users') }}">
                        User
                    </a>
                </li>

                {{-- only admin and client --}}
                {{-- @if ($user_role === \App\Models\Users::ROLE_ADMIN || $user_role === \App\Models\Users::ROLE_CLIENT_ADMIN)
                    <li class="nav-item {{ Request::segment(1) == 'transactions' ? 'active' : '' }}">
                        <a class="nav-link d-flex align-items-center text-capitalize" aria-current="page"
                            href="{{ route('view_transactions') }}">
                            Transactions
                        </a>
                    </li>
                @endif --}}
                {{-- only client --}}
                @if ($user_role === \App\Models\Users::ROLE_CLIENT_ADMIN)
                    <li class="nav-item {{ Request::path() == 'user/clients/transactions' || Request::path() == 'user/clients/transactions/addNew' || Request::path() == 'user/clients/transactions/view' ? 'active' : '' }}">
                        <a class="nav-link d-flex align-items-center text-capitalize" aria-current="page" href="{{ route('view_user_client_transaction') }}">
                            Transaction
                        </a>
                    </li>
                    {{-- <li class="nav-item {{ Request::segment(1) == 'zone' ? 'active' : '' }}">
                        <a class="nav-link d-flex align-items-center text-capitalize" aria-current="page"
                            href="{{ route('view_zone') }}">
                            Zone
                        </a>
                    </li> --}}
                @endif
                {{-- only checker --}}
                @if ($user_role === \App\Models\Users::ROLE_CHECKER)
                    <li class="nav-item {{ Request::path() == 'user/checker' || Request::path() == 'user/checker/view' ? 'active' : '' }}">
                        <a class="nav-link d-flex align-items-center text-capitalize" aria-current="page" href="{{ route('view_user_checker') }}">
                            Checker
                        </a>
                    </li>
                @endif
                {{-- all roles --}}
                @if ($user_role === \App\Models\Users::ROLE_ADMIN || $user_role === \App\Models\Users::ROLE_VENDOR || $user_role === \App\Models\Users::ROLE_CLIENT_ADMIN)
                    {{-- <li class="nav-item">
                            <a class="nav-link d-flex align-items-center text-capitalize" aria-current="page"
                                href="javascrript:void(0);">
                                Reports
                            </a>
                        </li> --}}
                @endif
                @if ($user_role === \App\Models\Users::ROLE_FINANCE)
                    <li class="nav-item {{ Request::segment(1) == 'dashboard' ? 'active' : '' }}">
                        <a class="nav-link d-flex align-items-center text-capitalize" aria-current="page" href="#">
                            Dashboard
                        </a>
                    </li>
                    <li class="nav-item {{ Request::segment(3) == 'ledgerBalanceList' ? 'active' : '' }}">
                        <a class="nav-link d-flex align-items-center text-capitalize" aria-current="page" href="{{ route('view_ledger_balance') }}">
                            Ledger Balance
                        </a>
                    </li>
                    <li class="nav-item dropdown {{ Request::segment(2) == 'payment' ? 'active' : '' }}">
                        <a class="nav-link" href="{{ route('view_keuangan_payment') }}" id="" role="button" aria-expanded="false">
                            Pembayaran
                        </a>
                    </li>
                    <li class="nav-item dropdown {{ Request::segment(2) == 'billing' ? 'active' : '' }}">
                        <a class="nav-link" href="{{ route('view_keuangan_billing') }}" id="" role="button" aria-expanded="false">
                            Penagihan
                        </a>
                    </li>
                    <li class="nav-item dropdown {{ Request::segment(2) == 'pocket_tf_history' ? 'active' : '' }}">
                        <a class="nav-link" href="{{ route('view_fiinance_pocket_tf_history') }}" id="" role="button" aria-expanded="false">
                            Riwayat Transfer Uang Saku
                        </a>
                    </li>
                    <li class="nav-item dropdown {{ Request::segment(2) == 'config' ? 'active' : '' }}">
                        <a class="nav-link dropdown-toggle" href="#" id="" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                            Konfigurasi
                        </a>
                        <ul class="dropdown-menu" style="right: 0; left: auto;" aria-labelledby="">
                            <li>
                                <a class="dropdown-item {{ Request::segment(3) == 'a_items' ? 'active' : '' }}" href="{{ route('view_a_items') }}" title="">additional item</a>
                            </li>
                            <li>
                                <a class="dropdown-item {{ Request::segment(3) == 'dana' ? 'active' : '' }}" href="{{ route('view_finance_dana') }}" title="">Dana</a>
                            </li>
                        </ul>
                    </li>
                @endif
            </ul>
            <ul class="navbar-nav ms-auto my-2 my-lg-0 navbar-nav-scroll">
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                        Hello, {{ mb_strimwidth(Auth::user()->first_name, 0, 12, '...') }}
                    </a>
                    <ul class="dropdown-menu" style="right: 0; left: auto;" aria-labelledby="navbarDropdownMenuLink">
                        <li>
                            {{-- <a class="dropdown-item" href="javascript:void(0);" title="">My Profile</a> --}}
                            <a class="dropdown-item" href="{{ route('view_profile') }}" title="">My Profile</a>
                        </li>
                        <li>
                            <a class="dropdown-item" href="#" title="Log Out" onclick="event.preventDefault(); document.getElementById('logout-form').submit();" style="font-size: 12px">
                                Logout
                                <form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
                                    @csrf
                                </form>
                            </a>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
        {{-- <p class="mb-0" id="time"></p> --}}
    </div>
</nav>
{{-- @if ($user_role == \App\Models\Users::ROLE_ADMIN)
    <div class="sub-nav shadow" id="subNav">
        <div class="container-fluid">
            <div class="row d-flex align-items-center">
                <div class="col-auto">
                    <p class="text-bold mb-0">FLEET MANAGER</p>
                </div>
                <div class="col-5 d-flex align-items-center">
                    <span class="me-2">Company</span>
                    <select name="filter-company" class="select2 form-control" id="filter-company" style="width:100%;">
                        <option value="all">Semua Company</option>
                    </select>
                </div>
            </div>
        </div>
    </div>
@endif --}}
