Added Optional and Alternative in Quotes
Redesigned the Row Edit Modal Added Errors for Optional and Alternative Rows
This commit is contained in:
@@ -577,6 +577,14 @@ const findDocumentErrors = computed(() => {
|
|||||||
} else {
|
} else {
|
||||||
itemInfo.value.rows.forEach(row => {
|
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 === "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 === "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"})
|
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 total19 = 0
|
||||||
let total7 = 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)){
|
if(!['pagebreak','title','text'].includes(row.mode)){
|
||||||
let rowPrice = Number(Number(row.quantity) * Number(row.price) * (1 - Number(row.discountPercent) /100) ).toFixed(3)
|
let rowPrice = Number(Number(row.quantity) * Number(row.price) * (1 - Number(row.discountPercent) /100) ).toFixed(3)
|
||||||
totalNet = totalNet + Number(rowPrice)
|
totalNet = totalNet + Number(rowPrice)
|
||||||
@@ -659,7 +667,7 @@ const documentTotal = computed(() => {
|
|||||||
if(row.mode === 'title'){
|
if(row.mode === 'title'){
|
||||||
titleSums[`${row.pos} - ${row.text}`] = 0
|
titleSums[`${row.pos} - ${row.text}`] = 0
|
||||||
lastTitle = `${row.pos} - ${row.text}`
|
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) )
|
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)"
|
v-if="!['pagebreak','title','text'].includes(row.mode)"
|
||||||
>
|
>
|
||||||
<UButton
|
<UButton
|
||||||
icon="i-heroicons-document-text"
|
icon="i-heroicons-pencil-square-16-solid"
|
||||||
@click="row.showEdit = true"
|
@click="row.showEdit = true"
|
||||||
/>
|
/>
|
||||||
<UButton
|
<UButton
|
||||||
@@ -2328,11 +2336,50 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
|
|||||||
/>
|
/>
|
||||||
<UModal v-model="row.showEdit">
|
<UModal v-model="row.showEdit">
|
||||||
<UCard>
|
<UCard>
|
||||||
<template #header>
|
<!-- <template #header>
|
||||||
Zeile bearbeiten
|
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>
|
</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
|
<UFormGroup
|
||||||
label="Umsatzsteuer:"
|
label="Umsatzsteuer:"
|
||||||
|
class="mt-3"
|
||||||
v-if="itemInfo.type !== 'deliveryNotes'"
|
v-if="itemInfo.type !== 'deliveryNotes'"
|
||||||
>
|
>
|
||||||
<USelectMenu
|
<USelectMenu
|
||||||
@@ -2348,8 +2395,10 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
|
|||||||
</template>
|
</template>
|
||||||
</USelectMenu>
|
</USelectMenu>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
|
||||||
<UFormGroup
|
<UFormGroup
|
||||||
label="Rabatt:"
|
label="Rabatt:"
|
||||||
|
class="mt-3"
|
||||||
v-if="itemInfo.type !== 'deliveryNotes'"
|
v-if="itemInfo.type !== 'deliveryNotes'"
|
||||||
>
|
>
|
||||||
<UInput
|
<UInput
|
||||||
@@ -2363,24 +2412,45 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
|
|||||||
</template>
|
</template>
|
||||||
</UInput>
|
</UInput>
|
||||||
</UFormGroup>
|
</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
|
<UFormGroup
|
||||||
label="Beschreibung:"
|
label="Beschreibung:"
|
||||||
|
class="mt-3"
|
||||||
>
|
>
|
||||||
<UTextarea
|
<UTextarea
|
||||||
v-model="row.description"
|
v-model="row.description"
|
||||||
|
rows="5"
|
||||||
>
|
>
|
||||||
|
|
||||||
</UTextarea>
|
</UTextarea>
|
||||||
</UFormGroup>
|
</UFormGroup>
|
||||||
|
|
||||||
<template #footer>
|
<!-- <template #footer>
|
||||||
<UButton
|
<UButton
|
||||||
@click="row.showEdit = false"
|
@click="row.showEdit = false"
|
||||||
>
|
>
|
||||||
Speichern
|
Speichern
|
||||||
</UButton>
|
</UButton>
|
||||||
</template>
|
</template>-->
|
||||||
</UCard>
|
</UCard>
|
||||||
|
|
||||||
|
|
||||||
@@ -2462,7 +2532,14 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
|
|||||||
v-if="!['pagebreak','title','text'].includes(row.mode) && itemInfo.type !== 'deliveryNotes'"
|
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>
|
||||||
<td
|
<td
|
||||||
v-if="row.mode === 'title'"
|
v-if="row.mode === 'title'"
|
||||||
|
|||||||
Reference in New Issue
Block a user