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,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>