mirror of
https://codeberg.org/metamuffin/abrechenbarkeit.git
synced 2025-05-22 22:34:46 +00:00
Add print button
This commit is contained in:
parent
ee7987599e
commit
3b5948682a
2 changed files with 154 additions and 146 deletions
|
@ -114,6 +114,8 @@ local translations = load_translations({ "en", config.language })
|
|||
local stylesheet = io.open("style.css"):read("a")
|
||||
local script = io.open("script.js"):read("a")
|
||||
|
||||
local can_print = false
|
||||
|
||||
local function format(template, params)
|
||||
params = params or {}
|
||||
if template == nil then return "NIL TEMPLATE" end
|
||||
|
@ -225,6 +227,7 @@ local function respond(status, title, body)
|
|||
<a href="/?spus">{+spus}</a>
|
||||
<a href="/?products">{+products}</a>
|
||||
<a href="/?log">{+log}</a>
|
||||
{print_button}
|
||||
<a href="/?about">{+about}</a>
|
||||
</nav>
|
||||
]], {
|
||||
|
@ -232,7 +235,9 @@ local function respond(status, title, body)
|
|||
style = stylesheet,
|
||||
user_style = get_user_theme(path and path:sub(2)),
|
||||
script = script,
|
||||
head_extra = config.head_extra or ""
|
||||
head_extra = config.head_extra or "",
|
||||
print_button = can_print and
|
||||
[[<script>document.write('<a href="javascript:print()" style="float:right;">{+print}</a>')</script>]] or ""
|
||||
}))
|
||||
if config.header ~= nil then
|
||||
print(config.header)
|
||||
|
@ -591,6 +596,7 @@ local function r_log(filter)
|
|||
if method == "POST" then
|
||||
notif = r_transaction_post()
|
||||
end
|
||||
can_print = true
|
||||
return respond(200, "Abrechnungen", function()
|
||||
if notif then print(notif) end
|
||||
print([[<table class="log"]])
|
||||
|
@ -874,6 +880,7 @@ local function r_products()
|
|||
if method == "POST" then
|
||||
notif = r_products_post()
|
||||
end
|
||||
can_print = true
|
||||
respond(200, "Abrechenbare Product List", function()
|
||||
print(format("<h1>{+products.title}</h1>"))
|
||||
if notif then print(notif) end
|
||||
|
|
|
@ -79,3 +79,4 @@ error.open_barcodes=Failed to open barcodes file
|
|||
error.no_path=No path
|
||||
users.inactive_list=Inactive Users
|
||||
users.embezzlement=A total of {amount} are currently under embezzlement.
|
||||
print=Print
|
Loading…
Add table
Reference in a new issue