mirror of
https://codeberg.org/metamuffin/abrechenbarkeit.git
synced 2024-12-29 16:14:36 +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:flush()
|
||||||
log:close()
|
log:close()
|
||||||
return string.format([[
|
return string.format([[
|
||||||
<div class=\"notif\"><p>Transaction successful: <strong class=\"amount-%s\">%.02f€</strong> (%s)</p></div>
|
<div class="notif"><p>Transaction successful: <strong class="amount-%s">%.02f€</strong> (%s)</p></div>
|
||||||
<audio src="%s" autoplay></audio>
|
<audio src="%s" autoplay></audio>
|
||||||
]],
|
]],
|
||||||
amount >= 0 and "pos" or "neg", amount / 100,
|
amount >= 0 and "pos" or "neg", amount / 100,
|
||||||
escape(comment),
|
escape(comment),
|
||||||
config.transaction_sound or ""
|
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>")
|
print("<tr><th>Time</th><th>Username</th><th>Amount</th><th>Comment</th></tr>")
|
||||||
for time, username, amount, comment in read_log() do
|
for time, username, amount, comment in read_log() do
|
||||||
if filter == nil or filter == username then
|
if filter == nil or filter == username then
|
||||||
print(string.format(
|
print(string.format([[
|
||||||
"<tr><td>%d (%s ago)</td><td>%s</td><td class=\"amount-%s\">%.02f€</td><td>%s</td></tr>",
|
<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),
|
time, format_duration(os.time() - time),
|
||||||
escape(username),
|
escape(username),
|
||||||
amount >= 0 and "pos" or "neg", amount / 100,
|
amount >= 0 and "pos" or "neg", amount / 100,
|
||||||
|
escape(comment),
|
||||||
|
escape(username),
|
||||||
|
-amount,
|
||||||
escape(comment)
|
escape(comment)
|
||||||
))
|
))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue