加入來源帳戶選項

This commit is contained in:
Wancat
2022-11-05 00:21:44 +08:00
parent ae86204c84
commit 22229fc5bc
4 changed files with 17 additions and 15 deletions

View File

@@ -1,15 +1,16 @@
{{ define "main" }}
<h1>Ledger Quick Note</h1>
<h1>Ledger 速記</h1>
<form action="/new" method="POST">
<label>Action:
<label>選擇模板:
{{ range .Templates }}
<input type="radio" name="action" value="{{ .Name }}">{{ .Name }}</option>
{{ end }}
</label><br>
<label>Amount: <input name="amount" type="number"></label><br>
<label>Account: <input name="account" type="text"></label></br>
<label>Tx Name: <input name="name" type="text"></label></br>
<input type="submit">
<label>金額:<input name="amount" type="number"></label><br>
<label>目的帳戶:<input name="dest" type="text"></label></br>
<label>來源帳戶:<input name="src" type="text"></label></br>
<label>名稱:<input name="name" type="text"></label></br>
<input type="submit" value="新增記錄">
</form>
{{ template "scripts" .Scripts }}
{{ end }}

View File

@@ -1,5 +1,5 @@
{{ define "scripts" }}
<h3>常用指令</h3>
<h3>快速查詢</h3>
<ul>
{{ range $k, $v := . }}
<li><a href="/query?query={{ urlquery $v }}">{{ $k }}</a></li>

3
tx.go
View File

@@ -13,7 +13,8 @@ type TxData struct {
Name string `form:"name"`
Date string
Amount string `form:"amount" binding:"required"`
Account string `form:"account"`
Destination string `form:"dest"`
Source string `form:"src"`
}
func newTx(data TxData) (result string, err error) {

View File

@@ -1,4 +1,4 @@
{{ .Date }} {{ with .Name }}{{ . }}{{ else }}{{ .Account }}{{ end }}
{{ .Account }} ${{ .Amount }}
cash
{{ .Date }} {{ with .Name }}{{ . }}{{ else }}{{ .Destination }}{{ end }}
{{ .Destination }} ${{ .Amount }}
{{ with .Source }}{{ . }}{{ else }}cash{{ end }}