{{-- Common between Admin, Customer & Organiser --}}
<li class="nav-item dropdown ">
    @php
        $data = notifications();
    @endphp

    <a class="nav-link dropdown-toggle" href="javascript:void(0)" id="blogDropdown" role="button" data-bs-toggle="dropdown"
        aria-expanded="false" v-pre>
        <span class="position-relative btn btn-sm btn-primary badge">
            <i class="fas fa-bell text-white"> </i>
            @if ($data['total_notify'] > 0)
                <span class="position-absolute top-0 start-100 translate-middle p-1 bg-danger rounded-circle"></span>
            @endif
        </span>
        <i class="fas fa-caret-down"></i>
    </a>
    <ul class="dropdown-menu" aria-labelledby="blogDropdown">
        @if (!empty($data['notifications']))
            @foreach ($data['notifications'] as $notification)
                <li class="nav-item dropdown">
                    <a class="dropdown-item" href="{{ route('eventmie.notify_read', [$notification->n_type]) }}">
                        {{ $notification->total }}
                        @if ($notification->n_type == 'user')
                            @lang('eventmie-pro::em.user')
                        @elseif($notification->n_type == 'cancel')
                            @lang('eventmie-pro::em.booking_cancellation')
                        @elseif($notification->n_type == 'review')
                            @lang('eventmie-pro::em.show_reviews')
                        @elseif($notification->n_type == 'contact')
                            @lang('eventmie-pro::em.contact')
                        @elseif($notification->n_type == 'events')
                            @lang('eventmie-pro::em.event')
                        @elseif($notification->n_type == 'Approve-Organizer')
                            @lang('eventmie-pro::em.requested_to_become_organiser')
                        @elseif($notification->n_type == 'Approved-Organizer')
                            @lang('eventmie-pro::em.became_organiser_successful')
                        @elseif($notification->n_type == 'bookings')
                            @lang('eventmie-pro::em.booking')
                        @elseif($notification->n_type == 'forgot_password')
                            @lang('eventmie-pro::em.reset_password')
                        @endif
                    </a>
                </li>
            @endforeach
        @else
            <li class="nav-item dropdown">
                <a class="dropdown-item"> @lang('eventmie-pro::em.no_notifications')</a>
            </li>
        @endif
    </ul>
</li>

