<template>
  <EntityList
    :items="items"
    type="vendors"
  />


  <!--  <UDashboardNavbar title="Lieferanten" :badge="filteredRows.length">
    <template #right>
      <UInput
          id="searchinput"
          name="searchinput"
          v-model="searchString"
          icon="i-heroicons-funnel"
          autocomplete="off"
          placeholder="Suche..."
          class="hidden lg:block"
          @keydown.esc="$event.target.blur()"
      >
        <template #trailing>
          <UKbd value="/" />
        </template>
      </UInput>

      <UButton @click="router.push(`/vendors/create/`)">+ Lieferant</UButton>

    </template>
  </UDashboardNavbar>

  <UDashboardToolbar>
    <template #right>
      <USelectMenu
          v-model="selectedColumns"
          icon="i-heroicons-adjustments-horizontal-solid"
          :options="templateColumns"
          multiple
          class="hidden lg:block"
          by="key"
      >
        <template #label>
          Spalten
        </template>
      </USelectMenu>
    </template>
  </UDashboardToolbar>

  <UTable
      :rows="filteredRows"
      :columns="columns"
      :ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
      class="w-full"
      @select="(i) => router.push(`/vendors/show/${i.id}`)"
      :empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Lieferanten anzuzeigen' }"
  >
    <template #name-data="{row}">
      <span v-if="row === filteredRows[selectedItem]" class="text-primary-500 font-bold">{{row.name}}</span>
      <span v-else>{{row.name}}</span>
    </template>
    <template #address-data="{row}">
      {{row.infoData.street ? `${row.infoData.street}, ` : ''}}{{row.infoData.special ? `${row.infoData.special},` : ''}} {{(row.infoData.zip || row.infoData.city) ? `${row.infoData.zip} ${row.infoData.city}, ` : ''}} {{row.infoData.country}}
    </template>
  </UTable>-->

</template>

<script setup>
definePageMeta({
  middleware: "auth"
})

const items = ref([])

const setupPage = async () => {
  items.value = await useSupabaseSelect("vendors","*","vendorNumber")
}

setupPage()


const templateColumns = [

]
</script>

<style scoped>

</style>