Changed STore Type and corrected all Pages

Added HistoryDisplay.vue
Added NumberRanges
This commit is contained in:
2023-12-27 21:52:55 +01:00
parent 9e092823e4
commit c41b99f29d
33 changed files with 1094 additions and 812 deletions

View File

@@ -1,11 +1,6 @@
<template>
<div id="main">
<div
class="previewDoc"
>
@@ -22,14 +17,14 @@
<UFormGroup label="Lieferant:" required>
<USelectMenu
v-model="itemInfo.vendor"
:options="vendors"
:options="dataStore.vendors"
option-attribute="name"
value-attribute="id"
searchable
:search-attributes="['name','vendorNumber']"
>
<template #label>
{{vendors.find(vendor => vendor.id === itemInfo.vendor) ? vendors.find(vendor => vendor.id === itemInfo.vendor).name : 'Lieferant auswählen'}}
{{dataStore.vendors.find(vendor => vendor.id === itemInfo.vendor) ? dataStore.vendors.find(vendor => vendor.id === itemInfo.vendor).name : 'Lieferant auswählen'}}
</template>
</USelectMenu>
</UFormGroup>
@@ -109,12 +104,13 @@
import InputGroup from "~/components/InputGroup.vue";
import * as dayjs from "dayjs";
const dataStore = useDataStore()
const supabase = useSupabaseClient()
const route = useRoute()
const toast = useToast()
const {vendors} = storeToRefs(useDataStore())
const {getVendorInvoiceById, getDocumentById, fetchVendorInvoices} = useDataStore()
const {fetchVendorInvoices} = useDataStore()
let currentVendorInvoice = null
let currentDocument = ref(null)
@@ -125,14 +121,11 @@ const mode = ref(route.params.mode || "show")
//Functions
const setupPage = async () => {
if(mode.value === "show" || mode.value === "edit"){
currentVendorInvoice = await getVendorInvoiceById(Number(useRoute().params.id))
currentDocument.value = await getDocumentById(currentVendorInvoice.document)
currentVendorInvoice = await dataStore.getVendorInvoiceById(Number(useRoute().params.id))
currentDocument.value = await dataStore.getDocumentById(currentVendorInvoice.document)
}
if(mode.value === "edit") itemInfo.value = currentVendorInvoice
}
@@ -162,7 +155,7 @@ const updateItem = async () => {
id: 0,
}*/
toast.add({title: "Eingangsrechnung erfolgreich gespeichert"})
fetchVendorInvoices()
dataStore.fetchVendorInvoices()
}
}