@extends('layout.master')



@section('title',mb_convert_case($q, MB_CASE_TITLE, "UTF-8").' - Haber Arama - '.config('settings.site_title', 'Varsayılan Başlık'))
@section('description','Aradığınız Haberler İle igili Gelişmeleri Haber Sitesinde Yer Almaktadır' )



@section('content')
<div class="container-page-custom"  id="site-content">
     
        <div class="col-md-12">

     <div class="container Category">
          <div class="container mt-5">
        <div class="section-header">
            <h2>@if(isset($q)) {{mb_convert_case($q, MB_CASE_TITLE, "UTF-8");}} - @endif Haber Arama</h2>
            <div class="line" style="background-color:#0400ff"></div>
        </div>
    </div>
    <div class="row">
      

    </div>
  

    </div>
    <div style="clear: both;"></div>
    <div class="container newseight" style="margin-top:50px">
        @if(isset($ekonomikhaberlerNews) and $ekonomikhaberlerNews->count() > 0)
        <div class="row">
           @foreach($ekonomikhaberlerNews as $ekonomikhaberNews)
            <div class="col-md-3">
                 <div class="news-card">
             {!! getNewsLink($ekonomikhaberNews)!!}<img src="{{env('PANEL_URL')}}/uploads/images/news/{{ date("Y/m/d", strtotime($ekonomikhaberNews->date)) }}/{{ $ekonomikhaberNews->news_image }}" alt="{{$ekonomikhaberNews->name}}"  style="height:165px"></a>
            <div class="news-badge"style="background-color:#{{$ekonomikhaberNews->category->color}} !important;">{{$ekonomikhaberNews->category->name}}</div>
             <div class="card-body">
                <h5 class="card-title">  {!! getNewsLink($ekonomikhaberNews)!!}<div class="news-title">{{$ekonomikhaberNews->name}}</div></a></h5></div>
        </div>
            </div>
                        @endforeach
            
           
        </div>
        @else 
 <div class="row">
    <div class="col-md-12" style="
    text-align: center;
">
        <img src="/img/400.png" style="
    width: 200px;
">
        <p style="
    margin-top: 20px;
    font-size: 20px;
">Aradığınız Haber Bulunmamaktadır.</p>
    </div>
    </div>

        @endif
            <div id="loading" style="display:none;" class="text-center mt-5">
    <img src="/output-onlinegiftools.gif" alt="Loading..." style="width: 150px;">

</div>
    </div>
    </div>
 </div>
              
    </div>
</div>

<script type="text/javascript">
    
    
       
     function initializeSlider(sliderClass, leftBtnId, rightBtnId, indicatorUlId, interval) {
    let sliderCont = document.querySelector(sliderClass);
    let sliderI = sliderCont.querySelectorAll(".sliderIn");
    let sliderItem = [...sliderI];
    let sliderD = sliderCont.parentElement.querySelectorAll(".lim");
    let sliderDods = [...sliderD];
    let dodsUl = sliderCont.parentElement.querySelector(indicatorUlId);
    let btnLeft = document.getElementById(leftBtnId);
    let btnRight = document.getElementById(rightBtnId);
    let limit = 0;
    let startX = 0;
    let moveX = 0;

    btnLeft.addEventListener("click", prev);
    btnRight.addEventListener("click", next);

    sliderCont.addEventListener("touchstart", touchStart);
    sliderCont.addEventListener("touchmove", touchMove);
    sliderCont.addEventListener("touchend", touchEnd);

    nexts();

    function prev() {
        limit--;
        if (limit < 0) {
            limit = sliderItem.length - 1;
        }
        nexts();
    }

    function next() {
        limit++;
        if (limit >= sliderItem.length) {
            limit = 0;
        }
        nexts();
    }

    let replay = setInterval(next, interval);

    dodsUl.addEventListener("mouseover", (e, index) => {
        if (!e.target.classList.contains("tumu")) {
            sliderDods.forEach((em, ind) => {
                em.classList.remove("active");
            });
            e.target.classList.add("active");
            limit = Number(e.target.innerText - 1);
            nexts();
        }
    });

    function nexts() {
        sliderItem.forEach((it, index) => {
            if (index == limit) {
                it.classList.add("sliderInActive");
            } else {
                it.classList.remove("sliderInActive");
            }
        });
        sliderDods.forEach((im, index) => {
            if (index == limit) {
                im.classList.add("active");
            } else {
                im.classList.remove("active");
            }
        });
    }

    function touchStart(e) {
        startX = e.touches[0].clientX;
        clearInterval(replay);
    }

    function touchMove(e) {
        moveX = e.touches[0].clientX;
    }

    function touchEnd() {
        const sensitivity = 100; // Kaydırma hassasiyetini artırmak için bu değeri artırabilirsiniz.
        if (startX > moveX + sensitivity) {
            next();
        } else if (startX < moveX - sensitivity) {
            prev();
        }
        replay = setInterval(next, interval);
    }
}

        // Initialize sliders
        initializeSlider(".slider-2", "left-2", "right-2", "#uli-2", 4000);

      
</script>
@endsection
