Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consider quantity for addon price #480

Merged
merged 2 commits into from
Jun 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions frontend/components/pricing/PremiumAddonBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ const quantityForPurchase = ref(1)

const prices = computed(() => {
const mainPrice = props.isYearly ? props.addon.price_per_year_eur / 12 : props.addon.price_per_month_eur

const savingAmount = props.addon.price_per_month_eur * 12 - props.addon.price_per_year_eur
const quantity = quantityForPurchase.value || 1
const savingAmount = (props.addon.price_per_month_eur * 12 - props.addon.price_per_year_eur) * quantity
const savingDigits = savingAmount % 100 === 0 ? 0 : 2

return {
main: formatPremiumProductPrice($t, mainPrice),
monthly: formatPremiumProductPrice($t, props.addon.price_per_month_eur),
monthly_based_on_yearly: formatPremiumProductPrice($t, props.addon.price_per_year_eur / 12),
yearly: formatPremiumProductPrice($t, props.addon.price_per_year_eur),
main: formatPremiumProductPrice($t, mainPrice * quantity),
monthly: formatPremiumProductPrice($t, props.addon.price_per_month_eur * quantity),
monthly_based_on_yearly: formatPremiumProductPrice($t, props.addon.price_per_year_eur / 12 * quantity),
yearly: formatPremiumProductPrice($t, props.addon.price_per_year_eur * quantity),
saving: formatPremiumProductPrice($t, savingAmount, savingDigits),
perValidator: formatPremiumProductPrice($t, mainPrice / props.addon.extra_dashboard_validators, 5)
}
Expand Down
Loading