This commit is contained in:
2025-09-28 14:32:21 +02:00
parent 1c3c6adcc2
commit 4e61b20ba8
6 changed files with 0 additions and 956 deletions

View File

@@ -1,88 +0,0 @@
<script setup>
const route = useRoute()
const router = useRouter()
const supabase = useSupabaseClient()
const currentSubmission = (await supabase.from("formSubmits").select().eq('id',route.params.id)).data[0]
const form = (await supabase.from("forms").select().eq('id',currentSubmission.formType)).data[0]
const formData = ref({})
const submitted = ref(currentSubmission.submitted)
const submitForm = async () => {
submitted.value = true
console.log(formData.value)
const {data,error} = await supabase
.from("formSubmits")
.update({values: formData.value, submitted: true})
.eq('id',currentSubmission.id)
.select()
if(error) {
console.log(error)
} else if( data) {
formData.value = {}
}
}
</script>
<template>
<div>
<UForm
v-if="!submitted"
@submit="submitForm"
@reset="formData = {}"
>
<div
v-for="item in form.fields"
>
<p v-if="item.type === 'header'">{{item.label}}</p>
<UFormGroup
v-else-if="item.type.includes('Input')"
:label="item.required ? item.label + '*' : item.label"
>
<UInput
v-if="item.type === 'textInput'"
v-model="formData[item.key]"
:required="item.required"
/>
<UInput
v-else-if="item.type === 'numberInput'"
v-model="formData[item.key]"
:required="item.required"
type="number"
inputmode="numeric"
/>
</UFormGroup>
</div>
<UButton type="submit">
Abschicken
</UButton>
<UButton
type="reset"
color="rose"
class="m-2"
>
Zurücksetzen
</UButton>
</UForm>
<div v-else>
Dieses Formular wurde bereits abgeschickt. Möchten Sie erneut Daten abschicken, sprechen Sie bitte Ihren Ansprechpartner an, um das Formular freizuschalten.
</div>
</div>
</template>
<style scoped>
</style>

View File

@@ -1,426 +0,0 @@
<script setup>
const dataStore = useDataStore()
const profileStore = useProfileStore()
const supabase = useSupabaseClient()
const router = useRouter()
const mode = ref("incoming")
const toast = useToast()
const inventoryChangeData = ref({
productId: null,
sourceSpaceId: null,
sourceProjectId: null,
destinationSpaceId: null,
destinationProjectId: null,
quantity: 1,
serials: []
})
const resetInput = () => {
inventoryChangeData.value = {
productId: null,
sourceSpaceId: null,
sourceProjectId: null,
destinationSpaceId: null,
destinationProjectId: null,
quantity: 1
}
}
const createMovement = async () => {
let movements = []
if(mode.value === 'incoming'){
let movement = {
productId: inventoryChangeData.value.productId,
spaceId: inventoryChangeData.value.destinationSpaceId,
projectId: inventoryChangeData.value.destinationProjectId,
quantity: inventoryChangeData.value.quantity,
profileId: profileStore.activeProfile.id,
tenant: profileStore.currentTenant
}
movements.push(movement)
/*const {error} = await supabase
.from("movements")
.insert([inventoryChangeData.value])
.select()
if(error) console.log(error)*/
} else if (mode.value === 'outgoing'){
let movement = {
productId: inventoryChangeData.value.productId,
spaceId: inventoryChangeData.value.sourceSpaceId,
projectId: inventoryChangeData.value.sourceProjectId,
quantity: inventoryChangeData.value.quantity * -1,
profileId: profileStore.activeProfile.id,
tenant: profileStore.currentTenant
}
movements.push(movement)
} else if (mode.value === 'change'){
let outMovement = {
productId: inventoryChangeData.value.productId,
spaceId: inventoryChangeData.value.sourceSpaceId,
projectId: inventoryChangeData.value.sourceProjectId,
quantity: inventoryChangeData.value.quantity * -1,
profileId: profileStore.activeProfile.id,
tenant: profileStore.currentTenant
}
let inMovement = {
productId: inventoryChangeData.value.productId,
spaceId: inventoryChangeData.value.destinationSpaceId,
projectId: inventoryChangeData.value.destinationProjectId,
quantity: inventoryChangeData.value.quantity,
profileId: profileStore.activeProfile.id,
tenant: profileStore.currentTenant
}
movements.push(outMovement)
movements.push(inMovement)
}
console.log(movements)
const {error} = await supabase
.from("movements")
.insert(movements)
.select()
if(error) {
console.log(error)
} else {
resetInput()
}
}
defineShortcuts({
meta_enter: {
usingInput: true,
handler: () => {
createMovement()
}
}
})
function checkProductId(productId) {
return dataStore.products.filter(product =>product.id === productId).length > 0;
}
function checkSpaceId(spaceId) {
return dataStore.spaces.filter(space => space.id === spaceId).length > 0;
}
function checkProjectId(projectId) {
return dataStore.projects.some(i => i.id === projectId)
}
function changeFocusToSpaceId() {
document.getElementById('spaceIdInput').focus()
}
function changeFocusToQuantity() {
document.getElementById('quantityInput').focus()
}
function changeFocusToBarcode() {
document.getElementById('barcodeInput').focus()
}
const findProductByBarcodeOrEAN = (input) => {
return dataStore.products.find(i => i.barcode === input || i.ean === input || i.articleNumber === input)
}
const findSpaceBySpaceNumber = (input) => {
return dataStore.spaces.find(i => i.spaceNumber === input)
}
const barcodeInput = ref("")
const showBarcodeTip = ref(true)
const serialInput = ref("")
const processBarcodeInput = () => {
if(findProductByBarcodeOrEAN(barcodeInput.value) && !findSpaceBySpaceNumber(barcodeInput.value)){
//Set Product
inventoryChangeData.value.productId = findProductByBarcodeOrEAN(barcodeInput.value).id
} else if (!findProductByBarcodeOrEAN(barcodeInput.value) && findSpaceBySpaceNumber(barcodeInput.value)){
//Set Space
if(mode.value === 'incoming'){
inventoryChangeData.value.destinationSpaceId = findSpaceBySpaceNumber(barcodeInput.value).id
} else if(mode.value === 'outgoing') {
inventoryChangeData.value.sourceSpaceId = findSpaceBySpaceNumber(barcodeInput.value).id
} else if(mode.value === 'change') {
if(!inventoryChangeData.value.sourceSpaceId){
inventoryChangeData.value.sourceSpaceId = findSpaceBySpaceNumber(barcodeInput.value).id
} else {
inventoryChangeData.value.destinationSpaceId = findSpaceBySpaceNumber(barcodeInput.value).id
}
}
//console.log(findSpaceBySpaceNumber(barcodeInput.value))
}
barcodeInput.value = ""
//console.log(movementData.value)
}
</script>
<template>
<UDashboardNavbar
title="Lager Vorgänge"
>
<template #right>
<UButton
@click="resetInput"
class="mt-3"
color="rose"
variant="outline"
>
Abbrechen
</UButton>
<UButton
@click="createMovement"
:disabled="mode === '' && checkSpaceId(inventoryChangeData.spaceId) && checkProductId(inventoryChangeData.productId)"
class="mt-3"
>
Bestätigen
</UButton>
</template>
</UDashboardNavbar>
<UDashboardPanelContent>
<div class="w-80 mx-auto mt-5">
<div class="flex flex-col">
<UButton
@click="mode = 'incoming'"
class="my-2"
:variant="mode === 'incoming' ? 'solid' : 'outline'"
>Wareneingang</UButton>
<UButton
@click="mode = 'outgoing'"
class="my-2"
:variant="mode === 'outgoing' ? 'solid' : 'outline'"
>Warenausgang</UButton>
<UButton
@click="mode = 'change'"
class="my-2"
:variant="mode === 'change' ? 'solid' : 'outline'"
>Umlagern</UButton>
</div>
<UAlert
title="Info"
variant="outline"
color="primary"
v-if="showBarcodeTip"
@close="showBarcodeTip = false"
:close-button="{ icon: 'i-heroicons-x-mark-20-solid', color: 'gray', variant: 'link', padded: false }"
description="Über die Barcode Eingabe können folgende Werte automatisch erkannt werden: Quelllagerplatz, Ziellagerplatz, Artikel (EAN oder Barcode). Es wird immer zuerst der Quell- und anschließend der Ziellagerplatz ausgefüllt."
/>
<!-- <UTooltip
text="Über die Barcode Eingabe könenn folgende Werte automatisch erkannt werden: Quell Lagerplatz, Ziellagerplatz, Artikel(EAN oder Barcode). Es wird immer zuerst der Quell- und anschließend der Ziellagerplatz ausgefüllt."
>-->
<UFormGroup
label="Barcode:"
class="mt-3"
>
<UInput
@keyup.enter="processBarcodeInput"
@focusout="processBarcodeInput"
@input="processBarcodeInput"
v-model="barcodeInput"
id="barcodeInput"
/>
</UFormGroup>
<!-- <template #text>
<span class="text-wrap">Über die Barcode Eingabe könenn folgende Werte automatisch erkannt werden: Quell Lagerplatz, Ziellagerplatz, Artikel(EAN oder Barcode). Es wird immer zuerst der Quell- und anschließend der Ziellagerplatz ausgefüllt.</span>
</template>
</UTooltip>-->
<UDivider
class="mt-5 w-80"
v-if="mode !== 'incoming'"
/>
<UFormGroup
label="Quell Lagerplatz:"
class="mt-3 w-80"
v-if="mode !== 'incoming' "
>
<USelectMenu
:options="dataStore.spaces"
searchable
option-attribute="spaceNumber"
:color="checkSpaceId(inventoryChangeData.sourceSpaceId) ? 'primary' : 'rose'"
v-model="inventoryChangeData.sourceSpaceId"
@change="inventoryChangeData.sourceProjectId = null"
value-attribute="id"
>
<template #label>
{{dataStore.spaces.find(space => space.id === inventoryChangeData.sourceSpaceId) ? dataStore.spaces.find(space => space.id === inventoryChangeData.sourceSpaceId).description : "Kein Lagerplatz ausgewählt"}}
</template>
</USelectMenu>
</UFormGroup>
<UFormGroup
label="Quell Projekt:"
class="mt-3 w-80"
v-if="mode !== 'incoming' "
>
<USelectMenu
:options="dataStore.projects"
searchable
option-attribute="name"
:color="checkProjectId(inventoryChangeData.sourceProjectId) ? 'primary' : 'rose'"
v-model="inventoryChangeData.sourceProjectId"
@change="inventoryChangeData.sourceSpaceId = null"
value-attribute="id"
>
<template #label>
{{dataStore.getProjectById(inventoryChangeData.sourceProjectId) ? dataStore.getProjectById(inventoryChangeData.sourceProjectId).name : "Kein Projekt ausgewählt"}}
</template>
</USelectMenu>
</UFormGroup>
<UDivider
class="mt-5 w-80"
/>
<UFormGroup
label="Artikel:"
class="mt-3 w-80"
>
<USelectMenu
:options="dataStore.products"
option-attribute="name"
value-attribute="id"
variant="outline"
searchable
:search-attributes="['name','ean', 'barcode']"
:color="checkProductId(inventoryChangeData.productId) ? 'primary' : 'rose'"
v-model="inventoryChangeData.productId"
v-on:select="changeFocusToSpaceId"
>
<template #label>
{{dataStore.products.find(product => product.id === inventoryChangeData.productId) ? dataStore.products.find(product => product.id === inventoryChangeData.productId).name : "Bitte Artikel auswählen"}}
</template>
</USelectMenu>
</UFormGroup>
<UDivider
class="mt-5 w-80"
v-if="mode !== 'outgoing'"
/>
<UFormGroup
label="Ziel Lagerplatz:"
class="mt-3 w-80"
v-if="mode !== 'outgoing'"
>
<USelectMenu
:options="dataStore.spaces"
searchable
option-attribute="spaceNumber"
:color="checkSpaceId(inventoryChangeData.destinationSpaceId) ? 'primary' : 'rose'"
v-model="inventoryChangeData.destinationSpaceId"
@change="inventoryChangeData.destinationProjectId = null"
value-attribute="id"
>
<template #label>
{{dataStore.spaces.find(space => space.id === inventoryChangeData.destinationSpaceId) ? dataStore.spaces.find(space => space.id === inventoryChangeData.destinationSpaceId).description : "Kein Lagerplatz ausgewählt"}}
</template>
</USelectMenu>
</UFormGroup>
<UFormGroup
label="Ziel Projekt:"
class="mt-3 w-80"
v-if="mode !== 'outgoing'"
>
<USelectMenu
:options="dataStore.projects"
searchable
option-attribute="name"
:color="checkProjectId(inventoryChangeData.destinationProjectId) ? 'primary' : 'rose'"
v-model="inventoryChangeData.destinationProjectId"
value-attribute="id"
@change="inventoryChangeData.destinationSpaceId = null"
>
<template #label>
{{dataStore.getProjectById(inventoryChangeData.destinationProjectId) ? dataStore.getProjectById(inventoryChangeData.destinationProjectId).name : "Kein Projekt ausgewählt"}}
</template>
</USelectMenu>
</UFormGroup>
<UDivider
class="mt-5 w-80"
/>
<UFormGroup
label="Anzahl:"
class="mt-3 w-80"
>
<UInput
variant="outline"
color="primary"
placeholder="Anzahl"
v-model="inventoryChangeData.quantity"
type="number"
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>
</template>
<style scoped>
</style>

