fix incoherence of amount between pages

This commit is contained in:
vinchent 2024-08-07 12:17:26 +02:00
parent 6d4b8236a5
commit 625929cf25
2 changed files with 13 additions and 4 deletions

View File

@ -46,7 +46,7 @@ function val() {
form.classList.add("was-validated");
hidePayButton();
let amountToCharge = String(parseFloat(document.getElementById("amount").value));
let amountToCharge = parseFloat(document.getElementById("amount").value);
let payload = {
amount: amountToCharge,
currency: 'eur',

View File

@ -16,9 +16,9 @@ Virtual Terminal
<div class="mb-3">
<label for="amount" class="form-label">Amount</label>
<input type="text"
id="amount"
name="amount"
autocomplete="amount-new"
id="charge_amount"
name="charge_amount"
autocomplete="charge_amount-new"
required=""
class="form-control">
</div>
@ -76,5 +76,14 @@ Virtual Terminal
</form>
{{ end }}
{{ define "js" }}
<script>
document.getElementById("charge_amount", function(evt) {
if (evt.target.value !== "") {
document.getElementById("amount").value = evt.target.value * 100;
} else {
document.getElementById("amount").value = 0;
}
});
</script>
{{ template "stripe-js" . }}
{{ end }}