cancel subscription

This commit is contained in:
2024-08-22 21:34:58 +02:00
parent 059638f3a7
commit c697da63b9
9 changed files with 115 additions and 34 deletions

View File

@ -14,6 +14,7 @@ All Subscriptions
<th>Customer</th>
<th>Product</th>
<th>Amount</th>
<th>Status</th>
</tr>
</thead>
<tbody>

View File

@ -4,7 +4,7 @@
{{ end }}
{{ define "content" }}
<h2 class="mt-5">Sale</h2>
<span id="refunded" class="badge bg-danger d-none">Refunded</span>
<span id="refunded" class="badge bg-danger d-none">{{index .StringMap "refund-badge"}}</span>
<span id="charged" class="badge bg-success d-none">Charged</span>
<hr>
<div class="alert alert-danger text-center d-none" id="messages"></div>
@ -22,7 +22,7 @@
</div>
<hr>
<a href='{{ index .StringMap "cancel" }}' class="btn btn-info">Cancel</a>
<a id="refund-btn" href="#!" class="btn btn-warning d-none">Refund Order</a>
<a id="refund-btn" href="#!" class="btn btn-warning d-none">{{index .StringMap "refund-btn"}}</a>
<input type="hidden" id="pi" value="">
<input type="hidden" id="charge-amount" value="">
<input type="hidden" id="currency" value="">
@ -32,8 +32,10 @@
<script type="module">
import {showInfo, refund} from "/static/js/sale.js"
showInfo({{.API}});
const api = {{.API}} + {{index .StringMap "refund-url"}}
document.getElementById("refund-btn").addEventListener("click", function(event) {
refund({{.API}});
refund(api, {{index .IntMap "is-refund"}});
});
</script>
{{ end }}