mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-20 10:40:29 +01:00
88c931ec13
* Make wallet able to send to multiple destinations * fix tests * update e2e tests * fix e2e part 2 * make headless again * pr changes * make wallet look exactly as old one when only 1 dest
48 lines
1.5 KiB
JavaScript
48 lines
1.5 KiB
JavaScript
function updateFiatValue(element) {
|
|
|
|
if (!element) {
|
|
element = $(this);
|
|
}
|
|
var rateStr = $("#Rate").val();
|
|
var divisibilityStr = $("#Divisibility").val();
|
|
var fiat = $("#Fiat").val();
|
|
var rate = parseFloat(rateStr);
|
|
var divisibility = parseInt(divisibilityStr);
|
|
if (!isNaN(rate) && !isNaN(divisibility)) {
|
|
var fiatValue = $(element).parents(".input-group").first().find(".fiat-value");
|
|
var amountValue = parseFloat($(element).val());
|
|
if (!isNaN(amountValue)) {
|
|
fiatValue.show();
|
|
fiatValue.text("= " + (rate * amountValue).toFixed(divisibility) + " " + fiat);
|
|
} else {
|
|
fiatValue.text("");
|
|
}
|
|
}
|
|
}
|
|
|
|
function updateFiatValueWithCurrentElement() {
|
|
updateFiatValue($(this))
|
|
}
|
|
|
|
$(function () {
|
|
|
|
|
|
$(".output-amount").on("input", updateFiatValueWithCurrentElement).each(updateFiatValueWithCurrentElement);
|
|
|
|
$("#crypto-fee-link").on("click", function (elem) {
|
|
var val = $(this).text();
|
|
$("#FeeSatoshiPerByte").val(val);
|
|
return false;
|
|
});
|
|
|
|
$(".crypto-balance-link").on("click", function (elem) {
|
|
var val = $(this).text();
|
|
var parentContainer = $(this).parents(".transaction-output-form");
|
|
var outputAmountElement = parentContainer.find(".output-amount");
|
|
outputAmountElement.val(val);
|
|
parentContainer.find(".subtract-fees").prop('checked', true);
|
|
updateFiatValue(outputAmountElement);
|
|
return false;
|
|
});
|
|
});
|