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,80 +106,122 @@ setupPage()
|
|||||||
v-else-if="mode == 'edit' || mode == 'create'"
|
v-else-if="mode == 'edit' || mode == 'create'"
|
||||||
class="p-5"
|
class="p-5"
|
||||||
>
|
>
|
||||||
<UFormGroup
|
<div class="flex flex-row">
|
||||||
label="Name:"
|
<div class="w-1/2 mr-5">
|
||||||
>
|
<UDivider>
|
||||||
<UInput
|
Allgemeines
|
||||||
v-model="itemInfo.name"
|
</UDivider>
|
||||||
/>
|
<UFormGroup
|
||||||
</UFormGroup>
|
label="Name:"
|
||||||
<UFormGroup
|
>
|
||||||
label="Lagerplatz:"
|
<UInput
|
||||||
>
|
v-model="itemInfo.name"
|
||||||
<USelectMenu
|
/>
|
||||||
:options="dataStore.spaces"
|
</UFormGroup>
|
||||||
v-model="itemInfo.currentSpace"
|
|
||||||
value-attribute="id"
|
<UFormGroup
|
||||||
>
|
label="Artikelnummer:"
|
||||||
<template #option="{option}">
|
>
|
||||||
<span class="truncate">{{option.spaceNumber}} - {{option.description}}</span>
|
<UInput
|
||||||
</template>
|
v-model="itemInfo.articleNumber"
|
||||||
<template #label>
|
/>
|
||||||
<span v-if="itemInfo.currentSpace">{{dataStore.getSpaceById(itemInfo.currentSpace).spaceNumber }} - {{dataStore.getSpaceById(itemInfo.currentSpace).description}}</span>
|
</UFormGroup>
|
||||||
<span v-else>Kein Lagerplatz ausgewählt</span>
|
<UFormGroup
|
||||||
</template>
|
label="Lagerplatz:"
|
||||||
</USelectMenu>
|
>
|
||||||
</UFormGroup>
|
<USelectMenu
|
||||||
<UFormGroup
|
:options="dataStore.spaces"
|
||||||
label="Seriennummer:"
|
v-model="itemInfo.currentSpace"
|
||||||
>
|
value-attribute="id"
|
||||||
<UInput
|
>
|
||||||
v-model="itemInfo.serialNumber"
|
<template #option="{option}">
|
||||||
/>
|
<span class="truncate">{{option.spaceNumber}} - {{option.description}}</span>
|
||||||
</UFormGroup>
|
</template>
|
||||||
<UFormGroup
|
<template #label>
|
||||||
label="Menge:"
|
<span v-if="itemInfo.currentSpace">{{dataStore.getSpaceById(itemInfo.currentSpace).spaceNumber }} - {{dataStore.getSpaceById(itemInfo.currentSpace).description}}</span>
|
||||||
help="Für Einzelartikel Menge gleich 0"
|
<span v-else>Kein Lagerplatz ausgewählt</span>
|
||||||
>
|
</template>
|
||||||
<UInput
|
</USelectMenu>
|
||||||
type="number"
|
</UFormGroup>
|
||||||
v-model="itemInfo.quantity"
|
<UFormGroup
|
||||||
/>
|
label="Seriennummer:"
|
||||||
</UFormGroup>
|
>
|
||||||
<UFormGroup
|
<UInput
|
||||||
label="Artikelnummer:"
|
v-model="itemInfo.serialNumber"
|
||||||
>
|
/>
|
||||||
<UInput
|
</UFormGroup>
|
||||||
v-model="itemInfo.articleNumber"
|
<UFormGroup
|
||||||
/>
|
label="Menge:"
|
||||||
</UFormGroup>
|
help="Für Einzelartikel Menge gleich 0"
|
||||||
<UFormGroup
|
>
|
||||||
label="Lieferant:"
|
<UInput
|
||||||
>
|
type="number"
|
||||||
<USelectMenu
|
v-model="itemInfo.quantity"
|
||||||
:options="dataStore.vendors"
|
/>
|
||||||
option-attribute="name"
|
</UFormGroup>
|
||||||
value-attribute="id"
|
</div>
|
||||||
searchable
|
<div class="w-1/2">
|
||||||
:search-attributes="['name']"
|
<UDivider>
|
||||||
v-model="itemInfo.vendor"
|
Anschaffung
|
||||||
/>
|
</UDivider>
|
||||||
</UFormGroup>
|
<UFormGroup
|
||||||
<UFormGroup
|
label="Hersteller:"
|
||||||
label="Kaufdatum:"
|
>
|
||||||
>
|
<UInput
|
||||||
<UPopover :popper="{ placement: 'bottom-start' }">
|
v-model="itemInfo.manufacturer"
|
||||||
<UButton
|
/>
|
||||||
icon="i-heroicons-calendar-days-20-solid"
|
</UFormGroup>
|
||||||
:label="itemInfo.purchaseDate ? dayjs(itemInfo.purchaseDate).format('DD.MM.YYYY') : 'Datum auswählen'"
|
<UFormGroup
|
||||||
variant="outline"
|
label="Herstellernr.:"
|
||||||
/>
|
>
|
||||||
|
<UInput
|
||||||
|
v-model="itemInfo.manufacturerNumber"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Lieferant:"
|
||||||
|
>
|
||||||
|
<USelectMenu
|
||||||
|
:options="dataStore.vendors"
|
||||||
|
option-attribute="name"
|
||||||
|
value-attribute="id"
|
||||||
|
searchable
|
||||||
|
:search-attributes="['name']"
|
||||||
|
v-model="itemInfo.vendor"
|
||||||
|
/>
|
||||||
|
</UFormGroup>
|
||||||
|
<UFormGroup
|
||||||
|
label="Kaufdatum:"
|
||||||
|
>
|
||||||
|
<UPopover :popper="{ placement: 'bottom-start' }">
|
||||||
|
<UButton
|
||||||
|
icon="i-heroicons-calendar-days-20-solid"
|
||||||
|
:label="itemInfo.purchaseDate ? dayjs(itemInfo.purchaseDate).format('DD.MM.YYYY') : 'Datum auswählen'"
|
||||||
|
variant="outline"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<template #panel="{ close }">
|
||||||
|
<LazyDatePicker v-model="itemInfo.purchaseDate" @close="close" />
|
||||||
|
</template>
|
||||||
|
</UPopover>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
|
||||||
<template #panel="{ close }">
|
|
||||||
<LazyDatePicker v-model="itemInfo.purchaseDate" @close="close" />
|
|
||||||
</template>
|
|
||||||
</UPopover>
|
|
||||||
</UFormGroup>
|
|
||||||
<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,16 +168,68 @@ setupPage()
|
|||||||
v-else-if="mode === 'edit' || mode === 'create'"
|
v-else-if="mode === 'edit' || mode === 'create'"
|
||||||
class="p-5"
|
class="p-5"
|
||||||
>
|
>
|
||||||
<UFormGroup
|
<div class="flex flex-row">
|
||||||
label="Typ:"
|
<div class="w-1/2 mr-5">
|
||||||
>
|
<UDivider>
|
||||||
<USelectMenu
|
Allgemeines
|
||||||
:options="spaceTypes"
|
</UDivider>
|
||||||
v-model="itemInfo.type"
|
<UFormGroup
|
||||||
>
|
label="Typ:"
|
||||||
|
>
|
||||||
|
<USelectMenu
|
||||||
|
:options="spaceTypes"
|
||||||
|
v-model="itemInfo.type"
|
||||||
|
>
|
||||||
|
|
||||||
|
</USelectMenu>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
|
||||||
</USelectMenu>
|
|
||||||
</UFormGroup>
|
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Beschreibung:"
|
label="Beschreibung:"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user