@include('layout/loading')
<nav class="sidebar sidebar-offcanvas" id="sidebar">
    <ul class="nav">

        @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['view_dashboard']))
            <li class="nav-item {{ request()->is('dashboard') ? 'active' : '' }}">
                <a class="nav-link" href="{{ route('homepage') }}">
                    <i class="mdi mdi-ballot menu-icon"></i>
                    <span class="menu-title text-uppercase">{{ __('sidebar.dashboard') }}</span>
                </a>
            </li>
        @endif


        @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['view_sample','create_sample']))
            <li class="nav-item {{ request()->segment(1) == 'sample' ? 'active' : '' }}">
                <a class="nav-link" data-toggle="collapse" href="#samples" aria-expanded="false" aria-controls="laboratory">
                    <i class="mdi mdi-account-child-circle menu-icon"></i>
                    <span class="menu-title text-uppercase">{{ __('sidebar.aliquot_management') }}</span>
                    <i class="menu-arrow"></i>
                </a>
                <div class="collapse {{ in_array(request()->segment(1), ['sample']) ? 'show' : '' }}" id="samples">
                    <ul class="nav flex-column sub-menu">
                        @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['create_sample']))
                            <li class="nav-item"> <a class="nav-link {{ (request()->segment(1) == 'sample' && request()->segment(2)=='new') ? 'active' : '' }}" href="{{url('sample/new')}}">{{ __('sidebar.new_sample') }}</a></li>
                        @endif
                        @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['view_sample']))
                            <li class="nav-item"> <a class="nav-link {{ (request()->segment(1) == 'sample' && (request()->segment(2)=='search' || request()->segment(2)=='')) ? 'active' : '' }}" href="{{url('sample/search?kword=&sample_date=today')}}">{{ __('sidebar.view_sample') }}</a></li>
                        @endif

                    </ul>
                </div>
            </li>
        @endif

        @if(\App\Http\Controllers\Helper\GlobalController::user_can(Auth::user()->role_id, ['generate_doctor_report','generate_summary_report', 'generate_financial_report']))
            <li class="nav-item {{ request()->segment(1) == 'report' ? 'active' : '' }}">
                <a class="nav-link" data-toggle="collapse" href="#reports" aria-expanded="false" aria-controls="reports">
                    <i class="mdi mdi-chart-bar-stacked menu-icon"></i>
                    <span class="menu-title text-uppercase">{{ __('sidebar.report') }}</span>
                    <i class="menu-arrow"></i>
                </a>
                <div class="collapse {{ in_array(request()->segment(1), ['report']) ? 'show' : '' }}" id="reports">
                    <ul class="nav flex-column sub-menu">

                    </ul>
                </div>
            </li>
        @endif

        <li class="nav-item {{ in_array(request()->segment(1), ['incident-type']) ? 'active' : '' }}">
            <a class="nav-link" data-toggle="collapse" href="#incident-record" aria-expanded="false" aria-controls="incident-record">
                <i class="mdi mdi-oil-temperature menu-icon"></i>
                <span class="menu-title text-uppercase">{{ __('sidebar.incident_records') }}</span>
                <i class="menu-arrow"></i>
            </a>
            <div class="collapse {{ in_array(request()->segment(1), ['incident-type']) ? 'show' : '' }}" id="incident-record">
                <ul class="nav flex-column sub-menu">
                    <li class="nav-item"> <a class="nav-link" href="">{{ __('sidebar.incident_table') }}</a></li>
                    <li class="nav-item"> <a class="nav-link {{request()->segment(1)=='incident-type' ? 'active':''}}" href="{{url('incident-type')}}">{{ __('sidebar.incident_type') }}</a></li>
                </ul>
            </div>
        </li>

        <li class="nav-item {{ in_array(request()->segment(1), ['building', 'room', 'equipment', 'rack', 'box']) ? 'active' : '' }}">
            <a class="nav-link" data-toggle="collapse" href="#lab-manager" aria-expanded="false" aria-controls="lab_manager">
                <i class="fa fa-folder-open-o menu-icon"></i>
                <span class="menu-title text-uppercase">{{ __('sidebar.management') }}</span>
                <i class="menu-arrow"></i>
            </a>
            <div class="collapse {{ in_array(request()->segment(1), ['building', 'room', 'equipment', 'rack', 'box']) ? 'show' : '' }}" id="lab-manager">
                <ul class="nav flex-column sub-menu">
                    <li class="nav-item"> <a class="nav-link {{request()->segment(1)=='building' ? 'active':''}}" href="{{url('building')}}">{{ __('sidebar.building') }}</a></li>
                    <li class="nav-item"> <a class="nav-link {{request()->segment(1)=='room' ? 'active':''}}" href="{{url('room')}}">{{ __('sidebar.safe_room') }}</a></li>
                    <li class="nav-item"> <a class="nav-link {{request()->segment(1)=='equipment' ? 'active':''}}" href="{{url('equipment')}}">{{ __('sidebar.freezer') }}</a></li>
                    <li class="nav-item"> <a class="nav-link {{request()->segment(1)=='rack' ? 'active':''}}" href="{{url('rack')}}">{{ __('sidebar.rack') }}</a></li>
                    <li class="nav-item"> <a class="nav-link {{request()->segment(1)=='box' ? 'active':''}}" href="{{url('box')}}">{{ __('sidebar.sample_box') }}</a></li>
                </ul>
            </div>
        </li>

        <li class="nav-item {{ in_array(request()->segment(1), ['concept', 'sample-container', 'pathogen']) ? 'active' : '' }}">
            <a class="nav-link" data-toggle="collapse" href="#catalog" aria-expanded="false" aria-controls="catalog">
                <i class="mdi mdi-cards-variant menu-icon"></i>
                <span class="menu-title text-uppercase">{{ __('sidebar.reference_lists') }}</span>
                <i class="menu-arrow"></i>
            </a>
            <div class="collapse {{ in_array(request()->segment(1), ['concept', 'sample-container', 'pathogen']) ? 'show' : '' }}" id="catalog">
                <ul class="nav flex-column sub-menu">
                    <li class="nav-item"> <a class="nav-link {{request()->segment(1)=='concept' ? 'active':''}}" href="{{url('concept')}}">{{ __('sidebar.reference_lists') }}</a></li>
                    <li class="nav-item"> <a class="nav-link {{request()->segment(1)=='pathogen' ? 'active':''}}" href="{{url('pathogen')}}">{{ __('sidebar.pathogen_type') }}</a></li>
                    <li class="nav-item"> <a class="nav-link {{request()->segment(1)=='sample-container' ? 'active':''}}" href="{{url('sample-container')}}">{{ __('sidebar.sample_container_type') }}</a></li>
                </ul>
            </div>
        </li>

        <li class="nav-item {{ request()->is('my-profile') ? 'active' : '' }}">
            <a class="nav-link" href="{{ url('my-profile') }}">
                <i class="mdi mdi-account-circle menu-icon"></i>
                <span class="menu-title text-uppercase">{{ __('general.profile') }}</span>
            </a>
        </li>

    </ul>
</nav>
