加入來源帳戶選項
This commit is contained in:
@@ -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 }}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{ define "scripts" }}
|
||||
<h3>常用指令</h3>
|
||||
<h3>快速查詢</h3>
|
||||
<ul>
|
||||
{{ range $k, $v := . }}
|
||||
<li><a href="/query?query={{ urlquery $v }}">{{ $k }}</a></li>
|
||||
|
||||
11
tx.go
11
tx.go
@@ -9,11 +9,12 @@ import (
|
||||
)
|
||||
|
||||
type TxData struct {
|
||||
Action string `form:"action" binding:"required"`
|
||||
Name string `form:"name"`
|
||||
Date string
|
||||
Amount string `form:"amount" binding:"required"`
|
||||
Account string `form:"account"`
|
||||
Action string `form:"action" binding:"required"`
|
||||
Name string `form:"name"`
|
||||
Date string
|
||||
Amount string `form:"amount" binding:"required"`
|
||||
Destination string `form:"dest"`
|
||||
Source string `form:"src"`
|
||||
}
|
||||
|
||||
func newTx(data TxData) (result string, err error) {
|
||||
|
||||
@@ -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 }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user