finance-consumer/bookkeeper/templates/tx.html.j2
2025-02-10 22:40:23 +08:00

76 lines
3.9 KiB
Django/Jinja

<div class="box">
<form action="{{ target }}" method="post">
<div class="field">
<label class="label" for="code">代码</label>
<div class="control">
<input id="code" name="code" class="input" type="number" placeholder="Code" value="{{ r.code or 0 }}">
</div>
</div>
<div class="field">
<label class="label" for="name">名称</label>
<div class="control">
<input id="name" name="name" class="input" type="text" placeholder="Name" value="{{ r.name or '' }}">
</div>
</div>
<table class="table is-fullwidth is-bordered">
<thead>
<tr>
<th><label class="label" for="date">买入日期</label></th>
<th><label class="label" for="buy">买入价</label></th>
<th><label class="label" for="volume">成交量(买)</label></th>
<th><label class="label" for="net_buy">实际买入</label></th>
</tr>
</thead>
<tbody>
<tr>
<td><input id="date" name="date" class="input" type="date" placeholder="YYYY-MM-DD" value="{{ r.date or '' }}"></td>
<td><input id="buy" name="buy" class="input" type="text" placeholder="Buy" value="{{ r.buy or 0 }}"></td>
<td><input id="volume" name="volume" class="input" type="number" placeholder="Volume" value="{{ r.volume or 0 }}"></td>
<td><input id="net_buy" name="net_buy" class="input" type="text" placeholder="Net Buy" value="{{ r.net_buy or 0 }}"></td>
</tr>
</tbody>
</table>
<table class="table is-fullwidth is-bordered">
<thead>
<tr>
<th><label class="label">卖出日期</label></th>
<th><label class="label">卖出价</label></th>
<th><label class="label">成交量</label></th>
<th><label class="label">实际卖出</label></th>
<th style="min-width: 4rem; vertical-align: middle;">操作</th>
</tr>
</thead>
<tbody>
{% if r.split_pieces %}
{% for split in r.split_pieces %}
<tr>
<td><input name="split_pieces[{{ loop.index0 }}].date" class="input" type="date" placeholder="YYYY-MM-DD" value="{{ split.date or '' }}"></td>
<td><input name="split_pieces[{{ loop.index0 }}].sell" class="input" type="text" placeholder="Sell" value="{{ split.sell or '' }}"></td>
<td><input name="split_pieces[{{ loop.index0 }}].volume" class="input" type="number" placeholder="Volume" value="{{ split.volume or '' }}"></td>
<td><input name="split_pieces[{{ loop.index0 }}].net_sell" class="input" type="text" placeholder="Net Sell" value="{{ split.net_sell or '' }}"></td>
<td><a onclick="deleteRow(this)">删除</a></td>
</tr>
{% endfor %}
{% else %}
<tr>
<td><input name="split_pieces[0].date" class="input" type="date" placeholder="YYYY-MM-DD"></td>
<td><input name="split_pieces[0].sell" class="input" type="text" placeholder="Sell"></td>
<td><input name="split_pieces[0].volume" class="input" type="number" placeholder="Volume"></td>
<td><input name="split_pieces[0].net_sell" class="input" type="text" placeholder="Net Sell"></td>
<td style="vertical-align: middle;"><a onclick="deleteRow(this)">删除</a></td>
</tr>
{% endif %}
<tr class="is-light" id="add-row-line">
<td colspan="5" style="text-align: center"><a onclick="addRow()">添加</a></td>
</tr>
</tbody>
</table>
<div class="field is-grouped">
<div class="control">
<button class="button is-link">Submit</button>
</div>
</div>
</form>
</div>