Skip to content

Commit f68dfb6

Browse files
committed
automatically display supporter cert discount
1 parent bcde797 commit f68dfb6

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

assets/js/desktopkey.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class DesktopLicense {
3232
return {
3333
productId: product.product_id,
3434
amount: product.price.gross,
35+
listAmount: product.list_price.gross,
3536
currency: product.currency
3637
}
3738
});

layouts/partials/supporter-cert-funder.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
<legend class="label-uppercase mb-2">{{ i18n "supporter_cert_funder_price" }}</legend>
66
<div class="grid grid-cols-3 gap-2 mb-2">
77
<template x-for="(price, index) in checkoutData.prices">
8-
<label :class="{'border-gray-300 hover:border-primary': checkoutData.selectedPriceIndex != index, 'border-primary bg-primary text-white': checkoutData.selectedPriceIndex == index}" class="flex items-center justify-center rounded-sm px-3 py-2 cursor-pointer border focus:ring-0 focus:border-secondary" @click="checkoutData.selectedPriceIndex = index">
8+
<label :class="{'border-gray-300 hover:border-primary': checkoutData.selectedPriceIndex != index, 'border-primary bg-primary text-white': checkoutData.selectedPriceIndex == index}" class="relative flex items-center justify-center rounded-sm px-3 py-2 cursor-pointer border focus:ring-0 focus:border-secondary" @click="checkoutData.selectedPriceIndex = index">
99
<input x-model="price.productId" type="radio" name="price-option" class="sr-only" :aria-labelledby="`price-option-${index}-label`">
1010
<span x-text="price.amount ? price.amount.toLocaleString('{{ .Site.Language.Lang }}', { style: 'currency', currency: price.currency }) : '…'" :id="`price-option-${index}-label`"></span>
11+
<span x-show="price.amount != price.listAmount" class="absolute top-0 left-0 -translate-2 -rotate-5 px-1 rounded-xs text-xs text-white bg-red-600 z-10">-<span x-text="((1 - price.amount / price.listAmount) * 100).toFixed(0)"></span>%</span>
1112
</label>
1213
</template>
1314
</div>

0 commit comments

Comments
 (0)