<!DOCTYPE html>
<html lang="it">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>{{env('APP_NAME', 'Admin')}}</title>

  <link rel="stylesheet" href="https://use.typekit.net/dit2bgs.css">

  @livewireStyles

  <style>
  .page-link.active, .active > .page-link
  {

    background-color: #006099 !important;
    border-color: var(--bs-pagination-active-border-color);
  }
  .buttons-print, .buttons-csv, .buttons-excel, .buttons-pdf{
    background-color: #006099 !important;
  }
    .top{
        margin-bottom:20px;
    }
    .bottom{
        margin-top:20px;
    }
    .rightPagination > div.dt-info
    {
        text-align:right;
    }
    .col-4 > div.dt-length
    {
        text-align:center;
    }
    div.dt-container div.dt-length label
    {
        margin-top:10px;
    }
    .was-validated .form-control:invalid, .form-control.is-invalid
    {
        border-width:3px !important;
    }
    .linkMenu
    {
        margin-left:30px;
    }
    .dt-button.dropdown-item
    {
        background-color:#FFFFFF !important;
    }
    .btn-group > button {
        background-color:#FFFFFF !important;
        color: black;
    }
    .card--ui.card--ui_btnCancel, .card--ui.card--ui_btnAddHeaderUser {
        padding: 0.30rem;
    }
    .btn--ui
    {
        -webkit-border-radius: 0.5rem !important;
        background-color:#0C6197 !important;
        font-weight:normal;
    }
    .btn--ui.lightGrey, .btn--ui.extraLightGrey
    {
        -webkit-border-radius: 0.5rem !important;
        background-color:#ffffff !important;
        border: 1px solid grey;
        color: black;
        font-weight:normal;
    }
    label.form-label
    {
        font-size:16px !important;
    }
    .form-control , .form-select
    {
        font-size:16px !important;
        background-color:#ffffff !important;
        border: 1px solid gray !important;
    }
    .select2-selection__rendered
    {
        font-size:16px !important;
    }
    .select2-selection
    {
        background-color:#ffffff !important;
        border: 1px solid gray !important;
    }
    span.title-form
    {
        font-size:16px !important;
    }
    .btn.u
    {
        text-decoration:underline;
    }
    .select2-dropdown
    {
        z-index:9999 !important;
    }
    .numericCol{
        text-align: right !important;
    }
  </style>

    <link rel="stylesheet" href="/css/style.css?v={{date('YmdHis')}}">
    <!-- <link rel="stylesheet" href="/css/style.css"> -->
    <!--<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">-->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">
    <style>
    .btn--ui
    {
        -webkit-border-radius: 0.5rem !important;
        background-color:#0C6197 !important;
        font-weight:normal;
    }
    .btn--ui.lightGrey, .btn--ui.extraLightGrey
    {
        -webkit-border-radius: 0.5rem !important;
        background-color:#ffffff !important;
        border: 1px solid grey;
        color: black;
        font-weight:normal;
    }
    </style>
    @stack('css')
    <link rel="stylesheet" href="/css/extra.css?v={{date('YmdHis')}}">
</head>

