Add row to create new transaction
This commit is contained in:
parent
e138c264ea
commit
cc58c0d012
@ -13,6 +13,7 @@ type AccountData struct {
|
||||
Account *postgres.Account
|
||||
Categories []postgres.GetCategoriesRow
|
||||
Transactions []postgres.GetTransactionsForAccountRow
|
||||
Payees []postgres.Payee
|
||||
}
|
||||
|
||||
func (h *Handler) account(c *gin.Context) {
|
||||
@ -43,11 +44,18 @@ func (h *Handler) account(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
payees, err := h.Service.GetPayees(c.Request.Context(), data.Budget.ID)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusNotFound, err)
|
||||
return
|
||||
}
|
||||
|
||||
d := AccountData{
|
||||
data,
|
||||
&account,
|
||||
categories,
|
||||
transactions,
|
||||
payees,
|
||||
}
|
||||
|
||||
c.HTML(http.StatusOK, "account.html", d)
|
||||
|
@ -12,6 +12,41 @@
|
||||
<span class="time"></span>
|
||||
</div>
|
||||
<table class="container col-lg-12" id="content">
|
||||
<form id="newtransactionform" action="/api/v1/transaction/new" method="POST">
|
||||
<td>
|
||||
<input type="hidden" name="account_id" value="{{.Account.ID}}" />
|
||||
<input type="date" name="date" class="form-control" value="{{now.Format "2006-01-02"}}" />
|
||||
</td>
|
||||
<td>
|
||||
{{.Account.Name}}
|
||||
</td>
|
||||
<td>
|
||||
<input list="payees" name="payee_id" class="form-control">
|
||||
<datalist id="payees">
|
||||
<option value="">-- none --</option>
|
||||
{{range .Payees}}
|
||||
<option data-value="{{.ID}}">{{.Name}}</option>
|
||||
{{- end}}
|
||||
</datalist>
|
||||
</td>
|
||||
<td>
|
||||
<input list="categories" name="category_id" class="form-control">
|
||||
<datalist id="categories">
|
||||
<option value="">-- none --</option>
|
||||
{{range .Categories}}
|
||||
<option data-value="{{.ID}}">{{.Group}} : {{.Name}}</option>
|
||||
{{- end}}
|
||||
</select>
|
||||
</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<input type="text" name="memo" class="form-control" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="amount" class="form-control" placeholder="0.00" />
|
||||
<input type="submit" class="btn btn-primary" name="create" value="Create" class="form-control" />
|
||||
</td>
|
||||
</form>
|
||||
{{range .Transactions}}
|
||||
<tr class="{{if .Date.After now}}future{{end}}">
|
||||
<td>{{.Date.Format "02.01.2006"}}</td>
|
||||
|
Loading…
x
Reference in New Issue
Block a user