Added Optional and Alternative in Quotes

Redesigned the Row Edit Modal
Added Errors for Optional and Alternative Rows
This commit is contained in:
2025-05-25 15:54:08 +02:00
parent e982684d95
commit bb99d5ae1c

View File

@@ -577,6 +577,14 @@ const findDocumentErrors = computed(() => {
} else {
itemInfo.value.rows.forEach(row => {
if(itemInfo.value.type !== "quotes" && row.optional) {
errors.push({message: `Position ${row.pos} ist als Optional markiert. Dies wird nur in Angeboten unterstützt.`, type: "breaking"})
}
if(itemInfo.value.type !== "quotes" && row.alternative) {
errors.push({message: `Position ${row.pos} ist als Alternativ markiert. Dies wird nur in Angeboten unterstützt.`, type: "breaking"})
}
if(row.mode === "normal" && !row.product) errors.push({message: `In Position ${row.pos} ist kein Artikel ausgewählt`, type: "breaking"})
if(row.mode === "service" && !row.service) errors.push({message: `In Position ${row.pos} ist keine Leistung ausgewählt`, type: "breaking"})
if(row.mode === "title" && !row.text) errors.push({message: `In Position ${row.pos} ist kein Titel hinterlegt`, type: "breaking"})
@@ -637,7 +645,7 @@ const documentTotal = computed(() => {
let total19 = 0
let total7 = 0
itemInfo.value.rows.forEach(row => {
itemInfo.value.rows.filter(i => !i.optional && !i.alternative).forEach(row => {
if(!['pagebreak','title','text'].includes(row.mode)){
let rowPrice = Number(Number(row.quantity) * Number(row.price) * (1 - Number(row.discountPercent) /100) ).toFixed(3)
totalNet = totalNet + Number(rowPrice)
@@ -659,7 +667,7 @@ const documentTotal = computed(() => {
if(row.mode === 'title'){
titleSums[`${row.pos} - ${row.text}`] = 0
lastTitle = `${row.pos} - ${row.text}`
} else if(!['pagebreak','text'].includes(row.mode) && lastTitle !== ""){
} else if(!['pagebreak','text'].includes(row.mode) && lastTitle !== "" && !row.optional && !row.alternative){
titleSums[lastTitle] = Number(titleSums[lastTitle]) + Number(Number(row.quantity) * Number(row.price) * (1 - Number(row.discountPercent) /100) )
}
})
@@ -2317,7 +2325,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
v-if="!['pagebreak','title','text'].includes(row.mode)"
>
<UButton
icon="i-heroicons-document-text"
icon="i-heroicons-pencil-square-16-solid"
@click="row.showEdit = true"
/>
<UButton
@@ -2328,11 +2336,50 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
/>
<UModal v-model="row.showEdit">
<UCard>
<template #header>
<!-- <template #header>
Zeile bearbeiten
</template>-->
<template #header>
<div class="flex items-center justify-between">
<h3 class="text-base font-semibold leading-6 text-gray-900 dark:text-white">
Zeile bearbeiten
</h3>
<UButton color="gray" variant="ghost" icon="i-heroicons-x-mark-20-solid" class="-my-1" @click="row.showEdit = false" />
</div>
</template>
<UFormGroup
label="Einzelpreis:"
v-if="itemInfo.type !== 'deliveryNotes'"
>
<UInput
v-model="row.inputPrice"
type="number"
step="0.001"
@change="updateCustomSurcharge"
>
<template #leading>
<span class="text-gray-500 dark:text-gray-400 text-xs">EUR</span>
</template>
<template #trailing>
<span
v-if="row.price > row.inputPrice"
class="text-primary text-xs">
{{useCurrency(row.price)}}
</span>
<span
v-else-if="row.price < row.inputPrice"
class="text-rose-600 text-xs">
{{useCurrency(row.price)}}
</span>
<span
v-else
class="text-gray-500 dark:text-gray-400 text-xs"> </span>
</template>
</UInput>
</UFormGroup>
<UFormGroup
label="Umsatzsteuer:"
class="mt-3"
v-if="itemInfo.type !== 'deliveryNotes'"
>
<USelectMenu
@@ -2348,8 +2395,10 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
</template>
</USelectMenu>
</UFormGroup>
<UFormGroup
label="Rabatt:"
class="mt-3"
v-if="itemInfo.type !== 'deliveryNotes'"
>
<UInput
@@ -2363,24 +2412,45 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
</template>
</UInput>
</UFormGroup>
<InputGroup class="w-full mt-3">
<UFormGroup
label="Optional:"
>
<UToggle
:disabled="row.alternative"
v-model="row.optional"
/>
</UFormGroup>
<UFormGroup
class="ml-3"
label="Alternativ:"
>
<UToggle
:disabled="row.optional"
v-model="row.alternative"
/>
</UFormGroup>
</InputGroup>
<UFormGroup
label="Beschreibung:"
class="mt-3"
>
<UTextarea
v-model="row.description"
rows="5"
>
</UTextarea>
</UFormGroup>
<template #footer>
<!-- <template #footer>
<UButton
@click="row.showEdit = false"
>
Speichern
</UButton>
</template>
</template>-->
</UCard>
@@ -2462,7 +2532,14 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
v-if="!['pagebreak','title','text'].includes(row.mode) && itemInfo.type !== 'deliveryNotes'"
>
<p class="text-right font-bold whitespace-nowrap"><span v-if="row.discountPercent !== 0" class="line-through mr-2 text-rose-500">{{getRowAmountUndiscounted(row)}} €</span>{{getRowAmount(row)}} €</p>
<p class="text-right font-bold whitespace-nowrap">
{{row.optional || row.alternative ? "(" : ""}}
<span v-if="row.discountPercent !== 0" class="line-through mr-2 text-rose-500">
{{getRowAmountUndiscounted(row)}} €
</span>
{{getRowAmount(row)}} €
{{row.optional || row.alternative ? ")" : ""}}
</p>
</td>
<td
v-if="row.mode === 'title'"