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"); form.classList.add("was-validated");
hidePayButton(); hidePayButton();
let amountToCharge = String(parseFloat(document.getElementById("amount").value)); let amountToCharge = parseFloat(document.getElementById("amount").value);
let payload = { let payload = {
amount: amountToCharge, amount: amountToCharge,
currency: 'eur', currency: 'eur',

View File

@ -16,9 +16,9 @@ Virtual Terminal
<div class="mb-3"> <div class="mb-3">
<label for="amount" class="form-label">Amount</label> <label for="amount" class="form-label">Amount</label>
<input type="text" <input type="text"
id="amount" id="charge_amount"
name="amount" name="charge_amount"
autocomplete="amount-new" autocomplete="charge_amount-new"
required="" required=""
class="form-control"> class="form-control">
</div> </div>
@ -76,5 +76,14 @@ Virtual Terminal
</form> </form>
{{ end }} {{ end }}
{{ define "js" }} {{ 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" . }} {{ template "stripe-js" . }}
{{ end }} {{ end }}