<li class="nav-item dropdown">
    <a class="nav-link dropdown-toggle" href="javascript:void(0)" id="blogDropdown" role="button"
        data-bs-toggle="dropdown" aria-expanded="false" v-pre>
        @if (Auth::user()->hasRole('customer'))
            <i class="fas fa-user-circle"></i>
        @elseif(Auth::user()->hasRole('organiser'))
            <i class="fas fa-person-booth"></i>
        @else
            <i class="fas fa-user-shield"></i>
        @endif

        {{ Auth::user()->name }} <i class="fas fa-caret-down"></i>
    </a>
    <ul class="dropdown-menu" aria-labelledby="blogDropdown">

        {{-- Customer --}}
        @if (Auth::user()->hasRole('customer'))
            <li class="nav-item dropdown ">
                <a class="dropdown-item" href="{{ route('eventmie.profile') }}"><i class="fas fa-id-card"></i>
                    @lang('eventmie-pro::em.profile')</a>
            </li>
            <li class="nav-item dropdown ">
                <a class="dropdown-item" href="{{ route('eventmie.mybookings_index') }}"><i 
                        class="fas fa-money-check-alt"></i> @lang('eventmie-pro::em.mybookings')</a>
            </li>
            <li class="nav-item dropdown ">
                <a class="dropdown-item" href="{{ route('eventmie.profile') }}#/becomeOrganiser"><i
                        class="fas fa-person-booth"></i>
                    @lang('eventmie-pro::em.become_organiser')</a>
            </li>
        @endif

        {{-- Organiser --}}
        @if (Auth::user()->hasRole('organiser'))
            <li class="nav-item dropdown">
                <a class="dropdown-item" href="{{ route('eventmie.profile') }}"><i class="fas fa-id-card"></i>
                    @lang('eventmie-pro::em.profile')</a>
            </li>
            <li class="nav-item dropdown">
                <a class="dropdown-item" href="{{ route('eventmie.myevents_form') }}"><i class="fas fa-calendar-plus"></i>
                    @lang('eventmie-pro::em.create_event')</a>
            </li>
            <li class="nav-item dropdown">
                <a class="dropdown-item" href="{{ route('eventmie.o_dashboard') }}"><i
                        class="fas fa-tachometer-alt"></i> @lang('eventmie-pro::em.dashboard')</a>
            </li>
        @endif

        {{-- CUSTOM --}}
        @if (Auth::user()->hasRole('pos'))
            <li class="nav-item dropdown">
                <a class="dropdown-item" href="{{ route('pos.o_dashboard') }}">
                    <i class="fas fa-money-check-alt"></i> @lang('eventmie-pro::em.pos') @lang('eventmie-pro::em.dashboard')</a>
            </li>
        @endif

        @if (Auth::user()->hasRole('scanner'))
            <li class="nav-item dropdown">
                <a class="dropdown-item" href="{{ route('scanner.o_dashboard') }}">
                    <i class="fas fa-money-check-alt"></i> @lang('eventmie-pro::em.scanner') @lang('eventmie-pro::em.dashboard')</a>
            </li>
        @endif
        {{-- CUSTOM --}}


        {{-- Admin --}}
        @if (Auth::user()->hasRole('admin'))
            <li class="nav-item dropdown">
                <a class="dropdown-item" href="{{ eventmie_url() . '/' . config('eventmie.route.admin_prefix') }}"><i
                        class="fas fa-tachometer-alt"></i> @lang('eventmie-pro::em.admin_panel')</a>
            </li>
            <li class="nav-item dropdown">
                <a class="dropdown-item" href="{{ route('eventmie.profile') }}"><i class="fas fa-id-card"></i>
                    @lang('eventmie-pro::em.profile')</a>
            </li>
            <li class="nav-item dropdown">
                <a class="dropdown-item" href="{{ route('eventmie.myevents_form') }}"><i
                        class="fas fa-calendar-plus"></i> @lang('eventmie-pro::em.create_event')</a>
            </li>


            {{-- CUSTOM --}}
            <li class="nav-item dropdown">
                <a class="dropdown-item" href="{{ route('failed-bookings.index') }}"
                    title="@lang('eventmie-pro::em.failed') @lang('eventmie-pro::em.bookings')">
                    <span class="nav-icon"><i class="fa fa-exclamation-triangle"></i></span>
                    <span class="tooltiptext">@lang('eventmie-pro::em.failed') @lang('eventmie-pro::em.bookings')</span>
                </a>
            </li>
            {{-- CUSTOM --}}
            
        @endif

        @if (!app('impersonate')->isImpersonating())
            <li class="nav-item dropdown">
                <a class="dropdown-item" href="{{ route('eventmie.logout') }}"
                    onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
                    <i class="fas fa-sign-out-alt"></i> @lang('eventmie-pro::em.logout')
                </a>
                <form id="logout-form" action="{{ route('eventmie.logout') }}"
                    method="POST" style="display: none;">
                    <input type="hidden" name="_token"
                        value="{{ csrf_token() }}">
                </form>
            </li>
        @else
            <li class="nav-item dropdown">
                <a class="dropdown-item" href="{{ route('impersonate.leave') }}">
                    <i class="fas fa-sign-out-alt"></i>
                    @if (Auth::user()->hasRole('organiser'))
                        @lang('eventmie-pro::em.leave_impersonate_user', ['Users' => 'Organiser'])
                    @endif

                    @if (Auth::user()->hasRole('customer'))
                        @lang('eventmie-pro::em.leave_impersonate_user', ['Users' => 'Customer'])
                    @endif

                    @if (Auth::user()->hasRole('scanner'))
                        @lang('eventmie-pro::em.leave_impersonate_user', ['Users' => 'Scanner'])
                    @endif

                    @if (Auth::user()->hasRole('pos'))
                        @lang('eventmie-pro::em.leave_impersonate_user', ['Users' => 'Pos'])
                    @endif

                    @if (Auth::user()->hasRole('manager'))
                        @lang('eventmie-pro::em.leave_impersonate_user', ['Users' => 'Manager'])
                    @endif

                    @if (Auth::user()->hasRole('suborganizer'))
                        @lang('eventmie-pro::em.leave_impersonate_user', ['Users' => 'Suborganizer'])
                    @endif

                    @if (Auth::user()->hasRole('semi-admin'))
                        @lang('eventmie-pro::em.leave_impersonate_user', ['Users' => 'Semi-Admin'])
                    @endif
                </a>
            </li>
        @endif
    </ul>
</li>

{{-- Organiser or Admin Scanner --}}
@if (Auth::user()->hasRole(['organiser', 'admin', 'scanner']))
<li class="nav-item dropdown">
    <a class="nav-link dropdown-toggle" href="javascript:void(0)" id="blogDropdown" role="button"
        data-bs-toggle="dropdown" aria-expanded="false"><i class="fas fa-qrcode"></i>
        @lang('eventmie-pro::em.scan_ticket') <i class="fas fa-caret-down"></i>
    </a>
    <ul aria-labelledby="blogDropdown" class="dropdown-menu">
        <li class="nav-item dropdown">
            <a class="dropdown-item" href="{{ route('eventmie.scan_ticket_camera') }}">
                <i class="fas fa-qrcode"></i>
                @lang('eventmie-pro::em.camera_ticket_scanner')
            </a>
        </li>

        <li class="nav-item dropdown">
            <a class="dropdown-item" href="{{ route('eventmie.scan_ticket_laser') }}">
                <i class="fas fa-barcode"></i>
                @lang('eventmie-pro::em.laser_ticket_scanner')
            </a>
        </li>
    </ul>
</li>
@endif