Added Reset in Inventory

Added Keyboard Controls for Tab Nav and Back to List
Added Select On Enter for First Entry in Search

for Customers and Vendors
This commit is contained in:
2024-05-01 21:55:41 +02:00
parent 86cd55102c
commit 7966173385
6 changed files with 107 additions and 9 deletions

View File

@@ -4,6 +4,22 @@ definePageMeta({
middleware: "auth"
})
defineShortcuts({
'backspace': () => {
router.push("/customers")
},
'arrowleft': () => {
if(openTab.value > 0){
openTab.value -= 1
}
},
'arrowright': () => {
if(openTab.value < 3) {
openTab.value += 1
}
},
})
const dataStore = useDataStore()
const route = useRoute()
const router = useRouter()
@@ -11,7 +27,7 @@ const toast = useToast()
const id = ref(route.params.id ? route.params.id : null )
let currentItem = ref(null)
const openTab = ref(0)
//Working
@@ -57,6 +73,7 @@ setupPage()
</script>
<template>
{{openTab}}
<UDashboardNavbar
:title="currentItem ? `Kunde: ${currentItem.name}` : (mode === 'create' ? 'Kunde erstellen' : 'Kunde bearbeiten')"
:ui="{center: 'flex items-stretch gap-1.5 min-w-0'}"
@@ -123,6 +140,7 @@ setupPage()
v-if="currentItem && mode == 'show'"
:items="[{label: 'Informationen'},{label: 'Projekte'},{label: 'Objekte'},{label: 'Verträge'}]"
class="p-5"
v-model="openTab"
>
<template #item="{item}">
<div v-if="item.label === 'Informationen'" class="flex mt-5">

View File

@@ -3,6 +3,7 @@
<template #right>
<UInput
id="searchinput"
name="searchinput"
v-model="searchString"
icon="i-heroicons-funnel"
autocomplete="off"
@@ -54,7 +55,7 @@
<span v-else class="text-rose-500">Gesperrt</span>
</template>
<template #address-data="{row}">
{{row.infoData.street ? `${row.infoData.street}, ` : ''}}{{row.infoData.special ? `${row.infoData.special},` : ''}} {{row.infoData.zip ? row.infoData.zip : ""}}{{row.infoData.city ? `${row.infoData.city}, ` : ''}} {{row.infoData.country}}
{{row.infoData.street ? `${row.infoData.street}, ` : ''}}{{row.infoData.special ? `${row.infoData.special},` : ''}} {{row.infoData.zip ? row.infoData.zip : ""}} {{row.infoData.city ? `${row.infoData.city}, ` : ''}} {{row.infoData.country}}
</template>
</UTable>
</template>
@@ -72,7 +73,16 @@ defineShortcuts({
},
'+': () => {
router.push("/customers/create")
},
'enter': {
usingInput: "searchinput",
handler: () => {
router.push(`/customers/show/${selectedEntry.value}`)
}
}
})
const dataStore = useDataStore()
@@ -115,17 +125,22 @@ const columns = computed(() => templateColumns.filter((column) => selectedColumn
const searchString = ref('')
const selectedEntry = ref(null)
const filteredRows = computed(() => {
if(!searchString.value) {
return dataStore.customers
}
return dataStore.customers.filter(item => {
let results = dataStore.customers.filter(item => {
return Object.values(item).some((value) => {
return String(value).toLowerCase().includes(searchString.value.toLowerCase())
})
})
selectedEntry.value = results[0].id
return results
})
</script>