QUick fixes in inventoryitems
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import HistoryDisplay from "~/components/HistoryDisplay.vue";
|
import HistoryDisplay from "~/components/HistoryDisplay.vue";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
import {useSupabaseSelectSingle} from "~/composables/useSupabase.js";
|
||||||
|
|
||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: "auth"
|
middleware: "auth"
|
||||||
@@ -22,11 +23,11 @@ const itemInfo = ref({
|
|||||||
|
|
||||||
//Functions
|
//Functions
|
||||||
const setupPage = async () => {
|
const setupPage = async () => {
|
||||||
if(mode.value === "show" || mode.value === "edit"){
|
if(mode.value === "show"){
|
||||||
itemInfo.value = await useSupabaseSelectSingle("inventoryitems", route.params.id, "*, vendor(*)")
|
itemInfo.value = await useSupabaseSelectSingle("inventoryitems", route.params.id, "*, vendor(*)")
|
||||||
|
} else if(mode.value === "edit") {
|
||||||
|
itemInfo.value = await useSupabaseSelectSingle("inventoryitems", route.params.id, "*")
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mode.value === "edit") itemInfo.value = itemInfo.value
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const cancelEditorCreate = () => {
|
const cancelEditorCreate = () => {
|
||||||
|
|||||||
@@ -68,6 +68,13 @@ defineShortcuts({
|
|||||||
|
|
||||||
const dataStore = useDataStore()
|
const dataStore = useDataStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const items = ref([])
|
||||||
|
|
||||||
|
const setupPage = async () => {
|
||||||
|
items.value = await useSupabaseSelect("inventoryitems","*", "articleNumber")
|
||||||
|
}
|
||||||
|
|
||||||
|
setupPage()
|
||||||
|
|
||||||
const templateColumns = [
|
const templateColumns = [
|
||||||
{
|
{
|
||||||
@@ -92,10 +99,10 @@ const columns = computed(() => templateColumns.filter((column) => selectedColumn
|
|||||||
const searchString = ref('')
|
const searchString = ref('')
|
||||||
const filteredRows = computed(() => {
|
const filteredRows = computed(() => {
|
||||||
if(!searchString.value) {
|
if(!searchString.value) {
|
||||||
return dataStore.inventoryitems
|
return items.value
|
||||||
}
|
}
|
||||||
|
|
||||||
return dataStore.inventoryitems.filter(product => {
|
return items.value.filter(product => {
|
||||||
return Object.values(product).some((value) => {
|
return Object.values(product).some((value) => {
|
||||||
return String(value).toLowerCase().includes(searchString.value.toLowerCase())
|
return String(value).toLowerCase().includes(searchString.value.toLowerCase())
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user