<script setup>

const dataStore = useDataStore()
const route = useRoute()
const router = useRouter()

const itemInfo = ref({})

const setupPage = () => {
  if(route.params) {
    if(route.params.id) itemInfo.value = dataStore.getCreatedDocumentById(Number(route.params.id))
  }
}

setupPage()
</script>

<template>

  <InputGroup>
    <UButton
      @click="router.push(`/createDocument/edit/${itemInfo.id}`)"
    >
      Bearbeiten
    </UButton>
  </InputGroup>
  <DevOnly>
    {{itemInfo}}
  </DevOnly>



  <DocumentDisplay
    :document-data="dataStore.documents.find(i => i.createdDocument === itemInfo.id)"
  />

</template>

<style scoped>

</style>