Many Changes
This commit is contained in:
@@ -29,6 +29,33 @@ const navLinks = [
|
||||
to: "/",
|
||||
icon: 'i-heroicons-home'
|
||||
},
|
||||
{
|
||||
label: "Kontakte",
|
||||
icon: 'i-heroicons-user-group',
|
||||
children: [
|
||||
{
|
||||
label: "Kunden",
|
||||
to: "/customers",
|
||||
icon: "i-heroicons-user-group"
|
||||
},
|
||||
{
|
||||
label: "Lieferanten",
|
||||
to: "/vendors",
|
||||
icon: "i-heroicons-truck"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "Buchhaltung",
|
||||
icon: 'i-heroicons-document-chart-bar',
|
||||
children: [
|
||||
{
|
||||
label: "Eingangsrechnungen",
|
||||
to: "/vendorinvoices",
|
||||
icon: "i-heroicons-user-group"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "Aufgaben",
|
||||
to: "/tasks",
|
||||
@@ -39,25 +66,16 @@ const navLinks = [
|
||||
to: "/planningBoard",
|
||||
icon: "i-heroicons-calendar-days"
|
||||
},
|
||||
{
|
||||
label: "Kunden",
|
||||
to: "/customers",
|
||||
icon: "i-heroicons-user-group"
|
||||
},
|
||||
|
||||
{
|
||||
label: "Projekte",
|
||||
to: "/projects",
|
||||
icon: "i-heroicons-clipboard-document-check"
|
||||
},
|
||||
{
|
||||
label: "Zeiterfassung",
|
||||
to: "/timetracking",
|
||||
icon: "i-heroicons-clock"
|
||||
},
|
||||
{
|
||||
label: "Artikel",
|
||||
to: "/products",
|
||||
icon: "i-heroicons-puzzle-piece"
|
||||
label: "Jobs",
|
||||
to: "/jobs",
|
||||
icon: "i-heroicons-square-3-stack-3d"
|
||||
},
|
||||
{
|
||||
label: "Dokumente",
|
||||
@@ -65,15 +83,32 @@ const navLinks = [
|
||||
icon: "i-heroicons-document"
|
||||
},
|
||||
{
|
||||
label: "Inventar",
|
||||
to: "/inventory",
|
||||
icon: "i-heroicons-square-3-stack-3d"
|
||||
label: "Mitarbeiter",
|
||||
icon: 'i-heroicons-user',
|
||||
children: [
|
||||
{
|
||||
label: "Zeiterfassung",
|
||||
to: "/timetracking",
|
||||
icon: "i-heroicons-clock"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "Jobs",
|
||||
to: "/jobs",
|
||||
icon: "i-heroicons-square-3-stack-3d"
|
||||
}
|
||||
label: "Lager",
|
||||
icon: 'i-heroicons-home',
|
||||
children: [
|
||||
{
|
||||
label: "Artikel",
|
||||
to: "/products",
|
||||
icon: "i-heroicons-puzzle-piece"
|
||||
},
|
||||
{
|
||||
label: "Inventar",
|
||||
to: "/inventory",
|
||||
icon: "i-heroicons-square-3-stack-3d"
|
||||
},
|
||||
]
|
||||
},
|
||||
]
|
||||
|
||||
const linksForBreadcrumbs = ref([])
|
||||
@@ -141,6 +176,10 @@ const items = [
|
||||
slot: 'account',
|
||||
disabled: true
|
||||
}], [{
|
||||
label: 'Externe Geräte',
|
||||
icon: 'i-heroicons-cog-8-tooth',
|
||||
to: "/settings/externalDevices"
|
||||
},{
|
||||
label: 'Settings',
|
||||
icon: 'i-heroicons-cog-8-tooth'
|
||||
}], /*[{
|
||||
@@ -181,6 +220,11 @@ const items = [
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<template #panel>
|
||||
<UNavigationTree :links="navLinks"/>
|
||||
</template>
|
||||
|
||||
<template #right v-if="user">
|
||||
<UColorModeButton/>
|
||||
<UDropdown :items="items" :ui="{ item: { disabled: 'cursor-text select-text' } }" :popper="{ placement: 'bottom-start' }">
|
||||
|
||||
48
spaces/components/DatePicker.vue
Normal file
48
spaces/components/DatePicker.vue
Normal file
@@ -0,0 +1,48 @@
|
||||
<script setup lang="ts">
|
||||
import { DatePicker as VCalendarDatePicker } from 'v-calendar'
|
||||
import 'v-calendar/dist/style.css'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Date,
|
||||
default: null
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:model-value', 'close'])
|
||||
|
||||
const colorMode = useColorMode()
|
||||
|
||||
const isDark = computed(() => colorMode.value === 'dark')
|
||||
|
||||
const date = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (value) => {
|
||||
emit('update:model-value', value)
|
||||
emit('close')
|
||||
}
|
||||
})
|
||||
|
||||
const attrs = [{
|
||||
key: 'today',
|
||||
highlight: {
|
||||
color: 'blue',
|
||||
fillMode: 'outline',
|
||||
class: '!bg-gray-100 dark:!bg-gray-800'
|
||||
},
|
||||
dates: new Date()
|
||||
}]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VCalendarDatePicker
|
||||
v-model="date"
|
||||
transparent
|
||||
borderless
|
||||
:attributes="attrs"
|
||||
:is-dark="isDark"
|
||||
title-position="left"
|
||||
trim-weeks
|
||||
:first-day-of-week="2"
|
||||
/>
|
||||
</template>
|
||||
@@ -11,7 +11,6 @@ export default defineNuxtConfig({
|
||||
'@pinia/nuxt',
|
||||
'@nuxt/ui',
|
||||
'@nuxt/content',
|
||||
'@nuxtjs/strapi',
|
||||
'@nuxtjs/supabase',
|
||||
"nuxt-editorjs",
|
||||
'@nuxtjs/fontaine',
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
"@nuxtjs/google-fonts": "^3.1.0",
|
||||
"@nuxtjs/strapi": "^1.9.3",
|
||||
"@pinia/nuxt": "^0.5.1",
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@vicons/ionicons5": "^0.12.0",
|
||||
"@zip.js/zip.js": "^2.7.32",
|
||||
"axios": "^1.6.2",
|
||||
@@ -42,6 +43,8 @@
|
||||
"nuxt-viewport": "^2.0.6",
|
||||
"papaparse": "^5.4.1",
|
||||
"pinia": "^2.1.7",
|
||||
"uuidv4": "^6.2.13"
|
||||
"socket.io-client": "^4.7.2",
|
||||
"uuidv4": "^6.2.13",
|
||||
"v-calendar": "^3.1.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,19 @@
|
||||
<div id="main">
|
||||
<!-- TODO: Kontakte erstellen und dem Kunden zuweisen -->
|
||||
|
||||
<UButton @click="router.push(`/customers/create/`)">+ Kunde</UButton>
|
||||
<div class="flex items-center gap-1">
|
||||
<UButton @click="router.push(`/customers/create/`)">+ Kunde</UButton>
|
||||
|
||||
<UInput
|
||||
v-model="searchString"
|
||||
placeholder="Suche..."
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<UTable
|
||||
:rows="customers"
|
||||
:rows="filteredRows"
|
||||
:columns="customerColumns"
|
||||
@select="selectCustomer"
|
||||
|
||||
@@ -20,6 +29,7 @@ definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
|
||||
|
||||
const router = useRouter()
|
||||
const {customers } = storeToRefs(useDataStore())
|
||||
const mode = ref("show")
|
||||
@@ -42,6 +52,21 @@ const selectCustomer = (customer) => {
|
||||
console.log(customer)
|
||||
router.push(`/customers/show/${customer.id} `)
|
||||
}
|
||||
|
||||
|
||||
const searchString = ref('')
|
||||
|
||||
const filteredRows = computed(() => {
|
||||
if(!searchString.value) {
|
||||
return customers.value
|
||||
}
|
||||
|
||||
return customers.value.filter(item => {
|
||||
return Object.values(item).some((value) => {
|
||||
return String(value).toLowerCase().includes(searchString.value.toLowerCase())
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
<script setup>
|
||||
import * as JSPM from 'jsprintmanager'
|
||||
|
||||
let printers = []
|
||||
let scanners = []
|
||||
|
||||
let printers = ref([])
|
||||
let scanners = ref([])
|
||||
|
||||
|
||||
find().then(devices => {
|
||||
console.log(devices)
|
||||
})
|
||||
|
||||
|
||||
const doScanning = () => {
|
||||
|
||||
@@ -36,16 +43,15 @@ const doPrintZPL = () => {
|
||||
|
||||
|
||||
|
||||
const getPrinters = () => {
|
||||
/*const getPrinters = () => {
|
||||
return new Promise((ok, err) => {
|
||||
let printers = [];
|
||||
let temp = [];
|
||||
if(JSPM.JSPrintManager.websocket_status == JSPM.WSStatus.Open) {
|
||||
JSPM.JSPrintManager.getPrinters().then(function (myPrinters) {
|
||||
printers = myPrinters;
|
||||
console.log(printers);
|
||||
ok(printers);
|
||||
temp = myPrinters;
|
||||
ok(temp);
|
||||
}).catch((e)=>err(e));
|
||||
} else { console.warn("JSPM WS not open"); ok(printers); }
|
||||
} else { console.warn("JSPM WS not open"); ok(temp); }
|
||||
});
|
||||
}
|
||||
const getScanners = () => {
|
||||
@@ -59,19 +65,28 @@ const getScanners = () => {
|
||||
}).catch((e)=>err(e));
|
||||
} else { console.warn("JSPM WS not open"); ok(printers); }
|
||||
});
|
||||
}
|
||||
const initJSPM = () => {
|
||||
}*/
|
||||
const initJSPM = async () => {
|
||||
JSPM.JSPrintManager.auto_reconnect = true
|
||||
JSPM.JSPrintManager.start();
|
||||
await JSPM.JSPrintManager.start();
|
||||
|
||||
JSPM.JSPrintManager.WS.onStatusChanged = () => {
|
||||
JSPM.JSPrintManager.WS.onStatusChanged = async () => {
|
||||
console.log("Status Changed")
|
||||
getPrinters().then(p => printers = p)
|
||||
getScanners().then(s => scanners = s)
|
||||
|
||||
if(JSPM.JSPrintManager.websocket_status === JSPM.WSStatus.Open){
|
||||
printers.value = await JSPM.JSPrintManager.getPrinters()
|
||||
scanners.value = await JSPM.JSPrintManager.getScanners()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
initJSPM()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -81,6 +96,8 @@ initJSPM()
|
||||
|
||||
<UButton @click="doPrintZPL">Print</UButton>
|
||||
|
||||
<UButton @click="initJSPM">Init</UButton>
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<UButton @click="router.push(`/products/create/`)">+ Artikel</UButton>
|
||||
<div class="flex items-center gap-1">
|
||||
<UButton @click="router.push(`/products/create/`)">+ Artikel</UButton>
|
||||
|
||||
<UInput
|
||||
v-model="searchString"
|
||||
placeholder="Suche..."
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
<UInput
|
||||
v-model="searchString"
|
||||
placeholder="Suche..."
|
||||
/>
|
||||
|
||||
<UTable
|
||||
:rows="filteredRows"
|
||||
|
||||
22
spaces/pages/settings/externalDevices.vue
Normal file
22
spaces/pages/settings/externalDevices.vue
Normal file
@@ -0,0 +1,22 @@
|
||||
<script setup>
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UPage>
|
||||
<UCard>
|
||||
<template #header>
|
||||
Etikettendrucker
|
||||
</template>
|
||||
</UCard>
|
||||
<UCard>
|
||||
<template #header>
|
||||
A4 Drucker
|
||||
</template>
|
||||
</UCard>
|
||||
</UPage>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,4 +1,6 @@
|
||||
<script setup>
|
||||
import * as dayjs from "dayjs";
|
||||
|
||||
definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
@@ -7,7 +9,7 @@ const supabase = useSupabaseClient()
|
||||
const user = useSupabaseUser()
|
||||
const toast = useToast()
|
||||
|
||||
const {times, projects} = storeToRefs(useDataStore())
|
||||
const {times, projects, profiles} = storeToRefs(useDataStore())
|
||||
const {fetchTimes, getTimeTypes} = useDataStore()
|
||||
const timeTypes = getTimeTypes
|
||||
const timeInfo = ref({
|
||||
@@ -212,7 +214,7 @@ const selectStartedTime = () => {
|
||||
|
||||
<div class="mt-3">
|
||||
Aktuelle gestarteter Eintrag:
|
||||
{{runningTimeInfo.id ? runningTimeInfo : "Keine Zeit gewählt"}}
|
||||
{{runningTimeInfo.id ? runningTimeInfo : "Keine Zeit gestartet"}}
|
||||
|
||||
|
||||
|
||||
@@ -268,7 +270,18 @@ const selectStartedTime = () => {
|
||||
v-if="times && user"
|
||||
:columns="columns"
|
||||
:rows="times.filter(time => time.user === user.id)"
|
||||
/>
|
||||
>
|
||||
<template #user-data="{row}">
|
||||
{{profiles.find(profile => profile.id === row.user) ? profiles.find(profile => profile.id === row.user).firstName + " " + profiles.find(profile => profile.id === row.user).lastName : row.user }}
|
||||
</template>
|
||||
|
||||
<template #start-data="{row}">
|
||||
{{dayjs(row.start).format("DD.MM.YY HH:mm")}}
|
||||
</template>
|
||||
<template #end-data="{row}">
|
||||
{{dayjs(row.end).format("DD.MM.YY HH:mm")}}
|
||||
</template>
|
||||
</UTable>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,73 +1,80 @@
|
||||
<template>
|
||||
<div id="main">
|
||||
<div id="left">
|
||||
|
||||
<router-link to="/vendorinvoices/edit"><UButton>+ Lieferantenrechnung</UButton></router-link>
|
||||
|
||||
|
||||
|
||||
<a v-for="item in dataStore.getVendorInvoiceList" @click="selectItem(item)">
|
||||
<UCard class="listItem">
|
||||
<UBadge>{{item.id}}</UBadge> {{item.date}}
|
||||
</UCard>
|
||||
</a>
|
||||
|
||||
|
||||
<div class="flex items-center gap-1">
|
||||
<UButton @click="router.push(`/vendorinvoices/create/`)">+ Eingangsrechnung</UButton>
|
||||
|
||||
<UInput
|
||||
v-model="searchString"
|
||||
placeholder="Suche..."
|
||||
/>
|
||||
</div>
|
||||
<div id="right">
|
||||
|
||||
<UCard v-if="selectedItem.id">
|
||||
<template #header>
|
||||
<UBadge>{{selectedItem.id}}</UBadge> {{selectedItem.name}}
|
||||
</template>
|
||||
<UTable :rows="selectedItem.lineItems"></UTable>
|
||||
{{selectedItem}}
|
||||
|
||||
|
||||
</UCard>
|
||||
</div>
|
||||
|
||||
<UTable
|
||||
:rows="filteredRows"
|
||||
:columns="itemColumns"
|
||||
@select="selectItem"
|
||||
|
||||
/>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
import {useDataStore} from "~/stores/data.ts";
|
||||
import {storeToRefs} from "pinia"
|
||||
definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
|
||||
|
||||
const showCreateProject = ref(false)
|
||||
const showCreateCustomer = ref(false)
|
||||
const projectData = ref({})
|
||||
const router = useRouter()
|
||||
const {vendorInvoices } = storeToRefs(useDataStore())
|
||||
const mode = ref("show")
|
||||
|
||||
const itemColumns = [
|
||||
{
|
||||
key: 'vendor',
|
||||
label: "Lieferantennr.",
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
key: "reference",
|
||||
label: "Referenz",
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
key: "date",
|
||||
label: "Datum",
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
|
||||
const dataStore = useDataStore()
|
||||
|
||||
const {projects} = storeToRefs(dataStore)
|
||||
const {addCustomer} = dataStore
|
||||
const {addProject} = dataStore
|
||||
let selectedItem = ref({})
|
||||
|
||||
const selectItem = (item) => {
|
||||
selectedItem.value = item
|
||||
console.log(item)
|
||||
router.push(`/vendorinvoices/show/${item.id} `)
|
||||
}
|
||||
|
||||
|
||||
const searchString = ref('')
|
||||
|
||||
const filteredRows = computed(() => {
|
||||
if(!searchString.value) {
|
||||
return vendorInvoices.value
|
||||
}
|
||||
|
||||
return vendorInvoices.value.filter(item => {
|
||||
return Object.values(item).some((value) => {
|
||||
return String(value).toLowerCase().includes(searchString.value.toLowerCase())
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
#main {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
#left {
|
||||
width: 25vw;
|
||||
}
|
||||
|
||||
#right {
|
||||
width: 60vw;
|
||||
padding-left: 3vw;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
167
spaces/pages/vendors/[mode]/[[id]].vue
vendored
Normal file
167
spaces/pages/vendors/[mode]/[[id]].vue
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
<script setup>
|
||||
definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
|
||||
//
|
||||
const supabase = useSupabaseClient()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const toast = useToast()
|
||||
const id = ref(route.params.id ? route.params.id : null )
|
||||
|
||||
|
||||
//Store
|
||||
const {vendors } = storeToRefs(useDataStore())
|
||||
const {fetchVendors, getVendorById} = useDataStore()
|
||||
|
||||
let currentItem = null
|
||||
|
||||
|
||||
|
||||
//Working
|
||||
const mode = ref(route.params.mode || "show")
|
||||
const itemInfo = ref({})
|
||||
|
||||
//Functions
|
||||
const setupPage = () => {
|
||||
if(mode.value === "show" || mode.value === "edit"){
|
||||
currentItem = getVendorById(Number(useRoute().params.id))
|
||||
}
|
||||
|
||||
if(mode.value === "edit") itemInfo.value = currentItem
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
const createItem = async () => {
|
||||
const {data,error} = await supabase
|
||||
.from("vendors")
|
||||
.insert([itemInfo.value])
|
||||
.select()
|
||||
|
||||
if(error) {
|
||||
console.log(error)
|
||||
} else {
|
||||
mode.value = "show"
|
||||
itemInfo.value = {}
|
||||
toast.add({title: "Lieferant erfolgreich erstellt"})
|
||||
await fetchVendors()
|
||||
router.push(`/vendors/show/${data[0].id}`)
|
||||
setupPage()
|
||||
}
|
||||
}
|
||||
|
||||
const editItem = async () => {
|
||||
router.push(`/vendors/edit/${currentItem.id}`)
|
||||
setupPage()
|
||||
}
|
||||
|
||||
const cancelEditorCreate = () => {
|
||||
router.push(`/vendors/`)
|
||||
}
|
||||
|
||||
const updateItem = async () => {
|
||||
const {error} = await supabase
|
||||
.from("vendors")
|
||||
.update(itemInfo.value)
|
||||
.eq('id',itemInfo.value.id)
|
||||
|
||||
if(error) {
|
||||
console.log(error)
|
||||
} else {
|
||||
mode.value = "show"
|
||||
itemInfo.value = {}
|
||||
toast.add({title: "Lieferant erfolgreich gespeichert"})
|
||||
fetchVendors()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
setupPage()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<UCard v-if="currentItem && mode == 'show'" >
|
||||
<template #header>
|
||||
{{currentItem.name}}
|
||||
</template>
|
||||
|
||||
{{currentItem}}
|
||||
|
||||
|
||||
|
||||
<template #footer>
|
||||
<UButton
|
||||
v-if="mode == 'show' && currentItem.id"
|
||||
@click="editItem"
|
||||
>
|
||||
Bearbeiten
|
||||
</UButton>
|
||||
<UButton
|
||||
color="red"
|
||||
class="ml-2"
|
||||
disabled
|
||||
>
|
||||
Archivieren
|
||||
</UButton>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
</UCard>
|
||||
<UCard v-else-if="mode == 'edit' || mode == 'create'" >
|
||||
<template #header>
|
||||
{{itemInfo.name}}
|
||||
</template>
|
||||
|
||||
<UFormGroup
|
||||
label="Name:"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.name"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Lieferantennr.:"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.vendorNumber"
|
||||
/>
|
||||
</UFormGroup>
|
||||
|
||||
|
||||
<template #footer>
|
||||
<UButton
|
||||
v-if="mode == 'edit'"
|
||||
@click="updateItem"
|
||||
>
|
||||
Speichern
|
||||
</UButton>
|
||||
<UButton
|
||||
v-else-if="mode == 'create'"
|
||||
@click="createItem"
|
||||
>
|
||||
Erstellen
|
||||
</UButton>
|
||||
<UButton
|
||||
@click="cancelEditorCreate"
|
||||
color="red"
|
||||
class="ml-2"
|
||||
>
|
||||
Abbrechen
|
||||
</UButton>
|
||||
</template>
|
||||
|
||||
</UCard>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
74
spaces/pages/vendors/index.vue
vendored
Normal file
74
spaces/pages/vendors/index.vue
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
<template>
|
||||
<div id="main">
|
||||
<!-- TODO: Kontakte erstellen und dem Lieferanten zuweisen -->
|
||||
|
||||
<div class="flex items-center gap-1">
|
||||
<UButton @click="router.push(`/vendors/create/`)">+ Lieferant</UButton>
|
||||
|
||||
<UInput
|
||||
v-model="searchString"
|
||||
placeholder="Suche..."
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<UTable
|
||||
:rows="filteredRows"
|
||||
:columns="itemColumns"
|
||||
@select="selectItem"
|
||||
|
||||
/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
|
||||
|
||||
const router = useRouter()
|
||||
const {vendors } = storeToRefs(useDataStore())
|
||||
const mode = ref("show")
|
||||
|
||||
const itemColumns = [
|
||||
{
|
||||
key: 'vendorNumber',
|
||||
label: "Lieferantennr.",
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
key: "name",
|
||||
label: "Name",
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
const selectItem = (item) => {
|
||||
console.log(item)
|
||||
router.push(`/vendors/show/${item.id} `)
|
||||
}
|
||||
|
||||
|
||||
const searchString = ref('')
|
||||
|
||||
const filteredRows = computed(() => {
|
||||
if(!searchString.value) {
|
||||
return vendors.value
|
||||
}
|
||||
|
||||
return vendors.value.filter(item => {
|
||||
return Object.values(item).some((value) => {
|
||||
return String(value).toLowerCase().includes(searchString.value.toLowerCase())
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -32,6 +32,8 @@ export const useDataStore = defineStore('data', {
|
||||
formSubmits: [] as any[],
|
||||
contacts: [] as any[],
|
||||
vehicles: [] as any[],
|
||||
vendors: [] as any[],
|
||||
vendorInvoices: [] as any[]
|
||||
}),
|
||||
actions: {
|
||||
async fetchData() {
|
||||
@@ -54,6 +56,8 @@ export const useDataStore = defineStore('data', {
|
||||
await this.fetchMovements()
|
||||
await this.fetchSpaces()
|
||||
await this.fetchVehicles()
|
||||
await this.fetchVendors()
|
||||
await this.fetchVendorInvoices()
|
||||
|
||||
},
|
||||
async fetchOwnTenant() {
|
||||
@@ -117,6 +121,14 @@ export const useDataStore = defineStore('data', {
|
||||
// @ts-ignore
|
||||
this.jobs = (await supabase.from("jobs").select()).data
|
||||
},
|
||||
async fetchVendors() {
|
||||
// @ts-ignore
|
||||
this.vendors = (await supabase.from("vendors").select()).data
|
||||
},
|
||||
async fetchVendorInvoices() {
|
||||
// @ts-ignore
|
||||
this.vendorInvoices = (await supabase.from("vendorinvoices").select()).data
|
||||
},
|
||||
async fetchDocuments() {
|
||||
// @ts-ignore
|
||||
this.documents = (await supabase.from("documents").select()).data
|
||||
@@ -142,6 +154,8 @@ export const useDataStore = defineStore('data', {
|
||||
|
||||
},
|
||||
getProductById: (state) => (productId:number) => state.products.find(product => product.id === productId),
|
||||
getVendorById: (state) => (itemId:number) => state.vendors.find(item => item.id === itemId),
|
||||
getVendorInvoiceById: (state) => (itemId:number) => state.vendorInvoices.find(item => item.id === itemId),
|
||||
getProjectById: (state) => (projectId:number) => {
|
||||
let project = state.projects.find(project => project.id === projectId)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user