From baa06b60fba47859d4dc9e425ddd5751076cd852 Mon Sep 17 00:00:00 2001 From: flfeders Date: Tue, 30 Jul 2024 12:01:07 +0200 Subject: [PATCH] Cahnges --- components/MainNav.vue | 4 + composables/usePrintLabel.js | 26 +++++ pages/createDocument/edit/[[id]].vue | 17 ++-- pages/products/[mode]/[[id]].vue | 9 +- pages/settings/labels/[mode]/[[id]].vue | 126 ++++++++++++++++++++++++ pages/settings/labels/index.vue | 113 +++++++++++++++++++++ 6 files changed, 282 insertions(+), 13 deletions(-) create mode 100644 composables/usePrintLabel.js create mode 100644 pages/settings/labels/[mode]/[[id]].vue create mode 100644 pages/settings/labels/index.vue diff --git a/components/MainNav.vue b/components/MainNav.vue index 2ddabf8..e978419 100644 --- a/components/MainNav.vue +++ b/components/MainNav.vue @@ -209,6 +209,10 @@ const links = computed(() => { label: "Reparaturprozesse", to: "/repairs/prozess/", icon: "i-heroicons-bars-3-solid" + },{ + label: "Labels", + to: "/settings/labels/", + icon: "i-heroicons-bars-3-solid" } ] }, diff --git a/composables/usePrintLabel.js b/composables/usePrintLabel.js new file mode 100644 index 0000000..959156c --- /dev/null +++ b/composables/usePrintLabel.js @@ -0,0 +1,26 @@ + +import Handlebars from "handlebars"; + +export const usePrintLabel = async (printServerId,printerName , rawZPL ) => { + const supabase = useSupabaseClient() + const dataStore = useDataStore() + + await supabase.from("printJobs").insert({ + tenant: dataStore.currentTenant, + rawContent: rawZPL, + printerName: printerName, + printServer: printServerId + }) + + + +} + +export const useGenerateZPL = (rawZPL,data) => { + let template = Handlebars.compile(rawZPL) + + return template(data) +} + + + diff --git a/pages/createDocument/edit/[[id]].vue b/pages/createDocument/edit/[[id]].vue index a595c8e..60f09bf 100644 --- a/pages/createDocument/edit/[[id]].vue +++ b/pages/createDocument/edit/[[id]].vue @@ -313,7 +313,7 @@ const getDocumentData = () => { vorname: contactData ? contactData.firstName : "", nachname: contactData ? contactData.lastName : "" })) - console.log(templateEndText({zahlungsziel_in_tagen: 14})) + console.log(templateEndText({zahlungsziel_in_tagen: itemInfo.value.paymentDays})) @@ -364,9 +364,13 @@ const generateDocument = async () => { const {data,error} = await supabase.storage.from("files").download(path) + console.log(data) + console.log(error) + uri.value = await useCreatePdf(getDocumentData(), await data.arrayBuffer()) //alert(uri.value) showDocument.value = true + console.log(uri.value) } const onChangeTab = (index) => { @@ -407,7 +411,8 @@ const saveDocument = async () => { description: itemInfo.value.description, startText: itemInfo.value.startText, endText: itemInfo.value.endText, - rows: itemInfo.value.rows + rows: itemInfo.value.rows, + contactPerson: itemInfo.value.contactPerson } let data = null @@ -420,12 +425,6 @@ const saveDocument = async () => { await router.push(`/createDocument/edit/${data[0].id}`) - - - - - - } const closeDocument = async () => { @@ -1177,6 +1176,7 @@ setupPage()
+ + + + + + + + + + \ No newline at end of file