mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 22:44:29 +01:00
Making Currency a textbox instead of dropdown
This commit is contained in:
@@ -778,7 +778,6 @@ namespace BTCPayServer.Controllers
|
||||
public IActionResult PayButton()
|
||||
{
|
||||
var store = StoreData;
|
||||
var currencyDropdown = supportedCurrencies(store);
|
||||
|
||||
var appUrl = HttpContext.Request.GetAbsoluteRoot().WithTrailingSlash();
|
||||
var model = new PayButtonViewModel
|
||||
@@ -787,23 +786,12 @@ namespace BTCPayServer.Controllers
|
||||
Currency = DEFAULT_CURRENCY,
|
||||
ButtonSize = 2,
|
||||
UrlRoot = appUrl,
|
||||
CurrencyDropdown = currencyDropdown,
|
||||
PayButtonImageUrl = appUrl + "img/paybutton/pay.png",
|
||||
StoreId = store.Id
|
||||
};
|
||||
return View(model);
|
||||
}
|
||||
|
||||
private List<string> supportedCurrencies(StoreData store)
|
||||
{
|
||||
var paymentMethods = store.GetSupportedPaymentMethods(_NetworkProvider)
|
||||
.Select(a => a.PaymentId.ToString()).ToList();
|
||||
var currencyDropdown = new List<string>();
|
||||
currencyDropdown.Add(DEFAULT_CURRENCY);
|
||||
currencyDropdown.AddRange(paymentMethods);
|
||||
return currencyDropdown;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("{storeId}/pay")]
|
||||
[IgnoreAntiforgeryToken]
|
||||
@@ -816,11 +804,6 @@ namespace BTCPayServer.Controllers
|
||||
if (model.Price <= 0)
|
||||
ModelState.AddModelError("Price", "Price must be greater than 0");
|
||||
|
||||
var curr = supportedCurrencies(store);
|
||||
if (!curr.Contains(model.Currency))
|
||||
ModelState.AddModelError("Currency", $"Selected currency {model.Currency} is not supported in this store");
|
||||
//
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
return View();
|
||||
|
||||
|
||||
@@ -17,12 +17,9 @@
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label> </label>
|
||||
<select class="form-control" v-model="srvModel.currency" v-on:change="inputChanges">
|
||||
@foreach (var item in Model.CurrencyDropdown)
|
||||
{
|
||||
<option>@item</option>
|
||||
}
|
||||
</select>
|
||||
<input name="price" type="text" class="form-control"
|
||||
v-model="srvModel.currency" v-on:change="inputChanges"
|
||||
:class="{'is-invalid': errors.has('currency') }">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
Reference in New Issue
Block a user