View File

@@ -1,150 +0,0 @@
<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>
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>

View File

@@ -1,127 +0,0 @@
<template>
<UDashboardNavbar >
<template #left>
<UButton
icon="i-heroicons-chevron-left"
variant="outline"
@click="router.push(`/settings/labels`)"
>
Labels
</UButton>
</template>
<template #center>
<h1
v-if="itemInfo"
class="text-xl font-medium"
>{{itemInfo.name ? `Label: ${itemInfo.name}` : (mode === 'create' ? 'Label erstellen' : 'Label bearbeiten')}}</h1>
</template>
</UDashboardNavbar>
<UTabs
:items="[{label: 'Informationen'}]"
v-if="mode === 'show' && itemInfo"
class="p-5"
v-model="openTab"
>
<template #item="{item}">
<UCard class="mt-5">
<div
v-if="item.label === 'Informationen'"
class="flex flex-row"
>
<div class="w-1/2 mr-5">
<UDivider>Allgemeines</UDivider>
<Toolbar>
<UButton @click="usePrintLabel('0dbe30f3-3008-4cde-8a7c-e785b1c22bfc','ZD411',useGenerateZPL(itemInfo.handlebarsZPL,{barcode:'XXX'}))">Test Druck</UButton>
</Toolbar>
<p>Name: {{itemInfo.name}}</p>
<p>Breite in Zoll: {{itemInfo.widthInch}}"</p>
<p>Höhe in Zoll: {{itemInfo.heightInch}}"</p>
<p>ZPL:</p>
<pre>{{itemInfo.handlebarsZPL}}</pre>
</div>
<div class="w-1/2">
<UDivider>Vorschau</UDivider>
<img
class="mx-auto mt-5"
v-if="demoZPL"
:src="`https://api.labelary.com/v1/printers/8dpmm/labels/${itemInfo.widthInch}x${itemInfo.heightInch}/0/${demoZPL}`"
/>
</div>
</div>
</UCard>
</template>
</UTabs>
</template>
<script setup>
defineShortcuts({
'backspace': () => {
router.push("/settings/labels")
},
'arrowleft': () => {
if(openTab.value > 0){
openTab.value -= 1
}
},
'arrowright': () => {
if(openTab.value < 3) {
openTab.value += 1
}
},
})
const router = useRouter()
const supabase = useSupabaseClient()
const dataStore = useDataStore()
const profileStore = useProfileStore()
const mode = useRoute().params.mode
const openTab = ref(0)
const itemInfo = ref({})
const setupPage = async () => {
itemInfo.value = await useSupabaseSelectSingle("printLabels",useRoute().params.id,'*')
renderDemoZPL()
}
const demoZPL = ref("")
const renderDemoZPL = () => {
let template = Handlebars.compile(itemInfo.value.handlebarsZPL)
demoZPL.value = template({barcode: "XXX"})
}
const printLabel = async () => {
await supabase.from("printJobs").insert({
tenant: profileStore.currentTenant,
rawContent: useGenerateZPL(itemInfo.value.handlebarsZPL,{barcode:"XXX"}),
printerName: "ZD411",
printServer: "0dbe30f3-3008-4cde-8a7c-e785b1c22bfc"
})
}
setupPage()
</script>
<style scoped>
img {
border: 1px solid black
}
</style>

