<script setup >

import DocumentUploadModal from "~/components/DocumentUploadModal.vue";

const props = defineProps({
  type: {
    type: String
  },
  elementId: {
    type: String
  }
})

const {type, elementId} = props

const emit = defineEmits(["uploadFinished"])

const modal = useModal()

const openModal = () => {
  let fileProps = {folder: null, type: null, typeEnabled: true}

  fileProps[props.type] = props.elementId

  console.log(fileProps)

  modal.open(DocumentUploadModal,{fileData: fileProps, onUploadFinished: () => emit("uploadFinished")})
}
</script>

<template>
  <UButton
      @click="openModal"
      icon="i-heroicons-arrow-up-tray"
  >
    Hochladen
  </UButton>
</template>

<style scoped>

</style>