mirror of
https://codeberg.org/metamuffin/abrechenbarkeit.git
synced 2024-12-29 00:04:35 +00:00
revert txn from log
This commit is contained in:
parent
82e7646230
commit
efd2e6c80e
1 changed files with 21 additions and 5 deletions
|
@ -204,9 +204,9 @@ local function r_user_post(username)
|
|||
log:flush()
|
||||
log:close()
|
||||
return string.format([[
|
||||
<div class=\"notif\"><p>Transaction successful: <strong class=\"amount-%s\">%.02f€</strong> (%s)</p></div>
|
||||
<audio src="%s" autoplay></audio>
|
||||
]],
|
||||
<div class="notif"><p>Transaction successful: <strong class="amount-%s">%.02f€</strong> (%s)</p></div>
|
||||
<audio src="%s" autoplay></audio>
|
||||
]],
|
||||
amount >= 0 and "pos" or "neg", amount / 100,
|
||||
escape(comment),
|
||||
config.transaction_sound or ""
|
||||
|
@ -277,11 +277,27 @@ local function r_log(filter)
|
|||
print("<tr><th>Time</th><th>Username</th><th>Amount</th><th>Comment</th></tr>")
|
||||
for time, username, amount, comment in read_log() do
|
||||
if filter == nil or filter == username then
|
||||
print(string.format(
|
||||
"<tr><td>%d (%s ago)</td><td>%s</td><td class=\"amount-%s\">%.02f€</td><td>%s</td></tr>",
|
||||
print(string.format([[
|
||||
<tr>
|
||||
<td>%d (%s ago)</td>
|
||||
<td>%s</td>
|
||||
<td class=\"amount-%s\">%.02f€</td>
|
||||
<td>%s</td>
|
||||
<td>
|
||||
<form action="/%s" method="POST">
|
||||
<input type="number" name="amount" id="amount" value="%d" hidden />
|
||||
<input type="text" name="comment" id="comment" value="Revert %s" hidden />
|
||||
<input type="submit" value="Revert" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
]],
|
||||
time, format_duration(os.time() - time),
|
||||
escape(username),
|
||||
amount >= 0 and "pos" or "neg", amount / 100,
|
||||
escape(comment),
|
||||
escape(username),
|
||||
-amount,
|
||||
escape(comment)
|
||||
))
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue