udemy-go-web-2/cmd/web/templates/sale.page.gohtml

42 lines
1.4 KiB
Plaintext
Raw Normal View History

2024-08-22 12:33:36 +00:00
{{ template "base" . }}
{{ define "title" }}
{{ index .StringMap "title" }}
{{ end }}
{{ define "content" }}
2024-08-21 21:43:16 +00:00
<h2 class="mt-5">Sale</h2>
2024-08-22 19:34:58 +00:00
<span id="refunded" class="badge bg-danger d-none">{{index .StringMap "refund-badge"}}</span>
2024-08-22 12:33:36 +00:00
<span id="charged" class="badge bg-success d-none">Charged</span>
2024-08-21 21:43:16 +00:00
<hr>
2024-08-22 12:33:36 +00:00
<div class="alert alert-danger text-center d-none" id="messages"></div>
2024-08-22 07:56:14 +00:00
<div>
2024-08-22 12:33:36 +00:00
<strong>Order No:</strong> <span id="order-no"></span>
<br>
<strong>Customer:</strong> <span id="customer"></span>
<br>
<strong>Product:</strong> <span id="product"></span>
<br>
<strong>Quantity:</strong> <span id="quantity"></span>
<br>
<strong>Total Sale:</strong> <span id="amount"></span>
<br>
2024-08-22 07:56:14 +00:00
</div>
<hr>
2024-08-22 12:33:36 +00:00
<a href='{{ index .StringMap "cancel" }}' class="btn btn-info">Cancel</a>
2024-08-22 19:34:58 +00:00
<a id="refund-btn" href="#!" class="btn btn-warning d-none">{{index .StringMap "refund-btn"}}</a>
2024-08-22 12:05:46 +00:00
<input type="hidden" id="pi" value="">
<input type="hidden" id="charge-amount" value="">
<input type="hidden" id="currency" value="">
2024-08-22 12:33:36 +00:00
{{ end }}
{{ define "js" }}
2024-08-22 12:05:46 +00:00
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
2024-08-21 21:43:16 +00:00
<script type="module">
2024-08-22 12:05:46 +00:00
import {showInfo, refund} from "/static/js/sale.js"
2024-08-21 21:43:16 +00:00
showInfo({{.API}});
2024-08-22 19:34:58 +00:00
const api = {{.API}} + {{index .StringMap "refund-url"}}
2024-08-22 12:05:46 +00:00
document.getElementById("refund-btn").addEventListener("click", function(event) {
2024-08-22 19:34:58 +00:00
refund(api, {{index .IntMap "is-refund"}});
2024-08-22 12:05:46 +00:00
});
2024-08-21 21:43:16 +00:00
</script>
2024-08-22 12:33:36 +00:00
{{ end }}