<body>
  <div class="container-fluid">

    <div class="row header--gestionale">
        <div class="header--gestionale_logo">
            <a href="/dashboard" class="d-flex align-items-center pb-2 pt-2">
                <img src="{{env('LOGO2', env('LOGO', ''))}}" id="home_logo" class="img-fluid" alt="logo madonnella"/>
            </a>
        </div>
        <div class="header--gestionale_pageTitle d-flex align-items-center justify-content-between">
            <h3 style="color:white;text-transform:uppercase;font-size:30px;">
            @php
            if (Request::is('dashboard'))
                print "Dashboard";
            if (Request::is('members'))
                print "Utenti";
            if (Request::is('members_archive'))
                print "Archivio utenti";
            if (Request::is('suppliers'))
                print "Fornitori";
            if (Request::is('in'))
                print "Entrate";
            if (Request::is('out'))
                print "Uscite";
            if (Request::is('receipts'))
                print "Ricevute";
            if (Request::is('records_in_out'))
                print "Gestionale";
            if (Request::is('records'))
                print "Prima nota";
            if (Request::is('records_old'))
                print "Prima nota";
            if (Request::is('course_member_one'))
                print "Corsi";
            if (Request::is('course_member_two'))
                print "Corsi";
            if (Request::is('course_member'))
                print "Iscritti corsi";
            if (Request::is('calendar'))
                print "Calendario";
            if (Request::is('calendar_remove'))
                print "Elimina lezioni";
            if (Request::is('calendar_settings'))
                print "Impostazioni calendario";
            if (Request::is('course_list'))
                print "Pagamento corsi";
            if (Request::is('reminders'))
                print "Scadenze";
            if (Request::is('settings'))
                print "Impostazioni";
            if (Request::is('categories'))
                print "Gruppi di appartenenza";
            if (Request::is('disciplines'))
                print "Discipline";
            if (Request::is('cards'))
                print "Tesseramenti";
            if (Request::is('course_subscriptions'))
                print "Corsi - Abbonamenti";
            if (Request::is('courses'))
                print "Corsi";
            if (Request::is('course_durations'))
                print "Corsi - Durata";
            if (Request::is('course_frequencies'))
                print "Corsi - Frequenza";
            if (Request::is('course_levels'))
                print "Corsi - Livelli";
            if (Request::is('course_types'))
                print "Corsi - Tipologie";
            if (Request::is('banks'))
                print "Canali finanziari";
            if (Request::is('causals'))
                print "Causali";
            if (Request::is('vats'))
                print "Iva";
            if (Request::is('payment_methods'))
                print "Metodi di pagamento";
            if (Request::is('users'))
                print "Profilo utenti";
            if (Request::is('reports'))
                print "Reports";
            if (Request::is('presence_reports'))
                print "Report presenze";
            if (Request::is('absence_reports'))
                print "Assenze";
            if (Request::is('financial_movements'))
                print "Movimenti finanziari";
            if (Request::is('dynamic_report'))
                print "Report dinamico";
            @endphp
            </h3>

            <div class="header--userprofile d-flex align-items-center">
                <div style="vertical-align: middle;width: 50px;height: 50px;border-radius: 50%;background-color:white;text-align:center">
                    <h3 style="font-size:1.50rem;color:#0C6197">{{substr(Auth::user()->name, 0, 1)}}</h3>
                </div>
                <a href="#" id="link-popover" data-bs-toggle="popover" data-bs-placement="bottom" data-bs-content="Bottom popover">{{Auth::user()->name}} <small>{{Auth::user()->level == 0 ? 'Admin' : 'Worker'}}</small></a>
            </div>

        </div>
    </div>

    <div class="row flex-nowrap position-relative" id="sidebar--wrapper">

        @if(Auth::user()->level != env('LEVEL_INSTRUCTOR', 2))
            <!-- sidebar menu -->
            <div class="sidebar--ui px-0 filterWrapper filterWrapper_open" id="filter--section">

                <a class="d-lg-none sidebar--opener" data-bs-toggle="offcanvas" href="#offcanvasExample" role="button" aria-controls="offcanvasExample">
                        <i class="ico--ui hamburger--menu"></i>
                </a>

                <div class="d-flex flex-column align-items-center align-items-sm-start offcanvas-lg offcanvas-start" tabindex="-1" id="offcanvasExample" aria-labelledby="offcanvasExampleLabel">
                    @if(false)
                        <a href="/dashboard" class="d-flex align-items-center pb-2 pt-2 mb-md-0 me-md-auto text-white text-decoration-none">
                            <img src="{{env('LOGO2', env('LOGO', ''))}}" class="fs-5 d-none d-sm-inline img-fluid" alt="logo madonnella"  style="max-width:200px"/>
                        </a>
                    @endif

                    <div class="offcanvas-header">
                        <img src="{{env('LOGO2', env('LOGO', ''))}}" class="fs-5 d-inline img-fluid" alt="logo madonnella"/>
                            <a class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#offcanvasExample" aria-label="Chiudi">
                            </a>
                    </div>

                    <div class="offcanvas-body w-100">
                    <div id="accordionExample" style="width:100%">
                        <div class="accordion-item">
                            <h2 class="accordion-header linkMenu" id="headingOne" style="margin-top:50px;">
                                <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="{{Request::is('members') || Request::is('suppliers') || Request::is('members_archive') ? 'true' : 'false'}}" aria-controls="collapseOne">
                                    Anagrafiche
                                </button>
                            </h2>
                            <div id="collapseOne" class="accordion-collapse collapse {{Request::is('members') || Request::is('suppliers') || Request::is('members_archive') ? 'show' : ''}}" aria-labelledby="headingOne" data-bs-parent="#accordionExample">
                                <div class="accordion-body">
                                    <ul class="nav nav-pills flex-column align-items-center align-items-sm-start w-100" id="menu-anagrafica" style="margin-top:0px;">
                                        <li class="nav-item" style="{{Request::is('members') ? 'background-color: #c5d9e6;' : ''}}">
                                            <a href="/members" class="nav-link d-flex align-items-center linkMenu">
                                                <span class="ms-3 d-md-inline">Utenti</span>
                                            </a>
                                        </li>
                                        @if(Auth::user()->level == env('LEVEL_ADMIN', 0))
                                            <li class="nav-item"  style="{{Request::is('suppliers') ? 'background-color: #c5d9e6;' : ''}}">
                                                <a href="/suppliers" class="nav-link d-flex align-items-center linkMenu">
                                                    <span class="ms-3 d-md-inline">Fornitori</span>
                                                </a>
                                            </li>
                                        @endif
                                        <li class="nav-item {{Request::is('members_archive') ? "nav-item-active" : ""}}">
                                            <a href="/members_archive" class="nav-link d-flex align-items-center linkMenu">
                                                <span class="ms-3 d-md-inline">Archivio</span>
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="accordion-item">
                            <h2 class="accordion-header linkMenu" id="headingTwo">
                                <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="{{Request::is('in') || Request::is('out') || Request::is('receipts') || Request::is('records_in_out') || Request::is('records') || Request::is('records_old') || Request::is('financial_movements') ? 'true' : 'false'}}" aria-controls="collapseTwo">
                                    Contabilità
                                </button>
                            </h2>
                            <div id="collapseTwo" class="accordion-collapse collapse {{Request::is('in') || Request::is('out') || Request::is('receipts') || Request::is('records_in_out') || Request::is('records') || Request::is('records_old') || Request::is('financial_movements') ? 'show' : ''}}" aria-labelledby="headingTwo" data-bs-parent="#accordionExample">
                                <div class="accordion-body">
                                    <ul class="nav nav-pills flex-column align-items-center align-items-sm-start w-100" id="menu-contabilita" style="margin-top:0px;">
                                        <li class="nav-item" style="{{Request::is('in') ? 'background-color: #c5d9e6;' : ''}}">
                                            <a href="/in" class="nav-link d-flex align-items-center linkMenu">
                                                <span class="ms-3 d-md-inline">Entrate</span>
                                            </a>
                                        </li>
                                        @if(Auth::user()->level == env('LEVEL_ADMIN', 0))
                                            <li class="nav-item" style="{{Request::is('out') ? 'background-color: #c5d9e6;' : ''}}">
                                                <a href="/out" class="nav-link d-flex align-items-center linkMenu">
                                                    <span class="ms-3 d-md-inline">Uscite</span>
                                                </a>
                                            </li>
                                        @endif
                                        @if(Auth::user()->level == env('LEVEL_ADMIN', 0))
                                        <li class="nav-item" style="{{Request::is('financial_movements') ? 'background-color: #c5d9e6;' : ''}}">
                                            <a href="/financial_movements" class="nav-link d-flex align-items-center linkMenu">
                                                <span class="ms-3 d-md-inline">Movimenti finanziari</span>
                                            </a>
                                        </li>
                                        @endif
                                        <li class="nav-item" style="{{Request::is('receipts') ? 'background-color: #c5d9e6;' : ''}}">
                                            <a href="/receipts" class="nav-link d-flex align-items-center linkMenu">
                                                <span class="ms-3 d-md-inline">Ricevute</span>
                                            </a>
                                        </li>
                                        @if(Auth::user()->level == env('LEVEL_ADMIN', 0))
                                            <li class="nav-item" style="{{Request::is('records_in_out') ? 'background-color: #c5d9e6;' : ''}}">
                                                <a href="/records_in_out" class="nav-link d-flex align-items-center linkMenu">
                                                    <span class="ms-3 d-md-inline">Gestionale</span>
                                                </a>
                                            </li>
                                        @endif
                                        <li class="nav-item" style="{{Request::is('records') ? 'background-color: #c5d9e6;' : ''}}">
                                            <a href="/records" class="nav-link d-flex align-items-center linkMenu">
                                                <span class="ms-3 d-md-inline">Prima Nota</span>
                                            </a>
                                        </li>
                                        <li class="nav-item" style="{{Request::is('records_old') ? 'background-color: #c5d9e6;' : ''}}">
                                            <a href="/records_old" class="nav-link d-flex align-items-center linkMenu">
                                                <span class="ms-3 d-md-inline">Prima Nota (OLD)</span>
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="accordion-item">
                            <h2 class="accordion-header linkMenu" id="headingThree">
                                <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="{{Request::is('course_list') || Request::is('course_member') ? 'true' : 'false'}}" aria-controls="collapseThree">
                                    Corsi
                                </button>
                            </h2>
                            <div id="collapseThree" class="accordion-collapse collapse {{Request::is('course_list') || Request::is('course_member') || Request::is('calendar') || Request::is('calendar_remove') || Request::is('calendar_settings') || Request::is('presence_reports') || Request::is('absence_reports') ? 'show' : ''}}" aria-labelledby="headingThree" data-bs-parent="#accordionExample">
                                <div class="accordion-body">
                                    <ul class="nav nav-pills flex-column align-items-center align-items-sm-start w-100" id="menu-contabilita" style="margin-top:0px;">
                                        <li class="nav-item" style="{{Request::is('course_member') ? 'background-color: #c5d9e6;' : ''}}">
                                            <a href="/course_member" class="nav-link d-flex align-items-center linkMenu">
                                                <span class="ms-3 d-md-inline">Iscritti</span>
                                            </a>
                                        </li>
                                        <li class="nav-item" style="{{Request::is('course_list') ? 'background-color: #c5d9e6;' : ''}}">
                                            <a href="/course_list" class="nav-link d-flex align-items-center linkMenu">
                                                <span class="ms-3 d-md-inline">Pagamenti</span>
                                            </a>
                                        </li>
                                        <li class="nav-item" style="{{Request::is('calendar') || Request::is('calendar_remove') || Request::is('calendar_settings') ? 'background-color: #c5d9e6;' : ''}}">
                                            <a href="/calendar" class="nav-link d-flex align-items-center linkMenu">
                                                <span class="ms-3 d-md-inline">Calendario</span>
                                            </a>
                                        </li>
                                        <li class="nav-item" style="{{Request::is('presence_reports') || Request::is('absence_reports') ? 'background-color: #c5d9e6;' : ''}}">
                                            <a href="/presence_reports" class="nav-link d-flex align-items-center linkMenu">
                                                <span class="ms-3 d-md-inline">Presenze</span>
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        @if(false)
                            <div class="accordion-item" style="{{Request::is('reminders') ? 'background-color: #c5d9e6;' : ''}}">
                                <h2 class="accordion-header linkMenu">
                                    <a class="accordion-button collapsed" href="/reminders">
                                        Scadenze
                                    </a>
                                </h2>
                            </div>
                        @endif
                        @if(Auth::user()->level == env('LEVEL_ADMIN', 0))
                            <div class="accordion-item " style="{{Request::is('settings') || Request::is('categories') || Request::is('disciplines') || Request::is('cards') || Request::is('course_subscriptions') || Request::is('courses') || Request::is('course_durations') || Request::is('course_frequencies') || Request::is('course_levels') || Request::is('course_types') || Request::is('banks') || Request::is('causals') || Request::is('vats') || Request::is('payment_methods') || Request::is('users') ? 'background-color: #c5d9e6;' : ''}}">
                                <h2 class="accordion-header linkMenu">
                                    <a class="accordion-button collapsed" href="/settings">
                                        Impostazioni
                                    </a>
                                </h2>
                            </div>
                            @if(false)
                                <div class="accordion-item " style="{{Request::is('users') ? 'background-color: #c5d9e6;' : ''}}">
                                    <h2 class="accordion-header linkMenu">
                                        <a class="accordion-button collapsed" href="/users">
                                            Utenti
                                        </a>
                                    </h2>
                                </div>
                            @endif
                        @endif
                        @if(Auth::user()->level == env('LEVEL_ADMIN', 0))
                            <div class="accordion-item">
                                <h2 class="accordion-header linkMenu" id="headingFour">
                                    <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseFour" aria-expanded="{{Request::is('reports') || Request::is('dynamic_report') ? 'true' : 'false'}}" aria-controls="collapseFour">
                                        Reports
                                    </button>
                                </h2>
                                <div id="collapseFour" class="accordion-collapse collapse {{Request::is('reports') || Request::is('dynamic_report') ? 'show' : ''}}" aria-labelledby="headingFour" data-bs-parent="#accordionExample">
                                    <div class="accordion-body">
                                        <ul class="nav nav-pills flex-column align-items-center align-items-sm-start w-100" id="menu-contabilita" style="margin-top:0px;">
                                            <li class="nav-item" style="{{Request::is('reports') ? 'background-color: #c5d9e6;' : ''}}">
                                                <a href="/reports" class="nav-link d-flex align-items-center linkMenu">
                                                    <span class="ms-3 d-md-inline">Report generale</span>
                                                </a>
                                            </li>
                                            <li class="nav-item" style="{{Request::is('dynamic_report') ? 'background-color: #c5d9e6;' : ''}}">
                                                <a href="/dynamic_report" class="nav-link d-flex align-items-center linkMenu">
                                                    <span class="ms-3 d-md-inline">Report dinamico</span>
                                                </a>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        @endif
                    </div>
                    </div>
                </div>
            </div>

            <button id="open-filter" onclick="pcsh1()"></button>
        @endif


        <div class="col">
            <div class="row h-100">
                {{ $slot }}
            </div>
        </div>

    </div>

