shop.tonybtw.com

shop.tonybtw.com

https://git.tonybtw.com/shop.tonybtw.com.git git://git.tonybtw.com/shop.tonybtw.com.git
998 bytes raw
1
package views
2
3
import (
4
	"fmt"
5
	"shop.tonybtw.com/internal/models"
6
)
7
8
templ Checkout(items []models.Cart_Item_Detail, total int, csrf_token string, cart_count int) {
9
	@Layout("Checkout") {
10
		<h1>Checkout</h1>
11
		<div class="checkout-summary">
12
			<h2>Order Summary</h2>
13
			<table class="cart-table">
14
				<tbody>
15
					for _, item := range items {
16
						<tr>
17
							<td>{ item.Name } ({ item.Size })</td>
18
							<td>x{ templ.EscapeString(fmt.Sprintf("%d", item.Quantity)) }</td>
19
							<td>{ Format_Price(item.Subtotal) }</td>
20
						</tr>
21
					}
22
				</tbody>
23
				<tfoot>
24
					<tr>
25
						<td colspan="2"><strong>Total</strong></td>
26
						<td><strong>{ Format_Price(total) }</strong></td>
27
					</tr>
28
				</tfoot>
29
			</table>
30
		</div>
31
		<p>You'll be redirected to Stripe to complete your purchase.</p>
32
		<form action="/checkout/create" method="POST">
33
			<input type="hidden" name="csrf_token" value={ csrf_token }/>
34
			<button type="submit" class="btn-primary">Continue to Payment</button>
35
		</form>
36
	}
37
}