<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>

        <!-- CSRF Token -->
        <meta name="csrf-token" content="{{ csrf_token() }}">

        <title>{{ config('app.name', 'Laravel') }}</title>
		<link rel="icon" href="{{ asset('img/wm_icon.png') }}" sizes="16x16 32x32" type="image/png">

        <!-- Scripts -->
        <script src="{{ asset('js/app.js') }}" defer></script>

        <!-- Fonts -->
        <link rel="dns-prefetch" href="//fonts.gstatic.com">
        <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">

        <!-- Styles -->
        <link href="{{ asset('css/app.css') }}" rel="stylesheet">
        <link rel="stylesheet" href="{{ asset('css/sidebar.css') }}">
        <!-- Bootstrap Js -->

        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
        <script src="https://kit.fontawesome.com/95e6e4ca72.js" crossorigin="anonymous"></script>

        <script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
        <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
        <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />

		<!-- Início Data Tables -->
		<link href="https://datatables.net/download/build/nightly/jquery.dataTables.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" href="{{ asset('css/datatables.css') }}">
		<script src="{{ asset('js/script.js') }}"></script>
		<script src="{{ asset('js/jquery.dataTables.min.js') }}"></script>
        <!-- Final Data Tables -->


        <script>
                function startTime() {
                    var today = new Date();
                    var h = today.getHours();
                    var m = today.getMinutes();
                    var s = today.getSeconds();
                    m = checkTime(m);
                    s = checkTime(s);
                    document.getElementById('txt').innerHTML =
                    h + ":" + m + ":" + s;
                    var t = setTimeout(startTime, 500);
                }
                function checkTime(i) {
                    if (i < 10) {i = "0" + i};  // add zero in front of numbers < 10
                    return i;
                }
            </script>

    </head>
    <body onload="startTime()">
        <div id="app">
            <div class="d-flex" id="wrapper">
                <!-- sidebar -->
                <div class="sidebar sidebar-lighten">
                    <div class="dashheader-darker">
                        <img src="{{ asset('img/wm_icon.png') }}" style="width: 38px;">
                        <span style="color: white; margin: 0px 10px;">WM digital.</span>
                    </div>
                    <!-- Profile -->
                    <div class="col-profile">
                        <div class="profile-container">
                        <div class="profile-photo one">

                        </div>
                            <ul class="profile-name">
                                <!-- Authentication Links -->
                                @guest
                                    <li class="nav-item">
                                        <a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
                                    </li>
                                    @if (Route::has('register'))
                                        <li class="nav-item">
                                            <a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
                                        </li>
                                    @endif
                                    @else
                                    <li class="nav-item dropdown">
                                        <a >
                                            {{ Auth::user()->name }} <span class="caret"></span>
                                        </a>
                                        <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
                                            <a class="dropdown-item" href="{{ route('logout') }}"
                                                onclick="event.preventDefault();
                                                                document.getElementById('logout-form').submit();">
                                                {{ __('Logout') }}
                                            </a>
                                            <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                                @csrf
                                            </form>
                                        </div>
                                    </li>
                                @endguest
                            </ul>

                        </div>
                        <a href="{{ route('logout') }}"
                            onclick="event.preventDefault();
                                            document.getElementById('logout-form').submit();"><i class="fas fa-power-off" data-toggle="tooltip" data-placement="bottom" title="Logout"></i>
                            </a>
                    </div>
                    <!-- sidebar menu -->
                    <div class="sidebar-menu ">
                        <!-- menu -->
                        <ul class="list list-unstyled list-scrollbar">
                            <!-- simple menu -->
                            @can('edit-users')
                            <li class="list-item">
                                <p class="list-title text-uppercase">ADMIN</p>
                                <ul class="list-unstyled">
                                    <li><a href="{{ route('users.index') }}" class="list-link current">Usuários</a></li>
                                </ul>
                            </li>
                            @endcan
                            <li class="list-item">
                                <p class="list-title text-uppercase">LEADS</p>
                                <ul class="list-unstyled">
                                    @can('edit-users')
                                    <li><a href="{{ route('leads.index') }}" class="list-link current">Leads Master</a></li>
                                    <li><a href="{{ route('leads.remalho') }}" class="list-link current">Remalho</a></li>
                                    @endcan
                                    <li><a href="{{ route('myleads.index') }}" class="list-link current">Minhas Leads</a></li>
                                </ul>
                            </li>
                            <li class="list-item">
                                <p class="list-title text-uppercase">PROPOSTAS</p>
                                <ul class="list-unstyled">
                                    @can('edit-users')
                                    <li><a href="{{ route('leads.relatorios') }}" class="list-link current">Relatórios</a></li>
                                    @endcan
                                </ul>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="content">
                    <!-- header -->
                    <div class="dashheader-lighter">
                        <!-- Header/Toolbar -->
                        <span class="navbar-text">
                            <a id="sidebar-toggle" class="navbar-bars">
                                <i class="fa fa-bars" aria-hidden="true" style="font-size: 20px;"></i>
                            </a>
                        </span>
                        <a href="{{ url('/home') }}" class="headlink">Home</a>
                        <a class="headlink">Suporte</a>
                        <span style="margin-left: auto;"><span id="txt"></span> - <span id="dayname"></span>, <span id="day"></span>/<span id="month"></span>/<span id="year"></span></span>
                        <a class="nav-badge">
                            <i class="far fa-bell"></i>
                            <span class="badge badge-warning navbar-badge">15</span>
                        </a>
                    </div>
                    <!-- START Conteúdo Yield -->
                    <main class="py-4">
                        @yield('content')
                    </main>
                    <!-- END Conteúdo Yield -->
                </div>
            </div>
        </div>
    </body>
