Restructured Pages
Added parent Spaces
This commit is contained in:
@@ -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
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -106,80 +106,122 @@ setupPage()
|
||||
v-else-if="mode == 'edit' || mode == 'create'"
|
||||
class="p-5"
|
||||
>
|
||||
<UFormGroup
|
||||
label="Name:"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.name"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Lagerplatz:"
|
||||
>
|
||||
<USelectMenu
|
||||
:options="dataStore.spaces"
|
||||
v-model="itemInfo.currentSpace"
|
||||
value-attribute="id"
|
||||
>
|
||||
<template #option="{option}">
|
||||
<span class="truncate">{{option.spaceNumber}} - {{option.description}}</span>
|
||||
</template>
|
||||
<template #label>
|
||||
<span v-if="itemInfo.currentSpace">{{dataStore.getSpaceById(itemInfo.currentSpace).spaceNumber }} - {{dataStore.getSpaceById(itemInfo.currentSpace).description}}</span>
|
||||
<span v-else>Kein Lagerplatz ausgewählt</span>
|
||||
</template>
|
||||
</USelectMenu>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Seriennummer:"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.serialNumber"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Menge:"
|
||||
help="Für Einzelartikel Menge gleich 0"
|
||||
>
|
||||
<UInput
|
||||
type="number"
|
||||
v-model="itemInfo.quantity"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Artikelnummer:"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.articleNumber"
|
||||
/>
|
||||
</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"
|
||||
/>
|
||||
<div class="flex flex-row">
|
||||
<div class="w-1/2 mr-5">
|
||||
<UDivider>
|
||||
Allgemeines
|
||||
</UDivider>
|
||||
<UFormGroup
|
||||
label="Name:"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.name"
|
||||
/>
|
||||
</UFormGroup>
|
||||
|
||||
<UFormGroup
|
||||
label="Artikelnummer:"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.articleNumber"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Lagerplatz:"
|
||||
>
|
||||
<USelectMenu
|
||||
:options="dataStore.spaces"
|
||||
v-model="itemInfo.currentSpace"
|
||||
value-attribute="id"
|
||||
>
|
||||
<template #option="{option}">
|
||||
<span class="truncate">{{option.spaceNumber}} - {{option.description}}</span>
|
||||
</template>
|
||||
<template #label>
|
||||
<span v-if="itemInfo.currentSpace">{{dataStore.getSpaceById(itemInfo.currentSpace).spaceNumber }} - {{dataStore.getSpaceById(itemInfo.currentSpace).description}}</span>
|
||||
<span v-else>Kein Lagerplatz ausgewählt</span>
|
||||
</template>
|
||||
</USelectMenu>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Seriennummer:"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.serialNumber"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Menge:"
|
||||
help="Für Einzelartikel Menge gleich 0"
|
||||
>
|
||||
<UInput
|
||||
type="number"
|
||||
v-model="itemInfo.quantity"
|
||||
/>
|
||||
</UFormGroup>
|
||||
</div>
|
||||
<div class="w-1/2">
|
||||
<UDivider>
|
||||
Anschaffung
|
||||
</UDivider>
|
||||
<UFormGroup
|
||||
label="Hersteller:"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.manufacturer"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
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
|
||||
label="Beschreibung:"
|
||||
>
|
||||
|
||||
@@ -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()
|
||||
</script>
|
||||
|
||||
<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>
|
||||
<UButton
|
||||
v-if="mode === 'edit'"
|
||||
@@ -94,7 +117,7 @@ setupPage()
|
||||
</UButton>
|
||||
<UButton
|
||||
v-if="mode === 'show'"
|
||||
@click=" router.push(`/inventory/spaces/edit/${currentItem.id}`)"
|
||||
@click=" router.push(`/spaces/edit/${itemInfo.id}`)"
|
||||
>
|
||||
Bearbeiten
|
||||
</UButton>
|
||||
@@ -102,14 +125,15 @@ setupPage()
|
||||
</UDashboardNavbar>
|
||||
<UTabs
|
||||
:items="[{label: 'Informationen'},{label: 'Logbuch'},{label: 'Bestand'}]"
|
||||
v-if="currentItem && mode == 'show'"
|
||||
v-if="itemInfo && mode == 'show'"
|
||||
class="p-5"
|
||||
>
|
||||
<template #item="{item}">
|
||||
<UCard class="mt-5">
|
||||
<div v-if="item.label === 'Informationen'">
|
||||
<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>
|
||||
|
||||
|
||||
@@ -144,16 +168,68 @@ setupPage()
|
||||
v-else-if="mode === 'edit' || mode === 'create'"
|
||||
class="p-5"
|
||||
>
|
||||
<UFormGroup
|
||||
label="Typ:"
|
||||
>
|
||||
<USelectMenu
|
||||
:options="spaceTypes"
|
||||
v-model="itemInfo.type"
|
||||
>
|
||||
<div class="flex flex-row">
|
||||
<div class="w-1/2 mr-5">
|
||||
<UDivider>
|
||||
Allgemeines
|
||||
</UDivider>
|
||||
<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
|
||||
label="Beschreibung:"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user