[pricelist](issue #4) add warning when price is less then min_price
This commit is contained in:
parent
43397fe3a7
commit
0df2677b1b
|
@ -84,6 +84,9 @@
|
||||||
</div>
|
</div>
|
||||||
<q-separator v-if="index < volume.prices.length - 1" />
|
<q-separator v-if="index < volume.prices.length - 1" />
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if='!public && !nodetails && isUnderMinPrice' class='fit warning bg-red text-center text-white text-body1'>
|
||||||
|
Einer der Preise ist unterhalb des niedrigsten minimal Preises.
|
||||||
|
</div>
|
||||||
<div v-if="editable" class="full-width row justify-end text-right">
|
<div v-if="editable" class="full-width row justify-end text-right">
|
||||||
<q-btn round icon="mdi-plus" size="sm" color="primary">
|
<q-btn round icon="mdi-plus" size="sm" color="primary">
|
||||||
<q-tooltip> Preis hinzufügen </q-tooltip>
|
<q-tooltip> Preis hinzufügen </q-tooltip>
|
||||||
|
@ -269,6 +272,24 @@ export default defineComponent({
|
||||||
emit('update:modelValue', volumes.value);
|
emit('update:modelValue', volumes.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isUnderMinPrice = computed(() => {
|
||||||
|
if (volumes.value) {
|
||||||
|
const this_volume = volumes.value.find(a => a.id === volume.value)
|
||||||
|
if (this_volume) {
|
||||||
|
if (this_volume.min_prices.length > 0) {
|
||||||
|
const min_price = this_volume.min_prices.sort((a, b) => {
|
||||||
|
if (a.price > b.price) return 1
|
||||||
|
if (a.price < b.price) return -1
|
||||||
|
return 0
|
||||||
|
})[0]
|
||||||
|
console.log('min_price', min_price)
|
||||||
|
return this_volume.prices.some(a => a.price < min_price.price)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
volumes,
|
volumes,
|
||||||
volume,
|
volume,
|
||||||
|
@ -282,9 +303,14 @@ export default defineComponent({
|
||||||
deleteVolume,
|
deleteVolume,
|
||||||
deleteIngredient,
|
deleteIngredient,
|
||||||
change,
|
change,
|
||||||
|
isUnderMinPrice
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped>
|
||||||
|
.warning {
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue