Restructured Pages
Added parent Spaces
This commit is contained in:
@@ -290,7 +290,7 @@ const calculateDocSum = (rows) => {
|
|||||||
|
|
||||||
rows.forEach(row => {
|
rows.forEach(row => {
|
||||||
if(row.mode !== "pagebreak") {
|
if(row.mode !== "pagebreak") {
|
||||||
sum += row.price * row.quantity * ( row.taxPercent + 100)/100
|
sum += row.price * row.quantity * ( Number(row.taxPercent) + 100)/100
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,11 @@ setupPage()
|
|||||||
v-else-if="mode == 'edit' || mode == 'create'"
|
v-else-if="mode == 'edit' || mode == 'create'"
|
||||||
class="p-5"
|
class="p-5"
|
||||||
>
|
>
|
||||||
|
<div class="flex flex-row">
|
||||||
|
<div class="w-1/2 mr-5">
|
||||||
|
<UDivider>
|
||||||
|
Allgemeines
|
||||||
|
</UDivider>
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Name:"
|
label="Name:"
|
||||||
>
|
>
|
||||||
@@ -113,6 +118,14 @@ setupPage()
|
|||||||
v-model="itemInfo.name"
|
v-model="itemInfo.name"
|
||||||
/>
|
/>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
|
||||||
|
<UFormGroup
|
||||||
|
label="Artikelnummer:"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.articleNumber"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Lagerplatz:"
|
label="Lagerplatz:"
|
||||||
>
|
>
|
||||||
@@ -146,11 +159,23 @@ setupPage()
|
|||||||
v-model="itemInfo.quantity"
|
v-model="itemInfo.quantity"
|
||||||
/>
|
/>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
</div>
|
||||||
|
<div class="w-1/2">
|
||||||
|
<UDivider>
|
||||||
|
Anschaffung
|
||||||
|
</UDivider>
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Artikelnummer:"
|
label="Hersteller:"
|
||||||
>
|
>
|
||||||
<UInput
|
<UInput
|
||||||
v-model="itemInfo.articleNumber"
|
v-model="itemInfo.manufacturer"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Herstellernr.:"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.manufacturerNumber"
|
||||||
/>
|
/>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
@@ -180,6 +205,23 @@ setupPage()
|
|||||||
</template>
|
</template>
|
||||||
</UPopover>
|
</UPopover>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Kaufpreis:"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.purchasePrice"
|
||||||
|
type="number"
|
||||||
|
steps="0.01"
|
||||||
|
>
|
||||||
|
<template #trailing>
|
||||||
|
<span class="text-gray-500 dark:text-gray-400 text-xs">EUR</span>
|
||||||
|
</template>
|
||||||
|
</UInput>
|
||||||
|
</UFormGroup>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Beschreibung:"
|
label="Beschreibung:"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -11,38 +11,54 @@ const router = useRouter()
|
|||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
const id = ref(route.params.id ? route.params.id : null )
|
const id = ref(route.params.id ? route.params.id : null )
|
||||||
|
|
||||||
let currentItem = ref(null)
|
|
||||||
|
|
||||||
//Working
|
//Working
|
||||||
const mode = ref(route.params.mode || "show")
|
const mode = ref(route.params.mode || "show")
|
||||||
const itemInfo = ref({
|
const itemInfo = ref({
|
||||||
spaceNumber: ""
|
spaceNumber: "",
|
||||||
|
address: {
|
||||||
|
streetNumber: "",
|
||||||
|
city: "",
|
||||||
|
zip:""
|
||||||
|
}
|
||||||
})
|
})
|
||||||
const spaceTypes = ["Regalplatz", "Kiste", "Palettenplatz", "Sonstiges"]
|
const spaceTypes = ["Regalplatz", "Kiste", "Palettenplatz", "Sonstiges"]
|
||||||
const spaceProducts = ref([])
|
const spaceProducts = ref([])
|
||||||
const spaceMovements = ref([])
|
const spaceMovements = ref([])
|
||||||
|
|
||||||
|
const spaces = ref([])
|
||||||
|
|
||||||
//Functions
|
//Functions
|
||||||
const setupPage = async () => {
|
const setupPage = async () => {
|
||||||
console.log("Called Setup")
|
if(mode.value === "show"){
|
||||||
if(mode.value === "show" || mode.value === "edit"){
|
itemInfo.value = await useSupabaseSelectSingle("spaces",route.params.id,"*, parentSpace(*)")
|
||||||
currentItem.value = await dataStore.getSpaceById(Number(useRoute().params.id))
|
|
||||||
|
|
||||||
spaceMovements.value = await dataStore.getMovementsBySpace(currentItem.value.id)
|
spaceMovements.value = await dataStore.getMovementsBySpace(itemInfo.value.id)
|
||||||
spaceProducts.value = []
|
spaceProducts.value = []
|
||||||
spaceMovements.value.forEach(movement => {
|
spaceMovements.value.forEach(movement => {
|
||||||
if(spaceProducts.value.filter(product => product.id === movement.productId).length === 0) spaceProducts.value.push(dataStore.getProductById(movement.productId))
|
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 = () => {
|
const cancelEditorCreate = () => {
|
||||||
if(currentItem.value) {
|
if(itemInfo.value) {
|
||||||
router.push(`/spaces/show/${currentItem.value.id}`)
|
router.push(`/spaces/show/${itemInfo.value.id}`)
|
||||||
} else {
|
} else {
|
||||||
router.push(`/spaces/`)
|
router.push(`/spaces/`)
|
||||||
}
|
}
|
||||||
@@ -59,18 +75,25 @@ function getSpaceProductCount(productId) {
|
|||||||
/*
|
/*
|
||||||
const printSpaceLabel = async () => {
|
const printSpaceLabel = async () => {
|
||||||
axios
|
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)
|
.then(console.log)
|
||||||
.catch(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()
|
setupPage()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<UDashboardNavbar :title="currentItem ? currentItem.name : (mode === 'create' ? 'Lagerplatz erstellen' : 'Lagerplatz bearbeiten')">
|
<UDashboardNavbar :title="itemInfo ? itemInfo.name : (mode === 'create' ? 'Lagerplatz erstellen' : 'Lagerplatz bearbeiten')">
|
||||||
<template #right>
|
<template #right>
|
||||||
<UButton
|
<UButton
|
||||||
v-if="mode === 'edit'"
|
v-if="mode === 'edit'"
|
||||||
@@ -94,7 +117,7 @@ setupPage()
|
|||||||
</UButton>
|
</UButton>
|
||||||
<UButton
|
<UButton
|
||||||
v-if="mode === 'show'"
|
v-if="mode === 'show'"
|
||||||
@click=" router.push(`/inventory/spaces/edit/${currentItem.id}`)"
|
@click=" router.push(`/spaces/edit/${itemInfo.id}`)"
|
||||||
>
|
>
|
||||||
Bearbeiten
|
Bearbeiten
|
||||||
</UButton>
|
</UButton>
|
||||||
@@ -102,14 +125,15 @@ setupPage()
|
|||||||
</UDashboardNavbar>
|
</UDashboardNavbar>
|
||||||
<UTabs
|
<UTabs
|
||||||
:items="[{label: 'Informationen'},{label: 'Logbuch'},{label: 'Bestand'}]"
|
:items="[{label: 'Informationen'},{label: 'Logbuch'},{label: 'Bestand'}]"
|
||||||
v-if="currentItem && mode == 'show'"
|
v-if="itemInfo && mode == 'show'"
|
||||||
class="p-5"
|
class="p-5"
|
||||||
>
|
>
|
||||||
<template #item="{item}">
|
<template #item="{item}">
|
||||||
<UCard class="mt-5">
|
<UCard class="mt-5">
|
||||||
<div v-if="item.label === 'Informationen'">
|
<div v-if="item.label === 'Informationen'">
|
||||||
<div class="truncate">
|
<div class="truncate">
|
||||||
<span>Beschreibung: {{currentItem.description}}</span>
|
<p>Übergeordneter Lagerplatz: <router-link v-if="itemInfo.parentSpace" :to="`/spaces/show/${itemInfo.parentSpace.id}`">{{itemInfo.parentSpace.spaceNumber}} - {{itemInfo.parentSpace.description}}</router-link></p>
|
||||||
|
<p>Beschreibung: <br>{{itemInfo.description}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@@ -144,6 +168,11 @@ setupPage()
|
|||||||
v-else-if="mode === 'edit' || mode === 'create'"
|
v-else-if="mode === 'edit' || mode === 'create'"
|
||||||
class="p-5"
|
class="p-5"
|
||||||
>
|
>
|
||||||
|
<div class="flex flex-row">
|
||||||
|
<div class="w-1/2 mr-5">
|
||||||
|
<UDivider>
|
||||||
|
Allgemeines
|
||||||
|
</UDivider>
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Typ:"
|
label="Typ:"
|
||||||
>
|
>
|
||||||
@@ -154,6 +183,53 @@ setupPage()
|
|||||||
|
|
||||||
</USelectMenu>
|
</USelectMenu>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Übergeordneter Lagerplatz:"
|
||||||
|
>
|
||||||
|
<USelectMenu
|
||||||
|
:options="spaces"
|
||||||
|
option-attribute="spaceNumber"
|
||||||
|
value-attribute="id"
|
||||||
|
v-model="itemInfo.parentSpace"
|
||||||
|
>
|
||||||
|
|
||||||
|
</USelectMenu>
|
||||||
|
</UFormGroup>
|
||||||
|
</div>
|
||||||
|
<div class="w-1/2">
|
||||||
|
<UDivider>
|
||||||
|
Ort
|
||||||
|
</UDivider>
|
||||||
|
<UFormGroup
|
||||||
|
label="Straße + Hausnummer:"
|
||||||
|
>
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.address.streetNumber"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="PLZ + Ort:"
|
||||||
|
>
|
||||||
|
<InputGroup class="w-full">
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.address.zip"
|
||||||
|
placeholder="PLZ"
|
||||||
|
@focusout="setCityByZip"
|
||||||
|
/>
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.address.city"
|
||||||
|
placeholder="Ort"
|
||||||
|
class="flex-auto"
|
||||||
|
:disabled="cityLoading"
|
||||||
|
|
||||||
|
/>
|
||||||
|
</InputGroup>
|
||||||
|
|
||||||
|
</UFormGroup>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Beschreibung:"
|
label="Beschreibung:"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user