Changes
This commit is contained in:
2
app.vue
2
app.vue
@@ -42,7 +42,9 @@ useSeoMeta({
|
||||
<NuxtPage/>
|
||||
</NuxtLayout>
|
||||
|
||||
<!--
|
||||
<UNotifications/>
|
||||
-->
|
||||
<VitePwaManifest/>
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,49 @@ export const useSupabaseSelect = async (relation,select = '*', sortColumn = null
|
||||
return data
|
||||
}
|
||||
|
||||
export const useSupabaseSelectDocuments = async (select = '*', sortColumn = null) => {
|
||||
const supabase = useSupabaseClient()
|
||||
const dataStore = useDataStore()
|
||||
let data = null
|
||||
|
||||
|
||||
if(sortColumn !== null ) {
|
||||
data = (await supabase
|
||||
.from("documents")
|
||||
.select(select)
|
||||
.eq("tenant", dataStore.currentTenant)
|
||||
.order(sortColumn, {ascending: true})).data
|
||||
} else {
|
||||
data = (await supabase
|
||||
.from("documents")
|
||||
.select(select)
|
||||
.eq("tenant", dataStore.currentTenant)).data
|
||||
}
|
||||
|
||||
if(data.length > 0){
|
||||
let paths = []
|
||||
data.forEach(doc => {
|
||||
paths.push(doc.path)
|
||||
})
|
||||
|
||||
const {data: supabaseData,error} = await supabase.storage.from('files').createSignedUrls(paths,3600)
|
||||
|
||||
data = data.map((doc,index) => {
|
||||
|
||||
return {
|
||||
...doc,
|
||||
url: supabaseData[index].signedUrl
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
console.log(data)
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
export const useSupabaseSelectSingle = async (relation,idToEq,select = '*' ) => {
|
||||
const supabase = useSupabaseClient()
|
||||
const dataStore = useDataStore()
|
||||
|
||||
@@ -296,6 +296,10 @@ let links = computed(() => {
|
||||
label: "Vorgänge",
|
||||
to: "/inventory",
|
||||
icon: "i-heroicons-square-3-stack-3d"
|
||||
},{
|
||||
label: "Bestände",
|
||||
to: "/inventory/stocks",
|
||||
icon: "i-heroicons-square-3-stack-3d"
|
||||
},
|
||||
{
|
||||
label: "Lagerplätze",
|
||||
|
||||
8
package-lock.json
generated
8
package-lock.json
generated
@@ -48,7 +48,8 @@
|
||||
"uuidv4": "^6.2.13",
|
||||
"v-calendar": "^3.1.2",
|
||||
"vuedraggable": "^4.1.0",
|
||||
"vuetify": "^3.4.0-beta.1"
|
||||
"vuetify": "^3.4.0-beta.1",
|
||||
"zebra-browser-print-wrapper": "^0.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nuxt/devtools": "latest",
|
||||
@@ -19292,6 +19293,11 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/zebra-browser-print-wrapper": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/zebra-browser-print-wrapper/-/zebra-browser-print-wrapper-0.1.4.tgz",
|
||||
"integrity": "sha512-w0mqnq83flxnNTgSgzkvSZWgnP/ffD0v+a5smOHUhB3UiaWqkDqIXzS6n6QnD6BBjE0qdrmlCmzoasSogEBJlw=="
|
||||
},
|
||||
"node_modules/zhead": {
|
||||
"version": "2.2.4",
|
||||
"resolved": "https://registry.npmjs.org/zhead/-/zhead-2.2.4.tgz",
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
"uuidv4": "^6.2.13",
|
||||
"v-calendar": "^3.1.2",
|
||||
"vuedraggable": "^4.1.0",
|
||||
"vuetify": "^3.4.0-beta.1"
|
||||
"vuetify": "^3.4.0-beta.1",
|
||||
"zebra-browser-print-wrapper": "^0.1.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,6 +232,7 @@ const saveRowDescription = () => {
|
||||
}
|
||||
|
||||
|
||||
|
||||
const removePosition = (id) => {
|
||||
let rows = itemInfo.value.rows.filter(row => row.id !== id)
|
||||
/*rows = rows.sort((a,b) => a.pos - b.pos)
|
||||
@@ -397,6 +398,8 @@ const saveDocument = async () => {
|
||||
project: itemInfo.value.project,
|
||||
documentNumber: itemInfo.value.documentNumber,
|
||||
documentDate: itemInfo.value.documentDate,
|
||||
deliveryDate: itemInfo.value.deliveryDate,
|
||||
paymentDays: itemInfo.value.paymentDays,
|
||||
deliveryDateType: itemInfo.value.deliveryDateType,
|
||||
info: {
|
||||
|
||||
@@ -932,6 +935,7 @@ setupPage()
|
||||
<span class="truncate">{{dataStore.getProductById(row.product) ? dataStore.getProductById(row.product).name : "Kein Produkt ausgewählt" }}</span>
|
||||
</template>
|
||||
</USelectMenu>
|
||||
{{dataStore.getProductById(66)}}
|
||||
</td>
|
||||
<td
|
||||
class="w-120"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup>
|
||||
|
||||
import {BlobReader, BlobWriter, ZipWriter} from "@zip.js/zip.js";
|
||||
import {useSupabaseSelectDocuments} from "~/composables/useSupabase.js";
|
||||
|
||||
definePageMeta({
|
||||
middleware: "auth"
|
||||
@@ -24,15 +25,24 @@ const fileUploadFormData = ref({
|
||||
let tags = dataStore.getDocumentTags
|
||||
|
||||
const selectedTags = ref("Eingang")
|
||||
const documents = ref([])
|
||||
|
||||
const setupPage = async () => {
|
||||
documents.value = await useSupabaseSelectDocuments("*, project(id,name), customer(id,name), contract(id,name), vendor(id,name), plant(id,name), vehicle(id,licensePlate), product(id,name), profile(id,fullName) ")
|
||||
}
|
||||
|
||||
|
||||
setupPage()
|
||||
const filteredDocuments = computed(() => {
|
||||
let returnList = []
|
||||
|
||||
returnList = dataStore.documents.filter(i => i.tags.filter(t => selectedTags.value === t).length > 0)
|
||||
if(selectedTags.value !== "Archiviert") {
|
||||
return documents.value.filter(i => i.tags.find(t => selectedTags.value === t) && !i.tags.includes("Archiviert"))
|
||||
} else {
|
||||
return documents.value.filter(i => i.tags.find(t => selectedTags.value === t))
|
||||
}
|
||||
|
||||
|
||||
|
||||
//return dataStore.documents.filter(doc => doc.tags.filter(tag => selectedTags.value.find(t => t === tag)).length > 0)
|
||||
return returnList
|
||||
|
||||
})
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ const availableDocuments = computed(() => {
|
||||
//console.log(dataStore.documents.filter(i => i.tags.includes('Eingangsrechnung') && !dataStore.incominginvoices.find(x => x.document === i.id)))
|
||||
//console.log(dataStore.documents.filter(i => i.tags.includes('Eingangsrechnung')).length)
|
||||
|
||||
return dataStore.documents.filter(i => i.tags.includes('Eingangsrechnung') && !dataStore.incominginvoices.find(x => x.document === i.id))
|
||||
return dataStore.documents.filter(i => i.tags.includes('Eingangsrechnung') && !i.tags.includes("Archiviert") && !dataStore.incominginvoices.find(x => x.document === i.id))
|
||||
})
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ const itemInfo = ref({
|
||||
reference: "",
|
||||
date: null,
|
||||
dueDate: null,
|
||||
paymentType: "",
|
||||
paymentType: "Überweisung",
|
||||
description: "",
|
||||
state: "Entwurf",
|
||||
accounts: [
|
||||
@@ -315,6 +315,13 @@ setupPage()
|
||||
|
||||
|
||||
|
||||
<UFormGroup label="Zahlart:" required>
|
||||
<USelectMenu
|
||||
:options="['Einzug','Kreditkarte','Überweisung','Sonstiges']"
|
||||
v-model="itemInfo.paymentType"
|
||||
/>
|
||||
</UFormGroup>
|
||||
|
||||
<UFormGroup label="Beschreibung:" required>
|
||||
<UTextarea
|
||||
v-model="itemInfo.description"
|
||||
|
||||
@@ -73,6 +73,10 @@ const templateColumns = [
|
||||
{
|
||||
key: "paid",
|
||||
label: "Bezahlt"
|
||||
},
|
||||
{
|
||||
key: "paymentType",
|
||||
label: "Zahlart"
|
||||
}
|
||||
]
|
||||
const selectedColumns = ref(templateColumns)
|
||||
|
||||
@@ -15,7 +15,8 @@ const inventoryChangeData = ref({
|
||||
sourceProjectId: null,
|
||||
destinationSpaceId: null,
|
||||
destinationProjectId: null,
|
||||
quantity: 1
|
||||
quantity: 1,
|
||||
serials: []
|
||||
})
|
||||
|
||||
const resetInput = () => {
|
||||
@@ -93,7 +94,14 @@ const createMovement = async () => {
|
||||
.from("movements")
|
||||
.insert(movements)
|
||||
.select()
|
||||
if(error) console.log(error)
|
||||
if(error) {
|
||||
console.log(error)
|
||||
} else {
|
||||
resetInput()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -146,6 +154,7 @@ const findSpaceBySpaceNumber = (input) => {
|
||||
|
||||
const barcodeInput = ref("")
|
||||
const showBarcodeTip = ref(true)
|
||||
const serialInput = ref("")
|
||||
|
||||
const processBarcodeInput = () => {
|
||||
if(findProductByBarcodeOrEAN(barcodeInput.value) && !findSpaceBySpaceNumber(barcodeInput.value)){
|
||||
@@ -380,6 +389,29 @@ const processBarcodeInput = () => {
|
||||
id="quantityInput"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Seriennummern:"
|
||||
class="mt-3 w-80"
|
||||
>
|
||||
<InputGroup class="w-full">
|
||||
<UInput
|
||||
variant="outline"
|
||||
color="primary"
|
||||
placeholder="Seriennummern"
|
||||
v-model="serialInput"
|
||||
/>
|
||||
<UButton
|
||||
@click="inventoryChangeData.serials.push(serialInput)"
|
||||
>
|
||||
+
|
||||
</UButton>
|
||||
</InputGroup>
|
||||
|
||||
</UFormGroup>
|
||||
|
||||
<ul>
|
||||
<li v-for="serial in inventoryChangeData.serials">{{serial}}</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</UDashboardPanelContent>
|
||||
|
||||
152
pages/inventory/stocks.vue
Normal file
152
pages/inventory/stocks.vue
Normal file
@@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<UDashboardNavbar title="Bestände" :badge="filteredRows.length">
|
||||
<template #right>
|
||||
<UInput
|
||||
id="searchinput"
|
||||
v-model="searchString"
|
||||
icon="i-heroicons-funnel"
|
||||
autocomplete="off"
|
||||
placeholder="Suche..."
|
||||
class="hidden lg:block"
|
||||
@keydown.esc="$event.target.blur()"
|
||||
>
|
||||
<template #trailing>
|
||||
<UKbd value="/" />
|
||||
</template>
|
||||
</UInput>
|
||||
|
||||
<UButton @click="router.push(`/products/create`)">+ Artikel</UButton>
|
||||
</template>
|
||||
</UDashboardNavbar>
|
||||
|
||||
<UDashboardToolbar>
|
||||
|
||||
<template #right>
|
||||
<USelectMenu
|
||||
v-model="selectedColumns"
|
||||
icon="i-heroicons-adjustments-horizontal-solid"
|
||||
:options="templateColumns"
|
||||
multiple
|
||||
class="hidden lg:block"
|
||||
by="key"
|
||||
>
|
||||
<template #label>
|
||||
Spalten
|
||||
</template>
|
||||
</USelectMenu>
|
||||
</template>
|
||||
</UDashboardToolbar>
|
||||
<UTable
|
||||
:rows="filteredRows"
|
||||
:columns="columns"
|
||||
class="w-full"
|
||||
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
|
||||
@select="(i) => router.push(`/products/show/${i.id}`) "
|
||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Artikel anzuzeigen' }"
|
||||
>
|
||||
<template #name-data="{row}">
|
||||
<span
|
||||
v-if="row === filteredRows[selectedItem]"
|
||||
class="text-primary-500 font-bold">{{row.name}}</span>
|
||||
<span v-else>
|
||||
{{row.name}}
|
||||
</span>
|
||||
|
||||
</template>
|
||||
<template #stock-data="{row}">
|
||||
{{`${dataStore.getStockByProductId(row.id)} ${(dataStore.units.find(unit => unit.id === row.unit) ? dataStore.units.find(unit => unit.id === row.unit).name : "")}`}}
|
||||
</template>
|
||||
|
||||
</UTable>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
|
||||
defineShortcuts({
|
||||
'/': () => {
|
||||
document.getElementById("searchinput").focus()
|
||||
},
|
||||
'+': () => {
|
||||
router.push("/products/create")
|
||||
},
|
||||
'Enter': {
|
||||
usingInput: true,
|
||||
handler: () => {
|
||||
router.push(`/products/show/${filteredRows.value[selectedItem.value].id}`)
|
||||
}
|
||||
},
|
||||
'arrowdown': () => {
|
||||
if(selectedItem.value < filteredRows.value.length - 1) {
|
||||
selectedItem.value += 1
|
||||
} else {
|
||||
selectedItem.value = 0
|
||||
}
|
||||
},
|
||||
'arrowup': () => {
|
||||
if(selectedItem.value === 0) {
|
||||
selectedItem.value = filteredRows.value.length - 1
|
||||
} else {
|
||||
selectedItem.value -= 1
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const dataStore = useDataStore()
|
||||
const router = useRouter()
|
||||
|
||||
const items = ref([])
|
||||
const selectedItem = ref(0)
|
||||
|
||||
const setupPage = async () => {
|
||||
items.value = await useSupabaseSelect("products","*")
|
||||
}
|
||||
|
||||
setupPage()
|
||||
|
||||
|
||||
const templateColumns = [
|
||||
{
|
||||
key: "stock",
|
||||
label: "Bestand"
|
||||
},
|
||||
{
|
||||
key: "name",
|
||||
label: "Name",
|
||||
sortable: true
|
||||
},
|
||||
]
|
||||
const selectedColumns = ref(templateColumns)
|
||||
const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
|
||||
|
||||
const templateTags = computed(() => {
|
||||
let temp = []
|
||||
|
||||
dataStore.products.forEach(row => {
|
||||
row.tags.forEach(tag => {
|
||||
if(!temp.includes(tag)) temp.push(tag)
|
||||
})
|
||||
})
|
||||
|
||||
return temp
|
||||
|
||||
})
|
||||
const selectedTags = ref(templateTags.value)
|
||||
|
||||
const searchString = ref('')
|
||||
|
||||
const filteredRows = computed(() => {
|
||||
let temp = items.value.filter(i => i.tags.some(x => selectedTags.value.includes(x)) || i.tags.length === 0)
|
||||
|
||||
return useSearch(searchString.value, temp)
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -128,8 +128,11 @@ setupPage()
|
||||
<UDivider
|
||||
class="my-2"
|
||||
/>
|
||||
<span v-if="itemInfo.purchasePrice">Einkaufspreis: {{Number(itemInfo.purchasePrice).toFixed(2)}} €<br></span>
|
||||
|
||||
<span v-if="itemInfo.manufacturer">Hersteller: {{itemInfo.manufacturer}}<br></span>
|
||||
<span v-if="itemInfo.manufacturerNumber">Herstellernummer: {{itemInfo.manufacturerNumber}}<br></span>
|
||||
<span v-if="itemInfo.description">Beschreibung: {{itemInfo.description}}<br></span>
|
||||
<span v-if="itemInfo.purchasePrice">Einkaufspreis: {{Number(itemInfo.purchasePrice).toFixed(2)}} €<br></span>
|
||||
</div>
|
||||
<div
|
||||
v-if="item.label === 'Logbuch'"
|
||||
@@ -222,13 +225,13 @@ setupPage()
|
||||
v-model="itemInfo.ean"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
<!-- <UFormGroup
|
||||
label="Barcode:"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.barcode"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</UFormGroup>-->
|
||||
<UFormGroup
|
||||
label="Verkaufspreis:"
|
||||
>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
import axios from "axios";
|
||||
|
||||
import ZebraBrowserPrintWrapper from "zebra-browser-print-wrapper"
|
||||
definePageMeta({
|
||||
middleware: "auth"
|
||||
})
|
||||
@@ -11,6 +11,8 @@ const router = useRouter()
|
||||
const toast = useToast()
|
||||
const id = ref(route.params.id ? route.params.id : null )
|
||||
|
||||
const browserPrint = ZebraBrowserPrintWrapper();
|
||||
|
||||
let currentItem = ref(null)
|
||||
|
||||
//Working
|
||||
@@ -36,6 +38,8 @@ const setupPage = async () => {
|
||||
}
|
||||
|
||||
if(mode.value === "edit") itemInfo.value = currentItem.value
|
||||
|
||||
|
||||
}
|
||||
|
||||
const cancelEditorCreate = () => {
|
||||
|
||||
@@ -1456,11 +1456,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
|
||||
//Get Item By Id
|
||||
const getProductById = computed(() => async (itemId) => {
|
||||
|
||||
return await useSupabaseSelectSingle("products",itemId, "*")
|
||||
|
||||
|
||||
//return products.value.find(item => item.id === itemId)
|
||||
return products.value.find(item => item.id === itemId)
|
||||
})
|
||||
|
||||
const getServiceById = computed(() => (itemId) => {
|
||||
|
||||
Reference in New Issue
Block a user