@extends('layouts.app')

@section('content')
    <div id="sidebar" class='active'>
        <div class="sidebar-wrapper active" style="overflow: auto;" id="mydiv">
            <div class="sidebar-header">
                <img src="{{ asset('images/logo.png') }}" alt="" srcset="">
            </div>
            <div class="sidebar-menu">
                <ul class="menu">
                    <li class="sidebar-title">PRINCIPAL</li>
                    <li class="sidebar-item {{ \Route::currentRouteName() == 'home' ? 'active' : '' }}">
                        <a href="{{ route('home') }}" class='sidebar-link'>
                            <i data-feather="home" width="20"></i>
                            <span>Inicio</span>
                        </a>
                    </li>

                    <li class="sidebar-title">COTIZACIÓN</li>

                    <li class="sidebar-item {{ Request::path() == 'cotizaciones/crear' ? 'active' : '' }}">
                        <a href="{{ url('cotizaciones/crear') }}" class='sidebar-link'>
                            <i data-feather="shopping-bag" width="20"></i>
                            <span>Crear nueva cotización</span>
                        </a>
                    </li>
                    <li class="sidebar-item {{ \Route::currentRouteName() == 'quotes' ? 'active' : '' }}">
                        <a href="{{ url('cotizaciones') }}" class='sidebar-link'>
                            <i data-feather="shopping-bag" width="20"></i>
                            <span>Cotizaciones realizadas</span>
                        </a>
                    </li>

                    <li class="sidebar-title">RECLAMACIÓN</li>

                    <li class="sidebar-item {{ Request::path() == 'reclamaciones/crear' ? 'active' : '' }}">
                        <a href="{{ url('reclamaciones/crear') }}" class='sidebar-link'>
                            <i data-feather="shopping-bag" width="20"></i>
                            <span>Crear nueva reclamación</span>
                        </a>
                    </li>

                    <li class="sidebar-item {{ \Route::currentRouteName() == 'claims' ? 'active' : '' }}">
                        <a href="{{ url('reclamaciones') }}" class='sidebar-link'>
                            <i data-feather="shopping-bag" width="20"></i>
                            <span>Histórico de reclamaciones</span>
                        </a>
                    </li>

                    @if (Auth::user()->type == 'admin')
                        <li class="sidebar-title">CONFIGURACIÓN</li>

                        <li class="sidebar-item {{ Request::path() == 'productos' ? 'active' : '' }}">
                            <a href="{{ url('productos') }}" class='sidebar-link'>
                                <i data-feather="shopping-bag" width="20"></i>
                                <span>Productos</span>
                            </a>
                        </li>

                        <li class="sidebar-item {{ Request::path() == 'aseguradoras' ? 'active' : '' }}">
                            <a href="{{ url('aseguradoras') }}" class='sidebar-link'>
                                <i data-feather="trello" width="20"></i>
                                <span>Aseguradoras</span>
                            </a>
                        </li>

                        <li class="sidebar-item {{ Request::path() == 'usuarios' ? 'active' : '' }}">
                            <a href="{{ url('usuarios') }}" class='sidebar-link'>
                                <i data-feather="user" width="20"></i>
                                <span>Usuarios</span>
                            </a>
                        </li>
                    @endif

                    {{-- Gestionar vehiculos --}}
                    <li class="sidebar-title">Gestionar encuesta</li>
                    <li class="sidebar-item {{ Route::is('polls.*') ? 'active' : '' }}">
                        <a href="{{ route('polls.index') }}" class='sidebar-link'>
                            <i data-feather="bar-chart-2" width="20"></i>
                            <span>Encuestas</span>
                        </a>
                    </li>

                    {{-- Gestionar vehiculos --}}
                    <li class="sidebar-title">COTIZADOR DE VEHÍCULO</li>

                    <li class="sidebar-item {{ Route::is('vehicle-quote.quotes.create') ? 'active' : '' }}">
                        <a href="{{ route('vehicle-quote.quotes.create') }}" class='sidebar-link'>
                            <i data-feather="shopping-bag" width="20"></i>
                            <span>Realizar cotización</span>
                        </a>
                    </li>

                    <li class="sidebar-item {{ Route::is('vehicle-quote.quotes.index') ? 'active' : '' }}">
                        <a href="{{ route('vehicle-quote.quotes.index') }}" class='sidebar-link'>
                            <i data-feather="shopping-bag" width="20"></i>
                            <span>Histórico de cotizaciones</span>
                        </a>
                    </li>
                    {{-- {{ dd(Route::is('vehicle-quote.manage-vehicle.*')) }} --}}
                    <li class="sidebar-item {{ Route::is('vehicle-quote.manage-vehicle.*') ? 'active' : '' }}">
                        <a href="{{ route('vehicle-quote.manage-vehicle.index') }}" class='sidebar-link'>
                            <i data-feather="shopping-bag" width="20"></i>
                            <span>Gestionar Vehículo</span>
                        </a>
                    </li>

                    <li class="sidebar-item {{ Route::is('vehicle-quote.manage-insurers.*') ? 'active' : '' }}">
                        <a href="{{ route('vehicle-quote.manage-insurers.index') }}" class='sidebar-link'>
                            <i data-feather="shopping-bag" width="20"></i>
                            <span>Gestionar Aseguradoras</span>
                        </a>
                    </li>

                    <li class="sidebar-item {{ Route::is('vehicle-quote.items.*') ? 'active' : '' }}">
                        <a href="{{ route('vehicle-quote.items.index') }}" class='sidebar-link'>
                            <i data-feather="shopping-bag" width="20"></i>
                            <span>Gestionar Items a cotizar</span>
                        </a>
                    </li>

                    <li class="sidebar-item {{ Route::is('vehicle-quote.customers.*') ? 'active' : '' }}">
                        <a href="{{ route('vehicle-quote.customers.index') }}" class='sidebar-link'>
                            <i data-feather="user" width="20"></i>
                            <span>Gestionar Clientes</span>
                        </a>
                    </li>
                </ul>
            </div>
            <button class="sidebar-toggler btn x"><i data-feather="x"></i></button>
        </div>
    </div>

    <div id="main">
        <nav class="navbar navbar-header navbar-expand navbar-light">
            <a class="sidebar-toggler" href="#"><span class="navbar-toggler-icon"></span></a>
            <button class="btn navbar-toggler" type="button" data-toggle="collapse"
                data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
                aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarSupportedContent">
                <ul class="navbar-nav d-flex align-items-center navbar-light ml-auto">
                    <li class="dropdown">
                        <a href="#" data-toggle="dropdown"
                            class="nav-link dropdown-toggle nav-link-lg nav-link-user">
                            <div class="avatar mr-1">
                                <img src="{{ Auth::user()->ui_avatar }}" alt="" srcset="">
                            </div>
                            <div class="d-none d-md-block d-lg-inline-block">Hola, {{ Auth::user()->name }}</div>
                        </a>
                        <div class="dropdown-menu dropdown-menu-right">
                            {{-- <a class="dropdown-item" href="#"><i data-feather="user"></i> Perfil</a>
                            <div class="dropdown-divider"></div> --}}
                            <a class = "dropdown-item" href="{{ route('profile') }}">
                                <i data-feather="lock"></i>
                                    <span class="menu-title">{{ __('Actualizar contraseña') }}</span>
                                </a>
                            <div class="dropdown-divider"></div>

                            <a class="dropdown-item" href="{{ route('logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
                                <i data-feather="log-out"></i> Cerrar Sesión
                            </a>
                            <form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
                                @csrf
                            </form>
                        </div>
                    </li>
                </ul>
            </div>
        </nav>

        <div class="main-content container-fluid">
            @if (!empty($page_title))
                <div class="page-title">
                    <h3>{{ $page_title }}</h3>
                    @if (!empty($page_title_sub))
                        <p class="text-subtitle text-muted">{{ $page_title_sub }}</p>
                    @endif
                </div>
            @endif

            @if (session('status'))
                <div class="alert alert-success" role="alert">
                    {{ session('status') }}
                </div>
            @endif

            @yield('main')
        </div>

        <footer>
            <div class="footer clearfix mb-0 text-muted">
                <div class="float-left">
                    <p>2020 &copy; {{ config('app.name') }}</p>
                </div>
                <div class="float-right">
                    <p>Developed by <a href="https://ktech.com.do/">Ktech Solutions</a></p>
                </div>
            </div>
        </footer>
    </div>
@endsection