</div>

<!-- notifiche -->
<div class="user--profile_menu d-none">
    <ul class="user--boxlist">
        <li class="user--boxlist_item">
            <a href="/profile">Profilo</a>
        </li>
        <li class="user--boxlist_item">
            <a href="/logout">Logout</a>
        </li>
    </ul>
</div>
<!-- ///notifiche -->

<script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" crossorigin="anonymous"></script>
  <script src="/assets/js/bootstrap.bundle.js"></script>
  <script src="/assets/js/app.js"></script>
  <script src="/assets/js/tablesaw.js"></script>
  <script src="/assets/js/tablesaw-init.js"></script>
    <script src="/assets/js/select2_scroll_fix.js"></script>

    @livewireScripts

    @stack('scripts')

    <script>
        function setToday(d)
        {
            $("#dateFrom").val(d);
            $("#dateTo").val(d);
            $(".todayButton").removeClass("lightGrey");
            $(".yesterdayButton").addClass("lightGrey");
        }
        function setYesterday(d)
        {
            $("#dateFrom").val(d);
            $("#dateTo").val(d);
            $(".yesterdayButton").removeClass("lightGrey");
            $(".todayButton").addClass("lightGrey");
        }
        $(document).ready(function() {
            $(document).on("click",`[data-bs-trigger='hover focus']`,function() {
                $(".bs-popover-auto").css('display','none');
                if (typeof $(this).popover !== "undefined") { 
                    $(this).popover('hide');
                }
            });
        });
        function newexportaction(e, dt, button, config) {
            var self = this;
            var oldStart = dt.settings()[0]._iDisplayStart;
            dt.one('preXhr', function (e, s, data) {
                // Just this once, load all data from the server...
                data.start = 0;
                data.length = 10000;
                dt.one('preDraw', function (e, settings) {
                    // Call the original action function
                    if (button[0].className.indexOf('buttons-copy') >= 0) {
                        $.fn.dataTable.ext.buttons.copyHtml5.action.call(self, e, dt, button, config);
                    } else if (button[0].className.indexOf('buttons-excel') >= 0) {
                        $.fn.dataTable.ext.buttons.excelHtml5.available(dt, config) ?
                            $.fn.dataTable.ext.buttons.excelHtml5.action.call(self, e, dt, button, config) :
                            $.fn.dataTable.ext.buttons.excelFlash.action.call(self, e, dt, button, config);
                    } else if (button[0].className.indexOf('buttons-csv') >= 0) {
                        $.fn.dataTable.ext.buttons.csvHtml5.available(dt, config) ?
                            $.fn.dataTable.ext.buttons.csvHtml5.action.call(self, e, dt, button, config) :
                            $.fn.dataTable.ext.buttons.csvFlash.action.call(self, e, dt, button, config);
                    } else if (button[0].className.indexOf('buttons-pdf') >= 0) {
                        $.fn.dataTable.ext.buttons.pdfHtml5.available(dt, config) ?
                            $.fn.dataTable.ext.buttons.pdfHtml5.action.call(self, e, dt, button, config) :
                            $.fn.dataTable.ext.buttons.pdfFlash.action.call(self, e, dt, button, config);
                    } else if (button[0].className.indexOf('buttons-print') >= 0) {
                        $.fn.dataTable.ext.buttons.print.action(e, dt, button, config);
                    }
                    dt.one('preXhr', function (e, s, data) {
                        // DataTables thinks the first item displayed is index 0, but we're not drawing that.
                        // Set the property to what it was before exporting.
                        settings._iDisplayStart = oldStart;
                        data.start = oldStart;
                    });
                    // Reload the grid with the original page. Otherwise, API functions like table.cell(this) don't work properly.
                    setTimeout(dt.ajax.reload, 0);
                    // Prevent rendering of the full data to the DOM
                    return false;
                });
            });
            // Requery the server with the new one-time export settings
            dt.ajax.reload();
        };
    </script>

</body>

</html>
