<script setup>

const openTasks = ref([])
const router = useRouter()
const auth = useAuthStore()

const setupPage = async () => {
  //TODO: BACKEND CHANGE Migrate to auth_users for profile
  openTasks.value = (await useEntities("tasks").select().filter(i => !i.archived && i.user_id === auth.user.id))
}

setupPage()

</script>

<template>
  <UTable
      v-if="openTasks.length > 0"
    :rows="openTasks"
      :columns="[{key:'name',label:'Name'},{key:'categorie',label:'Kategorie'}]"
      @select="(i) => router.push(`/standardEntity/tasks/show/${i.id}`)"
  />
  <div v-else>
    <p  class="text-center font-bold">Keine offenen Aufgaben</p>
  </div>
</template>

<style scoped>

</style>