Changed STore Type and corrected all Pages
Added HistoryDisplay.vue Added NumberRanges
This commit is contained in:
@@ -11,9 +11,7 @@ const toast = useToast()
|
||||
const id = ref(route.params.id ? route.params.id : null )
|
||||
|
||||
//Store
|
||||
const {customers, vendors, contacts } = storeToRefs(useDataStore())
|
||||
const {fetchContacts, getContactById} = useDataStore()
|
||||
|
||||
const dataStore = useDataStore()
|
||||
let currentContact = null
|
||||
|
||||
|
||||
@@ -27,7 +25,7 @@ const itemInfo = ref({
|
||||
//Functions
|
||||
const setupPage = () => {
|
||||
if(mode.value === "show" || mode.value === "edit"){
|
||||
currentContact = getContactById(Number(useRoute().params.id))
|
||||
currentContact = dataStore.getContactById(Number(useRoute().params.id))
|
||||
}
|
||||
|
||||
if(mode.value === "edit") itemInfo.value = currentContact
|
||||
@@ -53,7 +51,7 @@ const createItem = async () => {
|
||||
id: 0,
|
||||
}
|
||||
toast.add({title: "Kontakt erfolgreich erstellt"})
|
||||
await fetchContacts()
|
||||
await dataStore.fetchContacts()
|
||||
router.push(`/contacts/show/${data[0].id}`)
|
||||
setupPage()
|
||||
}
|
||||
@@ -84,7 +82,7 @@ const updateCustomer = async () => {
|
||||
name: "",
|
||||
}
|
||||
toast.add({title: "Kontakt erfolgreich gespeichert"})
|
||||
fetchContacts()
|
||||
dataStore.fetchContacts()
|
||||
}
|
||||
|
||||
|
||||
@@ -125,8 +123,8 @@ setupPage()
|
||||
</UButton>
|
||||
</InputGroup>
|
||||
|
||||
<span v-if="currentContact.customer">Kunde: {{customers.find(customer => customer.id === currentContact.customer) ? customers.find(customer => customer.id === currentContact.customer).name : "" }}</span><br>
|
||||
<span v-if="currentContact.vendor">Lieferant: {{vendors.find(vendor => vendor.id === currentContact.vendor) ? vendors.find(vendor => vendor.id === currentContact.vendor).name : ""}}</span><br>
|
||||
<span v-if="currentContact.customer">Kunde: {{dataStore.customers.find(customer => customer.id === currentContact.customer) ? dataStore.customers.find(customer => customer.id === currentContact.customer).name : "" }}</span><br>
|
||||
<span v-if="currentContact.vendor">Lieferant: {{dataStore.vendors.find(vendor => vendor.id === currentContact.vendor) ? dataStore.vendors.find(vendor => vendor.id === currentContact.vendor).name : ""}}</span><br>
|
||||
|
||||
<span>E-Mail: {{currentContact.email}}</span><br>
|
||||
<span>Mobil: {{currentContact.phoneMobile}}</span><br>
|
||||
@@ -201,7 +199,7 @@ setupPage()
|
||||
:search-attributes="['name']"
|
||||
>
|
||||
<template #label>
|
||||
{{customers.find(customer => customer.id === itemInfo.customer) ? customers.find(customer => customer.id === itemInfo.customer).name : "Kunde auswählen"}}
|
||||
{{dataStore.customers.find(customer => customer.id === itemInfo.customer) ? dataStore.customers.find(customer => customer.id === itemInfo.customer).name : "Kunde auswählen"}}
|
||||
</template>
|
||||
</USelectMenu>
|
||||
</UFormGroup>
|
||||
@@ -217,7 +215,7 @@ setupPage()
|
||||
:search-attributes="['name']"
|
||||
>
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user