<script setup>


definePageMeta({
  layout: 'mobile'
})

const auth = useAuthStore()

const pinnedLinks = computed(() => {
  return (auth.profile?.pinned_on_navigation || [])
      .map((pin) => {
        if (pin.type === "external") {
          return {
            label: pin.label,
            to: pin.link,
            icon: pin.icon,
            external: true,
          }
        } else if (pin.type === "standardEntity") {
          return {
            label: pin.label,
            to: `/standardEntity/${pin.datatype}/show/${pin.id}`,
            icon: pin.icon,
            external: false,
          }
        }
      })
      .filter(Boolean)
})
</script>

<template>
  <UDashboardPanelContent>
    <UPageGrid>
      <UDashboardCard>
        <display-welcome/>
      </UDashboardCard>
      <UDashboardCard
          title="Aufgaben"
      >
        <display-open-tasks/>
      </UDashboardCard>
      <!--<UDashboardCard
          title="Anwesenheit"
      >
        <display-running-working-time/>
      </UDashboardCard>
      <UDashboardCard
          title="Zeit"
      >
        <display-running-time/>
      </UDashboardCard>
      <UDashboardCard
          title="Buchhaltung"
          v-if="profileStore.ownTenant.features.accounting"
      >
        <display-open-balances/>
      </UDashboardCard>-->
      <UDashboardCard
          title="Projekte"
      >
        <display-projects-in-phases/>
      </UDashboardCard>
      <display-pinnend-links :links="pinnedLinks"/>

    </UPageGrid>
  </UDashboardPanelContent>

</template>

<style scoped>

</style>