all subscriptions
This commit is contained in:
@ -522,9 +522,17 @@ func (app *application) ResetPassword(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (app *application) AllSales(w http.ResponseWriter, r *http.Request) {
|
||||
allSales, err := app.DB.GetAllOrders()
|
||||
allSales, err := app.DB.GetAllOrders(false)
|
||||
if err != nil {
|
||||
app.badRequest(w, r, err)
|
||||
}
|
||||
app.writeJSON(w, http.StatusOK, allSales)
|
||||
}
|
||||
|
||||
func (app *application) AllSubscriptions(w http.ResponseWriter, r *http.Request) {
|
||||
allSubscriptions, err := app.DB.GetAllOrders(true)
|
||||
if err != nil {
|
||||
app.badRequest(w, r, err)
|
||||
}
|
||||
app.writeJSON(w, http.StatusOK, allSubscriptions)
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ func (app *application) routes() http.Handler {
|
||||
|
||||
mux.Post("/virtual-terminal-succeeded", app.VirtualTerminalPaymentSucceeded)
|
||||
mux.Post("/all-sales", app.AllSales)
|
||||
mux.Post("/all-subscriptions", app.AllSubscriptions)
|
||||
})
|
||||
mux.Post("/api/forgot-password", app.SendPasswordResetEmail)
|
||||
mux.Post("/api/reset-password", app.ResetPassword)
|
||||
|
@ -1,6 +1,6 @@
|
||||
{{ template "base" . }}
|
||||
{{ define "title" }}
|
||||
All Subscriptions
|
||||
All Sales
|
||||
{{ end }}
|
||||
{{ define "content" }}
|
||||
<h2 class="mt-5">All Sales</h2>
|
||||
|
@ -7,7 +7,23 @@ All Subscriptions
|
||||
{{define "content"}}
|
||||
<h2 class="mt-5">All Subscriptions</h2>
|
||||
<hr>
|
||||
<table id="subscriptions-table" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Transaction</th>
|
||||
<th>Customer</th>
|
||||
<th>Product</th>
|
||||
<th>Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
{{end}}
|
||||
|
||||
{{define "js"}}
|
||||
<script type="module">
|
||||
import {showTable} from "/static/js/all-sales.js"
|
||||
showTable({{.API}});
|
||||
</script>
|
||||
{{end}}
|
||||
|
Reference in New Issue
Block a user