
<div class="app-content">
    <!-- Header Section start -->
<!-- Header Section starts -->
<header class="header-main">
<div class="container-fluid">
    <div class="row">
        <div class="p-0 col-6 col-sm-4 d-flex align-items-center header-left">
            <span class="header-toggle me-3">
                <i class="iconoir-view-grid"></i>
            </span>
        </div>

        <div class="p-0 col-6 col-sm-8 d-flex align-items-center justify-content-end header-right">

            <ul class="d-flex align-items-center">

                {{-- <li class="header-cloud">
                    <a aria-controls="cloudoffcanvasTops" class="head-icon"
                       data-bs-target="#cloudoffcanvasTops" data-bs-toggle="offcanvas"
                       href="#" role="button">
                        <i class="iconoir-dew-point text-primary f-s-26 me-1"></i>
                        <span class="f-w-600">26 <sup class="f-s-10">°C</sup></span>
                    </a>

                    <div aria-labelledby="cloudoffcanvasTops"
                         class="offcanvas offcanvas-end header-cloud-canvas"
                         id="cloudoffcanvasTops"
                         tabindex="-1">
                        <div class="p-0 offcanvas-body">
                            <div class="cloud-body">

                                <div class="cloud-content-box">
                                    <div class="cloud-box bg-primary-900">
                                        <p class="mb-3">Mon</p>
                                        <h6 class="mt-4 f-s-13"> +29°C</h6>
                                        <span>
                            <i class="text-white ph-duotone ph-cloud-fog f-s-25"></i>
                          </span>
                                        <p class="mt-3 f-s-13"><i class="wi wi-raindrop"></i> 2%</p>
                                    </div>
                                    <div class="cloud-box bg-primary-800">
                                        <p class="mb-3">Tue</p>
                                        <h6 class="mt-4 f-s-13"> +29°C</h6>
                                        <span>
                            <i class="text-white ph-duotone ph-cloud-sun f-s-25"></i>
                          </span>
                                        <p class="mt-3 f-s-13"><i class="wi wi-raindrop"></i> 2%</p>
                                    </div>
                                    <div class="cloud-box bg-primary-700">
                                        <p class="mb-3 text-light">Wed</p>
                                        <h6 class="mt-4 f-s-13"> +20°C</h6>
                                        <span>
                            <i class="text-white ph-duotone ph-sun-dim f-s-25"></i>
                          </span>
                                        <p class="mt-3 f-s-13"><i class="wi wi-raindrop"></i> 1%</p>
                                    </div>
                                    <div class="cloud-box bg-primary-600">
                                        <p class="mb-3">Thu</p>
                                        <h6 class="mt-4 f-s-13"> +17°C</h6>
                                        <span>
                            <i class="text-white ph-duotone ph-sun-dim f-s-25"></i>
                          </span>
                                        <p class="mt-3 f-s-13"><i class="wi wi-raindrop"></i> 1%</p>
                                    </div>
                                    <div class="cloud-box bg-primary-500">
                                        <p class="mb-3">Fri</p>
                                        <h6 class="mt-4 f-s-13"> +18°C</h6>
                                        <span>
                            <i class="text-white ph-duotone ph-sun-dim f-s-25"></i>
                          </span>
                                        <p class="mt-3 f-s-13"><i class="wi wi-raindrop"></i> 1%</p>
                                    </div>
                                    <div class="cloud-box bg-primary-400">
                                        <p class="mb-3">Sat</p>
                                        <h6 class="mt-4 f-s-13"> +16°C</h6>
                                        <span>
                            <i class="text-white ph-duotone ph-sun-dim f-s-25"></i>
                          </span>
                                        <p class="mt-3 f-s-13"><i class="wi wi-raindrop"></i> 1%</p>
                                    </div>
                                    <div class="cloud-box bg-primary-300">
                                        <p class="mb-3">Sun</p>
                                        <h6 class="mt-4 f-s-13"> +29°C</h6>
                                        <span class="mb-3">
                            <i class="text-white ph-duotone ph-sun-dim f-s-25"></i>
                          </span>
                                        <p class="mt-3 f-s-13"><i class="wi wi-raindrop"></i> 1%</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </li> --}}

                <li class="header-language">
                    <div class="flex-shrink-0 dropdown" id="lang_selector">
                        <a aria-expanded="false" class="d-block head-icon ps-0"
                           data-bs-toggle="dropdown"
                           href="#">
                            <div class="lang-flag lang-en ">
                      <span class="overflow-hidden flag rounded-circle">
                        <i class=""></i>
                      </span>
                            </div>
                        </a>
                        <ul class="border-0 dropdown-menu language-dropdown header-card">
                            <li class="p-2 lang lang-en selected dropdown-item" data-bs-placement="top"
                                data-bs-toggle="tooltip" title="US">
                      <span class="d-flex align-items-center">
                        <i class="flag-icon flag-icon-usa flag-icon-squared b-r-10 f-s-22"></i>
                        <span class="ps-2">English</span>
                      </span>
                            </li>
                            <li class="p-2 lang lang-pt dropdown-item" title="FR">
                      <span class="d-flex align-items-center">
                        <i class="flag-icon flag-icon-fra flag-icon-squared b-r-10 f-s-22"></i>
                        <span class="ps-2">Française </span>
                      </span>
                            </li>
                            <li class="p-2 lang lang-es dropdown-item" title="UK">
                      <span class="d-flex align-items-center">
                        <i class="flag-icon flag-icon-gbr flag-icon-squared b-r-10 f-s-22"></i>
                        <span class="ps-2">English</span>
                      </span>
                            </li>
                            <li class="p-2 lang lang-es dropdown-item" title="Ru">
                      <span class="d-flex align-items-center">
                          <i class="flag-icon flag-icon-rus flag-icon-squared b-r-10 f-s-22"></i>
                        <span class="ps-2">Русская</span>
                      </span>
                            </li>
                            <li class="p-2 lang lang-es dropdown-item" title="IT">
                      <span class="d-flex align-items-center">
                        <i class="flag-icon flag-icon-ita flag-icon-squared b-r-10 f-s-22"></i>
                        <span class="ps-2">française</span>
                      </span>
                            </li>
                        </ul>
                    </div>

                </li>



                <li class="header-profile">


                    <div aria-labelledby="profilecanvasRight"
                         class="offcanvas offcanvas-end header-profile-canvas"
                         id="profilecanvasRight"
                         tabindex="-1">
                        <div class="offcanvas-body app-scroll">
                            <ul class="">
                                <li class="gap-3 mb-3 d-flex">
                                    <div class="d-flex-center">
                                                <span class="h-45 w-45 d-flex-center b-r-10 position-relative">
                                                    {{-- @if(auth()->user()->profile_image)
                                                  <img alt="" class="img-fluid b-r-10"
                                                  src="{{ asset('storage/' . auth()->user()->profile_image ) }}">
                                                  @else
                                                  <img src="{{ asset('assets/avatar.jpg') }}" class="img-fluid b-r-10">
                                                  @endif --}}
                                                </span>
                                    </div>
                                    <div class="mt-2 text-center">
                                        <h6 class="mb-0">
                                            {{ Auth::user()->name}}

                                            <img
                                                alt="instagram-check-mark"
                                                class="w-20 h-20"
                                                src="{{ asset('assets/images/profile-app/01.png') }}">

                                            </h6>
                                        <p class="mb-0 f-s-12 text-secondary">{{ Auth::user()->email }}</p>
                                    </div>
                                </li>

                                {{-- <li>
                                    <a class="f-w-500" href="profile.html" target="_blank">
                                        <i class="iconoir-user-love pe-1 f-s-20"></i> Profile
                                        Details
                                    </a>
                                </li>
                                <li>
                                    <a class="f-w-500" href="setting.html" target="_blank">
                                        <i class="iconoir-settings pe-1 f-s-20"></i> Settings
                                    </a>
                                </li>
                                <li class="py-1 app-divider-v dotted"></li>



                                <li class="py-1 app-divider-v dotted"></li>
                                <li>
                                    <a class="f-w-500" href="faq.html" target="_blank">
                                        <i class="iconoir-help-circle pe-1 f-s-20"></i> Help
                                    </a>
                                </li>
                                <li>
                                    <a class="f-w-500" href="pricing.html" target="_blank">
                                        <i class="iconoir-dollar pe-1 f-s-20"></i>
                                        Pricing
                                    </a>
                                </li> --}}


                                <li>
                                    <form method="POST" action="{{ route('logout') }}">
                                    @csrf
                                    <a class="mb-0 btn btn-light-danger btn-sm justify-content-center "
                                    :href="route('logout')"
                                    onclick="event.preventDefault();
                                                this.closest('form').submit();"
                                       role="button">
                                         <i class="ph-duotone ph-sign-out pe-1 f-s-20"></i> Log Out
                                    </a>
                                </form>
                                </li>
                            </ul>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </div>
</div>
</header>


<script>

function markAsRead(notificationId) {
    fetch(`/notifications/${notificationId}/read`, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
            'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content'),
        },
        body: JSON.stringify({
            _method: 'POST', // Use POST method for AJAX
        }),
    })
    .then(response => response.json())
    .then(data => {
        // Add a class to mark the notification as read
        const notificationElement = document.querySelector(`[data-id="${notificationId}"]`);
        notificationElement.classList.add('read'); // Add read class
        notificationElement.style.opacity = 0.5; // Example: adjust opacity to show it's read
    })
    .catch(error => {
        console.error('Error:', error);
    });
}

</script>