</html>
<script src="{{ asset('js/sidebar.menu.js') }}"></script>
<script>
    var d = new Date();
    document.getElementById("year").innerHTML = d.getFullYear();
    document.getElementById("month").innerHTML = d.getMonth() + 1;
    document.getElementById("day").innerHTML = d.getDate();

    var d = new Date();
    var weekday = new Array(7);
    weekday[0] = "Domingo";
    weekday[1] = "Segunda-Feira";
    weekday[2] = "Terça-Feira";
    weekday[3] = "Quarta-Feira";
    weekday[4] = "Quinta-Feira";
    weekday[5] = "Sexta-Feira";
    weekday[6] = "Sábado";

    var n = weekday[d.getDay()];
    document.getElementById("dayname").innerHTML = n;
</script>


<script>
$(function () {
  $('[data-toggle="tooltip"]').tooltip()
})
</script>


<script language='javascript' type='text/javascript'>
    var proposta = document.getElementById("proposta")
    , proposta_confirm = document.getElementById("proposta_confirm");

    function validatePassword(){
    if(proposta.value != proposta_confirm.value) {
        proposta_confirm.setCustomValidity("Valores precisam ser iguais.");
    } else {
        proposta_confirm.setCustomValidity('');
    }
    }

    proposta.onchange = validatePassword;
    proposta_confirm.onkeyup = validatePassword;
</script>

<script>
    const pasteBox = document.getElementById("proposta_confirm");
    pasteBox.onpaste = e => {
      e.preventDefault();
      return false;
    };
  </script>

<script>
    $('#demo').daterangepicker({
        "showDropdowns": true,
        "showWeekNumbers": true,
        "timePicker": true,
        "timePicker24Hour": true,
        "timePickerSeconds": true,
        ranges: {
            'Hoje': [moment(), moment()],
            'Ontem': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
            '7 Dias': [moment().subtract(6, 'days'), moment()],
            '30 Dias': [moment().subtract(29, 'days'), moment()],
            'Este Mês': [moment().startOf('month'), moment().endOf('month')],
            'Último Mês': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
        },
        "locale": {

            "format": "YYYY-MM-DD HH:mm:ss",
            "separator": " ~ ",
            "applyLabel": "Aplicar",
            "cancelLabel": "Cancelar",
            "fromLabel": "De",
            "toLabel": "Até",
            "customRangeLabel": "Período",
            "weekLabel": "S",
            "daysOfWeek": [
                "Dom",
                "Seg",
                "Ter",
                "Qua",
                "Qui",
                "Sex",
                "Sáb"
            ],
            "monthNames": [
                "Janeiro",
                "Fevereiro",
                "Março",
                "Abril",
                "Maio",
                "Junho",
                "Julho",
                "Agosto",
                "Setembro",
                "Outubro",
                "Novembro",
                "Dezembro"
            ],
            "firstDay": 1,
            startDate: moment().startOf('hour'),
            endDate: moment().startOf('hour').add(32, 'hour')
        },
        "alwaysShowCalendars": true
    }, function(start, end, label) {
      console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')');
    });
    </script>
<script>
    $(document).ready( function () {
    $('#table_id').DataTable();
} );
</script>
