Update the Widget page to use data passed to the template

This commit is contained in:
vinchent 2024-08-06 20:49:21 +02:00
parent 30976a55e8
commit 20f7bd529f

View File

@ -3,6 +3,7 @@
Buy one widget Buy one widget
{{ end }} {{ end }}
{{ define "content" }} {{ define "content" }}
{{$widget := index .Data "widget"}}
<h2 class="mt-3 text-center">Buy One Widget</h2> <h2 class="mt-3 text-center">Buy One Widget</h2>
<hr> <hr>
<img src="/static/img/widget.jpeg" <img src="/static/img/widget.jpeg"
@ -17,15 +18,12 @@ Buy one widget
class="d-blick needs-validation charge-form" class="d-blick needs-validation charge-form"
autocomplete="off" autocomplete="off"
novalidate=""> novalidate="">
<div class="mb-3"> <input type="hidden" name="product_id" value="{{$widget.ID}}">
<label for="amount" class="form-label">Amount</label> <input type="hidden" name="amount" value="{{$widget.Price}}">
<input type="text" <h3 class="mt-2 mb-3 text-center">{{$widget.Name}}: {{$widget.Price}}</h3>
id="amount" <p class="mt-2 mb-3 text-center">{{$widget.Description}}</p>
name="amount" <hr>
autocomplete="amount-new"
required=""
class="form-control">
</div>
<div class="mb-3"> <div class="mb-3">
<label for="cardholder-name" class="form-label">Cardholder Name</label> <label for="cardholder-name" class="form-label">Cardholder Name</label>
<input type="text" <input type="text"