<script setup>

const openTasks = ref([])
const supabase = useSupabaseClient()
const router = useRouter()


const setupPage = async () => {
  openTasks.value = (await supabase.from("tasks").select().eq("tenant",useProfileStore().currentTenant).not("archived","is",true).neq("categorie","Abgeschlossen").eq("profile", useProfileStore().activeProfile.id)).data
}

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>