-
由 zhou liang 创作于89db5047
cart.html 9.25 KiB
{{ define "cart" }}
{{ template "header" . }}
<div {{ with $.platform_css }} class="{{.}}" {{ end }}>
<span class="platform-flag">
{{$.platform_name}}
</span>
</div>
<main role="main" class="cart">
<div class="cart-bg">
<div class="container py-3 px-lg-5 py-lg-5">
{{ if eq (len $.items) 0 }}
<h3>Your shopping cart is empty!</h3>
<p>Items you add to your shopping cart will appear here.</p>
<a class="btn btn-info" href="/" role="button">Browse Products → </a>
{{ else }}
<div class="row mb-3 py-2">
<div class="col">
<h3>{{ $.cart_size }} item
{{- if gt ($.cart_size) 1}}s{{end}}
in your cart</h3>
</div>
<div class="col text-right">
<form method="POST" action="/cart/empty">
<button class="btn btn-secondary empty-btn" type="submit">Empty cart</button>
<a class="btn btn-info" href="/" role="button">Keep browsing</a>
</form>
</div>
</div>
{{ range $.items }}
<div class="product-item">
<div class="row pt-2 mb-2">
<div class="col text-right image">
<a href="/product/{{.Item.Id}}"><img class="img-fluid"
src="{{.Item.Picture}}" /></a>
</div>
<div class="col text-left text">
<h4>{{ .Item.Name }}</h4>
<p><small class="text-muted">SKU: #{{ .Item.Id }}</small></p>
<div class="details">
Quantity: {{ .Quantity }}<br/>
<strong>
{{ renderMoney .Price }}
</strong>
</div>
</div>
</div>
</div>
{{ end }}
<div class="row pt-2 my-3">
<div class="col text-center order-summary">
<p class="text-muted my-0">Shipping Cost: <strong>{{ renderMoney .shipping_cost }}</strong></p>
Total Cost: <strong>{{ renderMoney .total_cost }}</strong>
</div>
</div>
<div class="row py-3 my-2 checkout">
<div class="col-12 col-lg-8 offset-lg-2">
<h3 class="text-center">Checkout</h3>
<form action="/cart/checkout" method="POST">
<div class="form-row">
<div class="col-md-5 mb-3">
<label for="email">E-mail Address</label>
<input type="email" class="form-control" id="email"
name="email" value="someone@example.com" required>
</div>
<div class="col-md-5 mb-3">
<label for="street_address">Street Address</label>