diff --git a/pages/createDocument/index.vue b/pages/createDocument/index.vue index 8d50b5d..f4ab768 100644 --- a/pages/createDocument/index.vue +++ b/pages/createDocument/index.vue @@ -290,7 +290,7 @@ const calculateDocSum = (rows) => { rows.forEach(row => { if(row.mode !== "pagebreak") { - sum += row.price * row.quantity * ( row.taxPercent + 100)/100 + sum += row.price * row.quantity * ( Number(row.taxPercent) + 100)/100 } }) diff --git a/pages/inventoryitems/[mode]/[[id]].vue b/pages/inventoryitems/[mode]/[[id]].vue index e82a6f1..907a3a1 100644 --- a/pages/inventoryitems/[mode]/[[id]].vue +++ b/pages/inventoryitems/[mode]/[[id]].vue @@ -106,80 +106,122 @@ setupPage() v-else-if="mode == 'edit' || mode == 'create'" class="p-5" > - - - - - - - - - - - - - - - - - - - - - - - - +
+
+ + Allgemeines + + + + + + + + + + + + + + + + + + + + +
+
+ + Anschaffung + + + + + + + + + + + + + + + + + + + + + + +
+
+ - -
-
diff --git a/pages/spaces/[mode]/[[id]].vue b/pages/spaces/[mode]/[[id]].vue index 4383260..c5a0488 100644 --- a/pages/spaces/[mode]/[[id]].vue +++ b/pages/spaces/[mode]/[[id]].vue @@ -11,38 +11,54 @@ const router = useRouter() const toast = useToast() const id = ref(route.params.id ? route.params.id : null ) -let currentItem = ref(null) - //Working const mode = ref(route.params.mode || "show") const itemInfo = ref({ - spaceNumber: "" + spaceNumber: "", + address: { + streetNumber: "", + city: "", + zip:"" + } }) const spaceTypes = ["Regalplatz", "Kiste", "Palettenplatz", "Sonstiges"] const spaceProducts = ref([]) const spaceMovements = ref([]) +const spaces = ref([]) + //Functions const setupPage = async () => { - console.log("Called Setup") - if(mode.value === "show" || mode.value === "edit"){ - currentItem.value = await dataStore.getSpaceById(Number(useRoute().params.id)) + if(mode.value === "show"){ + itemInfo.value = await useSupabaseSelectSingle("spaces",route.params.id,"*, parentSpace(*)") - spaceMovements.value = await dataStore.getMovementsBySpace(currentItem.value.id) + spaceMovements.value = await dataStore.getMovementsBySpace(itemInfo.value.id) spaceProducts.value = [] spaceMovements.value.forEach(movement => { if(spaceProducts.value.filter(product => product.id === movement.productId).length === 0) spaceProducts.value.push(dataStore.getProductById(movement.productId)) }) + + + } else if(mode.value === "edit") { + itemInfo.value = await useSupabaseSelectSingle("spaces",route.params.id,"*") } - if(mode.value === "edit") itemInfo.value = currentItem.value + if(mode.value === "edit" || mode.value === "create"){ + if(itemInfo.value){ + spaces.value = (await useSupabaseSelect("spaces",'*')).filter(i => i.id !== itemInfo.value.id) + } else { + spaces.value = (await useSupabaseSelect("spaces",'*')) + } + } + + } const cancelEditorCreate = () => { - if(currentItem.value) { - router.push(`/spaces/show/${currentItem.value.id}`) + if(itemInfo.value) { + router.push(`/spaces/show/${itemInfo.value.id}`) } else { router.push(`/spaces/`) } @@ -59,18 +75,25 @@ function getSpaceProductCount(productId) { /* const printSpaceLabel = async () => { axios - .post(`http://${dataStore.ownTenant.value.labelPrinterIp}/pstprnt`, `^XA^FO10,20^BCN,100^FD${currentItem.value.spaceNumber}^XZ` ) + .post(`http://${dataStore.ownTenant.value.labelPrinterIp}/pstprnt`, `^XA^FO10,20^BCN,100^FD${itemInfo.value.spaceNumber}^XZ` ) .then(console.log) .catch(console.log) } */ +const cityLoading = ref(false) +const setCityByZip = async () => { + cityLoading.value = true + itemInfo.value.address.city = await useZipCheck(itemInfo.value.address.zip) + cityLoading.value = false +} + setupPage()