Currency dropdown as part of page model

This commit is contained in:
rockstardev 2018-08-14 23:47:41 +02:00
parent 4afd55c441
commit b562094956
4 changed files with 20 additions and 4 deletions

View File

@ -290,13 +290,21 @@ namespace BTCPayServer.Controllers
return NotFound();
var settings = app.GetSettings<PointOfSaleSettings>();
var store = await GetStore(app);
var paymentMethods = store.GetSupportedPaymentMethods(_NetworkProvider)
.Select(a=>a.PaymentId.ToString()).ToList();
var currencyDropdown = new List<string>();
currencyDropdown.Add(settings.Currency);
currencyDropdown.AddRange(paymentMethods);
var model = new PayButtonViewModel
{
Price = 10,
Currency = settings.Currency,
ButtonSize = 2,
UrlRoot = "http://127.0.0.1:14142"
UrlRoot = "http://127.0.0.1:14142",
CurrencyDropdown = currencyDropdown
};
return View(model);
}

View File

@ -24,6 +24,7 @@ namespace BTCPayServer.Controllers
UserManager<ApplicationUser> _UserManager;
CurrencyNameTable _Currencies;
InvoiceController _InvoiceController;
BTCPayNetworkProvider _NetworkProvider;
[TempData]
public string StatusMessage { get; set; }
@ -32,12 +33,14 @@ namespace BTCPayServer.Controllers
UserManager<ApplicationUser> userManager,
ApplicationDbContextFactory contextFactory,
CurrencyNameTable currencies,
InvoiceController invoiceController)
InvoiceController invoiceController,
BTCPayNetworkProvider networkProvider)
{
_InvoiceController = invoiceController;
_UserManager = userManager;
_ContextFactory = contextFactory;
_Currencies = currencies;
_NetworkProvider = networkProvider;
}
public async Task<IActionResult> ListApps()
{

View File

@ -18,5 +18,6 @@ namespace BTCPayServer.Models.AppViewModels
//
public string UrlRoot { get; set; }
public List<string> CurrencyDropdown { get; set; }
}
}

View File

@ -22,8 +22,12 @@
</div>
<div class="form-group col-md-4">
<label>&nbsp;</label>
<input type="text" class="form-control"
v-model="srvModel.currency" v-on:change="inputChanges">
<select class="form-control" v-model="srvModel.currency" v-on:change="inputChanges">
@foreach(var item in Model.CurrencyDropdown)
{
<option>@item</option>
}
</select>
</div>
</div>
<div class="form-group">