View File

@@ -1,111 +0,0 @@
<template>
<UDashboardNavbar
title="Labels"
>
<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(`/settings/labels/create`)" disabled>+ Label</UButton>
</template>
</UDashboardNavbar>
<!-- <UDashboardToolbar>
</UDashboardToolbar>-->
<UTable
:rows="items"
:columns="columns"
@select="(i) => router.push(`/settings/labels/show/${i.id}`)"
class="w-full"
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
: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>
</UTable>
</template>
<script setup>
defineShortcuts({
'/': () => {
//console.log(searchinput)
//searchinput.value.focus()
document.getElementById("searchinput").focus()
},
'+': () => {
router.push("/settings/labels/create")
},
'Enter': {
usingInput: true,
handler: () => {
router.push(`/settings/labels/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 router = useRouter()
const items = ref([])
const selectedItem = ref(0)
const setupPage = async () => {
items.value = await useSupabaseSelect("printLabels","*")
}
setupPage()
const templateColumns = [{key: 'name',label:'Name'},{key: 'widthInch',label:'Breite in Zoll'},{key: 'heightInch',label:'Höhe in Zoll'}]
const selectedColumns = ref(templateColumns)
const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
const searchString = ref('')
const filteredRows = computed(() => {
return useSearch(searchString.value, items.value)
})
</script>
<style scoped>
</style>