<script setup>
import { useRouter} from "vue-router";
import { ref } from 'vue';
import { departments, getDepartmentName, isLoading as departmentTabsIsLoading, getDepartments} from "@/components/pagination/departmentTabs.vue";

const router = useRouter();

/** Define the tabs */
const tabs = [
  { name: 'Hjem', path: '/user' },
  { name: 'Mine vaske', path: '/user/orders/' },
  { name: 'Mine køretøjer', path: '/user/vehicles/' },
  { name: 'Mine bookinger', path: '/user/bookings/' },
];

// Get the current path
const currentPath = ref(router.currentRoute.value.path);

// Get the index of the active tab
const activeTab = tabs.findIndex(tab => tab.path === currentPath.value);

// Change the tab
const changeTab = (index) => {
  router.push(tabs[index].path);
};

</script>

<template>
  <div class="columns">
    <div class="column">
      <div class="tabs is-right">
        <ul>
          <li v-for="(tab, index) in tabs" :key="index" :class="{'is-active': activeTab === index}" @click="changeTab(index)">
            <a>{{ tab.name }}</a>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<style scoped>

</style>