Some Changes
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
const toast = useToast()
|
||||
const supabase = useSupabaseClient()
|
||||
const router = useRouter()
|
||||
const props = defineProps({
|
||||
document: {
|
||||
type: Object,
|
||||
@@ -14,7 +15,7 @@ const props = defineProps({
|
||||
})
|
||||
|
||||
const {document, openShowModal:openShowModalProp } = props;
|
||||
const {fetchDocuments, getDocumentTags} = useDataStore()
|
||||
const {fetchDocuments, getDocumentTags, fetchVendorInvoices} = useDataStore()
|
||||
const {projects, customers} = storeToRefs(useDataStore())
|
||||
const tags = getDocumentTags
|
||||
const openShowModal = ref(false)
|
||||
@@ -26,7 +27,7 @@ const openDocument = async () => {
|
||||
openShowModal.value = true
|
||||
}
|
||||
|
||||
const uploadFiles = async () => {
|
||||
/*const uploadFiles = async () => {
|
||||
const uploadSingleFile = async (file) => {
|
||||
|
||||
const {data, error} = await supabase
|
||||
@@ -76,7 +77,7 @@ const uploadFiles = async () => {
|
||||
uploadModalOpen.value = false;
|
||||
uploadInProgress.value = false;
|
||||
fetchDocuments()
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
const updateDocument = async () => {
|
||||
@@ -101,7 +102,21 @@ const updateDocument = async () => {
|
||||
|
||||
}
|
||||
|
||||
const createVendorInvoice = async () => {
|
||||
const {data,error} = await supabase
|
||||
.from("vendorInvoices")
|
||||
.insert([{
|
||||
document: document.id,
|
||||
}])
|
||||
.select()
|
||||
if(error) {
|
||||
console.log(error)
|
||||
} else if(data) {
|
||||
fetchVendorInvoices()
|
||||
await router.push("/vendorinvoices")
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -125,53 +140,7 @@ const updateDocument = async () => {
|
||||
|
||||
|
||||
<!-- Slideovers -->
|
||||
<USlideover
|
||||
v-model="uploadModalOpen"
|
||||
>
|
||||
|
||||
<UCard class="flex flex-col flex-1" :ui="{ body: { base: 'flex-1' }, ring: '', divide: 'divide-y divide-gray-100 dark:divide-gray-800' }">
|
||||
<template #header>
|
||||
Datei Hochladen
|
||||
</template>
|
||||
|
||||
<div class="h-full">
|
||||
<UFormGroup
|
||||
label="Datei:"
|
||||
>
|
||||
<UInput
|
||||
type="file"
|
||||
id="fileUploadInput"
|
||||
multiple
|
||||
/>
|
||||
</UFormGroup>
|
||||
|
||||
<UFormGroup
|
||||
label="Tags:"
|
||||
class="mt-3"
|
||||
>
|
||||
<USelectMenu
|
||||
multiple
|
||||
searchable
|
||||
searchable-placeholder="Suchen..."
|
||||
:options="tags"
|
||||
v-model="fileUploadFormData.tags"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<UButton
|
||||
v-if="!uploadInProgress"
|
||||
class="mt-3"
|
||||
@click="uploadFiles"
|
||||
>Hochladen</UButton>
|
||||
<UProgress
|
||||
v-else
|
||||
animation="carousel"
|
||||
/>
|
||||
</template>
|
||||
</UCard>
|
||||
</USlideover>
|
||||
<USlideover
|
||||
v-model="openShowModal"
|
||||
fullscreen
|
||||
@@ -241,7 +210,12 @@ const updateDocument = async () => {
|
||||
</USelectMenu>
|
||||
</UFormGroup>
|
||||
|
||||
|
||||
<UButton
|
||||
v-if="document.tags.includes('Eingangsrechnung')"
|
||||
@click="createVendorInvoice"
|
||||
>
|
||||
Eingangsrechnung erstellen
|
||||
</UButton>
|
||||
|
||||
|
||||
</UCard>
|
||||
|
||||
Reference in New Issue
Block a user