// Blog Slider
jQuery(document).ready(function() {
  jQuery('.latest-news .owl-carousel').owlCarousel({
    loop: true,
    margin: 30,
    nav: true,
    navText: ["<i class='fa-solid fa-arrow-left'></i>", "<i class='fa-solid fa-arrow-right'></i>"], 
    dots: true,
    rtl: false,
    responsive: {
    0: { 
      items: 1 
    },
    600: { 
      items: 2 
    },
    992: { 
      items: 2 
    },
    1200: { 
      items: 3 
    }
  },
  autoplay: true,
  });
});

// Vehicle Tabs
document.addEventListener("click", e => {  if (e.target.parentElement.classList.contains("tab-title")  ) { ev_charging_station_redTab(e) }  });

[...document.querySelectorAll("div.main-tab div")].forEach((tabTile, index) => {
    tabTile.classList.toggle('active', index == 0)
  });
[...document.querySelectorAll(".tab-content")].forEach((tabcontent, index) => {
  tabcontent.classList.toggle('active', index == 0)
  });
function ev_charging_station_redTab(e) {  
  let ev_charging_station_tabTiles = [...document.querySelectorAll("div.main-tab div")];
  let ev_charging_station_tabcontents = [...document.querySelectorAll(".tab-content")];
  let ev_charging_station_activeTabIndex = ev_charging_station_tabTiles.findIndex(tab => { return tab == e.target.parentElement })
  ev_charging_station_tabTiles.forEach((tabTile, index) => {
    tabTile.classList.toggle('active', index === ev_charging_station_activeTabIndex)
  })
  ev_charging_station_tabcontents.forEach((tabcontent, index) => {
  tabcontent.classList.toggle('active', index === ev_charging_station_activeTabIndex)
  })
}