Fix Crowdfund + additional issues (#3994)

* Show free when invoice is fixed and 0 amount in apps
* animations on crowdfund not enabled broke JS
* Perk expansion in crowdfund was broken
This commit is contained in:
Andrew Camilleri
2022-07-22 13:30:39 +02:00
committed by GitHub
parent d016f59867
commit 6fbcc9a244
4 changed files with 40 additions and 22 deletions

View File

@@ -94,12 +94,23 @@
@functions {
private void PayFormInputContent(string buttonText,ViewPointOfSaleViewModel.Item.ItemPrice.ItemPriceType itemPriceType, decimal? minPriceValue = null, decimal? priceValue = null)
{
<div class="input-group">
<span class="input-group-text">@Model.CurrencySymbol</span>
<input type="hidden" name="requiresRefundEmail" value="@Model.RequiresRefundEmail.ToString()" />
<input class="form-control" type="number" min="@(minPriceValue ?? 0)" step="@Model.Step" name="amount" placeholder="Amount" value="@priceValue" readonly="@(itemPriceType == ViewPointOfSaleViewModel.Item.ItemPrice.ItemPriceType.Fixed)">
<button class="btn btn-primary text-nowrap" type="submit">@buttonText</button>
</div>
if (itemPriceType == ViewPointOfSaleViewModel.Item.ItemPrice.ItemPriceType.Fixed && priceValue == 0)
{
<div class="input-group ">
<input class="form-control" type="text" readonly value="Free"/>
<button class="btn btn-primary text-nowrap" type="submit">@buttonText</button>
</div>
}
else
{
<div class="input-group">
<span class="input-group-text">@Model.CurrencySymbol</span>
<input type="hidden" name="requiresRefundEmail" value="@Model.RequiresRefundEmail.ToString()" />
<input class="form-control" type="number" min="@(minPriceValue ?? 0)" step="@Model.Step" name="amount" placeholder="Amount" value="@priceValue" readonly="@(itemPriceType == ViewPointOfSaleViewModel.Item.ItemPrice.ItemPriceType.Fixed)">
<button class="btn btn-primary text-nowrap" type="submit">@buttonText</button>
</div>
}
}
private void CardBody(string title, string description)

View File

@@ -337,7 +337,10 @@
{{targetCurrency}}
<template v-if="perk.price.type == 1">or more</template>
</template>
<template v-else-if="perk.price.type === 2 && !perk.price.value">
Free
</template>
<template v-else-if="perk.price.type === 0 || (!perk.price.value && perk.price.type === 1)">
Any amount
</template>
@@ -346,19 +349,21 @@
<p class="card-text overflow-hidden" v-if="perk.description" v-html="perk.description"></p>
<div class="input-group" style="max-width:500px;" v-else-if="expanded" :id="'perk-form'+ perk.id">
<input
v-if="perk.price.type !== 0"
:disabled="!active"
:readonly="perk.price.type !== 1"
class="form-control hide-number-spin"
type="number"
v-model="amount"
:min="perk.price.value"
step="any"
placeholder="Contribution Amount"
required>
<span class="input-group-text" v-if="perk.price.type !== 0">{{targetCurrency}}</span>
<div class="input-group" style="max-width:500px;" v-if="expanded" :id="'perk-form'+ perk.id">
<template v-if="perk.price.type !== 0 && !(perk.price.type === 2 && !perk.price.value)">
<input
:disabled="!active"
:readonly="perk.price.type !== 1"
class="form-control hide-number-spin"
type="number"
v-model="amount"
:min="perk.price.value"
step="any"
placeholder="Contribution Amount"
required>
<span class="input-group-text" >{{targetCurrency}}</span>
</template>
<button
class="btn btn-primary d-flex align-items-center "
v-bind:class="{ 'btn-disabled': loading}"

View File

@@ -28,7 +28,9 @@ document.addEventListener("DOMContentLoaded",function (ev) {
},
computed: {
canExpand: function(){
return !this.expanded && this.active && (this.perk.price.type !== 2 || this.perk.price.value) && (this.perk.inventory==null || this.perk.inventory > 0)
return !this.expanded
&& this.active &&
(this.perk.inventory==null || this.perk.inventory > 0)
}
},
methods: {

View File

@@ -1,6 +1,6 @@
document.addEventListener("DOMContentLoaded",function (ev) {
var c = document.getElementById("fireworks");
if (!c.getContext) return;
if (!c || !c.getContext) return;
var ctx = c.getContext("2d");
if (!ctx) return;