<script setup>
import { useRouter} from "vue-router";
import { ref } from 'vue';
import { showAuthSignOutForm } from '@/components/forms/auth/authSignOutForm.vue';
import UserNavigation from "@/components/global/UserNavigation.vue";
import { SessionUser } from "@/components/session/token/SessionUser.vue";
const router = useRouter();
// Get the user from the route
const userId = ref(router.currentRoute.value.params.userId)

const tabs = [
  { name: 'Overview', path: '/superuser/users/' + userId.value },
  { name: 'Orders', path: '/superuser/users/' + userId.value + '/orders' },
  { name: 'Pricing', path: '/superuser/users/' + userId.value + '/pricing' },
  { name: 'Other', path: '/superuser/users/' + userId.value + '/other' },
  { name: 'Vehicles', path: '/superuser/users/' + userId.value + '/vehicles' },
  { name: SessionUser.superUser.modules.xlvask.meta.title, path: '/superuser/users/' + userId.value + '/xlvask' },
];

// 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>
    <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>
</template>

<style scoped>
</style>